From: Yunqing Wang Date: Fri, 6 Mar 2015 23:17:59 +0000 (-0800) Subject: vp9_ethread: fix me consts initialization to support aq_mode=3 encoding X-Git-Tag: v1.4.0~71^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e0ec0b2d9da1a45725d5e0ae164410fdeb3a3c8;p=platform%2Fupstream%2Flibvpx.git vp9_ethread: fix me consts initialization to support aq_mode=3 encoding While turning on "--aq_mode=3", the quantizers are updated by each thread. Fixed the me consts initialization function to make sure that the correct thread data are updated. Change-Id: Ied27bb7bae76fc3fa2cda4f8c35ac0b46271bef4 --- diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 4949997..6311388 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -3766,7 +3766,7 @@ static void encode_frame_internal(VP9_COMP *cpi) { vp9_frame_init_quantizer(cpi); vp9_initialize_rd_consts(cpi); - vp9_initialize_me_consts(cpi, cm->base_qindex); + vp9_initialize_me_consts(cpi, x, cm->base_qindex); init_encode_frame_mb_context(cpi); cm->use_prev_frame_mvs = !cm->error_resilient_mode && cm->width == cm->last_width && diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c index 2523d1e..29b54b0 100644 --- a/vp9/encoder/vp9_quantize.c +++ b/vp9/encoder/vp9_quantize.c @@ -683,7 +683,7 @@ void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) { x->errorperbit = rdmult >> 6; x->errorperbit += (x->errorperbit == 0); - vp9_initialize_me_consts(cpi, x->q_index); + vp9_initialize_me_consts(cpi, x, x->q_index); } void vp9_frame_init_quantizer(VP9_COMP *cpi) { diff --git a/vp9/encoder/vp9_rd.c b/vp9/encoder/vp9_rd.c index 5cc980c..caa9cae 100644 --- a/vp9/encoder/vp9_rd.c +++ b/vp9/encoder/vp9_rd.c @@ -204,27 +204,28 @@ static int compute_rd_thresh_factor(int qindex, vpx_bit_depth_t bit_depth) { return MAX((int)(pow(q, RD_THRESH_POW) * 5.12), 8); } -void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex) { +void vp9_initialize_me_consts(VP9_COMP *cpi, MACROBLOCK *x, int qindex) { #if CONFIG_VP9_HIGHBITDEPTH switch (cpi->common.bit_depth) { case VPX_BITS_8: - cpi->td.mb.sadperbit16 = sad_per_bit16lut_8[qindex]; - cpi->td.mb.sadperbit4 = sad_per_bit4lut_8[qindex]; + x->sadperbit16 = sad_per_bit16lut_8[qindex]; + x->sadperbit4 = sad_per_bit4lut_8[qindex]; break; case VPX_BITS_10: - cpi->td.mb.sadperbit16 = sad_per_bit16lut_10[qindex]; - cpi->td.mb.sadperbit4 = sad_per_bit4lut_10[qindex]; + x->sadperbit16 = sad_per_bit16lut_10[qindex]; + x->sadperbit4 = sad_per_bit4lut_10[qindex]; break; case VPX_BITS_12: - cpi->td.mb.sadperbit16 = sad_per_bit16lut_12[qindex]; - cpi->td.mb.sadperbit4 = sad_per_bit4lut_12[qindex]; + x->sadperbit16 = sad_per_bit16lut_12[qindex]; + x->sadperbit4 = sad_per_bit4lut_12[qindex]; break; default: assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12"); } #else - cpi->td.mb.sadperbit16 = sad_per_bit16lut_8[qindex]; - cpi->td.mb.sadperbit4 = sad_per_bit4lut_8[qindex]; + (void)cpi; + x->sadperbit16 = sad_per_bit16lut_8[qindex]; + x->sadperbit4 = sad_per_bit4lut_8[qindex]; #endif // CONFIG_VP9_HIGHBITDEPTH } diff --git a/vp9/encoder/vp9_rd.h b/vp9/encoder/vp9_rd.h index b18a816..4d24734 100644 --- a/vp9/encoder/vp9_rd.h +++ b/vp9/encoder/vp9_rd.h @@ -132,7 +132,7 @@ int vp9_compute_rd_mult(const struct VP9_COMP *cpi, int qindex); void vp9_initialize_rd_consts(struct VP9_COMP *cpi); -void vp9_initialize_me_consts(struct VP9_COMP *cpi, int qindex); +void vp9_initialize_me_consts(struct VP9_COMP *cpi, MACROBLOCK *x, int qindex); void vp9_model_rd_from_var_lapndz(unsigned int var, unsigned int n, unsigned int qstep, int *rate,