/src/ghostpdl/jpegxr/r_strip.c
Line | Count | Source |
1 | | |
2 | | /************************************************************************* |
3 | | * |
4 | | * This software module was originally contributed by Microsoft |
5 | | * Corporation in the course of development of the |
6 | | * ITU-T T.832 | ISO/IEC 29199-2 ("JPEG XR") format standard for |
7 | | * reference purposes and its performance may not have been optimized. |
8 | | * |
9 | | * This software module is an implementation of one or more |
10 | | * tools as specified by the JPEG XR standard. |
11 | | * |
12 | | * ITU/ISO/IEC give You a royalty-free, worldwide, non-exclusive |
13 | | * copyright license to copy, distribute, and make derivative works |
14 | | * of this software module or modifications thereof for use in |
15 | | * products claiming conformance to the JPEG XR standard as |
16 | | * specified by ITU-T T.832 | ISO/IEC 29199-2. |
17 | | * |
18 | | * ITU/ISO/IEC give users the same free license to this software |
19 | | * module or modifications thereof for research purposes and further |
20 | | * ITU/ISO/IEC standardization. |
21 | | * |
22 | | * Those intending to use this software module in products are advised |
23 | | * that its use may infringe existing patents. ITU/ISO/IEC have no |
24 | | * liability for use of this software module or modifications thereof. |
25 | | * |
26 | | * Copyright is not released for products that do not conform to |
27 | | * to the JPEG XR standard as specified by ITU-T T.832 | |
28 | | * ISO/IEC 29199-2. |
29 | | * |
30 | | * Microsoft Corporation retains full right to modify and use the code |
31 | | * for its own purpose, to assign or donate the code to a third party, |
32 | | * and to inhibit third parties from using the code for products that |
33 | | * do not conform to the JPEG XR standard as specified by ITU-T T.832 | |
34 | | * ISO/IEC 29199-2. |
35 | | * |
36 | | * This copyright notice must be included in all copies or derivative |
37 | | * works. |
38 | | * |
39 | | * Copyright (c) ITU-T/ISO/IEC 2008, 2009. |
40 | | ***********************************************************************/ |
41 | | |
42 | | #ifdef _MSC_VER |
43 | | #pragma comment (user,"$Id: r_strip.c,v 1.51 2008/03/24 18:06:56 steve Exp $") |
44 | | #else |
45 | | #ident "$Id: r_strip.c,v 1.51 2008/03/24 18:06:56 steve Exp $" |
46 | | #endif |
47 | | |
48 | | # include "jxr_priv.h" |
49 | | # include <stdlib.h> |
50 | | # include <limits.h> |
51 | | # include <assert.h> |
52 | | # include <math.h> |
53 | | # include <memory.h> |
54 | | |
55 | | static void dclphp_shuffle(int*data, int dclp_count); |
56 | | static void unblock_shuffle444(int*data); |
57 | | static void unblock_shuffle422(int*data); |
58 | | static void unblock_shuffle420(int*data); |
59 | | |
60 | | static void dequantize_up_dclp(jxr_image_t image, int use_my, int ch) |
61 | 0 | { |
62 | 0 | int tx, ty = 0; |
63 | 0 | int dc_quant = 0; |
64 | 0 | unsigned int strip; |
65 | 0 | unsigned int i; |
66 | |
|
67 | 0 | int lp_coeff_count = 16; |
68 | 0 | if (ch > 0) { |
69 | 0 | if (image->use_clr_fmt == 2/*YUV422*/) |
70 | 0 | lp_coeff_count = 8; |
71 | 0 | else if (image->use_clr_fmt == 1/*YUV420*/) |
72 | 0 | lp_coeff_count = 4; |
73 | 0 | } |
74 | |
|
75 | 0 | strip = use_my -1; |
76 | 0 | for(i=0; i < image->tile_rows; i++) |
77 | 0 | { |
78 | | /* Figure out what ty is */ |
79 | 0 | if(strip >= image->tile_row_position[i] && strip <image->tile_row_position[i] + image->tile_row_height[i]) |
80 | 0 | { |
81 | 0 | ty = i; |
82 | 0 | break; |
83 | 0 | } |
84 | 0 | } |
85 | | |
86 | | /* The current "cur" is now made up into DC coefficients, so |
87 | | we no longer need the strip_up levels. Dequantize them, |
88 | | inverse tranform then and deliver them to output. */ |
89 | 0 | for (tx = 0 ; tx < (int) image->tile_columns ; tx += 1) { |
90 | 0 | int mx; |
91 | 0 | if(image->dc_frame_uniform) |
92 | 0 | dc_quant = image->dc_quant_ch[ch]; |
93 | 0 | else |
94 | 0 | dc_quant = image->tile_quant[ty *(image->tile_columns) + tx].dc_quant_ch[ch]; |
95 | 0 | dc_quant = _jxr_quant_map(image, dc_quant, ch==0? 1 : 0/* iShift for YONLY */); |
96 | |
|
97 | 0 | for (mx = 0 ; mx < (int) image->tile_column_width[tx] ; mx += 1) { |
98 | 0 | int lp_quant_idx = MACROBLK_UP1_LP_QUANT(image,ch,tx,mx); |
99 | 0 | int k; |
100 | 0 | int lp_quant_use; |
101 | |
|
102 | 0 | int lp_quant_raw = 0; |
103 | 0 | if(image->lp_frame_uniform) |
104 | 0 | lp_quant_raw = image->lp_quant_ch[ch][lp_quant_idx]; |
105 | 0 | else |
106 | 0 | lp_quant_raw = image->tile_quant[ty *(image->tile_columns) + tx].lp_quant_ch[ch][lp_quant_idx]; |
107 | |
|
108 | 0 | lp_quant_use = _jxr_quant_map(image, lp_quant_raw, ch==0? 1 : 0/* iShift for YONLY */); |
109 | 0 | MACROBLK_UP_DC(image,ch,tx,mx) *= dc_quant; |
110 | 0 | CHECK1(image->lwf_test, MACROBLK_CUR_DC(image,ch,tx,mx)); |
111 | |
|
112 | 0 | DEBUG(" Dequantize strip=%d tx=%d MBx=%d ch=%d with lp_quant=%d lp_quant_use=%d\n", |
113 | 0 | use_my-1, tx, mx, ch, lp_quant_raw, lp_quant_use); |
114 | 0 | for (k = 1 ; k < lp_coeff_count ; k += 1) |
115 | 0 | { |
116 | 0 | MACROBLK_UP_LP(image,ch,tx,mx,k-1) *= lp_quant_use; |
117 | 0 | CHECK1(image->lwf_test, MACROBLK_UP_LP(image,ch,tx,mx,k-1)); |
118 | 0 | } |
119 | 0 | } |
120 | 0 | } |
121 | |
|
122 | | #if defined(DETAILED_DEBUG) |
123 | | for (tx = 0 ; tx < (int) image->tile_columns ; tx += 1) { |
124 | | int mx; |
125 | | for (mx = 0 ; mx < (int) image->tile_column_width[tx] ; mx += 1) { |
126 | | int jdx; |
127 | | DEBUG(" DC/LP (strip=%3d, tx=%d mbx=%4d, ch=%d) Dequant:", use_my-1, tx, mx, ch); |
128 | | DEBUG(" 0x%08x", MACROBLK_UP_DC(image,ch,tx,mx)); |
129 | | for (jdx = 0; jdx < lp_coeff_count-1 ; jdx += 1) { |
130 | | DEBUG(" 0x%08x", MACROBLK_UP_LP(image,ch,tx,mx,jdx)); |
131 | | if ((jdx+1)%4 == 3 && jdx != (lp_coeff_count-2)) |
132 | | DEBUG("\n%*s:", 48, ""); |
133 | | } |
134 | | DEBUG("\n"); |
135 | | } |
136 | | } |
137 | | #endif |
138 | 0 | } |
139 | | |
140 | | |
141 | | static void IPCT_level1_up1(jxr_image_t image, int use_my, int ch) |
142 | 0 | { |
143 | 0 | int idx; |
144 | |
|
145 | 0 | dequantize_up_dclp(image, use_my, ch); |
146 | |
|
147 | 0 | DEBUG(" DC-LP IPCT transforms (first level) for strip %d channel %d\n", use_my-1, ch); |
148 | | |
149 | | /* Reverse transform the DC/LP to 16 DC values. */ |
150 | |
|
151 | 0 | for (idx = 0 ; idx < (int) EXTENDED_WIDTH_BLOCKS(image); idx += 1) { |
152 | 0 | DEBUG(" DC-LP IPCT transforms for mb[%d %d]\n", idx, use_my-1); |
153 | |
|
154 | 0 | if (ch > 0 && image->use_clr_fmt == 1/*YUV420*/) { |
155 | |
|
156 | 0 | _jxr_2x2IPCT(image->strip[ch].up1[idx].data+0); |
157 | 0 | _jxr_InvPermute2pt(image->strip[ch].up1[idx].data+1, |
158 | 0 | image->strip[ch].up1[idx].data+2); |
159 | | |
160 | | /* Scale up the chroma channel */ |
161 | 0 | if (image->scaled_flag) { |
162 | 0 | int jdx; |
163 | 0 | for (jdx = 0 ; jdx < 4 ; jdx += 1) |
164 | 0 | image->strip[ch].up1[idx].data[jdx] *= 2; |
165 | 0 | } |
166 | |
|
167 | | #if defined(DETAILED_DEBUG) |
168 | | DEBUG(" DC/LP (strip=%3d, mbx=%4d, ch=%d) IPCT:", use_my-1, idx, ch); |
169 | | DEBUG(" 0x%08x", MACROBLK_UP_DC(image,ch,0,idx)); |
170 | | DEBUG(" 0x%08x", MACROBLK_UP_LP(image,ch,0,idx,0)); |
171 | | DEBUG(" 0x%08x", MACROBLK_UP_LP(image,ch,0,idx,1)); |
172 | | DEBUG(" 0x%08x", MACROBLK_UP_LP(image,ch,0,idx,2)); |
173 | | DEBUG("\n"); |
174 | | #endif |
175 | 0 | } else if (ch > 0 && image->use_clr_fmt == 2/*YUV422*/) { |
176 | | #if defined(DETAILED_DEBUG) |
177 | | int jdx; |
178 | | DEBUG(" DC/LP scaled_flag=%d\n", image->scaled_flag); |
179 | | DEBUG(" DC/LP (strip=%3d, mbx=%4d, ch=%d) Pre-IPCT:", use_my-1, idx, ch); |
180 | | DEBUG(" 0x%08x", MACROBLK_UP_DC(image,ch,0,idx)); |
181 | | for (jdx = 0; jdx < 7 ; jdx += 1) { |
182 | | DEBUG(" 0x%08x", MACROBLK_UP_LP(image,ch,0,idx,jdx)); |
183 | | if ((jdx+1)%4 == 3 && jdx != 6) |
184 | | DEBUG("\n%*s:", 44, ""); |
185 | | } |
186 | | DEBUG("\n"); |
187 | | #endif |
188 | |
|
189 | 0 | _jxr_2ptT(image->strip[ch].up1[idx].data+0, |
190 | 0 | image->strip[ch].up1[idx].data+4); |
191 | 0 | _jxr_2x2IPCT(image->strip[ch].up1[idx].data+0); |
192 | 0 | _jxr_2x2IPCT(image->strip[ch].up1[idx].data+4); |
193 | |
|
194 | 0 | _jxr_InvPermute2pt(image->strip[ch].up1[idx].data+1, |
195 | 0 | image->strip[ch].up1[idx].data+2); |
196 | 0 | _jxr_InvPermute2pt(image->strip[ch].up1[idx].data+5, |
197 | 0 | image->strip[ch].up1[idx].data+6); |
198 | |
|
199 | | #if defined(DETAILED_DEBUG) |
200 | | DEBUG(" DC/LP scaled_flag=%d\n", image->scaled_flag); |
201 | | DEBUG(" DC/LP (strip=%3d, mbx=%4d, ch=%d) scaled:", use_my-1, idx, ch); |
202 | | DEBUG(" 0x%08x", MACROBLK_UP_DC(image,ch,0,idx)); |
203 | | for (jdx = 0; jdx < 7 ; jdx += 1) { |
204 | | DEBUG(" 0x%08x", MACROBLK_UP_LP(image,ch,0,idx,jdx)); |
205 | | if ((jdx+1)%4 == 3 && jdx != 6) |
206 | | DEBUG("\n%*s:", 42, ""); |
207 | | } |
208 | | DEBUG("\n"); |
209 | | #endif |
210 | | /* Scale up the chroma channel */ |
211 | 0 | if (image->scaled_flag) { |
212 | 0 | int jdx; |
213 | 0 | for (jdx = 0 ; jdx < 8 ; jdx += 1) |
214 | 0 | image->strip[ch].up1[idx].data[jdx] *= 2; |
215 | 0 | } |
216 | |
|
217 | | #if defined(DETAILED_DEBUG) |
218 | | DEBUG(" DC/LP scaled_flag=%d\n", image->scaled_flag); |
219 | | DEBUG(" DC/LP (strip=%3d, mbx=%4d, ch=%d) IPCT:", use_my-1, idx, ch); |
220 | | DEBUG(" 0x%08x", MACROBLK_UP_DC(image,ch,0,idx)); |
221 | | for (jdx = 0; jdx < 7 ; jdx += 1) { |
222 | | DEBUG(" 0x%08x", MACROBLK_UP_LP(image,ch,0,idx,jdx)); |
223 | | if ((jdx+1)%4 == 3 && jdx != 6) |
224 | | DEBUG("\n%*s:", 40, ""); |
225 | | } |
226 | | DEBUG("\n"); |
227 | | #endif |
228 | 0 | } else { |
229 | | |
230 | | /* Channel 0 of everything, and Channel-N of full |
231 | | resolution colors, are processed here. */ |
232 | 0 | _jxr_4x4IPCT(image->strip[ch].up1[idx].data); |
233 | | |
234 | | /* Scale up the chroma channel */ |
235 | 0 | if (ch > 0 && image->scaled_flag) { |
236 | 0 | int jdx; |
237 | 0 | for (jdx = 0 ; jdx < 16 ; jdx += 1) |
238 | 0 | image->strip[ch].up1[idx].data[jdx] *= 2; |
239 | 0 | } |
240 | |
|
241 | | #if defined(DETAILED_DEBUG) |
242 | | int jdx; |
243 | | DEBUG(" DC/LP (strip=%3d, mbx=%4d, ch=%d) IPCT:", use_my-1, idx, ch); |
244 | | DEBUG(" 0x%08x", MACROBLK_UP_DC(image,ch,0,idx)); |
245 | | for (jdx = 0; jdx < 15 ; jdx += 1) { |
246 | | DEBUG(" 0x%08x", MACROBLK_UP_LP(image,ch,0,idx,jdx)); |
247 | | if ((jdx+1)%4 == 3 && jdx != 14) |
248 | | DEBUG("\n%*s:", 40, ""); |
249 | | } |
250 | | DEBUG("\n"); |
251 | | #endif |
252 | 0 | } |
253 | |
|
254 | 0 | } |
255 | |
|
256 | 0 | } |
257 | | |
258 | | static void IPCT_level2_up2(jxr_image_t image, int use_my, int ch) |
259 | 0 | { |
260 | 0 | int idx; |
261 | |
|
262 | 0 | for (idx = 0 ; idx < (int) EXTENDED_WIDTH_BLOCKS(image); idx += 1) { |
263 | 0 | int jdx; |
264 | | /* Reshuffle the DCLP with the HP data to get |
265 | | DC-LP stretches in the data stream. */ |
266 | 0 | int dclp_count = 16; |
267 | 0 | int hp_quant_raw; |
268 | 0 | int hp_quant; |
269 | |
|
270 | 0 | if (ch>0 && image->use_clr_fmt == 2/*YUV422*/) |
271 | 0 | dclp_count = 8; |
272 | 0 | else if (ch>0 && image->use_clr_fmt == 1/*YUV420*/) |
273 | 0 | dclp_count = 4; |
274 | |
|
275 | 0 | dclphp_shuffle(image->strip[ch].up2[idx].data, dclp_count); |
276 | |
|
277 | 0 | DEBUG(" DC-LP-HP IPCT transforms for (second level) strip %d MBx=%d ch=%d\n", |
278 | 0 | use_my-2, idx, ch); |
279 | |
|
280 | 0 | hp_quant_raw = MACROBLK_UP2_HP_QUANT(image,ch,0,idx); |
281 | 0 | hp_quant = _jxr_quant_map(image, hp_quant_raw, 1); |
282 | | |
283 | | /* IPCT transform to absorb HP band data. */ |
284 | 0 | for (jdx = 0 ; jdx < 16*dclp_count ; jdx += 16) { |
285 | 0 | int k; |
286 | | #if defined(DETAILED_DEBUG) |
287 | | { |
288 | | int pix; |
289 | | DEBUG(" DC-LP-HP (strip=%3d, mbx=%4d ch=%d, block=%2d) pre-IPCT:", |
290 | | use_my-2, idx, ch, jdx/16); |
291 | | for (pix = 0; pix < 16 ; pix += 1) { |
292 | | DEBUG(" 0x%08x", image->strip[ch].up2[idx].data[jdx+pix]); |
293 | | if (pix%4 == 3 && pix != 15) |
294 | | DEBUG("\n%*s:", 56, ""); |
295 | | } |
296 | | DEBUG("\n"); |
297 | | } |
298 | | #endif |
299 | 0 | DEBUG(" Dequantize strip=%d MBx=%d ch=%d block=%d with hp_quant=%d (raw=%d)\n", |
300 | 0 | use_my-2, idx, ch, jdx/16, hp_quant, hp_quant_raw); |
301 | 0 | for (k = 1 ; k < 16 ; k += 1) |
302 | 0 | { |
303 | 0 | image->strip[ch].up2[idx].data[jdx+k] *= hp_quant; |
304 | 0 | CHECK1(image->lwf_test, image->strip[ch].up2[idx].data[jdx+k]); |
305 | 0 | } |
306 | |
|
307 | 0 | _jxr_4x4IPCT(image->strip[ch].up2[idx].data+jdx); |
308 | | #if defined(DETAILED_DEBUG) |
309 | | { |
310 | | int pix; |
311 | | DEBUG(" DC-LP-HP (strip=%3d, mbx=%4d ch=%d block=%2d) IPCT:", |
312 | | use_my-2, idx, ch, jdx/16); |
313 | | for (pix = 0; pix < 16 ; pix += 1) { |
314 | | DEBUG(" 0x%08x", image->strip[ch].up2[idx].data[jdx+pix]); |
315 | | if (pix%4 == 3 && pix != 15) |
316 | | DEBUG("\n%*s:", 51, ""); |
317 | | } |
318 | | DEBUG("\n"); |
319 | | } |
320 | | #endif |
321 | 0 | } |
322 | |
|
323 | 0 | } |
324 | 0 | } |
325 | | |
326 | 0 | #define TOP_Y(y) ( y == image->tile_row_position[ty]) |
327 | 0 | #define BOTTOM_Y(y) ( y == image->tile_row_position[ty] + image->tile_row_height[ty] - 1) |
328 | 0 | #define LEFT_X(idx) ( idx == 0) |
329 | 0 | #define RIGHT_X(idx) ( idx == image->tile_column_width[tx] -1 ) |
330 | | |
331 | | |
332 | | static void overlap_level1_up2_444(jxr_image_t image, int use_my, int ch) |
333 | 0 | { |
334 | 0 | int tx = 0; /* XXXX */ |
335 | 0 | int top_my = use_my - 2; |
336 | 0 | int idx; |
337 | |
|
338 | 0 | int ty = 0; |
339 | | /* 16 Coeffs per MB */ |
340 | 0 | assert(ch == 0 || (image->use_clr_fmt != 2/*YUV422*/ && image->use_clr_fmt !=1/* YUV420*/)); |
341 | 0 | assert(use_my >= 2); |
342 | | /* Figure out which tile row the current strip of macroblocks belongs to. */ |
343 | 0 | while(top_my > image->tile_row_position[ty]+image->tile_row_height[ty] - 1) |
344 | 0 | ty++; |
345 | |
|
346 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
347 | 0 | { |
348 | | /* Top edge */ |
349 | 0 | if(top_my == 0 || (image->disableTileOverlapFlag && TOP_Y(top_my) )) |
350 | 0 | { |
351 | | /* If this is the very first strip of blocks, then process the |
352 | | first two scan lines with the smaller 4Overlap filter. */ |
353 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
354 | 0 | { |
355 | | /* Top edge across */ |
356 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
357 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
358 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx-1).data; /* Macroblock to the right */ |
359 | |
|
360 | 0 | _jxr_4OverlapFilter(tp1+2, tp1+3, tp0+0, tp0+1); |
361 | 0 | _jxr_4OverlapFilter(tp1+6, tp1+7, tp0+4, tp0+5); |
362 | 0 | } |
363 | 0 | } |
364 | | /* Top left corner */ |
365 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
366 | 0 | { |
367 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
368 | 0 | _jxr_4OverlapFilter(tp0+0, tp0+1, tp0+4, tp0+5); |
369 | 0 | } |
370 | | /* Top right corner */ |
371 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
372 | 0 | { |
373 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
374 | 0 | _jxr_4OverlapFilter(tp0+2, tp0+3, tp0+6, tp0+7); |
375 | 0 | } |
376 | 0 | } |
377 | | |
378 | | /* Bottom edge */ |
379 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) { |
380 | | |
381 | | /* This is the last row, so there is no UP below |
382 | | TOP. finish up with 4Overlap filters. */ |
383 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
384 | 0 | { |
385 | | /* Bottom edge across */ |
386 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) |
387 | 0 | || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
388 | |
|
389 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
390 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx-1).data; |
391 | 0 | _jxr_4OverlapFilter(tp1+10, tp1+11, tp0+8, tp0+9); |
392 | 0 | _jxr_4OverlapFilter(tp1+14, tp1+15, tp0+12, tp0+13); |
393 | 0 | } |
394 | 0 | } |
395 | | |
396 | | /* Bottom left corner */ |
397 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
398 | 0 | { |
399 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
400 | 0 | _jxr_4OverlapFilter(tp0+8, tp0+9, tp0+12, tp0+13); |
401 | 0 | } |
402 | | /* Bottom right corner */ |
403 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
404 | 0 | { |
405 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
406 | 0 | _jxr_4OverlapFilter(tp0+10, tp0+11, tp0+14, tp0+15); |
407 | 0 | } |
408 | 0 | } |
409 | |
|
410 | 0 | for (idx = 0 ; idx < image->tile_column_width[tx] ; idx += 1) { |
411 | 0 | if ((top_my+1) < (int) EXTENDED_HEIGHT_BLOCKS(image)) { |
412 | |
|
413 | 0 | if ((tx == 0 && idx==0 && !image->disableTileOverlapFlag) || |
414 | 0 | (image->disableTileOverlapFlag && LEFT_X(idx) && !BOTTOM_Y(top_my))) { |
415 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
416 | 0 | int*up0 = MACROBLK_UP1(image,ch,tx,0).data; |
417 | | |
418 | | /* Left edge Across Vertical MBs */ |
419 | 0 | _jxr_4OverlapFilter(tp0+8, tp0+12, up0+0, up0+4); |
420 | 0 | _jxr_4OverlapFilter(tp0+9, tp0+13, up0+1, up0+5); |
421 | 0 | } |
422 | |
|
423 | 0 | if (((image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1) && !image->disableTileOverlapFlag ) || |
424 | 0 | ( image->disableTileOverlapFlag && !RIGHT_X(idx) && !BOTTOM_Y(top_my) ) |
425 | 0 | ) { |
426 | | /* This assumes that the DCLP coefficients are the first |
427 | | 16 values in the array, and ordered properly. */ |
428 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
429 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx+1).data; |
430 | 0 | int*up0 = MACROBLK_UP1(image,ch,tx,idx+0).data; |
431 | 0 | int*up1 = MACROBLK_UP1(image,ch,tx,idx+1).data; |
432 | | |
433 | | /* MB below, right, right-below */ |
434 | 0 | _jxr_4x4OverlapFilter(tp0+10, tp0+11, tp1+ 8, tp1+ 9, |
435 | 0 | tp0+14, tp0+15, tp1+12, tp1+13, |
436 | 0 | up0+ 2, up0+ 3, up1+ 0, up1+ 1, |
437 | 0 | up0+ 6, up0+ 7, up1+ 4, up1+ 5); |
438 | 0 | } |
439 | 0 | if((image->tile_column_position[tx] + idx == (int) EXTENDED_WIDTH_BLOCKS(image)-1 && !image->disableTileOverlapFlag) || |
440 | 0 | (image->disableTileOverlapFlag && RIGHT_X(idx) && !BOTTOM_Y(top_my))) |
441 | 0 | { |
442 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
443 | 0 | int*up0 = MACROBLK_UP1(image,ch,tx,image->tile_column_width[tx]-1).data; |
444 | | |
445 | | /* Right edge Across Vertical MBs */ |
446 | 0 | _jxr_4OverlapFilter(tp0+10, tp0+14, up0+2, up0+6); |
447 | 0 | _jxr_4OverlapFilter(tp0+11, tp0+15, up0+3, up0+7); |
448 | 0 | } |
449 | 0 | } |
450 | 0 | } |
451 | 0 | } |
452 | 0 | } |
453 | | |
454 | | /* |
455 | | */ |
456 | | |
457 | | static void overlap_level1_up2_422(jxr_image_t image, int use_my, int ch) |
458 | 0 | { |
459 | 0 | int tx = 0; /* XXXX */ |
460 | 0 | int top_my = use_my - 2; |
461 | 0 | int idx; |
462 | |
|
463 | 0 | int ty = 0; |
464 | 0 | assert(ch > 0 && image->use_clr_fmt == 2/*YUV422*/); |
465 | 0 | assert(use_my >= 2); |
466 | | /* Figure out which tile row the current strip of macroblocks belongs to. */ |
467 | 0 | while(top_my > image->tile_row_position[ty]+image->tile_row_height[ty] - 1) |
468 | 0 | ty++; |
469 | | |
470 | | |
471 | | /* Top edge */ |
472 | 0 | if(top_my == 0 || (image->disableTileOverlapFlag && TOP_Y(top_my))) |
473 | 0 | { |
474 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
475 | 0 | { |
476 | | /* Top Left Corner Difference */ |
477 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
478 | 0 | { |
479 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
480 | 0 | tp0[0] = tp0[0] -tp0[1]; |
481 | 0 | CHECK1(image->lwf_test, tp0[0]); |
482 | 0 | } |
483 | | /* Top Right Corner Difference */ |
484 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
485 | 0 | { |
486 | 0 | int *tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
487 | 0 | tp0[1] = tp0[1] - tp0[0]; |
488 | 0 | CHECK1(image->lwf_test, tp0[1]); |
489 | 0 | } |
490 | 0 | } |
491 | 0 | } |
492 | | |
493 | | |
494 | | /* Bottom edge */ |
495 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) |
496 | 0 | { |
497 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
498 | 0 | { |
499 | | /* Bottom Left Corner Difference */ |
500 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
501 | 0 | { |
502 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
503 | 0 | tp0[6] = tp0[6] -tp0[7]; |
504 | 0 | CHECK1(image->lwf_test, tp0[6]); |
505 | 0 | } |
506 | | /* Bottom Right Corner Difference */ |
507 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
508 | 0 | { |
509 | 0 | int *tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
510 | 0 | tp0[7] = tp0[7] - tp0[6]; |
511 | 0 | CHECK1(image->lwf_test, tp0[7]); |
512 | 0 | } |
513 | 0 | } |
514 | 0 | } |
515 | |
|
516 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
517 | 0 | { |
518 | | /* Left edge */ |
519 | 0 | if (tx == 0 || image->disableTileOverlapFlag) |
520 | 0 | { |
521 | | /* Interior left edge */ |
522 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
523 | 0 | _jxr_2OverlapFilter(tp0+2, tp0+4); |
524 | 0 | } |
525 | | |
526 | | /* Right edge */ |
527 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
528 | 0 | { |
529 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
530 | | /* Interior Right edge */ |
531 | 0 | _jxr_2OverlapFilter(tp0+3, tp0+5); |
532 | 0 | } |
533 | | |
534 | | |
535 | | /* Top edge */ |
536 | 0 | if(top_my == 0 || (image->disableTileOverlapFlag && TOP_Y(top_my) )) |
537 | 0 | { |
538 | | /* If this is the very first strip of blocks, then process the |
539 | | first two scan lines with the smaller 4Overlap filter. */ |
540 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
541 | 0 | { |
542 | | /* Top edge across */ |
543 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
544 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
545 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx-1).data; /* The macroblock to the right */ |
546 | |
|
547 | 0 | _jxr_2OverlapFilter(tp1+1, tp0+0); |
548 | 0 | } |
549 | 0 | } |
550 | 0 | } |
551 | | |
552 | | /* Bottom edge */ |
553 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) { |
554 | | |
555 | | /* This is the last row, so there is no UP below |
556 | | TOP. finish up with 4Overlap filters. */ |
557 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
558 | 0 | { |
559 | | /* Bottom edge across */ |
560 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) |
561 | 0 | || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
562 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
563 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx - 1).data; |
564 | 0 | _jxr_2OverlapFilter(tp1+7, tp0+6); |
565 | 0 | } |
566 | 0 | } |
567 | 0 | } |
568 | |
|
569 | 0 | for (idx = 0 ; idx < image->tile_column_width[tx] ; idx += 1) { |
570 | 0 | if(top_my< EXTENDED_HEIGHT_BLOCKS(image) -1) |
571 | 0 | { |
572 | 0 | if ((tx == 0 && idx==0 && !image->disableTileOverlapFlag) || |
573 | 0 | (image->disableTileOverlapFlag && LEFT_X(idx) && !BOTTOM_Y(top_my))) { |
574 | | /* Across vertical blocks, left edge */ |
575 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
576 | 0 | int*up0 = MACROBLK_UP1(image,ch,tx,0).data; |
577 | | |
578 | | /* Left edge across vertical MBs */ |
579 | 0 | _jxr_2OverlapFilter(tp0+6, up0+0); |
580 | 0 | } |
581 | |
|
582 | 0 | if((image->tile_column_position[tx] + idx == (int) EXTENDED_WIDTH_BLOCKS(image)-1 && !image->disableTileOverlapFlag) || |
583 | 0 | (image->disableTileOverlapFlag && RIGHT_X(idx) && !BOTTOM_Y(top_my))) |
584 | 0 | { |
585 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
586 | 0 | int*up0 = MACROBLK_UP1(image,ch,tx,image->tile_column_width[tx]-1).data; |
587 | | |
588 | | /* Right edge across MBs */ |
589 | 0 | _jxr_2OverlapFilter(tp0+7, up0+1); |
590 | 0 | } |
591 | |
|
592 | 0 | if (((image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1) && !image->disableTileOverlapFlag ) || |
593 | 0 | ( image->disableTileOverlapFlag && !RIGHT_X(idx) && !BOTTOM_Y(top_my) ) |
594 | 0 | ) |
595 | 0 | { |
596 | | /* This assumes that the DCLP coefficients are the first |
597 | | 16 values in the array, and ordered properly. */ |
598 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
599 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx+1).data; |
600 | 0 | int*up0 = MACROBLK_UP1(image,ch,tx,idx+0).data; |
601 | 0 | int*up1 = MACROBLK_UP1(image,ch,tx,idx+1).data; |
602 | | |
603 | | /* MB below, right, right-below */ |
604 | 0 | _jxr_2x2OverlapFilter(tp0+7, tp1+6, up0+1, up1+0); |
605 | 0 | } |
606 | 0 | } |
607 | |
|
608 | 0 | if (((image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1) && !image->disableTileOverlapFlag ) || |
609 | 0 | ( image->disableTileOverlapFlag && !RIGHT_X(idx) ) |
610 | 0 | ) |
611 | 0 | { |
612 | | /* This assumes that the DCLP coefficients are the first |
613 | | 16 values in the array, and ordered properly. */ |
614 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
615 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx+1).data; |
616 | | |
617 | | /* MB to the right */ |
618 | 0 | _jxr_2x2OverlapFilter(tp0+3, tp1+2, tp0+5, tp1+4); |
619 | 0 | } |
620 | 0 | } |
621 | 0 | } |
622 | | |
623 | | /* Top edge */ |
624 | 0 | if(top_my == 0 || (image->disableTileOverlapFlag && TOP_Y(top_my))) |
625 | 0 | { |
626 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
627 | 0 | { |
628 | | /* Top Left Corner Addition */ |
629 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
630 | 0 | { |
631 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
632 | 0 | tp0[0] = tp0[0] + tp0[1]; |
633 | 0 | CHECK1(image->lwf_test, tp0[0]); |
634 | 0 | } |
635 | | /* Top Right Corner Addition */ |
636 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
637 | 0 | { |
638 | 0 | int *tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
639 | 0 | tp0[1] = tp0[1] + tp0[0]; |
640 | 0 | CHECK1(image->lwf_test, tp0[1]); |
641 | 0 | } |
642 | 0 | } |
643 | 0 | } |
644 | | |
645 | | /* Bottom edge */ |
646 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) |
647 | 0 | { |
648 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
649 | 0 | { |
650 | | /* Bottom Left Corner Addition */ |
651 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
652 | 0 | { |
653 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
654 | 0 | tp0[6] = tp0[6] + tp0[7]; |
655 | 0 | CHECK1(image->lwf_test, tp0[6]); |
656 | 0 | } |
657 | | /* Bottom Right Corner Addition */ |
658 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
659 | 0 | { |
660 | 0 | int *tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
661 | 0 | tp0[7] = tp0[7] + tp0[6]; |
662 | 0 | CHECK1(image->lwf_test, tp0[7]); |
663 | 0 | } |
664 | 0 | } |
665 | 0 | } |
666 | 0 | } |
667 | | |
668 | | static void overlap_level1_up2_420(jxr_image_t image, int use_my, int ch) |
669 | 0 | { |
670 | 0 | int tx = 0; /* XXXX */ |
671 | 0 | int top_my = use_my - 2; |
672 | |
|
673 | 0 | int idx; |
674 | 0 | int ty = 0; |
675 | | /* 4 coeffs*/ |
676 | 0 | assert(ch > 0 && image->use_clr_fmt == 1/*YUV420*/); |
677 | 0 | assert(use_my >= 2); |
678 | | /* Figure out which tile row the current strip of macroblocks belongs to. */ |
679 | 0 | while(top_my > image->tile_row_position[ty]+image->tile_row_height[ty] - 1) |
680 | 0 | ty++; |
681 | |
|
682 | 0 | if(top_my == 0 || (image->disableTileOverlapFlag && TOP_Y(top_my))) |
683 | 0 | { |
684 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
685 | 0 | { |
686 | | /* Top Left Corner Difference*/ |
687 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
688 | 0 | { |
689 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
690 | 0 | tp0[0] = tp0[0] -tp0[1]; |
691 | 0 | CHECK1(image->lwf_test, tp0[0]); |
692 | 0 | } |
693 | | /* Top Right Corner Difference*/ |
694 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
695 | 0 | { |
696 | 0 | int *tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
697 | 0 | tp0[1] = tp0[1] - tp0[0]; |
698 | 0 | CHECK1(image->lwf_test, tp0[1]); |
699 | 0 | } |
700 | 0 | } |
701 | 0 | } |
702 | | |
703 | | /* Bottom edge */ |
704 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) |
705 | 0 | { |
706 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
707 | 0 | { |
708 | | /* Bottom Left Corner Difference*/ |
709 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
710 | 0 | { |
711 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
712 | 0 | tp0[2] = tp0[2] -tp0[3]; |
713 | 0 | CHECK1(image->lwf_test, tp0[2]); |
714 | 0 | } |
715 | | /* Bottom Right Corner Difference*/ |
716 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
717 | 0 | { |
718 | 0 | int *tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
719 | 0 | tp0[3] = tp0[3] - tp0[2]; |
720 | 0 | CHECK1(image->lwf_test, tp0[3]); |
721 | 0 | } |
722 | 0 | } |
723 | 0 | } |
724 | |
|
725 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
726 | 0 | { |
727 | | /* Top edge */ |
728 | 0 | if(top_my == 0 || (image->disableTileOverlapFlag && TOP_Y(top_my))) |
729 | 0 | { |
730 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
731 | 0 | { |
732 | | /* Top edge across */ |
733 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
734 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
735 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx-1).data; |
736 | 0 | _jxr_2OverlapFilter(tp1+1, tp0+0); |
737 | 0 | } |
738 | 0 | } |
739 | 0 | } |
740 | | |
741 | | /* Bottom edge */ |
742 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) { |
743 | | |
744 | | /* This is the last row, so there is no UP below |
745 | | TOP. finish up with 4Overlap filters. */ |
746 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
747 | 0 | { |
748 | | /* Bottom edge across */ |
749 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) |
750 | 0 | || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
751 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
752 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx-1).data; |
753 | 0 | _jxr_2OverlapFilter(tp1+3, tp0+2); |
754 | 0 | } |
755 | 0 | } |
756 | 0 | } |
757 | 0 | else |
758 | 0 | { |
759 | 0 | for (idx = 0 ; idx < image->tile_column_width[tx] ; idx += 1) { |
760 | |
|
761 | 0 | if ((tx == 0 && idx==0 && !image->disableTileOverlapFlag) || |
762 | 0 | (image->disableTileOverlapFlag && LEFT_X(idx) && !BOTTOM_Y(top_my))) { |
763 | | /* Left edge across vertical MBs */ |
764 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
765 | 0 | int*up0 = MACROBLK_UP1(image,ch,tx,0).data; |
766 | |
|
767 | 0 | _jxr_2OverlapFilter(tp0+2, up0+0); |
768 | 0 | } |
769 | |
|
770 | 0 | if((image->tile_column_position[tx] + idx == (int) EXTENDED_WIDTH_BLOCKS(image)-1 && !image->disableTileOverlapFlag) || |
771 | 0 | (image->disableTileOverlapFlag && RIGHT_X(idx) && !BOTTOM_Y(top_my))) |
772 | 0 | { |
773 | | /* Right edge across vertical MBs */ |
774 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
775 | 0 | int*up0 = MACROBLK_UP1(image,ch,tx,image->tile_column_width[tx]-1).data; |
776 | |
|
777 | 0 | _jxr_2OverlapFilter(tp0+3, up0+1); |
778 | 0 | } |
779 | |
|
780 | 0 | if (((image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1) && !image->disableTileOverlapFlag ) || |
781 | 0 | ( image->disableTileOverlapFlag && !RIGHT_X(idx) && !BOTTOM_Y(top_my) ) |
782 | 0 | ) |
783 | 0 | { |
784 | | /* This assumes that the DCLP coefficients are the first |
785 | | 16 values in the array, and ordered properly. */ |
786 | | /* MB below, right, right-below */ |
787 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,idx+0).data; |
788 | 0 | int*tp1 = MACROBLK_UP2(image,ch,tx,idx+1).data; |
789 | 0 | int*up0 = MACROBLK_UP1(image,ch,tx,idx+0).data; |
790 | 0 | int*up1 = MACROBLK_UP1(image,ch,tx,idx+1).data; |
791 | |
|
792 | 0 | _jxr_2x2OverlapFilter(tp0+3, tp1+2, |
793 | 0 | up0+1, up1+0); |
794 | 0 | } |
795 | 0 | } |
796 | 0 | } |
797 | 0 | } |
798 | | |
799 | | /* Top edge */ |
800 | 0 | if(top_my == 0 || (image->disableTileOverlapFlag && TOP_Y(top_my))) |
801 | 0 | { |
802 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
803 | 0 | { |
804 | | /* Top Left Corner Addition */ |
805 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
806 | 0 | { |
807 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
808 | 0 | tp0[0] = tp0[0] + tp0[1]; |
809 | 0 | CHECK1(image->lwf_test, tp0[0]); |
810 | 0 | } |
811 | | /* Top Right Corner Addition */ |
812 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
813 | 0 | { |
814 | 0 | int *tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
815 | 0 | tp0[1] = tp0[1] + tp0[0]; |
816 | 0 | CHECK1(image->lwf_test, tp0[1]); |
817 | 0 | } |
818 | 0 | } |
819 | 0 | } |
820 | | |
821 | | |
822 | | /* Bottom edge */ |
823 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) |
824 | 0 | { |
825 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
826 | 0 | { |
827 | | /* Bottom Left Corner Addition*/ |
828 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
829 | 0 | { |
830 | 0 | int*tp0 = MACROBLK_UP2(image,ch,tx,0).data; |
831 | 0 | tp0[2] = tp0[2] + tp0[3]; |
832 | 0 | CHECK1(image->lwf_test, tp0[2]); |
833 | 0 | } |
834 | | /* Bottom Right Corner Addition*/ |
835 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
836 | 0 | { |
837 | 0 | int *tp0 = MACROBLK_UP2(image,ch,tx,image->tile_column_width[tx]-1).data; |
838 | 0 | tp0[3] = tp0[3] + tp0[2]; |
839 | 0 | CHECK1(image->lwf_test, tp0[3]); |
840 | 0 | } |
841 | 0 | } |
842 | 0 | } |
843 | 0 | } |
844 | | |
845 | | |
846 | | static void overlap_level1_up2(jxr_image_t image, int use_my, int ch) |
847 | 0 | { |
848 | 0 | if (ch == 0) { |
849 | 0 | overlap_level1_up2_444(image, use_my, ch); |
850 | |
|
851 | 0 | } |
852 | 0 | else { |
853 | 0 | switch (image->use_clr_fmt) { |
854 | 0 | case 1: /*YUV420*/ |
855 | 0 | overlap_level1_up2_420(image, use_my, ch); |
856 | 0 | break; |
857 | 0 | case 2: /*YUV422*/ |
858 | 0 | overlap_level1_up2_422(image, use_my, ch); |
859 | 0 | break; |
860 | 0 | default: |
861 | 0 | overlap_level1_up2_444(image, use_my, ch); |
862 | 0 | break; |
863 | 0 | } |
864 | 0 | } |
865 | 0 | } |
866 | | |
867 | | static int*R2B(int*data, int x, int y) |
868 | 0 | { |
869 | 0 | int bx = x/4; |
870 | 0 | int by = y/4; |
871 | 0 | int bl = by*4 + bx; |
872 | 0 | return data + bl*16 + 4*(y%4) + x%4; |
873 | 0 | } |
874 | | |
875 | | static int*R2B42(int*data, int x, int y) |
876 | 0 | { |
877 | 0 | int bx = x/4; |
878 | 0 | int by = y/4; |
879 | 0 | int bl = by*2 + bx; |
880 | 0 | return data + bl*16 + 4*(y%4) + x%4; |
881 | 0 | } |
882 | | |
883 | | static void overlap_level2_up3_444(jxr_image_t image, int use_my, int ch) |
884 | 0 | { |
885 | 0 | int tx = 0; /* XXXX */ |
886 | 0 | int top_my = use_my - 3; |
887 | 0 | int idx; |
888 | 0 | int ty = 0; |
889 | |
|
890 | 0 | assert(ch == 0 || (image->use_clr_fmt != 2/*YUV422*/ && image->use_clr_fmt !=1/* YUV420*/)); |
891 | 0 | assert(use_my >= 3); |
892 | 0 | DEBUG("Overlap Level2 for row %d\n", top_my); |
893 | | |
894 | | /* Figure out which tile row the current strip of macroblocks belongs to. */ |
895 | 0 | while(top_my > image->tile_row_position[ty]+image->tile_row_height[ty] - 1) |
896 | 0 | ty++; |
897 | |
|
898 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
899 | 0 | { |
900 | 0 | int jdx; |
901 | | /* Left edge */ |
902 | 0 | if (tx == 0 || image->disableTileOverlapFlag) |
903 | 0 | { |
904 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,0).data; |
905 | 0 | for (jdx = 2 ; jdx < 14 ; jdx += 4) { |
906 | 0 | _jxr_4OverlapFilter(R2B(dp,0,jdx+0),R2B(dp,0,jdx+1),R2B(dp,0,jdx+2),R2B(dp,0,jdx+3)); |
907 | 0 | _jxr_4OverlapFilter(R2B(dp,1,jdx+0),R2B(dp,1,jdx+1),R2B(dp,1,jdx+2),R2B(dp,1,jdx+3)); |
908 | 0 | } |
909 | 0 | } |
910 | | |
911 | | /* Right edge */ |
912 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag){ |
913 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,image->tile_column_width[tx]-1).data; |
914 | 0 | for (jdx = 2 ; jdx < 14 ; jdx += 4) { |
915 | 0 | _jxr_4OverlapFilter(R2B(dp,14,jdx+0),R2B(dp,14,jdx+1),R2B(dp,14,jdx+2),R2B(dp,14,jdx+3)); |
916 | 0 | _jxr_4OverlapFilter(R2B(dp,15,jdx+0),R2B(dp,15,jdx+1),R2B(dp,15,jdx+2),R2B(dp,15,jdx+3)); |
917 | 0 | } |
918 | 0 | } |
919 | | |
920 | | /* Top edge */ |
921 | 0 | if(top_my == 0 || (image->disableTileOverlapFlag && TOP_Y(top_my) )) |
922 | 0 | { |
923 | | /* If this is the very first strip of blocks, then process the |
924 | | first two scan lines with the smaller 4Overlap filter. */ |
925 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
926 | 0 | { |
927 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,idx).data; |
928 | 0 | _jxr_4OverlapFilter(R2B(dp, 2,0),R2B(dp, 3,0),R2B(dp, 4,0),R2B(dp, 5,0)); |
929 | 0 | _jxr_4OverlapFilter(R2B(dp, 6,0),R2B(dp, 7,0),R2B(dp, 8,0),R2B(dp, 9,0)); |
930 | 0 | _jxr_4OverlapFilter(R2B(dp,10,0),R2B(dp,11,0),R2B(dp,12,0),R2B(dp,13,0)); |
931 | |
|
932 | 0 | _jxr_4OverlapFilter(R2B(dp, 2,1),R2B(dp, 3,1),R2B(dp, 4,1),R2B(dp, 5,1)); |
933 | 0 | _jxr_4OverlapFilter(R2B(dp, 6,1),R2B(dp, 7,1),R2B(dp, 8,1),R2B(dp, 9,1)); |
934 | 0 | _jxr_4OverlapFilter(R2B(dp,10,1),R2B(dp,11,1),R2B(dp,12,1),R2B(dp,13,1)); |
935 | | |
936 | | /* Top edge across */ |
937 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
938 | 0 | int*pp = MACROBLK_UP3(image,ch,tx,idx-1).data; |
939 | 0 | _jxr_4OverlapFilter(R2B(pp,14,0),R2B(pp,15,0),R2B(dp,0,0),R2B(dp,1,0)); |
940 | 0 | _jxr_4OverlapFilter(R2B(pp,14,1),R2B(pp,15,1),R2B(dp,0,1),R2B(dp,1,1)); |
941 | 0 | } |
942 | 0 | } |
943 | | |
944 | | /* Top left corner */ |
945 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
946 | 0 | { |
947 | 0 | int *dp = MACROBLK_UP3(image,ch, tx, 0).data; |
948 | 0 | _jxr_4OverlapFilter(R2B(dp, 0,0),R2B(dp, 1,0),R2B(dp, 0,1),R2B(dp, 1,1)); |
949 | 0 | } |
950 | | /* Top right corner */ |
951 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
952 | 0 | { |
953 | 0 | int *dp = MACROBLK_UP3(image,ch,tx, image->tile_column_width[tx] - 1 ).data; |
954 | 0 | _jxr_4OverlapFilter(R2B(dp, 14,0),R2B(dp, 15,0),R2B(dp, 14,1),R2B(dp, 15,1)); |
955 | 0 | } |
956 | |
|
957 | 0 | } |
958 | | |
959 | | /* Bottom edge */ |
960 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) { |
961 | | |
962 | | /* This is the last row, so there is no UP below |
963 | | TOP. finish up with 4Overlap filters. */ |
964 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
965 | 0 | { |
966 | 0 | int*tp = MACROBLK_UP3(image,ch,tx,idx).data; |
967 | |
|
968 | 0 | _jxr_4OverlapFilter(R2B(tp, 2,14),R2B(tp, 3,14),R2B(tp, 4,14),R2B(tp, 5,14)); |
969 | 0 | _jxr_4OverlapFilter(R2B(tp, 6,14),R2B(tp, 7,14),R2B(tp, 8,14),R2B(tp, 9,14)); |
970 | 0 | _jxr_4OverlapFilter(R2B(tp,10,14),R2B(tp,11,14),R2B(tp,12,14),R2B(tp,13,14)); |
971 | |
|
972 | 0 | _jxr_4OverlapFilter(R2B(tp, 2,15),R2B(tp, 3,15),R2B(tp, 4,15),R2B(tp, 5,15)); |
973 | 0 | _jxr_4OverlapFilter(R2B(tp, 6,15),R2B(tp, 7,15),R2B(tp, 8,15),R2B(tp, 9,15)); |
974 | 0 | _jxr_4OverlapFilter(R2B(tp,10,15),R2B(tp,11,15),R2B(tp,12,15),R2B(tp,13,15)); |
975 | | |
976 | | /* Bottom edge across */ |
977 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) |
978 | 0 | || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
979 | 0 | int*tn = MACROBLK_UP3(image,ch,tx,idx-1).data; |
980 | 0 | _jxr_4OverlapFilter(R2B(tn,14,14),R2B(tn,15,14),R2B(tp, 0,14),R2B(tp, 1,14)); |
981 | 0 | _jxr_4OverlapFilter(R2B(tn,14,15),R2B(tn,15,15),R2B(tp, 0,15),R2B(tp, 1,15)); |
982 | 0 | } |
983 | 0 | } |
984 | | |
985 | | /* Bottom left corner */ |
986 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
987 | 0 | { |
988 | 0 | int *dp = MACROBLK_UP3(image,ch,tx,0).data; |
989 | 0 | _jxr_4OverlapFilter(R2B(dp, 0,14),R2B(dp, 1, 14),R2B(dp, 0,15),R2B(dp, 1, 15)); |
990 | 0 | } |
991 | | /* Bottom right corner */ |
992 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
993 | 0 | { |
994 | 0 | int *dp = MACROBLK_UP3(image,ch,tx, image->tile_column_width[tx] - 1 ).data; |
995 | 0 | _jxr_4OverlapFilter(R2B(dp, 14, 14),R2B(dp, 15, 14),R2B(dp, 14,15),R2B(dp, 15, 15)); |
996 | 0 | } |
997 | |
|
998 | 0 | } |
999 | |
|
1000 | 0 | for (idx = 0 ; idx < image->tile_column_width[tx] ; idx += 1) { |
1001 | 0 | int jdx; |
1002 | |
|
1003 | 0 | for (jdx = 2 ; jdx < 14 ; jdx += 4) { |
1004 | |
|
1005 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,idx).data; |
1006 | | /* Fully interior 4x4 filter blocks... */ |
1007 | 0 | _jxr_4x4OverlapFilter(R2B(dp, 2,jdx+0),R2B(dp, 3,jdx+0),R2B(dp, 4,jdx+0),R2B(dp, 5,jdx+0), |
1008 | 0 | R2B(dp, 2,jdx+1),R2B(dp, 3,jdx+1),R2B(dp, 4,jdx+1),R2B(dp, 5,jdx+1), |
1009 | 0 | R2B(dp, 2,jdx+2),R2B(dp, 3,jdx+2),R2B(dp, 4,jdx+2),R2B(dp, 5,jdx+2), |
1010 | 0 | R2B(dp, 2,jdx+3),R2B(dp, 3,jdx+3),R2B(dp, 4,jdx+3),R2B(dp, 5,jdx+3)); |
1011 | 0 | _jxr_4x4OverlapFilter(R2B(dp, 6,jdx+0),R2B(dp, 7,jdx+0),R2B(dp, 8,jdx+0),R2B(dp, 9,jdx+0), |
1012 | 0 | R2B(dp, 6,jdx+1),R2B(dp, 7,jdx+1),R2B(dp, 8,jdx+1),R2B(dp, 9,jdx+1), |
1013 | 0 | R2B(dp, 6,jdx+2),R2B(dp, 7,jdx+2),R2B(dp, 8,jdx+2),R2B(dp, 9,jdx+2), |
1014 | 0 | R2B(dp, 6,jdx+3),R2B(dp, 7,jdx+3),R2B(dp, 8,jdx+3),R2B(dp, 9,jdx+3)); |
1015 | 0 | _jxr_4x4OverlapFilter(R2B(dp,10,jdx+0),R2B(dp,11,jdx+0),R2B(dp,12,jdx+0),R2B(dp,13,jdx+0), |
1016 | 0 | R2B(dp,10,jdx+1),R2B(dp,11,jdx+1),R2B(dp,12,jdx+1),R2B(dp,13,jdx+1), |
1017 | 0 | R2B(dp,10,jdx+2),R2B(dp,11,jdx+2),R2B(dp,12,jdx+2),R2B(dp,13,jdx+2), |
1018 | 0 | R2B(dp,10,jdx+3),R2B(dp,11,jdx+3),R2B(dp,12,jdx+3),R2B(dp,13,jdx+3)); |
1019 | |
|
1020 | 0 | if ( (image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1 && !image->disableTileOverlapFlag) || |
1021 | 0 | (image->disableTileOverlapFlag && !RIGHT_X(idx))) { |
1022 | | /* 4x4 at the right */ |
1023 | 0 | int*np = MACROBLK_UP3(image,ch,tx,idx+1).data; |
1024 | |
|
1025 | 0 | _jxr_4x4OverlapFilter(R2B(dp,14,jdx+0),R2B(dp,15,jdx+0),R2B(np, 0,jdx+0),R2B(np, 1,jdx+0), |
1026 | 0 | R2B(dp,14,jdx+1),R2B(dp,15,jdx+1),R2B(np, 0,jdx+1),R2B(np, 1,jdx+1), |
1027 | 0 | R2B(dp,14,jdx+2),R2B(dp,15,jdx+2),R2B(np, 0,jdx+2),R2B(np, 1,jdx+2), |
1028 | 0 | R2B(dp,14,jdx+3),R2B(dp,15,jdx+3),R2B(np, 0,jdx+3),R2B(np, 1,jdx+3)); |
1029 | 0 | } |
1030 | 0 | } |
1031 | |
|
1032 | 0 | if ((top_my+1) < (int) EXTENDED_HEIGHT_BLOCKS(image)) { |
1033 | |
|
1034 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,idx).data; |
1035 | 0 | int*up = MACROBLK_UP2(image,ch,tx,idx).data; |
1036 | |
|
1037 | 0 | if ((tx == 0 && idx==0 && !image->disableTileOverlapFlag) || |
1038 | 0 | (image->disableTileOverlapFlag && LEFT_X(idx) && !BOTTOM_Y(top_my))) { |
1039 | | /* Across vertical blocks, left edge */ |
1040 | 0 | _jxr_4OverlapFilter(R2B(dp,0,14),R2B(dp,0,15),R2B(up,0,0),R2B(up,0,1)); |
1041 | 0 | _jxr_4OverlapFilter(R2B(dp,1,14),R2B(dp,1,15),R2B(up,1,0),R2B(up,1,1)); |
1042 | 0 | } |
1043 | 0 | if((!image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !BOTTOM_Y(top_my))) |
1044 | 0 | { |
1045 | | /* 4x4 bottom */ |
1046 | 0 | _jxr_4x4OverlapFilter(R2B(dp, 2,14),R2B(dp, 3,14),R2B(dp, 4,14),R2B(dp, 5,14), |
1047 | 0 | R2B(dp, 2,15),R2B(dp, 3,15),R2B(dp, 4,15),R2B(dp, 5,15), |
1048 | 0 | R2B(up, 2, 0),R2B(up, 3, 0),R2B(up, 4, 0),R2B(up, 5, 0), |
1049 | 0 | R2B(up, 2, 1),R2B(up, 3, 1),R2B(up, 4, 1),R2B(up, 5, 1)); |
1050 | 0 | _jxr_4x4OverlapFilter(R2B(dp, 6,14),R2B(dp, 7,14),R2B(dp, 8,14),R2B(dp, 9,14), |
1051 | 0 | R2B(dp, 6,15),R2B(dp, 7,15),R2B(dp, 8,15),R2B(dp, 9,15), |
1052 | 0 | R2B(up, 6, 0),R2B(up, 7, 0),R2B(up, 8, 0),R2B(up, 9, 0), |
1053 | 0 | R2B(up, 6, 1),R2B(up, 7, 1),R2B(up, 8, 1),R2B(up, 9, 1)); |
1054 | 0 | _jxr_4x4OverlapFilter(R2B(dp,10,14),R2B(dp,11,14),R2B(dp,12,14),R2B(dp,13,14), |
1055 | 0 | R2B(dp,10,15),R2B(dp,11,15),R2B(dp,12,15),R2B(dp,13,15), |
1056 | 0 | R2B(up,10, 0),R2B(up,11, 0),R2B(up,12, 0),R2B(up,13, 0), |
1057 | 0 | R2B(up,10, 1),R2B(up,11, 1),R2B(up,12, 1),R2B(up,13, 1)); |
1058 | 0 | } |
1059 | |
|
1060 | 0 | if (((image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1) && !image->disableTileOverlapFlag ) || |
1061 | 0 | ( image->disableTileOverlapFlag && !RIGHT_X(idx) && !BOTTOM_Y(top_my) ) |
1062 | 0 | ) { |
1063 | | /* Blocks that span the MB to the right */ |
1064 | 0 | int*dn = MACROBLK_UP3(image,ch,tx,idx+1).data; |
1065 | 0 | int*un = MACROBLK_UP2(image,ch,tx,idx+1).data; |
1066 | | |
1067 | | /* 4x4 on right, below, below-right */ |
1068 | 0 | _jxr_4x4OverlapFilter(R2B(dp,14,14),R2B(dp,15,14),R2B(dn, 0,14),R2B(dn, 1,14), |
1069 | 0 | R2B(dp,14,15),R2B(dp,15,15),R2B(dn, 0,15),R2B(dn, 1,15), |
1070 | 0 | R2B(up,14, 0),R2B(up,15, 0),R2B(un, 0, 0),R2B(un, 1, 0), |
1071 | 0 | R2B(up,14, 1),R2B(up,15, 1),R2B(un, 0, 1),R2B(un, 1, 1)); |
1072 | 0 | } |
1073 | 0 | if((image->tile_column_position[tx] + idx == (int) EXTENDED_WIDTH_BLOCKS(image)-1 && !image->disableTileOverlapFlag) || |
1074 | 0 | (image->disableTileOverlapFlag && RIGHT_X(idx) && !BOTTOM_Y(top_my))) |
1075 | 0 | { |
1076 | | /* Across vertical blocks, right edge */ |
1077 | 0 | _jxr_4OverlapFilter(R2B(dp,14,14),R2B(dp,14,15),R2B(up,14,0),R2B(up,14,1)); |
1078 | 0 | _jxr_4OverlapFilter(R2B(dp,15,14),R2B(dp,15,15),R2B(up,15,0),R2B(up,15,1)); |
1079 | 0 | } |
1080 | 0 | } |
1081 | 0 | } |
1082 | 0 | } |
1083 | 0 | } |
1084 | | |
1085 | | static void overlap_level2_up3_422(jxr_image_t image, int use_my, int ch) |
1086 | 0 | { |
1087 | 0 | int tx = 0; /* XXXX */ |
1088 | 0 | int top_my = use_my - 3; |
1089 | 0 | int idx; |
1090 | 0 | int ty = 0; |
1091 | | |
1092 | |
|
1093 | 0 | assert(ch > 0 && image->use_clr_fmt == 2/*YUV422*/); |
1094 | 0 | assert(use_my >= 3); |
1095 | 0 | DEBUG("Overlap Level2 for row %d\n", top_my); |
1096 | | |
1097 | | /* Figure out which tile row the current strip of macroblocks belongs to. */ |
1098 | 0 | while(top_my > image->tile_row_position[ty]+image->tile_row_height[ty] - 1) |
1099 | 0 | ty++; |
1100 | | |
1101 | | |
1102 | |
|
1103 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
1104 | 0 | { |
1105 | | /* Left edge */ |
1106 | 0 | if (tx == 0 || image->disableTileOverlapFlag) |
1107 | 0 | { |
1108 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,0).data; |
1109 | 0 | _jxr_4OverlapFilter(R2B42(dp,0, 2),R2B42(dp,0, 3),R2B42(dp,0, 4),R2B42(dp,0, 5)); |
1110 | 0 | _jxr_4OverlapFilter(R2B42(dp,0, 6),R2B42(dp,0, 7),R2B42(dp,0, 8),R2B42(dp,0, 9)); |
1111 | 0 | _jxr_4OverlapFilter(R2B42(dp,0,10),R2B42(dp,0,11),R2B42(dp,0,12),R2B42(dp,0,13)); |
1112 | |
|
1113 | 0 | _jxr_4OverlapFilter(R2B42(dp,1, 2),R2B42(dp,1, 3),R2B42(dp,1, 4),R2B42(dp,1, 5)); |
1114 | 0 | _jxr_4OverlapFilter(R2B42(dp,1, 6),R2B42(dp,1, 7),R2B42(dp,1, 8),R2B42(dp,1, 9)); |
1115 | 0 | _jxr_4OverlapFilter(R2B42(dp,1,10),R2B42(dp,1,11),R2B42(dp,1,12),R2B42(dp,1,13)); |
1116 | 0 | } |
1117 | | |
1118 | | /* Right edge */ |
1119 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag){ |
1120 | |
|
1121 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,image->tile_column_width[tx]-1).data; |
1122 | 0 | _jxr_4OverlapFilter(R2B42(dp,6,2),R2B42(dp,6,3),R2B42(dp,6,4),R2B42(dp,6,5)); |
1123 | 0 | _jxr_4OverlapFilter(R2B42(dp,7,2),R2B42(dp,7,3),R2B42(dp,7,4),R2B42(dp,7,5)); |
1124 | |
|
1125 | 0 | _jxr_4OverlapFilter(R2B42(dp,6,6),R2B42(dp,6,7),R2B42(dp,6,8),R2B42(dp,6,9)); |
1126 | 0 | _jxr_4OverlapFilter(R2B42(dp,7,6),R2B42(dp,7,7),R2B42(dp,7,8),R2B42(dp,7,9)); |
1127 | |
|
1128 | 0 | _jxr_4OverlapFilter(R2B42(dp,6,10),R2B42(dp,6,11),R2B42(dp,6,12),R2B42(dp,6,13)); |
1129 | 0 | _jxr_4OverlapFilter(R2B42(dp,7,10),R2B42(dp,7,11),R2B42(dp,7,12),R2B42(dp,7,13)); |
1130 | 0 | } |
1131 | | |
1132 | | /* Top edge */ |
1133 | 0 | if(top_my == 0 || (image->disableTileOverlapFlag && TOP_Y(top_my) )) |
1134 | 0 | { |
1135 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
1136 | 0 | { |
1137 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,idx).data; |
1138 | |
|
1139 | 0 | _jxr_4OverlapFilter(R2B42(dp, 2,0),R2B42(dp, 3,0),R2B42(dp, 4,0),R2B42(dp, 5,0)); |
1140 | 0 | _jxr_4OverlapFilter(R2B42(dp, 2,1),R2B42(dp, 3,1),R2B42(dp, 4,1),R2B42(dp, 5,1)); |
1141 | | |
1142 | | /* Top across for soft tiles */ |
1143 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
1144 | 0 | int*pp = MACROBLK_UP3(image,ch,tx,idx-1).data; |
1145 | 0 | _jxr_4OverlapFilter(R2B42(pp,6,0),R2B42(pp,7,0),R2B(dp,0,0),R2B42(dp,1,0)); |
1146 | 0 | _jxr_4OverlapFilter(R2B42(pp,6,1),R2B42(pp,7,1),R2B(dp,0,1),R2B42(dp,1,1)); |
1147 | 0 | } |
1148 | 0 | } |
1149 | | |
1150 | | /* Top left corner */ |
1151 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
1152 | 0 | { |
1153 | 0 | int *dp = MACROBLK_UP3(image,ch, tx, 0).data; |
1154 | 0 | _jxr_4OverlapFilter(R2B42(dp,0,0),R2B42(dp,1,0),R2B42(dp,0,1),R2B42(dp,1,1)); |
1155 | 0 | } |
1156 | | /* Top right corner */ |
1157 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
1158 | 0 | { |
1159 | 0 | int *dp = MACROBLK_UP3(image,ch,tx, image->tile_column_width[tx] - 1 ).data; |
1160 | 0 | _jxr_4OverlapFilter(R2B42(dp,6,0),R2B42(dp,7,0),R2B42(dp,6,1),R2B42(dp,7,1)); |
1161 | 0 | } |
1162 | 0 | } |
1163 | | |
1164 | | /* Bottom edge */ |
1165 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) { |
1166 | | |
1167 | | /* This is the last row, so there is no UP below |
1168 | | TOP. finish up with 4Overlap filters. */ |
1169 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
1170 | 0 | { |
1171 | 0 | int*tp = MACROBLK_UP3(image,ch,tx,idx).data; |
1172 | |
|
1173 | 0 | _jxr_4OverlapFilter(R2B42(tp,2,14),R2B42(tp,3,14),R2B42(tp,4,14),R2B42(tp,5,14)); |
1174 | 0 | _jxr_4OverlapFilter(R2B42(tp,2,15),R2B42(tp,3,15),R2B42(tp,4,15),R2B42(tp,5,15)); |
1175 | | |
1176 | | /* Bottom across for soft tiles */ |
1177 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) |
1178 | 0 | || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
1179 | | /* Blocks that span the MB to the right */ |
1180 | 0 | int*tn = MACROBLK_UP3(image,ch,tx,idx-1).data; |
1181 | 0 | _jxr_4OverlapFilter(R2B42(tn,6,14),R2B42(tn,7,14),R2B42(tp,0,14),R2B42(tp,1,14)); |
1182 | 0 | _jxr_4OverlapFilter(R2B42(tn,6,15),R2B42(tn,7,15),R2B42(tp,0,15),R2B42(tp,1,15)); |
1183 | 0 | } |
1184 | 0 | } |
1185 | | |
1186 | | /* Bottom left corner */ |
1187 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
1188 | 0 | { |
1189 | 0 | int *dp = MACROBLK_UP3(image,ch,tx,0).data; |
1190 | 0 | _jxr_4OverlapFilter(R2B42(dp,0,14),R2B42(dp,1,14),R2B42(dp,0,15),R2B42(dp,1,15)); |
1191 | 0 | } |
1192 | | /* Bottom right corner */ |
1193 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
1194 | 0 | { |
1195 | 0 | int *dp = MACROBLK_UP3(image,ch,tx, image->tile_column_width[tx] - 1 ).data; |
1196 | 0 | _jxr_4OverlapFilter(R2B42(dp,6,14),R2B42(dp,7,14),R2B42(dp,6,15),R2B42(dp,7,15)); |
1197 | 0 | } |
1198 | 0 | } |
1199 | |
|
1200 | 0 | for (idx = 0 ; idx < image->tile_column_width[tx] ; idx += 1) { |
1201 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,idx).data; |
1202 | | |
1203 | | /* Fully interior 4x4 filter blocks... */ |
1204 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,2,2),R2B42(dp,3,2),R2B42(dp,4,2),R2B42(dp,5,2), |
1205 | 0 | R2B42(dp,2,3),R2B42(dp,3,3),R2B42(dp,4,3),R2B42(dp,5,3), |
1206 | 0 | R2B42(dp,2,4),R2B42(dp,3,4),R2B42(dp,4,4),R2B42(dp,5,4), |
1207 | 0 | R2B42(dp,2,5),R2B42(dp,3,5),R2B42(dp,4,5),R2B42(dp,5,5)); |
1208 | |
|
1209 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,2,6),R2B42(dp,3,6),R2B42(dp,4,6),R2B42(dp,5,6), |
1210 | 0 | R2B42(dp,2,7),R2B42(dp,3,7),R2B42(dp,4,7),R2B42(dp,5,7), |
1211 | 0 | R2B42(dp,2,8),R2B42(dp,3,8),R2B42(dp,4,8),R2B42(dp,5,8), |
1212 | 0 | R2B42(dp,2,9),R2B42(dp,3,9),R2B42(dp,4,9),R2B42(dp,5,9)); |
1213 | |
|
1214 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,2,10),R2B42(dp,3,10),R2B42(dp,4,10),R2B42(dp,5,10), |
1215 | 0 | R2B42(dp,2,11),R2B42(dp,3,11),R2B42(dp,4,11),R2B42(dp,5,11), |
1216 | 0 | R2B42(dp,2,12),R2B42(dp,3,12),R2B42(dp,4,12),R2B42(dp,5,12), |
1217 | 0 | R2B42(dp,2,13),R2B42(dp,3,13),R2B42(dp,4,13),R2B42(dp,5,13)); |
1218 | |
|
1219 | 0 | if ( (image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1 && !image->disableTileOverlapFlag) || |
1220 | 0 | (image->disableTileOverlapFlag && !RIGHT_X(idx))) { |
1221 | | /* Blocks that span the MB to the right */ |
1222 | 0 | int*np = MACROBLK_UP3(image,ch,tx,idx+1).data; |
1223 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,6,2),R2B42(dp,7,2),R2B42(np,0,2),R2B42(np,1,2), |
1224 | 0 | R2B42(dp,6,3),R2B42(dp,7,3),R2B42(np,0,3),R2B42(np,1,3), |
1225 | 0 | R2B42(dp,6,4),R2B42(dp,7,4),R2B42(np,0,4),R2B42(np,1,4), |
1226 | 0 | R2B42(dp,6,5),R2B42(dp,7,5),R2B42(np,0,5),R2B42(np,1,5)); |
1227 | |
|
1228 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,6,6),R2B42(dp,7,6),R2B42(np,0,6),R2B42(np,1,6), |
1229 | 0 | R2B42(dp,6,7),R2B42(dp,7,7),R2B42(np,0,7),R2B42(np,1,7), |
1230 | 0 | R2B42(dp,6,8),R2B42(dp,7,8),R2B42(np,0,8),R2B42(np,1,8), |
1231 | 0 | R2B42(dp,6,9),R2B42(dp,7,9),R2B42(np,0,9),R2B42(np,1,9)); |
1232 | |
|
1233 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,6,10),R2B42(dp,7,10),R2B42(np,0,10),R2B42(np,1,10), |
1234 | 0 | R2B42(dp,6,11),R2B42(dp,7,11),R2B42(np,0,11),R2B42(np,1,11), |
1235 | 0 | R2B42(dp,6,12),R2B42(dp,7,12),R2B42(np,0,12),R2B42(np,1,12), |
1236 | 0 | R2B42(dp,6,13),R2B42(dp,7,13),R2B42(np,0,13),R2B42(np,1,13)); |
1237 | 0 | } |
1238 | |
|
1239 | 0 | if ((top_my+1) < (int) EXTENDED_HEIGHT_BLOCKS(image)) { |
1240 | | |
1241 | | /* Blocks that MB below */ |
1242 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,idx).data; |
1243 | 0 | int*up = MACROBLK_UP2(image,ch,tx,idx).data; |
1244 | |
|
1245 | 0 | if ((tx == 0 && idx==0 && !image->disableTileOverlapFlag) || |
1246 | 0 | (image->disableTileOverlapFlag && LEFT_X(idx) && !BOTTOM_Y(top_my))) { |
1247 | 0 | _jxr_4OverlapFilter(R2B42(dp,0,14),R2B42(dp,0,15),R2B42(up,0,0),R2B42(up,0,1)); |
1248 | 0 | _jxr_4OverlapFilter(R2B42(dp,1,14),R2B42(dp,1,15),R2B42(up,1,0),R2B42(up,1,1)); |
1249 | 0 | } |
1250 | 0 | if((!image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !BOTTOM_Y(top_my))) |
1251 | 0 | { |
1252 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,2,14),R2B42(dp,3,14),R2B42(dp,4,14),R2B42(dp,5,14), |
1253 | 0 | R2B42(dp,2,15),R2B42(dp,3,15),R2B42(dp,4,15),R2B42(dp,5,15), |
1254 | 0 | R2B42(up,2, 0),R2B42(up,3, 0),R2B42(up,4, 0),R2B42(up,5, 0), |
1255 | 0 | R2B42(up,2, 1),R2B42(up,3, 1),R2B42(up,4, 1),R2B42(up,5, 1)); |
1256 | |
|
1257 | 0 | } |
1258 | |
|
1259 | 0 | if (((image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1) && !image->disableTileOverlapFlag ) || |
1260 | 0 | ( image->disableTileOverlapFlag && !RIGHT_X(idx) && !BOTTOM_Y(top_my) ) |
1261 | 0 | ) { |
1262 | | /* Blocks that span the MB to the right, below, below-right */ |
1263 | 0 | int*dn = MACROBLK_UP3(image,ch,tx,idx+1).data; |
1264 | 0 | int*un = MACROBLK_UP2(image,ch,tx,idx+1).data; |
1265 | |
|
1266 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,6,14),R2B42(dp,7,14),R2B42(dn,0,14),R2B42(dn,1,14), |
1267 | 0 | R2B42(dp,6,15),R2B42(dp,7,15),R2B42(dn,0,15),R2B42(dn,1,15), |
1268 | 0 | R2B42(up,6, 0),R2B42(up,7, 0),R2B42(un,0, 0),R2B42(un,1, 0), |
1269 | 0 | R2B42(up,6, 1),R2B42(up,7, 1),R2B42(un,0, 1),R2B42(un,1, 1)); |
1270 | 0 | } |
1271 | 0 | if((image->tile_column_position[tx] + idx == (int) EXTENDED_WIDTH_BLOCKS(image)-1 && !image->disableTileOverlapFlag) || |
1272 | 0 | (image->disableTileOverlapFlag && RIGHT_X(idx) && !BOTTOM_Y(top_my))) |
1273 | 0 | { |
1274 | 0 | _jxr_4OverlapFilter(R2B42(dp,6,14),R2B42(dp,6,15),R2B42(up,6,0),R2B42(up,6,1)); |
1275 | 0 | _jxr_4OverlapFilter(R2B42(dp,7,14),R2B42(dp,7,15),R2B42(up,7,0),R2B42(up,7,1)); |
1276 | 0 | } |
1277 | 0 | } |
1278 | 0 | } |
1279 | 0 | } |
1280 | 0 | } |
1281 | | /* |
1282 | | */ |
1283 | | |
1284 | | static void overlap_level2_up3_420(jxr_image_t image, int use_my, int ch) |
1285 | 0 | { |
1286 | 0 | int tx = 0; /* XXXX */ |
1287 | 0 | int top_my = use_my - 3; |
1288 | 0 | int idx; |
1289 | 0 | int ty = 0; |
1290 | |
|
1291 | 0 | assert(ch > 0 && image->use_clr_fmt == 1/*YUV420*/); |
1292 | 0 | assert(use_my >= 3); |
1293 | |
|
1294 | 0 | DEBUG("Overlap Level2 (YUV420) for row %d\n", top_my); |
1295 | | |
1296 | | |
1297 | | /* Figure out which tile row the current strip of macroblocks belongs to. */ |
1298 | 0 | while(top_my > image->tile_row_position[ty]+image->tile_row_height[ty] - 1) |
1299 | 0 | ty++; |
1300 | |
|
1301 | 0 | for(tx = 0; tx < image->tile_columns; tx++) |
1302 | 0 | { |
1303 | | |
1304 | | /* Left edge */ |
1305 | 0 | if (tx == 0 || image->disableTileOverlapFlag) |
1306 | 0 | { |
1307 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,0).data; |
1308 | 0 | _jxr_4OverlapFilter(R2B42(dp,0,2),R2B42(dp,0,3),R2B42(dp,0,4),R2B42(dp,0,5)); |
1309 | 0 | _jxr_4OverlapFilter(R2B42(dp,1,2),R2B42(dp,1,3),R2B42(dp,1,4),R2B42(dp,1,5)); |
1310 | 0 | } |
1311 | | |
1312 | | /* Right edge */ |
1313 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag){ |
1314 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,image->tile_column_width[tx]-1).data; |
1315 | 0 | _jxr_4OverlapFilter(R2B42(dp,6,2),R2B42(dp,6,3),R2B42(dp,6,4),R2B42(dp,6,5)); |
1316 | 0 | _jxr_4OverlapFilter(R2B42(dp,7,2),R2B42(dp,7,3),R2B42(dp,7,4),R2B42(dp,7,5)); |
1317 | 0 | } |
1318 | | |
1319 | | /* Top edge */ |
1320 | 0 | if(top_my == 0 )/* || (image->disableTileOverlapFlag && TOP_Y(top_my) )) */ |
1321 | 0 | { |
1322 | | /* If this is the very first strip of blocks, then process the |
1323 | | first two scan lines with the smaller 4Overlap filter. */ |
1324 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
1325 | 0 | { |
1326 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,idx).data; |
1327 | 0 | _jxr_4OverlapFilter(R2B42(dp, 2,0),R2B42(dp, 3,0),R2B42(dp, 4,0),R2B42(dp, 5,0)); |
1328 | 0 | _jxr_4OverlapFilter(R2B42(dp, 2,1),R2B42(dp, 3,1),R2B42(dp, 4,1),R2B42(dp, 5,1)); |
1329 | | /* Top edge across */ |
1330 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
1331 | 0 | int*pp = MACROBLK_UP3(image,ch,tx,idx-1).data; |
1332 | 0 | _jxr_4OverlapFilter(R2B42(pp,6,0),R2B42(pp,7,0),R2B(dp,0,0),R2B42(dp,1,0)); |
1333 | 0 | _jxr_4OverlapFilter(R2B42(pp,6,1),R2B42(pp,7,1),R2B(dp,0,1),R2B42(dp,1,1)); |
1334 | 0 | } |
1335 | 0 | } |
1336 | | |
1337 | | /* Top left corner */ |
1338 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
1339 | 0 | { |
1340 | 0 | int *dp = MACROBLK_UP3(image,ch,tx,0).data; |
1341 | 0 | _jxr_4OverlapFilter(R2B42(dp, 0,0),R2B42(dp, 1, 0),R2B42(dp, 0 ,1),R2B42(dp, 1,1)); |
1342 | 0 | } |
1343 | | /* Top right corner */ |
1344 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
1345 | 0 | { |
1346 | 0 | int *dp = MACROBLK_UP3(image,ch,tx, image->tile_column_width[tx] - 1 ).data; |
1347 | 0 | _jxr_4OverlapFilter(R2B42(dp, 6,0),R2B42(dp, 7,0),R2B42(dp, 6,1),R2B42(dp, 7,1));; |
1348 | 0 | } |
1349 | |
|
1350 | 0 | } |
1351 | | |
1352 | | /* Bottom edge */ |
1353 | 0 | if ((top_my+1) == (int) EXTENDED_HEIGHT_BLOCKS(image) || (image->disableTileOverlapFlag && BOTTOM_Y(top_my))) { |
1354 | | |
1355 | | /* This is the last row, so there is no UP below |
1356 | | TOP. finish up with 4Overlap filters. */ |
1357 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
1358 | 0 | { |
1359 | 0 | int*tp = MACROBLK_UP3(image,ch,tx,idx).data; |
1360 | |
|
1361 | 0 | _jxr_4OverlapFilter(R2B42(tp,2,6),R2B42(tp,3,6),R2B42(tp,4,6),R2B42(tp,5,6)); |
1362 | 0 | _jxr_4OverlapFilter(R2B42(tp,2,7),R2B42(tp,3,7),R2B42(tp,4,7),R2B42(tp,5,7)); |
1363 | | |
1364 | | |
1365 | | /* Bottom edge across */ |
1366 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) |
1367 | 0 | || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
1368 | 0 | int*tn = MACROBLK_UP3(image,ch,tx,idx-1).data; |
1369 | 0 | _jxr_4OverlapFilter(R2B42(tn,6,6),R2B42(tn,7,6),R2B42(tp,0,6),R2B42(tp,1,6)); |
1370 | 0 | _jxr_4OverlapFilter(R2B42(tn,6,7),R2B42(tn,7,7),R2B42(tp,0,7),R2B42(tp,1,7)); |
1371 | 0 | } |
1372 | 0 | } |
1373 | | |
1374 | | /* Bottom left corner */ |
1375 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
1376 | 0 | { |
1377 | 0 | int *dp = MACROBLK_UP3(image,ch,tx,0).data; |
1378 | 0 | _jxr_4OverlapFilter(R2B42(dp, 0,6),R2B42(dp, 1, 6),R2B42(dp, 0,7),R2B42(dp, 1, 7)); |
1379 | 0 | } |
1380 | | |
1381 | | /* Bottom right corner */ |
1382 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
1383 | 0 | { |
1384 | 0 | int *dp = MACROBLK_UP3(image,ch,tx, image->tile_column_width[tx] - 1 ).data; |
1385 | 0 | _jxr_4OverlapFilter(R2B42(dp, 6, 6),R2B42(dp, 7, 6),R2B42(dp, 6, 7),R2B42(dp, 7, 7)); |
1386 | 0 | } |
1387 | |
|
1388 | 0 | if(image->disableTileOverlapFlag && BOTTOM_Y(top_my) && top_my <EXTENDED_HEIGHT_BLOCKS(image)-1) |
1389 | 0 | { |
1390 | | /* Also process Top edge of next macroblock row */ |
1391 | | /* In the case of YUV 420, the next row of macroblocks needs to be transformed */ |
1392 | | /* before yuv420_to_yuv422 is called */ |
1393 | | /* In the soft tile case the top 2 lines of the MB below are processed by the 2x2 operators spanning the MB below*/ |
1394 | | /* In the case of hard tiles, if this is the bottom most row of MBs in the Hard Tile */ |
1395 | | /* we need to process the top edge of the next hard tile */ |
1396 | | /* Also see HARDTILE_NOTE in yuv420_to_yuv422() */ |
1397 | |
|
1398 | 0 | for (idx = 0; idx < image->tile_column_width[tx] ; idx += 1) |
1399 | 0 | { |
1400 | 0 | int*dp = MACROBLK_UP2(image,ch,tx,idx).data; |
1401 | 0 | _jxr_4OverlapFilter(R2B42(dp, 2,0),R2B42(dp, 3,0),R2B42(dp, 4,0),R2B42(dp, 5,0)); |
1402 | 0 | _jxr_4OverlapFilter(R2B42(dp, 2,1),R2B42(dp, 3,1),R2B42(dp, 4,1),R2B42(dp, 5,1)); |
1403 | | /* Top edge across */ |
1404 | 0 | if ( (image->tile_column_position[tx] + idx > 0 && !image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !LEFT_X(idx))) { |
1405 | 0 | int*pp = MACROBLK_UP2(image,ch,tx,idx-1).data; |
1406 | 0 | _jxr_4OverlapFilter(R2B42(pp,6,0),R2B42(pp,7,0),R2B(dp,0,0),R2B42(dp,1,0)); |
1407 | 0 | _jxr_4OverlapFilter(R2B42(pp,6,1),R2B42(pp,7,1),R2B(dp,0,1),R2B42(dp,1,1)); |
1408 | 0 | } |
1409 | 0 | } |
1410 | | |
1411 | | /* Top left corner */ |
1412 | 0 | if(tx == 0 || image->disableTileOverlapFlag) |
1413 | 0 | { |
1414 | 0 | int *dp = MACROBLK_UP2(image,ch,tx,0).data; |
1415 | 0 | _jxr_4OverlapFilter(R2B42(dp, 0,0),R2B42(dp, 1, 0),R2B42(dp, 0 ,1),R2B42(dp, 1,1)); |
1416 | 0 | } |
1417 | | |
1418 | | /* Top right corner */ |
1419 | 0 | if(tx == image->tile_columns -1 || image->disableTileOverlapFlag) |
1420 | 0 | { |
1421 | 0 | int *dp = MACROBLK_UP2(image,ch,tx, image->tile_column_width[tx] - 1 ).data; |
1422 | 0 | _jxr_4OverlapFilter(R2B42(dp, 6,0),R2B42(dp, 7,0),R2B42(dp, 6,1),R2B42(dp, 7,1));; |
1423 | 0 | } |
1424 | 0 | } |
1425 | 0 | } |
1426 | |
|
1427 | 0 | for (idx = 0 ; idx < image->tile_column_width[tx] ; idx += 1) { |
1428 | |
|
1429 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,idx).data; |
1430 | 0 | int*up = MACROBLK_UP2(image,ch,tx,idx).data; |
1431 | | |
1432 | | /* Fully interior 4x4 filter blocks... */ |
1433 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,2,2),R2B42(dp,3,2),R2B42(dp,4,2),R2B42(dp,5,2), |
1434 | 0 | R2B42(dp,2,3),R2B42(dp,3,3),R2B42(dp,4,3),R2B42(dp,5,3), |
1435 | 0 | R2B42(dp,2,4),R2B42(dp,3,4),R2B42(dp,4,4),R2B42(dp,5,4), |
1436 | 0 | R2B42(dp,2,5),R2B42(dp,3,5),R2B42(dp,4,5),R2B42(dp,5,5)); |
1437 | |
|
1438 | 0 | if ( (image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1 && !image->disableTileOverlapFlag) || |
1439 | 0 | (image->disableTileOverlapFlag && !RIGHT_X(idx))) |
1440 | 0 | { |
1441 | | /* 4x4 at the right */ |
1442 | 0 | int*np = MACROBLK_UP3(image,ch,tx,idx+1).data; |
1443 | |
|
1444 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,6,2),R2B42(dp,7,2),R2B42(np,0,2),R2B42(np,1,2), |
1445 | 0 | R2B42(dp,6,3),R2B42(dp,7,3),R2B42(np,0,3),R2B42(np,1,3), |
1446 | 0 | R2B42(dp,6,4),R2B42(dp,7,4),R2B42(np,0,4),R2B42(np,1,4), |
1447 | 0 | R2B42(dp,6,5),R2B42(dp,7,5),R2B42(np,0,5),R2B42(np,1,5)); |
1448 | 0 | } |
1449 | |
|
1450 | 0 | if ((top_my+1) < (int) EXTENDED_HEIGHT_BLOCKS(image)) { |
1451 | |
|
1452 | 0 | int*dp = MACROBLK_UP3(image,ch,tx,idx).data; |
1453 | 0 | int*up = MACROBLK_UP2(image,ch,tx,idx).data; |
1454 | |
|
1455 | 0 | if ((tx == 0 && idx==0 && !image->disableTileOverlapFlag) || |
1456 | 0 | (image->disableTileOverlapFlag && LEFT_X(idx) && !BOTTOM_Y(top_my))) { |
1457 | | /* Across vertical blocks, left edge */ |
1458 | 0 | _jxr_4OverlapFilter(R2B42(dp,0,6),R2B42(dp,0,7),R2B42(up,0,0),R2B42(up,0,1)); |
1459 | 0 | _jxr_4OverlapFilter(R2B42(dp,1,6),R2B42(dp,1,7),R2B42(up,1,0),R2B42(up,1,1)); |
1460 | 0 | } |
1461 | 0 | if((!image->disableTileOverlapFlag) || (image->disableTileOverlapFlag && !BOTTOM_Y(top_my))) |
1462 | 0 | { |
1463 | | /* 4x4 straddling lower MB */ |
1464 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,2,6),R2B42(dp,3,6),R2B42(dp,4,6),R2B42(dp,5,6), |
1465 | 0 | R2B42(dp,2,7),R2B42(dp,3,7),R2B42(dp,4,7),R2B42(dp,5,7), |
1466 | 0 | R2B42(up,2,0),R2B42(up,3,0),R2B42(up,4,0),R2B42(up,5,0), |
1467 | 0 | R2B42(up,2,1),R2B42(up,3,1),R2B42(up,4,1),R2B42(up,5,1)); |
1468 | 0 | } |
1469 | |
|
1470 | 0 | if (((image->tile_column_position[tx] + idx < EXTENDED_WIDTH_BLOCKS(image)-1) && !image->disableTileOverlapFlag ) || |
1471 | 0 | ( image->disableTileOverlapFlag && !RIGHT_X(idx) && !BOTTOM_Y(top_my) ) |
1472 | 0 | ) { |
1473 | | /* Blocks that span the MB to the right */ |
1474 | 0 | int*dn = MACROBLK_UP3(image,ch,tx,idx+1).data; |
1475 | 0 | int*un = MACROBLK_UP2(image,ch,tx,idx+1).data; |
1476 | | |
1477 | | /* 4x4 right, below, below-right */ |
1478 | 0 | _jxr_4x4OverlapFilter(R2B42(dp,6,6),R2B42(dp,7,6),R2B42(dn,0,6),R2B42(dn,1,6), |
1479 | 0 | R2B42(dp,6,7),R2B42(dp,7,7),R2B42(dn,0,7),R2B42(dn,1,7), |
1480 | 0 | R2B42(up,6,0),R2B42(up,7,0),R2B42(un,0,0),R2B42(un,1,0), |
1481 | 0 | R2B42(up,6,1),R2B42(up,7,1),R2B42(un,0,1),R2B42(un,1,1)); |
1482 | 0 | } |
1483 | 0 | if((image->tile_column_position[tx] + idx == (int) EXTENDED_WIDTH_BLOCKS(image)-1 && !image->disableTileOverlapFlag) || |
1484 | 0 | (image->disableTileOverlapFlag && RIGHT_X(idx) && !BOTTOM_Y(top_my))) |
1485 | 0 | { |
1486 | | /* Across vertical blocks, right edge */ |
1487 | 0 | _jxr_4OverlapFilter(R2B42(dp,6,6),R2B42(dp,6,7),R2B42(up,6,0),R2B42(up,6,1)); |
1488 | 0 | _jxr_4OverlapFilter(R2B42(dp,7,6),R2B42(dp,7,7),R2B42(up,7,0),R2B42(up,7,1)); |
1489 | 0 | } |
1490 | 0 | } |
1491 | 0 | } |
1492 | 0 | } |
1493 | 0 | } |
1494 | | |
1495 | | |
1496 | | static void overlap_level2_up3(jxr_image_t image, int use_my, int ch) |
1497 | 0 | { |
1498 | 0 | if (ch == 0) { |
1499 | 0 | overlap_level2_up3_444(image, use_my, ch); |
1500 | 0 | } |
1501 | 0 | else { |
1502 | 0 | switch (image->use_clr_fmt) { |
1503 | 0 | case 1: /*YUV420*/ |
1504 | 0 | overlap_level2_up3_420(image, use_my, ch); |
1505 | 0 | break; |
1506 | 0 | case 2: /*YUV422*/ |
1507 | 0 | overlap_level2_up3_422(image, use_my, ch); |
1508 | 0 | break; |
1509 | 0 | default: |
1510 | 0 | overlap_level2_up3_444(image, use_my, ch); |
1511 | 0 | break; |
1512 | 0 | } |
1513 | 0 | } |
1514 | 0 | } |
1515 | | |
1516 | | |
1517 | | static void yuv444_to_rgb(jxr_image_t image, int mx) |
1518 | 0 | { |
1519 | 0 | int px; |
1520 | 0 | for (px = 0 ; px < 256 ; px += 1) { |
1521 | 0 | int Y = image->strip[0].up3[mx].data[px]; |
1522 | 0 | int U = image->strip[1].up3[mx].data[px]; |
1523 | 0 | int V = image->strip[2].up3[mx].data[px]; |
1524 | 0 | int G = Y - _jxr_floor_div2(-U); |
1525 | 0 | int R = G - U - _jxr_ceil_div2(V); |
1526 | 0 | int B = V + R; |
1527 | |
|
1528 | 0 | image->strip[0].up3[mx].data[px] = R; |
1529 | 0 | image->strip[1].up3[mx].data[px] = G; |
1530 | 0 | image->strip[2].up3[mx].data[px] = B; |
1531 | 0 | } |
1532 | 0 | } |
1533 | | |
1534 | | static const int iH[5][4] = {{4, 4 , 0, 8}, {5, 3, 1, 7}, {6, 2, 2, 6}, {7, 1, 3, 5}, {8, 0, 4, 4}}; |
1535 | | |
1536 | | static void upsample(int inbuf[], int outbuf[], int upsamplelen, int chroma_center) |
1537 | 0 | { |
1538 | 0 | int k; |
1539 | 0 | if(chroma_center == 5 || chroma_center == 6 || chroma_center == 7) |
1540 | 0 | { |
1541 | 0 | chroma_center = 0; |
1542 | 0 | DEBUG("Treating chroma_center as 0 in upsample\n"); |
1543 | 0 | } |
1544 | |
|
1545 | 0 | for (k = 0; k <= (upsamplelen - 2) / 2; k++) |
1546 | 0 | outbuf[2*k+1] = (( iH[chroma_center][0]*inbuf[k+1] + iH[chroma_center][1]*inbuf[k+2] + 4) >> 3); |
1547 | 0 | for (k = -1; k <= (upsamplelen - 4) / 2; k++) |
1548 | 0 | outbuf[2*k+2] = ((iH[chroma_center][2] * inbuf[k+1] + iH[chroma_center][3] * inbuf[k+2] + 4) >> 3); |
1549 | 0 | } |
1550 | | |
1551 | | static void yuv422_to_yuv444(jxr_image_t image, int mx) |
1552 | 0 | { |
1553 | 0 | int buf[256]; |
1554 | |
|
1555 | 0 | int ch; |
1556 | 0 | int px, py, idx; |
1557 | |
|
1558 | 0 | for(ch =1; ch < 3; ch ++) { |
1559 | |
|
1560 | 0 | for (py = 0 ; py < 16 ; py += 1) |
1561 | 0 | { |
1562 | 0 | int inbuf [10]; |
1563 | |
|
1564 | 0 | if(mx == 0) /* Repeat to the left */ |
1565 | 0 | image->strip[ch].upsample_memory_x[py] = image->strip[ch].up3[mx].data[8*py]; |
1566 | | |
1567 | | /* Prep input array */ |
1568 | 0 | for(px =0; px <=7; px++) |
1569 | 0 | { |
1570 | 0 | inbuf[px+1] = image->strip[ch].up3[mx].data[8*py+ px]; |
1571 | |
|
1572 | 0 | } |
1573 | 0 | inbuf[0] = image->strip[ch].upsample_memory_x[py]; |
1574 | 0 | if(mx+1 < (int) EXTENDED_WIDTH_BLOCKS(image)) |
1575 | 0 | inbuf[9] = image->strip[ch].up3[mx+1].data[8*py]; |
1576 | 0 | else |
1577 | 0 | inbuf[9] = inbuf[8]; /* Repeat to the right */ |
1578 | | |
1579 | | /* Call upsample */ |
1580 | 0 | upsample(inbuf, buf + 16*py, 16, image->chroma_centering_x); |
1581 | | |
1582 | | /* Remember right most vals */ |
1583 | 0 | image->strip[ch].upsample_memory_x[py] = image->strip[ch].up3[mx].data[8*py+7]; |
1584 | 0 | } |
1585 | |
|
1586 | 0 | for (idx = 0 ; idx < 256 ; idx += 1) |
1587 | 0 | image->strip[ch].up3[mx].data[idx] = buf[idx]; |
1588 | |
|
1589 | 0 | } |
1590 | 0 | } |
1591 | | |
1592 | | static void yuv420_to_yuv444(jxr_image_t image, int use_my, int mx) |
1593 | 0 | { |
1594 | 0 | int buf[256]; |
1595 | 0 | int intermediatebuf[2][16 * 8]; |
1596 | |
|
1597 | 0 | int ch; |
1598 | 0 | int inbuf [10]; |
1599 | 0 | int px, py, idx; |
1600 | | |
1601 | | /* Upsample in the y direction */ |
1602 | 0 | for (ch = 1 ; ch < 3 ; ch += 1) { |
1603 | 0 | for(px = 0; px < 8; px ++) |
1604 | 0 | { |
1605 | 0 | if(use_my-2 == 1) /* Repeat to the top */ |
1606 | 0 | image->strip[ch].upsample_memory_y[8*mx+ px] = image->strip[ch].up3[mx].data[px];/* Store the top most values */ |
1607 | | |
1608 | | /* Prep input buffer */ |
1609 | 0 | for(py =0; py < 8 ; py++) |
1610 | 0 | inbuf[py+1] = image->strip[ch].up3[mx].data[8*py+ px]; |
1611 | 0 | inbuf[0] = image->strip[ch].upsample_memory_y[8*mx + px]; |
1612 | 0 | if((use_my-2) < (int) EXTENDED_HEIGHT_BLOCKS(image)) |
1613 | 0 | { |
1614 | 0 | if(px <= 3) |
1615 | 0 | inbuf[9] = image->strip[ch].up2[mx].data[px]; /* Get the lower MB sample */ |
1616 | 0 | else |
1617 | 0 | inbuf[9] = image->strip[ch].up2[mx].data[px + 12]; /* Since unblock_shuffle420 has not been called on up2 */ |
1618 | 0 | } |
1619 | 0 | else |
1620 | 0 | inbuf[9] = inbuf[8]; /* Repeat to the right */ |
1621 | | |
1622 | | /* Call upsample */ |
1623 | 0 | upsample(inbuf, buf, 16, image->chroma_centering_y); |
1624 | |
|
1625 | 0 | for(py =0; py < 16; py ++) |
1626 | 0 | intermediatebuf[ch-1][8*py + px] = buf[py]; |
1627 | |
|
1628 | 0 | image->strip[ch].upsample_memory_y[8*mx + px] = image->strip[ch].up3[mx].data[8*7+px];/* Store the bottom most values */ |
1629 | 0 | } |
1630 | 0 | } |
1631 | | |
1632 | | /* Upsample in the X direction */ |
1633 | 0 | for (ch = 1 ; ch < 3 ; ch += 1) { |
1634 | 0 | int nextmbrow[16]; |
1635 | | |
1636 | | /* To upsample in the X direction, we need the Y-direction upsampled values from the left most row of the next MB */ |
1637 | | /* Prep input buffer */ |
1638 | 0 | for(py = 0; py < 8; py ++) |
1639 | 0 | { |
1640 | 0 | if(mx + 1 < (int) EXTENDED_WIDTH_BLOCKS(image)) |
1641 | 0 | inbuf[py + 1] = image->strip[ch].up3[mx+1].data[8*py]; |
1642 | 0 | else |
1643 | 0 | inbuf[py + 1] = image->strip[ch].up3[mx].data[8*py]; |
1644 | 0 | } |
1645 | 0 | if(use_my - 2 < (int) EXTENDED_HEIGHT_BLOCKS(image) && mx + 1 < (int) EXTENDED_WIDTH_BLOCKS(image)) |
1646 | 0 | inbuf[9] = image->strip[ch].up2[mx+1].data[0]; |
1647 | 0 | else |
1648 | 0 | inbuf[9] = inbuf[8];/* Repeat to the right */ |
1649 | 0 | if(use_my -2 != 1 && mx + 1 < (int) EXTENDED_WIDTH_BLOCKS(image)) |
1650 | 0 | inbuf[0] = image->strip[ch].upsample_memory_y[8*(mx+1)]; |
1651 | 0 | else |
1652 | 0 | inbuf[0] = inbuf[1]; |
1653 | | |
1654 | | /*Call upsample */ |
1655 | 0 | upsample(inbuf, nextmbrow, 16, image->chroma_centering_y); |
1656 | |
|
1657 | 0 | for(py = 0; py < 16; py ++) |
1658 | 0 | { |
1659 | 0 | if(mx == 0) /* Repeat to the left */ |
1660 | 0 | image->strip[ch].upsample_memory_x[py] = intermediatebuf[ch-1][8*py]; |
1661 | | |
1662 | | /* Prepare the input buffer */ |
1663 | 0 | for(px =0; px <=7; px++) |
1664 | 0 | inbuf[px+1] = intermediatebuf[ch-1][8*py+ px]; |
1665 | |
|
1666 | 0 | inbuf[0] = image->strip[ch].upsample_memory_x[py]; |
1667 | 0 | if(mx + 1 < (int) EXTENDED_WIDTH_BLOCKS(image)) |
1668 | 0 | { |
1669 | 0 | inbuf[9] = nextmbrow[py]; |
1670 | 0 | } |
1671 | 0 | else |
1672 | 0 | inbuf[9] = inbuf[8]; /* Repeat to the right */ |
1673 | | |
1674 | | /* Call upsample */ |
1675 | 0 | upsample(inbuf, buf + 16*py, 16, image->chroma_centering_x); |
1676 | 0 | image->strip[ch].upsample_memory_x[py] = intermediatebuf[ch-1][8*py + 7];/* Store the right most values */ |
1677 | 0 | } |
1678 | |
|
1679 | 0 | for(idx =0; idx < 256; idx ++) |
1680 | 0 | image->strip[ch].up3[mx].data[idx] = buf[idx]; |
1681 | 0 | } |
1682 | 0 | } |
1683 | | |
1684 | | static void yuvk_to_cmyk(jxr_image_t image, int mx) |
1685 | 0 | { |
1686 | 0 | int px; |
1687 | 0 | for (px = 0 ; px < 256 ; px += 1) { |
1688 | 0 | int Y = image->strip[0].up3[mx].data[px]; |
1689 | 0 | int U = image->strip[1].up3[mx].data[px]; |
1690 | 0 | int V = image->strip[2].up3[mx].data[px]; |
1691 | 0 | int K = image->strip[3].up3[mx].data[px]; |
1692 | 0 | int k = K + _jxr_floor_div2(Y); |
1693 | 0 | int m = k - Y - _jxr_floor_div2(U); |
1694 | 0 | int c = U + m + _jxr_floor_div2(V); |
1695 | 0 | int y = c - V; |
1696 | |
|
1697 | 0 | image->strip[0].up3[mx].data[px] = c; |
1698 | 0 | image->strip[1].up3[mx].data[px] = m; |
1699 | 0 | image->strip[2].up3[mx].data[px] = y; |
1700 | 0 | image->strip[3].up3[mx].data[px] = k; |
1701 | 0 | } |
1702 | 0 | } |
1703 | | |
1704 | | static int PostScalingFloat(int iPixVal, unsigned int expBias, unsigned char lenMantissa, int bitdepth) |
1705 | 0 | { |
1706 | 0 | int convVal = 0; |
1707 | 0 | if (bitdepth == JXR_BD16F) |
1708 | 0 | { |
1709 | 0 | uint8_t iS = 0; |
1710 | 0 | unsigned int fV = 0; |
1711 | 0 | unsigned int iEM = abs(iPixVal); |
1712 | 0 | if(iPixVal < 0) |
1713 | 0 | iS = 1; |
1714 | 0 | if (iEM > 0x7FFF) |
1715 | 0 | iEM = 0x7FFF; |
1716 | 0 | convVal = ((iS << 15) | iEM); /* Concatenate these fields*/ |
1717 | 0 | } |
1718 | 0 | else |
1719 | 0 | { |
1720 | 0 | int sign, iTempH, mantissa, exp, lmshift = (1 << lenMantissa); |
1721 | |
|
1722 | 0 | assert (expBias <= 127); |
1723 | |
|
1724 | 0 | iTempH = (int) iPixVal ; |
1725 | 0 | sign = (iTempH >> 31); |
1726 | 0 | iTempH = (iTempH ^ sign) - sign; /* abs(iTempH) */ |
1727 | |
|
1728 | 0 | exp = (unsigned int) iTempH >> lenMantissa;/* & ((1 << (31 - lenMantissa)) - 1); */ |
1729 | 0 | mantissa = (iTempH & (lmshift - 1)) | lmshift; /* actual mantissa, with normalizer */ |
1730 | 0 | if (exp == 0) { /* denormal land */ |
1731 | 0 | mantissa ^= lmshift; /* normalizer removed */ |
1732 | 0 | exp = 1; /* actual exponent */ |
1733 | 0 | } |
1734 | |
|
1735 | 0 | exp += (127 - expBias); |
1736 | 0 | while (mantissa < lmshift && exp > 1 && mantissa > 0) { /* denormal originally, see if normal is possible */ |
1737 | 0 | exp--; |
1738 | 0 | mantissa <<= 1; |
1739 | 0 | } |
1740 | 0 | if (mantissa < lmshift) /* truly denormal */ |
1741 | 0 | exp = 0; |
1742 | 0 | else |
1743 | 0 | mantissa ^= lmshift; |
1744 | 0 | mantissa <<= (23 - lenMantissa); |
1745 | |
|
1746 | 0 | convVal = (sign & 0x80000000) | (exp << 23) | mantissa; |
1747 | 0 | } |
1748 | 0 | return convVal; |
1749 | 0 | } |
1750 | | |
1751 | 0 | static void PostScalingFl2(int arrayOut[], int arrayIn[]) { |
1752 | | /* arrayIn[ ]= {R, G, B} */ |
1753 | | /* arrayOut[ ]= {Rrgbe, Grgbe, Brgbe, Ergbe} */ |
1754 | 0 | int iEr, iEg, iEb; |
1755 | 0 | int iShift; |
1756 | |
|
1757 | 0 | if (arrayIn[0] <= 0) { |
1758 | 0 | arrayOut[0] = 0; |
1759 | 0 | iEr = 0; |
1760 | 0 | } |
1761 | 0 | else if ((arrayIn[0] >> 7) > 1) { |
1762 | 0 | arrayOut[0] = (arrayIn[0] & 0x7F) + 0x80; |
1763 | 0 | iEr = (arrayIn[0] >> 7); |
1764 | 0 | } |
1765 | 0 | else { |
1766 | 0 | arrayOut[0] = arrayIn[0]; |
1767 | 0 | iEr = 1; |
1768 | 0 | } |
1769 | 0 | if (arrayIn[1] <= 0) { |
1770 | 0 | arrayOut[1] = 0; |
1771 | 0 | iEg = 0; |
1772 | 0 | } |
1773 | 0 | else if ((arrayIn[1] >> 7) > 1) { |
1774 | 0 | arrayOut[1] = (arrayIn[1] & 0x7F) + 0x80; |
1775 | 0 | iEg = (arrayIn[1] >> 7); |
1776 | 0 | } |
1777 | 0 | else { |
1778 | 0 | arrayOut[1] = arrayIn[1]; |
1779 | 0 | iEg = 1; |
1780 | 0 | } |
1781 | 0 | if (arrayIn[2] <= 0) { |
1782 | 0 | arrayOut[2] = 0; |
1783 | 0 | iEb = 0; |
1784 | 0 | } |
1785 | 0 | else if ((arrayIn[2] >> 7) > 1) { |
1786 | 0 | arrayOut[2] = (arrayIn[2] & 0x7F) + 0x80; |
1787 | 0 | iEb = (arrayIn[2] >> 7); |
1788 | 0 | } |
1789 | 0 | else { |
1790 | 0 | arrayOut[2] = arrayIn[2]; |
1791 | 0 | iEb = 1; |
1792 | 0 | } |
1793 | | |
1794 | | /* Max(iEr, iEg, iEb) */ |
1795 | 0 | arrayOut[3] = iEr> iEg? (iEr>iEb?iEr:iEb):(iEg>iEb?iEg:iEb); |
1796 | |
|
1797 | 0 | if( arrayOut[3] > iEr){ |
1798 | 0 | iShift = ( arrayOut[3] - iEr); |
1799 | 0 | arrayOut[0] = (unsigned char)((((int) arrayOut[0]) * 2 + 1) >> (iShift + 1)); |
1800 | 0 | } |
1801 | 0 | if( arrayOut[3] > iEg){ |
1802 | 0 | iShift = ( arrayOut[3]- iEg); |
1803 | 0 | arrayOut[1] = (unsigned char)((((int) arrayOut[1]) * 2 + 1) >> (iShift + 1)); |
1804 | 0 | } |
1805 | 0 | if( arrayOut[3] > iEb){ |
1806 | 0 | iShift = ( arrayOut[3]- iEb); |
1807 | 0 | arrayOut[2] = (unsigned char)((((int) arrayOut[2]) * 2 + 1) >> (iShift + 1)); |
1808 | 0 | } |
1809 | 0 | } |
1810 | | |
1811 | | static void scale_and_emit_top(jxr_image_t image, int tx, int use_my) |
1812 | 0 | { |
1813 | 0 | int scale = image->scaled_flag? 3 : 0; |
1814 | 0 | int bias; |
1815 | 0 | int round; |
1816 | 0 | int shift_bits = image->shift_bits; |
1817 | | /* Clipping based on 8bit values. */ |
1818 | 0 | int clip_low = 0; |
1819 | 0 | int clip_hig = 255; |
1820 | 0 | int idx; |
1821 | 0 | int buffer[(MAX_CHANNELS + 1)*256]; |
1822 | 0 | unsigned int bSkipColorTransform = 0; |
1823 | 0 | memset(buffer, 0,(MAX_CHANNELS + 1)*256); |
1824 | | |
1825 | | |
1826 | 0 | switch (SOURCE_BITDEPTH(image)) { |
1827 | 0 | case 0: /* BD1WHITE1*/ |
1828 | | |
1829 | 0 | case 15: /* BD1BLACK1 */ |
1830 | 0 | bias = 0; |
1831 | 0 | round = image->scaled_flag? 4 : 0; |
1832 | 0 | clip_low = 0; |
1833 | 0 | clip_hig = 1; |
1834 | 0 | break; |
1835 | 0 | case 1: /* BD8 */ |
1836 | 0 | bias = 1 << 7; |
1837 | 0 | round = image->scaled_flag? 3 : 0; |
1838 | 0 | clip_low = 0; |
1839 | 0 | clip_hig = 255; |
1840 | 0 | break; |
1841 | 0 | case 2: /* BD16 */ |
1842 | 0 | bias = 1 << 15; |
1843 | 0 | round = image->scaled_flag? 4 : 0; |
1844 | 0 | clip_low = 0; |
1845 | 0 | clip_hig = 65535; |
1846 | 0 | break; |
1847 | 0 | case 3: /* BD16S */ |
1848 | 0 | bias = 0; |
1849 | 0 | round = image->scaled_flag? 3 : 0; |
1850 | 0 | clip_low = -32768; |
1851 | 0 | clip_hig = 32767; |
1852 | 0 | break; |
1853 | | |
1854 | 0 | case 6: /*BD32S */ |
1855 | 0 | bias = 0; |
1856 | 0 | round = image->scaled_flag? 3 : 0; |
1857 | 0 | clip_hig = 0x7fffffff; |
1858 | 0 | clip_low = -(clip_hig + 1); |
1859 | 0 | break; |
1860 | | |
1861 | 0 | case 4: /* BD16F */ |
1862 | |
|
1863 | 0 | case 7: /* BD32F */ |
1864 | 0 | bias = 0; |
1865 | 0 | round = image->scaled_flag? 3 : 0; |
1866 | 0 | break; |
1867 | | |
1868 | 0 | case 8: /* BD5 */ |
1869 | 0 | bias = 16; |
1870 | 0 | round = image->scaled_flag? 3 : 0; |
1871 | 0 | clip_hig = 31; |
1872 | 0 | clip_low = 0; |
1873 | 0 | break; |
1874 | | |
1875 | 0 | case 9: /* BD10 */ |
1876 | 0 | bias = 512; |
1877 | 0 | round = image->scaled_flag? 3 : 0; |
1878 | 0 | clip_hig = 1023; |
1879 | 0 | clip_low = 0; |
1880 | 0 | break; |
1881 | | |
1882 | 0 | case 10: /* BD565 */ |
1883 | 0 | bias = 32; |
1884 | 0 | round = image->scaled_flag? 3 : 0; |
1885 | 0 | clip_hig = 31; |
1886 | 0 | clip_low = 0; |
1887 | 0 | break; |
1888 | | |
1889 | 0 | case 5: /* Reserved */ |
1890 | |
|
1891 | 0 | default: |
1892 | 0 | fprintf(stderr, "XXXX Don't know how to scale bit depth %d?\n", SOURCE_BITDEPTH(image)); |
1893 | 0 | bias = 0; |
1894 | 0 | round = image->scaled_flag? 3 : 0; |
1895 | 0 | clip_low = 0; |
1896 | 0 | clip_hig = 255; |
1897 | 0 | break; |
1898 | 0 | } |
1899 | | |
1900 | 0 | DEBUG("scale_and_emit_top: scale=%d, bias=%d, round=%d, shift_bits=%d, clip_low=%d, clip_hig=%d\n", |
1901 | 0 | scale, bias, round, shift_bits, clip_low, clip_hig); |
1902 | | |
1903 | | /* Up 'til this point, the MB contains 4x4 sub-blocks. We are |
1904 | | now ready for the MB to contain only raster data within, so |
1905 | | this loop rasterizes all the MBs in this strip. */ |
1906 | 0 | for (idx = 0 ; idx < (int) EXTENDED_WIDTH_BLOCKS(image); idx += 1) { |
1907 | |
|
1908 | 0 | int ch; |
1909 | 0 | int*dp = image->strip[0].up3[idx].data; |
1910 | 0 | unblock_shuffle444(dp); |
1911 | 0 | for (ch = 1 ; ch < image->num_channels ; ch += 1) { |
1912 | 0 | dp = image->strip[ch].up3[idx].data; |
1913 | 0 | switch (image->use_clr_fmt) { |
1914 | 0 | case 1: /* YUV420 */ |
1915 | 0 | unblock_shuffle420(dp); |
1916 | 0 | break; |
1917 | 0 | case 2: /* YUV422 */ |
1918 | 0 | unblock_shuffle422(dp); |
1919 | 0 | break; |
1920 | 0 | default: |
1921 | 0 | unblock_shuffle444(dp); |
1922 | 0 | break; |
1923 | 0 | } |
1924 | 0 | } |
1925 | 0 | } |
1926 | | |
1927 | 0 | for (idx = 0 ; idx < (int) EXTENDED_WIDTH_BLOCKS(image); idx += 1) { |
1928 | |
|
1929 | 0 | int ch; |
1930 | | #if defined(DETAILED_DEBUG) && 1 |
1931 | | for (ch = 0 ; ch < image->num_channels ; ch += 1) { |
1932 | | int count = 256; |
1933 | | if (ch > 0 && image->use_clr_fmt==2/*YUV422*/) |
1934 | | count = 128; |
1935 | | if (ch > 0 && image->use_clr_fmt==1/*YUV420*/) |
1936 | | count = 64; |
1937 | | |
1938 | | DEBUG("image yuv mx=%3d my=%3d ch=%d:", idx, use_my-3, ch); |
1939 | | int jdx; |
1940 | | for (jdx = 0 ; jdx < count ; jdx += 1) { |
1941 | | if (jdx%8 == 0 && jdx != 0) |
1942 | | DEBUG("\n%*s", 29, ""); |
1943 | | DEBUG(" %08x", image->strip[ch].up3[idx].data[jdx]); |
1944 | | } |
1945 | | DEBUG("\n"); |
1946 | | } |
1947 | | #endif |
1948 | |
|
1949 | 0 | if(SOURCE_CLR_FMT(image) == JXR_OCF_YUV420 || SOURCE_CLR_FMT(image) == JXR_OCF_YUV422 || SOURCE_CLR_FMT(image) == JXR_OCF_YUV444 || SOURCE_CLR_FMT(image) == JXR_OCF_CMYKDIRECT) |
1950 | 0 | { |
1951 | 0 | bSkipColorTransform = 1; |
1952 | 0 | } |
1953 | | |
1954 | | /* Perform transform in place, if needed. */ |
1955 | | /* For YCC output, no color transform is needed */ |
1956 | 0 | if(!bSkipColorTransform) |
1957 | 0 | { |
1958 | 0 | switch (image->use_clr_fmt ) { |
1959 | | |
1960 | 0 | case 1: /* YUV420 */ |
1961 | 0 | yuv420_to_yuv444(image, use_my, idx); |
1962 | 0 | yuv444_to_rgb(image, idx); |
1963 | 0 | break; |
1964 | | |
1965 | 0 | case 2: /* YUV422 */ |
1966 | 0 | yuv422_to_yuv444(image, idx); |
1967 | 0 | yuv444_to_rgb(image, idx); |
1968 | 0 | break; |
1969 | | |
1970 | 0 | case 3: /* YUV444 */ |
1971 | 0 | yuv444_to_rgb(image, idx); |
1972 | 0 | break; |
1973 | | |
1974 | 0 | case 4: /* CMYK */ |
1975 | 0 | yuvk_to_cmyk(image, idx); |
1976 | 0 | break; |
1977 | 0 | } |
1978 | 0 | } |
1979 | | |
1980 | | /* The strip data is now in the output color space. */ |
1981 | | |
1982 | | /* AddBias and ComputeScaling */ |
1983 | 0 | if (image->use_clr_fmt == 4 && SOURCE_CLR_FMT(image) != JXR_OCF_CMYKDIRECT/*CMYK*/) { |
1984 | | /* The CMYK format has a different and unique set |
1985 | | of bias/rounding calculations. Treat it as a |
1986 | | special case. And treat the K plane even more |
1987 | | special. */ |
1988 | 0 | int*dp; |
1989 | 0 | int jdx; |
1990 | 0 | for (ch = 0 ; ch < 3 ; ch += 1) { |
1991 | 0 | dp = image->strip[ch].up3[idx].data; |
1992 | 0 | for (jdx = 0 ; jdx < 256 ; jdx += 1) { |
1993 | 0 | dp[jdx] = (dp[jdx] + ((bias>>(shift_bits+1))<<scale) + round) >> scale; |
1994 | 0 | dp[jdx] <<= shift_bits; |
1995 | 0 | if (dp[jdx] > clip_hig) |
1996 | 0 | dp[jdx] = clip_hig; |
1997 | 0 | if (dp[jdx] < clip_low) |
1998 | 0 | dp[jdx] = clip_low; |
1999 | 0 | } |
2000 | 0 | } |
2001 | 0 | dp = image->strip[3].up3[idx].data; |
2002 | 0 | for (jdx = 0 ; jdx < 256 ; jdx += 1) { |
2003 | 0 | dp[jdx] = (dp[jdx] - ((bias>>(shift_bits+1))<<scale) + round) >> scale; |
2004 | 0 | dp[jdx] <<= shift_bits; |
2005 | 0 | if (dp[jdx] > clip_hig) |
2006 | 0 | dp[jdx] = clip_hig; |
2007 | 0 | if (dp[jdx] < clip_low) |
2008 | 0 | dp[jdx] = clip_low; |
2009 | 0 | } |
2010 | 0 | } |
2011 | 0 | else |
2012 | 0 | { |
2013 | 0 | for (ch = 0 ; ch < image->num_channels ; ch += 1) { |
2014 | | /* PostScalingInt and clip, 16s and 32s */ |
2015 | 0 | if( SOURCE_BITDEPTH(image)!= JXR_BD565 && SOURCE_BITDEPTH(image) != JXR_BD16F && SOURCE_BITDEPTH(image) != JXR_BD32F && SOURCE_CLR_FMT(image) != JXR_OCF_RGBE) |
2016 | 0 | { |
2017 | 0 | int*dp = image->strip[ch].up3[idx].data; |
2018 | 0 | int jdx; |
2019 | 0 | for (jdx = 0 ; jdx < 256 ; jdx += 1) { |
2020 | 0 | dp[jdx] = (dp[jdx] + ((bias>>shift_bits)<<scale) + round) >> scale; |
2021 | 0 | dp[jdx] <<= shift_bits; |
2022 | 0 | if (dp[jdx] > clip_hig) |
2023 | 0 | dp[jdx] = clip_hig; |
2024 | 0 | if (dp[jdx] < clip_low) |
2025 | 0 | dp[jdx] = clip_low; |
2026 | 0 | } |
2027 | | #if defined(DETAILED_DEBUG) && 0 |
2028 | | DEBUG("scale_and_emit: block at mx=%d, my=%d, ch=%d:", idx, use_my-3, ch); |
2029 | | for (jdx = 0 ; jdx < 256 ; jdx += 1) { |
2030 | | if (jdx%8 == 0 && jdx > 0) |
2031 | | DEBUG("\n%*s:", 41, ""); |
2032 | | DEBUG(" %04x", dp[jdx]); |
2033 | | } |
2034 | | DEBUG("\n"); |
2035 | | #endif |
2036 | 0 | } |
2037 | 0 | else if(SOURCE_BITDEPTH(image) == JXR_BD565) |
2038 | 0 | { |
2039 | | /* Special case where R and B have different clip thresholds from G */ |
2040 | 0 | int*dp = image->strip[ch].up3[idx].data; |
2041 | 0 | int jdx; |
2042 | 0 | assert(image->num_channels == 3); |
2043 | 0 | if(ch != 1) |
2044 | 0 | { |
2045 | 0 | clip_hig = 31; |
2046 | 0 | clip_low = 0; |
2047 | 0 | } |
2048 | 0 | else |
2049 | 0 | { |
2050 | 0 | clip_hig = 63; |
2051 | 0 | clip_low = 0; |
2052 | 0 | } |
2053 | 0 | for (jdx = 0 ; jdx < 256 ; jdx += 1) { |
2054 | 0 | if(ch == 1) |
2055 | 0 | dp[jdx] = (dp[jdx] + ((bias)<<scale) + round) >> scale; |
2056 | 0 | else |
2057 | 0 | dp[jdx] = (dp[jdx] + ((bias)<<scale) + round) >> (scale + 1); |
2058 | 0 | if (dp[jdx] > clip_hig) |
2059 | 0 | dp[jdx] = clip_hig; |
2060 | 0 | if (dp[jdx] < clip_low) |
2061 | 0 | dp[jdx] = clip_low; |
2062 | 0 | } |
2063 | 0 | } |
2064 | | |
2065 | | /* PostScalingFl */ |
2066 | 0 | else |
2067 | 0 | { |
2068 | 0 | int* dp = image->strip[ch].up3[idx].data; |
2069 | 0 | int jdx; |
2070 | 0 | if(SOURCE_BITDEPTH(image) == JXR_BD16F || SOURCE_BITDEPTH(image) == JXR_BD32F) |
2071 | 0 | { |
2072 | 0 | for (jdx = 0 ; jdx < 256 ; jdx += 1) { |
2073 | 0 | dp[jdx] = (dp[jdx] + round) >> scale; |
2074 | 0 | dp[jdx] = PostScalingFloat(dp[jdx], image->exp_bias, image->len_mantissa, SOURCE_BITDEPTH(image)); |
2075 | 0 | } |
2076 | 0 | } |
2077 | 0 | else /* RGBE : PostScalingFl2 requires one extra sample per pixel - Write directly into buffer */ |
2078 | 0 | { |
2079 | 0 | int *dp0 = image->strip[0].up3[idx].data; |
2080 | 0 | int *dp1 = image->strip[1].up3[idx].data; |
2081 | 0 | int *dp2 = image->strip[2].up3[idx].data; |
2082 | 0 | assert(image->num_channels == 3); |
2083 | 0 | assert(ch == 0); |
2084 | |
|
2085 | 0 | for (jdx = 0 ; jdx < 256 ; jdx += 1) { |
2086 | | /* There is no bias in this case */ |
2087 | 0 | int idp0 = (dp0[jdx] + round) >> scale; |
2088 | 0 | int idp1 = (dp1[jdx] + round) >> scale; |
2089 | 0 | int idp2 = (dp2[jdx] + round) >> scale; |
2090 | | |
2091 | 0 | int arrIn[3] = {idp0, idp1, idp2}; |
2092 | | |
2093 | 0 | PostScalingFl2(buffer + (image->num_channels + 1) * jdx, arrIn); |
2094 | 0 | ch = 3;/* We have taken care of all channels in one go */ |
2095 | 0 | } |
2096 | |
|
2097 | 0 | } |
2098 | | |
2099 | | |
2100 | | |
2101 | | #if defined(DETAILED_DEBUG) && 0 |
2102 | | DEBUG("scale_and_emit: block at mx=%d, my=%d, ch=%d:", idx, use_my-3, ch); |
2103 | | for (jdx = 0 ; jdx < 256 ; jdx += 1) { |
2104 | | if (jdx%8 == 0 && jdx > 0) |
2105 | | DEBUG("\n%*s:", 41, ""); |
2106 | | DEBUG(" %04x", dp[jdx]); |
2107 | | } |
2108 | | DEBUG("\n"); |
2109 | | #endif |
2110 | 0 | } |
2111 | 0 | } |
2112 | 0 | } |
2113 | |
|
2114 | 0 | if ( image->primary == 1 ) { /* alpha channel output is combined with primary channel */ |
2115 | 0 | int px; |
2116 | 0 | int channels = image->num_channels; |
2117 | | |
2118 | 0 | if(!bSkipColorTransform) /* Interleave channels in buffer */ |
2119 | 0 | { |
2120 | 0 | if (ALPHACHANNEL_FLAG(image)) |
2121 | 0 | channels ++; |
2122 | |
|
2123 | 0 | for (px = 0 ; px < 256 && (SOURCE_CLR_FMT(image) != JXR_OCF_RGBE) ; px += 1) /*RGBE is a special case that is already taken care of */ |
2124 | 0 | for (ch = 0 ; ch < image->num_channels ; ch += 1) |
2125 | 0 | buffer[channels*px + ch] = image->strip[ch].up3[idx].data[px]; |
2126 | |
|
2127 | 0 | if (ALPHACHANNEL_FLAG(image)) |
2128 | 0 | for (px = 0 ; px < 256 ; px += 1) |
2129 | 0 | buffer[channels*px + image->num_channels] = image->alpha->strip[0].up3[idx].data[px]; |
2130 | 0 | } |
2131 | 0 | else |
2132 | 0 | { |
2133 | 0 | int size = 256*sizeof(uint32_t); |
2134 | 0 | int i = 0; |
2135 | 0 | for(i = 0; i < image->num_channels; i ++) |
2136 | 0 | { |
2137 | 0 | memcpy(((uint8_t *)buffer + i*size), image->strip[i].up3[idx].data, size); |
2138 | |
|
2139 | 0 | } |
2140 | 0 | if(ALPHACHANNEL_FLAG(image)) |
2141 | 0 | memcpy(((uint8_t *)buffer) + image->num_channels*size, image->alpha->strip[0].up3[idx].data, size); |
2142 | 0 | } |
2143 | | |
2144 | |
|
2145 | 0 | _jxr_send_mb_to_output(image, idx, use_my-3, buffer); |
2146 | 0 | } |
2147 | 0 | } |
2148 | 0 | } |
2149 | | |
2150 | | /* |
2151 | | * The tile_row_buffer holds flushed mb data in image raster order, |
2152 | | * along with other per-mb data. This is in support of SPATIAL processing. |
2153 | | */ |
2154 | | static void rflush_to_tile_buffer(jxr_image_t image, int tx, int my) |
2155 | 0 | { |
2156 | 0 | int format_scale = 256; |
2157 | 0 | int mx; |
2158 | 0 | DEBUG("rflush_mb_strip: rflush_to_tile_buffer tx=%d, my=%d\n", tx, my); |
2159 | |
|
2160 | 0 | if (image->use_clr_fmt == 2 /* YUV422 */) { |
2161 | 0 | format_scale = 16 + 8*15; |
2162 | 0 | } else if (image->use_clr_fmt == 1 /* YUV420 */) { |
2163 | 0 | format_scale = 16 + 4*15; |
2164 | 0 | } |
2165 | |
|
2166 | 0 | for (mx = 0 ; mx < (int) image->tile_column_width[tx] ; mx += 1) { |
2167 | 0 | int off; |
2168 | 0 | int ch; |
2169 | 0 | DEBUG("rflush_mb_strip: rflush_to_tile_buffer tx=%d, mx=%d, CUR=0x%08x UP1=0x%08x, UP2=0x%08x, UP3=0x%08x, LP_QUANT=%d\n", |
2170 | 0 | tx, mx, MACROBLK_CUR(image,0,tx,mx).data[0], |
2171 | 0 | MACROBLK_UP1(image,0,tx,mx).data[0], |
2172 | 0 | MACROBLK_UP2(image,0,tx,mx).data[0], |
2173 | 0 | MACROBLK_UP3(image,0,tx,mx).data[0], |
2174 | 0 | MACROBLK_CUR_LP_QUANT(image,0,tx,mx)); |
2175 | |
|
2176 | 0 | off = my * EXTENDED_WIDTH_BLOCKS(image) + image->tile_column_position[tx] + mx; |
2177 | 0 | for (ch = 0; ch < image->num_channels; ch += 1) { |
2178 | 0 | int count; |
2179 | 0 | int idx; |
2180 | 0 | struct macroblock_s*mb = image->mb_row_buffer[ch] + off; |
2181 | 0 | mb->lp_quant = MACROBLK_CUR_LP_QUANT(image,ch,tx,mx); |
2182 | 0 | mb->hp_quant = MACROBLK_CUR(image,ch,tx,mx).hp_quant; |
2183 | 0 | count = (ch==0)? 256 : format_scale; |
2184 | 0 | for (idx = 0 ; idx < count ; idx += 1) |
2185 | 0 | mb->data[idx] = MACROBLK_CUR(image,ch,tx,mx).data[idx]; |
2186 | 0 | } |
2187 | 0 | } |
2188 | 0 | } |
2189 | | |
2190 | | /* |
2191 | | * Recover a strip of data from all but the last column of data. Skip |
2192 | | * the last column because this function is called while the last |
2193 | | * column is being processed. |
2194 | | */ |
2195 | | static void rflush_collect_mb_strip_data(jxr_image_t image, int my) |
2196 | 0 | { |
2197 | 0 | int format_scale = 256; |
2198 | 0 | int tx; |
2199 | |
|
2200 | 0 | DEBUG("rflush_mb_strip: rflush_collect_mb_strip_data my=%d\n", my); |
2201 | |
|
2202 | 0 | if (image->use_clr_fmt == 2 /* YUV422 */) { |
2203 | 0 | format_scale = 16 + 8*15; |
2204 | 0 | } else if (image->use_clr_fmt == 1 /* YUV420 */) { |
2205 | 0 | format_scale = 16 + 4*15; |
2206 | 0 | } |
2207 | |
|
2208 | 0 | for (tx = 0; tx < (int) image->tile_columns-1 ; tx += 1) { |
2209 | 0 | int mx; |
2210 | 0 | for (mx = 0; mx < (int) image->tile_column_width[tx]; mx += 1) { |
2211 | 0 | int off = my * EXTENDED_WIDTH_BLOCKS(image) + image->tile_column_position[tx] + mx; |
2212 | 0 | int ch; |
2213 | 0 | for (ch = 0; ch < image->num_channels; ch += 1) { |
2214 | 0 | struct macroblock_s*mb = image->mb_row_buffer[ch] + off; |
2215 | 0 | int count; |
2216 | 0 | int idx; |
2217 | 0 | MACROBLK_CUR_LP_QUANT(image,ch,tx,mx) = mb->lp_quant; |
2218 | 0 | MACROBLK_CUR(image,ch,tx,mx).hp_quant = mb->hp_quant; |
2219 | 0 | count = (ch==0)? 256 : format_scale; |
2220 | 0 | for (idx = 0 ; idx < count; idx += 1) |
2221 | 0 | MACROBLK_CUR(image,ch,tx,mx).data[idx] = mb->data[idx]; |
2222 | 0 | } |
2223 | 0 | DEBUG("rflush_mb_strip: rflush_collect_mb_strip_data tx=%d, mx=%d, CUR=0x%08x UP1=0x%08x, UP2=0x%08x, UP3=0x%08x lp_quant=%d\n", |
2224 | 0 | tx, mx, MACROBLK_CUR(image,0,tx,mx).data[0], |
2225 | 0 | MACROBLK_UP1(image,0,tx,mx).data[0], |
2226 | 0 | MACROBLK_UP2(image,0,tx,mx).data[0], |
2227 | 0 | MACROBLK_UP3(image,0,tx,mx).data[0], |
2228 | 0 | MACROBLK_CUR_LP_QUANT(image,0,tx,mx)); |
2229 | 0 | } |
2230 | 0 | } |
2231 | 0 | } |
2232 | | |
2233 | | /* |
2234 | | * The save_ and recover_context functions save the 3 strips of data |
2235 | | * currently in the strip buffer. This is used at the end of a tile |
2236 | | * row and beginning of the next tile row to save context while |
2237 | | * columns of tiles are collected, and restore it when processing the |
2238 | | * last tile column. |
2239 | | */ |
2240 | | static void rflush_save_context(jxr_image_t image) |
2241 | 0 | { |
2242 | 0 | int format_scale = 256; |
2243 | 0 | int tx; |
2244 | 0 | DEBUG("rflush_mb_strip: rflush_save_context\n"); |
2245 | |
|
2246 | 0 | if (image->use_clr_fmt == 2 /* YUV422 */) { |
2247 | 0 | format_scale = 16 + 8*15; |
2248 | 0 | } else if (image->use_clr_fmt == 1 /* YUV420 */) { |
2249 | 0 | format_scale = 16 + 4*15; |
2250 | 0 | } |
2251 | |
|
2252 | 0 | for (tx = 0; tx < (int) image->tile_columns ; tx += 1) { |
2253 | 0 | int mx; |
2254 | 0 | for (mx = 0; mx < (int) image->tile_column_width[tx]; mx += 1) { |
2255 | 0 | int off0 = image->tile_column_position[tx] + mx; |
2256 | 0 | int off1 = off0 + EXTENDED_WIDTH_BLOCKS(image); |
2257 | 0 | int off2 = off1 + EXTENDED_WIDTH_BLOCKS(image); |
2258 | 0 | int off3 = off2 + EXTENDED_WIDTH_BLOCKS(image); |
2259 | 0 | int ch; |
2260 | 0 | DEBUG("rflush_mb_strip: rflush_save_context tx=%d, mx=%d, CUR=0x%08x UP1=0x%08x, UP2=0x%08x, UP3=0x%08x\n", |
2261 | 0 | tx, mx, MACROBLK_CUR(image,0,tx,mx).data[0], |
2262 | 0 | MACROBLK_UP1(image,0,tx,mx).data[0], |
2263 | 0 | MACROBLK_UP2(image,0,tx,mx).data[0], |
2264 | 0 | MACROBLK_UP3(image,0,tx,mx).data[0]); |
2265 | 0 | for (ch = 0; ch < image->num_channels; ch += 1) { |
2266 | 0 | int count; |
2267 | 0 | int idx; |
2268 | |
|
2269 | 0 | image->mb_row_context[ch][off0].lp_quant = MACROBLK_CUR_LP_QUANT(image,ch,tx,mx); |
2270 | 0 | image->mb_row_context[ch][off1].lp_quant = MACROBLK_UP1_LP_QUANT(image,ch,tx,mx); |
2271 | 0 | image->mb_row_context[ch][off2].lp_quant = MACROBLK_UP2(image,ch,tx,mx).lp_quant; |
2272 | 0 | image->mb_row_context[ch][off3].lp_quant = MACROBLK_UP3(image,ch,tx,mx).lp_quant; |
2273 | 0 | image->mb_row_context[ch][off0].hp_quant = MACROBLK_CUR(image,ch,tx,mx).hp_quant; |
2274 | 0 | image->mb_row_context[ch][off1].hp_quant = MACROBLK_UP1(image,ch,tx,mx).hp_quant; |
2275 | 0 | image->mb_row_context[ch][off2].hp_quant = MACROBLK_UP2(image,ch,tx,mx).hp_quant; |
2276 | 0 | image->mb_row_context[ch][off3].hp_quant = MACROBLK_UP3(image,ch,tx,mx).hp_quant; |
2277 | 0 | count = (ch==0)? 256 : format_scale; |
2278 | 0 | for (idx = 0 ; idx < count; idx += 1) |
2279 | 0 | image->mb_row_context[ch][off0].data[idx] = MACROBLK_CUR(image,ch,tx,mx).data[idx]; |
2280 | 0 | for (idx = 0 ; idx < count; idx += 1) |
2281 | 0 | image->mb_row_context[ch][off1].data[idx] = MACROBLK_UP1(image,ch,tx,mx).data[idx]; |
2282 | 0 | for (idx = 0 ; idx < count; idx += 1) |
2283 | 0 | image->mb_row_context[ch][off2].data[idx] = MACROBLK_UP2(image,ch,tx,mx).data[idx]; |
2284 | 0 | for (idx = 0 ; idx < count; idx += 1) |
2285 | 0 | image->mb_row_context[ch][off3].data[idx] = MACROBLK_UP3(image,ch,tx,mx).data[idx]; |
2286 | 0 | } |
2287 | 0 | } |
2288 | 0 | } |
2289 | 0 | } |
2290 | | |
2291 | | static void rflush_recover_context(jxr_image_t image) |
2292 | 0 | { |
2293 | |
|
2294 | 0 | int format_scale = 256; |
2295 | 0 | int tx; |
2296 | 0 | DEBUG("rflush_mb_strip: recover contex\n"); |
2297 | 0 | if (image->use_clr_fmt == 2 /* YUV422 */) { |
2298 | 0 | format_scale = 16 + 8*15; |
2299 | 0 | } else if (image->use_clr_fmt == 1 /* YUV420 */) { |
2300 | 0 | format_scale = 16 + 4*15; |
2301 | 0 | } |
2302 | |
|
2303 | 0 | for (tx = 0; tx < (int) image->tile_columns ; tx += 1) { |
2304 | 0 | int mx; |
2305 | 0 | for (mx = 0; mx < (int) image->tile_column_width[tx]; mx += 1) { |
2306 | 0 | int off0 = image->tile_column_position[tx] + mx; |
2307 | 0 | int off1 = off0 + EXTENDED_WIDTH_BLOCKS(image); |
2308 | 0 | int off2 = off1 + EXTENDED_WIDTH_BLOCKS(image); |
2309 | 0 | int off3 = off2 + EXTENDED_WIDTH_BLOCKS(image); |
2310 | 0 | int ch; |
2311 | 0 | for (ch = 0; ch < image->num_channels; ch += 1) { |
2312 | 0 | int count; |
2313 | 0 | int idx; |
2314 | 0 | MACROBLK_CUR_LP_QUANT(image,ch,tx,mx) = image->mb_row_context[ch][off0].lp_quant; |
2315 | 0 | MACROBLK_UP1_LP_QUANT(image,ch,tx,mx) = image->mb_row_context[ch][off1].lp_quant; |
2316 | 0 | MACROBLK_UP2(image,ch,tx,mx).lp_quant = image->mb_row_context[ch][off2].lp_quant; |
2317 | 0 | MACROBLK_UP3(image,ch,tx,mx).lp_quant = image->mb_row_context[ch][off3].lp_quant; |
2318 | 0 | MACROBLK_CUR(image,ch,tx,mx).hp_quant = image->mb_row_context[ch][off0].hp_quant; |
2319 | 0 | MACROBLK_UP1(image,ch,tx,mx).hp_quant = image->mb_row_context[ch][off1].hp_quant; |
2320 | 0 | MACROBLK_UP2(image,ch,tx,mx).hp_quant = image->mb_row_context[ch][off2].hp_quant; |
2321 | 0 | MACROBLK_UP3(image,ch,tx,mx).hp_quant = image->mb_row_context[ch][off3].hp_quant; |
2322 | 0 | count = (ch==0)? 256 : format_scale; |
2323 | 0 | for (idx = 0 ; idx < count; idx += 1) |
2324 | 0 | MACROBLK_CUR(image,ch,tx,mx).data[idx] = image->mb_row_context[ch][off0].data[idx]; |
2325 | 0 | for (idx = 0 ; idx < count; idx += 1) |
2326 | 0 | MACROBLK_UP1(image,ch,tx,mx).data[idx] = image->mb_row_context[ch][off1].data[idx]; |
2327 | 0 | for (idx = 0 ; idx < count; idx += 1) |
2328 | 0 | MACROBLK_UP2(image,ch,tx,mx).data[idx] = image->mb_row_context[ch][off2].data[idx]; |
2329 | 0 | for (idx = 0 ; idx < count; idx += 1) |
2330 | 0 | MACROBLK_UP3(image,ch,tx,mx).data[idx] = image->mb_row_context[ch][off3].data[idx]; |
2331 | 0 | } |
2332 | 0 | } |
2333 | 0 | } |
2334 | 0 | } |
2335 | | |
2336 | | |
2337 | | /* |
2338 | | * When the parser calls this function, the current strip is done |
2339 | | * being parsed, so it no longer needs the previous strip. Complete |
2340 | | * the processing of the previous ("up") strip and arrange for it to |
2341 | | * be delivered to the applications. Then shuffle the current strip to |
2342 | | * the "up" position for the next round. |
2343 | | * |
2344 | | * cur_my is the number of the current line. If this is -1, then there |
2345 | | * are no lines complete yet and this function is being called to get |
2346 | | * things started. |
2347 | | */ |
2348 | | void _jxr_rflush_mb_strip(jxr_image_t image, int tx, int ty, int my) |
2349 | 0 | { |
2350 | | /* This is the position within the image of the current |
2351 | | line. It accounts for the current tile row. */ |
2352 | 0 | const int use_my = my + (ty>=0? image->tile_row_position[ty] : 0) - 1; |
2353 | |
|
2354 | 0 | DEBUG("rflush_mb_strip: cur_my=%d, tile-x/y=%d/%d, my=%d, use_my=%d\n", image->cur_my, tx, ty, my, use_my); |
2355 | |
|
2356 | 0 | if (image->tile_columns > 1 && tx >= 0) { |
2357 | 0 | if (tx+1 < (int) image->tile_columns) { |
2358 | | /* We're actually working on a tile, and this is |
2359 | | not the last tile in the row. Deliver the data |
2360 | | to the correct tile buffer and return. */ |
2361 | |
|
2362 | 0 | if (my == 0 && image->cur_my >= 0) { |
2363 | | /* starting a new tile, dump previous */ |
2364 | |
|
2365 | 0 | if (tx == 0 && ty > 0) { |
2366 | | /* First column of a row */ |
2367 | | /* Complete last line of previous row */ |
2368 | 0 | rflush_collect_mb_strip_data(image, image->cur_my); |
2369 | | /* Save previous strip context */ |
2370 | 0 | rflush_save_context(image); |
2371 | | /* Flush last column of previous row. */ |
2372 | 0 | rflush_to_tile_buffer(image, image->tile_columns-1, image->cur_my); |
2373 | 0 | } else if (tx > 0) { |
2374 | | /* Column within a row, dump previous column */ |
2375 | 0 | rflush_to_tile_buffer(image, tx-1, image->cur_my); |
2376 | 0 | } |
2377 | |
|
2378 | 0 | } else if (image->cur_my >= 0) { |
2379 | 0 | rflush_to_tile_buffer(image, tx, image->cur_my); |
2380 | 0 | } |
2381 | 0 | image->cur_my = my; |
2382 | 0 | _jxr_r_rotate_mb_strip(image); |
2383 | 0 | return; |
2384 | |
|
2385 | 0 | } else { |
2386 | | /* We are tiling, and this is the last tile of the |
2387 | | row, so collect rows from the left tiles to |
2388 | | finish the row, and proceed to processing. */ |
2389 | 0 | if (my == 0) { |
2390 | | /* Starting last tile of row */ |
2391 | | /* Flush end of previous tile */ |
2392 | 0 | rflush_to_tile_buffer(image, tx-1, image->cur_my); |
2393 | 0 | image->cur_my = -1; |
2394 | | /* Recover previous strip context */ |
2395 | 0 | if (ty > 0) { |
2396 | 0 | rflush_recover_context(image); |
2397 | 0 | } |
2398 | 0 | } else if (my <= (int) image->tile_row_height[ty]) { |
2399 | 0 | rflush_collect_mb_strip_data(image, image->cur_my); |
2400 | 0 | } |
2401 | 0 | } |
2402 | 0 | } |
2403 | | |
2404 | | |
2405 | 0 | if (use_my >= 1) { |
2406 | 0 | int ch; |
2407 | | |
2408 | | /* Dequantize the PREVIOUS strip of macroblocks DC and LP. */ |
2409 | | |
2410 | | /* Reverse transform the DC/LP to 16 DC values. */ |
2411 | |
|
2412 | 0 | for (ch = 0 ; ch < image->num_channels ; ch += 1) |
2413 | 0 | IPCT_level1_up1(image, use_my, ch); |
2414 | |
|
2415 | 0 | if (use_my >= 2) { |
2416 | 0 | if (OVERLAP_INFO(image) >= 2) |
2417 | 0 | for (ch = 0 ; ch < image->num_channels ; ch += 1) |
2418 | 0 | overlap_level1_up2(image, use_my, ch); |
2419 | | |
2420 | | /* Do the second level IPCT transform to include HP values. */ |
2421 | 0 | for (ch = 0 ; ch < image->num_channels ; ch += 1) |
2422 | 0 | IPCT_level2_up2(image,use_my, ch); |
2423 | |
|
2424 | 0 | if (use_my >= 3) { |
2425 | | |
2426 | | /* Do the second level post filter */ |
2427 | 0 | if (OVERLAP_INFO(image) >= 1) |
2428 | 0 | for (ch = 0 ; ch < image->num_channels ; ch += 1) |
2429 | 0 | overlap_level2_up3(image, use_my, ch); |
2430 | | |
2431 | | /* The reverse transformation is complete for the |
2432 | | PREVIOUS strip, so perform the "Output Formatting" |
2433 | | and deliver the data for the application. */ |
2434 | |
|
2435 | 0 | scale_and_emit_top(image, tx, use_my); |
2436 | 0 | } |
2437 | 0 | } |
2438 | | |
2439 | | /* read lwf test flag into image container */ |
2440 | 0 | if (image->lwf_test == 0) |
2441 | 0 | image->lwf_test = _jxr_read_lwf_test_flag(); |
2442 | |
|
2443 | 0 | } |
2444 | | |
2445 | | /* Now completely done with strip_up. Rotate the storage to |
2446 | | strip_down. */ |
2447 | 0 | image->cur_my = my; |
2448 | |
|
2449 | 0 | _jxr_r_rotate_mb_strip(image); |
2450 | 0 | } |
2451 | | |
2452 | | /* |
2453 | | * The input to this function is 256 samples arranged like this: |
2454 | | * |
2455 | | * DC..DC (16 DC values) HP..HP (240 HP values) |
2456 | | * |
2457 | | * Shuffle the values so that there is 1 DC, then 15 HP, and so on 16 |
2458 | | * times. This prepares the array for 16 calls to the 4x4IPCT transform. |
2459 | | */ |
2460 | | static void dclphp_shuffle(int*data, int dclp_count) |
2461 | 0 | { |
2462 | 0 | int tmp[256]; |
2463 | 0 | int dc, hp, dst; |
2464 | 0 | assert(dclp_count <= 16); |
2465 | |
|
2466 | 0 | for (dc=0, hp=16, dst=0; dc<dclp_count ; ) { |
2467 | 0 | int idx; |
2468 | 0 | tmp[dst++] = data[dc++]; |
2469 | 0 | for (idx = 0 ; idx < 15 ; idx += 1) |
2470 | 0 | tmp[dst++] = data[hp++]; |
2471 | 0 | } |
2472 | |
|
2473 | 0 | assert(dst == 16*dclp_count); |
2474 | 0 | assert(dc == dclp_count); |
2475 | 0 | assert(hp == 16+15*dclp_count); |
2476 | |
|
2477 | 0 | for (dst = 0 ; dst<256 ; dst+=1) |
2478 | 0 | data[dst] = tmp[dst]; |
2479 | 0 | } |
2480 | | |
2481 | | /* |
2482 | | * The input to this function is 256 intensities arranged as blocks, |
2483 | | * with each 4x4 block in raster order is together, i.e. |
2484 | | * |
2485 | | * 00..0011..1122..22... |
2486 | | * |
2487 | | * It reorders the values into a raster order that is not blocked: |
2488 | | * |
2489 | | * 0000111122223333 |
2490 | | * 0000111122223333 |
2491 | | * 0000111122223333, etc. |
2492 | | */ |
2493 | | static void unblock_shuffle444(int*data) |
2494 | 0 | { |
2495 | 0 | int tmp[256]; |
2496 | |
|
2497 | 0 | int idx; |
2498 | 0 | for (idx = 0 ; idx < 256 ; idx += 4) { |
2499 | 0 | int blk = idx/16; |
2500 | 0 | int mbx = blk%4; |
2501 | 0 | int mby = blk/4; |
2502 | 0 | int pix = idx%16; |
2503 | 0 | int py = pix/4; |
2504 | |
|
2505 | 0 | int ptr = 16*4*mby + 4*mbx + 16*py; |
2506 | 0 | tmp[ptr+0] = data[idx+0]; |
2507 | 0 | tmp[ptr+1] = data[idx+1]; |
2508 | 0 | tmp[ptr+2] = data[idx+2]; |
2509 | 0 | tmp[ptr+3] = data[idx+3]; |
2510 | 0 | } |
2511 | |
|
2512 | 0 | for (idx = 0 ; idx < 256 ; idx += 1) |
2513 | 0 | data[idx] = tmp[idx]; |
2514 | 0 | } |
2515 | | |
2516 | | /* |
2517 | | * 0 1 2 3 16 17 18 19 |
2518 | | * 4 5 6 7 20 21 22 23 |
2519 | | * 8 9 10 11 24 25 26 27 |
2520 | | * 12 13 14 15 28 29 30 31 |
2521 | | * 32 33 34 35 48 49 50 51 |
2522 | | * 36 37 38 39 52 53 54 55 |
2523 | | * 40 41 42 43 56 57 58 59 |
2524 | | * 44 45 46 47 60 61 62 63 ... |
2525 | | */ |
2526 | | static void unblock_shuffle422(int*data) |
2527 | 0 | { |
2528 | 0 | int tmp[128]; |
2529 | |
|
2530 | 0 | int idx; |
2531 | 0 | for (idx = 0 ; idx < 128 ; idx += 4) { |
2532 | 0 | int blk = idx/16; |
2533 | 0 | int mbx = blk%2; |
2534 | 0 | int mby = blk/2; |
2535 | 0 | int pix = idx%16; |
2536 | 0 | int py = pix/4; |
2537 | |
|
2538 | 0 | int ptr = 16*2*mby + 4*mbx + 8*py; |
2539 | 0 | tmp[ptr+0] = data[idx+0]; |
2540 | 0 | tmp[ptr+1] = data[idx+1]; |
2541 | 0 | tmp[ptr+2] = data[idx+2]; |
2542 | 0 | tmp[ptr+3] = data[idx+3]; |
2543 | 0 | } |
2544 | |
|
2545 | 0 | for (idx = 0 ; idx < 128 ; idx += 1) |
2546 | 0 | data[idx] = tmp[idx]; |
2547 | 0 | } |
2548 | | |
2549 | | /* |
2550 | | * 0 1 2 3 16 17 18 19 |
2551 | | * 4 5 6 7 20 21 22 23 |
2552 | | * 8 9 10 11 24 25 26 27 |
2553 | | * 12 13 14 15 28 29 30 31 |
2554 | | * 32 33 34 35 48 49 50 51 |
2555 | | * 36 37 38 39 52 53 54 55 |
2556 | | * 40 41 42 43 56 57 58 59 |
2557 | | * 44 45 46 47 60 61 62 63 |
2558 | | */ |
2559 | | static void unblock_shuffle420(int*data) |
2560 | 0 | { |
2561 | 0 | int tmp[64]; |
2562 | |
|
2563 | 0 | int idx; |
2564 | 0 | for (idx = 0 ; idx < 64 ; idx += 4) { |
2565 | 0 | int blk = idx/16; |
2566 | 0 | int mbx = blk%2; |
2567 | 0 | int mby = blk/2; |
2568 | 0 | int pix = idx%16; |
2569 | 0 | int py = pix/4; |
2570 | |
|
2571 | 0 | int ptr = 16*2*mby + 4*mbx + 8*py; |
2572 | 0 | tmp[ptr+0] = data[idx+0]; |
2573 | 0 | tmp[ptr+1] = data[idx+1]; |
2574 | 0 | tmp[ptr+2] = data[idx+2]; |
2575 | 0 | tmp[ptr+3] = data[idx+3]; |
2576 | 0 | } |
2577 | |
|
2578 | 0 | for (idx = 0 ; idx < 64 ; idx += 1) |
2579 | 0 | data[idx] = tmp[idx]; |
2580 | 0 | } |
2581 | | |
2582 | | void _jxr_r_rotate_mb_strip(jxr_image_t image) |
2583 | 0 | { |
2584 | 0 | if(image->primary) { |
2585 | 0 | int ch; |
2586 | |
|
2587 | 0 | for (ch = 0 ; ch < image->num_channels ; ch += 1) { |
2588 | 0 | struct macroblock_s*tmp = image->strip[ch].up3; |
2589 | 0 | image->strip[ch].up3 = image->strip[ch].up2; |
2590 | 0 | image->strip[ch].up2 = image->strip[ch].up1; |
2591 | 0 | image->strip[ch].up1 = image->strip[ch].cur; |
2592 | 0 | image->strip[ch].cur = tmp; |
2593 | 0 | } |
2594 | | |
2595 | 0 | _jxr_clear_strip_cur(image); |
2596 | |
|
2597 | 0 | if (ALPHACHANNEL_FLAG(image)) { |
2598 | 0 | struct macroblock_s*tmp = image->alpha->strip[0].up3; |
2599 | 0 | image->alpha->strip[0].up3 = image->alpha->strip[0].up2; |
2600 | 0 | image->alpha->strip[0].up2 = image->alpha->strip[0].up1; |
2601 | 0 | image->alpha->strip[0].up1 = image->alpha->strip[0].cur; |
2602 | 0 | image->alpha->strip[0].cur = tmp; |
2603 | 0 | _jxr_clear_strip_cur(image->alpha); |
2604 | 0 | } |
2605 | 0 | } |
2606 | 0 | } |
2607 | | |
2608 | | |
2609 | | /* |
2610 | | * $Log: r_strip.c,v $ |
2611 | | * Revision 1.53 2009/05/29 12:00:00 microsoft |
2612 | | * Reference Software v1.6 updates. |
2613 | | * |
2614 | | * Revision 1.52 2009/04/13 12:00:00 microsoft |
2615 | | * Reference Software v1.5 updates. |
2616 | | * |
2617 | | * Revision 1.51 2008/03/24 18:06:56 steve |
2618 | | * Imrpove DEBUG messages around quantization. |
2619 | | * |
2620 | | * Revision 1.50 2008/03/20 22:38:53 steve |
2621 | | * Use MB HPQP instead of first HPQP in decode. |
2622 | | * |
2623 | | * Revision 1.49 2008/03/18 21:09:11 steve |
2624 | | * Fix distributed color prediction. |
2625 | | * |
2626 | | * Revision 1.48 2008/03/17 23:48:12 steve |
2627 | | * Bias and Scaling for CMYK |
2628 | | * |
2629 | | * Revision 1.47 2008/03/17 21:48:56 steve |
2630 | | * CMYK decode support |
2631 | | * |
2632 | | * Revision 1.46 2008/03/14 17:08:51 gus |
2633 | | * *** empty log message *** |
2634 | | * |
2635 | | * Revision 1.45 2008/03/13 17:49:31 steve |
2636 | | * Fix problem with YUV422 CBP prediction for UV planes |
2637 | | * |
2638 | | * Add support for YUV420 encoding. |
2639 | | * |
2640 | | * Revision 1.44 2008/03/11 22:12:49 steve |
2641 | | * Encode YUV422 through DC. |
2642 | | * |
2643 | | * Revision 1.43 2008/03/05 06:58:10 gus |
2644 | | * *** empty log message *** |
2645 | | * |
2646 | | * Revision 1.42 2008/03/03 23:33:53 steve |
2647 | | * Implement SHIFT_BITS functionality. |
2648 | | * |
2649 | | * Revision 1.41 2008/03/02 18:35:27 steve |
2650 | | * Add support for BD16 |
2651 | | * |
2652 | | * Revision 1.40 2008/02/26 23:52:44 steve |
2653 | | * Remove ident for MS compilers. |
2654 | | * |
2655 | | * Revision 1.39 2008/02/01 22:49:53 steve |
2656 | | * Handle compress of YUV444 color DCONLY |
2657 | | * |
2658 | | * Revision 1.38 2008/01/08 23:23:18 steve |
2659 | | * Clean up some DEBUG messages. |
2660 | | * |
2661 | | * Revision 1.37 2008/01/04 17:07:35 steve |
2662 | | * API interface for setting QP values. |
2663 | | * |
2664 | | * Revision 1.36 2007/11/26 01:47:15 steve |
2665 | | * Add copyright notices per MS request. |
2666 | | * |
2667 | | * Revision 1.35 2007/11/22 19:02:05 steve |
2668 | | * More fixes of color plane buffer sizes. |
2669 | | * |
2670 | | * Revision 1.34 2007/11/22 02:51:04 steve |
2671 | | * Fix YUV422 strip save byte count - buffer overrun |
2672 | | * |
2673 | | * Revision 1.33 2007/11/21 23:26:14 steve |
2674 | | * make all strip buffers store MB data. |
2675 | | * |
2676 | | * Revision 1.32 2007/11/21 00:34:30 steve |
2677 | | * Rework spatial mode tile macroblock shuffling. |
2678 | | * |
2679 | | * Revision 1.31 2007/11/20 17:08:02 steve |
2680 | | * Fix SPATIAL processing of QUANT values for color. |
2681 | | * |
2682 | | * Revision 1.30 2007/11/16 21:33:48 steve |
2683 | | * Store MB Quant, not qp_index. |
2684 | | * |
2685 | | * Revision 1.29 2007/11/16 20:03:57 steve |
2686 | | * Store MB Quant, not qp_index. |
2687 | | * |
2688 | | * Revision 1.28 2007/11/12 23:21:55 steve |
2689 | | * Infrastructure for frequency mode ordering. |
2690 | | * |
2691 | | * Revision 1.27 2007/11/09 01:18:58 steve |
2692 | | * Stub strip input processing. |
2693 | | * |
2694 | | * Revision 1.26 2007/11/06 21:45:04 steve |
2695 | | * Fix MB of previous tile in row. |
2696 | | * |
2697 | | * Revision 1.25 2007/11/06 01:39:22 steve |
2698 | | * Do not collect strip data for pad strips. |
2699 | | * |
2700 | | * Revision 1.24 2007/11/05 02:01:12 steve |
2701 | | * Add support for mixed row/column tiles. |
2702 | | * |
2703 | | * Revision 1.23 2007/11/02 21:06:07 steve |
2704 | | * Filtering when tile rows are present. |
2705 | | * |
2706 | | * Revision 1.22 2007/11/02 00:19:06 steve |
2707 | | * Fix Multiple rows of tiles strip flush. |
2708 | | * |
2709 | | * Revision 1.21 2007/11/01 21:09:40 steve |
2710 | | * Multiple rows of tiles. |
2711 | | * |
2712 | | * Revision 1.20 2007/10/30 21:32:46 steve |
2713 | | * Support for multiple tile columns. |
2714 | | * |
2715 | | * Revision 1.19 2007/10/23 00:34:12 steve |
2716 | | * Level1 filtering for YUV422 and YUV420 |
2717 | | * |
2718 | | * Revision 1.18 2007/10/22 22:33:12 steve |
2719 | | * Level2 filtering for YUV422 |
2720 | | * |
2721 | | * Revision 1.17 2007/10/22 21:52:37 steve |
2722 | | * Level2 filtering for YUV420 |
2723 | | * |
2724 | | * Revision 1.16 2007/10/19 22:07:36 steve |
2725 | | * Clean up YUV420 to YUV444 conversion corner cases. |
2726 | | * |
2727 | | * Revision 1.15 2007/10/19 20:48:53 steve |
2728 | | * Convert YUV420 to YUV444 works. |
2729 | | * |
2730 | | * Revision 1.14 2007/10/17 23:43:20 steve |
2731 | | * Add support for YUV420 |
2732 | | * |
2733 | | * Revision 1.13 2007/10/01 20:39:34 steve |
2734 | | * Add support for YUV422 LP bands. |
2735 | | * |
2736 | | * Revision 1.12 2007/09/20 18:04:11 steve |
2737 | | * support render of YUV422 images. |
2738 | | * |
2739 | | * Revision 1.11 2007/09/12 01:10:22 steve |
2740 | | * Fix rounding/floor/ceil of YUV to RGB transform. |
2741 | | * |
2742 | | * Revision 1.10 2007/09/11 00:40:06 steve |
2743 | | * Fix rendering of chroma to add the missing *2. |
2744 | | * Fix handling of the chroma LP samples |
2745 | | * Parse some of the HP CBP data in chroma. |
2746 | | * |
2747 | | * Revision 1.9 2007/09/10 23:02:48 steve |
2748 | | * Scale chroma channels? |
2749 | | * |
2750 | | * Revision 1.8 2007/09/08 01:01:44 steve |
2751 | | * YUV444 color parses properly. |
2752 | | * |
2753 | | * Revision 1.7 2007/09/04 19:10:46 steve |
2754 | | * Finish level1 overlap filtering. |
2755 | | * |
2756 | | * Revision 1.6 2007/08/15 01:54:11 steve |
2757 | | * Add level2 filter to decoder. |
2758 | | * |
2759 | | * Revision 1.5 2007/08/13 22:55:12 steve |
2760 | | * Cleanup rflush_md_strip function. |
2761 | | * |
2762 | | * Revision 1.4 2007/08/02 22:48:27 steve |
2763 | | * Add missing clip of calculated values. |
2764 | | * |
2765 | | * Revision 1.3 2007/07/21 00:25:48 steve |
2766 | | * snapshot 2007 07 20 |
2767 | | * |
2768 | | * Revision 1.2 2007/07/11 00:53:36 steve |
2769 | | * HP adaptation and precition corrections. |
2770 | | * |
2771 | | * Revision 1.1 2007/06/28 20:03:11 steve |
2772 | | * LP processing seems to be OK now. |
2773 | | * |
2774 | | */ |
2775 | | |