From b1deb11a2427118f470b9a528df22b2629acc669 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Fri, 26 Feb 2010 20:51:20 +0100 Subject: [PATCH] Allowed I422 direct rendering support when possible (avcodec). --- modules/codec/avcodec/video.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index a021c01f8d..e21b4ad8c4 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -298,8 +298,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, p_sys->i_direct_rendering_used = -1; if( var_CreateGetBool( p_dec, "ffmpeg-dr" ) && (p_sys->p_codec->capabilities & CODEC_CAP_DR1) && - /* Apparently direct rendering doesn't work with YUV422P */ - p_sys->p_context->pix_fmt != PIX_FMT_YUV422P && /* H264 uses too many reference frames */ p_sys->i_codec_id != CODEC_ID_H264 && /* No idea why ... but this fixes flickering on some TSCC streams */ @@ -973,6 +971,12 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context, if( (intptr_t)p_pic->p[i].p_pixels % i_align ) b_compatible = false; } + if( p_context->pix_fmt == PIX_FMT_YUV422P && b_compatible ) + { + if( 2 * p_pic->p[1].i_pitch != p_pic->p[0].i_pitch || + 2 * p_pic->p[2].i_pitch != p_pic->p[0].i_pitch ) + b_compatible = false; + } if( !b_compatible ) { decoder_DeletePicture( p_dec, p_pic ); -- 2.39.2