]> granicus.if.org Git - libvpx/commitdiff
vp9: Enable cyclic refresh for HBD in real-time.
authorJerome Jiang <jianj@google.com>
Fri, 8 Jun 2018 01:05:23 +0000 (18:05 -0700)
committerJerome Jiang <jianj@google.com>
Mon, 18 Jun 2018 23:01:14 +0000 (16:01 -0700)
Keep denoiser and skin detection disabled since some key functions don't
work with >8 bits source.

Add test for HBD with denoiser and cyclic refresh enabled to make sure
nothing crashes.

BUG=webm:1534

Change-Id: Id61fe1e38ed1768f273870a6bdd5f163aa769fe4

test/vp9_end_to_end_test.cc
vp9/encoder/vp9_aq_cyclicrefresh.c
vp9/encoder/vp9_encoder.c
vp9/vp9_cx_iface.c

index d0cbfbbdafffb130bf500c619e4990b8477314ba..90a60c2f3c67e38cce53b7601fa5294dfde43764 100644 (file)
@@ -63,7 +63,7 @@ const libvpx_test::TestMode kEncodingModeVectors[] = {
 };
 
 // Speed settings tested
-const int kCpuUsedVectors[] = { 1, 2, 3, 5, 6 };
+const int kCpuUsedVectors[] = { 1, 2, 3, 5, 6, 7 };
 
 int is_extension_y4m(const char *filename) {
   const char *dot = strrchr(filename, '.');
@@ -82,7 +82,10 @@ class EndToEndTestLarge
   EndToEndTestLarge()
       : EncoderTest(GET_PARAM(0)), test_video_param_(GET_PARAM(2)),
         cpu_used_(GET_PARAM(3)), psnr_(0.0), nframes_(0),
-        encoding_mode_(GET_PARAM(1)) {}
+        encoding_mode_(GET_PARAM(1)) {
+    cyclic_refresh_ = 0;
+    denoiser_on_ = 0;
+  }
 
   virtual ~EndToEndTestLarge() {}
 
@@ -123,6 +126,9 @@ class EndToEndTestLarge
         encoder->Control(VP8E_SET_ARNR_MAXFRAMES, 7);
         encoder->Control(VP8E_SET_ARNR_STRENGTH, 5);
         encoder->Control(VP8E_SET_ARNR_TYPE, 3);
+      } else {
+        encoder->Control(VP9E_SET_NOISE_SENSITIVITY, denoiser_on_);
+        encoder->Control(VP9E_SET_AQ_MODE, cyclic_refresh_);
       }
     }
   }
@@ -138,6 +144,8 @@ class EndToEndTestLarge
 
   TestVideoParam test_video_param_;
   int cpu_used_;
+  int cyclic_refresh_;
+  int denoiser_on_;
 
  private:
   double psnr_;
@@ -170,6 +178,33 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) {
   EXPECT_GT(psnr, GetPsnrThreshold());
 }
 
+TEST_P(EndToEndTestLarge, EndtoEndPSNRDenoiserAQTest) {
+  cfg_.rc_target_bitrate = kBitrate;
+  cfg_.g_error_resilient = 0;
+  cfg_.g_profile = test_video_param_.profile;
+  cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;
+  cfg_.g_bit_depth = test_video_param_.bit_depth;
+  init_flags_ = VPX_CODEC_USE_PSNR;
+  cyclic_refresh_ = 3;
+  denoiser_on_ = 1;
+  if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
+
+  testing::internal::scoped_ptr<libvpx_test::VideoSource> video;
+  if (is_extension_y4m(test_video_param_.filename)) {
+    video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0,
+                                                kFrames));
+  } else {
+    video.reset(new libvpx_test::YUVVideoSource(
+        test_video_param_.filename, test_video_param_.fmt, kWidth, kHeight,
+        kFramerate, 1, 0, kFrames));
+  }
+  ASSERT_TRUE(video.get() != NULL);
+
+  ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
+  const double psnr = GetAveragePsnr();
+  EXPECT_GT(psnr, GetPsnrThreshold());
+}
+
 VP9_INSTANTIATE_TEST_CASE(EndToEndTestLarge,
                           ::testing::ValuesIn(kEncodingModeVectors),
                           ::testing::ValuesIn(kTestVectors),
index 95daadfe224281951add0246de990db752748532..aadedba39127ef718a47a98dad05ce2289956d4e 100644 (file)
@@ -428,9 +428,7 @@ void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) {
   double weight_segment = 0;
   int thresh_low_motion = (cm->width < 720) ? 55 : 20;
   cr->apply_cyclic_refresh = 1;
-  // TODO(jianj): Look into issue of cyclic refresh with high bitdepth.
-  if (cm->bit_depth > 8 || cm->frame_type == KEY_FRAME ||
-      cpi->svc.temporal_layer_id > 0 ||
+  if (cm->frame_type == KEY_FRAME || cpi->svc.temporal_layer_id > 0 ||
       (cpi->use_svc &&
        cpi->svc.layer_context[cpi->svc.temporal_layer_id].is_key_frame) ||
       (!cpi->use_svc && rc->avg_frame_low_motion < thresh_low_motion &&
index 2b1f2237f29de0d9ce1921333325f9274491dcea..fc199968751f1efbdc6c0a901c8bd7f21b10582a 100644 (file)
@@ -4888,6 +4888,12 @@ int vp9_receive_raw_frame(VP9_COMP *cpi, vpx_enc_frame_flags_t frame_flags,
   check_initial_width(cpi, subsampling_x, subsampling_y);
 #endif  // CONFIG_VP9_HIGHBITDEPTH
 
+#if CONFIG_VP9_HIGHBITDEPTH
+  // Disable denoiser for high bitdepth since vp9_denoiser_filter only works for
+  // 8 bits.
+  if (cm->bit_depth > 8) cpi->oxcf.noise_sensitivity = 0;
+#endif
+
 #if CONFIG_VP9_TEMPORAL_DENOISING
   setup_denoiser_buffer(cpi);
 #endif
index 0f0f6066f19dfa95f80635b4de1993bfd04b8dc6..55a26745c17833be07c46dcc2ce2de75f1484852 100644 (file)
@@ -709,8 +709,6 @@ static vpx_codec_err_t ctrl_set_noise_sensitivity(vpx_codec_alg_priv_t *ctx,
                                                   va_list args) {
   struct vp9_extracfg extra_cfg = ctx->extra_cfg;
   extra_cfg.noise_sensitivity = CAST(VP9E_SET_NOISE_SENSITIVITY, args);
-  // TODO(jianj): Look into issue of noise estimation with high bitdepth.
-  if (ctx->cfg.g_bit_depth > 8) extra_cfg.noise_sensitivity = 0;
   return update_extra_cfg(ctx, &extra_cfg);
 }