Use the common block walker to calculate skippability.
Change-Id: I6721e42f065df237426c91c1d871ec226ba7cdcb
}
}
+static INLINE void foreach_transformed_block_uv(
+ const MACROBLOCKD* const xd, int block_size,
+ foreach_transformed_block_visitor visit, void *arg) {
+ const MB_PREDICTION_MODE mode = xd->mode_info_context->mbmi.mode;
+ const int is_split =
+ xd->mode_info_context->mbmi.txfm_size == TX_8X8 &&
+ (mode == I8X8_PRED || mode == SPLITMV);
+ int plane;
+
+ for (plane = 1; plane < MAX_MB_PLANE; plane++) {
+ foreach_transformed_block_in_plane(xd, block_size, plane, is_split,
+ visit, arg);
+ }
+}
+
#endif // VP9_COMMON_VP9_BLOCKD_H_
*distortion = vp9_sb_block_error_c(x->coeff, xd->plane[0].dqcoeff,
16 << (bwl + bhl), 2);
*rate = rdcost_sby_4x4(cm, x, bsize);
- *skippable = vp9_sby_is_skippable(xd, bsize, TX_4X4);
+ *skippable = vp9_sby_is_skippable(xd, bsize);
}
static int rdcost_sby_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
*distortion = vp9_sb_block_error_c(x->coeff, xd->plane[0].dqcoeff,
64 << (bhl + bwl), 2);
*rate = rdcost_sby_8x8(cm, x, bsize);
- *skippable = vp9_sby_is_skippable(xd, bsize, TX_8X8);
+ *skippable = vp9_sby_is_skippable(xd, bsize);
}
static int rdcost_sby_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
*distortion = vp9_sb_block_error_c(x->coeff, xd->plane[0].dqcoeff,
256 << (bwl + bhl), 2);
*rate = rdcost_sby_16x16(cm, x, bsize);
- *skippable = vp9_sby_is_skippable(xd, bsize, TX_16X16);
+ *skippable = vp9_sby_is_skippable(xd, bsize);
}
static int rdcost_sby_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
*distortion = vp9_sb_block_error_c(x->coeff, xd->plane[0].dqcoeff,
1024 << (bwl + bhl), 0);
*rate = rdcost_sby_32x32(cm, x, bsize);
- *skippable = vp9_sby_is_skippable(xd, bsize, TX_32X32);
+ *skippable = vp9_sby_is_skippable(xd, bsize);
}
static void super_block_yrd(VP9_COMP *cpi,
xd->plane[1].dqcoeff,
xd->plane[2].dqcoeff,
32 << (bwl + bhl - 2), 2);
- *skip = vp9_sbuv_is_skippable(xd, bsize, TX_4X4);
+ *skip = vp9_sbuv_is_skippable(xd, bsize);
}
static int rd_cost_sbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *x,
xd->plane[1].dqcoeff,
xd->plane[2].dqcoeff,
128 << (bwl + bhl - 2), 2);
- *skip = vp9_sbuv_is_skippable(xd, bsize, TX_8X8);
+ *skip = vp9_sbuv_is_skippable(xd, bsize);
}
static int rd_cost_sbuv_16x16(VP9_COMMON *const cm, MACROBLOCK *x,
xd->plane[1].dqcoeff,
xd->plane[2].dqcoeff,
512 << (bwl + bhl - 2), 2);
- *skip = vp9_sbuv_is_skippable(xd, bsize, TX_16X16);
+ *skip = vp9_sbuv_is_skippable(xd, bsize);
}
static int rd_cost_sbuv_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
xd->plane[1].dqcoeff,
xd->plane[2].dqcoeff,
2048 << (bwl + bhl - 2), 0);
- *skip = vp9_sbuv_is_skippable(xd, bsize, TX_32X32);
+ *skip = vp9_sbuv_is_skippable(xd, bsize);
}
static void super_block_uvrd(VP9_COMMON *const cm, MACROBLOCK *x,
x->e_mbd.plane[0].eobs[i] = bsi.eobs[i];
}
- *returntotrate = bsi.r;
- *returndistortion = bsi.d;
- *returnyrate = bsi.segment_yrate;
- *skippable = bsi.txfm_size == TX_4X4 ?
- vp9_mby_is_skippable_4x4(&x->e_mbd) :
- vp9_mby_is_skippable_8x8(&x->e_mbd);
-
/* save partitions */
mbmi->txfm_size = bsi.txfm_size;
mbmi->partitioning = bsi.segment_num;
if (mbmi->second_ref_frame > 0)
x->partition_info->bmi[15].second_mv.as_int = bsi.second_mvs[15].as_int;
+ *returntotrate = bsi.r;
+ *returndistortion = bsi.d;
+ *returnyrate = bsi.segment_yrate;
+ *skippable = vp9_sby_is_skippable(&x->e_mbd, BLOCK_SIZE_MB16X16);
+
return (int)(bsi.segment_rd);
}
}
}
-int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd) {
- int skip = 1;
- int i = 0;
-
- for (i = 0; i < 16; i++)
- skip &= (!xd->plane[0].eobs[i]);
-
- return skip;
-}
-
-int vp9_mbuv_is_skippable_4x4(MACROBLOCKD *xd) {
- int skip = 1;
- int i;
-
- for (i = 0; i < 4; i++)
- skip &= (!xd->plane[1].eobs[i]);
- for (i = 0; i < 4; i++)
- skip &= (!xd->plane[2].eobs[i]);
- return skip;
-}
-
-static int mb_is_skippable_4x4(MACROBLOCKD *xd) {
- return (vp9_mby_is_skippable_4x4(xd) &
- vp9_mbuv_is_skippable_4x4(xd));
-}
-
-int vp9_mby_is_skippable_8x8(MACROBLOCKD *xd) {
- int skip = 1;
- int i = 0;
-
- for (i = 0; i < 16; i += 4)
- skip &= (!xd->plane[0].eobs[i]);
-
- return skip;
-}
-
-int vp9_mbuv_is_skippable_8x8(MACROBLOCKD *xd) {
- return (!xd->plane[1].eobs[0]) & (!xd->plane[2].eobs[0]);
-}
-
-static int mb_is_skippable_8x8(MACROBLOCKD *xd) {
- return (vp9_mby_is_skippable_8x8(xd) &
- vp9_mbuv_is_skippable_8x8(xd));
+struct is_skippable_args {
+ MACROBLOCKD *xd;
+ int *skippable;
+};
+static void is_skippable(int plane, int block,
+ int block_size_b, int ss_txfrm_size, void *argv) {
+ struct is_skippable_args *args = argv;
+ args->skippable[0] &= (!args->xd->plane[plane].eobs[block]);
}
-static int mb_is_skippable_8x8_4x4uv(MACROBLOCKD *xd) {
- return (vp9_mby_is_skippable_8x8(xd) &
- vp9_mbuv_is_skippable_4x4(xd));
-}
-
-int vp9_mby_is_skippable_16x16(MACROBLOCKD *xd) {
- return (!xd->plane[0].eobs[0]);
-}
-
-static int mb_is_skippable_16x16(MACROBLOCKD *xd) {
- return (vp9_mby_is_skippable_16x16(xd) & vp9_mbuv_is_skippable_8x8(xd));
-}
-
-int vp9_sby_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
- TX_SIZE sz) {
- const int inc = 1 << (sz * 2);
+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 skip = 1;
- int i = 0;
-
- for (i = 0; i < (1 << (bwl + bhl)); i += inc)
- skip &= (!xd->plane[0].eobs[i]);
-
- return skip;
+ int result = 1;
+ struct is_skippable_args args = {xd, &result};
+ foreach_transformed_block(xd, bwl + bhl, is_skippable, &args);
+ return result;
}
-int vp9_sbuv_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize, TX_SIZE sz) {
- const int inc = 1 << (sz * 2);
- const int bwl = mb_width_log2(bsize) + 1, bhl = mb_height_log2(bsize) + 1;
- int skip = 1;
- int i = 0;
-
- for (i = 0; i < (1 << (bwl + bhl)); i += inc) {
- skip &= (!xd->plane[1].eobs[i]);
- skip &= (!xd->plane[2].eobs[i]);
- }
-
- return skip;
+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;
+ struct is_skippable_args args = {xd, &result};
+ foreach_transformed_block_in_plane(xd, bwl + bhl, 0, 0, is_skippable, &args);
+ return result;
}
-static int sb_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize,
- TX_SIZE ysz, TX_SIZE uvsz) {
- return vp9_sby_is_skippable(xd, bsize, ysz) &
- vp9_sbuv_is_skippable(xd, bsize, uvsz);
+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;
+ struct is_skippable_args args = {xd, &result};
+ foreach_transformed_block_uv(xd, bwl + bhl, is_skippable, &args);
+ return result;
}
void vp9_tokenize_sb(VP9_COMP *cpi,
int b;
const int n_y = (1 << (bwl + bhl)), n_uv = (n_y * 3) >> 1;
- mbmi->mb_skip_coeff = sb_is_skippable(xd, bsize, txfm_size, uv_txfm_size);
+ mbmi->mb_skip_coeff = vp9_sb_is_skippable(xd, bsize);
if (mbmi->mb_skip_coeff) {
if (!dry_run)
} else
skip_inc = 0;
- switch (tx_size) {
- case TX_16X16:
-
- xd->mode_info_context->mbmi.mb_skip_coeff = mb_is_skippable_16x16(xd);
- break;
- case TX_8X8:
- if (xd->mode_info_context->mbmi.mode == I8X8_PRED ||
- xd->mode_info_context->mbmi.mode == SPLITMV)
- xd->mode_info_context->mbmi.mb_skip_coeff =
- mb_is_skippable_8x8_4x4uv(xd);
- else
- xd->mode_info_context->mbmi.mb_skip_coeff =
- mb_is_skippable_8x8(xd);
- break;
-
- default:
- xd->mode_info_context->mbmi.mb_skip_coeff =
- mb_is_skippable_4x4(xd);
- break;
- }
+ xd->mode_info_context->mbmi.mb_skip_coeff = vp9_sb_is_skippable(xd,
+ BLOCK_SIZE_MB16X16);
if (xd->mode_info_context->mbmi.mb_skip_coeff) {
if (!dry_run)
typedef int64_t vp9_coeff_accum[REF_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS]
[MAX_ENTROPY_TOKENS + 1];
-int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd);
-int vp9_mbuv_is_skippable_4x4(MACROBLOCKD *xd);
-int vp9_mby_is_skippable_8x8(MACROBLOCKD *xd);
-int vp9_mbuv_is_skippable_8x8(MACROBLOCKD *xd);
-int vp9_mby_is_skippable_16x16(MACROBLOCKD *xd);
-
-int vp9_sby_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize, TX_SIZE sz);
-int vp9_sbuv_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize, TX_SIZE sz);
-
+int vp9_sb_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize);
+int vp9_sby_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize);
+int vp9_sbuv_is_skippable(MACROBLOCKD *xd, BLOCK_SIZE_TYPE bsize);
struct VP9_COMP;
void vp9_tokenize_mb(struct VP9_COMP *cpi, MACROBLOCKD *xd,