[vlc-devel] [PATCH 1/2] display: remove range conversion filter

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 13 16:56:55 CET 2020


There doesn't seem to be any display module that transforms these J4xx chromas
into I4xx chromas for their input format. So we don't need 2 filters for this.
---
 src/video_output/display.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 98e79f0d754..b2efcbbbfd7 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -289,13 +289,12 @@ static int vout_display_start(void *func, bool forced, va_list ap)
     vout_display_priv_t *osys = va_arg(ap, vout_display_priv_t *);
     const vout_display_cfg_t *cfg = &osys->cfg;
     vout_display_t *vd = &osys->display;
-    vlc_video_context *context = osys->src_vctx;
 
     /* Picture buffer does not have the concept of aspect ratio */
     video_format_Copy(&osys->display_fmt, vd->source);
     vd->obj.force = forced; /* TODO: pass to activate() instead? */
 
-    int ret = activate(vd, cfg, &osys->display_fmt, context);
+    int ret = activate(vd, cfg, &osys->display_fmt, osys->src_vctx);
     if (ret != VLC_SUCCESS) {
         video_format_Clean(&osys->display_fmt);
         vlc_objres_clear(VLC_OBJECT(vd));
@@ -335,14 +334,7 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
     v_dst.i_sar_num = 0;
     v_dst.i_sar_den = 0;
 
-    video_format_t v_dst_cmp = v_dst;
-    if ((v_src.i_chroma == VLC_CODEC_J420 && v_dst.i_chroma == VLC_CODEC_I420) ||
-        (v_src.i_chroma == VLC_CODEC_J422 && v_dst.i_chroma == VLC_CODEC_I422) ||
-        (v_src.i_chroma == VLC_CODEC_J440 && v_dst.i_chroma == VLC_CODEC_I440) ||
-        (v_src.i_chroma == VLC_CODEC_J444 && v_dst.i_chroma == VLC_CODEC_I444))
-        v_dst_cmp.i_chroma = v_src.i_chroma;
-
-    const bool convert = memcmp(&v_src, &v_dst_cmp, sizeof(v_src)) != 0;
+    const bool convert = memcmp(&v_src, &v_dst, sizeof(v_src)) != 0;
     if (!convert)
         return 0;
 
@@ -356,16 +348,14 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
     /* */
     int ret = -1;
 
-    for (int i = 0; i < 1 + (v_dst_cmp.i_chroma != v_dst.i_chroma); i++) {
+    {
         es_format_t dst;
 
-        es_format_InitFromVideo(&dst, i == 0 ? &v_dst : &v_dst_cmp);
+        es_format_InitFromVideo(&dst, &v_dst);
 
         filter_chain_Reset(osys->converters, &src, osys->src_vctx, &dst);
         ret = filter_chain_AppendConverter(osys->converters, &dst);
         es_format_Clean(&dst);
-        if (ret == 0)
-            break;
     }
     es_format_Clean(&src);
 
-- 
2.26.2



More information about the vlc-devel mailing list