]> git.sesse.net Git - vlc/commitdiff
Allowed I422 direct rendering support when possible (avcodec).
authorLaurent Aimar <fenrir@videolan.org>
Fri, 26 Feb 2010 19:51:20 +0000 (20:51 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Fri, 26 Feb 2010 19:59:55 +0000 (20:59 +0100)
modules/codec/avcodec/video.c

index a021c01f8d730f11e209df65862394be9bb7560b..e21b4ad8c49aa7e255c85efe768b7acd9946c848 100644 (file)
@@ -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 );