[vlc-devel] commit: Do not load a filter for J4xy -> I4xy in vout_display. ( Laurent Aimar )

git version control git at videolan.org
Sun Aug 30 20:11:45 CEST 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sun Aug 30 20:09:12 2009 +0200| [d3c6ad0b555b667e9ce71bf8e3442ae35d2b1d40] | committer: Laurent Aimar 

Do not load a filter for J4xy -> I4xy in vout_display.

 It's not perfect, as they do not have the same dynamic, but it costs a lot
of CPU for something not that visible.
 If an option is wanted, it is easy to add.

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

 src/video_output/display.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 4774ba9..33c825c 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -364,10 +364,19 @@ static void VoutDisplayCreateRender(vout_display_t *vd)
     v_dst.i_sar_num = 0;
     v_dst.i_sar_den = 0;
 
-    const bool convert = memcmp(&v_src, &v_dst, sizeof(v_src)) != 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;
     if (!convert)
         return;
 
+    msg_Err(vd, "A filter to adapt decoder to display is needed");
+
     osys->filters = filter_chain_New(vd, "video filter2", false,
                                      FilterAllocationInit,
                                      FilterAllocationClean, NULL);
@@ -379,13 +388,18 @@ static void VoutDisplayCreateRender(vout_display_t *vd)
 
     /* */
     es_format_t dst;
-    es_format_InitFromVideo(&dst, &v_dst);
 
-    filter_chain_Reset(osys->filters, &src, &dst);
+    filter_t *filter;
+    for (int i = 0; i < 1 + (v_dst_cmp.i_chroma != v_dst.i_chroma); i++) {
 
-    msg_Err(vd, "A filter to adapt decoder to display is needed");
-    filter_t *filter = filter_chain_AppendFilter(osys->filters,
-                                                 NULL, NULL, &src, &dst);
+        es_format_InitFromVideo(&dst, i == 0 ? &v_dst : &v_dst_cmp);
+
+        filter_chain_Reset(osys->filters, &src, &dst);
+        filter = filter_chain_AppendFilter(osys->filters,
+                                           NULL, NULL, &src, &dst);
+        if (filter)
+            break;
+    }
     if (!filter)
     {
         msg_Err(vd, "VoutDisplayCreateRender FAILED");




More information about the vlc-devel mailing list