shithub: dav1d

Download patch

ref: 5a4ae342706270467a9bf314823546805bc0d70a
parent: d8799d94772e89ec1046f06f8a03c50e052b0085
author: Luc Trudeau <[email protected]>
date: Thu Aug 8 13:23:49 EDT 2019

Quick out if seg_id == 0 in get_prev_frame_segid

--- a/src/decode.c
+++ b/src/decode.c
@@ -673,8 +673,6 @@
                                             const uint8_t *ref_seg_map,
                                             const ptrdiff_t stride)
 {
-    unsigned seg_id = 8;
-
     assert(f->frame_hdr->primary_ref_frame != DAV1D_PRIMARY_REF_NONE);
     if (dav1d_thread_picture_wait(&f->refp[f->frame_hdr->primary_ref_frame],
                                   (by + h4) * 4, PLANE_TYPE_BLOCK))
@@ -682,12 +680,13 @@
         return 8;
     }
 
+    unsigned seg_id = 8;
     ref_seg_map += by * stride + bx;
     do {
         for (int x = 0; x < w4; x++)
             seg_id = imin(seg_id, ref_seg_map[x]);
         ref_seg_map += stride;
-    } while (--h4 > 0);
+    } while (--h4 > 0 && seg_id);
     assert(seg_id < 8);
 
     return seg_id;