Mercurial > mplayer.hg
comparison xacodec.c @ 2373:463da8544d23
reworked for mplayer
author | alex |
---|---|
date | Mon, 22 Oct 2001 17:07:40 +0000 |
parents | 0959af64c098 |
children | 4edd4d7f4511 |
comparison
equal
deleted
inserted
replaced
2372:0959af64c098 | 2373:463da8544d23 |
---|---|
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <dlfcn.h> /* dlsym, dlopen, dlclose */ | 9 #include <dlfcn.h> /* dlsym, dlopen, dlclose */ |
10 #include <stdarg.h> /* va_alist, va_start, va_end */ | 10 #include <stdarg.h> /* va_alist, va_start, va_end */ |
11 #include <errno.h> /* strerror, errno */ | 11 #include <errno.h> /* strerror, errno */ |
12 | 12 |
13 #include "odeon.h" | 13 #include "mp_msg.h" |
14 #include "aclib/byteswap.h" | 14 #include "aclib/byteswap.h" |
15 | 15 |
16 #include "stream.h" | 16 #include "stream.h" |
17 #include "demuxer.h" | 17 #include "demuxer.h" |
18 #include "codec-cfg.h" | 18 #include "codec-cfg.h" |
46 void (*close_func)(); | 46 void (*close_func)(); |
47 } xacodec_driver_t; | 47 } xacodec_driver_t; |
48 | 48 |
49 xacodec_driver_t *xacodec_driver = NULL; | 49 xacodec_driver_t *xacodec_driver = NULL; |
50 | 50 |
51 /* *** XANIM SHIT *** */ | |
52 | |
53 typedef struct | |
54 { | |
55 unsigned char r0, g0, b0; | |
56 unsigned char r1, g1, b1; | |
57 unsigned char r2, g2, b2; | |
58 unsigned char r3, g3, b3; | |
59 unsigned int clr0_0, clr0_1, clr0_2, clr0_3; | |
60 unsigned int clr1_0, clr1_1, clr1_2, clr1_3; | |
61 unsigned int clr2_0, clr2_1, clr2_2, clr2_3; | |
62 unsigned int clr3_0, clr3_1, clr3_2, clr3_3; | |
63 } XA_2x2_Color; | |
64 | |
65 #define ip_OUT_2x2_1BLK(ip, CAST, cmap2x2, rinc) { register CAST d0, d1; \ | |
66 *ip++ = d0 = (CAST)(cmap2x2->clr0_0); *ip++ = d0; \ | |
67 *ip++ = d1 = (CAST)(cmap2x2->clr1_0); *ip = d1; \ | |
68 ip += rinc; \ | |
69 *ip++ = d0; *ip++ = d0; *ip++ = d1; *ip = d1; ip += rinc; \ | |
70 *ip++ = d0 = (CAST)(cmap2x2->clr2_0); *ip++ = d0; \ | |
71 *ip++ = d1 = (CAST)(cmap2x2->clr3_0); *ip = d1; \ | |
72 ip += rinc; *ip++ = d0; *ip++ = d0; *ip++ = d1; *ip++ = d1; } | |
73 | |
74 #define ip_OUT_2x2_2BLKS(ip, CAST, c2x2map0, c2x2map1, rinc) { \ | |
75 *ip++ = (CAST)(c2x2map0->clr0_0); \ | |
76 *ip++ = (CAST)(c2x2map0->clr1_0); \ | |
77 *ip++ = (CAST)(c2x2map1->clr0_0); \ | |
78 *ip = (CAST)(c2x2map1->clr1_0); ip += rinc; \ | |
79 *ip++ = (CAST)(c2x2map0->clr2_0); \ | |
80 *ip++ = (CAST)(c2x2map0->clr3_0); \ | |
81 *ip++ = (CAST)(c2x2map1->clr2_0); \ | |
82 *ip = (CAST)(c2x2map1->clr3_0); } | |
83 | |
84 void XA_2x2_OUT_1BLK_clr8(unsigned char *image, unsigned int x, unsigned int y, | |
85 unsigned int imagex, XA_2x2_Color *cmap2x2) | |
86 { | |
87 unsigned int row_inc = imagex - 3; | |
88 unsigned char *ip = (unsigned char *)(image + y * imagex + x); | |
89 | |
90 XA_Print("XA_2x2_OUT_1BLK_clr8('image: %08x', 'x: %d', 'y: %d', 'imagex: %d', 'cmap2x2: %08x')", | |
91 image, x, y, imagex, cmap2x2); | |
92 ip_OUT_2x2_1BLK(ip, unsigned char, cmap2x2, row_inc); | |
93 } | |
94 | |
95 void XA_2x2_OUT_4BLKS_clr8(unsigned char *image, unsigned int x, unsigned int y, | |
96 unsigned int imagex, XA_2x2_Color *cm0, XA_2x2_Color *cm1, XA_2x2_Color *cm2, | |
97 XA_2x2_Color *cm3) | |
98 { | |
99 unsigned int row_inc = imagex - 3; | |
100 unsigned char *ip = (unsigned char *)(image + y * imagex + x); | |
101 | |
102 XA_Print("XA_2x2_OUT_1BLK_clr8('image: %08x', 'x: %d', 'y: %d', 'imagex: %d', 'cm0: %08x', 'cm1: %08x', 'cm2: %08x', 'cm3: %08x')", | |
103 image, x, y, imagex, cm0, cm1, cm2, cm3); | |
104 ip_OUT_2x2_2BLKS(ip, unsigned char, cm0, cm1, row_inc); | |
105 ip += row_inc; | |
106 ip_OUT_2x2_2BLKS(ip, unsigned char, cm2, cm3, row_inc); | |
107 } | |
108 | |
109 void *YUV2x2_Blk_Func(unsigned int image_type, int blks, unsigned int dith_flag) | |
110 { | |
111 void (*color_func)(); | |
112 | |
113 XA_Print("YUV2x2_Blk_Func('image_type: %d', 'blks: %d', 'dith_flag: %d')", | |
114 image_type, blks, dith_flag); | |
115 | |
116 if (blks == 1) | |
117 { | |
118 switch(image_type) | |
119 { | |
120 default: | |
121 color_func = XA_2x2_OUT_1BLK_clr8; | |
122 break; | |
123 } | |
124 } | |
125 else /* blks == 4 */ | |
126 { | |
127 switch(image_type) | |
128 { | |
129 default: | |
130 color_func = XA_2x2_OUT_4BLKS_clr8; | |
131 break; | |
132 } | |
133 } | |
134 | |
135 XA_Print("YUV2x2_Blk_Func -> %08x", color_func); | |
136 | |
137 return((void *)color_func); | |
138 } | |
139 | |
140 void *YUV2x2_Map_Func(unsigned int image_type, unsigned int dith_type) | |
141 { | |
142 XA_Print("YUV2x2_Map_Func('image_type: %d', 'dith_type: %d')", | |
143 image_type, dith_type); | |
144 } | |
145 | |
146 int XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)()) | |
147 { | |
148 XA_Print("XA_Add_Func_To_Free_Chain('anim_hdr: %08x', 'function: %08x')", | |
149 anim_hdr, function); | |
150 xacodec_driver->close_func = function; | |
151 } | |
152 | |
153 int XA_Gen_YUV_Tabs(XA_ANIM_HDR *anim_hdr) | |
154 { | |
155 XA_Print("XA_Gen_YUV_Tabs('anim_hdr: %08x')", anim_hdr); | |
156 | |
157 // XA_Print("anim type: %d - img[x: %d, y: %d, c: %d, d: %d]", | |
158 // anim_hdr->anim_type, anim_hdr->imagex, anim_hdr->imagey, | |
159 // anim_hdr->imagec, anim_hdr->imaged); | |
160 } | |
161 | |
162 void JPG_Setup_Samp_Limit_Table(XA_ANIM_HDR *anim_hdr) | |
163 { | |
164 XA_Print("JPG_Setup_Samp_Limit_Table('anim_hdr: %08x')", anim_hdr); | |
165 } | |
166 | |
167 void JPG_Alloc_MCU_Bufs(XA_ANIM_HDR *anim_hdr, unsigned int width, | |
168 unsigned int height, unsigned int full_flag) | |
169 { | |
170 XA_Print("JPG_Alloc_MCU_Bufs('anim_hdr: %08x', 'width: %d', 'height: %d', 'full_flag: %d')", | |
171 anim_hdr, width, height, full_flag); | |
172 } | |
173 | |
174 typedef struct | |
175 { | |
176 unsigned char *Ybuf; | |
177 unsigned char *Ubuf; | |
178 unsigned char *Vbuf; | |
179 unsigned char *the_buf; | |
180 unsigned int the_buf_size; | |
181 unsigned short y_w, y_h; | |
182 unsigned short uv_w, uv_h; | |
183 } YUVBufs; | |
184 | |
185 typedef struct | |
186 { | |
187 unsigned long Uskip_mask; | |
188 long *YUV_Y_tab; | |
189 long *YUV_UB_tab; | |
190 long *YUV_VR_tab; | |
191 long *YUV_UG_tab; | |
192 long *YUV_VG_tab; | |
193 } YUVTabs; | |
194 | |
195 #define XA_IMTYPE_RGB 0x0001 | |
196 | |
197 void XA_YUV1611_To_RGB(unsigned char *image, unsigned int imagex, unsigned int imagey, | |
198 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs, | |
199 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
200 { | |
201 XA_Print("XA_YUV1611_To_RGB('image: %08x', 'imagex: %d', 'imagey: %d', 'i_x: %d', 'i_y: %d', 'yuv_bufs: %08x', 'yuv_tabs: %08x', 'map_flag: %d', 'map: %08x', 'chdr: %08x')", | |
202 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr); | |
203 } | |
204 | |
205 void XA_YUV1611_To_CLR8(unsigned char *image, unsigned int imagex, unsigned int imagey, | |
206 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs, | |
207 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
208 { | |
209 XA_Print("XA_YUV1611_To_CLR8('image: %08x', 'imagex: %d', 'imagey: %d', 'i_x: %d', 'i_y: %d', 'yuv_bufs: %08x', 'yuv_tabs: %08x', 'map_flag: %d', 'map: %08x', 'chdr: %08x')", | |
210 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr); | |
211 } | |
212 | |
213 void *XA_YUV1611_Func(unsigned int image_type) | |
214 { | |
215 void (*color_func)(); | |
216 | |
217 XA_Print("XA_YUV1611_Func('image_type: %d')", image_type); | |
218 | |
219 switch(image_type) | |
220 { | |
221 case XA_IMTYPE_RGB: | |
222 color_func = XA_YUV1611_To_RGB; | |
223 break; | |
224 default: | |
225 color_func = XA_YUV1611_To_CLR8; | |
226 break; | |
227 } | |
228 | |
229 return((void *)color_func); | |
230 } | |
231 | |
232 unsigned long XA_Time_Read() | |
233 { | |
234 return(GetRelativeTime()); | |
235 } | |
236 | |
237 /* YUV 41 11 11 routines */ | |
238 void XA_YUV411111_To_RGB(unsigned char *image, unsigned int imagex, unsigned int imagey, | |
239 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs, | |
240 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
241 { | |
242 XA_Print("XA_YUV411111_To_RGB('image: %d', 'imagex: %d', 'imagey: %d', 'i_x: %d', 'i_y: %d', 'yuv_bufs: %08x', 'yuv_tabs: %08x', 'map_flag: %d', 'map: %08x', 'chdr: %08x')", | |
243 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr); | |
244 } | |
245 | |
246 | |
247 void *XA_YUV411111_Func(unsigned int image_type) | |
248 { | |
249 void (*color_func)(); | |
250 | |
251 XA_Print("XA_YUV411111_Func('image_type: %d')", image_type); | |
252 | |
253 switch(image_type) | |
254 { | |
255 case XA_IMTYPE_RGB: color_func = XA_YUV411111_To_RGB; break; | |
256 } | |
257 | |
258 return((void *)color_func); | |
259 } | |
260 | |
261 | |
262 YUVBufs jpg_YUVBufs; | |
263 YUVTabs def_yuv_tabs; | |
264 | |
265 /* *** EOF XANIM SHIT *** */ | |
266 | 51 |
267 /* Needed by XAnim DLLs */ | 52 /* Needed by XAnim DLLs */ |
268 int XA_Print(char *fmt, ...) | 53 int XA_Print(char *fmt, ...) |
269 { | 54 { |
270 va_list vallist; | 55 va_list vallist; |
271 char buf[1024]; | 56 char buf[1024]; |
272 | 57 |
273 va_start(vallist, fmt); | 58 va_start(vallist, fmt); |
274 vsnprintf(buf, 1024, fmt, vallist); | 59 vsnprintf(buf, 1024, fmt, vallist); |
275 odprintf(LOG_NORM, "[xacodec] %s", buf); | 60 mp_msg(MSGT_DECVIDEO, MSGL_HINT, "[xacodec] %s", buf); |
276 va_end(vallist); | 61 va_end(vallist); |
277 } | 62 } |
278 | 63 |
279 int TheEnd1(char *err_mess) | 64 int TheEnd1(char *err_mess) |
280 { | 65 { |
295 codec_driver->file_handler = dlopen(filename, RTLD_NOW|RTLD_GLOBAL); | 80 codec_driver->file_handler = dlopen(filename, RTLD_NOW|RTLD_GLOBAL); |
296 if (!codec_driver->file_handler) | 81 if (!codec_driver->file_handler) |
297 { | 82 { |
298 error = dlerror(); | 83 error = dlerror(); |
299 if (error) | 84 if (error) |
300 printf("xacodec: fialed to init %s while %s\n", filename, error); | 85 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to init %s while %s\n", filename, error); |
301 else | 86 else |
302 printf("xacodec: failed ot init (dlopen) %s\n", filename); | 87 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed ot init (dlopen) %s\n", filename); |
303 return(0); | 88 return(0); |
304 } | 89 } |
305 | 90 |
306 what_the = dlsym(codec_driver->file_handler, "What_The"); | 91 what_the = dlsym(codec_driver->file_handler, "What_The"); |
307 if ((error = dlerror()) != NULL) | 92 if ((error = dlerror()) != NULL) |
308 { | 93 { |
309 printf("xacodec: failed to init %s while %s\n", filename, error); | 94 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to init %s while %s\n", filename, error); |
310 dlclose(codec_driver->file_handler); | 95 dlclose(codec_driver->file_handler); |
311 return(0); | 96 return(0); |
312 } | 97 } |
313 | 98 |
314 mod_hdr = what_the(); | 99 mod_hdr = what_the(); |
315 if (!mod_hdr) | 100 if (!mod_hdr) |
316 { | 101 { |
317 printf("xacodec: 'What_The' function failed in %s\n", filename); | 102 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: 'What_The' function failed in %s\n", filename); |
318 dlclose(codec_driver->file_handler); | 103 dlclose(codec_driver->file_handler); |
319 return(0); | 104 return(0); |
320 } | 105 } |
321 | 106 |
322 printf("=== XAnim Codec ===\n"); | 107 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "=== XAnim Codec ===\n"); |
323 printf(" Filename: %s (API revision: %x)\n", filename, mod_hdr->api_rev); | 108 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " Filename: %s (API revision: %x)\n", filename, mod_hdr->api_rev); |
324 printf(" Codec: %s. Rev: %s\n", mod_hdr->desc, mod_hdr->rev); | 109 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " Codec: %s. Rev: %s\n", mod_hdr->desc, mod_hdr->rev); |
325 if (mod_hdr->copyright) | 110 if (mod_hdr->copyright) |
326 printf(" %s\n", mod_hdr->copyright); | 111 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " %s\n", mod_hdr->copyright); |
327 if (mod_hdr->mod_author) | 112 if (mod_hdr->mod_author) |
328 printf(" Module Author(s): %s\n", mod_hdr->mod_author); | 113 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " Module Author(s): %s\n", mod_hdr->mod_author); |
329 if (mod_hdr->authors) | 114 if (mod_hdr->authors) |
330 printf(" Codec Author(s): %s\n", mod_hdr->authors); | 115 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " Codec Author(s): %s\n", mod_hdr->authors); |
331 | 116 |
332 if (mod_hdr->api_rev > XAVID_API_REV) | 117 if (mod_hdr->api_rev > XAVID_API_REV) |
333 { | 118 { |
334 printf("xacodec: not supported api revision in %s\n", filename); | 119 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supported api revision in %s\n", filename); |
335 dlclose(codec_driver->file_handler); | 120 dlclose(codec_driver->file_handler); |
336 return(0); | 121 return(0); |
337 } | 122 } |
338 | 123 |
339 func = mod_hdr->funcs; | 124 func = mod_hdr->funcs; |
340 if (!func) | 125 if (!func) |
341 { | 126 { |
342 printf("xacodec: function table error in %s\n", filename); | 127 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: function table error in %s\n", filename); |
343 dlclose(codec_driver->file_handler); | 128 dlclose(codec_driver->file_handler); |
344 return(0); | 129 return(0); |
345 } | 130 } |
346 | 131 |
347 if (verbose > 2) | 132 if (verbose > 2) |
595 free(xacodec_driver->decinfo); | 380 free(xacodec_driver->decinfo); |
596 if (xacodec_driver != NULL) | 381 if (xacodec_driver != NULL) |
597 free(xacodec_driver); | 382 free(xacodec_driver); |
598 return(TRUE); | 383 return(TRUE); |
599 } | 384 } |
385 | |
386 | |
387 /* *** XANIM SHIT *** */ | |
388 /* like loader/win32.c - mini XANIM library */ | |
389 | |
390 typedef struct | |
391 { | |
392 unsigned char r0, g0, b0; | |
393 unsigned char r1, g1, b1; | |
394 unsigned char r2, g2, b2; | |
395 unsigned char r3, g3, b3; | |
396 unsigned int clr0_0, clr0_1, clr0_2, clr0_3; | |
397 unsigned int clr1_0, clr1_1, clr1_2, clr1_3; | |
398 unsigned int clr2_0, clr2_1, clr2_2, clr2_3; | |
399 unsigned int clr3_0, clr3_1, clr3_2, clr3_3; | |
400 } XA_2x2_Color; | |
401 | |
402 #define ip_OUT_2x2_1BLK(ip, CAST, cmap2x2, rinc) { register CAST d0, d1; \ | |
403 *ip++ = d0 = (CAST)(cmap2x2->clr0_0); *ip++ = d0; \ | |
404 *ip++ = d1 = (CAST)(cmap2x2->clr1_0); *ip = d1; \ | |
405 ip += rinc; \ | |
406 *ip++ = d0; *ip++ = d0; *ip++ = d1; *ip = d1; ip += rinc; \ | |
407 *ip++ = d0 = (CAST)(cmap2x2->clr2_0); *ip++ = d0; \ | |
408 *ip++ = d1 = (CAST)(cmap2x2->clr3_0); *ip = d1; \ | |
409 ip += rinc; *ip++ = d0; *ip++ = d0; *ip++ = d1; *ip++ = d1; } | |
410 | |
411 #define ip_OUT_2x2_2BLKS(ip, CAST, c2x2map0, c2x2map1, rinc) { \ | |
412 *ip++ = (CAST)(c2x2map0->clr0_0); \ | |
413 *ip++ = (CAST)(c2x2map0->clr1_0); \ | |
414 *ip++ = (CAST)(c2x2map1->clr0_0); \ | |
415 *ip = (CAST)(c2x2map1->clr1_0); ip += rinc; \ | |
416 *ip++ = (CAST)(c2x2map0->clr2_0); \ | |
417 *ip++ = (CAST)(c2x2map0->clr3_0); \ | |
418 *ip++ = (CAST)(c2x2map1->clr2_0); \ | |
419 *ip = (CAST)(c2x2map1->clr3_0); } | |
420 | |
421 void XA_2x2_OUT_1BLK_clr8(unsigned char *image, unsigned int x, unsigned int y, | |
422 unsigned int imagex, XA_2x2_Color *cmap2x2) | |
423 { | |
424 unsigned int row_inc = imagex - 3; | |
425 unsigned char *ip = (unsigned char *)(image + y * imagex + x); | |
426 | |
427 XA_Print("XA_2x2_OUT_1BLK_clr8('image: %08x', 'x: %d', 'y: %d', 'imagex: %d', 'cmap2x2: %08x')", | |
428 image, x, y, imagex, cmap2x2); | |
429 ip_OUT_2x2_1BLK(ip, unsigned char, cmap2x2, row_inc); | |
430 } | |
431 | |
432 void XA_2x2_OUT_4BLKS_clr8(unsigned char *image, unsigned int x, unsigned int y, | |
433 unsigned int imagex, XA_2x2_Color *cm0, XA_2x2_Color *cm1, XA_2x2_Color *cm2, | |
434 XA_2x2_Color *cm3) | |
435 { | |
436 unsigned int row_inc = imagex - 3; | |
437 unsigned char *ip = (unsigned char *)(image + y * imagex + x); | |
438 | |
439 XA_Print("XA_2x2_OUT_1BLK_clr8('image: %08x', 'x: %d', 'y: %d', 'imagex: %d', 'cm0: %08x', 'cm1: %08x', 'cm2: %08x', 'cm3: %08x')", | |
440 image, x, y, imagex, cm0, cm1, cm2, cm3); | |
441 ip_OUT_2x2_2BLKS(ip, unsigned char, cm0, cm1, row_inc); | |
442 ip += row_inc; | |
443 ip_OUT_2x2_2BLKS(ip, unsigned char, cm2, cm3, row_inc); | |
444 } | |
445 | |
446 void *YUV2x2_Blk_Func(unsigned int image_type, int blks, unsigned int dith_flag) | |
447 { | |
448 void (*color_func)(); | |
449 | |
450 XA_Print("YUV2x2_Blk_Func('image_type: %d', 'blks: %d', 'dith_flag: %d')", | |
451 image_type, blks, dith_flag); | |
452 | |
453 if (blks == 1) | |
454 { | |
455 switch(image_type) | |
456 { | |
457 default: | |
458 color_func = XA_2x2_OUT_1BLK_clr8; | |
459 break; | |
460 } | |
461 } | |
462 else /* blks == 4 */ | |
463 { | |
464 switch(image_type) | |
465 { | |
466 default: | |
467 color_func = XA_2x2_OUT_4BLKS_clr8; | |
468 break; | |
469 } | |
470 } | |
471 | |
472 XA_Print("YUV2x2_Blk_Func -> %08x", color_func); | |
473 | |
474 return((void *)color_func); | |
475 } | |
476 | |
477 void *YUV2x2_Map_Func(unsigned int image_type, unsigned int dith_type) | |
478 { | |
479 XA_Print("YUV2x2_Map_Func('image_type: %d', 'dith_type: %d')", | |
480 image_type, dith_type); | |
481 } | |
482 | |
483 int XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)()) | |
484 { | |
485 XA_Print("XA_Add_Func_To_Free_Chain('anim_hdr: %08x', 'function: %08x')", | |
486 anim_hdr, function); | |
487 xacodec_driver->close_func = function; | |
488 } | |
489 | |
490 int XA_Gen_YUV_Tabs(XA_ANIM_HDR *anim_hdr) | |
491 { | |
492 XA_Print("XA_Gen_YUV_Tabs('anim_hdr: %08x')", anim_hdr); | |
493 | |
494 // XA_Print("anim type: %d - img[x: %d, y: %d, c: %d, d: %d]", | |
495 // anim_hdr->anim_type, anim_hdr->imagex, anim_hdr->imagey, | |
496 // anim_hdr->imagec, anim_hdr->imaged); | |
497 } | |
498 | |
499 void JPG_Setup_Samp_Limit_Table(XA_ANIM_HDR *anim_hdr) | |
500 { | |
501 XA_Print("JPG_Setup_Samp_Limit_Table('anim_hdr: %08x')", anim_hdr); | |
502 } | |
503 | |
504 void JPG_Alloc_MCU_Bufs(XA_ANIM_HDR *anim_hdr, unsigned int width, | |
505 unsigned int height, unsigned int full_flag) | |
506 { | |
507 XA_Print("JPG_Alloc_MCU_Bufs('anim_hdr: %08x', 'width: %d', 'height: %d', 'full_flag: %d')", | |
508 anim_hdr, width, height, full_flag); | |
509 } | |
510 | |
511 typedef struct | |
512 { | |
513 unsigned char *Ybuf; | |
514 unsigned char *Ubuf; | |
515 unsigned char *Vbuf; | |
516 unsigned char *the_buf; | |
517 unsigned int the_buf_size; | |
518 unsigned short y_w, y_h; | |
519 unsigned short uv_w, uv_h; | |
520 } YUVBufs; | |
521 | |
522 typedef struct | |
523 { | |
524 unsigned long Uskip_mask; | |
525 long *YUV_Y_tab; | |
526 long *YUV_UB_tab; | |
527 long *YUV_VR_tab; | |
528 long *YUV_UG_tab; | |
529 long *YUV_VG_tab; | |
530 } YUVTabs; | |
531 | |
532 #define XA_IMTYPE_RGB 0x0001 | |
533 | |
534 void XA_YUV1611_To_RGB(unsigned char *image, unsigned int imagex, unsigned int imagey, | |
535 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs, | |
536 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
537 { | |
538 XA_Print("XA_YUV1611_To_RGB('image: %08x', 'imagex: %d', 'imagey: %d', 'i_x: %d', 'i_y: %d', 'yuv_bufs: %08x', 'yuv_tabs: %08x', 'map_flag: %d', 'map: %08x', 'chdr: %08x')", | |
539 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr); | |
540 } | |
541 | |
542 void XA_YUV1611_To_CLR8(unsigned char *image, unsigned int imagex, unsigned int imagey, | |
543 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs, | |
544 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
545 { | |
546 XA_Print("XA_YUV1611_To_CLR8('image: %08x', 'imagex: %d', 'imagey: %d', 'i_x: %d', 'i_y: %d', 'yuv_bufs: %08x', 'yuv_tabs: %08x', 'map_flag: %d', 'map: %08x', 'chdr: %08x')", | |
547 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr); | |
548 } | |
549 | |
550 void *XA_YUV1611_Func(unsigned int image_type) | |
551 { | |
552 void (*color_func)(); | |
553 | |
554 XA_Print("XA_YUV1611_Func('image_type: %d')", image_type); | |
555 | |
556 switch(image_type) | |
557 { | |
558 case XA_IMTYPE_RGB: | |
559 color_func = XA_YUV1611_To_RGB; | |
560 break; | |
561 default: | |
562 color_func = XA_YUV1611_To_CLR8; | |
563 break; | |
564 } | |
565 | |
566 return((void *)color_func); | |
567 } | |
568 | |
569 unsigned long XA_Time_Read() | |
570 { | |
571 return(GetRelativeTime()); | |
572 } | |
573 | |
574 /* YUV 41 11 11 routines */ | |
575 void XA_YUV411111_To_RGB(unsigned char *image, unsigned int imagex, unsigned int imagey, | |
576 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs, | |
577 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
578 { | |
579 XA_Print("XA_YUV411111_To_RGB('image: %d', 'imagex: %d', 'imagey: %d', 'i_x: %d', 'i_y: %d', 'yuv_bufs: %08x', 'yuv_tabs: %08x', 'map_flag: %d', 'map: %08x', 'chdr: %08x')", | |
580 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr); | |
581 } | |
582 | |
583 | |
584 void *XA_YUV411111_Func(unsigned int image_type) | |
585 { | |
586 void (*color_func)(); | |
587 | |
588 XA_Print("XA_YUV411111_Func('image_type: %d')", image_type); | |
589 | |
590 switch(image_type) | |
591 { | |
592 case XA_IMTYPE_RGB: color_func = XA_YUV411111_To_RGB; break; | |
593 } | |
594 | |
595 return((void *)color_func); | |
596 } | |
597 | |
598 | |
599 YUVBufs jpg_YUVBufs; | |
600 YUVTabs def_yuv_tabs; | |
601 | |
602 /* *** EOF XANIM SHIT *** */ |