summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Paniconi <marpan@google.com>2013-10-22 11:30:06 -0700
committerMarco Paniconi <marpan@google.com>2013-10-30 16:52:46 -0700
commitb26ce8b1bead574613fa20212bd6f15cc9613e2e (patch)
tree2bf08fd7ce6ae623a25563def1107f1ae0e26da8
parenta2a5c6f821483891f3488b3f14e2c72a81ffe8f6 (diff)
downloadlibvpx-b26ce8b1bead574613fa20212bd6f15cc9613e2e.tar
libvpx-b26ce8b1bead574613fa20212bd6f15cc9613e2e.tar.gz
libvpx-b26ce8b1bead574613fa20212bd6f15cc9613e2e.tar.bz2
libvpx-b26ce8b1bead574613fa20212bd6f15cc9613e2e.zip
Updates to 1-pass:
-Don't reduce maxQ for gold/alt in CBR mode. -Fix to min/maxQ for first/initial key frame. -Add more speeds to datarate test and reduce the starting bitrate for test. Change-Id: Id2a333d76dd3f6a51b322ca984588e2a22159c58
-rw-r--r--test/datarate_test.cc35
-rw-r--r--vp9/encoder/vp9_onyx_if.c9
2 files changed, 39 insertions, 5 deletions
diff --git a/test/datarate_test.cc b/test/datarate_test.cc
index 6d5064442..85f4bb668 100644
--- a/test/datarate_test.cc
+++ b/test/datarate_test.cc
@@ -176,14 +176,32 @@ TEST_P(DatarateTest, ChangingDropFrameThresh) {
}
}
-class DatarateTestVP9 : public DatarateTest {
+class DatarateTestVP9 : public ::libvpx_test::EncoderTest,
+ public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
+ public:
+ DatarateTestVP9() : EncoderTest(GET_PARAM(0)) {}
+
protected:
virtual ~DatarateTestVP9() {}
+ virtual void SetUp() {
+ InitializeConfig();
+ SetMode(GET_PARAM(1));
+ set_cpu_used_ = GET_PARAM(2);
+ ResetModel();
+ }
+
+ virtual void ResetModel() {
+ last_pts_ = 0;
+ frame_number_ = 0;
+ bits_total_ = 0;
+ duration_ = 0.0;
+ }
+
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
::libvpx_test::Encoder *encoder) {
if (video->frame() == 1) {
- encoder->Control(VP8E_SET_CPUUSED, 2);
+ encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
}
const vpx_rational_t tb = video->timebase();
timebase_ = static_cast<double>(tb.num) / tb.den;
@@ -205,6 +223,14 @@ class DatarateTestVP9 : public DatarateTest {
effective_datarate_ = ((bits_total_) / 1000.0) / duration_;
}
}
+
+ vpx_codec_pts_t last_pts_;
+ double timebase_;
+ int frame_number_;
+ int64_t bits_total_;
+ double duration_;
+ double effective_datarate_;
+ int set_cpu_used_;
};
// There is no buffer model/frame dropper in VP9 currently, so for now we
@@ -218,7 +244,7 @@ TEST_P(DatarateTestVP9, BasicRateTargeting) {
::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
30, 1, 0, 140);
- for (int i = 200; i < 800; i += 200) {
+ for (int i = 150; i < 800; i += 200) {
cfg_.rc_target_bitrate = i;
ResetModel();
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
@@ -231,5 +257,6 @@ TEST_P(DatarateTestVP9, BasicRateTargeting) {
VP8_INSTANTIATE_TEST_CASE(DatarateTest, ALL_TEST_MODES);
VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9,
- ::testing::Values(::libvpx_test::kOnePassGood));
+ ::testing::Values(::libvpx_test::kOnePassGood),
+ ::testing::Range(1, 5));
} // namespace
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index ad214c709..b664f1e99 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -2866,7 +2866,7 @@ static int pick_q_and_adjust_q_bounds(VP9_COMP *cpi,
cpi->active_best_quality = inter_minq[q];
// 1-pass: for now, use the average Q for the active_best, if its lower
// than active_worst.
- if (cpi->pass == 0 && (cpi->avg_frame_qindex < cpi->active_worst_quality))
+ if (cpi->pass == 0 && (cpi->avg_frame_qindex < q))
cpi->active_best_quality = inter_minq[cpi->avg_frame_qindex];
#endif
@@ -2902,7 +2902,14 @@ static int pick_q_and_adjust_q_bounds(VP9_COMP *cpi,
if (cm->frame_type == KEY_FRAME && !cpi->this_key_frame_forced) {
*top_index =
(cpi->active_worst_quality + cpi->active_best_quality * 3) / 4;
+ // If this is the first (key) frame in 1-pass, active best is the user
+ // best-allowed, and leave the top_index to active_worst.
+ if (cpi->pass == 0 && cpi->common.current_video_frame == 0) {
+ cpi->active_best_quality = cpi->oxcf.best_allowed_q;
+ *top_index = cpi->oxcf.worst_allowed_q;
+ }
} else if (!cpi->is_src_frame_alt_ref &&
+ (cpi->oxcf.end_usage != USAGE_STREAM_FROM_SERVER) &&
(cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
*top_index =
(cpi->active_worst_quality + cpi->active_best_quality) / 2;