diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c index d535894734cf73bfdedc5d5ce791da96c8fb828f..f06a4ca883b134d57a3aa7f1704a080eeb51f5fd 100644 --- a/vp8/encoder/encodeframe.c +++ b/vp8/encoder/encodeframe.c @@ -399,13 +399,6 @@ void vp8cx_frame_init_quantizer(VP8_COMP *cpi) // 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); } diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index df1a6f57ef0aa9f4d232d10d8cd55a526cbbdd80..912d64179c9a6c40de39b0f2bad2558c774b7d75 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -3123,11 +3123,14 @@ static int pick_frame_size(VP8_COMP *cpi) 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; @@ -3138,13 +3141,19 @@ static void set_quantizer(VP8_COMP *cpi, int Q) 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)