[vlc-devel] [PATCH 17/18] decoder: factorize the output YUV subsampling constraints fixup

Steve Lhomme robux4 at ycbcr.xyz
Mon Oct 28 13:41:34 CET 2019


This way other decoder owner (thumbnail, transcode, etc) benefit from the same
fix in a consistent manner.

Now we clean the value directly in the dec->fmt_out whereas before it was
cleaned at the vout level and the decoder didn't know about it.

It should be done before the decoder allocates it's picture pool. This is the
case as the default pool is created during the format_update, which called in
the same function later.

Other decoder owners are not impacted as they don't provide a default pool and
just rely on a direct picture_NewFromFormat() call.
---
 src/input/decoder.c         | 12 ------------
 src/input/decoder_helpers.c | 12 ++++++++++++
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index fac5177181d..edcf8447ef4 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -405,18 +405,6 @@ static int ModuleThread_UpdateAudioFormat( decoder_t *p_dec )
 static void FixDisplayFormat(decoder_t *p_dec, video_format_t *fmt)
 {
     *fmt = p_dec->fmt_out.video;
-
-    if( vlc_fourcc_IsYUV( fmt->i_chroma ) )
-    {
-        const vlc_chroma_description_t *dsc = vlc_fourcc_GetChromaDescription( fmt->i_chroma );
-        for( unsigned int i = 0; dsc && i < dsc->plane_count; i++ )
-        {
-            while( fmt->i_width % dsc->p[i].w.den )
-                fmt->i_width++;
-            while( fmt->i_height % dsc->p[i].h.den )
-                fmt->i_height++;
-        }
-    }
 }
 
 static int CreateVoutIfNeeded(struct decoder_owner *, vout_thread_t **, enum vlc_vout_order *, vlc_decoder_device **);
diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 8f98d799271..3d8a06985db 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -111,6 +111,18 @@ int decoder_UpdateVideoOutput( decoder_t *dec, vlc_video_context *vctx_out )
     vlc_ureduce( &dec->fmt_out.video.i_sar_num, &dec->fmt_out.video.i_sar_den,
                     dec->fmt_out.video.i_sar_num, dec->fmt_out.video.i_sar_den, 50000 );
 
+    if( vlc_fourcc_IsYUV( dec->fmt_out.video.i_chroma ) )
+    {
+        const vlc_chroma_description_t *dsc = vlc_fourcc_GetChromaDescription( dec->fmt_out.video.i_chroma );
+        for( unsigned int i = 0; dsc && i < dsc->plane_count; i++ )
+        {
+            while( dec->fmt_out.video.i_width % dsc->p[i].w.den )
+                dec->fmt_out.video.i_width++;
+            while( dec->fmt_out.video.i_height % dsc->p[i].h.den )
+                dec->fmt_out.video.i_height++;
+        }
+    }
+
     if( !dec->fmt_out.video.i_visible_width ||
         !dec->fmt_out.video.i_visible_height )
     {
-- 
2.17.1



More information about the vlc-devel mailing list