Use BLOCK_SIZE_TYPE in foreach_ walker

Change-Id: I655305c9e22bdd9abc893d3c40d4bc6616aa1d35
This commit is contained in:
John Koleszar
2013-04-12 14:12:05 -07:00
parent acfc5981c3
commit ff3f93639c
3 changed files with 20 additions and 22 deletions

View File

@@ -801,16 +801,18 @@ static INLINE int old_block_idx_4x4(MACROBLOCKD* const xd, int block_size_b,
} }
typedef void (*foreach_transformed_block_visitor)(int plane, int block, typedef void (*foreach_transformed_block_visitor)(int plane, int block,
int block_size_b, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, int ss_txfrm_size,
void *arg); void *arg);
static INLINE void foreach_transformed_block_in_plane( static INLINE void foreach_transformed_block_in_plane(
const MACROBLOCKD* const xd, int block_size, int plane, const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize, int plane,
int is_split, foreach_transformed_block_visitor visit, void *arg) { int is_split, foreach_transformed_block_visitor visit, void *arg) {
const int bw = b_width_log2(bsize), bh = b_height_log2(bsize);
// block and transform sizes, in number of 4x4 blocks log 2 ("*_b") // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8 // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
const TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size; const TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size;
const int block_size_b = block_size; const int block_size_b = bw + bh;
const int txfrm_size_b = tx_size * 2; const int txfrm_size_b = tx_size * 2;
// subsampled size of the block // subsampled size of the block
@@ -825,20 +827,19 @@ static INLINE void foreach_transformed_block_in_plane(
const int ss_txfrm_size = txfrm_size_b > ss_block_size || is_split const int ss_txfrm_size = txfrm_size_b > ss_block_size || is_split
? txfrm_size_b - ss_max * 2 ? txfrm_size_b - ss_max * 2
: txfrm_size_b; : txfrm_size_b;
const int step = 1 << ss_txfrm_size;
// TODO(jkoleszar): 1 may not be correct here with larger chroma planes.
const int inc = is_split ? 1 : (1 << ss_txfrm_size);
int i; int i;
assert(txfrm_size_b <= block_size_b); assert(txfrm_size_b <= block_size_b);
assert(ss_txfrm_size <= ss_block_size); assert(ss_txfrm_size <= ss_block_size);
for (i = 0; i < (1 << ss_block_size); i += inc) { for (i = 0; i < (1 << ss_block_size); i += step) {
visit(plane, i, block_size_b, ss_txfrm_size, arg); visit(plane, i, bsize, ss_txfrm_size, arg);
} }
} }
static INLINE void foreach_transformed_block( static INLINE void foreach_transformed_block(
const MACROBLOCKD* const xd, int block_size, const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize,
foreach_transformed_block_visitor visit, void *arg) { foreach_transformed_block_visitor visit, void *arg) {
const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode; const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
const int is_split = const int is_split =
@@ -850,13 +851,13 @@ static INLINE void foreach_transformed_block(
const int is_split_chroma = is_split && const int is_split_chroma = is_split &&
xd->plane[plane].plane_type == PLANE_TYPE_UV; xd->plane[plane].plane_type == PLANE_TYPE_UV;
foreach_transformed_block_in_plane(xd, block_size, plane, is_split_chroma, foreach_transformed_block_in_plane(xd, bsize, plane, is_split_chroma,
visit, arg); visit, arg);
} }
} }
static INLINE void foreach_transformed_block_uv( static INLINE void foreach_transformed_block_uv(
const MACROBLOCKD* const xd, int block_size, const MACROBLOCKD* const xd, BLOCK_SIZE_TYPE bsize,
foreach_transformed_block_visitor visit, void *arg) { foreach_transformed_block_visitor visit, void *arg) {
const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode; const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
const int is_split = const int is_split =
@@ -865,7 +866,7 @@ static INLINE void foreach_transformed_block_uv(
int plane; int plane;
for (plane = 1; plane < MAX_MB_PLANE; plane++) { for (plane = 1; plane < MAX_MB_PLANE; plane++) {
foreach_transformed_block_in_plane(xd, block_size, plane, is_split, foreach_transformed_block_in_plane(xd, bsize, plane, is_split,
visit, arg); visit, arg);
} }
} }

View File

@@ -402,11 +402,12 @@ struct decode_block_args {
int *eobtotal; int *eobtotal;
}; };
static void decode_block(int plane, int block, static void decode_block(int plane, int block,
int block_size_b, BLOCK_SIZE_TYPE bsize,
int ss_txfrm_size, int ss_txfrm_size,
void *argv) { void *argv) {
const struct decode_block_args* const arg = argv; const struct decode_block_args* const arg = argv;
const int old_block_idx = old_block_idx_4x4(arg->xd, block_size_b, const int bw = b_width_log2(bsize), bh = b_height_log2(bsize);
const int old_block_idx = old_block_idx_4x4(arg->xd, bw + bh,
plane, block); plane, block);
// find the maximum eob for this transform size, adjusted by segment // find the maximum eob for this transform size, adjusted by segment
@@ -428,10 +429,9 @@ int vp9_decode_tokens(VP9D_COMP* const pbi,
MACROBLOCKD* const xd, MACROBLOCKD* const xd,
BOOL_DECODER* const bc, BOOL_DECODER* const bc,
BLOCK_SIZE_TYPE bsize) { BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
int eobtotal = 0; int eobtotal = 0;
struct decode_block_args args = {pbi, xd, bc, &eobtotal}; struct decode_block_args args = {pbi, xd, bc, &eobtotal};
foreach_transformed_block(xd, bwl + bhl, decode_block, &args); foreach_transformed_block(xd, bsize, decode_block, &args);
return eobtotal; return eobtotal;
} }

View File

@@ -381,32 +381,29 @@ struct is_skippable_args {
int *skippable; int *skippable;
}; };
static void is_skippable(int plane, int block, static void is_skippable(int plane, int block,
int block_size_b, int ss_txfrm_size, void *argv) { BLOCK_SIZE_TYPE bsize, int ss_txfrm_size, void *argv) {
struct is_skippable_args *args = argv; struct is_skippable_args *args = argv;
args->skippable[0] &= (!args->xd->plane[plane].eobs[block]); args->skippable[0] &= (!args->xd->plane[plane].eobs[block]);
} }
int vp9_sb_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) { int vp9_sb_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
int result = 1; int result = 1;
struct is_skippable_args args = {xd, &result}; struct is_skippable_args args = {xd, &result};
foreach_transformed_block(xd, bwl + bhl, is_skippable, &args); foreach_transformed_block(xd, bsize, is_skippable, &args);
return result; return result;
} }
int vp9_sby_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) { int vp9_sby_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
int result = 1; int result = 1;
struct is_skippable_args args = {xd, &result}; struct is_skippable_args args = {xd, &result};
foreach_transformed_block_in_plane(xd, bwl + bhl, 0, 0, is_skippable, &args); foreach_transformed_block_in_plane(xd, bsize, 0, 0, is_skippable, &args);
return result; return result;
} }
int vp9_sbuv_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) { int vp9_sbuv_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize) {
const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
int result = 1; int result = 1;
struct is_skippable_args args = {xd, &result}; struct is_skippable_args args = {xd, &result};
foreach_transformed_block_uv(xd, bwl + bhl, is_skippable, &args); foreach_transformed_block_uv(xd, bsize, is_skippable, &args);
return result; return result;
} }