Commit 6e0ec0b2 authored by Yunqing Wang's avatar Yunqing Wang
Browse files

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
parent 9d44fd6b
......@@ -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 &&
......
......@@ -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) {
......
......@@ -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
}
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment