fix nw802-2.4 compile
[openwrt/svn-archive/archive.git] / package / nw802-2.4 / patches / 100-compile_fix.patch
1 --- a/nw8xx_jpgl.c
2 +++ b/nw8xx_jpgl.c
3 @@ -111,18 +111,18 @@
4 // Clamping table
5 #define SAFE_CLAMP
6 #ifdef SAFE_CLAMP
7 -inline unsigned char clamp(int x) {
8 +inline unsigned char nw8xx_clamp(int x) {
9 if ( x > 255 )
10 return 255;
11 if ( x < 0 )
12 return 0;
13 return x;
14 }
15 -#define clamp_adjust(x) clamp(x+128)
16 +#define nw8xx_clamp_adjust(x) nw8xx_clamp(x+128)
17 #else
18 -#define clamp(x) clampTbl[(x)+512]
19 -#define clamp_adjust(x) clampTbl[(x)+640]
20 -static char clampTbl[1280];
21 +#define nw8xx_clamp(x) nw8xx_clampTbl[(x)+512]
22 +#define nw8xx_clamp_adjust(x) nw8xx_clampTbl[(x)+640]
23 +static char nw8xx_clampTbl[1280];
24 #endif
25
26 // Code to initialize those tables
27 @@ -195,19 +195,19 @@
28 }
29
30 #ifndef SAFE_CLAMP
31 -static void clampTbl_init(void)
32 +static void nw8xx_clampTbl_init(void)
33 {
34 // Instead of doing if(...) to test for overrange, we use
35 - // a clamping table
36 + // a nw8xx_clamping table
37
38 int i;
39
40 for (i=0 ; i < 512 ; i++)
41 - clampTbl[i] = 0;
42 + nw8xx_clampTbl[i] = 0;
43 for (i=512 ; i < 768 ; i++ )
44 - clampTbl[i] = i - 512;
45 + nw8xx_clampTbl[i] = i - 512;
46 for (i=768 ; i < 1280 ; i++ )
47 - clampTbl[i] = 255;
48 + nw8xx_clampTbl[i] = 255;
49
50 }
51 #endif
52 @@ -521,16 +521,16 @@
53 for ( x=0 ; x<4 ; x++ )
54 {
55 // Y block
56 - Yline[ 0] = clamp_adjust(block_y[block_idx ]);
57 - Yline[ 4] = clamp_adjust(block_y[block_idx+16]);
58 - Yline[ 8] = clamp_adjust(block_y[block_idx+32]);
59 - Yline[12] = clamp_adjust(block_y[block_idx+48]);
60 + Yline[ 0] = nw8xx_clamp_adjust(block_y[block_idx ]);
61 + Yline[ 4] = nw8xx_clamp_adjust(block_y[block_idx+16]);
62 + Yline[ 8] = nw8xx_clamp_adjust(block_y[block_idx+32]);
63 + Yline[12] = nw8xx_clamp_adjust(block_y[block_idx+48]);
64
65 // U block
66 - *Uline = clamp_adjust(block_u[block_idx]);
67 + *Uline = nw8xx_clamp_adjust(block_u[block_idx]);
68
69 // V block
70 - *Vline = clamp_adjust(block_v[block_idx]);
71 + *Vline = nw8xx_clamp_adjust(block_v[block_idx]);
72
73 // Ajust pointers & index
74 block_idx++;
75 @@ -596,9 +596,9 @@
76 vc = Vline[0];
77
78 // B G R
79 - *(fb++) = clamp(( yc + yuvTbl_v2[vc] ) >> 16);
80 - *(fb++) = clamp(( yc - yuvTbl_u2[uc] - yuvTbl_v1[vc] ) >> 16);
81 - *(fb++) = clamp(( yc + yuvTbl_u1[uc] ) >> 16);
82 + *(fb++) = nw8xx_clamp(( yc + yuvTbl_v2[vc] ) >> 16);
83 + *(fb++) = nw8xx_clamp(( yc - yuvTbl_u2[uc] - yuvTbl_v1[vc] ) >> 16);
84 + *(fb++) = nw8xx_clamp(( yc + yuvTbl_u1[uc] ) >> 16);
85 #ifdef _JPGL_TEST_
86 fb++;
87 #endif
88 @@ -609,9 +609,9 @@
89 vc = ( 3*Vline[0] + Vline[1] ) >> 2;
90
91 // B G R
92 - *(fb++) = clamp(( yc + yuvTbl_v2[vc] ) >> 16);
93 - *(fb++) = clamp(( yc - yuvTbl_u2[uc] - yuvTbl_v1[vc] ) >> 16);
94 - *(fb++) = clamp(( yc + yuvTbl_u1[uc] ) >> 16);
95 + *(fb++) = nw8xx_clamp(( yc + yuvTbl_v2[vc] ) >> 16);
96 + *(fb++) = nw8xx_clamp(( yc - yuvTbl_u2[uc] - yuvTbl_v1[vc] ) >> 16);
97 + *(fb++) = nw8xx_clamp(( yc + yuvTbl_u1[uc] ) >> 16);
98 #ifdef _JPGL_TEST_
99 fb++;
100 #endif
101 @@ -622,9 +622,9 @@
102 vc = ( Vline[0] + Vline[1] ) >> 1;
103
104 // B G R
105 - *(fb++) = clamp(( yc + yuvTbl_v2[vc] ) >> 16);
106 - *(fb++) = clamp(( yc - yuvTbl_u2[uc] - yuvTbl_v1[vc] ) >> 16);
107 - *(fb++) = clamp(( yc + yuvTbl_u1[uc] ) >> 16);
108 + *(fb++) = nw8xx_clamp(( yc + yuvTbl_v2[vc] ) >> 16);
109 + *(fb++) = nw8xx_clamp(( yc - yuvTbl_u2[uc] - yuvTbl_v1[vc] ) >> 16);
110 + *(fb++) = nw8xx_clamp(( yc + yuvTbl_u1[uc] ) >> 16);
111 #ifdef _JPGL_TEST_
112 fb++;
113 #endif
114 @@ -635,9 +635,9 @@
115 vc = ( Vline[0] + 3*Vline[1] ) >> 2;
116
117 // B G R
118 - *(fb++) = clamp(( yc + yuvTbl_v2[vc] ) >> 16);
119 - *(fb++) = clamp(( yc - yuvTbl_u2[uc] - yuvTbl_v1[vc] ) >> 16);
120 - *(fb++) = clamp(( yc + yuvTbl_u1[uc] ) >> 16);
121 + *(fb++) = nw8xx_clamp(( yc + yuvTbl_v2[vc] ) >> 16);
122 + *(fb++) = nw8xx_clamp(( yc - yuvTbl_u2[uc] - yuvTbl_v1[vc] ) >> 16);
123 + *(fb++) = nw8xx_clamp(( yc + yuvTbl_u1[uc] ) >> 16);
124 #ifdef _JPGL_TEST_
125 fb++;
126 #endif
127 @@ -707,6 +707,6 @@
128 vlcTbl_init();
129 yuvTbl_init();
130 #ifndef SAFE_CLAMP
131 - clampTbl_init();
132 + nw8xx_clampTbl_init();
133 #endif
134 }