Merge "Adding plane_block_width and plane_block_height functions." into experimental

This commit is contained in:
Dmitry Kovalev
2013-05-31 15:28:45 -07:00
committed by Gerrit Code Review
6 changed files with 145 additions and 193 deletions

View File

@@ -608,6 +608,16 @@ static INLINE struct plane_block_idx plane_block_idx(int y_blocks,
return res;
}
static INLINE int plane_block_width(BLOCK_SIZE_TYPE bsize,
const struct macroblockd_plane* plane) {
return 4 << (b_width_log2(bsize) - plane->subsampling_x);
}
static INLINE int plane_block_height(BLOCK_SIZE_TYPE bsize,
const struct macroblockd_plane* plane) {
return 4 << (b_height_log2(bsize) - plane->subsampling_y);
}
typedef void (*foreach_transformed_block_visitor)(int plane, int block,
BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size,
@@ -678,8 +688,8 @@ static INLINE void foreach_predicted_block_in_plane(
// block sizes in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// subsampled size of the block
const int bw = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
const int bh = b_height_log2(bsize) - xd->plane[plane].subsampling_y;
const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
const int bhl = b_height_log2(bsize) - xd->plane[plane].subsampling_y;
// size of the predictor to use.
int pred_w, pred_h;
@@ -689,21 +699,20 @@ static INLINE void foreach_predicted_block_in_plane(
pred_w = 0;
pred_h = 0;
} else {
pred_w = bw;
pred_h = bh;
pred_w = bwl;
pred_h = bhl;
}
assert(pred_w <= bw);
assert(pred_h <= bh);
assert(pred_w <= bwl);
assert(pred_h <= bhl);
// 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) {
for (y = 0; y < 1 << bhl; y += 1 << pred_h) {
for (x = 0; x < 1 << bwl; 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);
i += (1 << (bwl + pred_h)) - (1 << bwl);
}
}
static INLINE void foreach_predicted_block(
@@ -733,8 +742,7 @@ static int raster_block_offset(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
static int16_t* raster_block_offset_int16(MACROBLOCKD *xd,
BLOCK_SIZE_TYPE bsize,
int plane, int block, int16_t *base) {
const int bw = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
const int stride = 4 << bw;
const int stride = plane_block_width(bsize, &xd->plane[plane]);
return base + raster_block_offset(xd, bsize, plane, block, stride);
}
static uint8_t* raster_block_offset_uint8(MACROBLOCKD *xd,

View File

@@ -384,9 +384,8 @@ static void build_inter_predictors(int plane, int block,
MACROBLOCKD * const xd = arg->xd;
const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
const int bhl = b_height_log2(bsize) - xd->plane[plane].subsampling_y;
const int bh = 4 << bhl, bw = 4 << bwl;
const int x_idx = block & ((1 << bwl) - 1), y_idx = block >> bwl;
const int x = x_idx * 4, y = y_idx * 4;
const int bh = 4 << bhl, bw = 4 << bwl;
const int x = 4 * (block & ((1 << bwl) - 1)), y = 4 * (block >> bwl);
const int use_second_ref = xd->mode_info_context->mbmi.second_ref_frame > 0;
int which_mv;

View File

@@ -362,14 +362,13 @@ void vp9_build_intra_predictors(uint8_t *src, int src_stride,
void vp9_build_intra_predictors_sby_s(MACROBLOCKD *xd,
BLOCK_SIZE_TYPE bsize) {
const int bwl = b_width_log2(bsize), bw = 4 << bwl;
const int bhl = b_height_log2(bsize), bh = 4 << bhl;
vp9_build_intra_predictors(xd->plane[0].dst.buf, xd->plane[0].dst.stride,
xd->plane[0].dst.buf, xd->plane[0].dst.stride,
const struct macroblockd_plane* const pd = &xd->plane[0];
const int bw = plane_block_width(bsize, pd);
const int bh = plane_block_height(bsize, pd);
vp9_build_intra_predictors(pd->dst.buf, pd->dst.stride,
pd->dst.buf, pd->dst.stride,
xd->mode_info_context->mbmi.mode,
bw, bh,
xd->up_available, xd->left_available,
bw, bh, xd->up_available, xd->left_available,
0 /*xd->right_available*/);
}
@@ -398,11 +397,9 @@ void vp9_predict_intra_block(MACROBLOCKD *xd,
uint8_t *predictor, int pre_stride) {
const int bwl = bwl_in - tx_size;
const int wmask = (1 << bwl) - 1;
const int have_top =
(block_idx >> bwl) || xd->up_available;
const int have_left =
(block_idx & wmask) || xd->left_available;
int have_right = ((block_idx & wmask) != wmask);
const int have_top = (block_idx >> bwl) || xd->up_available;
const int have_left = (block_idx & wmask) || xd->left_available;
const int have_right = ((block_idx & wmask) != wmask);
const int txfm_block_size = 4 << tx_size;
assert(bwl >= 0);