summaryrefslogtreecommitdiff
path: root/vp9/common/vp9_reconinter.h
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/common/vp9_reconinter.h')
-rw-r--r--vp9/common/vp9_reconinter.h78
1 files changed, 63 insertions, 15 deletions
diff --git a/vp9/common/vp9_reconinter.h b/vp9/common/vp9_reconinter.h
index ee34fc5d2..51b705f71 100644
--- a/vp9/common/vp9_reconinter.h
+++ b/vp9/common/vp9_reconinter.h
@@ -17,31 +17,19 @@
struct subpix_fn_table;
void vp9_build_inter_predictors_sby(MACROBLOCKD *xd,
- uint8_t *dst_y,
- int dst_ystride,
int mb_row,
int mb_col,
BLOCK_SIZE_TYPE bsize);
void vp9_build_inter_predictors_sbuv(MACROBLOCKD *xd,
- uint8_t *dst_u,
- uint8_t *dst_v,
- int dst_uvstride,
int mb_row,
int mb_col,
BLOCK_SIZE_TYPE bsize);
+
void vp9_build_inter_predictors_sb(MACROBLOCKD *mb,
int mb_row, int mb_col,
BLOCK_SIZE_TYPE bsize);
-void vp9_build_inter_predictors_mb(MACROBLOCKD *xd,
- int mb_row,
- int mb_col);
-
-void vp9_build_inter4x4_predictors_mbuv(MACROBLOCKD *xd,
- int mb_row,
- int mb_col);
-
void vp9_setup_interp_filters(MACROBLOCKD *xd,
INTERPOLATIONFILTERTYPE filter,
VP9_COMMON *cm);
@@ -83,8 +71,68 @@ static int scaled_buffer_offset(int x_offset,
int y_offset,
int stride,
const struct scale_factors *scale) {
- return scale->scale_value_y(y_offset, scale) * stride +
- scale->scale_value_x(x_offset, scale);
+ if (scale)
+ return scale->scale_value_y(y_offset, scale) * stride +
+ scale->scale_value_x(x_offset, scale);
+ return y_offset * stride + x_offset;
+}
+
+static void setup_pred_plane(struct buf_2d *dst,
+ uint8_t *src, int stride,
+ int mb_row, int mb_col,
+ const struct scale_factors *scale,
+ int subsampling_x, int subsampling_y) {
+ const int x = (16 * mb_col) >> subsampling_x;
+ const int y = (16 * mb_row) >> subsampling_y;
+ dst->buf = src + scaled_buffer_offset(x, y, stride, scale);
+ dst->stride = stride;
+}
+
+// TODO(jkoleszar): audit all uses of this that don't set mb_row, mb_col
+static void setup_dst_planes(MACROBLOCKD *xd,
+ const YV12_BUFFER_CONFIG *src,
+ int mb_row, int mb_col) {
+ setup_pred_plane(&xd->plane[0].dst,
+ src->y_buffer, src->y_stride,
+ mb_row, mb_col, NULL,
+ xd->plane[0].subsampling_x, xd->plane[0].subsampling_y);
+ setup_pred_plane(&xd->plane[1].dst,
+ src->u_buffer, src->uv_stride,
+ mb_row, mb_col, NULL,
+ xd->plane[1].subsampling_x, xd->plane[1].subsampling_y);
+ setup_pred_plane(&xd->plane[2].dst,
+ src->v_buffer, src->uv_stride,
+ mb_row, mb_col, NULL,
+ xd->plane[2].subsampling_x, xd->plane[2].subsampling_y);
+}
+
+static void setup_pre_planes(MACROBLOCKD *xd,
+ const YV12_BUFFER_CONFIG *src0,
+ const YV12_BUFFER_CONFIG *src1,
+ int mb_row, int mb_col,
+ const struct scale_factors *scale,
+ const struct scale_factors *scale_uv) {
+ int i;
+
+ for (i = 0; i < 2; i++) {
+ const YV12_BUFFER_CONFIG *src = i ? src1 : src0;
+
+ if (!src)
+ continue;
+
+ setup_pred_plane(&xd->plane[0].pre[i],
+ src->y_buffer, src->y_stride,
+ mb_row, mb_col, scale ? scale + i : NULL,
+ xd->plane[0].subsampling_x, xd->plane[0].subsampling_y);
+ setup_pred_plane(&xd->plane[1].pre[i],
+ src->u_buffer, src->uv_stride,
+ mb_row, mb_col, scale_uv ? scale_uv + i : NULL,
+ xd->plane[1].subsampling_x, xd->plane[1].subsampling_y);
+ setup_pred_plane(&xd->plane[2].pre[i],
+ src->v_buffer, src->uv_stride,
+ mb_row, mb_col, scale_uv ? scale_uv + i : NULL,
+ xd->plane[2].subsampling_x, xd->plane[2].subsampling_y);
+ }
}
static void setup_pred_block(YV12_BUFFER_CONFIG *dst,