[vlc-commits] decoder: factorize the output YUV subsampling constraints fixup

Steve Lhomme git at videolan.org
Mon Nov 4 10:42:05 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Aug  6 13:59:35 2019 +0200| [f5ae836c3528d1fdce271821c9ab82229bf88596] | committer: Steve Lhomme

decoder: factorize the output YUV subsampling constraints fixup

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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f5ae836c3528d1fdce271821c9ab82229bf88596
---

 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 fac5177181..edcf8447ef 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 8f98d79927..3d8a06985d 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 )
     {



More information about the vlc-commits mailing list