shithub: dav1d

Download patch

ref: 6c81623eab4154e1387681695d51a52a08ec4eec
parent: 5595102721d3c298d7cee64e64878486a3b8bdad
author: Henrik Gramner <gramner@twoorioles.com>
date: Tue Oct 22 19:44:52 EDT 2019

Shrink some stack buffers in the C versions of ipred_z

Only the upsamling code requires a size of width/height * 2, but
upsampling is never performed when width or height is above 8.

--- a/src/ipred_tmpl.c
+++ b/src/ipred_tmpl.c
@@ -415,7 +415,7 @@
     angle &= 511;
     assert(angle < 90);
     int dx = dav1d_dr_intra_derivative[angle >> 1];
-    pixel top_out[(64 + 64) * 2];
+    pixel top_out[64 + 64];
     const pixel *top;
     int max_base_x;
     const int upsample_above = enable_intra_edge_filter ?
@@ -474,8 +474,8 @@
         get_upsample(width + height, 180 - angle, is_sm) : 0;
     const int upsample_above = enable_intra_edge_filter ?
         get_upsample(width + height, angle - 90, is_sm) : 0;
-    pixel edge[64 * 2 + 64 * 2 + 1];
-    pixel *const topleft = &edge[height * 2];
+    pixel edge[64 + 64 + 1];
+    pixel *const topleft = &edge[64];
 
     if (upsample_above) {
         upsample_edge(topleft, width + 1, topleft_in, 0, width + 1
@@ -494,8 +494,8 @@
         }
     }
     if (upsample_left) {
-        upsample_edge(edge, height + 1, &topleft_in[-height], 0, height + 1
-                      HIGHBD_TAIL_SUFFIX);
+        upsample_edge(&topleft[-height * 2], height + 1, &topleft_in[-height],
+                      0, height + 1 HIGHBD_TAIL_SUFFIX);
         dy <<= 1;
     } else {
         const int filter_strength = enable_intra_edge_filter ?
@@ -549,7 +549,7 @@
     angle &= 511;
     assert(angle > 180);
     int dy = dav1d_dr_intra_derivative[(270 - angle) >> 1];
-    pixel left_out[(64 + 64) * 2];
+    pixel left_out[64 + 64];
     const pixel *left;
     int max_base_y;
     const int upsample_left = enable_intra_edge_filter ?