shithub: dav1d

Download patch

ref: f6a8cc0cee72b659b5a878b6f5f324077c85aa36
parent: f7743da199f9ccca9e15e8faf37c0bfa36d482f1
author: Ronald S. Bultje <rsbultje@gmail.com>
date: Mon Sep 30 11:30:30 EDT 2019

Minor cleanup

--- a/src/fg_apply_tmpl.c
+++ b/src/fg_apply_tmpl.c
@@ -42,9 +42,12 @@
                              const uint8_t points[][2], const int num,
                              uint8_t scaling[SCALING_SIZE])
 {
+#if BITDEPTH == 8
+    const int shift_x = 0;
+#else
     const int shift_x = bitdepth - 8;
+#endif
     const int scaling_size = 1 << bitdepth;
-    const int pad = 1 << shift_x;
 
     // Fill up the preceding entries with the initial value
     for (int i = 0; i < points[0][0] << shift_x; i++)
@@ -69,9 +72,8 @@
     for (int i = points[num - 1][0] << shift_x; i < scaling_size; i++)
         scaling[i] = points[num - 1][1];
 
-    if (pad <= 1) return;
-
-    const int rnd = pad >> 1;
+#if BITDEPTH != 8
+    const int pad = 1 << shift_x, rnd = pad >> 1;
     for (int i = 0; i < num - 1; i++) {
         const int bx = points[i][0] << shift_x;
         const int ex = points[i+1][0] << shift_x;
@@ -83,6 +85,7 @@
             }
         }
     }
+#endif
 }
 
 #ifndef UNIT_TEST
--- a/src/film_grain_tmpl.c
+++ b/src/film_grain_tmpl.c
@@ -156,8 +156,8 @@
 // samples from the correct block of a grain LUT, while taking into account the
 // offsets provided by the offsets cache
 static inline entry sample_lut(const entry grain_lut[][GRAIN_WIDTH],
-                               int offsets[2][2], int subx, int suby,
-                               int bx, int by, int x, int y)
+                               const int offsets[2][2], const int subx, const int suby,
+                               const int bx, const int by, const int x, const int y)
 {
     const int randval = offsets[bx][by];
     const int offx = 3 + (2 >> subx) * (3 + (randval >> 4));