Mercurial > mplayer.hg
annotate libmpcodecs/vd_ffmpeg.c @ 6835:a9ba8559ca6f
10l to dunno
author | atmos4 |
---|---|
date | Sun, 28 Jul 2002 22:29:04 +0000 |
parents | 2d7dfcc79651 |
children | 591a6c942551 |
rev | line source |
---|---|
4952 | 1 #include <stdio.h> |
2 #include <stdlib.h> | |
3 #include <assert.h> | |
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
4 #include <time.h> |
4952 | 5 |
6 #include "config.h" | |
7 #include "mp_msg.h" | |
8 #include "help_mp.h" | |
9 | |
10 #ifdef USE_LIBAVCODEC | |
11 | |
12 #include "bswap.h" | |
13 | |
14 #include "vd_internal.h" | |
15 | |
16 static vd_info_t info = { | |
17 "FFmpeg's libavcodec codec family", | |
18 "ffmpeg", | |
19 VFM_FFMPEG, | |
20 "A'rpi", | |
21 "http://ffmpeg.sf.net", | |
22 "native codecs" | |
23 }; | |
24 | |
25 LIBVD_EXTERN(ffmpeg) | |
26 | |
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
27 #include "../postproc/rgb2rgb.h" |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
28 |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
29 |
4952 | 30 #ifdef USE_LIBAVCODEC_SO |
31 #include <libffmpeg/avcodec.h> | |
32 #else | |
33 #include "libavcodec/avcodec.h" | |
34 #endif | |
35 | |
36 int avcodec_inited=0; | |
37 | |
5517 | 38 #ifdef FF_POSTPROCESS |
39 int quant_store[MBR+1][MBC+1]; | |
40 #endif | |
41 | |
5280 | 42 typedef struct { |
43 AVCodecContext *avctx; | |
5482 | 44 int last_aspect; |
45 int do_slices; | |
6734 | 46 int do_dr1; |
5482 | 47 int vo_inited; |
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
48 int convert; |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
49 int yuy2_support; |
6681 | 50 #if LIBAVCODEC_BUILD >= 4615 |
51 int yvu9_support; | |
52 #endif | |
5280 | 53 } vd_ffmpeg_ctx; |
54 | |
4952 | 55 //#ifdef FF_POSTPROCESS |
56 //unsigned int lavc_pp=0; | |
57 //#endif | |
58 | |
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
59 #include "cfgparser.h" |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
60 |
6739 | 61 static void get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type); |
62 | |
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
63 static int lavc_param_workaround_bugs=0; |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
64 static int lavc_param_error_resilience=0; |
6355 | 65 static int lavc_param_gray=0; |
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
66 static int lavc_param_vstats=0; |
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
67 |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
68 struct config lavc_decode_opts_conf[]={ |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
69 #if LIBAVCODEC_BUILD >= 4611 |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
70 {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL}, |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
71 {"ver", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, -1, 99, NULL}, |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
72 #endif |
6355 | 73 #if LIBAVCODEC_BUILD >= 4614 |
74 {"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL}, | |
75 #endif | |
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
76 {"vstats", &lavc_param_vstats, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL}, |
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
77 {NULL, NULL, 0, 0, 0, 0, NULL} |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
78 }; |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
79 |
4952 | 80 // to set/get/query special features/parameters |
81 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
82 vd_ffmpeg_ctx *ctx = sh->context; |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
83 switch(cmd){ |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
84 case VDCTRL_QUERY_FORMAT: |
6739 | 85 switch(*((int*)arg)){ |
86 case IMGFMT_YV12: | |
87 case IMGFMT_IYUV: | |
88 case IMGFMT_I420: | |
6835 | 89 #if LIBAVCODEC_BUILD >= 4615 |
6740 | 90 if(ctx->yvu9_support) return CONTROL_FALSE; |
6835 | 91 else |
92 #endif | |
93 return CONTROL_TRUE; | |
6739 | 94 case IMGFMT_YUY2: |
95 if(ctx->yuy2_support) return CONTROL_TRUE; | |
96 return CONTROL_FALSE; | |
6681 | 97 #if LIBAVCODEC_BUILD >= 4615 |
6739 | 98 case IMGFMT_YVU9: |
99 if(ctx->yvu9_support) return CONTROL_TRUE; | |
100 return CONTROL_FALSE; | |
6681 | 101 #endif |
6739 | 102 default: |
103 return CONTROL_FALSE; | |
104 | |
105 } | |
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
106 } |
4952 | 107 return CONTROL_UNKNOWN; |
108 } | |
109 | |
110 // init driver | |
111 static int init(sh_video_t *sh){ | |
5280 | 112 AVCodecContext *avctx; |
113 vd_ffmpeg_ctx *ctx; | |
5457
f248c9e86423
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)
alex
parents:
5331
diff
changeset
|
114 AVCodec *lavc_codec; |
4952 | 115 |
116 if(!avcodec_inited){ | |
117 avcodec_init(); | |
118 avcodec_register_all(); | |
119 avcodec_inited=1; | |
120 } | |
5280 | 121 |
122 ctx = sh->context = malloc(sizeof(vd_ffmpeg_ctx)); | |
123 if (!ctx) | |
124 return(0); | |
125 memset(ctx, 0, sizeof(vd_ffmpeg_ctx)); | |
4952 | 126 |
5457
f248c9e86423
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)
alex
parents:
5331
diff
changeset
|
127 lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll); |
f248c9e86423
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)
alex
parents:
5331
diff
changeset
|
128 if(!lavc_codec){ |
4952 | 129 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll); |
130 return 0; | |
131 } | |
5482 | 132 |
5494
1c45b1484ffb
i just fixed b-frames & slices in libavcodec :) ... iam too tired for benchmarks now ...
michael
parents:
5482
diff
changeset
|
133 if(vd_use_slices && lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) |
1c45b1484ffb
i just fixed b-frames & slices in libavcodec :) ... iam too tired for benchmarks now ...
michael
parents:
5482
diff
changeset
|
134 ctx->do_slices=1; |
6734 | 135 |
6736 | 136 #if LIBAVCODEC_BUILD > 4615 |
6735 | 137 if(lavc_codec->capabilities&CODEC_CAP_DR1) |
6734 | 138 ctx->do_dr1=1; |
6736 | 139 #endif |
140 | |
5280 | 141 ctx->avctx = malloc(sizeof(AVCodecContext)); |
142 memset(ctx->avctx, 0, sizeof(AVCodecContext)); | |
143 avctx = ctx->avctx; | |
6739 | 144 |
145 #if LIBAVCODEC_BUILD > 4615 | |
146 if(ctx->do_dr1){ | |
147 avctx->flags|= CODEC_FLAG_EMU_EDGE | CODEC_FLAG_DR1; | |
148 avctx->get_buffer_callback= get_buffer; | |
149 } | |
150 #endif | |
4952 | 151 |
5280 | 152 avctx->width = sh->disp_w; |
153 avctx->height= sh->disp_h; | |
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
154 #if LIBAVCODEC_BUILD >= 4611 |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
155 avctx->workaround_bugs= lavc_param_workaround_bugs; |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
156 avctx->error_resilience= lavc_param_error_resilience; |
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
157 #endif |
6355 | 158 #if LIBAVCODEC_BUILD >= 4614 |
159 if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY; | |
160 #endif | |
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
161 |
5280 | 162 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); |
4952 | 163 if (sh->format == mmioFOURCC('R', 'V', '1', '3')) |
5280 | 164 avctx->sub_id = 3; |
5939 | 165 #if LIBAVCODEC_BUILD >= 4605 |
166 /* AVRn stores huffman table in AVI header */ | |
167 /* Pegasus MJPEG stores it also in AVI header, but it uses the common | |
168 MJPG fourcc :( */ | |
5940 | 169 if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) && |
5939 | 170 (sh->format == mmioFOURCC('A','V','R','n') || |
171 sh->format == mmioFOURCC('M','J','P','G'))) | |
172 { | |
173 avctx->flags |= CODEC_FLAG_EXTERN_HUFF; | |
174 avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); | |
175 avctx->extradata = malloc(avctx->extradata_size); | |
176 memcpy(avctx->extradata, sh->bih+sizeof(BITMAPINFOHEADER), | |
177 avctx->extradata_size); | |
178 | |
179 #if 0 | |
180 { | |
181 int x; | |
182 uint8_t *p = avctx->extradata; | |
183 | |
184 for (x=0; x<avctx->extradata_size; x++) | |
185 printf("[%x] ", p[x]); | |
186 printf("\n"); | |
187 } | |
188 #endif | |
189 } | |
190 #endif | |
4952 | 191 /* open it */ |
5457
f248c9e86423
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)
alex
parents:
5331
diff
changeset
|
192 if (avcodec_open(avctx, lavc_codec) < 0) { |
4952 | 193 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); |
194 return 0; | |
195 } | |
196 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n"); | |
5482 | 197 ctx->last_aspect=-3; |
5510 | 198 return 1; //mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12); |
4952 | 199 } |
200 | |
201 // uninit driver | |
202 static void uninit(sh_video_t *sh){ | |
5280 | 203 vd_ffmpeg_ctx *ctx = sh->context; |
204 AVCodecContext *avctx = ctx->avctx; | |
205 | |
206 if (avcodec_close(avctx) < 0) | |
4952 | 207 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); |
5939 | 208 |
209 #if LIBAVCODEC_BUILD >= 4605 | |
210 if (avctx->extradata_size) | |
211 free(avctx->extradata); | |
212 #endif | |
213 | |
5280 | 214 if (avctx) |
215 free(avctx); | |
216 if (ctx) | |
217 free(ctx); | |
4952 | 218 } |
219 | |
5482 | 220 static void draw_slice(struct AVCodecContext *s, |
221 UINT8 **src, int linesize, | |
222 int y, int width, int height){ | |
6710 | 223 sh_video_t * sh = s->opaque; |
5482 | 224 int stride[3]; |
6740 | 225 int start=0, i; |
226 int skip_stride= (s->width+15)>>4; | |
227 UINT8 *skip= &s->mbskip_table[(y>>4)*skip_stride]; | |
228 #if LIBAVCODEC_BUILD > 4615 | |
229 int threshold= s->pict_type==B_TYPE ? -99 : s->dr_ip_buffer_count; | |
230 #endif | |
5482 | 231 |
232 stride[0]=linesize; | |
6740 | 233 #if LIBAVCODEC_BUILD > 4615 |
234 if(s->dr_uvstride) | |
235 stride[1]=stride[2]= s->dr_uvstride; | |
236 else | |
237 #endif | |
238 stride[1]=stride[2]=stride[0]/2; | |
239 #if 0 | |
240 if(s->pict_type!=B_TYPE){ | |
241 for(i=0; i*16<width+16; i++){ | |
242 if(i*16>=width || skip[i]>=threshold){ | |
243 if(start==i) start++; | |
244 else{ | |
245 UINT8 *src2[3]= {src[0] + start*16, | |
246 src[1] + start*8, | |
247 src[2] + start*8}; | |
248 //printf("%2d-%2d x %d\n", start, i, y); | |
249 mpcodecs_draw_slice (sh,src2, stride, (i-start)*16, height, start*16, y); | |
250 start= i+1; | |
251 } | |
252 } | |
253 } | |
254 }else | |
255 #endif | |
256 mpcodecs_draw_slice (sh,src, stride, width, height, 0, y); | |
5482 | 257 } |
4952 | 258 |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
259 static int init_vo(sh_video_t *sh){ |
5280 | 260 vd_ffmpeg_ctx *ctx = sh->context; |
261 AVCodecContext *avctx = ctx->avctx; | |
4952 | 262 |
5482 | 263 if (avctx->aspect_ratio_info != ctx->last_aspect || |
264 avctx->width != sh->disp_w || | |
265 avctx->height != sh->disp_h || | |
266 !ctx->vo_inited) | |
5280 | 267 { |
268 ctx->last_aspect = avctx->aspect_ratio_info; | |
269 switch(avctx->aspect_ratio_info) | |
270 { | |
271 case FF_ASPECT_4_3_625: | |
272 case FF_ASPECT_4_3_525: | |
273 sh->aspect = 4.0/3.0; | |
274 break; | |
275 case FF_ASPECT_16_9_625: | |
276 case FF_ASPECT_16_9_525: | |
277 sh->aspect = 16.0/9.0; | |
278 break; | |
279 case FF_ASPECT_SQUARE: | |
280 sh->aspect = 0.0; | |
281 break; | |
282 } | |
5482 | 283 sh->disp_w = avctx->width; |
284 sh->disp_h = avctx->height; | |
285 ctx->vo_inited=1; | |
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
286 ctx->yuy2_support=(avctx->pix_fmt==PIX_FMT_YUV422P); |
6681 | 287 #if LIBAVCODEC_BUILD >= 4615 |
288 ctx->yvu9_support=(avctx->pix_fmt==PIX_FMT_YUV410P); | |
289 #endif | |
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
290 if (!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h, |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
291 ctx->yuy2_support ? IMGFMT_YUY2 : IMGFMT_YV12)) |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
292 return -1; |
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
293 ctx->convert=(sh->codec->outfmt[sh->outfmtidx]==IMGFMT_YUY2); |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
294 } |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
295 return 0; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
296 } |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
297 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
298 #if LIBAVCODEC_BUILD > 4615 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
299 static void get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type){ |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
300 sh_video_t * sh = avctx->opaque; |
6734 | 301 vd_ffmpeg_ctx *ctx = sh->context; |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
302 mp_image_t* mpi=NULL; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
303 // int flags= MP_IMGFLAG_ALIGNED_STRIDE; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
304 int flags= MP_IMGFLAG_ACCEPT_STRIDE; |
6737 | 305 int type= MP_IMGTYPE_IPB; |
6738 | 306 int align=15; |
307 | |
308 if(avctx->pix_fmt == PIX_FMT_YUV410P) | |
309 align=63; //yes seriously, its really needed (16x16 chroma blocks in SVQ1 -> 64x64) | |
310 | |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
311 if(init_vo(sh)<0){ |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
312 printf("init_vo failed\n"); |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
313 return; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
314 } |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
315 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
316 if(pict_type==B_TYPE) |
6734 | 317 flags|=(!avctx->hurry_up && ctx->do_slices) ? |
318 MP_IMGFLAG_DRAW_CALLBACK:0; | |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
319 else |
6742
93bce3460e2a
fallback to slices, if dr1 fails (bug found by kabi)
michael
parents:
6740
diff
changeset
|
320 flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE |
93bce3460e2a
fallback to slices, if dr1 fails (bug found by kabi)
michael
parents:
6740
diff
changeset
|
321 | (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0); |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
322 |
6737 | 323 #if LIBAVCODEC_BUILD > 4616 |
324 if(avctx->has_b_frames){ | |
325 type= MP_IMGTYPE_IPB; | |
326 }else{ | |
327 type= MP_IMGTYPE_IP; | |
328 } | |
329 #endif | |
330 mp_msg(MSGT_DECVIDEO,MSGL_DBG2, type== MP_IMGTYPE_IPB ? "using IPB\n" : "using IP\n"); | |
331 | |
332 mpi= mpcodecs_get_image(sh,type, flags, | |
6738 | 333 (width+align)&(~align), (height+align)&(~align)); |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
334 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
335 // ok, lets see what did we get: |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
336 if( mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
337 !(mpi->flags&MP_IMGFLAG_DIRECT)){ |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
338 // nice, filter/vo likes draw_callback :) |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
339 avctx->draw_horiz_band= draw_slice; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
340 } else |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
341 avctx->draw_horiz_band= NULL; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
342 avctx->dr_buffer[0]= mpi->planes[0]; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
343 avctx->dr_buffer[1]= mpi->planes[1]; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
344 avctx->dr_buffer[2]= mpi->planes[2]; |
6734 | 345 |
346 if(avctx->dr_stride && avctx->dr_stride !=mpi->stride[0]){ | |
347 mp_msg(MSGT_DECVIDEO,MSGL_ERR, "Error: stride changed\n"); | |
348 } | |
349 | |
350 avctx->dr_stride = mpi->stride[0]; | |
6737 | 351 avctx->dr_uvstride = mpi->stride[1]; |
6734 | 352 |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
353 avctx->dr_opaque_frame = mpi; |
6737 | 354 avctx->dr_ip_buffer_count=2; //FIXME |
6742
93bce3460e2a
fallback to slices, if dr1 fails (bug found by kabi)
michael
parents:
6740
diff
changeset
|
355 //printf("%X\n", (int)mpi->planes[0]); |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
356 } |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
357 #endif |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
358 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
359 // decode a frame |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
360 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
361 int got_picture=0; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
362 int ret; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
363 AVPicture lavc_picture; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
364 vd_ffmpeg_ctx *ctx = sh->context; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
365 AVCodecContext *avctx = ctx->avctx; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
366 mp_image_t* mpi=NULL; |
6737 | 367 int dr1= ctx->do_dr1; |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
368 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
369 if(len<=0) return NULL; // skipped frame |
6734 | 370 |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
371 avctx->draw_horiz_band=NULL; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
372 avctx->opaque=sh; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
373 if(ctx->vo_inited && !ctx->convert && !(flags&3) && !dr1){ |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
374 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE | |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
375 (ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0), |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
376 sh->disp_w, sh->disp_h); |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
377 if(mpi && mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){ |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
378 // vd core likes slices! |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
379 avctx->draw_horiz_band=draw_slice; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
380 } |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
381 } |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
382 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
383 #if LIBAVCODEC_BUILD > 4603 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
384 avctx->hurry_up=(flags&3)?((flags&2)?2:1):0; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
385 #endif |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
386 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
387 ret = avcodec_decode_video(avctx, &lavc_picture, |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
388 &got_picture, data, len); |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
389 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n"); |
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
390 |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
391 //-- vstats generation |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
392 while(lavc_param_vstats){ // always one time loop |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
393 static FILE *fvstats=NULL; |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
394 char filename[20]; |
6834
2d7dfcc79651
Fix overall frametime overflow, hopefully long long int is portable. (untested, will test tomorrow)
atmos4
parents:
6833
diff
changeset
|
395 static long long int all_len=0; |
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
396 static int frame_number=0; |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
397 static double all_frametime=0.0; |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
398 |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
399 if(!fvstats) { |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
400 time_t today2; |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
401 struct tm *today; |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
402 today2 = time(NULL); |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
403 today = localtime(&today2); |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
404 sprintf(filename, "vstats_%02d%02d%02d.log", today->tm_hour, |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
405 today->tm_min, today->tm_sec); |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
406 fvstats = fopen(filename,"w"); |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
407 if(!fvstats) { |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
408 perror("fopen"); |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
409 lavc_param_vstats=0; // disable block |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
410 break; |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
411 /*exit(1);*/ |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
412 } |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
413 } |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
414 |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
415 all_len+=len; |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
416 all_frametime+=sh->frametime; |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
417 fprintf(fvstats, "frame= %5d q= %2d f_size= %6d s_size= %8.0fkB ", |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
418 ++frame_number, avctx->quality, len, (double)all_len/1024); |
6833
a709a7662cd1
Add type= and fix a minor typing difference from ffmpeg
atmos4
parents:
6828
diff
changeset
|
419 fprintf(fvstats, "time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", |
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
420 all_frametime, (double)(len*8)/sh->frametime/1000.0, |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
421 (double)(all_len*8)/all_frametime/1000.0); |
6833
a709a7662cd1
Add type= and fix a minor typing difference from ffmpeg
atmos4
parents:
6828
diff
changeset
|
422 fprintf(fvstats, "type= %c\n", sh->ds->flags&1 ? 'I' : 'P'); |
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
423 break; |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
424 } |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
425 //-- |
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
426 |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
427 if(!got_picture) return NULL; // skipped image |
6738 | 428 |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
429 if(init_vo(sh)<0) return NULL; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
430 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
431 #if LIBAVCODEC_BUILD > 4615 |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
432 if(dr1 && avctx->dr_opaque_frame){ |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
433 mpi= (mp_image_t*)avctx->dr_opaque_frame; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
434 } |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
435 #endif |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
436 |
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
437 if(!mpi && ctx->convert){ |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
438 // do yuv422p -> yuy2 conversion: |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
439 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
440 avctx->width, avctx->height); |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
441 if(!mpi) return NULL; |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
442 yuv422ptoyuy2(lavc_picture.data[0],lavc_picture.data[1],lavc_picture.data[2], |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
443 mpi->planes[0],avctx->width,avctx->height, |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
444 lavc_picture.linesize[0],lavc_picture.linesize[1],mpi->stride[0]); |
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
445 return mpi; |
5280 | 446 } |
4952 | 447 |
5482 | 448 if(!mpi) |
4952 | 449 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, |
5280 | 450 avctx->width, avctx->height); |
4952 | 451 if(!mpi){ // temporary! |
5207
d337cc4ab0ee
config vo if resolution changed (after decoded image read the dimensions out of lavc context)
alex
parents:
5124
diff
changeset
|
452 printf("couldn't allocate image for codec\n"); |
4952 | 453 return NULL; |
454 } | |
455 | |
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
456 if(!dr1){ |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
457 mpi->planes[0]=lavc_picture.data[0]; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
458 mpi->planes[1]=lavc_picture.data[1]; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
459 mpi->planes[2]=lavc_picture.data[2]; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
460 mpi->stride[0]=lavc_picture.linesize[0]; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
461 mpi->stride[1]=lavc_picture.linesize[1]; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
462 mpi->stride[2]=lavc_picture.linesize[2]; |
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
463 } |
4952 | 464 |
5280 | 465 if(avctx->pix_fmt==PIX_FMT_YUV422P){ |
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
466 // we have 422p but user wants yv12 (420p) |
4952 | 467 mpi->stride[1]*=2; |
468 mpi->stride[2]*=2; | |
469 } | |
470 | |
6665 | 471 /* to comfirm with newer lavc style */ |
472 #if !defined(FF_POSTPROCESS) && (LIBAVCODEC_BUILD > 4612) | |
473 mpi->qscale=avctx->quant_store; | |
474 #if LIBAVCODEC_BUILD > 4613 | |
475 mpi->qstride=avctx->qstride; | |
476 #else | |
477 mpi->qstride=MBC+1; | |
478 #endif | |
6771 | 479 #elif defined(FF_POSTPROCESS) |
5517 | 480 mpi->qscale=&quant_store[0][0]; |
481 mpi->qstride=MBC+1; | |
482 #endif | |
483 | |
4952 | 484 return mpi; |
485 } | |
486 | |
487 #endif | |
488 |