Bugfix: assertion when encoding multiple keyframes
BUG=aomedia:1514
Change-Id: I6868bac0cb525263edb1ed0a6939dc8a60181d27
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 2e0cc96..11512a4 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -901,9 +901,12 @@
static void write_cdef(AV1_COMMON *cm, aom_writer *w, int skip, int mi_col,
int mi_row) {
- if (cm->all_lossless) return;
- if (cm->allow_intrabc && NO_FILTER_FOR_IBC) {
- assert(cm->cdef_bits == 0);
+ if (cm->all_lossless || (cm->allow_intrabc && NO_FILTER_FOR_IBC)) {
+ // Initialize to indicate no CDEF for safety.
+ cm->cdef_bits = 0;
+ cm->cdef_strengths[0] = 0;
+ cm->nb_cdef_strengths = 1;
+ cm->cdef_uv_strengths[0] = 0;
return;
}