annotate dec_video.c @ 5095:5d4d5171334b

[REVERSE] aszitted mi?
author gabucino
date Fri, 15 Mar 2002 16:43:58 +0000
parents d26babb53d8d
children 5f82ade9c677
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
2 #define USE_MP_IMAGE
2775
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
3
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
4 #include "config.h"
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
5
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
6 #include <stdio.h>
2775
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
7 #ifdef HAVE_MALLOC_H
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
8 #include <malloc.h>
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
9 #endif
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
10 #include <stdlib.h>
1430
1728d249c783 missing unistd.h (requires for off_t under freebsd)
arpi
parents: 1429
diff changeset
11 #include <unistd.h>
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
12
1567
5c7760aa4f94 printf->mp_msg/mp_dbg
arpi
parents: 1547
diff changeset
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
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
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
8c3e93ef116d cleanup...
arpi
parents: 1489
diff changeset
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
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
19 extern int verbose; // defined in mplayer.c
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
20
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
21 #include "stream.h"
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
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
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
24
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
25 #include "codec-cfg.h"
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
26
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
27 #ifdef USE_LIBVO2
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
28 #include "libvo2/libvo2.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
29 #else
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
30 #include "libvo/video_out.h"
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
31 #endif
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
32
4188
cfd1eed5961d using mp_image.h - not finished...
arpi
parents: 4156
diff changeset
33 #include "stheader.h"
cfd1eed5961d using mp_image.h - not finished...
arpi
parents: 4156
diff changeset
34
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
35 #include "dec_video.h"
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
36
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
37 #include "roqav.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
38
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
39 // ===================================================================
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
40
4844
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
41 extern int benchmark;
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
42 extern double video_time_usage;
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
43 extern double vout_time_usage;
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
44 extern double max_video_time_usage;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
45 extern double max_vout_time_usage;
4838
5129860a980e frame dropping prediction with benchmarks
nick
parents: 4834
diff changeset
46 extern double cur_video_time_usage;
5129860a980e frame dropping prediction with benchmarks
nick
parents: 4834
diff changeset
47 extern double cur_vout_time_usage;
4388
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
48 extern vo_vaa_t vo_vaa;
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
49
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
50 extern int frameratecode2framerate[16];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
51
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
52 #include "dll_init.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
53
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
54 //#include <inttypes.h>
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
55 //#include "libvo/img_format.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
56
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
57 #include "libmpeg2/mpeg2.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
58 #include "libmpeg2/mpeg2_internal.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
59
2184
966ec115c87f integrated new postproc code
arpi
parents: 2087
diff changeset
60 #include "postproc/postprocess.h"
966ec115c87f integrated new postproc code
arpi
parents: 2087
diff changeset
61
3144
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
62 #include "cpudetect.h"
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
63
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
64 extern picture_t *picture; // exported from libmpeg2/decode.c
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
65
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
66 int divx_quality=0;
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
67
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
68 #ifdef USE_DIRECTSHOW
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
69 #include "loader/dshow/DS_VideoDecoder.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
70 static DS_VideoDecoder* ds_vdec=NULL;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
71 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
72
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
73 #ifdef USE_LIBAVCODEC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
74 #ifdef USE_LIBAVCODEC_SO
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
75 #include <libffmpeg/avcodec.h>
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
76 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
77 #include "libavcodec/avcodec.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
78 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
79 static AVCodec *lavc_codec=NULL;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
80 static AVCodecContext lavc_context;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
81 static AVPicture lavc_picture;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
82 int avcodec_inited=0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
83 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
84 #ifdef FF_POSTPROCESS
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
85 unsigned int lavc_pp=0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
86 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
87
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
88 #ifdef USE_DIVX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
89 #ifndef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
90 #include "opendivx/decore.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
91 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
92 #include <decore.h>
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
93 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
94 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
95
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
96 #ifdef USE_XANIM
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
97 #include "xacodec.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
98 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
99
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
100 #ifdef USE_TV
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
101 #include "libmpdemux/tv.h"
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
102 extern int tv_param_on;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
103 extern tvi_handle_t *tv_handler;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
104 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
105
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
106 void AVI_Decode_RLE8(char *image,char *delta,int tdsize,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
107 unsigned int *map,int imagex,int imagey,unsigned char x11_bytes_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
108
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
109 void AVI_Decode_Video1_16(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
110 char *encoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
111 int encoded_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
112 char *decoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
113 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
114 int height,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
115 int bytes_per_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
116
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
117 void AVI_Decode_Video1_8(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
118 char *encoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
119 int encoded_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
120 char *decoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
121 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
122 int height,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
123 unsigned char *palette_map,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
124 int bytes_per_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
125
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
126 void *init_fli_decoder(int width, int height);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
127
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
128 void decode_fli_frame(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
129 unsigned char *encoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
130 int encoded_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
131 unsigned char *decoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
132 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
133 int height,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
134 int bytes_per_pixel,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
135 void *context);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
136
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
137 void qt_decode_rle(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
138 unsigned char *encoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
139 int encoded_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
140 unsigned char *decoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
141 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
142 int height,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
143 int encoded_bpp,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
144 int bytes_per_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
145
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
146 void decode_nuv(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
147 unsigned char *encoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
148 int encoded_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
149 unsigned char *decoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
150 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
151 int height);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
152
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
153 void *decode_cinepak_init(void);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
154
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
155 void decode_cinepak(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
156 void *context,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
157 unsigned char *buf,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
158 int size,
4916
a41e0440edfb Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents: 4911
diff changeset
159 mp_image_t *mpi);
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
160
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
161 void decode_cyuv(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
162 unsigned char *buf,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
163 int size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
164 unsigned char *frame,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
165 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
166 int height,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
167 int bit_per_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
168
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
169 int qt_init_decode_smc(void);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
170
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
171 void qt_decode_smc(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
172 unsigned char *encoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
173 int encoded_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
174 unsigned char *decoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
175 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
176 int height,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
177 unsigned char *palette_map,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
178 int bytes_per_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
179
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
180 void decode_duck_tm1(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
181 unsigned char *encoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
182 int encoded_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
183 unsigned char *decoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
184 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
185 int height,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
186 int bytes_per_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
187
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
188 #ifdef HAVE_PNG
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
189 void decode_mpng(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
190 unsigned char *encoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
191 int encoded_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
192 unsigned char *decoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
193 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
194 int height,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
195 int bytes_per_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
196 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
197
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
198 void qt_decode_rpza(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
199 unsigned char *encoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
200 int encoded_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
201 unsigned char *decoded,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
202 int width,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
203 int height,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
204 int bytes_per_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
205
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
206 //**************************************************************************//
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
207 // The OpenDivX stuff:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
208 //**************************************************************************//
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
209
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
210 #ifndef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
211
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
212 static unsigned char *opendivx_src[3];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
213 static int opendivx_stride[3];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
214
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
215 // callback, the opendivx decoder calls this for each frame:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
216 void convert_linux(unsigned char *puc_y, int stride_y,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
217 unsigned char *puc_u, unsigned char *puc_v, int stride_uv,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
218 unsigned char *bmp, int width_y, int height_y){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
219
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
220 // printf("convert_yuv called %dx%d stride: %d,%d\n",width_y,height_y,stride_y,stride_uv);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
221
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
222 opendivx_src[0]=puc_y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
223 opendivx_src[1]=puc_u;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
224 opendivx_src[2]=puc_v;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
225
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
226 opendivx_stride[0]=stride_y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
227 opendivx_stride[1]=stride_uv;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
228 opendivx_stride[2]=stride_uv;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
229 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
230 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
231
1429
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
232 int get_video_quality_max(sh_video_t *sh_video){
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
233 switch(sh_video->codec->driver){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
234 #ifdef USE_WIN32DLL
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
235 case VFM_VFW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
236 case VFM_VFWEX:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
237 return 9; // for Divx.dll (divx4)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
238 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
239 #ifdef USE_DIRECTSHOW
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
240 case VFM_DSHOW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
241 return 4;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
242 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
243 #ifdef MPEG12_POSTPROC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
244 case VFM_MPEG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
245 return GET_PP_QUALITY_MAX;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
246 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
247 #ifdef FF_POSTPROCESS
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
248 case VFM_FFMPEG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
249 return GET_PP_QUALITY_MAX;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
250 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
251 #ifdef USE_DIVX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
252 case VFM_DIVX4:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
253 case VFM_ODIVX:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
254 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
255 return 9; // for divx4linux
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
256 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
257 return GET_PP_QUALITY_MAX; // for opendivx
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
258 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
259 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
260 }
1429
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
261 return 0;
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
262 }
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
263
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
264 void set_video_quality(sh_video_t *sh_video,int quality){
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
265 switch(sh_video->codec->driver){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
266 #ifdef USE_WIN32DLL
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
267 case VFM_VFW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
268 case VFM_VFWEX:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
269 vfw_set_postproc(sh_video,10*quality);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
270 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
271 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
272 #ifdef USE_DIRECTSHOW
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
273 case VFM_DSHOW: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
274 if(quality<0 || quality>4) quality=4;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
275 DS_VideoDecoder_SetValue(ds_vdec,"Quality",quality);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
276 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
277 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
278 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
279 #ifdef MPEG12_POSTPROC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
280 case VFM_MPEG: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
281 if(quality<0 || quality>GET_PP_QUALITY_MAX) quality=GET_PP_QUALITY_MAX;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
282 picture->pp_options=getPpModeForQuality(quality);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
283 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
284 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
285 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
286 #ifdef FF_POSTPROCESS
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
287 case VFM_FFMPEG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
288 if(quality<0 || quality>GET_PP_QUALITY_MAX) quality=GET_PP_QUALITY_MAX;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
289 lavc_pp=getPpModeForQuality(quality);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
290 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
291 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
292 #ifdef USE_DIVX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
293 case VFM_DIVX4:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
294 case VFM_ODIVX: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
295 DEC_SET dec_set;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
296 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
297 if(quality<0 || quality>9) quality=9;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
298 dec_set.postproc_level=quality*10;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
299 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
300 if(quality<0 || quality>GET_PP_QUALITY_MAX) quality=GET_PP_QUALITY_MAX;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
301 dec_set.postproc_level=getPpModeForQuality(quality);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
302 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
303 decore(0x123,DEC_OPT_SETPP,&dec_set,NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
304 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
305 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
306 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
307 }
1429
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
308 }
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
309
4395
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
310 int set_video_colors(sh_video_t *sh_video,char *item,int value)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
311 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
312 if(vo_vaa.get_video_eq)
4388
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
313 {
4395
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
314 vidix_video_eq_t veq;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
315 if(vo_vaa.get_video_eq(&veq) == 0)
4388
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
316 {
4395
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
317 int v_hw_equ_cap = veq.cap;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
318 if(v_hw_equ_cap != 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
319 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
320 if(vo_vaa.set_video_eq)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
321 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
322 vidix_video_eq_t veq;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
323 veq.flags = VEQ_FLG_ITU_R_BT_601; /* Fixme please !!! */
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
324 if(strcmp(item,"Brightness") == 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
325 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
326 if(!(v_hw_equ_cap & VEQ_CAP_BRIGHTNESS)) goto try_sw_control;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
327 veq.brightness = value*10;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
328 veq.cap = VEQ_CAP_BRIGHTNESS;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
329 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
330 else
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
331 if(strcmp(item,"Contrast") == 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
332 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
333 if(!(v_hw_equ_cap & VEQ_CAP_CONTRAST)) goto try_sw_control;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
334 veq.contrast = value*10;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
335 veq.cap = VEQ_CAP_CONTRAST;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
336 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
337 else
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
338 if(strcmp(item,"Saturation") == 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
339 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
340 if(!(v_hw_equ_cap & VEQ_CAP_SATURATION)) goto try_sw_control;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
341 veq.saturation = value*10;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
342 veq.cap = VEQ_CAP_SATURATION;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
343 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
344 else
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
345 if(strcmp(item,"Hue") == 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
346 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
347 if(!(v_hw_equ_cap & VEQ_CAP_HUE)) goto try_sw_control;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
348 veq.hue = value*10;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
349 veq.cap = VEQ_CAP_HUE;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
350 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
351 else goto try_sw_control;;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
352 vo_vaa.set_video_eq(&veq);
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
353 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
354 return 1;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
355 }
4388
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
356 }
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
357 }
4395
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
358 try_sw_control:
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
359 #ifdef USE_DIRECTSHOW
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
360 if(sh_video->codec->driver==VFM_DSHOW){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
361 DS_VideoDecoder_SetValue(ds_vdec,item,value);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
362 return 1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
363 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
364 #endif
2938
757c3ab1a45a added support for setting color values on tv interface
alex
parents: 2827
diff changeset
365
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
366 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
367 #ifdef DECORE_VERSION
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
368 #if DECORE_VERSION >= 20011010
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
369 if(sh_video->codec->driver==VFM_DIVX4){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
370 int option;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
371 if(!strcmp(item,"Brightness")) option=DEC_GAMMA_BRIGHTNESS;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
372 else if(!strcmp(item, "Contrast")) option=DEC_GAMMA_CONTRAST;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
373 else if(!strcmp(item,"Saturation")) option=DEC_GAMMA_SATURATION;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
374 else return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
375 value = (value * 256) / 100 - 128;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
376 decore(0x123, DEC_OPT_GAMMA, (void *)option, (void *) value);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
377 return 1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
378 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
379 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
380 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
381 #endif
4898
a6b9c1fc6ee9 removed codec dependent parts, only core left
arpi
parents: 4881
diff changeset
382
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
383 #ifdef USE_TV
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
384
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
385 if (tv_param_on == 1)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
386 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
387 if (!strcmp(item, "Brightness"))
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
388 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
389 tv_set_color_options(tv_handler, TV_COLOR_BRIGHTNESS, value);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
390 return(1);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
391 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
392 if (!strcmp(item, "Hue"))
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
393 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
394 tv_set_color_options(tv_handler, TV_COLOR_HUE, value);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
395 return(1);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
396 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
397 if (!strcmp(item, "Saturation"))
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
398 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
399 tv_set_color_options(tv_handler, TV_COLOR_SATURATION, value);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
400 return(1);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
401 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
402 if (!strcmp(item, "Contrast"))
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
403 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
404 tv_set_color_options(tv_handler, TV_COLOR_CONTRAST, value);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
405 return(1);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
406 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
407 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
408 #endif
1429
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
409 return 0;
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
410 }
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
411
2049
df41903fd7d7 VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents: 2044
diff changeset
412 void uninit_video(sh_video_t *sh_video){
1654
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
413 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
414 mp_msg(MSGT_DECVIDEO,MSGL_V,"uninit video: %d \n",sh_video->codec->driver);
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
415 switch(sh_video->codec->driver){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
416 #ifdef USE_LIBAVCODEC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
417 case VFM_FFMPEG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
418 if (avcodec_close(&lavc_context) < 0)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
419 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
420 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
421 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
422 #ifdef USE_DIRECTSHOW
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
423 case VFM_DSHOW: // Win32/DirectShow
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
424 if(ds_vdec){ DS_VideoDecoder_Destroy(ds_vdec); ds_vdec=NULL; }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
425 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
426 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
427 case VFM_MPEG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
428 mpeg2_free_image_buffers (picture);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
429 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
430 #ifdef USE_XANIM
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
431 case VFM_XANIM:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
432 xacodec_exit();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
433 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
434 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
435 #ifdef USE_DIVX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
436 case VFM_DIVX4:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
437 case VFM_ODIVX:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
438 decore(0x123,DEC_OPT_RELEASE,NULL,NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
439 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
440 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
441 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
442 if(sh_video->our_out_buffer){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
443 free(sh_video->our_out_buffer);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
444 sh_video->our_out_buffer=NULL;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
445 }
1654
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
446 sh_video->inited=0;
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
447 }
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
448
4453
71d05615a378 Providing new tune info
nick
parents: 4395
diff changeset
449 int init_video(sh_video_t *sh_video,int *pitches)
71d05615a378 Providing new tune info
nick
parents: 4395
diff changeset
450 {
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
451 unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx];
4453
71d05615a378 Providing new tune info
nick
parents: 4395
diff changeset
452 pitches[0] = pitches[1] =pitches[2] = 0; /* fake unknown */
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
453
1454
3e5b5be0b61d temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents: 1431
diff changeset
454 sh_video->our_out_buffer=NULL;
4875
d282da672340 We should know size of out buffer
nick
parents: 4844
diff changeset
455 sh_video->our_out_buffer_size=0U;
1454
3e5b5be0b61d temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents: 1431
diff changeset
456
4188
cfd1eed5961d using mp_image.h - not finished...
arpi
parents: 4156
diff changeset
457 sh_video->image=new_mp_image(sh_video->disp_w,sh_video->disp_h);
cfd1eed5961d using mp_image.h - not finished...
arpi
parents: 4156
diff changeset
458 mp_image_setfmt(sh_video->image,out_fmt);
cfd1eed5961d using mp_image.h - not finished...
arpi
parents: 4156
diff changeset
459
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
460 switch(sh_video->codec->driver){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
461 case VFM_ROQVIDEO:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
462 #ifdef USE_MP_IMAGE
4937
5f3f768a7596 oops...changed the wrong codec's image type
melanson
parents: 4936
diff changeset
463 sh_video->image->type=MP_IMGTYPE_IP;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
464 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
465 sh_video->our_out_buffer_size = sh_video->disp_w * sh_video->disp_h * 1.5;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
466 sh_video->our_out_buffer = (char*)memalign(64, sh_video->our_out_buffer_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
467 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
468 sh_video->context = roq_decode_video_init();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
469 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
470 case VFM_CINEPAK: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
471 #ifdef USE_MP_IMAGE
4937
5f3f768a7596 oops...changed the wrong codec's image type
melanson
parents: 4936
diff changeset
472 sh_video->image->type=MP_IMGTYPE_STATIC;
4945
b0e1dc1bba4b workaround for CVID frames width!=0
arpi
parents: 4944
diff changeset
473 sh_video->image->width=(sh_video->image->width+3)&(~3);
b0e1dc1bba4b workaround for CVID frames width!=0
arpi
parents: 4944
diff changeset
474 sh_video->image->height=(sh_video->image->height+3)&(~3);
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
475 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
476 int bpp=((out_fmt&255)+7)/8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
477 sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
478 sh_video->our_out_buffer = (char*)memalign(64, sh_video->our_out_buffer_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
479 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
480 sh_video->context = decode_cinepak_init();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
481 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
482 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
483 case VFM_XANIM: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
484 #ifdef USE_XANIM
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
485 int ret=xacodec_init_video(sh_video,out_fmt);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
486 if(!ret) return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
487 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
488 // mp_msg(MSGT_DECVIDEO, MSGL_ERR, MSGTR_NoXAnimSupport);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
489 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "MPlayer was compiled WIHTOUT XAnim support!\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
490 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
491 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
492 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
493 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
494 #ifdef USE_WIN32DLL
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
495 case VFM_VFW: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
496 if(!init_vfw_video_codec(sh_video,0)) {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
497 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
498 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
499 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32 video codec init OK!\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
500 /* Warning: these pitches tested only with YUY2 fourcc */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
501 pitches[0] = 16; pitches[1] = pitches[2] = 8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
502 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
503 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
504 case VFM_VFWEX: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
505 if(!init_vfw_video_codec(sh_video,1)) {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
506 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
507 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
508 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32Ex video codec init OK!\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
509 /* Warning: these pitches tested only with YUY2 fourcc */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
510 pitches[0] = 16; pitches[1] = pitches[2] = 8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
511 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
512 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
513 case VFM_DSHOW: { // Win32/DirectShow
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
514 #ifndef USE_DIRECTSHOW
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
515 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoDShowSupport);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
516 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
517 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
518 int bpp;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
519 if(!(ds_vdec=DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, 0))){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
520 // if(DS_VideoDecoder_Open(sh_video->codec->dll,&sh_video->codec->guid, sh_video->bih, 0, NULL)){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
521 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_video->codec->dll);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
522 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Maybe you forget to upgrade your win32 codecs?? It's time to download the new\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
523 mp_msg(MSGT_DECVIDEO,MSGL_HINT,"package from: ftp://mplayerhq.hu/MPlayer/releases/w32codec.zip !\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
524 // mp_msg(MSGT_DECVIDEO,MSGL_HINT,"Or you should disable DShow support: make distclean;make -f Makefile.No-DS\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
525 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
526 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
527
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
528 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
529 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
530 bpp=sh_video->image->bpp;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
531 if(sh_video->image->flags&MP_IMGFLAG_YUV){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
532 DS_VideoDecoder_SetDestFmt(ds_vdec,bpp,out_fmt); // YUV
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
533 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
534 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
535 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
536 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
537 switch(out_fmt){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
538 case IMGFMT_YUY2:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
539 case IMGFMT_UYVY:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
540 bpp=16;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
541 DS_VideoDecoder_SetDestFmt(ds_vdec,16,out_fmt);break; // packed YUV
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
542 case IMGFMT_YV12:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
543 case IMGFMT_I420:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
544 case IMGFMT_IYUV:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
545 bpp=12;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
546 DS_VideoDecoder_SetDestFmt(ds_vdec,12,out_fmt);break; // planar YUV
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
547 default:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
548 bpp=((out_fmt&255)+7)&(~7);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
549 DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
550 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
551 sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp/8; // FIXME!!!
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
552 sh_video->our_out_buffer = (char*)memalign(64,sh_video->our_out_buffer_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
553 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
554 /* Warning: these pitches tested only with YUY2 fourcc */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
555 pitches[0] = 16; pitches[1] = pitches[2] = 8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
556 DS_SetAttr_DivX("Quality",divx_quality);
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
557
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
558 DS_VideoDecoder_StartInternal(ds_vdec);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
559 // printf("DivX setting result = %d\n", DS_SetAttr_DivX("Quality",divx_quality) );
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
560 // printf("DivX setting result = %d\n", DS_SetValue_DivX("Brightness",60) );
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
561
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
562 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DShow video codec init OK!\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
563 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
564 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
565 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
566 #else /* !USE_WIN32DLL */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
567 case VFM_VFW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
568 case VFM_DSHOW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
569 case VFM_VFWEX:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
570 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoWfvSupport);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
571 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
572 #endif /* !USE_WIN32DLL */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
573 case VFM_ODIVX: { // OpenDivX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
574 #ifndef USE_DIVX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
575 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"MPlayer was compiled WITHOUT OpenDivx support!\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
576 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
577 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
578 mp_msg(MSGT_DECVIDEO,MSGL_V,"OpenDivX video codec\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
579 { DEC_PARAM dec_param;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
580 DEC_SET dec_set;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
581 memset(&dec_param,0,sizeof(dec_param));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
582 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
583 dec_param.output_format=DEC_USER;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
584 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
585 dec_param.color_depth = 32;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
586 #endif
4995
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
587 #ifdef DECORE_DIVX5
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
588 /* codec_version should be 311, 400 or 500 according
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
589 * to DivX version used in video, let's hope 500 is
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
590 * compatible with all DivX4 content, otherwise we
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
591 * should find some logic to also choose between
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
592 * 400 and 500 - Atmos
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
593 */
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
594 dec_param.codec_version = (sh_video->format==mmioFOURCC('D','I','V','3'))?311:500;
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
595 dec_param.build_number = 0;
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
596 #endif
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
597 dec_param.x_dim = sh_video->bih->biWidth;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
598 dec_param.y_dim = sh_video->bih->biHeight;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
599 decore(0x123, DEC_OPT_INIT, &dec_param, NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
600 dec_set.postproc_level = divx_quality;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
601 decore(0x123, DEC_OPT_SETPP, &dec_set, NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
602 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
603 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
604 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
605 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
606 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
607 case VFM_DIVX4: { // DivX4Linux
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
608 #ifndef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
609 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoDivx4Support);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
610 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
611 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
612 mp_msg(MSGT_DECVIDEO,MSGL_V,"DivX4Linux video codec\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
613 { DEC_PARAM dec_param;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
614 DEC_SET dec_set;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
615 int bits=16;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
616 memset(&dec_param,0,sizeof(dec_param));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
617 switch(out_fmt){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
618 case IMGFMT_YV12: dec_param.output_format=DEC_YV12;bits=12;break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
619 case IMGFMT_YUY2: dec_param.output_format=DEC_YUY2;break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
620 case IMGFMT_UYVY: dec_param.output_format=DEC_UYVY;break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
621 case IMGFMT_I420: dec_param.output_format=DEC_420;bits=12;break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
622 case IMGFMT_BGR15: dec_param.output_format=DEC_RGB555_INV;break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
623 case IMGFMT_BGR16: dec_param.output_format=DEC_RGB565_INV;break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
624 case IMGFMT_BGR24: dec_param.output_format=DEC_RGB24_INV;bits=24;break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
625 case IMGFMT_BGR32: dec_param.output_format=DEC_RGB32_INV;bits=32;break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
626 default:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
627 mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Unsupported out_fmt: 0x%X\n",out_fmt);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
628 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
629 }
4995
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
630 #ifdef DECORE_DIVX5
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
631 dec_param.codec_version = (sh_video->format==mmioFOURCC('D','I','V','3'))?311:500;
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
632 dec_param.build_number = 0;
d26babb53d8d DivX5linux support working (only tested with divx3 and divx4 upto now, will try getting divx5 damples now)
atmos4
parents: 4945
diff changeset
633 #endif
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
634 dec_param.x_dim = sh_video->bih->biWidth;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
635 dec_param.y_dim = sh_video->bih->biHeight;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
636 decore(0x123, DEC_OPT_INIT, &dec_param, NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
637 dec_set.postproc_level = divx_quality;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
638 decore(0x123, DEC_OPT_SETPP, &dec_set, NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
639 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
640 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
641 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
642 sh_video->our_out_buffer_size = ((bits*dec_param.x_dim+7)/8)*dec_param.y_dim;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
643 sh_video->our_out_buffer = (char*)memalign(64,sh_video->our_out_buffer_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
644 // sh_video->our_out_buffer = shmem_alloc(dec_param.x_dim*dec_param.y_dim*5);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
645 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
646 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
647 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: OpenDivX video codec init OK!\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
648 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
649 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
650 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
651 case VFM_FFMPEG: { // FFmpeg's libavcodec
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
652 #ifndef USE_LIBAVCODEC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
653 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_NoLAVCsupport);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
654 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
655 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
656 /* Just because we know that */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
657 pitches[0] = 16;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
658 pitches[1] = pitches[2] = 8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
659 mp_msg(MSGT_DECVIDEO,MSGL_V,"FFmpeg's libavcodec video codec\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
660 if(!avcodec_inited){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
661 avcodec_init();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
662 avcodec_register_all();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
663 avcodec_inited=1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
664 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
665 lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh_video->codec->dll);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
666 if(!lavc_codec){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
667 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh_video->codec->dll);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
668 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
669 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
670 memset(&lavc_context, 0, sizeof(lavc_context));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
671 // sh_video->disp_h/=2; // !!
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
672 lavc_context.width=sh_video->disp_w;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
673 lavc_context.height=sh_video->disp_h;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
674 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",lavc_context.width,lavc_context.height);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
675 if (sh_video->format == mmioFOURCC('R', 'V', '1', '3'))
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
676 lavc_context.sub_id = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
677 /* open it */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
678 if (avcodec_open(&lavc_context, lavc_codec) < 0) {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
679 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
680 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
681 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
682 #ifdef FF_POSTPROCESS
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
683 lavc_pp=divx_quality;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
684 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
685 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
686 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
687 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
688 }
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
689
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
690 case VFM_MPEG: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
691 // init libmpeg2:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
692 mpeg2_init();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
693 #ifdef MPEG12_POSTPROC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
694 picture->pp_options=divx_quality;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
695 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
696 if(divx_quality) mp_msg(MSGT_DECVIDEO,MSGL_HINT,MSGTR_MpegPPhint);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
697 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
698 /* Just because we know that */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
699 pitches[0] = 16;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
700 pitches[1] = pitches[2] = 8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
701 // send seq header to the decoder:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
702 mpeg2_decode_data(NULL,videobuffer,videobuffer+videobuf_len,0);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
703 mpeg2_allocate_image_buffers (picture);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
704 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
705 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
706 case VFM_RAW: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
707 if (sh_video->format != 0x0)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
708 /* set out_fmt */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
709 sh_video->codec->outfmt[sh_video->outfmtidx] = sh_video->format;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
710 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
711 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
712 case VFM_RLE: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
713 int bpp=((out_fmt&255)+7)/8; // RGB only
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
714 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
715 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
716 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
717 sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp; // FIXME!!!
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
718 sh_video->our_out_buffer = (char*)memalign(64,sh_video->our_out_buffer_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
719 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
720 if(bpp==2){ // 15 or 16 bpp ==> palette conversion!
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
721 unsigned int* pal=(unsigned int*)(((char*)sh_video->bih)+40);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
722 int cols=(sh_video->bih->biSize-40)/4;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
723 //int cols=1<<(sh_video->bih->biBitCount);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
724 int i;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
725 if(cols>256) cols=256;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
726 mp_msg(MSGT_DECVIDEO,MSGL_V,"RLE: converting palette for %d colors.\n",cols);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
727 for(i=0;i<cols;i++){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
728 unsigned int c=pal[i];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
729 unsigned int b=c&255;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
730 unsigned int g=(c>>8)&255;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
731 unsigned int r=(c>>16)&255;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
732 if((out_fmt&255)==15)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
733 pal[i]=((r>>3)<<10)|((g>>3)<<5)|((b>>3));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
734 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
735 pal[i]=((r>>3)<<11)|((g>>2)<<5)|((b>>3));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
736 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
737 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
738 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
739 case VFM_FLI:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
740 sh_video->context = init_fli_decoder(sh_video->disp_w, sh_video->disp_h);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
741 case VFM_MSVIDC:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
742 case VFM_QTRLE:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
743 case VFM_DUCKTM1:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
744 #ifdef HAVE_PNG
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
745 case VFM_MPNG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
746 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
747 case VFM_QTRPZA:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
748 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
749 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
750 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
751 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
752 int bpp=((out_fmt&255)+7)/8; // RGB only
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
753 sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp; // FIXME!!!
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
754 sh_video->our_out_buffer = (char*)memalign(64,sh_video->our_out_buffer_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
755 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
756 if ((sh_video->codec->driver == VFM_QTRLE) && (sh_video->bih->biBitCount != 24))
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
757 printf (
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
758 " *** FYI: This Quicktime file is using %d-bit RLE Animation\n" \
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
759 " encoding, which is not yet supported by MPlayer. But if you upload\n" \
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
760 " this Quicktime file to the MPlayer FTP, the team could look at it.\n",
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
761 sh_video->bih->biBitCount);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
762
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
763 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
764 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
765 case VFM_QTSMC:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
766 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
767 if (qt_init_decode_smc() != 0)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
768 mp_msg(MSGT_DECVIDEO, MSGL_ERR, "SMC decoder could not allocate enough memory");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
769 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
770 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
771 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
772 int bpp=((out_fmt&255)+7)/8; // RGB only
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
773 sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp; // FIXME!!!
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
774 sh_video->our_out_buffer = (char*)memalign(64, sh_video->our_out_buffer_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
775 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
776 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
777 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
778 case VFM_NUV:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
779 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
780 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
781 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
782 sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*3/2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
783 sh_video->our_out_buffer = (char *)memalign(64,sh_video->our_out_buffer_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
784 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
785 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
786 case VFM_CYUV: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
787 // int bpp=((out_fmt&255)+7)/8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
788 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
789 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
790 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
791 sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
792 sh_video->our_out_buffer = (char*)memalign(64, sh_video->our_out_buffer_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
793 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
794 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
795 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
796 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
797 }
1654
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
798 sh_video->inited=1;
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
799 return 1;
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
800 }
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
801
4494
382a3c60629e Allows to users control direct rendering
nick
parents: 4489
diff changeset
802 extern int vaa_use_dr;
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
803
4741
d3a52470594c More correct direct rendering usage
nick
parents: 4687
diff changeset
804 static int use_dr=0,use_dr_422=0;
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
805 static bes_da_t bda;
4931
6c518133c3b8 DR on multibuffering
nick
parents: 4916
diff changeset
806 static int multi_buff_num = 0;
4741
d3a52470594c More correct direct rendering usage
nick
parents: 4687
diff changeset
807 void init_video_vaa( unsigned width )
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
808 {
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
809 unsigned adp;
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
810 memset(&bda,0,sizeof(bes_da_t));
4064940f3f9b optimization
nick
parents: 4494
diff changeset
811 if(vo_vaa.query_bes_da)
4064940f3f9b optimization
nick
parents: 4494
diff changeset
812 use_dr = vo_vaa.query_bes_da(&bda) ? 0 : 1;
4064940f3f9b optimization
nick
parents: 4494
diff changeset
813 if(!vaa_use_dr) use_dr = 0;
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
814 if(use_dr)
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
815 {
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
816 uint32_t sstride,dstride;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
817 sstride=width*2;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
818 adp = bda.dest.pitch.y-1;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
819 dstride=(width*2+adp)&~adp;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
820 if(sstride == dstride) use_dr_422 = 1;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
821 }
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
822 }
4064940f3f9b optimization
nick
parents: 4494
diff changeset
823
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
824 #ifdef USE_LIBVO2
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
825 int decode_video(vo2_handle_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
826 #else
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
827 int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
828 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
829
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
830 mp_image_t *mpi=sh_video->image;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
831 unsigned int out_fmt=mpi->imgfmt; //sh_video->codec->outfmt[sh_video->outfmtidx];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
832 int planar=(mpi->flags&MP_IMGFLAG_PLANAR)!=0; //(out_fmt==IMGFMT_YV12||out_fmt==IMGFMT_IYUV||out_fmt==IMGFMT_I420);
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
833 int blit_frame=0;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
834 void *vmem;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
835 int painted;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
836
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
837 //uint8_t* planes_[3];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
838 //uint8_t** planes=planes_;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
839 //int stride_[3];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
840 //int* stride=stride_;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
841
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
842 unsigned int t=GetTimer();
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
843 unsigned int t2;
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
844 double tt;
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
845
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
846 painted = 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
847 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
848 if(mpi->type!=MP_IMGTYPE_EXPORT)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
849 if( !(mpi->flags&MP_IMGFLAG_ALLOCATED) && !(mpi->flags&MP_IMGFLAG_DIRECT) ){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
850 // allocate image buffer:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
851 sh_video->our_out_buffer = (char *)memalign(64, mpi->width*mpi->height*mpi->bpp/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
852 if((mpi->flags|MP_IMGFLAG_PLANAR) && (mpi->flags|MP_IMGFLAG_YUV)){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
853 // planar YUV
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
854 mpi->stride[0]=mpi->width;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
855 mpi->stride[1]=mpi->stride[2]=mpi->width/2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
856 mpi->planes[0]=sh_video->our_out_buffer;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
857 mpi->planes[1]=mpi->planes[0]+mpi->stride[0]*mpi->height;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
858 mpi->planes[2]=mpi->planes[1]+mpi->stride[0]*mpi->height/4;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
859 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
860 // packed YUV / RGB
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
861 mpi->stride[0]=mpi->width*mpi->bpp;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
862 mpi->planes[0]=sh_video->our_out_buffer;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
863 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
864 mpi->flags|=MP_IMGFLAG_ALLOCATED;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
865 mp_msg(MSGT_DECVIDEO,MSGL_INFO,"mp_image: allocated %d bytes for %dx%dx%d [0x%X] image\n",
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
866 mpi->width*mpi->height*mpi->bpp/8, mpi->width, mpi->height, mpi->bpp, mpi->imgfmt);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
867 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
868 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
869
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
870 //printf("decode_frame(start: %p, size: %d, w: %d, h: %d)\n",
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
871 // start, in_size, sh_video->disp_w, sh_video->disp_h);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
872
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
873 //-------------------- Decode a frame: -----------------------
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
874 switch(sh_video->codec->driver){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
875 case VFM_CINEPAK:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
876 if (in_size == 0)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
877 blit_frame = 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
878 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
879 {
4916
a41e0440edfb Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents: 4911
diff changeset
880 decode_cinepak(sh_video->context, start, in_size, mpi);
a41e0440edfb Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents: 4911
diff changeset
881 blit_frame = 2;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
882 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
883 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
884 #ifdef USE_XANIM
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
885 case VFM_XANIM: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
886 xacodec_image_t* image=xacodec_decode_frame(start,in_size,drop_frame?1:0);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
887 if(image){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
888 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
889 //planes=image->planes;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
890 //stride=image->stride;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
891 mpi->planes[0]=image->planes[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
892 mpi->planes[1]=image->planes[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
893 mpi->planes[2]=image->planes[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
894 mpi->stride[0]=image->stride[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
895 mpi->stride[1]=image->stride[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
896 mpi->stride[2]=image->stride[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
897 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
898 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
899 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
900 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
901 #ifdef USE_DIVX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
902 case VFM_ODIVX: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
903 // OpenDivX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
904 DEC_FRAME dec_frame;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
905 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
906 DEC_PICTURE dec_pic;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
907 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
908 // let's decode
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
909 dec_frame.length = in_size;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
910 dec_frame.bitstream = start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
911 dec_frame.render_flag = drop_frame?0:1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
912
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
913 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
914 dec_frame.bmp=&dec_pic;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
915 dec_pic.y=dec_pic.u=dec_pic.v=NULL;
4944
f896676db962 DivX5 Build support, not usefull because current divx5linux from avifile.sf.net only decodes black/green image
atmos4
parents: 4937
diff changeset
916 #ifdef DECORE_DIVX5
f896676db962 DivX5 Build support, not usefull because current divx5linux from avifile.sf.net only decodes black/green image
atmos4
parents: 4937
diff changeset
917 decore(0x123, DEC_OPT_FRAME, &dec_frame, NULL);
f896676db962 DivX5 Build support, not usefull because current divx5linux from avifile.sf.net only decodes black/green image
atmos4
parents: 4937
diff changeset
918 #else
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
919 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL);
4944
f896676db962 DivX5 Build support, not usefull because current divx5linux from avifile.sf.net only decodes black/green image
atmos4
parents: 4937
diff changeset
920 #endif
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
921 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
922 opendivx_src[0]=NULL;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
923 decore(0x123, 0, &dec_frame, NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
924 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
925
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
926 if(!drop_frame)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
927
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
928 // let's display
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
929 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
930 if(dec_pic.y){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
931 mpi->planes[0]=dec_pic.y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
932 mpi->planes[1]=dec_pic.u;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
933 mpi->planes[2]=dec_pic.v;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
934 mpi->stride[0]=dec_pic.stride_y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
935 mpi->stride[1]=mpi->stride[2]=dec_pic.stride_uv;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
936 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
937 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
938 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
939 if(opendivx_src[0]){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
940 // planes=opendivx_src;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
941 // stride=opendivx_stride;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
942 mpi->planes[0]=opendivx_src[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
943 mpi->planes[1]=opendivx_src[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
944 mpi->planes[2]=opendivx_src[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
945 mpi->stride[0]=opendivx_stride[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
946 mpi->stride[1]=opendivx_stride[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
947 mpi->stride[2]=opendivx_stride[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
948 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
949 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
950 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
951
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
952 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
953 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
954 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
955 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
956 case VFM_DIVX4: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
957 // DivX4Linux
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
958 DEC_FRAME dec_frame;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
959 // let's decode
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
960 dec_frame.length = in_size;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
961 dec_frame.bitstream = start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
962 dec_frame.render_flag = drop_frame?0:1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
963 dec_frame.bmp=sh_video->our_out_buffer;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
964 dec_frame.stride=sh_video->disp_w;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
965 // printf("Decoding DivX4 frame\n");
4944
f896676db962 DivX5 Build support, not usefull because current divx5linux from avifile.sf.net only decodes black/green image
atmos4
parents: 4937
diff changeset
966 #ifdef DECORE_DIVX5
f896676db962 DivX5 Build support, not usefull because current divx5linux from avifile.sf.net only decodes black/green image
atmos4
parents: 4937
diff changeset
967 decore(0x123, DEC_OPT_FRAME, &dec_frame, NULL);
f896676db962 DivX5 Build support, not usefull because current divx5linux from avifile.sf.net only decodes black/green image
atmos4
parents: 4937
diff changeset
968 #else
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
969 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL);
4944
f896676db962 DivX5 Build support, not usefull because current divx5linux from avifile.sf.net only decodes black/green image
atmos4
parents: 4937
diff changeset
970 #endif
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
971 if(!drop_frame) blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
972 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
973 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
974 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
975 #ifdef USE_DIRECTSHOW
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
976 case VFM_DSHOW: { // W32/DirectShow
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
977 if(drop_frame<2)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
978 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
979 /* FIXME: WILL WORK ONLY FOR PACKED FOURCC. BUT WHAT ABOUT PLANAR? */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
980 vmem = 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
981 if(use_dr_422)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
982 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
983 vmem = bda.dga_addr + bda.offsets[0] + bda.offset.y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
984 if(vo_doublebuffering && bda.num_frames>1)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
985 {
4931
6c518133c3b8 DR on multibuffering
nick
parents: 4916
diff changeset
986 vmem = bda.dga_addr + bda.offsets[multi_buff_num] + bda.offset.y;
6c518133c3b8 DR on multibuffering
nick
parents: 4916
diff changeset
987 multi_buff_num=(multi_buff_num+1)%bda.num_frames;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
988 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
989 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
990 DS_VideoDecoder_DecodeInternal(ds_vdec, start, in_size, 0, drop_frame ? 0 : vmem ? vmem : sh_video->our_out_buffer);
4931
6c518133c3b8 DR on multibuffering
nick
parents: 4916
diff changeset
991 if(vmem) painted = 1;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
992 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
993 if(!drop_frame && sh_video->our_out_buffer) blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
994 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
995 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
996 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
997 #ifdef USE_LIBAVCODEC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
998 case VFM_FFMPEG: { // libavcodec
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
999 int got_picture=0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1000 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"Calling ffmpeg...\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1001 if(drop_frame<2 && in_size>0){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1002 int ret = avcodec_decode_video(&lavc_context, &lavc_picture,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1003 &got_picture, start, in_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1004 if(verbose>1){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1005 unsigned char *x="???";
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1006 switch(lavc_context.pix_fmt){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1007 case PIX_FMT_YUV420P: x="YUV420P";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1008 case PIX_FMT_YUV422: x="YUV422";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1009 case PIX_FMT_RGB24: x="RGB24";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1010 case PIX_FMT_BGR24: x="BGR24";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1011 #ifdef PIX_FMT_YUV422P
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1012 case PIX_FMT_YUV422P: x="YUV422P";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1013 case PIX_FMT_YUV444P: x="YUV444P";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1014 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1015 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1016 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"DONE -> got_picture=%d format=0x%X (%s) \n",got_picture,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1017 lavc_context.pix_fmt,x);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1018 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1019 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1020 if(!drop_frame && got_picture){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1021 // if(!drop_frame){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1022 if(planar){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1023 #ifdef FF_POSTPROCESS
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1024 #ifdef MBC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1025 if(lavc_pp){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1026 // postprocess
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1027 int w=(sh_video->disp_w+15)&(~15);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1028 int h=(sh_video->disp_h+15)&(~15);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1029 int xoff=0; //(w-sh_video->disp_w)/2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1030 int yoff=0; //(h-sh_video->disp_h)/2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1031 if(!sh_video->our_out_buffer){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1032 sh_video->our_out_buffer = (char*)memalign(64,w*h*3/2);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1033 memset(sh_video->our_out_buffer,0,w*h*3/2);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1034 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1035 mpi->stride[0]=w;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1036 mpi->stride[1]=mpi->stride[2]=w/2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1037 mpi->planes[0]=sh_video->our_out_buffer+mpi->stride[0]*yoff+xoff;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1038 mpi->planes[2]=sh_video->our_out_buffer+w*h+mpi->stride[2]*(yoff>>1)+(xoff>>1);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1039 mpi->planes[1]=mpi->planes[2]+w*h/4;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1040 postprocess(lavc_picture.data,lavc_picture.linesize[0],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1041 mpi->planes,mpi->stride[0],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1042 sh_video->disp_w,sh_video->disp_h,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1043 &quant_store[0][0],MBC+1,lavc_pp);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1044 } else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1045 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1046 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1047 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1048 //planes=lavc_picture.data;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1049 //stride=lavc_picture.linesize;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1050 mpi->planes[0]=lavc_picture.data[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1051 mpi->planes[1]=lavc_picture.data[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1052 mpi->planes[2]=lavc_picture.data[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1053 mpi->stride[0]=lavc_picture.linesize[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1054 mpi->stride[1]=lavc_picture.linesize[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1055 mpi->stride[2]=lavc_picture.linesize[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1056 if(lavc_context.pix_fmt==PIX_FMT_YUV422P){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1057 mpi->stride[1]*=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1058 mpi->stride[2]*=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1059 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1060
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1061 //stride[1]=stride[2]=0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1062 //stride[0]/=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1063 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1064 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1065 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1066 int y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1067 // temporary hack - FIXME
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1068 if(!sh_video->our_out_buffer)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1069 sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*2);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1070 for(y=0;y<sh_video->disp_h;y++){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1071 unsigned char *s0=lavc_picture.data[0]+lavc_picture.linesize[0]*y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1072 unsigned char *s1=lavc_picture.data[1]+lavc_picture.linesize[1]*y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1073 unsigned char *s2=lavc_picture.data[2]+lavc_picture.linesize[2]*y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1074 unsigned char *d=sh_video->our_out_buffer+y*2*sh_video->disp_w;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1075 int x;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1076 for(x=0;x<sh_video->disp_w/2;x++){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1077 d[4*x+0]=s0[2*x+0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1078 d[4*x+1]=s1[x];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1079 d[4*x+2]=s0[2*x+1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1080 d[4*x+3]=s2[x];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1081 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1082 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1083 blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1084 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1085
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1086 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1087 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1088 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1089 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1090 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1091 #ifdef USE_WIN32DLL
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1092 case VFM_VFWEX:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1093 case VFM_VFW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1094 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1095 int ret;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1096 if(!in_size) break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1097 /* FIXME: WILL WORK ONLY FOR PACKED FOURCC. BUT WHAT ABOUT PLANAR? */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1098 vmem = 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1099 if(use_dr_422)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1100 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1101 vmem = bda.dga_addr + bda.offsets[0] + bda.offset.y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1102 if(vo_doublebuffering && bda.num_frames>1)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1103 {
4931
6c518133c3b8 DR on multibuffering
nick
parents: 4916
diff changeset
1104 vmem = bda.dga_addr + bda.offsets[multi_buff_num] + bda.offset.y;
6c518133c3b8 DR on multibuffering
nick
parents: 4916
diff changeset
1105 multi_buff_num=(multi_buff_num+1)%bda.num_frames;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1106 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1107 sh_video->our_out_buffer = vmem;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1108 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1109 if((ret=vfw_decode_video(sh_video,start,in_size,drop_frame,(sh_video->codec->driver==VFM_VFWEX) ))){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1110 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error decompressing frame, err=%d\n",ret);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1111 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1112 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1113 if(vmem) painted=1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1114 if(!drop_frame) blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1115 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1116 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1117 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1118 case VFM_MPEG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1119 if(out_fmt==IMGFMT_MPEGPES){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1120 // hardware decoding:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1121 static vo_mpegpes_t packet;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1122 mpeg2_decode_data(video_out, start, start+in_size,3); // parse headers
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1123 packet.data=start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1124 packet.size=in_size-4;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1125 packet.timestamp=sh_video->timer*90000.0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1126 packet.id=0x1E0; //+sh_video->ds->id;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1127 mpi->planes[0]=(uint8_t*)(&packet);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1128 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1129 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1130 // software decoding:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1131 if(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1132 mpeg2_decode_data(video_out, start, start+in_size,drop_frame) > 0 // decode
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1133 && (!drop_frame)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1134 ) blit_frame=1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1135 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1136 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1137 case VFM_RAW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1138 // planes[0]=start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1139 // blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1140 sh_video->our_out_buffer = start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1141 blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1142 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1143 case VFM_RLE:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1144 //void AVI_Decode_RLE8(char *image,char *delta,int tdsize,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1145 // unsigned int *map,int imagex,int imagey,unsigned char x11_bytes_pixel);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1146 AVI_Decode_RLE8(sh_video->our_out_buffer,start,in_size,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1147 (int*)(((char*)sh_video->bih)+40),
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1148 sh_video->disp_w,sh_video->disp_h,((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1149 blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1150 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1151 case VFM_MSVIDC:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1152 if (sh_video->bih->biBitCount == 16)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1153 AVI_Decode_Video1_16(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1154 start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1155 sh_video->disp_w, sh_video->disp_h,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1156 ((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1157 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1158 AVI_Decode_Video1_8(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1159 start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1160 sh_video->disp_w, sh_video->disp_h,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1161 (char *)sh_video->bih+40, ((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1162 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1163 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1164 case VFM_FLI:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1165 decode_fli_frame(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1166 start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1167 sh_video->disp_w, sh_video->disp_h,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1168 ((out_fmt&255)+7)/8,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1169 sh_video->context);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1170 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1171 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1172 case VFM_NUV:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1173 decode_nuv(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1174 start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1175 sh_video->disp_w, sh_video->disp_h);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1176 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1177 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1178 case VFM_QTRLE:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1179 qt_decode_rle(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1180 start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1181 sh_video->disp_w, sh_video->disp_h,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1182 sh_video->bih->biBitCount,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1183 ((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1184 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1185 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1186 case VFM_QTSMC:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1187 qt_decode_smc(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1188 start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1189 sh_video->disp_w, sh_video->disp_h,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1190 (unsigned char *)sh_video->bih+40,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1191 ((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1192 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1193 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1194 case VFM_DUCKTM1:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1195 decode_duck_tm1(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1196 start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1197 sh_video->disp_w, sh_video->disp_h,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1198 ((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1199 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1200 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1201 #ifdef HAVE_PNG
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1202 case VFM_MPNG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1203 decode_mpng(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1204 start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1205 sh_video->disp_w,sh_video->disp_h,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1206 ((out_fmt&255)+7)/8
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1207 );
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1208 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1209 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1210 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1211 case VFM_CYUV:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1212 decode_cyuv(start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1213 sh_video->disp_w, sh_video->disp_h, (out_fmt==IMGFMT_YUY2)?16:(out_fmt&255));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1214 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1215 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1216 case VFM_ROQVIDEO:
4936
026329111b09 first pass at RoQ video decoder...not exactly qualified as 'working' at
melanson
parents: 4931
diff changeset
1217 roq_decode_video(sh_video->context, start, in_size, mpi);
026329111b09 first pass at RoQ video decoder...not exactly qualified as 'working' at
melanson
parents: 4931
diff changeset
1218 blit_frame = 2;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1219 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1220 case VFM_QTRPZA:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1221 qt_decode_rpza(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1222 start, in_size, sh_video->our_out_buffer,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1223 sh_video->disp_w, sh_video->disp_h,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1224 ((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1225 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1226 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1227 } // switch
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
1228 //------------------------ frame decoded. --------------------
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
1229
3160
80df2986ca42 {f}emms is only needed on x86
jkeil
parents: 3144
diff changeset
1230 #ifdef ARCH_X86
1367
16bedc82bd09 MMX problem workaround for broken (win32) codecs
arpi
parents: 1365
diff changeset
1231 // some codecs is broken, and doesn't restore MMX state :(
16bedc82bd09 MMX problem workaround for broken (win32) codecs
arpi
parents: 1365
diff changeset
1232 // it happens usually with broken/damaged files.
3144
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1233 if(gCpuCaps.has3DNow){
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1234 __asm __volatile ("femms\n\t":::"memory");
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1235 }
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1236 else if(gCpuCaps.hasMMX){
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1237 __asm __volatile ("emms\n\t":::"memory");
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1238 }
3160
80df2986ca42 {f}emms is only needed on x86
jkeil
parents: 3144
diff changeset
1239 #endif
1367
16bedc82bd09 MMX problem workaround for broken (win32) codecs
arpi
parents: 1365
diff changeset
1240
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1241 t2=GetTimer();t=t2-t;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1242 tt = t*0.000001f;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1243 video_time_usage+=tt;
4844
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1244 if(benchmark)
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1245 {
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1246 if(tt > max_video_time_usage) max_video_time_usage=tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1247 cur_video_time_usage=tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1248 }
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1249 if(painted) return 1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1250 switch(blit_frame){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1251 case 3:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1252 if(planar){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1253 mpi->stride[0]=sh_video->disp_w;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1254 mpi->stride[1]=mpi->stride[2]=sh_video->disp_w/2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1255 mpi->planes[0]=sh_video->our_out_buffer;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1256 mpi->planes[2]=mpi->planes[0]+sh_video->disp_w*sh_video->disp_h;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1257 mpi->planes[1]=mpi->planes[2]+sh_video->disp_w*sh_video->disp_h/4;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1258 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1259 mpi->planes[0]=sh_video->our_out_buffer;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1260 mpi->stride[0]=sh_video->disp_w*mpi->bpp;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1261 if(sh_video->bih && sh_video->bih->biSize==1064)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1262 mpi->planes[1]=&sh_video->bih[1]; // pointer to palette
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1263 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1264 mpi->planes[1]=NULL;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1265 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1266 //#define VFM_RAW_POSTPROC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1267 #ifdef VFM_RAW_POSTPROC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1268 if (sh_video->codec->driver == VFM_RAW)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1269 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1270 mp_dbg(MSGT_DECVIDEO, MSGL_V, "Postprocessing raw %s!\n",
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1271 vo_format_name(out_fmt));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1272 switch(out_fmt)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1273 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1274 case IMGFMT_YV12:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1275 postprocess(planes, stride[0], planes, stride[0],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1276 sh_video->disp_w, sh_video->disp_h, planes[0],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1277 0, /*0x20000*/divx_quality);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1278 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1279 // case IMGFMT_UYVY:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1280 // uyvytoyv12(start, planes[0], planes[1], planes[2],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1281 // sh_video->disp_w, sh_video->disp_h, stride[0], stride[1],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1282 // sh_video->disp_w*2);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1283 // postprocess(planes, stride[0], planes, stride[0],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1284 // sh_video->disp_w, sh_video->disp_h, planes[0],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1285 // 0, /*0x20000*/divx_quality);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1286 // break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1287 default:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1288 mp_dbg(MSGT_DECVIDEO, MSGL_DBG2, "Unsuitable outformat (%s) for raw pp!\n",
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1289 vo_format_name(out_fmt));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1290 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1291 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1292 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1293 case 2:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1294 #ifdef USE_LIBVO2
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1295 if(planar)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1296 vo2_draw_slice(video_out,planes,stride,sh_video->disp_w,sh_video->disp_h,0,0);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1297 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1298 vo2_draw_frame(video_out,planes[0],sh_video->disp_w,sh_video->disp_w,sh_video->disp_h);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1299 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1300 if(planar)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1301 video_out->draw_slice(mpi->planes,mpi->stride,sh_video->disp_w,sh_video->disp_h,0,0);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1302 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1303 video_out->draw_frame(mpi->planes);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1304 #endif
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1305 t2=GetTimer()-t2;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1306 tt=t2*0.000001f;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1307 vout_time_usage+=tt;
4844
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1308 if(benchmark)
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1309 {
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1310 if(tt > max_vout_time_usage) max_vout_time_usage = tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1311 cur_vout_time_usage=tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1312 }
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
1313 blit_frame=1;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1314 break;
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
1315 }
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
1316
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
1317 return blit_frame;
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
1318 }
1375
dbcb5b5e1fae file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents: 1367
diff changeset
1319
2827
b4d46817f050 ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents: 2794
diff changeset
1320