shithub: dav1d

Download patch

ref: 0bf59f09b246f6266001ef57e5628282a9ea3920
parent: cf9ec49ac7d0c766ea88ea801c0831bca3e663a9
author: Ronald S. Bultje <rsbultje@gmail.com>
date: Tue Nov 13 15:09:21 EST 2018

Fix segmentation map size check

Fixes #166.

--- a/src/decode.c
+++ b/src/decode.c
@@ -3093,8 +3093,8 @@
         if (f->frame_hdr.segmentation.temporal || !f->frame_hdr.segmentation.update_map) {
             const int pri_ref = f->frame_hdr.primary_ref_frame;
             assert(pri_ref != PRIMARY_REF_NONE);
-            const int ref_w = (f->refp[pri_ref].p.p.w + 3) >> 2;
-            const int ref_h = (f->refp[pri_ref].p.p.h + 3) >> 2;
+            const int ref_w = ((f->refp[pri_ref].p.p.w + 7) >> 3) << 1;
+            const int ref_h = ((f->refp[pri_ref].p.p.h + 7) >> 3) << 1;
             if (ref_w == f->bw && ref_h == f->bh) {
                 f->prev_segmap_ref = c->refs[f->frame_hdr.refidx[pri_ref]].segmap;
                 if (f->prev_segmap_ref == NULL) {