2372
|
1 /*
|
|
2 xacodec.c
|
|
3 XAnim Video Codec DLL support
|
|
4
|
|
5 (C) 2001 Alex Beregszaszi <alex@naxine.org>
|
|
6 */
|
|
7
|
|
8 #include <stdio.h>
|
2376
|
9 #include <stdlib.h>
|
|
10
|
2372
|
11 #include <dlfcn.h> /* dlsym, dlopen, dlclose */
|
|
12 #include <stdarg.h> /* va_alist, va_start, va_end */
|
|
13 #include <errno.h> /* strerror, errno */
|
|
14
|
2376
|
15 #include "config.h"
|
|
16 #define XACODEC_PATH "/usr/lib/xanim"
|
|
17
|
2373
|
18 #include "mp_msg.h"
|
2376
|
19 #include "bswap.h"
|
2372
|
20
|
|
21 #include "stream.h"
|
|
22 #include "demuxer.h"
|
|
23 #include "codec-cfg.h"
|
|
24 #include "stheader.h"
|
2376
|
25
|
|
26 //#include "loader/DirectShow/default.h"
|
|
27
|
2372
|
28 #include "libvo/img_format.h"
|
|
29 #include "xacodec.h"
|
|
30
|
|
31 #ifndef RTLD_NOW
|
|
32 #define RLTD_NOW 2
|
|
33 #endif
|
|
34 #ifndef RTLD_LAZY
|
|
35 #define RLTD_LAZY 1
|
|
36 #endif
|
|
37 #ifndef RTLD_GLOBAL
|
|
38 #define RLTD_GLOBAL 256
|
|
39 #endif
|
|
40
|
|
41 extern int verbose;
|
|
42
|
|
43 typedef struct xacodec_driver
|
|
44 {
|
|
45 XA_DEC_INFO *decinfo;
|
|
46 void *file_handler;
|
|
47 long (*iq_func)(XA_CODEC_HDR *codec_hdr);
|
|
48 unsigned int (*dec_func)(unsigned char *image, unsigned char *delta,
|
|
49 unsigned int dsize, XA_DEC_INFO *dec_info);
|
|
50 void (*close_func)();
|
|
51 } xacodec_driver_t;
|
|
52
|
|
53 xacodec_driver_t *xacodec_driver = NULL;
|
|
54
|
|
55
|
|
56 /* Needed by XAnim DLLs */
|
|
57 int XA_Print(char *fmt, ...)
|
|
58 {
|
|
59 va_list vallist;
|
|
60 char buf[1024];
|
|
61
|
|
62 va_start(vallist, fmt);
|
|
63 vsnprintf(buf, 1024, fmt, vallist);
|
2373
|
64 mp_msg(MSGT_DECVIDEO, MSGL_HINT, "[xacodec] %s", buf);
|
2372
|
65 va_end(vallist);
|
|
66 }
|
|
67
|
|
68 int TheEnd1(char *err_mess)
|
|
69 {
|
|
70 XA_Print("error: %s - exiting\n", err_mess);
|
|
71 xacodec_exit();
|
|
72 }
|
|
73 /* end of crap */
|
|
74
|
|
75 /* load, init and query */
|
|
76 int xacodec_init(char *filename, xacodec_driver_t *codec_driver)
|
|
77 {
|
|
78 void *(*what_the)();
|
|
79 char *error;
|
|
80 XAVID_MOD_HDR *mod_hdr;
|
|
81 XAVID_FUNC_HDR *func;
|
|
82 int i;
|
|
83
|
|
84 codec_driver->file_handler = dlopen(filename, RTLD_NOW|RTLD_GLOBAL);
|
|
85 if (!codec_driver->file_handler)
|
|
86 {
|
|
87 error = dlerror();
|
|
88 if (error)
|
2373
|
89 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to init %s while %s\n", filename, error);
|
2372
|
90 else
|
2373
|
91 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed ot init (dlopen) %s\n", filename);
|
2372
|
92 return(0);
|
|
93 }
|
|
94
|
|
95 what_the = dlsym(codec_driver->file_handler, "What_The");
|
|
96 if ((error = dlerror()) != NULL)
|
|
97 {
|
2373
|
98 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to init %s while %s\n", filename, error);
|
2372
|
99 dlclose(codec_driver->file_handler);
|
|
100 return(0);
|
|
101 }
|
|
102
|
|
103 mod_hdr = what_the();
|
|
104 if (!mod_hdr)
|
|
105 {
|
2373
|
106 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: 'What_The' function failed in %s\n", filename);
|
2372
|
107 dlclose(codec_driver->file_handler);
|
|
108 return(0);
|
|
109 }
|
|
110
|
2373
|
111 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "=== XAnim Codec ===\n");
|
|
112 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " Filename: %s (API revision: %x)\n", filename, mod_hdr->api_rev);
|
|
113 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " Codec: %s. Rev: %s\n", mod_hdr->desc, mod_hdr->rev);
|
2372
|
114 if (mod_hdr->copyright)
|
2373
|
115 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " %s\n", mod_hdr->copyright);
|
2372
|
116 if (mod_hdr->mod_author)
|
2373
|
117 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " Module Author(s): %s\n", mod_hdr->mod_author);
|
2372
|
118 if (mod_hdr->authors)
|
2373
|
119 mp_msg(MSGT_DECVIDEO, MSGL_INFO, " Codec Author(s): %s\n", mod_hdr->authors);
|
2372
|
120
|
|
121 if (mod_hdr->api_rev > XAVID_API_REV)
|
|
122 {
|
2373
|
123 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supported api revision in %s\n", filename);
|
2372
|
124 dlclose(codec_driver->file_handler);
|
|
125 return(0);
|
|
126 }
|
|
127
|
|
128 func = mod_hdr->funcs;
|
|
129 if (!func)
|
|
130 {
|
2373
|
131 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: function table error in %s\n", filename);
|
2372
|
132 dlclose(codec_driver->file_handler);
|
|
133 return(0);
|
|
134 }
|
|
135
|
|
136 if (verbose > 2)
|
|
137 printf("dump: funcs: 0x%08x (num %d)\n", mod_hdr->funcs, mod_hdr->num_funcs);
|
|
138 for (i = 0; i < mod_hdr->num_funcs; i++)
|
|
139 {
|
|
140 if (verbose > 2)
|
|
141 printf("dump(%d): %d %d [iq:0x%08x d:0x%08x]\n", i,
|
|
142 func[i].what, func[i].id, func[i].iq_func, func[i].dec_func);
|
|
143 if (func[i].what & XAVID_AVI_QUERY)
|
|
144 {
|
|
145 printf("0x%08x: avi init/query func (id: %d)\n",
|
|
146 func[i].iq_func, func[i].id);
|
|
147 codec_driver->iq_func = func[i].iq_func;
|
|
148 }
|
|
149 if (func[i].what & XAVID_QT_QUERY)
|
|
150 {
|
|
151 printf("0x%08x: qt init/query func (id: %d)\n",
|
|
152 func[i].iq_func, func[i].id);
|
|
153 codec_driver->iq_func = func[i].iq_func;
|
|
154 }
|
|
155 if (func[i].what & XAVID_DEC_FUNC)
|
|
156 {
|
|
157 printf("0x%08x: decoder func (init/query: 0x%08x) (id: %d)\n",
|
|
158 func[i].dec_func, func[i].iq_func, func[i].id);
|
|
159 codec_driver->dec_func = func[i].dec_func;
|
|
160 }
|
|
161 }
|
|
162 return(1);
|
|
163 }
|
|
164
|
|
165 int xacodec_query(xacodec_driver_t *codec_driver, XA_CODEC_HDR *codec_hdr)
|
|
166 {
|
|
167 long codec_ret;
|
|
168
|
|
169 codec_ret = codec_driver->iq_func(codec_hdr);
|
|
170 switch(codec_ret)
|
|
171 {
|
|
172 case CODEC_SUPPORTED:
|
|
173 codec_driver->dec_func = codec_hdr->decoder;
|
|
174 printf("Codec is supported: found decoder for %s at 0x%08x\n",
|
|
175 codec_hdr->description, codec_hdr->decoder);
|
|
176 return(1);
|
|
177 case CODEC_UNSUPPORTED:
|
|
178 printf("Codec is unsupported\n");
|
|
179 return(0);
|
|
180 case CODEC_UNKNOWN:
|
|
181 default:
|
|
182 printf("Codec is unknown\n");
|
|
183 return(0);
|
|
184 }
|
|
185 }
|
|
186
|
|
187 char *xacodec_def_path = XACODEC_PATH;
|
|
188
|
|
189 int xacodec_init_video(sh_video_t *vidinfo, int out_format)
|
|
190 {
|
|
191 char dll[1024];
|
|
192 XA_CODEC_HDR codec_hdr;
|
|
193
|
|
194 xacodec_driver = realloc(xacodec_driver, sizeof(struct xacodec_driver));
|
|
195 if (xacodec_driver == NULL)
|
|
196 return(0);
|
|
197
|
|
198 xacodec_driver->iq_func = NULL;
|
|
199 xacodec_driver->dec_func = NULL;
|
|
200 xacodec_driver->close_func = NULL;
|
|
201
|
|
202 snprintf(dll, 1024, "%s/%s", xacodec_def_path, vidinfo->codec->dll);
|
|
203 if (xacodec_init(dll, xacodec_driver) == 0)
|
|
204 return(0);
|
|
205
|
|
206 codec_hdr.anim_hdr = malloc(4096);
|
|
207 codec_hdr.description = vidinfo->codec->info;
|
|
208 codec_hdr.compression = bswap_32(vidinfo->format);
|
|
209 codec_hdr.decoder = NULL;
|
|
210 codec_hdr.avi_ctab_flag = 0;
|
|
211 codec_hdr.avi_read_ext = NULL;
|
|
212 codec_hdr.xapi_rev = 0x0001;
|
|
213 codec_hdr.extra = NULL;
|
|
214 codec_hdr.x = vidinfo->disp_w;
|
|
215 codec_hdr.y = vidinfo->disp_h;
|
|
216
|
|
217 switch(out_format)
|
|
218 {
|
|
219 case IMGFMT_RGB8:
|
|
220 codec_hdr.depth = 8;
|
|
221 break;
|
|
222 case IMGFMT_RGB15:
|
|
223 codec_hdr.depth = 15;
|
|
224 break;
|
|
225 case IMGFMT_RGB16:
|
|
226 codec_hdr.depth = 16;
|
|
227 break;
|
|
228 case IMGFMT_RGB24:
|
|
229 codec_hdr.depth = 24;
|
|
230 break;
|
|
231 case IMGFMT_RGB32:
|
|
232 codec_hdr.depth = 32;
|
|
233 break;
|
|
234 case IMGFMT_BGR8:
|
|
235 codec_hdr.depth = 8;
|
|
236 break;
|
|
237 case IMGFMT_BGR15:
|
|
238 codec_hdr.depth = 15;
|
|
239 break;
|
|
240 case IMGFMT_BGR16:
|
|
241 codec_hdr.depth = 16;
|
|
242 break;
|
|
243 case IMGFMT_BGR24:
|
|
244 codec_hdr.depth = 24;
|
|
245 break;
|
|
246 case IMGFMT_BGR32:
|
|
247 codec_hdr.depth = 32;
|
|
248 break;
|
|
249 default:
|
|
250 printf("xacodec: not supported image format (%s)\n",
|
|
251 vo_format_name(out_format));
|
|
252 return(0);
|
|
253 }
|
2376
|
254 mp_msg(MSGT_DECVIDEO,MSGL_INFO, "xacodec: querying for %dx%d %dbit [fourcc: %4x] (%s)...\n",
|
2372
|
255 codec_hdr.x, codec_hdr.y, codec_hdr.depth, codec_hdr.compression,
|
|
256 codec_hdr.description);
|
|
257
|
|
258 if (xacodec_query(xacodec_driver, &codec_hdr) == 0)
|
|
259 return(0);
|
|
260
|
|
261 // free(codec_hdr.anim_hdr);
|
|
262
|
|
263 xacodec_driver->decinfo = malloc(sizeof(XA_DEC_INFO));
|
|
264 xacodec_driver->decinfo->cmd = 0;
|
|
265 xacodec_driver->decinfo->skip_flag = 0;
|
|
266 xacodec_driver->decinfo->imagex = xacodec_driver->decinfo->xe = codec_hdr.x;
|
|
267 xacodec_driver->decinfo->imagey = xacodec_driver->decinfo->ye = codec_hdr.y;
|
|
268 xacodec_driver->decinfo->imaged = codec_hdr.depth;
|
|
269 xacodec_driver->decinfo->chdr = NULL;
|
|
270 xacodec_driver->decinfo->map_flag = 0; /* xaFALSE */
|
|
271 xacodec_driver->decinfo->map = NULL;
|
|
272 xacodec_driver->decinfo->xs = xacodec_driver->decinfo->ys = 0;
|
|
273 xacodec_driver->decinfo->special = 0;
|
|
274 xacodec_driver->decinfo->extra = codec_hdr.extra;
|
|
275
|
|
276 vidinfo->our_out_buffer = malloc(codec_hdr.y * codec_hdr.x * codec_hdr.depth);
|
|
277
|
|
278 printf("out_buf size: %d\n", codec_hdr.y * codec_hdr.x * codec_hdr.depth);
|
|
279
|
|
280 if (vidinfo->our_out_buffer == NULL)
|
|
281 {
|
2376
|
282 mp_msg(MSGT_DECVIDEO,MSGL_ERR, "cannot allocate memory for output: %s",
|
2372
|
283 strerror(errno));
|
|
284 return(0);
|
|
285 }
|
|
286
|
|
287 printf("extra: %08x - %dx%d %dbit\n", codec_hdr.extra,
|
|
288 codec_hdr.x, codec_hdr.y, codec_hdr.depth);
|
|
289 return(1);
|
|
290 }
|
|
291
|
|
292 #define ACT_DLT_NORM 0x00000000
|
|
293 #define ACT_DLT_BODY 0x00000001
|
|
294 #define ACT_DLT_XOR 0x00000002
|
|
295 #define ACT_DLT_NOP 0x00000004
|
|
296 #define ACT_DLT_MAPD 0x00000008
|
|
297 #define ACT_DLT_DROP 0x00000010
|
|
298 #define ACT_DLT_BAD 0x80000000
|
|
299
|
|
300 // unsigned int (*dec_func)(unsigned char *image, unsigned char *delta,
|
|
301 // unsigned int dsize, XA_DEC_INFO *dec_info);
|
|
302
|
|
303 int xacodec_decode_frame(uint8_t *frame, int frame_size,
|
|
304 uint8_t *dest, int skip_flag)
|
|
305 {
|
|
306 unsigned int ret;
|
|
307 int i;
|
|
308
|
|
309 if (skip_flag > 0)
|
|
310 printf("frame will be dropped..\n");
|
|
311
|
|
312 xacodec_driver->decinfo->skip_flag = skip_flag;
|
|
313
|
|
314 printf("frame: %08x (size: %d) - dest: %08x\n", frame, frame_size, dest);
|
|
315
|
|
316 ret = xacodec_driver->dec_func(dest, frame, frame_size, xacodec_driver->decinfo);
|
|
317
|
|
318 printf("ret: %lu : ", ret);
|
|
319
|
|
320 for (i = 0; i < 10; i++)
|
|
321 {
|
|
322 if (frame[i] != dest[i])
|
|
323 printf("%d: [%02x] != [%02x] ", i, frame[i], dest[i]);
|
|
324 else
|
|
325 printf("%d: [%02x] ", frame[i]);
|
|
326 }
|
|
327
|
|
328 if (ret == ACT_DLT_NORM)
|
|
329 {
|
|
330 printf("norm\n");
|
|
331 return(TRUE);
|
|
332 }
|
|
333
|
|
334 /*
|
|
335 if (!(ret & ACT_DLT_MAPD))
|
|
336 xacodec_driver->decinfo->map_flag = 0;
|
|
337 else
|
|
338 {
|
|
339 xacodec_driver->decinfo->map_flag = 1;
|
|
340 xacodec_driver->decinfo->map = ...
|
|
341 }
|
|
342 */
|
|
343
|
|
344 if (ret & ACT_DLT_NOP)
|
|
345 {
|
|
346 printf("nop\n");
|
|
347 return(FALSE); /* dst = 0 */
|
|
348 }
|
|
349
|
|
350 if (ret & ACT_DLT_DROP) /* by skip frames and errors */
|
|
351 {
|
|
352 printf("drop\n");
|
|
353 return(FALSE);
|
|
354 }
|
|
355
|
|
356
|
|
357 if (ret & ACT_DLT_BAD)
|
|
358 {
|
|
359 printf("bad\n");
|
|
360 return(FALSE);
|
|
361 }
|
|
362
|
|
363 if (ret & ACT_DLT_BODY)
|
|
364 {
|
|
365 printf("body\n");
|
|
366 return(TRUE);
|
|
367 }
|
|
368
|
|
369 if (ret & ACT_DLT_XOR)
|
|
370 {
|
|
371 printf("xor\n");
|
|
372 return(TRUE);
|
|
373 }
|
|
374
|
|
375 return(FALSE);
|
|
376 }
|
|
377
|
|
378 int xacodec_exit()
|
|
379 {
|
|
380 if (xacodec_driver->close_func)
|
|
381 xacodec_driver->close_func();
|
|
382 dlclose(xacodec_driver->file_handler);
|
|
383 if (xacodec_driver->decinfo != NULL)
|
|
384 free(xacodec_driver->decinfo);
|
|
385 if (xacodec_driver != NULL)
|
|
386 free(xacodec_driver);
|
|
387 return(TRUE);
|
|
388 }
|
2373
|
389
|
|
390
|
|
391 /* *** XANIM SHIT *** */
|
|
392 /* like loader/win32.c - mini XANIM library */
|
|
393
|
|
394 typedef struct
|
|
395 {
|
|
396 unsigned char r0, g0, b0;
|
|
397 unsigned char r1, g1, b1;
|
|
398 unsigned char r2, g2, b2;
|
|
399 unsigned char r3, g3, b3;
|
|
400 unsigned int clr0_0, clr0_1, clr0_2, clr0_3;
|
|
401 unsigned int clr1_0, clr1_1, clr1_2, clr1_3;
|
|
402 unsigned int clr2_0, clr2_1, clr2_2, clr2_3;
|
|
403 unsigned int clr3_0, clr3_1, clr3_2, clr3_3;
|
|
404 } XA_2x2_Color;
|
|
405
|
|
406 #define ip_OUT_2x2_1BLK(ip, CAST, cmap2x2, rinc) { register CAST d0, d1; \
|
|
407 *ip++ = d0 = (CAST)(cmap2x2->clr0_0); *ip++ = d0; \
|
|
408 *ip++ = d1 = (CAST)(cmap2x2->clr1_0); *ip = d1; \
|
|
409 ip += rinc; \
|
|
410 *ip++ = d0; *ip++ = d0; *ip++ = d1; *ip = d1; ip += rinc; \
|
|
411 *ip++ = d0 = (CAST)(cmap2x2->clr2_0); *ip++ = d0; \
|
|
412 *ip++ = d1 = (CAST)(cmap2x2->clr3_0); *ip = d1; \
|
|
413 ip += rinc; *ip++ = d0; *ip++ = d0; *ip++ = d1; *ip++ = d1; }
|
|
414
|
|
415 #define ip_OUT_2x2_2BLKS(ip, CAST, c2x2map0, c2x2map1, rinc) { \
|
|
416 *ip++ = (CAST)(c2x2map0->clr0_0); \
|
|
417 *ip++ = (CAST)(c2x2map0->clr1_0); \
|
|
418 *ip++ = (CAST)(c2x2map1->clr0_0); \
|
|
419 *ip = (CAST)(c2x2map1->clr1_0); ip += rinc; \
|
|
420 *ip++ = (CAST)(c2x2map0->clr2_0); \
|
|
421 *ip++ = (CAST)(c2x2map0->clr3_0); \
|
|
422 *ip++ = (CAST)(c2x2map1->clr2_0); \
|
|
423 *ip = (CAST)(c2x2map1->clr3_0); }
|
|
424
|
|
425 void XA_2x2_OUT_1BLK_clr8(unsigned char *image, unsigned int x, unsigned int y,
|
|
426 unsigned int imagex, XA_2x2_Color *cmap2x2)
|
|
427 {
|
|
428 unsigned int row_inc = imagex - 3;
|
|
429 unsigned char *ip = (unsigned char *)(image + y * imagex + x);
|
|
430
|
|
431 XA_Print("XA_2x2_OUT_1BLK_clr8('image: %08x', 'x: %d', 'y: %d', 'imagex: %d', 'cmap2x2: %08x')",
|
|
432 image, x, y, imagex, cmap2x2);
|
|
433 ip_OUT_2x2_1BLK(ip, unsigned char, cmap2x2, row_inc);
|
|
434 }
|
|
435
|
|
436 void XA_2x2_OUT_4BLKS_clr8(unsigned char *image, unsigned int x, unsigned int y,
|
|
437 unsigned int imagex, XA_2x2_Color *cm0, XA_2x2_Color *cm1, XA_2x2_Color *cm2,
|
|
438 XA_2x2_Color *cm3)
|
|
439 {
|
|
440 unsigned int row_inc = imagex - 3;
|
|
441 unsigned char *ip = (unsigned char *)(image + y * imagex + x);
|
|
442
|
|
443 XA_Print("XA_2x2_OUT_1BLK_clr8('image: %08x', 'x: %d', 'y: %d', 'imagex: %d', 'cm0: %08x', 'cm1: %08x', 'cm2: %08x', 'cm3: %08x')",
|
|
444 image, x, y, imagex, cm0, cm1, cm2, cm3);
|
|
445 ip_OUT_2x2_2BLKS(ip, unsigned char, cm0, cm1, row_inc);
|
|
446 ip += row_inc;
|
|
447 ip_OUT_2x2_2BLKS(ip, unsigned char, cm2, cm3, row_inc);
|
|
448 }
|
|
449
|
|
450 void *YUV2x2_Blk_Func(unsigned int image_type, int blks, unsigned int dith_flag)
|
|
451 {
|
|
452 void (*color_func)();
|
|
453
|
|
454 XA_Print("YUV2x2_Blk_Func('image_type: %d', 'blks: %d', 'dith_flag: %d')",
|
|
455 image_type, blks, dith_flag);
|
|
456
|
|
457 if (blks == 1)
|
|
458 {
|
|
459 switch(image_type)
|
|
460 {
|
|
461 default:
|
|
462 color_func = XA_2x2_OUT_1BLK_clr8;
|
|
463 break;
|
|
464 }
|
|
465 }
|
|
466 else /* blks == 4 */
|
|
467 {
|
|
468 switch(image_type)
|
|
469 {
|
|
470 default:
|
|
471 color_func = XA_2x2_OUT_4BLKS_clr8;
|
|
472 break;
|
|
473 }
|
|
474 }
|
|
475
|
|
476 XA_Print("YUV2x2_Blk_Func -> %08x", color_func);
|
|
477
|
|
478 return((void *)color_func);
|
|
479 }
|
|
480
|
|
481 void *YUV2x2_Map_Func(unsigned int image_type, unsigned int dith_type)
|
|
482 {
|
|
483 XA_Print("YUV2x2_Map_Func('image_type: %d', 'dith_type: %d')",
|
|
484 image_type, dith_type);
|
|
485 }
|
|
486
|
|
487 int XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)())
|
|
488 {
|
|
489 XA_Print("XA_Add_Func_To_Free_Chain('anim_hdr: %08x', 'function: %08x')",
|
|
490 anim_hdr, function);
|
|
491 xacodec_driver->close_func = function;
|
|
492 }
|
|
493
|
|
494 int XA_Gen_YUV_Tabs(XA_ANIM_HDR *anim_hdr)
|
|
495 {
|
|
496 XA_Print("XA_Gen_YUV_Tabs('anim_hdr: %08x')", anim_hdr);
|
|
497
|
|
498 // XA_Print("anim type: %d - img[x: %d, y: %d, c: %d, d: %d]",
|
|
499 // anim_hdr->anim_type, anim_hdr->imagex, anim_hdr->imagey,
|
|
500 // anim_hdr->imagec, anim_hdr->imaged);
|
|
501 }
|
|
502
|
|
503 void JPG_Setup_Samp_Limit_Table(XA_ANIM_HDR *anim_hdr)
|
|
504 {
|
|
505 XA_Print("JPG_Setup_Samp_Limit_Table('anim_hdr: %08x')", anim_hdr);
|
|
506 }
|
|
507
|
|
508 void JPG_Alloc_MCU_Bufs(XA_ANIM_HDR *anim_hdr, unsigned int width,
|
|
509 unsigned int height, unsigned int full_flag)
|
|
510 {
|
|
511 XA_Print("JPG_Alloc_MCU_Bufs('anim_hdr: %08x', 'width: %d', 'height: %d', 'full_flag: %d')",
|
|
512 anim_hdr, width, height, full_flag);
|
|
513 }
|
|
514
|
|
515 typedef struct
|
|
516 {
|
|
517 unsigned char *Ybuf;
|
|
518 unsigned char *Ubuf;
|
|
519 unsigned char *Vbuf;
|
|
520 unsigned char *the_buf;
|
|
521 unsigned int the_buf_size;
|
|
522 unsigned short y_w, y_h;
|
|
523 unsigned short uv_w, uv_h;
|
|
524 } YUVBufs;
|
|
525
|
|
526 typedef struct
|
|
527 {
|
|
528 unsigned long Uskip_mask;
|
|
529 long *YUV_Y_tab;
|
|
530 long *YUV_UB_tab;
|
|
531 long *YUV_VR_tab;
|
|
532 long *YUV_UG_tab;
|
|
533 long *YUV_VG_tab;
|
|
534 } YUVTabs;
|
|
535
|
|
536 #define XA_IMTYPE_RGB 0x0001
|
|
537
|
|
538 void XA_YUV1611_To_RGB(unsigned char *image, unsigned int imagex, unsigned int imagey,
|
|
539 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs,
|
|
540 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr)
|
|
541 {
|
|
542 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')",
|
|
543 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr);
|
|
544 }
|
|
545
|
|
546 void XA_YUV1611_To_CLR8(unsigned char *image, unsigned int imagex, unsigned int imagey,
|
|
547 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs,
|
|
548 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr)
|
|
549 {
|
|
550 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')",
|
|
551 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr);
|
|
552 }
|
|
553
|
|
554 void *XA_YUV1611_Func(unsigned int image_type)
|
|
555 {
|
|
556 void (*color_func)();
|
|
557
|
|
558 XA_Print("XA_YUV1611_Func('image_type: %d')", image_type);
|
|
559
|
|
560 switch(image_type)
|
|
561 {
|
|
562 case XA_IMTYPE_RGB:
|
|
563 color_func = XA_YUV1611_To_RGB;
|
|
564 break;
|
|
565 default:
|
|
566 color_func = XA_YUV1611_To_CLR8;
|
|
567 break;
|
|
568 }
|
|
569
|
|
570 return((void *)color_func);
|
|
571 }
|
|
572
|
|
573 unsigned long XA_Time_Read()
|
|
574 {
|
|
575 return(GetRelativeTime());
|
|
576 }
|
|
577
|
|
578 /* YUV 41 11 11 routines */
|
|
579 void XA_YUV411111_To_RGB(unsigned char *image, unsigned int imagex, unsigned int imagey,
|
|
580 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs,
|
|
581 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr)
|
|
582 {
|
|
583 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')",
|
|
584 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr);
|
|
585 }
|
|
586
|
|
587
|
|
588 void *XA_YUV411111_Func(unsigned int image_type)
|
|
589 {
|
|
590 void (*color_func)();
|
|
591
|
|
592 XA_Print("XA_YUV411111_Func('image_type: %d')", image_type);
|
|
593
|
|
594 switch(image_type)
|
|
595 {
|
|
596 case XA_IMTYPE_RGB: color_func = XA_YUV411111_To_RGB; break;
|
|
597 }
|
|
598
|
|
599 return((void *)color_func);
|
|
600 }
|
|
601
|
|
602
|
|
603 YUVBufs jpg_YUVBufs;
|
|
604 YUVTabs def_yuv_tabs;
|
|
605
|
|
606 /* *** EOF XANIM SHIT *** */
|