]> granicus.if.org Git - libvpx/commitdiff
Make ext-refs respect encoding flags.
authorGeza Lore <gezalore@gmail.com>
Wed, 13 Apr 2016 10:55:14 +0000 (11:55 +0100)
committerGeza Lore <gezalore@gmail.com>
Wed, 13 Apr 2016 11:03:58 +0000 (12:03 +0100)
The VP8_EFLAG_NO_UPD_LAST and VP8_EFLAG_NO_REF_LAST flags can be
passed to the encoder to signal that it should not update/reference
the LAST ref frame when encoding the current frame. With
--enable-ext-refs turned on, the new LAST2 LAST3 and LAST4 ref frames
could still be used or updated, which causes the
  VP10/ErrorResilienceTestLarge.DropFramesWithoutRecovery/{0,1,2}
tests to fail.

With this patch, if --enable-ext-refs is used, then
VP8_EFLAG_NO_UPD_LAST and VP8_EFLAG_NO_REF_LAST also applies to the
new LAST2 LAST3 and LAST4 ref frames, as well as the LAST ref frame.

Change-Id: If482b1c09bbaf914eca8e0348a2367bff261661d

test/error_resilience_test.cc
vp10/common/enums.h
vp10/encoder/encoder.c

index cd0dca235a355c97c2ea26a2333e5332b549df12..777ac493fdf1d91f23c9c39eb2305400f3eb2af5 100644 (file)
@@ -164,6 +164,7 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,
     mismatch_psnr_ += mismatch_psnr;
     ++mismatch_nframes_;
     // std::cout << "Mismatch frame psnr: " << mismatch_psnr << "\n";
+    ASSERT_TRUE(0) << "Encode/Decode mismatch found";
   }
 
   void SetErrorFrames(int num, unsigned int *list) {
index 86a7efcf3ba35dcb4d24a604cc6c89b594cd4d49..01f1e78ad8ad29f632612b024c1772ddd7bf66f2 100644 (file)
@@ -194,9 +194,11 @@ typedef enum {
   VP9_LAST4_FLAG = 1 << 3,
   VP9_GOLD_FLAG = 1 << 4,
   VP9_ALT_FLAG = 1 << 5,
+  VP9_REFFRAME_ALL = (1 << 6) - 1
 #else
   VP9_GOLD_FLAG = 1 << 1,
   VP9_ALT_FLAG = 1 << 2,
+  VP9_REFFRAME_ALL = (1 << 3) - 1
 #endif  // CONFIG_EXT_REFS
 } VP9_REFFRAME;
 
index f0de8ef408a7d4e91a282f1de6e40044f7c70450..b34b15eb9467ac5b52dd6e7c5d833f2d25697b2d 100644 (file)
@@ -5137,10 +5137,16 @@ int vp10_get_quantizer(VP10_COMP *cpi) {
 void vp10_apply_encoding_flags(VP10_COMP *cpi, vpx_enc_frame_flags_t flags) {
   if (flags & (VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_GF |
                VP8_EFLAG_NO_REF_ARF)) {
-    int ref = 7;
+    int ref = VP9_REFFRAME_ALL;
 
-    if (flags & VP8_EFLAG_NO_REF_LAST)
+    if (flags & VP8_EFLAG_NO_REF_LAST) {
       ref ^= VP9_LAST_FLAG;
+#if CONFIG_EXT_REFS
+      ref ^= VP9_LAST2_FLAG;
+      ref ^= VP9_LAST3_FLAG;
+      ref ^= VP9_LAST4_FLAG;
+#endif  // CONFIG_EXT_REFS
+    }
 
     if (flags & VP8_EFLAG_NO_REF_GF)
       ref ^= VP9_GOLD_FLAG;
@@ -5154,10 +5160,16 @@ void vp10_apply_encoding_flags(VP10_COMP *cpi, vpx_enc_frame_flags_t flags) {
   if (flags & (VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
                VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_FORCE_GF |
                VP8_EFLAG_FORCE_ARF)) {
-    int upd = 7;
+    int upd = VP9_REFFRAME_ALL;
 
-    if (flags & VP8_EFLAG_NO_UPD_LAST)
+    if (flags & VP8_EFLAG_NO_UPD_LAST) {
       upd ^= VP9_LAST_FLAG;
+#if CONFIG_EXT_REFS
+      upd ^= VP9_LAST2_FLAG;
+      upd ^= VP9_LAST3_FLAG;
+      upd ^= VP9_LAST4_FLAG;
+#endif  // CONFIG_EXT_REFS
+    }
 
     if (flags & VP8_EFLAG_NO_UPD_GF)
       upd ^= VP9_GOLD_FLAG;