Make ext-refs respect encoding flags.
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
diff --git a/test/error_resilience_test.cc b/test/error_resilience_test.cc
index cd0dca2..777ac49 100644
--- a/test/error_resilience_test.cc
+++ b/test/error_resilience_test.cc
@@ -164,6 +164,7 @@
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) {
diff --git a/vp10/common/enums.h b/vp10/common/enums.h
index 86a7efc..01f1e78 100644
--- a/vp10/common/enums.h
+++ b/vp10/common/enums.h
@@ -194,9 +194,11 @@
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;
diff --git a/vp10/encoder/encoder.c b/vp10/encoder/encoder.c
index f0de8ef..b34b15e 100644
--- a/vp10/encoder/encoder.c
+++ b/vp10/encoder/encoder.c
@@ -5137,10 +5137,16 @@
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 @@
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;