media/libvpx/vp9/common/vp9_reconinter.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license
michael@0 5 * that can be found in the LICENSE file in the root of the source
michael@0 6 * tree. An additional intellectual property rights grant can be found
michael@0 7 * in the file PATENTS. All contributing project authors may
michael@0 8 * be found in the AUTHORS file in the root of the source tree.
michael@0 9 */
michael@0 10
michael@0 11 #ifndef VP9_COMMON_VP9_RECONINTER_H_
michael@0 12 #define VP9_COMMON_VP9_RECONINTER_H_
michael@0 13
michael@0 14 #include "vpx/vpx_integer.h"
michael@0 15 #include "vp9/common/vp9_onyxc_int.h"
michael@0 16
michael@0 17 struct subpix_fn_table;
michael@0 18 void vp9_build_inter_predictors_sby(MACROBLOCKD *xd, int mi_row, int mi_col,
michael@0 19 BLOCK_SIZE bsize);
michael@0 20
michael@0 21 void vp9_build_inter_predictors_sbuv(MACROBLOCKD *xd, int mi_row, int mi_col,
michael@0 22 BLOCK_SIZE bsize);
michael@0 23
michael@0 24 void vp9_build_inter_predictors_sb(MACROBLOCKD *xd, int mi_row, int mi_col,
michael@0 25 BLOCK_SIZE bsize);
michael@0 26
michael@0 27 void vp9_setup_interp_filters(MACROBLOCKD *xd,
michael@0 28 INTERPOLATION_TYPE filter,
michael@0 29 VP9_COMMON *cm);
michael@0 30
michael@0 31 void vp9_build_inter_predictor(const uint8_t *src, int src_stride,
michael@0 32 uint8_t *dst, int dst_stride,
michael@0 33 const MV *mv_q3,
michael@0 34 const struct scale_factors *scale,
michael@0 35 int w, int h, int do_avg,
michael@0 36 const struct subpix_fn_table *subpix,
michael@0 37 enum mv_precision precision);
michael@0 38
michael@0 39 static int scaled_buffer_offset(int x_offset, int y_offset, int stride,
michael@0 40 const struct scale_factors *scale) {
michael@0 41 const int x = scale ? scale->sfc->scale_value_x(x_offset, scale->sfc) :
michael@0 42 x_offset;
michael@0 43 const int y = scale ? scale->sfc->scale_value_y(y_offset, scale->sfc) :
michael@0 44 y_offset;
michael@0 45 return y * stride + x;
michael@0 46 }
michael@0 47
michael@0 48 static void setup_pred_plane(struct buf_2d *dst,
michael@0 49 uint8_t *src, int stride,
michael@0 50 int mi_row, int mi_col,
michael@0 51 const struct scale_factors *scale,
michael@0 52 int subsampling_x, int subsampling_y) {
michael@0 53 const int x = (MI_SIZE * mi_col) >> subsampling_x;
michael@0 54 const int y = (MI_SIZE * mi_row) >> subsampling_y;
michael@0 55 dst->buf = src + scaled_buffer_offset(x, y, stride, scale);
michael@0 56 dst->stride = stride;
michael@0 57 }
michael@0 58
michael@0 59 // TODO(jkoleszar): audit all uses of this that don't set mb_row, mb_col
michael@0 60 static void setup_dst_planes(MACROBLOCKD *xd,
michael@0 61 const YV12_BUFFER_CONFIG *src,
michael@0 62 int mi_row, int mi_col) {
michael@0 63 uint8_t *buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
michael@0 64 src->alpha_buffer};
michael@0 65 int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
michael@0 66 src->alpha_stride};
michael@0 67 int i;
michael@0 68
michael@0 69 for (i = 0; i < MAX_MB_PLANE; ++i) {
michael@0 70 struct macroblockd_plane *pd = &xd->plane[i];
michael@0 71 setup_pred_plane(&pd->dst, buffers[i], strides[i], mi_row, mi_col, NULL,
michael@0 72 pd->subsampling_x, pd->subsampling_y);
michael@0 73 }
michael@0 74 }
michael@0 75
michael@0 76 static void setup_pre_planes(MACROBLOCKD *xd, int i,
michael@0 77 const YV12_BUFFER_CONFIG *src,
michael@0 78 int mi_row, int mi_col,
michael@0 79 const struct scale_factors *sf) {
michael@0 80 if (src) {
michael@0 81 int j;
michael@0 82 uint8_t* buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
michael@0 83 src->alpha_buffer};
michael@0 84 int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
michael@0 85 src->alpha_stride};
michael@0 86
michael@0 87 for (j = 0; j < MAX_MB_PLANE; ++j) {
michael@0 88 struct macroblockd_plane *pd = &xd->plane[j];
michael@0 89 setup_pred_plane(&pd->pre[i], buffers[j], strides[j],
michael@0 90 mi_row, mi_col, sf, pd->subsampling_x, pd->subsampling_y);
michael@0 91 }
michael@0 92 }
michael@0 93 }
michael@0 94
michael@0 95 static void set_scale_factors(MACROBLOCKD *xd, int ref0, int ref1,
michael@0 96 struct scale_factors sf[MAX_REF_FRAMES]) {
michael@0 97 xd->scale_factor[0] = sf[ref0 >= 0 ? ref0 : 0];
michael@0 98 xd->scale_factor[1] = sf[ref1 >= 0 ? ref1 : 0];
michael@0 99 }
michael@0 100
michael@0 101 void vp9_setup_scale_factors(VP9_COMMON *cm, int i);
michael@0 102
michael@0 103 #endif // VP9_COMMON_VP9_RECONINTER_H_

mercurial