7 -inline unsigned char clamp(int x) {
8 +inline unsigned char nw8xx_clamp(int x) {
15 -#define clamp_adjust(x) clamp(x+128)
16 +#define nw8xx_clamp_adjust(x) nw8xx_clamp(x+128)
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];
26 // Code to initialize those tables
31 -static void clampTbl_init(void)
32 +static void nw8xx_clampTbl_init(void)
34 // Instead of doing if(...) to test for overrange, we use
36 + // a nw8xx_clamping table
40 for (i=0 ; i < 512 ; i++)
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++ )
48 + nw8xx_clampTbl[i] = 255;
53 for ( x=0 ; x<4 ; x++ )
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]);
66 - *Uline = clamp_adjust(block_u[block_idx]);
67 + *Uline = nw8xx_clamp_adjust(block_u[block_idx]);
70 - *Vline = clamp_adjust(block_v[block_idx]);
71 + *Vline = nw8xx_clamp_adjust(block_v[block_idx]);
73 // Ajust pointers & index
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);
89 vc = ( 3*Vline[0] + Vline[1] ) >> 2;
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);
102 vc = ( Vline[0] + Vline[1] ) >> 1;
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);
115 vc = ( Vline[0] + 3*Vline[1] ) >> 2;
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);
132 + nw8xx_clampTbl_init();