shithub: treason

Download patch

ref: 48e202712769741daf7806b0bbc6cd0d2fd5a50b
parent: ebb9eb6fea94a263e919b76ec0f0bdb0dcacdd60
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Wed Sep 23 10:46:20 EDT 2020

YUV: even faster

--- a/yuv.c
+++ b/yuv.c
@@ -17,32 +17,27 @@
 
 #define ONE do{ \
 			yy1 = (int)*Y * 0x10101; \
-			r = yy1 + 91881*cr1; \
-			r = (r & 0xff000000) ? ~(r >> 31) : (r>>16); \
-			g = yy1 - go; \
-			g = (g & 0xff000000) ? ~(g >> 31) : (g>>16); \
 			b = yy1 + 116130*cb1; \
-			b = (b & 0xff000000) ? ~(b >> 31) : (b>>16); \
-			RGB[2] = r; \
-			RGB[1] = g; \
-			RGB[0] = b; \
+			RGB[0] = (b >> 24) ? ~(b >> 31) : (b>>16); \
+			g = yy1 - go; \
+			RGB[1] = (g >> 24) ? ~(g >> 31) : (g>>16); \
+			r = yy1 + 91881*cr1; \
+			RGB[2] = (r >> 24) ? ~(r >> 31) : (r>>16); \
 }while(0)
 
 			ONE; Y += 1;        RGB += 3;
 			ONE; Y += Y_stride; RGB += RGB_stride;
 			ONE; Y -= 1;        RGB -= 3;
-			ONE; Y -= Y_stride; RGB -= RGB_stride;
+			ONE; Y -= Y_stride; RGB -= RGB_stride - 6;
 
 			Y += 2;
 			U += 1;
 			V += 1;
-
-			RGB += 6;
 		}
 
-		Y += 2*Y_stride - x;
+		Y += Y_stride*2 - x;
 		U += UV_stride - x/2;
 		V += UV_stride - x/2;
-		RGB += 2*RGB_stride - 3*x;
+		RGB += RGB_stride*2 - 3*x;
 	}
 }