From f6fd5b2704690d8c83745175001a359863a96e69 Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Mon, 17 Feb 2014 13:57:40 +0100 Subject: [PATCH] Using vp9_subtract_plane instead of vp9_subtract_{sb, sby, sbuv}. Change-Id: I67a82a347245076b6c3b0bc41b587f9961a29943 --- vp9/encoder/vp9_encodemb.c | 37 +++++++++++-------------------------- vp9/encoder/vp9_encodemb.h | 4 +--- vp9/encoder/vp9_rdopt.c | 9 ++++++--- 3 files changed, 18 insertions(+), 32 deletions(-) diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 6f976f584..2fa3cecde 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -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]; const struct macroblockd_plane *const pd = &x->e_mbd.plane[plane]; 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); } -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) typedef struct vp9_token_state vp9_token_state; @@ -488,7 +472,7 @@ void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize) { MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; struct encode_b_args arg = {x, &ctx, &mbmi->skip}; - vp9_subtract_sby(x, bsize); + vp9_subtract_plane(x, bsize, 0); if (x->optimize) optimize_init_b(0, bsize, &arg); @@ -501,17 +485,18 @@ void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) { struct optimize_ctx ctx; MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; struct encode_b_args arg = {x, &ctx, &mbmi->skip}; + int plane; - if (!x->skip_recode) - vp9_subtract_sb(x, bsize); + for (plane = 0; plane < MAX_MB_PLANE; ++plane) { + if (!x->skip_recode) + vp9_subtract_plane(x, bsize, plane); - if (x->optimize && (!x->skip_recode || !x->skip_optimize)) { - int i; - for (i = 0; i < MAX_MB_PLANE; ++i) - optimize_init_b(i, bsize, &arg); + if (x->optimize && (!x->skip_recode || !x->skip_optimize)) + optimize_init_b(plane, 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, diff --git a/vp9/encoder/vp9_encodemb.h b/vp9/encoder/vp9_encodemb.h index 515935f9b..a61f776a4 100644 --- a/vp9/encoder/vp9_encodemb.h +++ b/vp9/encoder/vp9_encodemb.h @@ -26,9 +26,7 @@ void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize); void vp9_xform_quant(MACROBLOCK *x, int plane, int block, BLOCK_SIZE plane_bsize, TX_SIZE tx_size); -void vp9_subtract_sby(MACROBLOCK *x, BLOCK_SIZE bsize); -void vp9_subtract_sbuv(MACROBLOCK *x, BLOCK_SIZE bsize); -void vp9_subtract_sb(MACROBLOCK *x, BLOCK_SIZE bsize); +void vp9_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane); void vp9_encode_block_intra(MACROBLOCK *x, int plane, int block, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index a3e879b82..11fd3de34 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -949,7 +949,7 @@ static void super_block_yrd(VP9_COMP *cpi, assert(bs == mbmi->sb_type); if (b_inter_mode) - vp9_subtract_sby(x, bs); + vp9_subtract_plane(x, bs, 0); if (cpi->sf.tx_size_search_method == USE_LARGESTALL || (cpi->sf.tx_size_search_method != USE_FULL_RD && @@ -1291,8 +1291,11 @@ static void super_block_uvrd(VP9_COMP *const cpi, MACROBLOCK *x, if (ref_best_rd < 0) goto term; - if (is_inter_block(mbmi)) - vp9_subtract_sbuv(x, bsize); + if (is_inter_block(mbmi)) { + int plane; + for (plane = 1; plane < MAX_MB_PLANE; ++plane) + vp9_subtract_plane(x, bsize, plane); + } *rate = 0; *distortion = 0;