annotate dec_video.c @ 5311:91c8ffdd4721

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