Mercurial > mplayer.hg
annotate libmpcodecs/vd_xanim.c @ 7329:9129781e5939
removed messy global 'tv_handle', use stream->priv for that purpose
note: i couldn't test it (only compile test) may be broken :(
we're going to an unified demuxer API - required for modularization
author | arpi |
---|---|
date | Sun, 08 Sep 2002 23:00:01 +0000 |
parents | 641b287f8b07 |
children | 04df35721744 |
rev | line source |
---|---|
7285 | 1 /* |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
2 XAnim Video Codec DLL support |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
3 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
4 It partly emulates the Xanim codebase. |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
5 You need the -rdynamic flag to use this with gcc. |
7285 | 6 |
7 (C) 2001 Alex Beregszaszi <alex@naxine.org> | |
8 and Arpad Gereoffy <arpi@thot.banki.hu> | |
9 */ | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
10 |
4969 | 11 #include <stdio.h> |
12 #include <stdlib.h> | |
7285 | 13 #include <string.h> /* strerror */ |
4969 | 14 |
15 #include "config.h" | |
7285 | 16 |
4969 | 17 #ifdef USE_XANIM |
18 #include "mp_msg.h" | |
19 | |
20 #include "vd_internal.h" | |
21 | |
22 static vd_info_t info = { | |
23 "XAnim codecs", | |
24 "xanim", | |
25 "A'rpi & Alex", | |
5272 | 26 "Xanim (http://xanim.va.pubnix.com/)", |
4969 | 27 "binary codec plugins" |
28 }; | |
29 | |
30 LIBVD_EXTERN(xanim) | |
31 | |
7285 | 32 #ifdef __FreeBSD__ |
33 #include <unistd.h> | |
34 #endif | |
35 | |
36 #include <dlfcn.h> /* dlsym, dlopen, dlclose */ | |
37 #include <stdarg.h> /* va_alist, va_start, va_end */ | |
38 #include <errno.h> /* strerror, errno */ | |
39 | |
40 #include "mp_msg.h" | |
41 #include "bswap.h" | |
42 | |
43 #include "linux/timer.h" | |
44 #include "libvo/fastmemcpy.h" | |
45 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
46 #if 0 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
47 /* this should be removed */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
48 #ifndef RTLD_NOW |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
49 #define RLTD_NOW 2 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
50 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
51 #ifndef RTLD_LAZY |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
52 #define RLTD_LAZY 1 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
53 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
54 #ifndef RTLD_GLOBAL |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
55 #define RLTD_GLOBAL 256 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
56 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
57 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
58 |
7285 | 59 typedef struct |
60 { | |
61 unsigned int what; | |
62 unsigned int id; | |
63 int (*iq_func)(); /* init/query function */ | |
64 unsigned int (*dec_func)(); /* opt decode function */ | |
65 } XAVID_FUNC_HDR; | |
66 | |
67 #define XAVID_WHAT_NO_MORE 0x0000 | |
68 #define XAVID_AVI_QUERY 0x0001 | |
69 #define XAVID_QT_QUERY 0x0002 | |
70 #define XAVID_DEC_FUNC 0x0100 | |
71 | |
72 #define XAVID_API_REV 0x0003 | |
73 | |
74 typedef struct | |
75 { | |
76 unsigned int api_rev; | |
77 char *desc; | |
78 char *rev; | |
79 char *copyright; | |
80 char *mod_author; | |
81 char *authors; | |
82 unsigned int num_funcs; | |
83 XAVID_FUNC_HDR *funcs; | |
84 } XAVID_MOD_HDR; | |
85 | |
86 /* XA CODEC .. */ | |
87 typedef struct | |
88 { | |
89 void *anim_hdr; | |
90 unsigned int compression; | |
91 unsigned int x, y; | |
92 unsigned int depth; | |
93 void *extra; | |
94 unsigned int xapi_rev; | |
95 unsigned int (*decoder)(); | |
96 char *description; | |
97 unsigned int avi_ctab_flag; | |
98 unsigned int (*avi_read_ext)(); | |
99 } XA_CODEC_HDR; | |
100 | |
101 #define CODEC_SUPPORTED 1 | |
102 #define CODEC_UNKNOWN 0 | |
103 #define CODEC_UNSUPPORTED -1 | |
104 | |
105 /* fuckin colormap structures for xanim */ | |
106 typedef struct | |
107 { | |
108 unsigned short red; | |
109 unsigned short green; | |
110 unsigned short blue; | |
111 unsigned short gray; | |
112 } ColorReg; | |
113 | |
114 typedef struct XA_ACTION_STRUCT | |
115 { | |
116 int type; | |
117 int cmap_rev; | |
118 unsigned char *data; | |
119 struct XA_ACTION_STRUCT *next; | |
120 struct XA_CHDR_STRUCT *chdr; | |
121 ColorReg *h_cmap; | |
122 unsigned int *map; | |
123 struct XA_ACTION_STRUCT *next_same_chdr; | |
124 } XA_ACTION; | |
125 | |
126 typedef struct XA_CHDR_STRUCT | |
127 { | |
128 unsigned int rev; | |
129 ColorReg *cmap; | |
130 unsigned int csize, coff; | |
131 unsigned int *map; | |
132 unsigned int msize, moff; | |
133 struct XA_CHDR_STRUCT *next; | |
134 XA_ACTION *acts; | |
135 struct XA_CHDR_STRUCT *new_chdr; | |
136 } XA_CHDR; | |
137 | |
138 typedef struct | |
139 { | |
140 unsigned int cmd; | |
141 unsigned int skip_flag; | |
142 unsigned int imagex, imagey; /* image buffer size */ | |
143 unsigned int imaged; /* image depth */ | |
144 XA_CHDR *chdr; /* color map header */ | |
145 unsigned int map_flag; | |
146 unsigned int *map; | |
147 unsigned int xs, ys; | |
148 unsigned int xe, ye; | |
149 unsigned int special; | |
150 void *extra; | |
151 } XA_DEC_INFO; | |
152 | |
153 typedef struct | |
154 { | |
155 unsigned int file_num; | |
156 unsigned int anim_type; | |
157 unsigned int imagex; | |
158 unsigned int imagey; | |
159 unsigned int imagec; | |
160 unsigned int imaged; | |
161 } XA_ANIM_HDR; | |
162 | |
163 typedef struct { | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
164 XA_DEC_INFO *decinfo; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
165 void *file_handler; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
166 long (*iq_func)(XA_CODEC_HDR *codec_hdr); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
167 unsigned int (*dec_func)(unsigned char *image, unsigned char *delta, |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
168 unsigned int dsize, XA_DEC_INFO *dec_info); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
169 } vd_xanim_ctx; |
7285 | 170 |
171 #if 0 | |
172 typedef char xaBYTE; | |
173 typedef short xaSHORT; | |
174 typedef int xaLONG; | |
175 | |
176 typedef unsigned char xaUBYTE; | |
177 typedef unsigned short xaUSHORT; | |
178 typedef unsigned int xaULONG; | |
179 #endif | |
180 | |
181 #define xaFALSE 0 | |
182 #define xaTRUE 1 | |
183 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
184 #define ACT_DLTA_NORM 0x00000000 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
185 #define ACT_DLTA_BODY 0x00000001 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
186 #define ACT_DLTA_XOR 0x00000002 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
187 #define ACT_DLTA_NOP 0x00000004 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
188 #define ACT_DLTA_MAPD 0x00000008 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
189 #define ACT_DLTA_DROP 0x00000010 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
190 #define ACT_DLTA_BAD 0x80000000 |
7285 | 191 |
192 #define XA_CLOSE_FUNCS 5 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
193 int xa_close_funcs = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
194 void *xa_close_func[XA_CLOSE_FUNCS]; |
7285 | 195 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
196 /* load, init and query */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
197 static int xacodec_load(sh_video_t *sh, char *filename) |
7285 | 198 { |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
199 vd_xanim_ctx *priv = sh->context; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
200 void *(*what_the)(); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
201 char *error; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
202 XAVID_MOD_HDR *mod_hdr; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
203 XAVID_FUNC_HDR *func; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
204 int i; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
205 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
206 priv->file_handler = dlopen(filename, RTLD_NOW|RTLD_GLOBAL); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
207 if (!priv->file_handler) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
208 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
209 error = dlerror(); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
210 if (error) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
211 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to dlopen %s while %s\n", filename, error); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
212 else |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
213 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to dlopen %s\n", filename); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
214 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
215 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
216 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
217 what_the = dlsym(priv->file_handler, "What_The"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
218 if ((error = dlerror()) != NULL) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
219 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
220 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: failed to init %s while %s\n", filename, error); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
221 dlclose(priv->file_handler); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
222 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
223 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
224 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
225 mod_hdr = what_the(); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
226 if (!mod_hdr) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
227 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
228 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: initializer function failed in %s\n", filename); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
229 dlclose(priv->file_handler); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
230 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
231 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
232 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
233 mp_msg(MSGT_DECVIDEO, MSGL_V, "=== XAnim Codec ===\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
234 mp_msg(MSGT_DECVIDEO, MSGL_V, " Filename: %s (API revision: %x)\n", filename, mod_hdr->api_rev); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
235 mp_msg(MSGT_DECVIDEO, MSGL_V, " Codec: %s. Rev: %s\n", mod_hdr->desc, mod_hdr->rev); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
236 if (mod_hdr->copyright) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
237 mp_msg(MSGT_DECVIDEO, MSGL_V, " %s\n", mod_hdr->copyright); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
238 if (mod_hdr->mod_author) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
239 mp_msg(MSGT_DECVIDEO, MSGL_V, " Module Author(s): %s\n", mod_hdr->mod_author); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
240 if (mod_hdr->authors) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
241 mp_msg(MSGT_DECVIDEO, MSGL_V, " Codec Author(s): %s\n", mod_hdr->authors); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
242 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
243 if (mod_hdr->api_rev > XAVID_API_REV) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
244 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
245 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supported api revision (%d) in %s\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
246 mod_hdr->api_rev, filename); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
247 dlclose(priv->file_handler); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
248 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
249 } |
7285 | 250 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
251 func = mod_hdr->funcs; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
252 if (!func) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
253 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
254 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: function table error in %s\n", filename); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
255 dlclose(priv->file_handler); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
256 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
257 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
258 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
259 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Exported functions by codec: [functable: 0x%08x entries: %d]\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
260 mod_hdr->funcs, mod_hdr->num_funcs); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
261 for (i = 0; i < (int)mod_hdr->num_funcs; i++) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
262 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
263 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " %d: %d %d [iq:0x%08x d:0x%08x]\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
264 i, func[i].what, func[i].id, func[i].iq_func, func[i].dec_func); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
265 if (func[i].what & XAVID_AVI_QUERY) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
266 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
267 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " 0x%08x: avi init/query func (id: %d)\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
268 func[i].iq_func, func[i].id); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
269 priv->iq_func = (void *)func[i].iq_func; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
270 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
271 if (func[i].what & XAVID_QT_QUERY) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
272 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
273 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " 0x%08x: qt init/query func (id: %d)\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
274 func[i].iq_func, func[i].id); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
275 priv->iq_func = (void *)func[i].iq_func; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
276 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
277 if (func[i].what & XAVID_DEC_FUNC) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
278 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
279 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, " 0x%08x: decoder func (init/query: 0x%08x) (id: %d)\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
280 func[i].dec_func, func[i].iq_func, func[i].id); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
281 priv->dec_func = (void *)func[i].dec_func; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
282 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
283 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
284 return(1); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
285 } |
7285 | 286 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
287 static int xacodec_query(sh_video_t *sh, XA_CODEC_HDR *codec_hdr) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
288 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
289 vd_xanim_ctx *priv = sh->context; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
290 long ret; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
291 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
292 #if 0 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
293 /* the brute one */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
294 if (priv->dec_func) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
295 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
296 codec_hdr->decoder = priv->dec_func; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
297 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "We got decoder's address at init! %p\n", codec_hdr->decoder); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
298 return(1); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
299 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
300 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
301 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
302 ret = priv->iq_func(codec_hdr); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
303 switch(ret) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
304 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
305 case CODEC_SUPPORTED: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
306 priv->dec_func = (void *)codec_hdr->decoder; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
307 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "Codec is supported: found decoder for %s at 0x%08x\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
308 codec_hdr->description, codec_hdr->decoder); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
309 return(1); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
310 case CODEC_UNSUPPORTED: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
311 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "Codec (%s) is unsupported by dll\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
312 codec_hdr->description); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
313 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
314 case CODEC_UNKNOWN: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
315 default: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
316 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "Codec (%s) is unknown by dll\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
317 codec_hdr->description); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
318 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
319 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
320 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
321 |
7285 | 322 void XA_Print(char *fmt, ...) |
323 { | |
324 va_list vallist; | |
325 char buf[1024]; | |
326 | |
327 va_start(vallist, fmt); | |
328 vsnprintf(buf, 1024, fmt, vallist); | |
329 mp_msg(MSGT_XACODEC, MSGL_DBG2, "[xacodec] %s\n", buf); | |
330 va_end(vallist); | |
331 | |
332 return; | |
333 } | |
334 | |
335 /* 0 is no debug (needed by 3ivX) */ | |
336 long xa_debug = 0; | |
337 | |
338 void TheEnd1(char *err_mess) | |
339 { | |
340 XA_Print("error: %s - exiting\n", err_mess); | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
341 /* we should exit here... */ |
7285 | 342 |
343 return; | |
344 } | |
345 | |
346 void XA_Add_Func_To_Free_Chain(XA_ANIM_HDR *anim_hdr, void (*function)()) | |
347 { | |
348 // XA_Print("XA_Add_Func_To_Free_Chain('anim_hdr: %08x', 'function: %08x')", | |
349 // anim_hdr, function); | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
350 xa_close_func[xa_close_funcs] = function; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
351 if (xa_close_funcs+1 < XA_CLOSE_FUNCS) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
352 xa_close_funcs++; |
7285 | 353 |
354 return; | |
355 } | |
356 | |
357 | |
358 unsigned long XA_Time_Read() | |
359 { | |
360 return GetTimer(); //(GetRelativeTime()); | |
361 } | |
362 | |
363 void XA_dummy() | |
364 { | |
365 XA_Print("dummy() called"); | |
366 } | |
367 | |
368 void XA_Gen_YUV_Tabs(XA_ANIM_HDR *anim_hdr) | |
369 { | |
370 XA_Print("XA_Gen_YUV_Tabs('anim_hdr: %08x')", anim_hdr); | |
371 return; | |
372 } | |
373 | |
374 void JPG_Setup_Samp_Limit_Table(XA_ANIM_HDR *anim_hdr) | |
375 { | |
376 XA_Print("JPG_Setup_Samp_Limit_Table('anim_hdr: %08x')", anim_hdr); | |
377 return; | |
378 } | |
379 | |
380 void JPG_Alloc_MCU_Bufs(XA_ANIM_HDR *anim_hdr, unsigned int width, | |
381 unsigned int height, unsigned int full_flag) | |
382 { | |
383 XA_Print("JPG_Alloc_MCU_Bufs('anim_hdr: %08x', 'width: %d', 'height: %d', 'full_flag: %d')", | |
384 anim_hdr, width, height, full_flag); | |
385 return; | |
386 } | |
387 | |
388 /* --------------- 4x4 pixel YUV block fillers [CVID] ----------------- */ | |
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 SET_4_YUV_PIXELS(image,x,y,cmap2x2) \ | |
403 image->planes[0][((x)+0)+((y)+0)*image->stride[0]]=cmap2x2->clr0_0;\ | |
404 image->planes[0][((x)+1)+((y)+0)*image->stride[0]]=cmap2x2->clr0_1;\ | |
405 image->planes[0][((x)+0)+((y)+1)*image->stride[0]]=cmap2x2->clr0_2;\ | |
406 image->planes[0][((x)+1)+((y)+1)*image->stride[0]]=cmap2x2->clr0_3;\ | |
407 image->planes[1][((x)>>1)+((y)>>1)*image->stride[1]]=cmap2x2->clr1_0;\ | |
408 image->planes[2][((x)>>1)+((y)>>1)*image->stride[2]]=cmap2x2->clr1_1; | |
409 | |
410 void XA_2x2_OUT_1BLK_Convert(unsigned char *image_p, unsigned int x, unsigned int y, | |
411 unsigned int imagex, XA_2x2_Color *cmap2x2) | |
412 { | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
413 mp_image_t *mpi = (mp_image_t *)image_p; |
7285 | 414 |
415 #if 0 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
416 SET_4_YUV_PIXELS(mpi,x,y,cmap2x2) |
7285 | 417 #else |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
418 SET_4_YUV_PIXELS(mpi,x,y,cmap2x2) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
419 SET_4_YUV_PIXELS(mpi,x+2,y,cmap2x2) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
420 SET_4_YUV_PIXELS(mpi,x,y+2,cmap2x2) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
421 SET_4_YUV_PIXELS(mpi,x+2,y+2,cmap2x2) |
7285 | 422 #endif |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
423 |
7285 | 424 return; |
425 } | |
426 | |
427 void XA_2x2_OUT_4BLKS_Convert(unsigned char *image_p, unsigned int x, unsigned int y, | |
428 unsigned int imagex, XA_2x2_Color *cm0, XA_2x2_Color *cm1, XA_2x2_Color *cm2, | |
429 XA_2x2_Color *cm3) | |
430 { | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
431 mp_image_t *mpi = (mp_image_t *)image_p; |
7285 | 432 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
433 SET_4_YUV_PIXELS(mpi,x,y,cm0) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
434 SET_4_YUV_PIXELS(mpi,x+2,y,cm1) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
435 SET_4_YUV_PIXELS(mpi,x,y+2,cm2) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
436 SET_4_YUV_PIXELS(mpi,x+2,y+2,cm3) |
7285 | 437 return; |
438 } | |
439 | |
440 void *YUV2x2_Blk_Func(unsigned int image_type, int blks, unsigned int dith_flag) | |
441 { | |
442 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUV2x2_Blk_Func(image_type=%d, blks=%d, dith_flag=%d)\n", | |
443 image_type, blks, dith_flag); | |
444 switch(blks){ | |
445 case 1: | |
446 return (void*) XA_2x2_OUT_1BLK_Convert; | |
447 case 4: | |
448 return (void*) XA_2x2_OUT_4BLKS_Convert; | |
449 } | |
450 | |
451 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Unimplemented: YUV2x2_Blk_Func(image_type=%d blks=%d dith=%d)\n",image_type,blks,dith_flag); | |
452 return (void*) XA_dummy; | |
453 } | |
454 | |
455 // Take Four Y's and UV and put them into a 2x2 Color structure. | |
456 | |
457 void XA_YUV_2x2_clr(XA_2x2_Color *cmap2x2, unsigned int Y0, unsigned int Y1, | |
458 unsigned int Y2, unsigned int Y3, unsigned int U, unsigned int V, | |
459 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
460 { | |
461 | |
462 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV_2x2_clr(%p [%d,%d,%d,%d][%d][%d] %d %p %p)\n", | |
463 cmap2x2,Y0,Y1,Y2,Y3,U,V,map_flag,map,chdr); | |
464 | |
465 cmap2x2->clr0_0=Y0; | |
466 cmap2x2->clr0_1=Y1; | |
467 cmap2x2->clr0_2=Y2; | |
468 cmap2x2->clr0_3=Y3; | |
469 cmap2x2->clr1_0=U; | |
470 cmap2x2->clr1_1=V; | |
471 return; | |
472 } | |
473 | |
474 void *YUV2x2_Map_Func(unsigned int image_type, unsigned int dith_type) | |
475 { | |
476 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUV2x2_Map_Func('image_type: %d', 'dith_type: %d')", | |
477 image_type, dith_type); | |
478 return((void*)XA_YUV_2x2_clr); | |
479 } | |
480 | |
481 /* -------------------- whole YUV frame converters ------------------------- */ | |
482 | |
483 typedef struct | |
484 { | |
485 unsigned char *Ybuf; | |
486 unsigned char *Ubuf; | |
487 unsigned char *Vbuf; | |
488 unsigned char *the_buf; | |
489 unsigned int the_buf_size; | |
490 unsigned short y_w, y_h; | |
491 unsigned short uv_w, uv_h; | |
492 } YUVBufs; | |
493 | |
494 typedef struct | |
495 { | |
496 unsigned long Uskip_mask; | |
497 long *YUV_Y_tab; | |
498 long *YUV_UB_tab; | |
499 long *YUV_VR_tab; | |
500 long *YUV_UG_tab; | |
501 long *YUV_VG_tab; | |
502 } YUVTabs; | |
503 | |
504 YUVBufs jpg_YUVBufs; | |
505 YUVTabs def_yuv_tabs; | |
506 | |
507 /* -------------- YUV 4x4 1x1 1x1 (4:1:0 aka YVU9) [Indeo 3,4,5] ------------------ */ | |
508 | |
509 void XA_YUV1611_Convert(unsigned char *image_p, unsigned int imagex, unsigned int imagey, | |
510 unsigned int i_x, unsigned int i_y, YUVBufs *yuv, YUVTabs *yuv_tabs, | |
511 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
512 { | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
513 mp_image_t *mpi = (mp_image_t *)image_p; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
514 mp_image_t *image = (mp_image_t *)image_p; |
7285 | 515 int y; |
516 int uvstride; | |
517 | |
518 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUVTabs: %d %p %p %p %p %p\n",yuv_tabs->Uskip_mask, | |
519 yuv_tabs->YUV_Y_tab, | |
520 yuv_tabs->YUV_UB_tab, | |
521 yuv_tabs->YUV_VR_tab, | |
522 yuv_tabs->YUV_UG_tab, | |
523 yuv_tabs->YUV_VG_tab ); | |
524 | |
525 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV1611_Convert('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')", | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
526 image_p, imagex, imagey, i_x, i_y, yuv, yuv_tabs, map_flag, map, chdr); |
7285 | 527 |
528 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUV: %p %p %p %X (%d) %dx%d %dx%d\n", | |
529 yuv->Ybuf,yuv->Ubuf,yuv->Vbuf,yuv->the_buf,yuv->the_buf_size, | |
530 yuv->y_w,yuv->y_h,yuv->uv_w,yuv->uv_h); | |
531 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
532 if(mpi->imgfmt == IMGFMT_YVU9 && !yuv_tabs->YUV_Y_tab) |
7285 | 533 { |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
534 if(((int)i_x==mpi->width) && ((int)i_y==mpi->height)){ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
535 mpi->planes[0]=yuv->Ybuf; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
536 mpi->planes[1]=yuv->Ubuf; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
537 mpi->planes[2]=yuv->Vbuf; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
538 mpi->stride[0]=i_x; // yuv->y_w |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
539 mpi->stride[1]=mpi->stride[2]=i_x/4; // yuv->uv_w |
7285 | 540 } else { |
541 int y; | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
542 for(y=0;y<(int)i_y;y++) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
543 memcpy(mpi->planes[0]+y*mpi->stride[0],yuv->Ybuf+y*i_x,i_x); |
7285 | 544 i_x>>=2; i_y>>=2; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
545 for(y=0;y<(int)i_y;y++){ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
546 memcpy(mpi->planes[1]+y*mpi->stride[1],yuv->Ubuf+y*i_x,i_x); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
547 memcpy(mpi->planes[2]+y*mpi->stride[2],yuv->Vbuf+y*i_x,i_x); |
7285 | 548 } |
549 } | |
550 return; | |
551 } | |
552 | |
553 // copy Y plane: | |
554 if(yuv_tabs->YUV_Y_tab){ // dirty hack to detect iv32: | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
555 for(y=0;y<(int)(imagey*imagex);y++) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
556 mpi->planes[0][y]=yuv->Ybuf[y]<<1; |
7285 | 557 } else |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
558 memcpy(mpi->planes[0],yuv->Ybuf,imagex*imagey); |
7285 | 559 |
560 // scale U,V planes by 2: | |
561 imagex>>=2; | |
562 imagey>>=2; | |
563 | |
564 uvstride=(yuv->uv_w)?yuv->uv_w:imagex; | |
565 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
566 for(y=0;y<(int)imagey;y++){ |
7285 | 567 unsigned char *su=yuv->Ubuf+uvstride*y; |
568 unsigned char *sv=yuv->Vbuf+uvstride*y; | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
569 unsigned int strideu=mpi->stride[1]; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
570 unsigned int stridev=mpi->stride[2]; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
571 unsigned char *du=mpi->planes[1]+2*y*strideu; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
572 unsigned char *dv=mpi->planes[2]+2*y*stridev; |
7285 | 573 int x; |
574 if(yuv_tabs->YUV_Y_tab){ // dirty hack to detect iv32: | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
575 for(x=0;x<(int)imagex;x++){ |
7285 | 576 du[2*x]=du[2*x+1]=du[2*x+strideu]=du[2*x+strideu+1]=su[x]*2; |
577 dv[2*x]=dv[2*x+1]=dv[2*x+stridev]=dv[2*x+stridev+1]=sv[x]*2; | |
578 } | |
579 } else { | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
580 for(x=0;x<(int)imagex;x++){ |
7285 | 581 du[2*x]=du[2*x+1]=du[2*x+strideu]=du[2*x+strideu+1]=su[x]; |
582 dv[2*x]=dv[2*x+1]=dv[2*x+stridev]=dv[2*x+stridev+1]=sv[x]; | |
583 } | |
584 } | |
585 } | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
586 |
7285 | 587 return; |
588 } | |
589 | |
590 void *XA_YUV1611_Func(unsigned int image_type) | |
591 { | |
592 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV1611_Func('image_type: %d')", image_type); | |
593 return((void *)XA_YUV1611_Convert); | |
594 } | |
595 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
596 #if 0 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
597 /* this should be removed too */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
598 |
7285 | 599 /* -------------- YUV 4x1 1x1 1x1 (4:1:1 but interleaved) [CYUV] ------------------ */ |
600 | |
601 void XA_YUV411111_Convert(unsigned char *image, unsigned int imagex, unsigned int imagey, | |
602 unsigned int i_x, unsigned int i_y, YUVBufs *yuv_bufs, YUVTabs *yuv_tabs, | |
603 unsigned int map_flag, unsigned int *map, XA_CHDR *chdr) | |
604 { | |
605 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV411111_Convert('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')", | |
606 image, imagex, imagey, i_x, i_y, yuv_bufs, yuv_tabs, map_flag, map, chdr); | |
607 return; | |
608 } | |
609 | |
610 void *XA_YUV411111_Func(unsigned int image_type) | |
611 { | |
612 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV411111_Func('image_type: %d')", image_type); | |
613 return((void*)XA_YUV411111_Convert); | |
614 } | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
615 #endif |
7285 | 616 |
617 /* --------------- YUV 2x2 1x1 1x1 (4:2:0 aka YV12) [3ivX,H263] ------------ */ | |
618 | |
619 void XA_YUV221111_Convert(unsigned char *image_p, unsigned int imagex, unsigned int imagey, | |
620 unsigned int i_x, unsigned int i_y, YUVBufs *yuv, YUVTabs *yuv_tabs, unsigned int map_flag, | |
621 unsigned int *map, XA_CHDR *chdr) | |
622 { | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
623 mp_image_t *mpi = (mp_image_t *)image_p; |
7285 | 624 |
625 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV221111_Convert(%p %dx%d %d;%d [%dx%d] %p %p %d %p %p)\n", | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
626 image_p,imagex,imagey,i_x,i_y, mpi->width,mpi->height, |
7285 | 627 yuv,yuv_tabs,map_flag,map,chdr); |
628 | |
629 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "YUV: %p %p %p %X (%X) %Xx%X %Xx%X\n", | |
630 yuv->Ybuf,yuv->Ubuf,yuv->Vbuf,yuv->the_buf,yuv->the_buf_size, | |
631 yuv->y_w,yuv->y_h,yuv->uv_w,yuv->uv_h); | |
632 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
633 if(((int)i_x==mpi->width) && ((int)i_y==mpi->height)){ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
634 mpi->planes[0]=yuv->Ybuf; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
635 if(mpi->imgfmt==IMGFMT_YV12){ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
636 mpi->planes[1]=yuv->Ubuf; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
637 mpi->planes[2]=yuv->Vbuf; |
7285 | 638 } else { |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
639 mpi->planes[1]=yuv->Vbuf; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
640 mpi->planes[2]=yuv->Ubuf; |
7285 | 641 } |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
642 mpi->stride[0]=i_x; // yuv->y_w |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
643 mpi->stride[1]=mpi->stride[2]=i_x/2; // yuv->uv_w |
7285 | 644 } else { |
645 int y; | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
646 for(y=0;y<(int)i_y;y++) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
647 memcpy(mpi->planes[0]+y*mpi->stride[0],yuv->Ybuf+y*i_x,i_x); |
7285 | 648 i_x>>=1; i_y>>=1; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
649 for(y=0;y<(int)i_y;y++){ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
650 memcpy(mpi->planes[1]+y*mpi->stride[1],yuv->Ubuf+y*i_x,i_x); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
651 memcpy(mpi->planes[2]+y*mpi->stride[2],yuv->Vbuf+y*i_x,i_x); |
7285 | 652 } |
653 } | |
654 return; | |
655 } | |
656 | |
657 void *XA_YUV221111_Func(unsigned int image_type) | |
658 { | |
659 mp_dbg(MSGT_DECVIDEO,MSGL_DBG3, "XA_YUV221111_Func('image_type: %d')\n",image_type); | |
660 return((void *)XA_YUV221111_Convert); | |
661 } | |
662 | |
663 /* *** EOF XANIM *** */ | |
4969 | 664 |
665 // to set/get/query special features/parameters | |
666 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
667 return CONTROL_UNKNOWN; | |
668 } | |
669 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
670 //int xacodec_init_video(sh_video_t *vidinfo, int out_format); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
671 /* out_format = sh->codec->outfmt[sh->codec->outfmtidx]; */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
672 |
4969 | 673 // init driver |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
674 static int init(sh_video_t *sh) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
675 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
676 vd_xanim_ctx *priv; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
677 char *def_path = XACODEC_PATH; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
678 char dll[1024]; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
679 XA_CODEC_HDR codec_hdr; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
680 int i; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
681 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
682 priv = malloc(sizeof(vd_xanim_ctx)); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
683 if (!priv) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
684 return 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
685 sh->context = priv; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
686 memset(priv, 0, sizeof(vd_xanim_ctx)); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
687 |
6525 | 688 if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12)) return 0; |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
689 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
690 priv->iq_func = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
691 priv->dec_func = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
692 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
693 for (i=0; i < XA_CLOSE_FUNCS; i++) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
694 xa_close_func[i] = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
695 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
696 if (getenv("XANIM_MOD_DIR")) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
697 def_path = getenv("XANIM_MOD_DIR"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
698 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
699 snprintf(dll, 1024, "%s/%s", def_path, sh->codec->dll); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
700 if (xacodec_load(sh, dll) == 0) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
701 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
702 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
703 codec_hdr.xapi_rev = XAVID_API_REV; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
704 codec_hdr.anim_hdr = malloc(4096); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
705 codec_hdr.description = sh->codec->info; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
706 codec_hdr.compression = bswap_32(sh->bih->biCompression); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
707 codec_hdr.decoder = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
708 codec_hdr.x = sh->bih->biWidth; /* ->disp_w */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
709 codec_hdr.y = sh->bih->biHeight; /* ->disp_h */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
710 /* extra fields to store palette */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
711 codec_hdr.avi_ctab_flag = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
712 codec_hdr.avi_read_ext = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
713 codec_hdr.extra = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
714 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
715 switch(sh->codec->outfmt[sh->outfmtidx]) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
716 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
717 case IMGFMT_BGR32: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
718 codec_hdr.depth = 32; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
719 break; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
720 case IMGFMT_BGR24: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
721 codec_hdr.depth = 24; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
722 break; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
723 case IMGFMT_IYUV: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
724 case IMGFMT_I420: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
725 case IMGFMT_YV12: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
726 codec_hdr.depth = 12; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
727 break; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
728 case IMGFMT_YVU9: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
729 #if 0 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
730 if (sh->bih->biCompression == mmioFOURCC('I','V','3','2') || |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
731 sh->bih->biCompression == mmioFOURCC('i','v','3','2') || |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
732 sh->bih->biCompression == mmioFOURCC('I','V','3','1') || |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
733 sh->bih->biCompression == mmioFOURCC('i','v','3','2')) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
734 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
735 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supporting YVU9 output with Indeo3\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
736 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
737 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
738 #endif |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
739 codec_hdr.depth = 9; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
740 break; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
741 default: |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
742 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: not supported image out format (%s)\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
743 vo_format_name(sh->codec->outfmt[sh->outfmtidx])); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
744 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
745 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
746 mp_msg(MSGT_DECVIDEO, MSGL_INFO, "xacodec: querying for input %dx%d %dbit [fourcc: %4x] (%s)...\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
747 codec_hdr.x, codec_hdr.y, codec_hdr.depth, codec_hdr.compression, codec_hdr.description); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
748 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
749 if (xacodec_query(sh, &codec_hdr) == 0) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
750 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
751 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
752 // free(codec_hdr.anim_hdr); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
753 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
754 priv->decinfo = malloc(sizeof(XA_DEC_INFO)); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
755 if (priv->decinfo == NULL) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
756 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
757 mp_msg(MSGT_DECVIDEO, MSGL_FATAL, "xacodec: memory allocation error: %s\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
758 strerror(errno)); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
759 return(0); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
760 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
761 priv->decinfo->cmd = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
762 priv->decinfo->skip_flag = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
763 priv->decinfo->imagex = priv->decinfo->xe = codec_hdr.x; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
764 priv->decinfo->imagey = priv->decinfo->ye = codec_hdr.y; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
765 priv->decinfo->imaged = codec_hdr.depth; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
766 priv->decinfo->chdr = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
767 priv->decinfo->map_flag = 0; /* xaFALSE */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
768 priv->decinfo->map = NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
769 priv->decinfo->xs = priv->decinfo->ys = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
770 priv->decinfo->special = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
771 priv->decinfo->extra = codec_hdr.extra; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
772 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "decinfo->extra, filled by codec: 0x%08x [%s]\n", |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
773 &priv->decinfo->extra, priv->decinfo->extra); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
774 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
775 return(1); |
4969 | 776 } |
777 | |
778 // uninit driver | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
779 static void uninit(sh_video_t *sh) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
780 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
781 vd_xanim_ctx *priv = sh->context; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
782 int i; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
783 void (*close_func)(); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
784 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
785 for (i=0; i < XA_CLOSE_FUNCS; i++) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
786 if (xa_close_func[i]) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
787 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
788 close_func = xa_close_func[i]; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
789 close_func(); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
790 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
791 dlclose(priv->file_handler); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
792 if (priv->decinfo != NULL) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
793 free(priv->decinfo); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
794 free(priv); |
4969 | 795 } |
796 | |
797 //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); | |
798 | |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
799 // unsigned int (*dec_func)(unsigned char *image, unsigned char *delta, |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
800 // unsigned int dsize, XA_DEC_INFO *dec_info); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
801 |
4969 | 802 // decode a frame |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
803 static mp_image_t* decode(sh_video_t *sh, void *data, int len, int flags) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
804 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
805 vd_xanim_ctx *priv = sh->context; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
806 mp_image_t *mpi; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
807 unsigned int ret; |
4969 | 808 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
809 if (len <= 0) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
810 return NULL; // skipped frame |
4969 | 811 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
812 mpi = mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0, |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
813 sh->disp_w, sh->disp_h); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
814 if (!mpi) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
815 return NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
816 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
817 priv->decinfo->skip_flag = (flags&3)?1:0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
818 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
819 ret = priv->dec_func((uint8_t*)mpi, data, len, priv->decinfo); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
820 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
821 if (ret == ACT_DLTA_NORM) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
822 return mpi; |
4969 | 823 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
824 if (ret & ACT_DLTA_MAPD) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
825 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "mapd\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
826 /* |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
827 if (!(ret & ACT_DLT_MAPD)) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
828 xacodec_driver->decinfo->map_flag = 0; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
829 else |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
830 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
831 xacodec_driver->decinfo->map_flag = 1; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
832 xacodec_driver->decinfo->map = ... |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
833 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
834 */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
835 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
836 if (ret & ACT_DLTA_XOR) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
837 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
838 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "xor\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
839 return mpi; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
840 } |
4969 | 841 |
7298
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
842 /* nothing changed */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
843 if (ret & ACT_DLTA_NOP) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
844 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
845 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "nop\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
846 return NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
847 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
848 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
849 /* frame dropped (also display latest frame) */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
850 if (ret & ACT_DLTA_DROP) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
851 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
852 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "drop\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
853 return NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
854 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
855 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
856 if (ret & ACT_DLTA_BAD) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
857 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
858 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "bad\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
859 return NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
860 } |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
861 |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
862 /* used for double buffer */ |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
863 if (ret & ACT_DLTA_BODY) |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
864 { |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
865 mp_msg(MSGT_DECVIDEO, MSGL_DBG2, "body\n"); |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
866 return NULL; |
641b287f8b07
removed xacodec_driver, using sh->context instead, removed xacodec_image, using mpi instead, some warning fixes. note: mpi optimisations are still pending
alex
parents:
7285
diff
changeset
|
867 } |
4969 | 868 |
869 return mpi; | |
870 } | |
871 #endif |