gifsicle-1.92.patchset revision 076894e2
1From b1338f362620d9bbfe4c1ca41ae37c0c7ceeca53 Mon Sep 17 00:00:00 2001
2From: Jerome Duval <jerome.duval@gmail.com>
3Date: Fri, 3 May 2019 19:04:54 +0200
4Subject: gcc2 patch
5
6
7diff --git a/src/gifwrite.c b/src/gifwrite.c
8index 3688a09..50b2c4d 100644
9--- a/src/gifwrite.c
10+++ b/src/gifwrite.c
11@@ -210,6 +210,8 @@ typedef struct gfc_rgbdiff {signed short r, g, b;} gfc_rgbdiff;
12 /* Difference (MSE) between given color indexes + dithering error */
13 static inline unsigned int color_diff(Gif_Color a, Gif_Color b, int a_transparent, int b_transparent, gfc_rgbdiff dither)
14 {
15+  unsigned int dith, undith;
16+
17   /* if one is transparent and the other is not, then return maximum difference */
18   /* TODO: figure out what color is in the canvas under the transparent pixel and match against that */
19   if (a_transparent != b_transparent) return 1<<25;
20@@ -218,11 +220,11 @@ static inline unsigned int color_diff(Gif_Color a, Gif_Color b, int a_transparen
21   if (a_transparent) return 0;
22 
23   /* squared error with or without dithering. */
24-  unsigned int dith = (a.gfc_red-b.gfc_red+dither.r)*(a.gfc_red-b.gfc_red+dither.r)
25+  dith = (a.gfc_red-b.gfc_red+dither.r)*(a.gfc_red-b.gfc_red+dither.r)
26   + (a.gfc_green-b.gfc_green+dither.g)*(a.gfc_green-b.gfc_green+dither.g)
27   + (a.gfc_blue-b.gfc_blue+dither.b)*(a.gfc_blue-b.gfc_blue+dither.b);
28 
29-  unsigned int undith = (a.gfc_red-b.gfc_red+dither.r/2)*(a.gfc_red-b.gfc_red+dither.r/2)
30+  undith = (a.gfc_red-b.gfc_red+dither.r/2)*(a.gfc_red-b.gfc_red+dither.r/2)
31   + (a.gfc_green-b.gfc_green+dither.g/2)*(a.gfc_green-b.gfc_green+dither.g/2)
32   + (a.gfc_blue-b.gfc_blue+dither.b/2)*(a.gfc_blue-b.gfc_blue+dither.b/2);
33 
34@@ -336,9 +338,10 @@ gfc_lookup_lossy(Gif_CodeTable *gfc, const Gif_Colormap *gfcm, Gif_Image *gfi,
35   unsigned image_endpos = gfi->width * gfi->height;
36 
37   struct selected_node best_t = {node, pos, base_diff};
38+  uint8_t suffix;
39   if (pos >= image_endpos) return best_t;
40 
41-  uint8_t suffix = gif_pixel_at_pos(gfi, pos);
42+  suffix = gif_pixel_at_pos(gfi, pos);
43   assert(!node || (node >= gfc->nodes && node < gfc->nodes + NODES_SIZE));
44   assert(suffix < gfc->clear_code);
45   if (!node) {
46-- 
472.21.0
48
49