[vlc-devel] [PATCH 2/2] avcodec: use i_aligned_width and i_aligned_height

Thomas Guillem thomas at gllm.fr
Thu Dec 11 17:08:39 CET 2014


fix green lines when using avcodec with swscale or some vouts.

(fixes #13062)
---
 modules/codec/avcodec/video.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 5ba6e2e..c2b466a 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -122,35 +122,31 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
                                             AVCodecContext *p_context )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    int width = p_context->coded_width;
-    int height = p_context->coded_height;
+    int aligned_width = p_context->coded_width;
+    int aligned_height = p_context->coded_height;
 
     if( p_sys->p_va == NULL )
     {
         int aligns[AV_NUM_DATA_POINTERS];
 
-        avcodec_align_dimensions2(p_context, &width, &height, aligns);
+        avcodec_align_dimensions2(p_context, &aligned_width, &aligned_height,
+                                  aligns);
     }
 
 
-    if( width == 0 || height == 0 || width > 8192 || height > 8192 )
+    if( aligned_width == 0 || aligned_height == 0
+     || aligned_width > 8192 || aligned_height > 8192 )
     {
-        msg_Err( p_dec, "Invalid frame size %dx%d.", width, height );
+        msg_Err( p_dec, "Invalid frame size %dx%d.", aligned_width,
+                 aligned_height );
         return NULL; /* invalid display size */
     }
-    p_dec->fmt_out.video.i_width = width;
-    p_dec->fmt_out.video.i_height = height;
-
-    if( width != p_context->width || height != p_context->height )
-    {
-        p_dec->fmt_out.video.i_visible_width = p_context->width;
-        p_dec->fmt_out.video.i_visible_height = p_context->height;
-    }
-    else
-    {
-        p_dec->fmt_out.video.i_visible_width = width;
-        p_dec->fmt_out.video.i_visible_height = height;
-    }
+    p_dec->fmt_out.video.i_aligned_width = aligned_width;
+    p_dec->fmt_out.video.i_aligned_height = aligned_height;
+    p_dec->fmt_out.video.i_width = p_context->coded_width;
+    p_dec->fmt_out.video.i_height = p_context->coded_height;
+    p_dec->fmt_out.video.i_visible_width = p_context->width;
+    p_dec->fmt_out.video.i_visible_height = p_context->height;
 
     if( !p_sys->p_va && GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) )
     {
-- 
2.1.3




More information about the vlc-devel mailing list