shithub: dav1d

Download patch

ref: 4fdb3ea91697bb390844f00b0e8aa4441c91802e
parent: bb8725fb412552f6393fb5eced8fda47cb686acd
author: Luc Trudeau <ltrudeau@twoorioles.com>
date: Fri Sep 28 07:31:32 EDT 2018

Fix left shift of negative value -1

Fix #40

--- a/src/picture.c
+++ b/src/picture.c
@@ -159,7 +159,7 @@
 
     // convert to luma units; include plane delay from loopfilters; clip
     const int ss_ver = p->p.p.layout != DAV1D_PIXEL_LAYOUT_I444;
-    y_unclipped <<= plane_type & ss_ver; // we rely here on PLANE_TYPE_UV being 1
+    y_unclipped *= 1 << (plane_type & ss_ver); // we rely here on PLANE_TYPE_UV being 1
     y_unclipped += (plane_type != PLANE_TYPE_BLOCK) * 8; // delay imposed by loopfilter
     const int y = iclip(y_unclipped, 0, p->p.p.h - 1);
     atomic_uint *const progress = &p->progress[plane_type != PLANE_TYPE_BLOCK];