annotate dec_video.c @ 4929:939eacee89ab

Use as much buffers as possible
author nick
date Sun, 03 Mar 2002 16:53:12 +0000
parents a41e0440edfb
children 6c518133c3b8
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
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
463 sh_video->image->type=MP_IMGTYPE_STATIC;
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
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
472 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
473 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
474 int bpp=((out_fmt&255)+7)/8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
475 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
476 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
477 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
478 sh_video->context = decode_cinepak_init();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
479 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
480 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
481 case VFM_XANIM: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
482 #ifdef USE_XANIM
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
483 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
484 if(!ret) return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
485 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
486 // 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
487 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
488 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
489 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
490 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
491 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
492 #ifdef USE_WIN32DLL
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
493 case VFM_VFW: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
494 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
495 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
496 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
497 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
498 /* 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
499 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
500 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
501 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
502 case VFM_VFWEX: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
503 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
504 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
505 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
506 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
507 /* 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
508 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
509 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
510 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
511 case VFM_DSHOW: { // Win32/DirectShow
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
512 #ifndef USE_DIRECTSHOW
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
513 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
514 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
515 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
516 int bpp;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
517 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
518 // 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
519 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
520 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
521 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
522 // 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
523 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
524 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
525
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
526 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
527 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
528 bpp=sh_video->image->bpp;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
529 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
530 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
531 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
532 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
533 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
534 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
535 switch(out_fmt){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
536 case IMGFMT_YUY2:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
537 case IMGFMT_UYVY:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
538 bpp=16;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
539 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
540 case IMGFMT_YV12:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
541 case IMGFMT_I420:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
542 case IMGFMT_IYUV:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
543 bpp=12;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
544 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
545 default:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
546 bpp=((out_fmt&255)+7)&(~7);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
547 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
548 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
549 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
550 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
551 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
552 /* 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
553 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
554 DS_SetAttr_DivX("Quality",divx_quality);
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
555
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
556 DS_VideoDecoder_StartInternal(ds_vdec);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
557 // 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
558 // 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
559
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
560 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
561 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
562 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
563 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
564 #else /* !USE_WIN32DLL */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
565 case VFM_VFW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
566 case VFM_DSHOW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
567 case VFM_VFWEX:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
568 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
569 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
570 #endif /* !USE_WIN32DLL */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
571 case VFM_ODIVX: { // OpenDivX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
572 #ifndef USE_DIVX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
573 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
574 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
575 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
576 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
577 { DEC_PARAM dec_param;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
578 DEC_SET dec_set;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
579 memset(&dec_param,0,sizeof(dec_param));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
580 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
581 dec_param.output_format=DEC_USER;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
582 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
583 dec_param.color_depth = 32;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
584 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
585 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
586 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
587 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
588 dec_set.postproc_level = divx_quality;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
589 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
590 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
591 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
592 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
593 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
594 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
595 case VFM_DIVX4: { // DivX4Linux
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
596 #ifndef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
597 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
598 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
599 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
600 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
601 { DEC_PARAM dec_param;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
602 DEC_SET dec_set;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
603 int bits=16;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
604 memset(&dec_param,0,sizeof(dec_param));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
605 switch(out_fmt){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
606 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
607 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
608 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
609 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
610 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
611 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
612 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
613 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
614 default:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
615 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
616 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
617 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
618 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
619 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
620 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
621 dec_set.postproc_level = divx_quality;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
622 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
623 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
624 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
625 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
626 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
627 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
628 // 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
629 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
630 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
631 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
632 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
633 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
634 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
635 case VFM_FFMPEG: { // FFmpeg's libavcodec
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
636 #ifndef USE_LIBAVCODEC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
637 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
638 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
639 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
640 /* Just because we know that */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
641 pitches[0] = 16;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
642 pitches[1] = pitches[2] = 8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
643 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
644 if(!avcodec_inited){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
645 avcodec_init();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
646 avcodec_register_all();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
647 avcodec_inited=1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
648 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
649 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
650 if(!lavc_codec){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
651 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
652 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
653 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
654 memset(&lavc_context, 0, sizeof(lavc_context));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
655 // sh_video->disp_h/=2; // !!
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
656 lavc_context.width=sh_video->disp_w;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
657 lavc_context.height=sh_video->disp_h;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
658 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
659 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
660 lavc_context.sub_id = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
661 /* open it */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
662 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
663 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
664 return 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
665 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
666 #ifdef FF_POSTPROCESS
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
667 lavc_pp=divx_quality;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
668 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
669 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
670 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
671 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
672 }
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
673
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
674 case VFM_MPEG: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
675 // init libmpeg2:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
676 mpeg2_init();
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
677 #ifdef MPEG12_POSTPROC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
678 picture->pp_options=divx_quality;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
679 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
680 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
681 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
682 /* Just because we know that */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
683 pitches[0] = 16;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
684 pitches[1] = pitches[2] = 8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
685 // send seq header to the decoder:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
686 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
687 mpeg2_allocate_image_buffers (picture);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
688 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
689 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
690 case VFM_RAW: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
691 if (sh_video->format != 0x0)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
692 /* set out_fmt */
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
693 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
694 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
695 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
696 case VFM_RLE: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
697 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
698 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
699 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
700 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
701 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
702 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
703 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
704 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
705 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
706 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
707 //int cols=1<<(sh_video->bih->biBitCount);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
708 int i;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
709 if(cols>256) cols=256;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
710 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
711 for(i=0;i<cols;i++){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
712 unsigned int c=pal[i];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
713 unsigned int b=c&255;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
714 unsigned int g=(c>>8)&255;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
715 unsigned int r=(c>>16)&255;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
716 if((out_fmt&255)==15)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
717 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
718 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
719 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
720 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
721 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
722 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
723 case VFM_FLI:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
724 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
725 case VFM_MSVIDC:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
726 case VFM_QTRLE:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
727 case VFM_DUCKTM1:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
728 #ifdef HAVE_PNG
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
729 case VFM_MPNG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
730 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
731 case VFM_QTRPZA:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
732 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
733 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
734 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
735 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
736 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
737 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
738 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
739 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
740 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
741 printf (
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
742 " *** 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
743 " 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
744 " 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
745 sh_video->bih->biBitCount);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
746
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
747 break;
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 case VFM_QTSMC:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
750 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
751 if (qt_init_decode_smc() != 0)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
752 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
753 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
754 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
755 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
756 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
757 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
758 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
759 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
760 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
761 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
762 case VFM_NUV:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
763 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
764 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
765 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
766 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
767 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
768 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
769 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
770 case VFM_CYUV: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
771 // int bpp=((out_fmt&255)+7)/8;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
772 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
773 sh_video->image->type=MP_IMGTYPE_STATIC;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
774 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
775 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
776 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
777 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
778 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
779 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
780 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
781 }
1654
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
782 sh_video->inited=1;
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
783 return 1;
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
784 }
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
785
4494
382a3c60629e Allows to users control direct rendering
nick
parents: 4489
diff changeset
786 extern int vaa_use_dr;
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
787
4741
d3a52470594c More correct direct rendering usage
nick
parents: 4687
diff changeset
788 static int use_dr=0,use_dr_422=0;
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
789 static bes_da_t bda;
4741
d3a52470594c More correct direct rendering usage
nick
parents: 4687
diff changeset
790 void init_video_vaa( unsigned width )
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
791 {
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
792 unsigned adp;
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
793 memset(&bda,0,sizeof(bes_da_t));
4064940f3f9b optimization
nick
parents: 4494
diff changeset
794 if(vo_vaa.query_bes_da)
4064940f3f9b optimization
nick
parents: 4494
diff changeset
795 use_dr = vo_vaa.query_bes_da(&bda) ? 0 : 1;
4064940f3f9b optimization
nick
parents: 4494
diff changeset
796 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
797 if(use_dr)
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
798 {
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
799 uint32_t sstride,dstride;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
800 sstride=width*2;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
801 adp = bda.dest.pitch.y-1;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
802 dstride=(width*2+adp)&~adp;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
803 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
804 }
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
805 }
4064940f3f9b optimization
nick
parents: 4494
diff changeset
806
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
807 #ifdef USE_LIBVO2
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
808 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
809 #else
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
810 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
811 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
812
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
813 mp_image_t *mpi=sh_video->image;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
814 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
815 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
816 int blit_frame=0;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
817 void *vmem;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
818 int painted;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
819 static int double_buff_num = 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
820
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
821 //uint8_t* planes_[3];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
822 //uint8_t** planes=planes_;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
823 //int stride_[3];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
824 //int* stride=stride_;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
825
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
826 unsigned int t=GetTimer();
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
827 unsigned int t2;
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
828 double tt;
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
829
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
830 painted = 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
831 #ifdef USE_MP_IMAGE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
832 if(mpi->type!=MP_IMGTYPE_EXPORT)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
833 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
834 // allocate image buffer:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
835 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
836 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
837 // planar YUV
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
838 mpi->stride[0]=mpi->width;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
839 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
840 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
841 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
842 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
843 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
844 // packed YUV / RGB
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
845 mpi->stride[0]=mpi->width*mpi->bpp;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
846 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
847 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
848 mpi->flags|=MP_IMGFLAG_ALLOCATED;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
849 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
850 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
851 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
852 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
853
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
854 //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
855 // 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
856
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
857 //-------------------- Decode a frame: -----------------------
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
858 switch(sh_video->codec->driver){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
859 case VFM_CINEPAK:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
860 if (in_size == 0)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
861 blit_frame = 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
862 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
863 {
4916
a41e0440edfb Cinepak decoder now use mp_image_t -> YV12 worx, others disabled
arpi
parents: 4911
diff changeset
864 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
865 blit_frame = 2;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
866 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
867 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
868 #ifdef USE_XANIM
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
869 case VFM_XANIM: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
870 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
871 if(image){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
872 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
873 //planes=image->planes;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
874 //stride=image->stride;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
875 mpi->planes[0]=image->planes[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
876 mpi->planes[1]=image->planes[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
877 mpi->planes[2]=image->planes[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
878 mpi->stride[0]=image->stride[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
879 mpi->stride[1]=image->stride[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
880 mpi->stride[2]=image->stride[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
881 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
882 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
883 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
884 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
885 #ifdef USE_DIVX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
886 case VFM_ODIVX: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
887 // OpenDivX
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
888 DEC_FRAME dec_frame;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
889 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
890 DEC_PICTURE dec_pic;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
891 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
892 // let's decode
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
893 dec_frame.length = in_size;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
894 dec_frame.bitstream = start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
895 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
896
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
897 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
898 dec_frame.bmp=&dec_pic;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
899 dec_pic.y=dec_pic.u=dec_pic.v=NULL;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
900 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
901 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
902 opendivx_src[0]=NULL;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
903 decore(0x123, 0, &dec_frame, NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
904 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
905
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
906 if(!drop_frame)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
907
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
908 // let's display
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
909 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
910 if(dec_pic.y){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
911 mpi->planes[0]=dec_pic.y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
912 mpi->planes[1]=dec_pic.u;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
913 mpi->planes[2]=dec_pic.v;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
914 mpi->stride[0]=dec_pic.stride_y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
915 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
916 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
917 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
918 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
919 if(opendivx_src[0]){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
920 // planes=opendivx_src;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
921 // stride=opendivx_stride;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
922 mpi->planes[0]=opendivx_src[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
923 mpi->planes[1]=opendivx_src[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
924 mpi->planes[2]=opendivx_src[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
925 mpi->stride[0]=opendivx_stride[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
926 mpi->stride[1]=opendivx_stride[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
927 mpi->stride[2]=opendivx_stride[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
928 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
929 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
930 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
931
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
932 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
933 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
934 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
935 #ifdef NEW_DECORE
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
936 case VFM_DIVX4: {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
937 // DivX4Linux
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
938 DEC_FRAME dec_frame;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
939 // let's decode
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
940 dec_frame.length = in_size;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
941 dec_frame.bitstream = start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
942 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
943 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
944 dec_frame.stride=sh_video->disp_w;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
945 // printf("Decoding DivX4 frame\n");
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
946 decore(0x123, (sh_video->format==mmioFOURCC('D','I','V','3'))?DEC_OPT_FRAME_311:DEC_OPT_FRAME, &dec_frame, NULL);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
947 if(!drop_frame) blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
948 break;
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 #ifdef USE_DIRECTSHOW
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
952 case VFM_DSHOW: { // W32/DirectShow
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
953 if(drop_frame<2)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
954 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
955 /* 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
956 vmem = 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
957 if(use_dr_422)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
958 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
959 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
960 if(vo_doublebuffering && bda.num_frames>1)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
961 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
962 if(double_buff_num) vmem = bda.dga_addr + bda.offsets[1] + bda.offset.y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
963 else 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
964 double_buff_num = double_buff_num ? 0 : 1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
965 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
966 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
967 DS_VideoDecoder_DecodeInternal(ds_vdec, start, in_size, 0, drop_frame ? 0 : vmem ? vmem : sh_video->our_out_buffer);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
968 if(vmem) painted = 1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
969 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
970 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
971 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
972 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
973 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
974 #ifdef USE_LIBAVCODEC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
975 case VFM_FFMPEG: { // libavcodec
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
976 int got_picture=0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
977 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
978 if(drop_frame<2 && in_size>0){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
979 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
980 &got_picture, start, in_size);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
981 if(verbose>1){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
982 unsigned char *x="???";
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
983 switch(lavc_context.pix_fmt){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
984 case PIX_FMT_YUV420P: x="YUV420P";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
985 case PIX_FMT_YUV422: x="YUV422";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
986 case PIX_FMT_RGB24: x="RGB24";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
987 case PIX_FMT_BGR24: x="BGR24";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
988 #ifdef PIX_FMT_YUV422P
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
989 case PIX_FMT_YUV422P: x="YUV422P";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
990 case PIX_FMT_YUV444P: x="YUV444P";break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
991 #endif
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 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
994 lavc_context.pix_fmt,x);
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 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
997 if(!drop_frame && got_picture){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
998 // if(!drop_frame){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
999 if(planar){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1000 #ifdef FF_POSTPROCESS
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1001 #ifdef MBC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1002 if(lavc_pp){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1003 // postprocess
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1004 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
1005 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
1006 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
1007 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
1008 if(!sh_video->our_out_buffer){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1009 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
1010 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
1011 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1012 mpi->stride[0]=w;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1013 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
1014 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
1015 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
1016 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
1017 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
1018 mpi->planes,mpi->stride[0],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1019 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
1020 &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
1021 } else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1022 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1023 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1024 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1025 //planes=lavc_picture.data;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1026 //stride=lavc_picture.linesize;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1027 mpi->planes[0]=lavc_picture.data[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1028 mpi->planes[1]=lavc_picture.data[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1029 mpi->planes[2]=lavc_picture.data[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1030 mpi->stride[0]=lavc_picture.linesize[0];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1031 mpi->stride[1]=lavc_picture.linesize[1];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1032 mpi->stride[2]=lavc_picture.linesize[2];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1033 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
1034 mpi->stride[1]*=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1035 mpi->stride[2]*=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1036 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1037
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1038 //stride[1]=stride[2]=0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1039 //stride[0]/=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1040 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1041 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1042 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1043 int y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1044 // temporary hack - FIXME
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1045 if(!sh_video->our_out_buffer)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1046 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
1047 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
1048 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
1049 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
1050 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
1051 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
1052 int x;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1053 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
1054 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
1055 d[4*x+1]=s1[x];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1056 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
1057 d[4*x+3]=s2[x];
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1058 }
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 blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1061 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1062
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 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1065 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1066 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1067 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1068 #ifdef USE_WIN32DLL
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1069 case VFM_VFWEX:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1070 case VFM_VFW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1071 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1072 int ret;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1073 if(!in_size) break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1074 /* 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
1075 vmem = 0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1076 if(use_dr_422)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1077 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1078 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
1079 if(vo_doublebuffering && bda.num_frames>1)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1080 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1081 if(double_buff_num) vmem = bda.dga_addr + bda.offsets[1] + bda.offset.y;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1082 else 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
1083 double_buff_num = double_buff_num ? 0 : 1;
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 sh_video->our_out_buffer = vmem;
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 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
1088 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
1089 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1090 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1091 if(vmem) painted=1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1092 if(!drop_frame) blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1093 break;
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 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1096 case VFM_MPEG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1097 if(out_fmt==IMGFMT_MPEGPES){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1098 // hardware decoding:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1099 static vo_mpegpes_t packet;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1100 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
1101 packet.data=start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1102 packet.size=in_size-4;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1103 packet.timestamp=sh_video->timer*90000.0;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1104 packet.id=0x1E0; //+sh_video->ds->id;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1105 mpi->planes[0]=(uint8_t*)(&packet);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1106 blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1107 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1108 // software decoding:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1109 if(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1110 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
1111 && (!drop_frame)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1112 ) blit_frame=1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1113 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1114 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1115 case VFM_RAW:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1116 // planes[0]=start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1117 // blit_frame=2;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1118 sh_video->our_out_buffer = start;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1119 blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1120 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1121 case VFM_RLE:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1122 //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
1123 // 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
1124 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
1125 (int*)(((char*)sh_video->bih)+40),
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1126 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
1127 blit_frame=3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1128 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1129 case VFM_MSVIDC:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1130 if (sh_video->bih->biBitCount == 16)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1131 AVI_Decode_Video1_16(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1132 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
1133 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
1134 ((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1135 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1136 AVI_Decode_Video1_8(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1137 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
1138 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
1139 (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
1140 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1141 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1142 case VFM_FLI:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1143 decode_fli_frame(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1144 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
1145 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
1146 ((out_fmt&255)+7)/8,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1147 sh_video->context);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1148 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1149 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1150 case VFM_NUV:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1151 decode_nuv(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1152 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
1153 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
1154 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1155 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1156 case VFM_QTRLE:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1157 qt_decode_rle(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1158 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
1159 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
1160 sh_video->bih->biBitCount,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1161 ((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_QTSMC:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1165 qt_decode_smc(
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 (unsigned char *)sh_video->bih+40,
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1169 ((out_fmt&255)+7)/8);
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_DUCKTM1:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1173 decode_duck_tm1(
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 ((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1177 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1178 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1179 #ifdef HAVE_PNG
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1180 case VFM_MPNG:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1181 decode_mpng(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1182 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
1183 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
1184 ((out_fmt&255)+7)/8
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1185 );
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1186 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1187 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1188 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1189 case VFM_CYUV:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1190 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
1191 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
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_ROQVIDEO:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1195 roq_decode_video(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
1196 sh_video->disp_w, sh_video->disp_h, sh_video->context);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1197 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1198 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1199 case VFM_QTRPZA:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1200 qt_decode_rpza(
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1201 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
1202 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
1203 ((out_fmt&255)+7)/8);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1204 blit_frame = 3;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1205 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1206 } // switch
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
1207 //------------------------ frame decoded. --------------------
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
1208
3160
80df2986ca42 {f}emms is only needed on x86
jkeil
parents: 3144
diff changeset
1209 #ifdef ARCH_X86
1367
16bedc82bd09 MMX problem workaround for broken (win32) codecs
arpi
parents: 1365
diff changeset
1210 // some codecs is broken, and doesn't restore MMX state :(
16bedc82bd09 MMX problem workaround for broken (win32) codecs
arpi
parents: 1365
diff changeset
1211 // it happens usually with broken/damaged files.
3144
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1212 if(gCpuCaps.has3DNow){
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1213 __asm __volatile ("femms\n\t":::"memory");
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1214 }
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1215 else if(gCpuCaps.hasMMX){
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1216 __asm __volatile ("emms\n\t":::"memory");
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
1217 }
3160
80df2986ca42 {f}emms is only needed on x86
jkeil
parents: 3144
diff changeset
1218 #endif
1367
16bedc82bd09 MMX problem workaround for broken (win32) codecs
arpi
parents: 1365
diff changeset
1219
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1220 t2=GetTimer();t=t2-t;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1221 tt = t*0.000001f;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1222 video_time_usage+=tt;
4844
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1223 if(benchmark)
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1224 {
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1225 if(tt > max_video_time_usage) max_video_time_usage=tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1226 cur_video_time_usage=tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1227 }
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1228 if(painted) return 1;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1229 switch(blit_frame){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1230 case 3:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1231 if(planar){
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1232 mpi->stride[0]=sh_video->disp_w;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1233 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
1234 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
1235 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
1236 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
1237 } else {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1238 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
1239 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
1240 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
1241 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
1242 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1243 mpi->planes[1]=NULL;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1244 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1245 //#define VFM_RAW_POSTPROC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1246 #ifdef VFM_RAW_POSTPROC
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1247 if (sh_video->codec->driver == VFM_RAW)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1248 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1249 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
1250 vo_format_name(out_fmt));
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1251 switch(out_fmt)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1252 {
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1253 case IMGFMT_YV12:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1254 postprocess(planes, stride[0], planes, stride[0],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1255 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
1256 0, /*0x20000*/divx_quality);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1257 break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1258 // case IMGFMT_UYVY:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1259 // 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
1260 // 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
1261 // sh_video->disp_w*2);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1262 // postprocess(planes, stride[0], planes, stride[0],
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1263 // 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
1264 // 0, /*0x20000*/divx_quality);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1265 // break;
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1266 default:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1267 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
1268 vo_format_name(out_fmt));
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 }
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1271 #endif
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1272 case 2:
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1273 #ifdef USE_LIBVO2
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1274 if(planar)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1275 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
1276 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1277 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
1278 #else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1279 if(planar)
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1280 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
1281 else
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1282 video_out->draw_frame(mpi->planes);
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1283 #endif
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1284 t2=GetTimer()-t2;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1285 tt=t2*0.000001f;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
1286 vout_time_usage+=tt;
4844
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1287 if(benchmark)
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1288 {
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1289 if(tt > max_vout_time_usage) max_vout_time_usage = tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1290 cur_vout_time_usage=tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
1291 }
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
1292 blit_frame=1;
4911
6078b7894e20 Native Cinepak decoder: Added YV12 support (which is so very close
melanson
parents: 4898
diff changeset
1293 break;
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
1294 }
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
1295
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
1296 return blit_frame;
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
1297 }
1375
dbcb5b5e1fae file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents: 1367
diff changeset
1298
2827
b4d46817f050 ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents: 2794
diff changeset
1299