diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-02-16 14:31:34 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2008-02-16 14:31:34 +0000 |
commit | 539ab7489e4b462c1595ddffe1ff3201d7f18bec (patch) | |
tree | 144d133da630d8c0966b23ec2899dd11242c363b /libmpcodecs/vd_libmpeg2.c | |
parent | c19d8bdef215e7ed57b8070bb5d7aeae310b0cbf (diff) | |
download | mpv-539ab7489e4b462c1595ddffe1ff3201d7f18bec.tar.bz2 mpv-539ab7489e4b462c1595ddffe1ff3201d7f18bec.tar.xz |
Avoid reinit of vo with the exactly same parameters over and over.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26009 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vd_libmpeg2.c')
-rw-r--r-- | libmpcodecs/vd_libmpeg2.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/libmpcodecs/vd_libmpeg2.c b/libmpcodecs/vd_libmpeg2.c index 81c1a1d8a3..4dbb807750 100644 --- a/libmpcodecs/vd_libmpeg2.c +++ b/libmpcodecs/vd_libmpeg2.c @@ -32,6 +32,10 @@ typedef struct { mpeg2dec_t *mpeg2dec; int quant_store_idx; char *quant_store[3]; + int imgfmt; + int width; + int height; + double aspect; } vd_libmpeg2_ctx_t; // to set/get/query special features/parameters @@ -157,6 +161,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ int type, use_callback; mp_image_t* mpi_new; unsigned long pw, ph; + int imgfmt; switch(state){ case STATE_BUFFER: @@ -176,15 +181,24 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ // video parameters initialized/changed, (re)init libvo: if (info->sequence->width >> 1 == info->sequence->chroma_width && info->sequence->height >> 1 == info->sequence->chroma_height) { - if(!mpcodecs_config_vo(sh, - info->sequence->picture_width, - info->sequence->picture_height, IMGFMT_YV12)) return 0; + imgfmt = IMGFMT_YV12; } else if (info->sequence->width >> 1 == info->sequence->chroma_width && info->sequence->height == info->sequence->chroma_height) { - if(!mpcodecs_config_vo(sh, - info->sequence->picture_width, - info->sequence->picture_height, IMGFMT_422P)) return 0; + imgfmt = IMGFMT_422P; } else return 0; + if (imgfmt == context->imgfmt && + info->sequence->picture_width == context->width && + info->sequence->picture_height == context->height && + sh->aspect == context->aspect) + break; + if(!mpcodecs_config_vo(sh, + info->sequence->picture_width, + info->sequence->picture_height, imgfmt)) + return 0; + context->imgfmt = imgfmt; + context->width = info->sequence->picture_width; + context->height = info->sequence->picture_height; + context->aspect = sh->aspect; break; case STATE_PICTURE: type=info->current_picture->flags&PIC_MASK_CODING_TYPE; |