annotate xacodec.c @ 2377:3ad626921328

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