shithub: dav1d

Download patch

ref: aeb5a5efc840da40c58d579b4e8792cb911bc6ba
parent: b7d2b7d2f82994f70edd9bfb908a02884731d4cc
author: James Almer <[email protected]>
date: Wed Oct 31 14:51:20 EDT 2018

explicitly clear some Dav1dRef pointers after calling dav1d_ref_dec()

Partially reverts b7d2b7d2f82994f70edd9bfb908a02884731d4cc, fixing a regression
introduced by it.

--- a/src/decode.c
+++ b/src/decode.c
@@ -3018,7 +3018,9 @@
             if (f->cur_segmap_ref)
                 dav1d_ref_inc(f->cur_segmap_ref);
             dav1d_ref_dec(&c->refs[i].refmvs);
-            if (!f->frame_hdr.allow_intrabc) {
+            if (f->frame_hdr.allow_intrabc) {
+                c->refs[i].refmvs = NULL;
+            } else {
                 c->refs[i].refmvs = f->mvs_ref;
                 if (f->mvs_ref)
                     dav1d_ref_inc(f->mvs_ref);
@@ -3038,7 +3040,9 @@
                     if (c->cdf[i].cdf)
                         dav1d_cdf_thread_unref(&c->cdf[i]);
                     dav1d_ref_dec(&c->refs[i].segmap);
+                    c->refs[i].segmap = NULL;
                     dav1d_ref_dec(&c->refs[i].refmvs);
+                    c->refs[i].refmvs = NULL;
                 }
             }
             return res;
--- a/src/obu.c
+++ b/src/obu.c
@@ -1060,7 +1060,9 @@
                 if (c->refs[i].p.p.data[0])
                     dav1d_thread_picture_unref(&c->refs[i].p);
                 dav1d_ref_dec(&c->refs[i].segmap);
+                c->refs[i].segmap = NULL;
                 dav1d_ref_dec(&c->refs[i].refmvs);
+                c->refs[i].refmvs = NULL;
                 if (c->cdf[i].cdf)
                     dav1d_cdf_thread_unref(&c->cdf[i]);
             }
@@ -1187,6 +1189,7 @@
                 if (c->refs[r].segmap)
                     dav1d_ref_inc(c->refs[r].segmap);
                 dav1d_ref_dec(&c->refs[i].refmvs);
+                c->refs[i].refmvs = NULL;
                 c->refs[i].qidx = c->refs[r].qidx;
             }
         }