Merge "test_vector_test: Add row-mt and lpf-opt tests for vp9 decoder"
diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c
index 1eac502..da600fb 100644
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -1356,7 +1356,12 @@
write_uncompressed_header(cpi, &wb);
// Skip the rest coding process if use show existing frame.
- if (cpi->common.show_existing_frame) return;
+ if (cpi->common.show_existing_frame) {
+ uncompressed_hdr_size = vpx_wb_bytes_written(&wb);
+ data += uncompressed_hdr_size;
+ *size = data - dest;
+ return;
+ }
saved_wb = wb;
vpx_wb_write_literal(&wb, 0, 16); // don't know in advance first part. size
diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c
index 4f103ff..f7e3237 100644
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -3748,6 +3748,7 @@
: 0;
if (cm->show_existing_frame) {
+ cpi->rc.this_frame_target = 0;
if (is_psnr_calc_enabled(cpi)) set_raw_source_frame(cpi);
return 1;
}
@@ -4071,6 +4072,7 @@
#endif
if (cm->show_existing_frame) {
+ rc->this_frame_target = 0;
if (is_psnr_calc_enabled(cpi)) set_raw_source_frame(cpi);
return;
}
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index ae84dd5..5fdca8d 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2887,7 +2887,9 @@
#define FRAMES_TO_CHECK_DECAY 8
#define MIN_KF_TOT_BOOST 300
-#define KF_BOOST_SCAN_MAX_FRAMES 32
+#define DEFAULT_SCAN_FRAMES_FOR_KF_BOOST 32
+#define MAX_SCAN_FRAMES_FOR_KF_BOOST 48
+#define MIN_SCAN_FRAMES_FOR_KF_BOOST 32
#define KF_ABS_ZOOM_THRESH 6.0
#ifdef AGGRESSIVE_VBR
@@ -2911,6 +2913,12 @@
int kf_bits = 0;
double decay_accumulator = 1.0;
double zero_motion_accumulator = 1.0;
+ double zero_motion_sum = 0.0;
+ double zero_motion_avg;
+ double motion_compensable_sum = 0.0;
+ double motion_compensable_avg;
+ int num_frames = 0;
+ int kf_boost_scan_frames = DEFAULT_SCAN_FRAMES_FOR_KF_BOOST;
double boost_score = 0.0;
double kf_mod_err = 0.0;
double kf_raw_err = 0.0;
@@ -3063,13 +3071,34 @@
// how many bits to spend on it.
boost_score = 0.0;
+ for (i = 0; i < VPXMIN(MAX_SCAN_FRAMES_FOR_KF_BOOST, (rc->frames_to_key - 1));
+ ++i) {
+ if (EOF == input_stats(twopass, &next_frame)) break;
+
+ zero_motion_sum += next_frame.pcnt_inter - next_frame.pcnt_motion;
+ motion_compensable_sum +=
+ 1 - (double)next_frame.coded_error / next_frame.intra_error;
+ num_frames++;
+ }
+
+ if (num_frames >= MIN_SCAN_FRAMES_FOR_KF_BOOST) {
+ zero_motion_avg = zero_motion_sum / num_frames;
+ motion_compensable_avg = motion_compensable_sum / num_frames;
+ kf_boost_scan_frames = (int)(VPXMAX(64 * zero_motion_avg - 16,
+ 160 * motion_compensable_avg - 112));
+ kf_boost_scan_frames =
+ VPXMAX(VPXMIN(kf_boost_scan_frames, MAX_SCAN_FRAMES_FOR_KF_BOOST),
+ MIN_SCAN_FRAMES_FOR_KF_BOOST);
+ }
+ reset_fpf_position(twopass, start_position);
+
for (i = 0; i < (rc->frames_to_key - 1); ++i) {
if (EOF == input_stats(twopass, &next_frame)) break;
// The zero motion test here insures that if we mark a kf group as static
// it is static throughout not just the first KF_BOOST_SCAN_MAX_FRAMES.
// It also allows for a larger boost on long static groups.
- if ((i <= KF_BOOST_SCAN_MAX_FRAMES) || (zero_motion_accumulator >= 0.99)) {
+ if ((i <= kf_boost_scan_frames) || (zero_motion_accumulator >= 0.99)) {
double frame_boost;
double zm_factor;