From 9774962a24516f268555de4f8b14c6dae3fe784c Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Wed, 26 Feb 2014 13:51:12 -0800 Subject: [PATCH] Cleaning up vp9_encodemb.c file. Usage of encode_b_args is unnecessary because encode_block_pass1() doesn't use them. That's why optimize_init_b() call is also not required. Change-Id: Ib6cfe4916c2ca85749c90bb0adcba6fea592f9ac --- vp9/encoder/vp9_encodemb.c | 23 ++++++----------------- vp9/encoder/vp9_encodemb.h | 2 +- vp9/encoder/vp9_firstpass.c | 2 +- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 8cb2843bd..e2ed6760e 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -453,8 +453,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE plane_bsize, } static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) { - struct encode_b_args *const args = arg; - MACROBLOCK *const x = args->x; + MACROBLOCK *const x = (MACROBLOCK *)arg; MACROBLOCKD *const xd = &x->e_mbd; struct macroblock_plane *const p = &x->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane]; @@ -466,24 +465,14 @@ static void encode_block_pass1(int plane, int block, BLOCK_SIZE plane_bsize, vp9_xform_quant(x, plane, block, plane_bsize, tx_size); - if (p->eobs[block] == 0) - return; - - xd->itxm_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]); + if (p->eobs[block] > 0) + xd->itxm_add(dqcoeff, dst, pd->dst.stride, p->eobs[block]); } -void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize) { - MACROBLOCKD *const xd = &x->e_mbd; - struct optimize_ctx ctx; - MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; - struct encode_b_args arg = {x, &ctx, &mbmi->skip}; - +void vp9_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize) { vp9_subtract_plane(x, bsize, 0); - if (x->optimize) - optimize_init_b(0, bsize, &arg); - - vp9_foreach_transformed_block_in_plane(xd, bsize, 0, encode_block_pass1, - &arg); + vp9_foreach_transformed_block_in_plane(&x->e_mbd, bsize, 0, + encode_block_pass1, x); } void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) { diff --git a/vp9/encoder/vp9_encodemb.h b/vp9/encoder/vp9_encodemb.h index a61f776a4..dcf6e8759 100644 --- a/vp9/encoder/vp9_encodemb.h +++ b/vp9/encoder/vp9_encodemb.h @@ -21,7 +21,7 @@ extern "C" { #endif void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize); -void vp9_encode_sby(MACROBLOCK *x, BLOCK_SIZE bsize); +void vp9_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize); void vp9_xform_quant(MACROBLOCK *x, int plane, int block, BLOCK_SIZE plane_bsize, TX_SIZE tx_size); diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index ddb901dd1..32ed96999 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -675,7 +675,7 @@ void vp9_first_pass(VP9_COMP *cpi) { xd->mi_8x8[0]->mbmi.ref_frame[0] = LAST_FRAME; xd->mi_8x8[0]->mbmi.ref_frame[1] = NONE; vp9_build_inter_predictors_sby(xd, mb_row << 1, mb_col << 1, bsize); - vp9_encode_sby(x, bsize); + vp9_encode_sby_pass1(x, bsize); sum_mvr += mv.as_mv.row; sum_mvr_abs += abs(mv.as_mv.row); sum_mvc += mv.as_mv.col; -- 2.40.0