Reinitialize quantizer only when any delta is changing

No need to reinitialize for base Q changes.

Change-Id: Ie76ec21dd3c5582d5183dbed75ed73a1eed3e291
This commit is contained in:
Attila Nagy 2011-02-18 10:01:49 +02:00
Родитель b2ae57f1b6
Коммит fb5a692d27
1 изменённых файлов: 13 добавлений и 6 удалений

Просмотреть файл

@ -3051,21 +3051,27 @@ 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;
int new_delta_q;
cm->base_qindex = Q;
/* if any of the delta_q values are changing update flag has to be set */
/* currently only y2dc_delta_q may change */
cm->y1dc_delta_q = 0;
cm->y2dc_delta_q = 0;
cm->y2ac_delta_q = 0;
cm->uvdc_delta_q = 0;
cm->uvac_delta_q = 0;
if(Q<4)
if (Q < 4)
{
update |= cm->y2dc_delta_q != 4-Q;
cm->y2dc_delta_q = 4-Q;
new_delta_q = 4-Q;
}
else
new_delta_q = 0;
update |= cm->y2dc_delta_q != new_delta_q;
cm->y2dc_delta_q = new_delta_q;
// Set Segment specific quatizers
mbd->segment_feature_data[MB_LVL_ALT_Q][0] = cpi->segment_feature_data[MB_LVL_ALT_Q][0];
@ -3073,6 +3079,7 @@ static void set_quantizer(VP8_COMP *cpi, int Q)
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];
/* quantizer has to be reinitialized for any delta_q changes */
if(update)
vp8cx_init_quantizer(cpi);