View | Details | Raw Unified | Return to bug 208757
Collapse All | Expand All

(-)games/edge/files/patch-epi__image_hq2x.cc (+26 lines)
Line 0 Link Here
1
--- epi/image_hq2x.cc.orig	2009-10-18 12:33:23.000000000 +0200
2
+++ epi/image_hq2x.cc	2016-04-12 22:06:00.628879000 +0200
3
@@ -169,15 +169,20 @@ void Interp10(u8_t * dest, u32_t c1, u32
4
 #define PIXEL11_90    Interp9(dest+BpL+4, c[5], c[6], c[8]);
5
 #define PIXEL11_100   Interp10(dest+BpL+4, c[5], c[6], c[8]);
6
 
7
+static inline u32_t UDiff(u32_t u1, u32_t u2)
8
+{
9
+	return (u1 >= u2) ? u1 - u2 : u2 - u1;
10
+}
11
+
12
 inline bool Diff(const u8_t p1, const u8_t p2)
13
 {
14
 	u32_t YUV1 = PixelYUV[p1];
15
 	u32_t YUV2 = PixelYUV[p2];
16
 
17
 	return (YUV1 & Amask) != (YUV2 & Amask) ||
18
-		   (u32_t)abs((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ||
19
-		   (u32_t)abs((YUV1 & Umask) - (YUV2 & Umask)) > trU ||
20
-		   (u32_t)abs((YUV1 & Vmask) - (YUV2 & Vmask)) > trV;
21
+		   UDiff((YUV1 & Ymask), (YUV2 & Ymask)) > trY ||
22
+		   UDiff((YUV1 & Umask), (YUV2 & Umask)) > trU ||
23
+		   UDiff((YUV1 & Vmask), (YUV2 & Vmask)) > trV;
24
 }
25
 
26
 void Setup(const u8_t *palette, int trans_pixel)

Return to bug 208757