3 /* { dg-options "-O2" } */
4 /* { dg-skip-if "requires io" { freestanding } } */
8 extern void abort (void);
10 typedef struct _PixelPacket
{ unsigned char r
, g
, b
; }
12 #define ARRAYLEN(X) (sizeof(X)/sizeof(X[0]))
14 #define COLS (ARRAYLEN(q) - 1)
15 PixelPacket p
[2*COLS
+ 22];
16 #define Minify(POS, WEIGHT) do { \
17 total_r += (WEIGHT)*(p[POS].r); \
18 total_g += (WEIGHT)*(p[POS].g); \
19 total_b += (WEIGHT)*(p[POS].b); \
21 unsigned long columns
= COLS
;
24 static const unsigned char answers
[COLS
] = { 31, 32, 34, 35, 36 };
26 for (x
= 0; x
< sizeof(p
)/sizeof(p
[0]); x
++) {
27 p
[x
].b
= (x
+ 34) | 1;
29 for (x
= 0; x
< columns
; x
++) {
30 double total_r
= 0, total_g
= 0, total_b
= 0;
31 double saved_r
= 0, saved_g
= 0, saved_b
= 0;
37 Minify(2*x
+ 11, 15.0);
38 Minify(2*x
+ 12, 7.0);
39 Minify(2*x
+ 18, 7.0);
40 Minify(2*x
+ 19, 15.0);
41 Minify(2*x
+ 20, 15.0);
42 Minify(2*x
+ 21, 7.0);
43 q
[x
].r
= (unsigned char)(total_r
/128.0 + 0.5);
44 q
[x
].g
= (unsigned char)(total_g
/128.0 + 0.5);
45 q
[x
].b
= (unsigned char)(total_b
/128.0 + 0.5);
46 fprintf(stderr
, "r:%f g:%f b:%f\n", saved_r
, saved_g
, saved_b
);
48 for (x
= 0; x
< COLS
; x
++) {
49 if (answers
[x
] != q
[x
].b
)