Mercurial > mplayer.hg
annotate dec_video.c @ 4294:21dbbbbd5479
a few filters (should be removed/merged when arpis videofilter stuff is finished)
-ssf cgb=<float> -> chrominance gaussian blur (nice to improve picture quality)
-ssf lgb=<float> -> luminance gaussian blur (dunno what its good for)
-ssf chs=<int> -> shift chrominance horizontally
-ssf cvs=<int> -> shift chrominance vertically
these will only work if the swscaler is used at all
author | michael |
---|---|
date | Mon, 21 Jan 2002 15:22:28 +0000 |
parents | 818be6ba8758 |
children | 8f43b10f387f |
rev | line source |
---|---|
4188 | 1 |
2 #define USE_MP_IMAGE | |
2775 | 3 |
4 #include "config.h" | |
1294 | 5 |
6 #include <stdio.h> | |
2775 | 7 #ifdef HAVE_MALLOC_H |
8 #include <malloc.h> | |
9 #endif | |
1294 | 10 #include <stdlib.h> |
1430 | 11 #include <unistd.h> |
1294 | 12 |
1567 | 13 #include "mp_msg.h" |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
14 #include "help_mp.h" |
1294 | 15 |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1309
diff
changeset
|
16 #include "linux/timer.h" |
1496 | 17 #include "linux/shmem.h" |
1327
b12e1817bcc2
some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents:
1309
diff
changeset
|
18 |
2563 | 19 extern int verbose; // defined in mplayer.c |
20 | |
1294 | 21 #include "stream.h" |
22 #include "demuxer.h" | |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1367
diff
changeset
|
23 #include "parse_es.h" |
1294 | 24 |
25 #include "codec-cfg.h" | |
26 | |
1422 | 27 #ifdef USE_LIBVO2 |
28 #include "libvo2/libvo2.h" | |
29 #else | |
1294 | 30 #include "libvo/video_out.h" |
1422 | 31 #endif |
1294 | 32 |
4188 | 33 #include "stheader.h" |
34 | |
2563 | 35 #include "dec_video.h" |
36 | |
37 // =================================================================== | |
38 | |
39 extern double video_time_usage; | |
40 extern double vout_time_usage; | |
41 | |
42 extern int frameratecode2framerate[16]; | |
43 | |
44 #include "dll_init.h" | |
45 | |
46 //#include <inttypes.h> | |
47 //#include "libvo/img_format.h" | |
48 | |
1294 | 49 #include "libmpeg2/mpeg2.h" |
50 #include "libmpeg2/mpeg2_internal.h" | |
51 | |
2184 | 52 #include "postproc/postprocess.h" |
53 | |
3144 | 54 #include "cpudetect.h" |
55 | |
1294 | 56 extern picture_t *picture; // exported from libmpeg2/decode.c |
57 | |
2563 | 58 int divx_quality=0; |
1294 | 59 |
60 #ifdef USE_DIRECTSHOW | |
3947
2eb8c8aacca7
using dshow headers from dshow/ instead of c++ version
arpi
parents:
3877
diff
changeset
|
61 #include "loader/dshow/DS_VideoDecoder.h" |
2eb8c8aacca7
using dshow headers from dshow/ instead of c++ version
arpi
parents:
3877
diff
changeset
|
62 static DS_VideoDecoder* ds_vdec=NULL; |
3062 | 63 #endif |
1294 | 64 |
65 #ifdef USE_LIBAVCODEC | |
2496 | 66 #ifdef USE_LIBAVCODEC_SO |
67 #include <libffmpeg/avcodec.h> | |
68 #else | |
1294 | 69 #include "libavcodec/avcodec.h" |
2496 | 70 #endif |
1927 | 71 static AVCodec *lavc_codec=NULL; |
72 static AVCodecContext lavc_context; | |
73 static AVPicture lavc_picture; | |
74 int avcodec_inited=0; | |
1294 | 75 #endif |
2228 | 76 #ifdef FF_POSTPROCESS |
77 unsigned int lavc_pp=0; | |
78 #endif | |
1294 | 79 |
1349 | 80 #ifndef NEW_DECORE |
1294 | 81 #include "opendivx/decore.h" |
1349 | 82 #else |
83 #include <decore.h> | |
84 #endif | |
1294 | 85 |
2378 | 86 #ifdef USE_XANIM |
87 #include "xacodec.h" | |
88 #endif | |
89 | |
2938
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
90 #ifdef USE_TV |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
91 #include "libmpdemux/tv.h" |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
92 |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
93 extern int tv_param_on; |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
94 extern tvi_handle_t *tv_handler; |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
95 #endif |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
96 |
1948 | 97 void AVI_Decode_RLE8(char *image,char *delta,int tdsize, |
98 unsigned int *map,int imagex,int imagey,unsigned char x11_bytes_pixel); | |
99 | |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
100 void AVI_Decode_Video1_16( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
101 char *encoded, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
102 int encoded_size, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
103 char *decoded, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
104 int width, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
105 int height, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
106 int bytes_per_pixel); |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
107 |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
108 void AVI_Decode_Video1_8( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
109 char *encoded, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
110 int encoded_size, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
111 char *decoded, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
112 int width, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
113 int height, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
114 unsigned char *palette_map, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
115 int bytes_per_pixel); |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
116 |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
117 void Decode_Fli( |
3172 | 118 unsigned char *encoded, |
119 int encoded_size, | |
120 unsigned char *decoded, | |
121 int width, | |
122 int height, | |
123 int bytes_per_pixel); | |
124 | |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
125 void qt_decode_rle( |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
126 unsigned char *encoded, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
127 int encoded_size, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
128 unsigned char *decoded, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
129 int width, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
130 int height, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
131 int encoded_bpp, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
132 int bytes_per_pixel); |
3172 | 133 |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
134 void decode_nuv( |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
135 unsigned char *encoded, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
136 int encoded_size, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
137 unsigned char *decoded, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
138 int width, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
139 int height); |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
140 |
3969 | 141 void *decode_cinepak_init(void); |
142 | |
143 void decode_cinepak( | |
144 void *context, | |
145 unsigned char *buf, | |
146 int size, | |
147 unsigned char *frame, | |
148 int width, | |
149 int height, | |
150 int bit_per_pixel); | |
151 | |
152 void decode_cyuv( | |
153 unsigned char *buf, | |
154 int size, | |
155 unsigned char *frame, | |
156 int width, | |
157 int height, | |
158 int bit_per_pixel); | |
159 | |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
160 int qt_init_decode_smc(void); |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
161 |
4227 | 162 void qt_decode_smc( |
163 unsigned char *encoded, | |
164 int encoded_size, | |
165 unsigned char *decoded, | |
166 int width, | |
167 int height, | |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
168 unsigned char *palette_map, |
4227 | 169 int bytes_per_pixel); |
170 | |
1294 | 171 //**************************************************************************// |
172 // The OpenDivX stuff: | |
173 //**************************************************************************// | |
174 | |
175 #ifndef NEW_DECORE | |
176 | |
177 static unsigned char *opendivx_src[3]; | |
178 static int opendivx_stride[3]; | |
179 | |
180 // callback, the opendivx decoder calls this for each frame: | |
181 void convert_linux(unsigned char *puc_y, int stride_y, | |
182 unsigned char *puc_u, unsigned char *puc_v, int stride_uv, | |
183 unsigned char *bmp, int width_y, int height_y){ | |
184 | |
185 // printf("convert_yuv called %dx%d stride: %d,%d\n",width_y,height_y,stride_y,stride_uv); | |
186 | |
187 opendivx_src[0]=puc_y; | |
188 opendivx_src[1]=puc_u; | |
189 opendivx_src[2]=puc_v; | |
190 | |
191 opendivx_stride[0]=stride_y; | |
192 opendivx_stride[1]=stride_uv; | |
193 opendivx_stride[2]=stride_uv; | |
194 } | |
195 #endif | |
196 | |
1429 | 197 int get_video_quality_max(sh_video_t *sh_video){ |
198 switch(sh_video->codec->driver){ | |
2087 | 199 #ifdef USE_WIN32DLL |
200 case VFM_VFW: | |
201 case VFM_VFWEX: | |
2184 | 202 return 9; // for Divx.dll (divx4) |
2087 | 203 #endif |
1429 | 204 #ifdef USE_DIRECTSHOW |
205 case VFM_DSHOW: | |
206 return 4; | |
207 #endif | |
208 #ifdef MPEG12_POSTPROC | |
209 case VFM_MPEG: | |
2184 | 210 return GET_PP_QUALITY_MAX; |
1429 | 211 #endif |
2228 | 212 #ifdef FF_POSTPROCESS |
213 case VFM_FFMPEG: | |
214 return GET_PP_QUALITY_MAX; | |
215 #endif | |
1429 | 216 case VFM_DIVX4: |
217 case VFM_ODIVX: | |
2184 | 218 #ifdef NEW_DECORE |
219 return 9; // for divx4linux | |
220 #else | |
221 return GET_PP_QUALITY_MAX; // for opendivx | |
222 #endif | |
1429 | 223 } |
224 return 0; | |
225 } | |
226 | |
227 void set_video_quality(sh_video_t *sh_video,int quality){ | |
228 switch(sh_video->codec->driver){ | |
2087 | 229 #ifdef USE_WIN32DLL |
230 case VFM_VFW: | |
231 case VFM_VFWEX: | |
232 vfw_set_postproc(sh_video,10*quality); | |
233 break; | |
234 #endif | |
1429 | 235 #ifdef USE_DIRECTSHOW |
236 case VFM_DSHOW: { | |
237 if(quality<0 || quality>4) quality=4; | |
3062 | 238 DS_VideoDecoder_SetValue(ds_vdec,"Quality",quality); |
1429 | 239 } |
240 break; | |
241 #endif | |
242 #ifdef MPEG12_POSTPROC | |
243 case VFM_MPEG: { | |
2184 | 244 if(quality<0 || quality>GET_PP_QUALITY_MAX) quality=GET_PP_QUALITY_MAX; |
245 picture->pp_options=getPpModeForQuality(quality); | |
1429 | 246 } |
247 break; | |
248 #endif | |
2228 | 249 #ifdef FF_POSTPROCESS |
250 case VFM_FFMPEG: | |
251 if(quality<0 || quality>GET_PP_QUALITY_MAX) quality=GET_PP_QUALITY_MAX; | |
252 lavc_pp=getPpModeForQuality(quality); | |
253 break; | |
254 #endif | |
1429 | 255 case VFM_DIVX4: |
256 case VFM_ODIVX: { | |
257 DEC_SET dec_set; | |
2184 | 258 #ifdef NEW_DECORE |
259 if(quality<0 || quality>9) quality=9; | |
260 dec_set.postproc_level=quality*10; | |
261 #else | |
262 if(quality<0 || quality>GET_PP_QUALITY_MAX) quality=GET_PP_QUALITY_MAX; | |
263 dec_set.postproc_level=getPpModeForQuality(quality); | |
264 #endif | |
1429 | 265 decore(0x123,DEC_OPT_SETPP,&dec_set,NULL); |
266 } | |
267 break; | |
268 } | |
269 } | |
270 | |
271 int set_video_colors(sh_video_t *sh_video,char *item,int value){ | |
1431 | 272 #ifdef USE_DIRECTSHOW |
2295 | 273 if(sh_video->codec->driver==VFM_DSHOW){ |
3062 | 274 DS_VideoDecoder_SetValue(ds_vdec,item,value); |
1429 | 275 return 1; |
276 } | |
1431 | 277 #endif |
2938
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
278 |
2295 | 279 #ifdef NEW_DECORE |
280 #ifdef DECORE_VERSION | |
281 #if DECORE_VERSION >= 20011010 | |
282 if(sh_video->codec->driver==VFM_DIVX4){ | |
283 int option; | |
284 if(!strcmp(item,"Brightness")) option=DEC_GAMMA_BRIGHTNESS; | |
285 else if(!strcmp(item, "Contrast")) option=DEC_GAMMA_CONTRAST; | |
286 else if(!strcmp(item,"Saturation")) option=DEC_GAMMA_SATURATION; | |
287 else return 0; | |
288 value = (value * 256) / 100 - 128; | |
289 decore(0x123, DEC_OPT_GAMMA, (void *)option, (void *) value); | |
290 return 1; | |
291 } | |
292 #endif | |
293 #endif | |
294 #endif | |
2938
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
295 |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
296 #ifdef USE_TV |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
297 |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
298 if (tv_param_on == 1) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
299 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
300 if (!strcmp(item, "Brightness")) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
301 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
302 tv_set_color_options(tv_handler, TV_COLOR_BRIGHTNESS, value); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
303 return(1); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
304 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
305 if (!strcmp(item, "Hue")) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
306 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
307 tv_set_color_options(tv_handler, TV_COLOR_HUE, value); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
308 return(1); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
309 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
310 if (!strcmp(item, "Saturation")) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
311 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
312 tv_set_color_options(tv_handler, TV_COLOR_SATURATION, value); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
313 return(1); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
314 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
315 if (!strcmp(item, "Contrast")) |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
316 { |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
317 tv_set_color_options(tv_handler, TV_COLOR_CONTRAST, value); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
318 return(1); |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
319 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
320 } |
757c3ab1a45a
added support for setting color values on tv interface
alex
parents:
2827
diff
changeset
|
321 #endif |
1429 | 322 return 0; |
323 } | |
1294 | 324 |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
325 void uninit_video(sh_video_t *sh_video){ |
1654 | 326 if(!sh_video->inited) return; |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
327 mp_msg(MSGT_DECVIDEO,MSGL_V,"uninit video: %d \n",sh_video->codec->driver); |
1654 | 328 switch(sh_video->codec->driver){ |
1666 | 329 #ifdef USE_LIBAVCODEC |
1654 | 330 case VFM_FFMPEG: |
331 if (avcodec_close(&lavc_context) < 0) | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
332 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); |
1654 | 333 break; |
1666 | 334 #endif |
1669 | 335 #ifdef USE_DIRECTSHOW |
1664 | 336 case VFM_DSHOW: // Win32/DirectShow |
3062 | 337 if(ds_vdec){ DS_VideoDecoder_Destroy(ds_vdec); ds_vdec=NULL; } |
1664 | 338 break; |
1666 | 339 #endif |
1654 | 340 case VFM_MPEG: |
341 mpeg2_free_image_buffers (picture); | |
342 break; | |
2563 | 343 #ifdef USE_XANIM |
344 case VFM_XANIM: | |
345 xacodec_exit(); | |
346 break; | |
347 #endif | |
4156
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
3969
diff
changeset
|
348 case VFM_DIVX4: |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
3969
diff
changeset
|
349 case VFM_ODIVX: |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
3969
diff
changeset
|
350 decore(0x123,DEC_OPT_RELEASE,NULL,NULL); |
22fadd4022b5
playtree-based config patch by Alban Bedel <albeu@free.fr>
arpi
parents:
3969
diff
changeset
|
351 break; |
1654 | 352 } |
353 if(sh_video->our_out_buffer){ | |
354 free(sh_video->our_out_buffer); | |
355 sh_video->our_out_buffer=NULL; | |
356 } | |
357 sh_video->inited=0; | |
358 } | |
359 | |
1294 | 360 int init_video(sh_video_t *sh_video){ |
361 unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx]; | |
362 | |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
363 sh_video->our_out_buffer=NULL; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
364 |
4188 | 365 sh_video->image=new_mp_image(sh_video->disp_w,sh_video->disp_h); |
366 mp_image_setfmt(sh_video->image,out_fmt); | |
367 | |
1294 | 368 switch(sh_video->codec->driver){ |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
369 case VFM_CINEPAK: { |
4188 | 370 #ifdef USE_MP_IMAGE |
371 sh_video->image->type=MP_IMGTYPE_STATIC; | |
372 #else | |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
373 int bpp=((out_fmt&255)+7)/8; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
374 sh_video->our_out_buffer = |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
375 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); |
4188 | 376 #endif |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
377 sh_video->context = decode_cinepak_init(); |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
378 break; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
379 } |
2659 | 380 case VFM_XANIM: { |
2378 | 381 #ifdef USE_XANIM |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
382 int ret=xacodec_init_video(sh_video,out_fmt); |
2378 | 383 if(!ret) return 0; |
2659 | 384 #else |
2660 | 385 // mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_NoXAnimSupport); |
386 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "MPlayer was compiled WIHTOUT XAnim support!\n"); | |
2659 | 387 return 0; |
388 #endif | |
2378 | 389 break; |
390 } | |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
391 #ifdef USE_WIN32DLL |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
392 case VFM_VFW: { |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
393 if(!init_vfw_video_codec(sh_video,0)) { |
1294 | 394 return 0; |
395 } | |
1567 | 396 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n"); |
1294 | 397 break; |
398 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
399 case VFM_VFWEX: { |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
400 if(!init_vfw_video_codec(sh_video,1)) { |
1297 | 401 return 0; |
402 } | |
1567 | 403 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32Ex video codec init OK!\n"); |
1297 | 404 break; |
405 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
406 case VFM_DSHOW: { // Win32/DirectShow |
1294 | 407 #ifndef USE_DIRECTSHOW |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
408 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoDShowSupport); |
1294 | 409 return 0; |
410 #else | |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
411 int bpp; |
3448 | 412 if(!(ds_vdec=DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, 0))){ |
1294 | 413 // if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, NULL)){ |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
414 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_video->codec->dll); |
1567 | 415 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n"); |
416 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n"); | |
417 // mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Or you should disable DShow support: make distclean;make -f Makefile.No-DS\n"); | |
1294 | 418 return 0; |
419 } | |
4188 | 420 |
421 #ifdef USE_MP_IMAGE | |
422 sh_video->image->type=MP_IMGTYPE_STATIC; | |
423 bpp=sh_video->image->bpp; | |
424 if(sh_video->image->flags&MP_IMGFLAG_YUV){ | |
425 DS_VideoDecoder_SetDestFmt(ds_vdec,bpp,out_fmt); // YUV | |
426 } else { | |
427 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR | |
428 } | |
429 #else | |
1294 | 430 switch(out_fmt){ |
431 case IMGFMT_YUY2: | |
432 case IMGFMT_UYVY: | |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
433 bpp=16; |
3062 | 434 DS_VideoDecoder_SetDestFmt(ds_vdec,16,out_fmt);break; // packed YUV |
1294 | 435 case IMGFMT_YV12: |
436 case IMGFMT_I420: | |
437 case IMGFMT_IYUV: | |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
438 bpp=12; |
3062 | 439 DS_VideoDecoder_SetDestFmt(ds_vdec,12,out_fmt);break; // planar YUV |
1294 | 440 default: |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
441 bpp=((out_fmt&255)+7)&(~7); |
3062 | 442 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR |
1294 | 443 } |
444 | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
445 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp/8); // FIXME!!! |
4188 | 446 #endif |
1547
4b0046db8e64
alloc frame buffer for directshow codec - requires for avifile sync
arpi
parents:
1517
diff
changeset
|
447 |
3062 | 448 DS_SetAttr_DivX("Quality",divx_quality); |
1294 | 449 |
3062 | 450 DS_VideoDecoder_StartInternal(ds_vdec); |
1294 | 451 // printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",divx_quality) ); |
452 // printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) ); | |
453 | |
1567 | 454 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n"); |
1294 | 455 break; |
456 #endif | |
457 } | |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
458 #else /* !USE_WIN32DLL */ |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
459 case VFM_VFW: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
460 case VFM_DSHOW: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
461 case VFM_VFWEX: |
2006 | 462 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoWfvSupport); |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1297
diff
changeset
|
463 return 0; |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
464 #endif /* !USE_WIN32DLL */ |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
465 case VFM_ODIVX: { // OpenDivX |
1567 | 466 mp_msg(MSGT_DECVIDEO,MSGL_V,"OpenDivX video codec\n"); |
1294 | 467 { DEC_PARAM dec_param; |
468 DEC_SET dec_set; | |
1349 | 469 memset(&dec_param,0,sizeof(dec_param)); |
1294 | 470 #ifdef NEW_DECORE |
471 dec_param.output_format=DEC_USER; | |
472 #else | |
473 dec_param.color_depth = 32; | |
474 #endif | |
475 dec_param.x_dim = sh_video->bih->biWidth; | |
476 dec_param.y_dim = sh_video->bih->biHeight; | |
477 decore(0x123, DEC_OPT_INIT, &dec_param, NULL); | |
478 dec_set.postproc_level = divx_quality; | |
479 decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); | |
1349 | 480 } |
1567 | 481 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n"); |
1349 | 482 break; |
483 } | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
484 case VFM_DIVX4: { // DivX4Linux |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
485 #ifndef NEW_DECORE |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
486 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoDivx4Support); |
1631 | 487 return 0; |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
488 #else |
1567 | 489 mp_msg(MSGT_DECVIDEO,MSGL_V,"DivX4Linux video codec\n"); |
1349 | 490 { DEC_PARAM dec_param; |
491 DEC_SET dec_set; | |
492 int bits=16; | |
493 memset(&dec_param,0,sizeof(dec_param)); | |
494 switch(out_fmt){ | |
495 case IMGFMT_YV12: dec_param.output_format=DEC_YV12;bits=12;break; | |
496 case IMGFMT_YUY2: dec_param.output_format=DEC_YUY2;break; | |
497 case IMGFMT_UYVY: dec_param.output_format=DEC_UYVY;break; | |
498 case IMGFMT_I420: dec_param.output_format=DEC_420;bits=12;break; | |
499 case IMGFMT_BGR15: dec_param.output_format=DEC_RGB555_INV;break; | |
500 case IMGFMT_BGR16: dec_param.output_format=DEC_RGB565_INV;break; | |
501 case IMGFMT_BGR24: dec_param.output_format=DEC_RGB24_INV;bits=24;break; | |
502 case IMGFMT_BGR32: dec_param.output_format=DEC_RGB32_INV;bits=32;break; | |
503 default: | |
1567 | 504 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",out_fmt); |
1349 | 505 return 0; |
506 } | |
507 dec_param.x_dim = sh_video->bih->biWidth; | |
508 dec_param.y_dim = sh_video->bih->biHeight; | |
509 decore(0x123, DEC_OPT_INIT, &dec_param, NULL); | |
510 dec_set.postproc_level = divx_quality; | |
511 decore(0x123, DEC_OPT_SETPP, &dec_set, NULL); | |
4188 | 512 #ifdef USE_MP_IMAGE |
513 sh_video->image->type=MP_IMGTYPE_STATIC; | |
514 #else | |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
515 sh_video->our_out_buffer = (char*)memalign(64,((bits*dec_param.x_dim+7)/8)*dec_param.y_dim); |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
516 // sh_video->our_out_buffer = shmem_alloc(dec_param.x_dim*dec_param.y_dim*5); |
4188 | 517 #endif |
1294 | 518 } |
1567 | 519 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n"); |
1294 | 520 break; |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
521 #endif |
1294 | 522 } |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
523 case VFM_FFMPEG: { // FFmpeg's libavcodec |
1294 | 524 #ifndef USE_LIBAVCODEC |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
525 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoLAVCsupport); |
1631 | 526 return 0; |
1294 | 527 #else |
1567 | 528 mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n"); |
1654 | 529 if(!avcodec_inited){ |
530 avcodec_init(); | |
531 avcodec_register_all(); | |
532 avcodec_inited=1; | |
533 } | |
1294 | 534 lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll); |
535 if(!lavc_codec){ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
536 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh_video->codec->dll); |
1631 | 537 return 0; |
1294 | 538 } |
539 memset(&lavc_context, 0, sizeof(lavc_context)); | |
1462 | 540 // sh_video->disp_h/=2; // !! |
1294 | 541 lavc_context.width=sh_video->disp_w; |
542 lavc_context.height=sh_video->disp_h; | |
1567 | 543 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",lavc_context.width,lavc_context.height); |
3877 | 544 if (sh_video->format == mmioFOURCC('R', 'V', '1', '3')) |
545 lavc_context.sub_id = 3; | |
1294 | 546 /* open it */ |
547 if (avcodec_open(&lavc_context, lavc_codec) < 0) { | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
548 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); |
1631 | 549 return 0; |
1294 | 550 } |
2228 | 551 #ifdef FF_POSTPROCESS |
552 lavc_pp=divx_quality; | |
553 #endif | |
1567 | 554 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n"); |
1294 | 555 break; |
556 #endif | |
557 } | |
558 | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
559 case VFM_MPEG: { |
1294 | 560 // init libmpeg2: |
2567 | 561 mpeg2_init(); |
1294 | 562 #ifdef MPEG12_POSTPROC |
563 picture->pp_options=divx_quality; | |
564 #else | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
565 if(divx_quality) mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_MpegPPhint); |
1294 | 566 #endif |
2567 | 567 // send seq header to the decoder: |
568 mpeg2_decode_data(NULL,videobuffer,videobuffer+videobuf_len,0); | |
1294 | 569 mpeg2_allocate_image_buffers (picture); |
570 break; | |
571 } | |
1488 | 572 case VFM_RAW: { |
3397
39abf443aac4
vfm_raw hack: set outfmt if format != 0x0 (for tv input)
alex
parents:
3303
diff
changeset
|
573 if (sh_video->format != 0x0) |
39abf443aac4
vfm_raw hack: set outfmt if format != 0x0 (for tv input)
alex
parents:
3303
diff
changeset
|
574 /* set out_fmt */ |
39abf443aac4
vfm_raw hack: set outfmt if format != 0x0 (for tv input)
alex
parents:
3303
diff
changeset
|
575 sh_video->codec->outfmt[sh_video->outfmtidx] = sh_video->format; |
1488 | 576 break; |
577 } | |
1948 | 578 case VFM_RLE: { |
579 int bpp=((out_fmt&255)+7)/8; // RGB only | |
4188 | 580 #ifdef USE_MP_IMAGE |
581 sh_video->image->type=MP_IMGTYPE_STATIC; | |
582 #else | |
583 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!! | |
584 #endif | |
1949 | 585 if(bpp==2){ // 15 or 16 bpp ==> palette conversion! |
586 unsigned int* pal=(unsigned int*)(((char*)sh_video->bih)+40); | |
3303 | 587 int cols=(sh_video->bih->biSize-40)/4; |
588 //int cols=1<<(sh_video->bih->biBitCount); | |
1949 | 589 int i; |
590 if(cols>256) cols=256; | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1949
diff
changeset
|
591 mp_msg(MSGT_DECVIDEO,MSGL_V,"RLE: converting palette for %d colors.\n",cols); |
1949 | 592 for(i=0;i<cols;i++){ |
593 unsigned int c=pal[i]; | |
594 unsigned int b=c&255; | |
595 unsigned int g=(c>>8)&255; | |
596 unsigned int r=(c>>16)&255; | |
597 if((out_fmt&255)==15) | |
598 pal[i]=((r>>3)<<10)|((g>>3)<<5)|((b>>3)); | |
599 else | |
600 pal[i]=((r>>3)<<11)|((g>>2)<<5)|((b>>3)); | |
601 } | |
602 } | |
1948 | 603 break; |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
604 case VFM_MSVIDC: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
605 case VFM_FLI: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
606 case VFM_QTRLE: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
607 { |
4188 | 608 #ifdef USE_MP_IMAGE |
609 sh_video->image->type=MP_IMGTYPE_STATIC; | |
610 #else | |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
611 int bpp=((out_fmt&255)+7)/8; // RGB only |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
612 sh_video->our_out_buffer = |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
613 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!! |
4188 | 614 #endif |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
615 if ((sh_video->codec->driver == VFM_QTRLE) && (sh_video->bih->biBitCount != 24)) |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
616 printf ( |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
617 " *** FYI: This Quicktime file is using %d-bit RLE Animation\n" \ |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
618 " encoding, which is not yet supported by MPlayer. But if you upload\n" \ |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
619 " this Quicktime file to the MPlayer FTP, the team could look at it.\n", |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
620 sh_video->bih->biBitCount); |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
621 |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
622 break; |
3172 | 623 } |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
624 case VFM_QTSMC: |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
625 { |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
626 if (qt_init_decode_smc() != 0) |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
627 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "SMC decoder could not allocate enough memory"); |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
628 #ifdef USE_MP_IMAGE |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
629 sh_video->image->type=MP_IMGTYPE_STATIC; |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
630 #else |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
631 int bpp=((out_fmt&255)+7)/8; // RGB only |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
632 sh_video->our_out_buffer = |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
633 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!! |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
634 #endif |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
635 break; |
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
636 } |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
637 case VFM_NUV: |
4188 | 638 #ifdef USE_MP_IMAGE |
639 sh_video->image->type=MP_IMGTYPE_STATIC; | |
640 #else | |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
641 sh_video->our_out_buffer = (char *)memalign(64, sh_video->disp_w*sh_video->disp_h*3/2); |
4188 | 642 #endif |
3172 | 643 break; |
3969 | 644 case VFM_CYUV: { |
4188 | 645 // int bpp=((out_fmt&255)+7)/8; |
646 #ifdef USE_MP_IMAGE | |
647 sh_video->image->type=MP_IMGTYPE_STATIC; | |
648 #else | |
3969 | 649 sh_video->our_out_buffer = |
650 (char*)memalign(64, sh_video->disp_w*sh_video->disp_h*3); | |
4188 | 651 #endif |
3969 | 652 break; |
653 } | |
1948 | 654 } |
1294 | 655 } |
1654 | 656 sh_video->inited=1; |
1294 | 657 return 1; |
658 } | |
659 | |
1422 | 660 #ifdef USE_LIBVO2 |
661 int decode_video(vo2_handle_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){ | |
662 #else | |
1294 | 663 int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){ |
1422 | 664 #endif |
4188 | 665 |
666 mp_image_t *mpi=sh_video->image; | |
667 unsigned int out_fmt=mpi->imgfmt; //sh_video->codec->outfmt[sh_video->outfmtidx]; | |
668 int planar=(mpi->flags&MP_IMGFLAG_PLANAR)!=0; //(out_fmt==IMGFMT_YV12||out_fmt==IMGFMT_IYUV||out_fmt==IMGFMT_I420); | |
1294 | 669 int blit_frame=0; |
670 | |
4188 | 671 //uint8_t* planes_[3]; |
672 //uint8_t** planes=planes_; | |
673 //int stride_[3]; | |
674 //int* stride=stride_; | |
1360 | 675 |
676 unsigned int t=GetTimer(); | |
677 unsigned int t2; | |
678 | |
4188 | 679 #ifdef USE_MP_IMAGE |
680 if(mpi->type!=MP_IMGTYPE_EXPORT) | |
681 if( !(mpi->flags&MP_IMGFLAG_ALLOCATED) && !(mpi->flags&MP_IMGFLAG_DIRECT) ){ | |
682 // allocate image buffer: | |
683 sh_video->our_out_buffer = (char *)memalign(64, mpi->width*mpi->height*mpi->bpp/8); | |
684 if((mpi->flags|MP_IMGFLAG_PLANAR) && (mpi->flags|MP_IMGFLAG_YUV)){ | |
685 // planar YUV | |
686 mpi->stride[0]=mpi->width; | |
687 mpi->stride[1]=mpi->stride[2]=mpi->width/2; | |
688 mpi->planes[0]=sh_video->our_out_buffer; | |
689 mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height; | |
690 mpi->planes[2]=mpi->planes[1]+mpi->stride[0]*mpi->height/4; | |
691 } else { | |
692 // packed YUV / RGB | |
693 mpi->stride[0]=mpi->width*mpi->bpp; | |
694 mpi->planes[0]=sh_video->our_out_buffer; | |
695 } | |
696 mpi->flags|=MP_IMGFLAG_ALLOCATED; | |
697 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"mp_image: allocated %d bytes for %dx%dx%d [0x%X] image\n", | |
698 mpi->width*mpi->height*mpi->bpp/8, mpi->width, mpi->height, mpi->bpp, mpi->imgfmt); | |
699 } | |
700 #endif | |
701 | |
2794 | 702 //printf("decode_frame(start: %p, size: %d, w: %d, h: %d)\n", |
703 // start, in_size, sh_video->disp_w, sh_video->disp_h); | |
704 | |
1294 | 705 //-------------------- Decode a frame: ----------------------- |
706 switch(sh_video->codec->driver){ | |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
707 case VFM_CINEPAK: |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
708 decode_cinepak(sh_video->context, start, in_size, sh_video->our_out_buffer, |
3646 | 709 sh_video->disp_w, sh_video->disp_h, (out_fmt==IMGFMT_YUY2)?16:(out_fmt&255)); |
3643
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
710 blit_frame = 3; |
fb9fd7e2dd35
native opensourec Cinepak (CVID) codec by im Ferguson <timf@mail.csse.monash.edu.au>
arpi
parents:
3449
diff
changeset
|
711 break; |
2378 | 712 #ifdef USE_XANIM |
713 case VFM_XANIM: { | |
2384 | 714 xacodec_image_t* image=xacodec_decode_frame(start,in_size,drop_frame?1:0); |
715 if(image){ | |
716 blit_frame=2; | |
4188 | 717 //planes=image->planes; |
718 //stride=image->stride; | |
719 mpi->planes[0]=image->planes[0]; | |
720 mpi->planes[1]=image->planes[1]; | |
721 mpi->planes[2]=image->planes[2]; | |
722 mpi->stride[0]=image->stride[0]; | |
723 mpi->stride[1]=image->stride[1]; | |
724 mpi->stride[2]=image->stride[2]; | |
2384 | 725 } |
2378 | 726 break; |
727 } | |
728 #endif | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
729 case VFM_ODIVX: { |
1294 | 730 // OpenDivX |
731 DEC_FRAME dec_frame; | |
732 #ifdef NEW_DECORE | |
733 DEC_PICTURE dec_pic; | |
734 #endif | |
735 // let's decode | |
736 dec_frame.length = in_size; | |
737 dec_frame.bitstream = start; | |
1349 | 738 dec_frame.render_flag = drop_frame?0:1; |
739 | |
1294 | 740 #ifdef NEW_DECORE |
741 dec_frame.bmp=&dec_pic; | |
742 dec_pic.y=dec_pic.u=dec_pic.v=NULL; | |
1349 | 743 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL); |
744 #else | |
1360 | 745 opendivx_src[0]=NULL; |
1349 | 746 decore(0x123, 0, &dec_frame, NULL); |
1294 | 747 #endif |
1360 | 748 |
749 if(!drop_frame) | |
1294 | 750 |
1349 | 751 // let's display |
1294 | 752 #ifdef NEW_DECORE |
753 if(dec_pic.y){ | |
4188 | 754 mpi->planes[0]=dec_pic.y; |
755 mpi->planes[1]=dec_pic.u; | |
756 mpi->planes[2]=dec_pic.v; | |
757 mpi->stride[0]=dec_pic.stride_y; | |
758 mpi->stride[1]=mpi->stride[2]=dec_pic.stride_uv; | |
1360 | 759 blit_frame=2; |
1294 | 760 } |
761 #else | |
762 if(opendivx_src[0]){ | |
4188 | 763 // planes=opendivx_src; |
764 // stride=opendivx_stride; | |
765 mpi->planes[0]=opendivx_src[0]; | |
766 mpi->planes[1]=opendivx_src[1]; | |
767 mpi->planes[2]=opendivx_src[2]; | |
768 mpi->stride[0]=opendivx_stride[0]; | |
769 mpi->stride[1]=opendivx_stride[1]; | |
770 mpi->stride[2]=opendivx_stride[2]; | |
1360 | 771 blit_frame=2; |
1294 | 772 } |
773 #endif | |
774 | |
775 break; | |
776 } | |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
777 #ifdef NEW_DECORE |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
778 case VFM_DIVX4: { |
1349 | 779 // DivX4Linux |
780 DEC_FRAME dec_frame; | |
781 // let's decode | |
782 dec_frame.length = in_size; | |
783 dec_frame.bitstream = start; | |
784 dec_frame.render_flag = drop_frame?0:1; | |
785 dec_frame.bmp=sh_video->our_out_buffer; | |
786 dec_frame.stride=sh_video->disp_w; | |
787 // printf("Decoding DivX4 frame\n"); | |
788 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL); | |
1360 | 789 if(!drop_frame) blit_frame=3; |
1349 | 790 break; |
791 } | |
1352
5ac130627602
fixed shmem size, and now compiles without divx4linux too :)
arpi
parents:
1349
diff
changeset
|
792 #endif |
1294 | 793 #ifdef USE_DIRECTSHOW |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
794 case VFM_DSHOW: { // W32/DirectShow |
3062 | 795 if(drop_frame<2) |
796 DS_VideoDecoder_DecodeInternal(ds_vdec, start, in_size, 0, drop_frame ? 0 : sh_video->our_out_buffer); | |
1362
11673118f37f
Fix segfault in DShow video decoder. Using directshow, the
jkeil
parents:
1360
diff
changeset
|
797 if(!drop_frame && sh_video->our_out_buffer) blit_frame=3; |
1294 | 798 break; |
799 } | |
800 #endif | |
801 #ifdef USE_LIBAVCODEC | |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
802 case VFM_FFMPEG: { // libavcodec |
1294 | 803 int got_picture=0; |
1567 | 804 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"Calling ffmpeg...\n"); |
1294 | 805 if(drop_frame<2 && in_size>0){ |
806 int ret = avcodec_decode_video(&lavc_context, &lavc_picture, | |
807 &got_picture, start, in_size); | |
1489 | 808 if(verbose>1){ |
1462 | 809 unsigned char *x="???"; |
810 switch(lavc_context.pix_fmt){ | |
811 case PIX_FMT_YUV420P: x="YUV420P";break; | |
812 case PIX_FMT_YUV422: x="YUV422";break; | |
813 case PIX_FMT_RGB24: x="RGB24";break; | |
814 case PIX_FMT_BGR24: x="BGR24";break; | |
1465 | 815 #ifdef PIX_FMT_YUV422P |
1462 | 816 case PIX_FMT_YUV422P: x="YUV422P";break; |
817 case PIX_FMT_YUV444P: x="YUV444P";break; | |
1465 | 818 #endif |
1462 | 819 } |
1567 | 820 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"DONE -> got_picture=%d format=0x%X (%s) \n",got_picture, |
1462 | 821 lavc_context.pix_fmt,x); |
822 } | |
1567 | 823 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n"); |
1360 | 824 if(!drop_frame && got_picture){ |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
825 // if(!drop_frame){ |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
826 if(planar){ |
2228 | 827 #ifdef FF_POSTPROCESS |
3745 | 828 #ifdef MBC |
2228 | 829 if(lavc_pp){ |
830 // postprocess | |
2291 | 831 int w=(sh_video->disp_w+15)&(~15); |
832 int h=(sh_video->disp_h+15)&(~15); | |
833 int xoff=0; //(w-sh_video->disp_w)/2; | |
834 int yoff=0; //(h-sh_video->disp_h)/2; | |
835 if(!sh_video->our_out_buffer){ | |
836 sh_video->our_out_buffer = (char*)memalign(64,w*h*3/2); | |
837 memset(sh_video->our_out_buffer,0,w*h*3/2); | |
838 } | |
4188 | 839 mpi->stride[0]=w; |
840 mpi->stride[1]=mpi->stride[2]=w/2; | |
841 mpi->planes[0]=sh_video->our_out_buffer+mpi->stride[0]*yoff+xoff; | |
842 mpi->planes[2]=sh_video->our_out_buffer+w*h+mpi->stride[2]*(yoff>>1)+(xoff>>1); | |
843 mpi->planes[1]=mpi->planes[2]+w*h/4; | |
2228 | 844 postprocess(lavc_picture.data,lavc_picture.linesize[0], |
4188 | 845 mpi->planes,mpi->stride[0], |
2228 | 846 sh_video->disp_w,sh_video->disp_h, |
847 &quant_store[0][0],MBC+1,lavc_pp); | |
848 } else | |
849 #endif | |
3745 | 850 #endif |
2228 | 851 { |
4188 | 852 //planes=lavc_picture.data; |
853 //stride=lavc_picture.linesize; | |
854 mpi->planes[0]=lavc_picture.data[0]; | |
855 mpi->planes[1]=lavc_picture.data[1]; | |
856 mpi->planes[2]=lavc_picture.data[2]; | |
857 mpi->stride[0]=lavc_picture.linesize[0]; | |
858 mpi->stride[1]=lavc_picture.linesize[1]; | |
859 mpi->stride[2]=lavc_picture.linesize[2]; | |
860 | |
2228 | 861 //stride[1]=stride[2]=0; |
862 //stride[0]/=2; | |
863 } | |
864 blit_frame=2; | |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
865 } else { |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
866 int y; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
867 // temporary hack - FIXME |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
868 if(!sh_video->our_out_buffer) |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
869 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*2); |
1454
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
870 for(y=0;y<sh_video->disp_h;y++){ |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
871 unsigned char *s0=lavc_picture.data[0]+lavc_picture.linesize[0]*y; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
872 unsigned char *s1=lavc_picture.data[1]+lavc_picture.linesize[1]*y; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
873 unsigned char *s2=lavc_picture.data[2]+lavc_picture.linesize[2]*y; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
874 unsigned char *d=sh_video->our_out_buffer+y*2*sh_video->disp_w; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
875 int x; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
876 for(x=0;x<sh_video->disp_w/2;x++){ |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
877 d[4*x+0]=s0[2*x+0]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
878 d[4*x+1]=s1[x]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
879 d[4*x+2]=s0[2*x+1]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
880 d[4*x+3]=s2[x]; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
881 } |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
882 } |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
883 blit_frame=3; |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
884 } |
3e5b5be0b61d
temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents:
1431
diff
changeset
|
885 |
1360 | 886 } |
1294 | 887 } |
888 break; | |
889 } | |
890 #endif | |
1517
0e9c29538a86
Use USE_WIN32DLL define instead of ARCH_X86 to decide whether or not to compile
jkeil
parents:
1496
diff
changeset
|
891 #ifdef USE_WIN32DLL |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
892 case VFM_VFWEX: |
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
893 case VFM_VFW: |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1297
diff
changeset
|
894 { |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
895 int ret; |
1360 | 896 if(!in_size) break; |
2049
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
897 if((ret=vfw_decode_video(sh_video,start,in_size,drop_frame,(sh_video->codec->driver==VFM_VFWEX) ))){ |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
898 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret); |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
899 break; |
df41903fd7d7
VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents:
2044
diff
changeset
|
900 } |
1360 | 901 if(!drop_frame) blit_frame=3; |
1294 | 902 break; |
903 } | |
1309
598e3047ce13
Add some preliminary support for non-x86 architectures to mplayer
jkeil
parents:
1297
diff
changeset
|
904 #endif |
1410
eda16e490ae7
using AFM_/VFM_ macros instead of hardcoded constants (idea by al3x)
arpi
parents:
1401
diff
changeset
|
905 case VFM_MPEG: |
1873 | 906 if(out_fmt==IMGFMT_MPEGPES){ |
907 // hardware decoding: | |
908 static vo_mpegpes_t packet; | |
909 mpeg2_decode_data(video_out, start, start+in_size,3); // parse headers | |
910 packet.data=start; | |
911 packet.size=in_size-4; | |
912 packet.timestamp=sh_video->timer*90000.0; | |
913 packet.id=0x1E0; //+sh_video->ds->id; | |
4188 | 914 mpi->planes[0]=(uint8_t*)(&packet); |
1873 | 915 blit_frame=2; |
916 } else { | |
917 // software decoding: | |
2019
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
918 if( |
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
919 mpeg2_decode_data(video_out, start, start+in_size,drop_frame) > 0 // decode |
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
920 && (!drop_frame) |
7de4eceac32f
mpeg2-interlaced patch by Ivan Kalvatchev <iive@yahoo.com>
arpi
parents:
2006
diff
changeset
|
921 ) blit_frame=1; |
1873 | 922 } |
1294 | 923 break; |
1488 | 924 case VFM_RAW: |
2794 | 925 // planes[0]=start; |
926 // blit_frame=2; | |
927 sh_video->our_out_buffer = start; | |
928 blit_frame=3; | |
1488 | 929 break; |
1948 | 930 case VFM_RLE: |
931 //void AVI_Decode_RLE8(char *image,char *delta,int tdsize, | |
932 // unsigned int *map,int imagex,int imagey,unsigned char x11_bytes_pixel); | |
933 AVI_Decode_RLE8(sh_video->our_out_buffer,start,in_size, | |
934 (int*)(((char*)sh_video->bih)+40), | |
935 sh_video->disp_w,sh_video->disp_h,((out_fmt&255)+7)/8); | |
936 blit_frame=3; | |
937 break; | |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
938 case VFM_MSVIDC: |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
939 if (sh_video->bih->biBitCount == 16) |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
940 AVI_Decode_Video1_16( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
941 start, in_size, sh_video->our_out_buffer, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
942 sh_video->disp_w, sh_video->disp_h, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
943 ((out_fmt&255)+7)/8); |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
944 else |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
945 AVI_Decode_Video1_8( |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
946 start, in_size, sh_video->our_out_buffer, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
947 sh_video->disp_w, sh_video->disp_h, |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
948 (char *)sh_video->bih+40, ((out_fmt&255)+7)/8); |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
949 blit_frame = 3; |
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
950 break; |
3172 | 951 case VFM_FLI: |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
952 Decode_Fli( |
3172 | 953 start, in_size, sh_video->our_out_buffer, |
954 sh_video->disp_w, sh_video->disp_h, | |
955 ((out_fmt&255)+7)/8); | |
956 blit_frame = 3; | |
957 break; | |
3804
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
958 case VFM_NUV: |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
959 decode_nuv( |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
960 start, in_size, sh_video->our_out_buffer, |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
961 sh_video->disp_w, sh_video->disp_h); |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
962 blit_frame = 3; |
53ed66a4f0bf
NuppelVideo decoder added, based on Panagiotis Issaris' patch
alex
parents:
3745
diff
changeset
|
963 break; |
3687
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
964 case VFM_QTRLE: |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
965 qt_decode_rle( |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
966 start, in_size, sh_video->our_out_buffer, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
967 sh_video->disp_w, sh_video->disp_h, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
968 sh_video->bih->biBitCount, |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
969 ((out_fmt&255)+7)/8); |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
970 blit_frame = 3; |
7fb817c9060b
This commit adds initial support for Quicktime Animation (RLE) video. It
melanson
parents:
3646
diff
changeset
|
971 break; |
4227 | 972 case VFM_QTSMC: |
973 qt_decode_smc( | |
974 start, in_size, sh_video->our_out_buffer, | |
975 sh_video->disp_w, sh_video->disp_h, | |
4275
818be6ba8758
initial implementation of SMC codec; it almost works, too!
melanson
parents:
4227
diff
changeset
|
976 (unsigned char *)sh_video->bih+40, |
4227 | 977 ((out_fmt&255)+7)/8); |
978 blit_frame = 3; | |
979 break; | |
3969 | 980 case VFM_CYUV: |
981 decode_cyuv(start, in_size, sh_video->our_out_buffer, | |
982 sh_video->disp_w, sh_video->disp_h, (out_fmt==IMGFMT_YUY2)?16:(out_fmt&255)); | |
983 blit_frame = 3; | |
984 break; | |
1294 | 985 } // switch |
986 //------------------------ frame decoded. -------------------- | |
987 | |
3160 | 988 #ifdef ARCH_X86 |
1367 | 989 // some codecs is broken, and doesn't restore MMX state :( |
990 // it happens usually with broken/damaged files. | |
3144 | 991 if(gCpuCaps.has3DNow){ |
992 __asm __volatile ("femms\n\t":::"memory"); | |
993 } | |
994 else if(gCpuCaps.hasMMX){ | |
995 __asm __volatile ("emms\n\t":::"memory"); | |
996 } | |
3160 | 997 #endif |
1367 | 998 |
1360 | 999 t2=GetTimer();t=t2-t;video_time_usage+=t*0.000001f; |
1000 | |
1001 switch(blit_frame){ | |
1002 case 3: | |
1003 if(planar){ | |
4188 | 1004 mpi->stride[0]=sh_video->disp_w; |
1005 mpi->stride[1]=mpi->stride[2]=sh_video->disp_w/2; | |
1006 mpi->planes[0]=sh_video->our_out_buffer; | |
1007 mpi->planes[2]=mpi->planes[0]+sh_video->disp_w*sh_video->disp_h; | |
1008 mpi->planes[1]=mpi->planes[2]+sh_video->disp_w*sh_video->disp_h/4; | |
2716 | 1009 } else { |
4188 | 1010 mpi->planes[0]=sh_video->our_out_buffer; |
1011 mpi->stride[0]=sh_video->disp_w*mpi->bpp; | |
2716 | 1012 if(sh_video->bih && sh_video->bih->biSize==1064) |
4188 | 1013 mpi->planes[1]=&sh_video->bih[1]; // pointer to palette |
2716 | 1014 else |
4188 | 1015 mpi->planes[1]=NULL; |
2716 | 1016 } |
3073 | 1017 //#define VFM_RAW_POSTPROC |
1018 #ifdef VFM_RAW_POSTPROC | |
1019 if (sh_video->codec->driver == VFM_RAW) | |
1020 { | |
1021 mp_dbg(MSGT_DECVIDEO, MSGL_V, "Postprocessing raw %s!\n", | |
1022 vo_format_name(out_fmt)); | |
1023 switch(out_fmt) | |
1024 { | |
1025 case IMGFMT_YV12: | |
1026 postprocess(planes, stride[0], planes, stride[0], | |
1027 sh_video->disp_w, sh_video->disp_h, planes[0], | |
1028 0, /*0x20000*/divx_quality); | |
1029 break; | |
1030 // case IMGFMT_UYVY: | |
1031 // uyvytoyv12(start, planes[0], planes[1], planes[2], | |
1032 // sh_video->disp_w, sh_video->disp_h, stride[0], stride[1], | |
1033 // sh_video->disp_w*2); | |
1034 // postprocess(planes, stride[0], planes, stride[0], | |
1035 // sh_video->disp_w, sh_video->disp_h, planes[0], | |
1036 // 0, /*0x20000*/divx_quality); | |
1037 // break; | |
1038 default: | |
1039 mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "Unsuitable outformat (%s) for raw pp!\n", | |
1040 vo_format_name(out_fmt)); | |
1041 } | |
1042 } | |
1043 #endif | |
1360 | 1044 case 2: |
1422 | 1045 #ifdef USE_LIBVO2 |
1046 if(planar) | |
1047 vo2_draw_slice(video_out,planes,stride,sh_video->disp_w,sh_video->disp_h,0,0); | |
1048 else | |
1049 vo2_draw_frame(video_out,planes[0],sh_video->disp_w,sh_video->disp_w,sh_video->disp_h); | |
1050 #else | |
1360 | 1051 if(planar) |
4188 | 1052 video_out->draw_slice(mpi->planes,mpi->stride,sh_video->disp_w,sh_video->disp_h,0,0); |
1360 | 1053 else |
4188 | 1054 video_out->draw_frame(mpi->planes); |
1422 | 1055 #endif |
1360 | 1056 t2=GetTimer()-t2;vout_time_usage+=t2*0.000001f; |
1057 blit_frame=1; | |
1058 break; | |
1059 } | |
1060 | |
1294 | 1061 return blit_frame; |
1062 } | |
1375
dbcb5b5e1fae
file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents:
1367
diff
changeset
|
1063 |
2827
b4d46817f050
ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents:
2794
diff
changeset
|
1064 |