Index: source/libvpx/test/datarate_test.cc |
=================================================================== |
--- source/libvpx/test/datarate_test.cc (revision 291857) |
+++ source/libvpx/test/datarate_test.cc (working copy) |
@@ -42,6 +42,9 @@ |
virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, |
::libvpx_test::Encoder *encoder) { |
+ if (video->frame() == 1) { |
+ encoder->Control(VP8E_SET_NOISE_SENSITIVITY, denoiser_on_); |
+ } |
const vpx_rational_t tb = video->timebase(); |
timebase_ = static_cast<double>(tb.num) / tb.den; |
duration_ = 0; |
@@ -120,9 +123,40 @@ |
double file_datarate_; |
double effective_datarate_; |
size_t bits_in_last_frame_; |
+ int denoiser_on_; |
}; |
+// Check basic datarate targeting, for a single bitrate, but loop over the |
+// various denoiser settings. |
+TEST_P(DatarateTestLarge, DenoiserLevels) { |
+ cfg_.rc_buf_initial_sz = 500; |
+ cfg_.rc_dropframe_thresh = 1; |
+ cfg_.rc_max_quantizer = 56; |
+ cfg_.rc_end_usage = VPX_CBR; |
+ ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, |
+ 30, 1, 0, 140); |
+ for (int j = 1; j < 5; ++j) { |
+ // Run over the denoiser levels. |
+ // For the temporal denoiser (#if CONFIG_TEMPORAL_DENOISING) the level j |
+ // refers to the 4 denoiser modes: denoiserYonly, denoiserOnYUV, |
+ // denoiserOnAggressive, and denoiserOnAdaptive. |
+ // For the spatial denoiser (if !CONFIG_TEMPORAL_DENOISING), the level j |
+ // refers to the blur thresholds: 20, 40, 60 80. |
+ // The j = 0 case (denoiser off) is covered in the tests below. |
+ denoiser_on_ = j; |
+ cfg_.rc_target_bitrate = 300; |
+ ResetModel(); |
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
+ ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_ * 0.95) |
+ << " The datarate for the file exceeds the target!"; |
+ |
+ ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.3) |
+ << " The datarate for the file missed the target!"; |
+ } |
+} |
+ |
TEST_P(DatarateTestLarge, BasicBufferModel) { |
+ denoiser_on_ = 0; |
cfg_.rc_buf_initial_sz = 500; |
cfg_.rc_dropframe_thresh = 1; |
cfg_.rc_max_quantizer = 56; |
@@ -154,6 +188,7 @@ |
} |
TEST_P(DatarateTestLarge, ChangingDropFrameThresh) { |
+ denoiser_on_ = 0; |
cfg_.rc_buf_initial_sz = 500; |
cfg_.rc_max_quantizer = 36; |
cfg_.rc_end_usage = VPX_CBR; |