The encoder was not correctly catching transitions in the quantizer
deltas. If a delta_q was set, then the quantizer would be reinitialized
on every frame, but if they transitioned to 0, the quantizer would
not be reinitialized, leading to a encode-decode mismatch.
This bug was triggered by commit
999e155, which sets a Y2 delta Q
for very low base Q levels.
Change-Id: Ia6733464a55ee4ff2edbb82c0873980d345446f5
// Clear Zbin mode boost for default case
cpi->zbin_mode_boost = 0;
- // vp8cx_init_quantizer() is first called in vp8_create_compressor(). A check is added here so that vp8cx_init_quantizer() is only called
- // when these values are not all zero.
- if (cpi->common.y1dc_delta_q | cpi->common.y2dc_delta_q | cpi->common.uvdc_delta_q | cpi->common.y2ac_delta_q | cpi->common.uvac_delta_q)
- {
- vp8cx_init_quantizer(cpi);
- }
-
// MB level quantizer setup
vp8cx_mb_init_quantizer(cpi, &cpi->mb);
}
return 1;
}
+
static void set_quantizer(VP8_COMP *cpi, int Q)
{
VP8_COMMON *cm = &cpi->common;
MACROBLOCKD *mbd = &cpi->mb.e_mbd;
+ int update = 0;
+ update |= cm->base_qindex != Q;
cm->base_qindex = Q;
cm->y1dc_delta_q = 0;
if(Q<4)
{
+ update |= cm->y2dc_delta_q != 4-Q;
cm->y2dc_delta_q = 4-Q;
}
+
// Set Segment specific quatizers
mbd->segment_feature_data[MB_LVL_ALT_Q][0] = cpi->segment_feature_data[MB_LVL_ALT_Q][0];
mbd->segment_feature_data[MB_LVL_ALT_Q][1] = cpi->segment_feature_data[MB_LVL_ALT_Q][1];
mbd->segment_feature_data[MB_LVL_ALT_Q][2] = cpi->segment_feature_data[MB_LVL_ALT_Q][2];
mbd->segment_feature_data[MB_LVL_ALT_Q][3] = cpi->segment_feature_data[MB_LVL_ALT_Q][3];
+
+ if(update)
+ vp8cx_init_quantizer(cpi);
+
}
static void update_alt_ref_frame_and_stats(VP8_COMP *cpi)