[vlc-devel] [PATCH 09/10] avcodec: video: fix comparing signed/unsigned resolutions

ileoo at videolan.org ileoo at videolan.org
Sun Sep 4 14:30:13 CEST 2016


From: Ilkka Ollakka <ileoo at videolan.org>

Cleared up the comparision as it was actually just comparing if
visible_width is different to width, with few extra steps taken previously.
---
 modules/codec/avcodec/video.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 5e70ce0..a9435c1 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -339,16 +339,14 @@ static int OpenVideoCodec( decoder_t *p_dec )
         }
     }
 
-    p_sys->p_context->width  = p_dec->fmt_in.video.i_visible_width;
-    p_sys->p_context->height = p_dec->fmt_in.video.i_visible_height;
-    if (p_sys->p_context->width  == 0)
-        p_sys->p_context->width  = p_dec->fmt_in.video.i_width;
-    else if (p_sys->p_context->width != p_dec->fmt_in.video.i_width)
+    p_sys->p_context->coded_width  = p_sys->p_context->width  = p_dec->fmt_in.video.i_visible_width;
+    p_sys->p_context->coded_height = p_sys->p_context->height = p_dec->fmt_in.video.i_visible_height;
+
+    if (p_dec->fmt_in.video.i_visible_width != p_dec->fmt_in.video.i_width)
         p_sys->p_context->coded_width = p_dec->fmt_in.video.i_width;
-    if (p_sys->p_context->height == 0)
-        p_sys->p_context->height = p_dec->fmt_in.video.i_height;
-    else if (p_sys->p_context->height != p_dec->fmt_in.video.i_height)
+    if (p_dec->fmt_in.video.i_visible_height != p_dec->fmt_in.video.i_height)
         p_sys->p_context->coded_height = p_dec->fmt_in.video.i_height;
+
     p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.video.i_bits_per_pixel;
     p_sys->pix_fmt = AV_PIX_FMT_NONE;
     p_sys->profile = -1;
-- 
2.6.6



More information about the vlc-devel mailing list