Commit 0053b46d authored by John Koleszar's avatar John Koleszar

make build_inter_predictors block size agnostic (split)

All build_inter_predictors can now be serviced by the same inner
function.

Change-Id: I40b08bee8f047286db4b1aad9dcae37b879c3f2a
parent e0df9b21
......@@ -878,31 +878,40 @@ typedef void (*foreach_predicted_block_visitor)(int plane, int block,
static INLINE void foreach_predicted_block_in_plane(
const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize, int plane,
foreach_predicted_block_visitor visit, void *arg) {
const int bw = b_width_log2(bsize), bh = b_height_log2(bsize);
int i, x, y;
const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
// block sizes in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
const int block_size_b = bw + bh;
// subsampled size of the block
const int ss_sum = xd->plane[plane].subsampling_x +
xd->plane[plane].subsampling_y;
const int ss_block_size = block_size_b - ss_sum;
const int bw = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
const int bh = b_height_log2(bsize) - xd->plane[plane].subsampling_y;
// size of the predictor to use.
// TODO(jkoleszar): support I8X8, I4X4
const int pred_w = bw - xd->plane[plane].subsampling_x;
const int pred_h = bh - xd->plane[plane].subsampling_y;
const int pred_b = mode == SPLITMV ? 0 : pred_w + pred_h;
const int step = 1 << pred_b;
int i;
assert(pred_b <= block_size_b);
assert(pred_b == (mode == SPLITMV ? 0 : ss_block_size));
for (i = 0; i < (1 << ss_block_size); i += step) {
visit(plane, i, bsize, pred_w, pred_h, arg);
int pred_w, pred_h;
if (mode == SPLITMV) {
// 4x4 or 8x8
const int is_4x4 =
(xd->mode_info_context->mbmi.partitioning == PARTITIONING_4X4);
pred_w = is_4x4 ? 0 : 1 >> xd->plane[plane].subsampling_x;
pred_h = is_4x4 ? 0 : 1 >> xd->plane[plane].subsampling_y;
} else {
pred_w = bw;
pred_h = bh;
}
assert(pred_w <= bw);
assert(pred_h <= bh);
// visit each subblock in raster order
i = 0;
for (y = 0; y < 1 << bh; y += 1 << pred_h) {
for (x = 0; x < 1 << bw; x += 1 << pred_w) {
visit(plane, i, bsize, pred_w, pred_h, arg);
i += 1 << pred_w;
}
i -= 1 << bw;
i += 1 << (bw + pred_h);
}
}
static INLINE void foreach_predicted_block(
......
This diff is collapsed.
......@@ -16,21 +16,20 @@
struct subpix_fn_table;
void vp9_build_inter_predictors_sby(MACROBLOCKD *x,
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 *x,
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment