summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2010-10-14 18:58:34 -0700
committerYaowu Xu <yaowu@google.com>2010-10-15 10:14:34 -0700
commit2e53e9e53ff00113dc8a9952d596020c648f13db (patch)
tree81f3a38a4199f2984169976031cad5a18bf72d6e
parenta2b598a2f964b0d7a1e5df74b66c70a1bca746ca (diff)
downloadlibvpx-2e53e9e53ff00113dc8a9952d596020c648f13db.tar.gz
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
-rw-r--r--vp8/encoder/encodeintra.c4
-rw-r--r--vp8/encoder/encodemb.c2
-rw-r--r--vp8/encoder/onyx_if.c10
-rw-r--r--vp8/encoder/onyx_int.h1
4 files changed, 13 insertions, 4 deletions
diff --git a/vp8/encoder/encodeintra.c b/vp8/encoder/encodeintra.c
index 6611e0077..a790456f8 100644
--- a/vp8/encoder/encodeintra.c
+++ b/vp8/encoder/encodeintra.c
@@ -105,7 +105,7 @@ void vp8_encode_intra16x16mby(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
#if !(CONFIG_REALTIME_ONLY)
#if 1
- if (x->optimize && x->rddiv > 1)
+ if (x->optimize==2 ||(x->optimize && x->rddiv > 1))
vp8_optimize_mby(x, rtcd);
#endif
@@ -200,7 +200,7 @@ void vp8_encode_intra16x16mbuv(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
#if !(CONFIG_REALTIME_ONLY)
#if 1
- if (x->optimize && x->rddiv > 1)
+ if (x->optimize==2 ||(x->optimize && x->rddiv > 1))
vp8_optimize_mbuv(x, rtcd);
#endif
diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c
index 1f9568902..782b6fd2d 100644
--- a/vp8/encoder/encodemb.c
+++ b/vp8/encoder/encodemb.c
@@ -633,7 +633,7 @@ void vp8_encode_inter16x16(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
vp8_quantize_mb(x);
#if !(CONFIG_REALTIME_ONLY)
- if (x->optimize && x->rddiv > 1)
+ if (x->optimize==2 ||(x->optimize && x->rddiv > 1))
vp8_optimize_mb(x, rtcd);
#endif
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index 34af6ea8e..382a9de58 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -1282,7 +1282,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
}
if (cpi->sf.optimize_coefficients == 1)
- cpi->mb.optimize = 1;
+ cpi->mb.optimize = 1 + cpi->is_next_src_alt_ref;
else
cpi->mb.optimize = 0;
@@ -1749,6 +1749,7 @@ void vp8_init_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
// YX Temp
cpi->last_alt_ref_sei = -1;
cpi->is_src_frame_alt_ref = 0;
+ cpi->is_next_src_alt_ref = 0;
#if 0
// Experimental RD Code
@@ -2034,6 +2035,7 @@ void vp8_change_config(VP8_PTR ptr, VP8_CONFIG *oxcf)
// YX Temp
cpi->last_alt_ref_sei = -1;
cpi->is_src_frame_alt_ref = 0;
+ cpi->is_next_src_alt_ref = 0;
#if 0
// 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;
cpi->source_alt_ref_pending = FALSE; // Clear Pending altf Ref flag.
cpi->is_src_frame_alt_ref = 0;
+ cpi->is_next_src_alt_ref = 0;
}
else
#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->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
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index cb768c018..8a34a1f3a 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -273,6 +273,7 @@ typedef struct
int last_alt_ref_sei;
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 alt_is_last; // Alt reference frame same as last ( short circuit altref search)