]> granicus.if.org Git - libvpx/commitdiff
vp9 svc: fix to make top layer frame non-ref
authorJerome Jiang <jianj@google.com>
Tue, 30 Jan 2018 00:38:28 +0000 (16:38 -0800)
committerJerome Jiang <jianj@google.com>
Tue, 30 Jan 2018 02:38:46 +0000 (18:38 -0800)
Add mismatch check to the datarate test of changing svc pattern on the
fly.

Change-Id: I6a878736de44e6a40c077ed6430aabd7fadabdd9

examples/vp9_spatial_svc_encoder.c
test/datarate_test.cc
vp9/encoder/vp9_svc_layercontext.c

index 85014a0cc1c1b16f38a92b33c894dabc13b43e25..d49a2307d24eef1a814ebf9b1625bfd95713ab83 100644 (file)
@@ -589,6 +589,10 @@ void set_frame_flags_bypass_mode(int sl, int tl, int num_spatial_layers,
       } else {
         ref_frame_config->frame_flags[sl] =
             VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF;
+        if (sl == num_spatial_layers - 1)
+          ref_frame_config->frame_flags[sl] =
+              VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_ARF |
+              VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF;
       }
     }
     if (tl == 0) {
index 8e68174ee2c92c9852da673e963f3bb09fb6ad10..158adf425a07f597ba71c4b4b1b94dcaf50b1b9d 100644 (file)
@@ -1879,6 +1879,13 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SL2TLDynamicPatternChange) {
   ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
   CheckLayerRateTargeting(&cfg_, number_spatial_layers_,
                           number_temporal_layers_, file_datarate_, 0.78, 1.15);
+#if CONFIG_VP9_DECODER
+  // Number of temporal layers > 1, so half of the frames in this SVC pattern
+  // will be non-reference frame and hence encoder will avoid loopfilter.
+  // Since frame dropper is off, we can expect 200 (half of the sequence)
+  // mismatched frames.
+  EXPECT_EQ(static_cast<unsigned int>(200), GetMismatchFrames());
+#endif
 }
 
 // Check basic rate targeting for 1 pass CBR SVC with 3 spatial layers and on
index 35d5ec3e068c5bab021bd658fec63326d8867842..54789ee70790bc107a353d4e8d17b20600e12900 100644 (file)
@@ -549,6 +549,8 @@ static void set_flags_and_fb_idx_for_temporal_mode2(VP9_COMP *const cpi) {
     if (!spatial_id) {
       cpi->ref_frame_flags = VP9_LAST_FLAG;
     } else {
+      if (spatial_id == cpi->svc.number_spatial_layers - 1)
+        cpi->ext_refresh_alt_ref_frame = 0;
       cpi->ref_frame_flags = VP9_LAST_FLAG | VP9_GOLD_FLAG;
     }
   }