change to make use of more trellis quantization

when a subsequent frame is encoded as an alt reference frame, it is
unlikely that any mb in current frame will be used as reference for
future frames, so we can enable quantization optimization even when
the RD constant is slightly rate-biased. The change has an overall
benefit between 0.1% to 0.2% bit savings on the test sets based on
vpxssim scores.

Change-Id: I9aa7bc5cd573ea84e3ee655d2834c18c4460ceea
This commit is contained in:
Yaowu Xu 2010-10-14 18:58:34 -07:00
Родитель a2b598a2f9
Коммит 2e53e9e53f
4 изменённых файлов: 13 добавлений и 4 удалений

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

@ -105,7 +105,7 @@ void vp8_encode_intra16x16mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
#if !(CONFIG_REALTIME_ONLY) #if !(CONFIG_REALTIME_ONLY)
#if 1 #if 1
if (x->optimize && x->rddiv > 1) if (x->optimize==2 ||(x->optimize && x->rddiv > 1))
vp8_optimize_mby(x, rtcd); vp8_optimize_mby(x, rtcd);
#endif #endif
@ -200,7 +200,7 @@ void vp8_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
#if !(CONFIG_REALTIME_ONLY) #if !(CONFIG_REALTIME_ONLY)
#if 1 #if 1
if (x->optimize && x->rddiv > 1) if (x->optimize==2 ||(x->optimize && x->rddiv > 1))
vp8_optimize_mbuv(x, rtcd); vp8_optimize_mbuv(x, rtcd);
#endif #endif

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

@ -633,7 +633,7 @@ void vp8_encode_inter16x16(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
vp8_quantize_mb(x); vp8_quantize_mb(x);
#if !(CONFIG_REALTIME_ONLY) #if !(CONFIG_REALTIME_ONLY)
if (x->optimize && x->rddiv > 1) if (x->optimize==2 ||(x->optimize && x->rddiv > 1))
vp8_optimize_mb(x, rtcd); vp8_optimize_mb(x, rtcd);
#endif #endif

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

@ -1282,7 +1282,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
} }
if (cpi->sf.optimize_coefficients == 1) if (cpi->sf.optimize_coefficients == 1)
cpi->mb.optimize = 1; cpi->mb.optimize = 1 + cpi->is_next_src_alt_ref;
else else
cpi->mb.optimize = 0; cpi->mb.optimize = 0;
@ -1749,6 +1749,7 @@ void vp8_init_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
// YX Temp // YX Temp
cpi->last_alt_ref_sei = -1; cpi->last_alt_ref_sei = -1;
cpi->is_src_frame_alt_ref = 0; cpi->is_src_frame_alt_ref = 0;
cpi->is_next_src_alt_ref = 0;
#if 0 #if 0
// Experimental RD Code // Experimental RD Code
@ -2034,6 +2035,7 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
// YX Temp // YX Temp
cpi->last_alt_ref_sei = -1; cpi->last_alt_ref_sei = -1;
cpi->is_src_frame_alt_ref = 0; cpi->is_src_frame_alt_ref = 0;
cpi->is_next_src_alt_ref = 0;
#if 0 #if 0
// Experimental RD Code // Experimental RD Code
@ -5419,6 +5421,7 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
cm->show_frame = 0; cm->show_frame = 0;
cpi->source_alt_ref_pending = FALSE; // Clear Pending altf Ref flag. cpi->source_alt_ref_pending = FALSE; // Clear Pending altf Ref flag.
cpi->is_src_frame_alt_ref = 0; cpi->is_src_frame_alt_ref = 0;
cpi->is_next_src_alt_ref = 0;
} }
else else
#endif #endif
@ -5437,6 +5440,11 @@ int vp8_get_compressed_data(VP8_PTR ptr, unsigned int *frame_flags, unsigned lon
cpi->is_src_frame_alt_ref = 0; cpi->is_src_frame_alt_ref = 0;
cpi->source_encode_index = (cpi->source_encode_index + 1) % cpi->oxcf.lag_in_frames; cpi->source_encode_index = (cpi->source_encode_index + 1) % cpi->oxcf.lag_in_frames;
if(cpi->source_encode_index == cpi->last_alt_ref_sei)
cpi->is_next_src_alt_ref = 1;
else
cpi->is_next_src_alt_ref = 0;
} }
#endif #endif

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

@ -273,6 +273,7 @@ typedef struct
int last_alt_ref_sei; int last_alt_ref_sei;
int is_src_frame_alt_ref; int is_src_frame_alt_ref;
int is_next_src_alt_ref;
int gold_is_last; // golden frame same as last frame ( short circuit gold searches) int gold_is_last; // golden frame same as last frame ( short circuit gold searches)
int alt_is_last; // Alt reference frame same as last ( short circuit altref search) int alt_is_last; // Alt reference frame same as last ( short circuit altref search)