annotate libmpcodecs/dec_video.c @ 4925:6719d1a3be53

add no fs as default for windrivers
author atmos4
date Sun, 03 Mar 2002 13:40:23 +0000
parents 7c4edfe929c8
children 45c51c7f7870
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2775
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
1
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
2 #include "config.h"
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
3
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
4 #include <stdio.h>
2775
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
5 #ifdef HAVE_MALLOC_H
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
6 #include <malloc.h>
8e3875816f6d added missing #include <malloc.h>
pl
parents: 2716
diff changeset
7 #endif
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
8 #include <stdlib.h>
1430
1728d249c783 missing unistd.h (requires for off_t under freebsd)
arpi
parents: 1429
diff changeset
9 #include <unistd.h>
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
10
1567
5c7760aa4f94 printf->mp_msg/mp_dbg
arpi
parents: 1547
diff changeset
11 #include "mp_msg.h"
1973
5216f108cb4f all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents: 1949
diff changeset
12 #include "help_mp.h"
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
13
1327
b12e1817bcc2 some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents: 1309
diff changeset
14 #include "linux/timer.h"
1496
8c3e93ef116d cleanup...
arpi
parents: 1489
diff changeset
15 #include "linux/shmem.h"
1327
b12e1817bcc2 some cleanup - fixed warnings, removed old stuff, moved audio resync to dec_audio
arpi
parents: 1309
diff changeset
16
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
17 extern int verbose; // defined in mplayer.c
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
18
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
19 #include "stream.h"
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
20 #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
21 #include "parse_es.h"
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
22
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
23 #include "codec-cfg.h"
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
24
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
25 #include "libvo/video_out.h"
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
26
4188
cfd1eed5961d using mp_image.h - not finished...
arpi
parents: 4156
diff changeset
27 #include "stheader.h"
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
28 #include "vd.h"
4188
cfd1eed5961d using mp_image.h - not finished...
arpi
parents: 4156
diff changeset
29
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
30 #include "dec_video.h"
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
31
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
32 // ===================================================================
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
33 // temp hack:
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
34
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
35 #ifdef FF_POSTPROCESS
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
36 #ifndef MBC
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
37 #define MBC 48
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
38 #define MBR 36
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
39 #endif
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
40 int quant_store[MBR+1][MBC+1]; // [Review]
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
41 #endif
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
42
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
43 int avcodec_inited=0;
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
44
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
45 // ===================================================================
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
46
4844
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
47 extern int benchmark;
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
48 extern double video_time_usage;
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
49 extern double vout_time_usage;
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
50 extern double max_video_time_usage;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
51 extern double max_vout_time_usage;
4838
5129860a980e frame dropping prediction with benchmarks
nick
parents: 4834
diff changeset
52 extern double cur_video_time_usage;
5129860a980e frame dropping prediction with benchmarks
nick
parents: 4834
diff changeset
53 extern double cur_vout_time_usage;
4388
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
54 extern vo_vaa_t vo_vaa;
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
55
2184
966ec115c87f integrated new postproc code
arpi
parents: 2087
diff changeset
56 #include "postproc/postprocess.h"
966ec115c87f integrated new postproc code
arpi
parents: 2087
diff changeset
57
3144
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
58 #include "cpudetect.h"
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
59
2563
fc124f9db88e more cleanup, warnings fixed
arpi
parents: 2541
diff changeset
60 int divx_quality=0;
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
61
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
62 static vd_functions_t* mpvdec=NULL;
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
63
1429
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
64 int get_video_quality_max(sh_video_t *sh_video){
4898
a6b9c1fc6ee9 removed codec dependent parts, only core left
arpi
parents: 4881
diff changeset
65 // switch(sh_video->codec->driver){
1429
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
66 return 0;
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
67 }
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
68
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
69 void set_video_quality(sh_video_t *sh_video,int quality){
4898
a6b9c1fc6ee9 removed codec dependent parts, only core left
arpi
parents: 4881
diff changeset
70 // switch(sh_video->codec->driver){
1429
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
71 }
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
72
4395
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
73 int set_video_colors(sh_video_t *sh_video,char *item,int value)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
74 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
75 if(vo_vaa.get_video_eq)
4388
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
76 {
4395
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
77 vidix_video_eq_t veq;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
78 if(vo_vaa.get_video_eq(&veq) == 0)
4388
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
79 {
4395
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
80 int v_hw_equ_cap = veq.cap;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
81 if(v_hw_equ_cap != 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
82 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
83 if(vo_vaa.set_video_eq)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
84 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
85 vidix_video_eq_t veq;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
86 veq.flags = VEQ_FLG_ITU_R_BT_601; /* Fixme please !!! */
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
87 if(strcmp(item,"Brightness") == 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
88 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
89 if(!(v_hw_equ_cap & VEQ_CAP_BRIGHTNESS)) goto try_sw_control;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
90 veq.brightness = value*10;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
91 veq.cap = VEQ_CAP_BRIGHTNESS;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
92 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
93 else
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
94 if(strcmp(item,"Contrast") == 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
95 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
96 if(!(v_hw_equ_cap & VEQ_CAP_CONTRAST)) goto try_sw_control;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
97 veq.contrast = value*10;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
98 veq.cap = VEQ_CAP_CONTRAST;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
99 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
100 else
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
101 if(strcmp(item,"Saturation") == 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
102 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
103 if(!(v_hw_equ_cap & VEQ_CAP_SATURATION)) goto try_sw_control;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
104 veq.saturation = value*10;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
105 veq.cap = VEQ_CAP_SATURATION;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
106 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
107 else
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
108 if(strcmp(item,"Hue") == 0)
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
109 {
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
110 if(!(v_hw_equ_cap & VEQ_CAP_HUE)) goto try_sw_control;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
111 veq.hue = value*10;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
112 veq.cap = VEQ_CAP_HUE;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
113 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
114 else goto try_sw_control;;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
115 vo_vaa.set_video_eq(&veq);
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
116 }
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
117 return 1;
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
118 }
4388
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
119 }
b6b429d10296 Support for HW equalizing
nick
parents: 4301
diff changeset
120 }
4395
817530449706 New logic of HW equalizing:
nick
parents: 4388
diff changeset
121 try_sw_control:
2938
757c3ab1a45a added support for setting color values on tv interface
alex
parents: 2827
diff changeset
122
4898
a6b9c1fc6ee9 removed codec dependent parts, only core left
arpi
parents: 4881
diff changeset
123
1429
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
124 return 0;
8986d06b2816 contrast/brightness/etc patch (temporary)
arpi
parents: 1422
diff changeset
125 }
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
126
2049
df41903fd7d7 VfW stuff moved to dll_init, warnings fixed, using dll_init.h
arpi
parents: 2044
diff changeset
127 void uninit_video(sh_video_t *sh_video){
1654
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
128 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
129 mp_msg(MSGT_DECVIDEO,MSGL_V,"uninit video: %d \n",sh_video->codec->driver);
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
130 mpvdec->uninit(sh_video);
1654
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
131 sh_video->inited=0;
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
132 }
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
133
4453
71d05615a378 Providing new tune info
nick
parents: 4395
diff changeset
134 int init_video(sh_video_t *sh_video,int *pitches)
71d05615a378 Providing new tune info
nick
parents: 4395
diff changeset
135 {
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
136 //unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx];
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
137 int i;
4453
71d05615a378 Providing new tune info
nick
parents: 4395
diff changeset
138 pitches[0] = pitches[1] =pitches[2] = 0; /* fake unknown */
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
139
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
140 //sh_video->our_out_buffer=NULL;
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
141 //sh_video->our_out_buffer_size=0U;
1454
3e5b5be0b61d temporary hack: YUV422P -> YUY2 converter (for ffmpeg MJPEG testing)
arpi
parents: 1431
diff changeset
142
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
143 for (i=0; mpcodecs_vd_drivers[i] != NULL; i++)
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
144 if(mpcodecs_vd_drivers[i]->info->id==sh_video->codec->driver){
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
145 mpvdec=mpcodecs_vd_drivers[i]; break;
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
146 }
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
147 if(!mpvdec) return 0; // no such driver
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
148
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
149 printf("Selecting Video Decoder: [%s] %s\n",mpvdec->info->short_name,mpvdec->info->name);
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
150
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
151 if(!mpvdec->init(sh_video)){
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
152 printf("VDecoder init failed :(\n");
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
153 return 0;
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
154 }
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
155
1654
9d85b84e367e dec_video uninit
arpi
parents: 1653
diff changeset
156 sh_video->inited=1;
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
157 return 1;
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
158 }
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
159
4494
382a3c60629e Allows to users control direct rendering
nick
parents: 4489
diff changeset
160 extern int vaa_use_dr;
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
161
4741
d3a52470594c More correct direct rendering usage
nick
parents: 4687
diff changeset
162 static int use_dr=0,use_dr_422=0;
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
163 static bes_da_t bda;
4741
d3a52470594c More correct direct rendering usage
nick
parents: 4687
diff changeset
164 void init_video_vaa( unsigned width )
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
165 {
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
166 unsigned adp;
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
167 memset(&bda,0,sizeof(bes_da_t));
4064940f3f9b optimization
nick
parents: 4494
diff changeset
168 if(vo_vaa.query_bes_da)
4064940f3f9b optimization
nick
parents: 4494
diff changeset
169 use_dr = vo_vaa.query_bes_da(&bda) ? 0 : 1;
4064940f3f9b optimization
nick
parents: 4494
diff changeset
170 if(!vaa_use_dr) use_dr = 0;
4745
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
171 if(use_dr)
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
172 {
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
173 uint32_t sstride,dstride;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
174 sstride=width*2;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
175 adp = bda.dest.pitch.y-1;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
176 dstride=(width*2+adp)&~adp;
398e3663ed71 Allow using direct rendering with any HW pitches (even on matrox g400).
nick
parents: 4741
diff changeset
177 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
178 }
4515
4064940f3f9b optimization
nick
parents: 4494
diff changeset
179 }
4064940f3f9b optimization
nick
parents: 4494
diff changeset
180
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
181 int decode_video(vo_functions_t *video_out,sh_video_t *sh_video,unsigned char *start,int in_size,int drop_frame){
4898
a6b9c1fc6ee9 removed codec dependent parts, only core left
arpi
parents: 4881
diff changeset
182 mp_image_t *mpi=NULL;
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
183 int blit_frame=0;
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
184 unsigned int t=GetTimer();
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
185 unsigned int t2;
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
186 double tt;
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
187
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
188 mpi=mpvdec->decode(sh_video, start, in_size, drop_frame);
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
189
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
190 //------------------------ frame decoded. --------------------
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
191
3160
80df2986ca42 {f}emms is only needed on x86
jkeil
parents: 3144
diff changeset
192 #ifdef ARCH_X86
1367
16bedc82bd09 MMX problem workaround for broken (win32) codecs
arpi
parents: 1365
diff changeset
193 // some codecs is broken, and doesn't restore MMX state :(
16bedc82bd09 MMX problem workaround for broken (win32) codecs
arpi
parents: 1365
diff changeset
194 // it happens usually with broken/damaged files.
3144
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
195 if(gCpuCaps.has3DNow){
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
196 __asm __volatile ("femms\n\t":::"memory");
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
197 }
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
198 else if(gCpuCaps.hasMMX){
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
199 __asm __volatile ("emms\n\t":::"memory");
ce34f5b40272 runtime cpu detection
michael
parents: 3073
diff changeset
200 }
3160
80df2986ca42 {f}emms is only needed on x86
jkeil
parents: 3144
diff changeset
201 #endif
1367
16bedc82bd09 MMX problem workaround for broken (win32) codecs
arpi
parents: 1365
diff changeset
202
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
203 if(!mpi) return 0; // error / skipped frame
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
204
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
205 t2=GetTimer();t=t2-t;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
206 tt = t*0.000001f;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
207 video_time_usage+=tt;
4844
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
208 if(benchmark)
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
209 {
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
210 if(tt > max_video_time_usage) max_video_time_usage=tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
211 cur_video_time_usage=tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
212 }
4898
a6b9c1fc6ee9 removed codec dependent parts, only core left
arpi
parents: 4881
diff changeset
213
4902
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
214 if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALBACK))){
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
215 // blit frame:
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
216 if(mpi->flags&MP_IMGFLAG_PLANAR)
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
217 video_out->draw_slice(mpi->planes,mpi->stride,sh_video->disp_w,sh_video->disp_h,0,0);
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
218 else
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
219 video_out->draw_frame(mpi->planes);
7c4edfe929c8 implemented basic wrapper functions to new libmpcodecs api
arpi
parents: 4901
diff changeset
220 }
4898
a6b9c1fc6ee9 removed codec dependent parts, only core left
arpi
parents: 4881
diff changeset
221
4834
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
222 t2=GetTimer()-t2;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
223 tt=t2*0.000001f;
fdb92826250c max & average benchmarks
nick
parents: 4750
diff changeset
224 vout_time_usage+=tt;
4844
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
225 if(benchmark)
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
226 {
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
227 if(tt > max_vout_time_usage) max_vout_time_usage = tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
228 cur_vout_time_usage=tt;
76acf5bbda78 exclude benchmark stuff execution from normal playback
nick
parents: 4838
diff changeset
229 }
1360
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
230 blit_frame=1;
3ab0d3f21f51 some cleanup, redundant code removed
arpi
parents: 1352
diff changeset
231
1294
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
232 return blit_frame;
0a8e0c7ddd0c video decoder stuff
arpi
parents:
diff changeset
233 }
1375
dbcb5b5e1fae file-format detection stuff moved out from mplayer.c to demuxer.c and dec_video.c
arpi
parents: 1367
diff changeset
234
2827
b4d46817f050 ms video1 (cram) codecs by Mike Melanson <melanson@pcisys.net>
arpi
parents: 2794
diff changeset
235