/src/ghostpdl/jpegxr/init.c
Line | Count | Source |
1 | | |
2 | | |
3 | | /************************************************************************* |
4 | | * |
5 | | * This software module was originally contributed by Microsoft |
6 | | * Corporation in the course of development of the |
7 | | * ITU-T T.832 | ISO/IEC 29199-2 ("JPEG XR") format standard for |
8 | | * reference purposes and its performance may not have been optimized. |
9 | | * |
10 | | * This software module is an implementation of one or more |
11 | | * tools as specified by the JPEG XR standard. |
12 | | * |
13 | | * ITU/ISO/IEC give You a royalty-free, worldwide, non-exclusive |
14 | | * copyright license to copy, distribute, and make derivative works |
15 | | * of this software module or modifications thereof for use in |
16 | | * products claiming conformance to the JPEG XR standard as |
17 | | * specified by ITU-T T.832 | ISO/IEC 29199-2. |
18 | | * |
19 | | * ITU/ISO/IEC give users the same free license to this software |
20 | | * module or modifications thereof for research purposes and further |
21 | | * ITU/ISO/IEC standardization. |
22 | | * |
23 | | * Those intending to use this software module in products are advised |
24 | | * that its use may infringe existing patents. ITU/ISO/IEC have no |
25 | | * liability for use of this software module or modifications thereof. |
26 | | * |
27 | | * Copyright is not released for products that do not conform to |
28 | | * to the JPEG XR standard as specified by ITU-T T.832 | |
29 | | * ISO/IEC 29199-2. |
30 | | * |
31 | | * Microsoft Corporation retains full right to modify and use the code |
32 | | * for its own purpose, to assign or donate the code to a third party, |
33 | | * and to inhibit third parties from using the code for products that |
34 | | * do not conform to the JPEG XR standard as specified by ITU-T T.832 | |
35 | | * ISO/IEC 29199-2. |
36 | | * |
37 | | * This copyright notice must be included in all copies or derivative |
38 | | * works. |
39 | | * |
40 | | * Copyright (c) ITU-T/ISO/IEC 2008, 2009. |
41 | | ***********************************************************************/ |
42 | | |
43 | | #ifdef _MSC_VER |
44 | | #pragma comment (user,"$Id: init.c,v 1.23 2008/03/13 21:23:27 steve Exp $") |
45 | | #else |
46 | | #ident "$Id: init.c,v 1.23 2008/03/13 21:23:27 steve Exp $" |
47 | | #endif |
48 | | |
49 | | # include "jxr_priv.h" |
50 | | # include <stdlib.h> |
51 | | # include <assert.h> |
52 | | |
53 | | const int _jxr_abslevel_index_delta[7] = { 1, 0, -1, -1, -1, -1, -1 }; |
54 | | |
55 | | static void clear_vlc_tables(jxr_image_t image) |
56 | 0 | { |
57 | 0 | int idx; |
58 | 0 | for (idx = 0 ; idx < AbsLevelInd_COUNT ; idx += 1) { |
59 | 0 | image->vlc_table[idx].discriminant = 0; |
60 | 0 | image->vlc_table[idx].discriminant2 = 0; |
61 | 0 | image->vlc_table[idx].table = 0; |
62 | 0 | image->vlc_table[idx].deltatable = 0; |
63 | 0 | image->vlc_table[idx].delta2table = 0; |
64 | 0 | } |
65 | 0 | } |
66 | | |
67 | | static struct jxr_image* __make_jxr(void) |
68 | 0 | { |
69 | 0 | struct jxr_image*image = (struct jxr_image*) calloc(1, sizeof(struct jxr_image)); |
70 | 0 | int idx; |
71 | 0 | if (image == NULL) |
72 | 0 | return NULL; |
73 | 0 | image->user_flags = 0; |
74 | 0 | image->width1 = 0; |
75 | 0 | image->height1 = 0; |
76 | 0 | image->extended_width = 0; |
77 | 0 | image->extended_height = 0; |
78 | 0 | image->header_flags1 = 0; |
79 | 0 | image->header_flags2 = 0x80; /* SHORT_HEADER_FLAG=1 */ |
80 | 0 | image->header_flags_fmt = 0; |
81 | 0 | image->bands_present = 0; /* Default ALL bands present */ |
82 | 0 | image->num_channels = 0; |
83 | 0 | image->tile_index_table = 0; |
84 | 0 | image->tile_index_table_length = 0; |
85 | 0 | image->primary = 1; |
86 | |
|
87 | 0 | clear_vlc_tables(image); |
88 | |
|
89 | 0 | for (idx = 0 ; idx < MAX_CHANNELS ; idx += 1) { |
90 | 0 | image->strip[idx].up4 = 0; |
91 | 0 | image->strip[idx].up3 = 0; |
92 | 0 | image->strip[idx].up2 = 0; |
93 | 0 | image->strip[idx].up1 = 0; |
94 | 0 | image->strip[idx].cur = 0; |
95 | 0 | } |
96 | |
|
97 | 0 | image->scaled_flag = 1; |
98 | |
|
99 | 0 | image->out_fun = 0; |
100 | |
|
101 | 0 | return image; |
102 | 0 | } |
103 | | |
104 | | static int |
105 | | make_mb_row_buffer_aux(jxr_image_t image, int ch, int format_scale, size_t block_count) |
106 | 0 | { |
107 | 0 | int*data, *pred_dclp; |
108 | 0 | size_t idx; |
109 | |
|
110 | 0 | image->mb_row_buffer[ch] = (struct macroblock_s*) calloc(block_count, sizeof(struct macroblock_s)); |
111 | 0 | if (image->mb_row_buffer[ch] == NULL) |
112 | 0 | return -1; |
113 | 0 | data = (int*) calloc(block_count*format_scale, sizeof(int)); |
114 | 0 | pred_dclp = (int*) calloc(block_count*7, sizeof(int)); |
115 | 0 | if (data == NULL || pred_dclp == NULL) { |
116 | 0 | free(data); |
117 | 0 | free(pred_dclp); |
118 | 0 | return -1; |
119 | 0 | } |
120 | | |
121 | 0 | for (idx = 0 ; idx < block_count ; idx += 1) { |
122 | 0 | image->mb_row_buffer[ch][idx].data = data + format_scale*idx; |
123 | | /* 7 (used as mutilpier) = 1 DC + 3 top LP + 3 left LP coefficients used for prediction */ |
124 | 0 | image->mb_row_buffer[ch][idx].pred_dclp = pred_dclp + 7*idx; |
125 | 0 | } |
126 | |
|
127 | 0 | return 0; |
128 | 0 | } |
129 | | |
130 | | static int make_mb_row_buffer(jxr_image_t image, unsigned use_height) |
131 | 0 | { |
132 | 0 | size_t block_count = EXTENDED_WIDTH_BLOCKS(image) * use_height; |
133 | 0 | int*data, *pred_dclp; |
134 | 0 | size_t idx; |
135 | 0 | int format_scale; |
136 | 0 | int ch; |
137 | |
|
138 | 0 | if (make_mb_row_buffer_aux(image, 0, 256, block_count)) |
139 | 0 | return -1; |
140 | | |
141 | 0 | format_scale = 256; |
142 | 0 | if (image->use_clr_fmt == 2 /* YUV422 */) { |
143 | 0 | format_scale = 16 + 8*15; |
144 | 0 | } else if (image->use_clr_fmt == 1 /* YUV420 */) { |
145 | 0 | format_scale = 16 + 4*15; |
146 | 0 | } |
147 | |
|
148 | 0 | for (ch = 1 ; ch < image->num_channels ; ch += 1) { |
149 | 0 | if (make_mb_row_buffer_aux(image, ch, format_scale, block_count)) |
150 | 0 | return -1; |
151 | 0 | } |
152 | 0 | return 0; |
153 | 0 | } |
154 | | |
155 | | /* |
156 | | * Allocate the macroblock strip store. Each macroblock points to 256 |
157 | | * values that are either the 256 pixel values, or the DC, LP and HP |
158 | | * coefficients. |
159 | | * |
160 | | * DC/LP/HP arrangement - |
161 | | * The first word is the DC. |
162 | | * The next 15 are the LP coefficients. |
163 | | * The remaining 240 are HP coefficients. |
164 | | */ |
165 | | int _jxr_make_mbstore(jxr_image_t image, int up4_flag) |
166 | 0 | { |
167 | 0 | int ch; |
168 | |
|
169 | 0 | assert(image->strip[0].up4 == 0); |
170 | 0 | assert(image->strip[0].up3 == 0); |
171 | 0 | assert(image->strip[0].up2 == 0); |
172 | 0 | assert(image->strip[0].up1 == 0); |
173 | 0 | assert(image->strip[0].cur == 0); |
174 | |
|
175 | 0 | assert(image->num_channels > 0); |
176 | |
|
177 | 0 | for (ch = 0 ; ch < image->num_channels ; ch += 1) { |
178 | 0 | size_t idx; |
179 | 0 | if (up4_flag) |
180 | 0 | { |
181 | 0 | image->strip[ch].up4 = (struct macroblock_s*) |
182 | 0 | calloc(EXTENDED_WIDTH_BLOCKS(image), sizeof(struct macroblock_s)); |
183 | 0 | if (image->strip[ch].up4 == NULL) |
184 | 0 | return -1; |
185 | 0 | } |
186 | 0 | image->strip[ch].up3 = (struct macroblock_s*) |
187 | 0 | calloc(EXTENDED_WIDTH_BLOCKS(image), sizeof(struct macroblock_s)); |
188 | 0 | if (image->strip[ch].up3 == NULL) |
189 | 0 | return -1; |
190 | 0 | image->strip[ch].up2 = (struct macroblock_s*) |
191 | 0 | calloc(EXTENDED_WIDTH_BLOCKS(image), sizeof(struct macroblock_s)); |
192 | 0 | if (image->strip[ch].up2 == NULL) |
193 | 0 | return -1; |
194 | 0 | image->strip[ch].up1 = (struct macroblock_s*) |
195 | 0 | calloc(EXTENDED_WIDTH_BLOCKS(image), sizeof(struct macroblock_s)); |
196 | 0 | if (image->strip[ch].up1 == NULL) |
197 | 0 | return -1; |
198 | 0 | image->strip[ch].cur = (struct macroblock_s*) |
199 | 0 | calloc(EXTENDED_WIDTH_BLOCKS(image), sizeof(struct macroblock_s)); |
200 | 0 | if (image->strip[ch].cur == NULL) |
201 | 0 | return -1; |
202 | | |
203 | 0 | if (up4_flag) { |
204 | 0 | image->strip[ch].up4[0].data = (int*)calloc(256 * EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
205 | 0 | if (image->strip[ch].up4[0].data == NULL) |
206 | 0 | return -1; |
207 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
208 | 0 | image->strip[ch].up4[idx].data = image->strip[ch].up4[idx-1].data + 256; |
209 | 0 | } |
210 | 0 | image->strip[ch].up3[0].data = (int*)calloc(256 * EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
211 | 0 | if (image->strip[ch].up3[0].data == NULL) |
212 | 0 | return -1; |
213 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
214 | 0 | image->strip[ch].up3[idx].data = image->strip[ch].up3[idx-1].data + 256; |
215 | |
|
216 | 0 | image->strip[ch].up2[0].data = (int*)calloc(256 * EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
217 | 0 | if (image->strip[ch].up2[0].data == NULL) |
218 | 0 | return -1; |
219 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
220 | 0 | image->strip[ch].up2[idx].data = image->strip[ch].up2[idx-1].data + 256; |
221 | |
|
222 | 0 | image->strip[ch].up1[0].data = (int*)calloc(256 * EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
223 | 0 | if (image->strip[ch].up1[0].data == NULL) |
224 | 0 | return -1; |
225 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
226 | 0 | image->strip[ch].up1[idx].data = image->strip[ch].up1[idx-1].data + 256; |
227 | |
|
228 | 0 | image->strip[ch].cur[0].data = (int*)calloc(256 * EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
229 | 0 | if (image->strip[ch].cur[0].data == NULL) |
230 | 0 | return -1; |
231 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
232 | 0 | image->strip[ch].cur[idx].data = image->strip[ch].cur[idx-1].data + 256; |
233 | |
|
234 | 0 | if (up4_flag) { |
235 | 0 | image->strip[ch].up4[0].pred_dclp = (int*)calloc(7*EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
236 | 0 | if (image->strip[ch].up4[0].pred_dclp == NULL) |
237 | 0 | return -1; |
238 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
239 | 0 | image->strip[ch].up4[idx].pred_dclp = image->strip[ch].up4[idx-1].pred_dclp + 7; |
240 | 0 | } |
241 | | |
242 | 0 | image->strip[ch].up3[0].pred_dclp = (int*)calloc(7*EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
243 | 0 | if (image->strip[ch].up3[0].pred_dclp == NULL) |
244 | 0 | return -1; |
245 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
246 | 0 | image->strip[ch].up3[idx].pred_dclp = image->strip[ch].up3[idx-1].pred_dclp + 7; |
247 | |
|
248 | 0 | image->strip[ch].up2[0].pred_dclp = (int*)calloc(7*EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
249 | 0 | if (image->strip[ch].up2[0].pred_dclp == NULL) |
250 | 0 | return -1; |
251 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
252 | 0 | image->strip[ch].up2[idx].pred_dclp = image->strip[ch].up2[idx-1].pred_dclp + 7; |
253 | |
|
254 | 0 | image->strip[ch].up1[0].pred_dclp = (int*)calloc(7*EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
255 | 0 | if (image->strip[ch].up1[0].pred_dclp == NULL) |
256 | 0 | return -1; |
257 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
258 | 0 | image->strip[ch].up1[idx].pred_dclp = image->strip[ch].up1[idx-1].pred_dclp + 7; |
259 | |
|
260 | 0 | image->strip[ch].cur[0].pred_dclp = (int*)calloc(7*EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
261 | 0 | if (image->strip[ch].cur[0].pred_dclp == NULL) |
262 | 0 | return -1; |
263 | 0 | for (idx = 1 ; idx < EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
264 | 0 | image->strip[ch].cur[idx].pred_dclp = image->strip[ch].cur[idx-1].pred_dclp + 7; |
265 | |
|
266 | 0 | if(ch!= 0) |
267 | 0 | { |
268 | 0 | if(image->use_clr_fmt == 2 || image->use_clr_fmt == 1) /* 422 or 420 */ |
269 | 0 | { |
270 | 0 | image->strip[ch].upsample_memory_x = (int*)calloc(16, sizeof(int)); |
271 | 0 | if (image->strip[ch].upsample_memory_x == NULL) |
272 | 0 | return -1; |
273 | 0 | } |
274 | | |
275 | 0 | if(image->use_clr_fmt == 1)/* 420 */ |
276 | 0 | { |
277 | 0 | image->strip[ch].upsample_memory_y = (int*)calloc(8*EXTENDED_WIDTH_BLOCKS(image), sizeof(int)); |
278 | 0 | if (image->strip[ch].upsample_memory_y == NULL) |
279 | 0 | return -1; |
280 | 0 | } |
281 | 0 | } |
282 | | |
283 | 0 | } |
284 | | |
285 | | /* If there is tiling (in columns) then allocate a tile buffer |
286 | | that can hold an entire row of tiles. */ |
287 | 0 | if (FREQUENCY_MODE_CODESTREAM_FLAG(image)) { /* FREQUENCY MODE */ |
288 | |
|
289 | 0 | if (make_mb_row_buffer(image, EXTENDED_HEIGHT_BLOCKS(image))) |
290 | 0 | return -1; |
291 | |
|
292 | 0 | } else { /* SPATIAL */ |
293 | 0 | if (INDEXTABLE_PRESENT_FLAG(image)) { |
294 | | /* This means that the tiling flag is used */ |
295 | 0 | unsigned max_tile_height = 0; |
296 | 0 | unsigned idx; |
297 | 0 | int format_scale; |
298 | 0 | int ch; |
299 | 0 | for (idx = 0 ; idx < image->tile_rows ; idx += 1) { |
300 | 0 | if (image->tile_row_height[idx] > max_tile_height) |
301 | 0 | max_tile_height = image->tile_row_height[idx]; |
302 | 0 | } |
303 | |
|
304 | 0 | if (make_mb_row_buffer(image, max_tile_height)) |
305 | 0 | return -1; |
306 | | |
307 | | /* Save enough context MBs for 4 rows of |
308 | | macroblocks. */ |
309 | | |
310 | 0 | format_scale = 256; |
311 | 0 | if (image->use_clr_fmt == 2 /* YUV422 */) { |
312 | 0 | format_scale = 16 + 8*15; |
313 | 0 | } else if (image->use_clr_fmt == 1 /* YUV420 */) { |
314 | 0 | format_scale = 16 + 4*15; |
315 | 0 | } |
316 | |
|
317 | 0 | for (ch = 0 ; ch < image->num_channels ; ch += 1) { |
318 | 0 | int count = (ch==0)? 256 : format_scale; |
319 | 0 | image->mb_row_context[ch] = (struct macroblock_s*) |
320 | 0 | calloc(4*EXTENDED_WIDTH_BLOCKS(image), sizeof(struct macroblock_s)); |
321 | 0 | if (image->mb_row_context[ch] == NULL) |
322 | 0 | return -1; |
323 | 0 | image->mb_row_context[ch][0].data = (int*) |
324 | 0 | calloc(4*EXTENDED_WIDTH_BLOCKS(image)*count, sizeof(int)); |
325 | 0 | if (image->mb_row_context[ch][0].data == NULL) |
326 | 0 | return -1; |
327 | 0 | for (idx = 1 ; idx < 4*EXTENDED_WIDTH_BLOCKS(image) ; idx += 1) |
328 | 0 | image->mb_row_context[ch][idx].data = image->mb_row_context[ch][idx-1].data+count; |
329 | 0 | } |
330 | |
|
331 | 0 | } |
332 | 0 | } |
333 | | |
334 | | /* since CBP processing is done at each row, need to save contexts is multiple tile columns */ |
335 | 0 | image->model_hp_buffer = 0; |
336 | 0 | image->hp_cbp_model_buffer = 0; |
337 | 0 | if (image->tile_columns > 1) { |
338 | 0 | image->model_hp_buffer = (struct model_s*) |
339 | 0 | calloc(image->tile_columns, sizeof(struct model_s)); |
340 | 0 | if (image->model_hp_buffer == NULL) |
341 | 0 | return -1; |
342 | 0 | image->hp_cbp_model_buffer = (struct cbp_model_s*) |
343 | 0 | calloc(image->tile_columns, sizeof(struct cbp_model_s)); |
344 | 0 | if (image->hp_cbp_model_buffer == NULL) |
345 | 0 | return -1; |
346 | 0 | } |
347 | | |
348 | 0 | image->cur_my = -1; |
349 | |
|
350 | 0 | return 0; |
351 | 0 | } |
352 | | |
353 | | jxr_image_t jxr_create_input(void) |
354 | 0 | { |
355 | 0 | struct jxr_image*image = __make_jxr(); |
356 | |
|
357 | 0 | return image; |
358 | 0 | } |
359 | | |
360 | | jxr_image_t jxr_create_image(int width, int height, unsigned char * windowing) |
361 | 0 | { |
362 | 0 | struct jxr_image*image = __make_jxr(); |
363 | |
|
364 | 0 | if (width == 0 || height == 0) |
365 | 0 | return 0; |
366 | | |
367 | 0 | image = __make_jxr(); |
368 | 0 | if (image == NULL) |
369 | 0 | return 0; |
370 | | |
371 | 0 | if (windowing[0] == 1) { |
372 | 0 | assert(((width+windowing[2]+windowing[4]) & 0x0f) == 0); |
373 | 0 | assert(((height+windowing[1]+windowing[3]) & 0x0f) == 0); |
374 | 0 | } |
375 | 0 | else { |
376 | 0 | windowing[1] = windowing[2] = 0; |
377 | 0 | windowing[3] = (((height + 15) >> 4) << 4) - height; |
378 | 0 | windowing[4] = (((width + 15) >> 4) << 4) - width; |
379 | 0 | } |
380 | |
|
381 | 0 | image->width1 = width-1; |
382 | 0 | image->height1 = height-1; |
383 | 0 | image->extended_width = image->width1 + 1 + windowing[2] + windowing[4]; |
384 | 0 | image->extended_height = image->height1 + 1 + windowing[1] + windowing[3]; |
385 | |
|
386 | 0 | image->dc_frame_uniform = 1; |
387 | 0 | image->lp_frame_uniform = 1; |
388 | 0 | image->lp_use_dc_qp = 0; |
389 | 0 | image->num_lp_qps = 1; |
390 | 0 | image->hp_use_lp_qp = 0; |
391 | 0 | image->hp_frame_uniform = 1; |
392 | 0 | image->num_hp_qps = 1; |
393 | |
|
394 | 0 | image->window_extra_top = windowing[1]; |
395 | 0 | image->window_extra_left = windowing[2]; |
396 | 0 | image->window_extra_bottom = windowing[3]; |
397 | 0 | image->window_extra_right = windowing[4]; |
398 | |
|
399 | 0 | return image; |
400 | 0 | } |
401 | | |
402 | | void jxr_flag_SKIP_HP_DATA(jxr_image_t image, int flag) |
403 | 0 | { |
404 | 0 | if (flag) |
405 | 0 | image->user_flags |= 0x0001; |
406 | 0 | else |
407 | 0 | image->user_flags &= ~0x0001; |
408 | 0 | } |
409 | | |
410 | | void jxr_flag_SKIP_FLEX_DATA(jxr_image_t image, int flag) |
411 | 0 | { |
412 | 0 | if (flag) |
413 | 0 | image->user_flags |= 0x0002; |
414 | 0 | else |
415 | 0 | image->user_flags &= ~0x0002; |
416 | 0 | } |
417 | | |
418 | | void jxr_destroy(jxr_image_t image) |
419 | 0 | { |
420 | 0 | int idx, plane_idx = 1; |
421 | 0 | if(image == NULL) |
422 | 0 | return; |
423 | | |
424 | 0 | if (ALPHACHANNEL_FLAG(image)) |
425 | 0 | plane_idx = 2; |
426 | | |
427 | 0 | for (; plane_idx > 0; plane_idx --) { |
428 | 0 | jxr_image_t plane = (plane_idx == 1 ? image : image->alpha); |
429 | |
|
430 | 0 | for (idx = 0 ; idx < plane->num_channels ; idx += 1) { |
431 | 0 | if (plane->strip[idx].up4) { |
432 | 0 | free(plane->strip[idx].up4[0].data); |
433 | 0 | free(plane->strip[idx].up4); |
434 | 0 | } |
435 | 0 | if (plane->strip[idx].up3) { |
436 | 0 | free(plane->strip[idx].up3[0].data); |
437 | 0 | free(plane->strip[idx].up3); |
438 | 0 | } |
439 | 0 | if (plane->strip[idx].up2) { |
440 | 0 | free(plane->strip[idx].up2[0].data); |
441 | 0 | free(plane->strip[idx].up2); |
442 | 0 | } |
443 | 0 | if (plane->strip[idx].up1) { |
444 | 0 | free(plane->strip[idx].up1[0].data); |
445 | 0 | free(plane->strip[idx].up1); |
446 | 0 | } |
447 | 0 | if (plane->strip[idx].cur) { |
448 | 0 | free(plane->strip[idx].cur[0].data); |
449 | 0 | free(plane->strip[idx].cur); |
450 | 0 | } |
451 | 0 | if(plane->strip[idx].upsample_memory_x) |
452 | 0 | free(plane->strip[idx].upsample_memory_x); |
453 | 0 | if(plane->strip[idx].upsample_memory_y) |
454 | 0 | free(plane->strip[idx].upsample_memory_y); |
455 | |
|
456 | 0 | } |
457 | |
|
458 | 0 | for (idx = 0 ; idx < plane->num_channels ; idx += 1) { |
459 | 0 | if (plane->mb_row_buffer[idx]) { |
460 | 0 | free(plane->mb_row_buffer[idx][0].data); |
461 | 0 | free(plane->mb_row_buffer[idx]); |
462 | 0 | } |
463 | |
|
464 | 0 | if (plane->mb_row_context[idx]) { |
465 | 0 | free(plane->mb_row_context[idx][0].data); |
466 | 0 | free(plane->mb_row_context[idx]); |
467 | 0 | } |
468 | 0 | } |
469 | |
|
470 | 0 | if (plane->model_hp_buffer) { |
471 | 0 | free(plane->model_hp_buffer); |
472 | 0 | } |
473 | |
|
474 | 0 | if (plane->hp_cbp_model_buffer) { |
475 | 0 | free(plane->hp_cbp_model_buffer); |
476 | 0 | } |
477 | |
|
478 | 0 | if(plane_idx == 1){ |
479 | 0 | if (plane->tile_index_table) |
480 | 0 | free(plane->tile_index_table); |
481 | 0 | if (plane->tile_column_width) |
482 | 0 | free(plane->tile_column_width); |
483 | 0 | if (plane->tile_row_height) |
484 | 0 | free(plane->tile_row_height); |
485 | 0 | } |
486 | 0 | free(plane); |
487 | 0 | } |
488 | 0 | } |
489 | | |
490 | | /* |
491 | | * $Log: init.c,v $ |
492 | | * Revision 1.25 2009/05/29 12:00:00 microsoft |
493 | | * Reference Software v1.6 updates. |
494 | | * |
495 | | * Revision 1.24 2009/04/13 12:00:00 microsoft |
496 | | * Reference Software v1.5 updates. |
497 | | * |
498 | | * Revision 1.23 2008/03/13 21:23:27 steve |
499 | | * Add pipeline step for YUV420. |
500 | | * |
501 | | * Revision 1.22 2008/03/05 06:58:10 gus |
502 | | * *** empty log message *** |
503 | | * |
504 | | * Revision 1.21 2008/02/28 18:50:31 steve |
505 | | * Portability fixes. |
506 | | * |
507 | | * Revision 1.20 2008/02/26 23:52:44 steve |
508 | | * Remove ident for MS compilers. |
509 | | * |
510 | | * Revision 1.19 2008/01/04 17:07:35 steve |
511 | | * API interface for setting QP values. |
512 | | * |
513 | | * Revision 1.18 2007/11/26 01:47:15 steve |
514 | | * Add copyright notices per MS request. |
515 | | * |
516 | | * Revision 1.17 2007/11/22 19:02:05 steve |
517 | | * More fixes of color plane buffer sizes. |
518 | | * |
519 | | * Revision 1.16 2007/11/21 23:26:14 steve |
520 | | * make all strip buffers store MB data. |
521 | | * |
522 | | * Revision 1.15 2007/11/21 00:34:30 steve |
523 | | * Rework spatial mode tile macroblock shuffling. |
524 | | * |
525 | | * Revision 1.14 2007/11/15 17:44:13 steve |
526 | | * Frequency mode color support. |
527 | | * |
528 | | * Revision 1.13 2007/11/14 23:56:17 steve |
529 | | * Fix TILE ordering, using seeks, for FREQUENCY mode. |
530 | | * |
531 | | * Revision 1.12 2007/11/12 23:21:54 steve |
532 | | * Infrastructure for frequency mode ordering. |
533 | | * |
534 | | * Revision 1.11 2007/11/08 02:52:32 steve |
535 | | * Some progress in some encoding infrastructure. |
536 | | * |
537 | | * Revision 1.10 2007/11/05 02:01:12 steve |
538 | | * Add support for mixed row/column tiles. |
539 | | * |
540 | | * Revision 1.9 2007/11/01 21:09:40 steve |
541 | | * Multiple rows of tiles. |
542 | | * |
543 | | * Revision 1.8 2007/10/30 21:32:46 steve |
544 | | * Support for multiple tile columns. |
545 | | * |
546 | | * Revision 1.7 2007/09/08 01:01:43 steve |
547 | | * YUV444 color parses properly. |
548 | | * |
549 | | * Revision 1.6 2007/09/04 19:10:46 steve |
550 | | * Finish level1 overlap filtering. |
551 | | * |
552 | | * Revision 1.5 2007/08/15 01:54:11 steve |
553 | | * Add level2 filter to decoder. |
554 | | * |
555 | | * Revision 1.4 2007/08/04 00:15:31 steve |
556 | | * Allow width/height of 1 pixel. |
557 | | * |
558 | | * Revision 1.3 2007/07/21 00:25:48 steve |
559 | | * snapshot 2007 07 20 |
560 | | * |
561 | | * Revision 1.2 2007/06/28 20:03:11 steve |
562 | | * LP processing seems to be OK now. |
563 | | * |
564 | | * Revision 1.1 2007/06/06 17:19:12 steve |
565 | | * Introduce to CVS. |
566 | | * |
567 | | */ |
568 | | |