Index: source/libvpx/test/datarate_test.cc |
=================================================================== |
--- source/libvpx/test/datarate_test.cc (revision 292072) |
+++ source/libvpx/test/datarate_test.cc (working copy) |
@@ -126,6 +126,7 @@ |
int denoiser_on_; |
}; |
+#if CONFIG_TEMPORAL_DENOISING |
// Check basic datarate targeting, for a single bitrate, but loop over the |
// various denoiser settings. |
TEST_P(DatarateTestLarge, DenoiserLevels) { |
@@ -154,6 +155,7 @@ |
<< " The datarate for the file missed the target!"; |
} |
} |
+#endif // CONFIG_TEMPORAL_DENOISING |
TEST_P(DatarateTestLarge, BasicBufferModel) { |
denoiser_on_ = 0; |
@@ -238,6 +240,8 @@ |
tot_frame_number_ = 0; |
first_drop_ = 0; |
num_drops_ = 0; |
+ // Denoiser is off by default. |
+ denoiser_on_ = 0; |
// For testing up to 3 layers. |
for (int i = 0; i < 3; ++i) { |
bits_total_[i] = 0; |
@@ -311,6 +315,7 @@ |
::libvpx_test::Encoder *encoder) { |
if (video->frame() == 1) { |
encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_); |
+ encoder->Control(VP9E_SET_NOISE_SENSITIVITY, denoiser_on_); |
} |
if (cfg_.ts_number_layers > 1) { |
if (video->frame() == 1) { |
@@ -392,6 +397,7 @@ |
int64_t bits_in_buffer_model_; |
vpx_codec_pts_t first_drop_; |
int num_drops_; |
+ int denoiser_on_; |
}; |
// Check basic rate targeting, |
@@ -615,6 +621,36 @@ |
} |
} |
+#if CONFIG_VP9_TEMPORAL_DENOISING |
+// Check basic datarate targeting, for a single bitrate, when denoiser is on. |
+TEST_P(DatarateTestVP9Large, DenoiserLevels) { |
+ cfg_.rc_buf_initial_sz = 500; |
+ cfg_.rc_buf_optimal_sz = 500; |
+ cfg_.rc_buf_sz = 1000; |
+ cfg_.rc_dropframe_thresh = 1; |
+ cfg_.rc_min_quantizer = 2; |
+ cfg_.rc_max_quantizer = 56; |
+ cfg_.rc_end_usage = VPX_CBR; |
+ cfg_.g_lag_in_frames = 0; |
+ |
+ ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, |
+ 30, 1, 0, 140); |
+ |
+ // For the temporal denoiser (#if CONFIG_VP9_TEMPORAL_DENOISING), |
+ // there is only one denoiser mode: denoiserYonly(which is 1), |
+ // but may add more modes in the future. |
+ cfg_.rc_target_bitrate = 300; |
+ ResetModel(); |
+ // Turn on the denoiser. |
+ denoiser_on_ = 1; |
+ ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
+ ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85) |
+ << " The datarate for the file is lower than target by too much!"; |
+ ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15) |
+ << " The datarate for the file is greater than target by too much!"; |
+} |
+#endif // CONFIG_VP9_TEMPORAL_DENOISING |
+ |
VP8_INSTANTIATE_TEST_CASE(DatarateTestLarge, ALL_TEST_MODES); |
VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9Large, |
::testing::Values(::libvpx_test::kOnePassGood, |