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
This commit is contained in:
Yunqing Wang 2015-03-06 15:17:59 -08:00
parent 9d44fd6bc5
commit 6e0ec0b2d9
4 changed files with 13 additions and 12 deletions

View File

@ -3766,7 +3766,7 @@ static void encode_frame_internal(VP9_COMP *cpi) {
vp9_frame_init_quantizer(cpi); vp9_frame_init_quantizer(cpi);
vp9_initialize_rd_consts(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); init_encode_frame_mb_context(cpi);
cm->use_prev_frame_mvs = !cm->error_resilient_mode && cm->use_prev_frame_mvs = !cm->error_resilient_mode &&
cm->width == cm->last_width && cm->width == cm->last_width &&

View File

@ -683,7 +683,7 @@ void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) {
x->errorperbit = rdmult >> 6; x->errorperbit = rdmult >> 6;
x->errorperbit += (x->errorperbit == 0); 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) { void vp9_frame_init_quantizer(VP9_COMP *cpi) {

View File

@ -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); 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 #if CONFIG_VP9_HIGHBITDEPTH
switch (cpi->common.bit_depth) { switch (cpi->common.bit_depth) {
case VPX_BITS_8: case VPX_BITS_8:
cpi->td.mb.sadperbit16 = sad_per_bit16lut_8[qindex]; x->sadperbit16 = sad_per_bit16lut_8[qindex];
cpi->td.mb.sadperbit4 = sad_per_bit4lut_8[qindex]; x->sadperbit4 = sad_per_bit4lut_8[qindex];
break; break;
case VPX_BITS_10: case VPX_BITS_10:
cpi->td.mb.sadperbit16 = sad_per_bit16lut_10[qindex]; x->sadperbit16 = sad_per_bit16lut_10[qindex];
cpi->td.mb.sadperbit4 = sad_per_bit4lut_10[qindex]; x->sadperbit4 = sad_per_bit4lut_10[qindex];
break; break;
case VPX_BITS_12: case VPX_BITS_12:
cpi->td.mb.sadperbit16 = sad_per_bit16lut_12[qindex]; x->sadperbit16 = sad_per_bit16lut_12[qindex];
cpi->td.mb.sadperbit4 = sad_per_bit4lut_12[qindex]; x->sadperbit4 = sad_per_bit4lut_12[qindex];
break; break;
default: default:
assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12"); assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12");
} }
#else #else
cpi->td.mb.sadperbit16 = sad_per_bit16lut_8[qindex]; (void)cpi;
cpi->td.mb.sadperbit4 = sad_per_bit4lut_8[qindex]; x->sadperbit16 = sad_per_bit16lut_8[qindex];
x->sadperbit4 = sad_per_bit4lut_8[qindex];
#endif // CONFIG_VP9_HIGHBITDEPTH #endif // CONFIG_VP9_HIGHBITDEPTH
} }

View File

@ -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_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, void vp9_model_rd_from_var_lapndz(unsigned int var, unsigned int n,
unsigned int qstep, int *rate, unsigned int qstep, int *rate,