Merge "Using vp9_subtract_plane instead of vp9_subtract_{sb, sby, sbuv}."

This commit is contained in:
Dmitry Kovalev 2014-02-25 11:06:05 -08:00 committed by Gerrit Code Review
commit 4632a96d97
3 changed files with 18 additions and 32 deletions

View File

@ -51,7 +51,7 @@ void vp9_subtract_block_c(int rows, int cols,
} }
} }
static void subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { void vp9_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
struct macroblock_plane *const p = &x->plane[plane]; struct macroblock_plane *const p = &x->plane[plane];
const struct macroblockd_plane *const pd = &x->e_mbd.plane[plane]; const struct macroblockd_plane *const pd = &x->e_mbd.plane[plane];
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
@ -62,22 +62,6 @@ static void subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
pd->dst.buf, pd->dst.stride); pd->dst.buf, pd->dst.stride);
} }
void vp9_subtract_sby(MACROBLOCK *x, BLOCK_SIZE bsize) {
subtract_plane(x, bsize, 0);
}
void vp9_subtract_sbuv(MACROBLOCK *x, BLOCK_SIZE bsize) {
int i;
for (i = 1; i < MAX_MB_PLANE; i++)
subtract_plane(x, bsize, i);
}
void vp9_subtract_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
vp9_subtract_sby(x, bsize);
vp9_subtract_sbuv(x, bsize);
}
#define RDTRUNC(RM, DM, R, D) ((128 + (R) * (RM)) & 0xFF) #define RDTRUNC(RM, DM, R, D) ((128 + (R) * (RM)) & 0xFF)
typedef struct vp9_token_state vp9_token_state; typedef struct vp9_token_state vp9_token_state;
@ -494,7 +478,7 @@ void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize) {
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct encode_b_args arg = {x, &ctx, &mbmi->skip}; struct encode_b_args arg = {x, &ctx, &mbmi->skip};
vp9_subtract_sby(x, bsize); vp9_subtract_plane(x, bsize, 0);
if (x->optimize) if (x->optimize)
optimize_init_b(0, bsize, &arg); optimize_init_b(0, bsize, &arg);
@ -507,17 +491,18 @@ void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) {
struct optimize_ctx ctx; struct optimize_ctx ctx;
MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi;
struct encode_b_args arg = {x, &ctx, &mbmi->skip}; struct encode_b_args arg = {x, &ctx, &mbmi->skip};
int plane;
if (!x->skip_recode) for (plane = 0; plane < MAX_MB_PLANE; ++plane) {
vp9_subtract_sb(x, bsize); if (!x->skip_recode)
vp9_subtract_plane(x, bsize, plane);
if (x->optimize && (!x->skip_recode || !x->skip_optimize)) { if (x->optimize && (!x->skip_recode || !x->skip_optimize))
int i; optimize_init_b(plane, bsize, &arg);
for (i = 0; i < MAX_MB_PLANE; ++i)
optimize_init_b(i, bsize, &arg); vp9_foreach_transformed_block_in_plane(xd, bsize, plane, encode_block,
&arg);
} }
vp9_foreach_transformed_block(xd, bsize, encode_block, &arg);
} }
static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, static void encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,

View File

@ -26,9 +26,7 @@ void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize);
void vp9_xform_quant(MACROBLOCK *x, int plane, int block, void vp9_xform_quant(MACROBLOCK *x, int plane, int block,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size); BLOCK_SIZE plane_bsize, TX_SIZE tx_size);
void vp9_subtract_sby(MACROBLOCK *x, BLOCK_SIZE bsize); void vp9_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane);
void vp9_subtract_sbuv(MACROBLOCK *x, BLOCK_SIZE bsize);
void vp9_subtract_sb(MACROBLOCK *x, BLOCK_SIZE bsize);
void vp9_encode_block_intra(MACROBLOCK *x, int plane, int block, void vp9_encode_block_intra(MACROBLOCK *x, int plane, int block,
BLOCK_SIZE plane_bsize, TX_SIZE tx_size, BLOCK_SIZE plane_bsize, TX_SIZE tx_size,

View File

@ -953,7 +953,7 @@ static void super_block_yrd(VP9_COMP *cpi,
assert(bs == mbmi->sb_type); assert(bs == mbmi->sb_type);
if (b_inter_mode) if (b_inter_mode)
vp9_subtract_sby(x, bs); vp9_subtract_plane(x, bs, 0);
if (cpi->sf.tx_size_search_method == USE_LARGESTALL || if (cpi->sf.tx_size_search_method == USE_LARGESTALL ||
(cpi->sf.tx_size_search_method != USE_FULL_RD && (cpi->sf.tx_size_search_method != USE_FULL_RD &&
@ -1295,8 +1295,11 @@ static void super_block_uvrd(VP9_COMP *const cpi, MACROBLOCK *x,
if (ref_best_rd < 0) if (ref_best_rd < 0)
goto term; goto term;
if (is_inter_block(mbmi)) if (is_inter_block(mbmi)) {
vp9_subtract_sbuv(x, bsize); int plane;
for (plane = 1; plane < MAX_MB_PLANE; ++plane)
vp9_subtract_plane(x, bsize, plane);
}
*rate = 0; *rate = 0;
*distortion = 0; *distortion = 0;