shithub: dav1d

Download patch

ref: 81aba493930a7849af24217657cf1061608666b2
parent: a4178cc20d1495543295ea55eead3581b189ec86
author: Henrik Gramner <gramner@twoorioles.com>
date: Mon Dec 30 23:13:01 EST 2019

Fix C inverse ADST clipping

--- a/src/itx_1d.c
+++ b/src/itx_1d.c
@@ -709,16 +709,15 @@
     t6a = (((3784 - 4096) * t7 -  1567         * t6 + 2048) >> 12) + t7;
     t7a = (( 1567         * t7 + (3784 - 4096) * t6 + 2048) >> 12) + t6;
 
-    out[0 * out_s] = CLIP(  t0 + t2);
-    out[7 * out_s] = CLIP(-(t1 + t3));
-    t2             = CLIP(  t0 - t2);
-    t3             = CLIP(  t1 - t3);
+    out[0 * out_s] =  CLIP(t0  + t2 );
+    out[7 * out_s] = -CLIP(t1  + t3 );
+    t2             =  CLIP(t0  - t2 );
+    t3             =  CLIP(t1  - t3 );
+    out[1 * out_s] = -CLIP(t4a + t6a);
+    out[6 * out_s] =  CLIP(t5a + t7a);
+    t6             =  CLIP(t4a - t6a);
+    t7             =  CLIP(t5a - t7a);
 
-    out[1 * out_s] = CLIP(-(t4a + t6a));
-    out[6 * out_s] = CLIP(  t5a + t7a );
-    t6             = CLIP(  t4a - t6a );
-    t7             = CLIP(  t5a - t7a );
-
     out[3 * out_s] = -(((t2 + t3) * 181 + 128) >> 8);
     out[4 * out_s] =   ((t2 - t3) * 181 + 128) >> 8;
     out[2 * out_s] =   ((t6 + t7) * 181 + 128) >> 8;
@@ -808,22 +807,22 @@
     t14  = ((t15a * (3784 - 4096) - t14a *  1567         + 2048) >> 12) + t15a;
     t15  = ((t15a *  1567         + t14a * (3784 - 4096) + 2048) >> 12) + t14a;
 
-    out[ 0 * out_s] = CLIP(  t0  + t2   );
-    out[15 * out_s] = CLIP(-(t1  + t3)  );
-    t2a             = CLIP(  t0  - t2   );
-    t3a             = CLIP(  t1  - t3   );
-    out[ 3 * out_s] = CLIP(-(t4a + t6a) );
-    out[12 * out_s] = CLIP(  t5a + t7a  );
-    t6              = CLIP(  t4a - t6a  );
-    t7              = CLIP(  t5a - t7a  );
-    out[ 1 * out_s] = CLIP(-(t8a + t10a));
-    out[14 * out_s] = CLIP(  t9a + t11a );
-    t10             = CLIP(  t8a - t10a );
-    t11             = CLIP(  t9a - t11a );
-    out[ 2 * out_s] = CLIP(  t12 + t14  );
-    out[13 * out_s] = CLIP(-(t13 + t15) );
-    t14a            = CLIP(  t12 - t14  );
-    t15a            = CLIP(  t13 - t15  );
+    out[ 0 * out_s] =  CLIP(t0  + t2  );
+    out[15 * out_s] = -CLIP(t1  + t3  );
+    t2a             =  CLIP(t0  - t2  );
+    t3a             =  CLIP(t1  - t3  );
+    out[ 3 * out_s] = -CLIP(t4a + t6a );
+    out[12 * out_s] =  CLIP(t5a + t7a );
+    t6              =  CLIP(t4a - t6a );
+    t7              =  CLIP(t5a - t7a );
+    out[ 1 * out_s] = -CLIP(t8a + t10a);
+    out[14 * out_s] =  CLIP(t9a + t11a);
+    t10             =  CLIP(t8a - t10a);
+    t11             =  CLIP(t9a - t11a);
+    out[ 2 * out_s] =  CLIP(t12 + t14 );
+    out[13 * out_s] = -CLIP(t13 + t15 );
+    t14a            =  CLIP(t12 - t14 );
+    t15a            =  CLIP(t13 - t15 );
 
     out[ 7 * out_s] = -(((t2a  + t3a)  * 181 + 128) >> 8);
     out[ 8 * out_s] =   ((t2a  - t3a)  * 181 + 128) >> 8;