shithub: dav1d

Download patch

ref: ed1298182b54d50bed64c232e31bd88290556e67
parent: 47a581a53d584214b528bcfcbe0898de9149948b
author: Ronald S. Bultje <[email protected]>
date: Wed Nov 7 04:22:16 EST 2018

Change stride of emu_edge buffer from 160 to 192

To account for overwrites of up to 31 pixels and widths of up to
128+7=135 pixels, yet still be aligned to 32.

--- a/src/lib.c
+++ b/src/lib.c
@@ -117,7 +117,7 @@
             if (!t->scratch.mem) goto error;
             memset(t->cf, 0, 32 * 32 * sizeof(int32_t));
             t->emu_edge =
-                dav1d_alloc_aligned(160 * (128 + 7) * sizeof(uint16_t), 32);
+                dav1d_alloc_aligned(192 * (128 + 7) * sizeof(uint16_t), 32);
             if (!t->emu_edge) goto error;
             if (f->n_tc > 1) {
                 pthread_mutex_init(&t->tile_thread.td.lock, NULL);
--- a/src/recon_tmpl.c
+++ b/src/recon_tmpl.c
@@ -530,10 +530,10 @@
     {
         f->dsp->mc.emu_edge(bw4 * h_mul + !!mx * 7, bh4 * v_mul + !!my * 7,
                             w, h, dx - !!mx * 3, dy - !!my * 3,
-                            t->emu_edge, 160 * sizeof(pixel),
+                            t->emu_edge, 192 * sizeof(pixel),
                             refp->p.data[pl], ref_stride);
-        ref = &t->emu_edge[160 * !!my * 3 + !!mx * 3];
-        ref_stride = 160 * sizeof(pixel);
+        ref = &t->emu_edge[192 * !!my * 3 + !!mx * 3];
+        ref_stride = 192 * sizeof(pixel);
     } else {
         ref = ((pixel *) refp->p.data[pl]) + PXSTRIDE(ref_stride) * dy + dx;
     }
@@ -668,10 +668,10 @@
             }
             if (dx < 3 || dx + 8 + 4 > width || dy < 3 || dy + 8 + 4 > height) {
                 f->dsp->mc.emu_edge(15, 15, width, height, dx - 3, dy - 3,
-                                    t->emu_edge, 160 * sizeof(pixel),
+                                    t->emu_edge, 192 * sizeof(pixel),
                                     refp->p.data[pl], ref_stride);
-                ref_ptr = &t->emu_edge[160 * 3 + 3];
-                ref_stride = 160 * sizeof(pixel);
+                ref_ptr = &t->emu_edge[192 * 3 + 3];
+                ref_stride = 192 * sizeof(pixel);
             } else {
                 ref_ptr = ((pixel *) refp->p.data[pl]) + PXSTRIDE(ref_stride) * dy + dx;
             }