[vlc-commits] chroma: chain: favor YUV10 if output is YUV10

Thomas Guillem git at videolan.org
Mon Mar 19 12:15:33 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 16 09:12:40 2018 +0100| [506448553e8846f49f781b97619de693f46a2fc8] | committer: Thomas Guillem

chroma: chain: favor YUV10 if output is YUV10

(cherry picked from commit 4e9d965d4c5a60ad43bc746e6c47ad1c67b34f0c)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/video_chroma/chain.c | 39 +++++++++++++++++++++++++++++++++++----
 1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index b78883e49b..e9b43a49bc 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -67,17 +67,46 @@ static void EsFormatMergeSize( es_format_t *p_dst,
                                const es_format_t *p_base,
                                const es_format_t *p_size );
 
-static const vlc_fourcc_t pi_allowed_chromas[] = {
+#define ALLOWED_CHROMAS_YUV10 \
+    VLC_CODEC_I420_10L, \
+    VLC_CODEC_I420_10B, \
+    VLC_CODEC_I420_16L \
+
+static const vlc_fourcc_t pi_allowed_chromas_yuv[] = {
+    VLC_CODEC_I420,
+    VLC_CODEC_I422,
+    ALLOWED_CHROMAS_YUV10,
+    VLC_CODEC_RGB32,
+    VLC_CODEC_RGB24,
+    0
+};
+
+static const vlc_fourcc_t pi_allowed_chromas_yuv10[] = {
+    ALLOWED_CHROMAS_YUV10,
     VLC_CODEC_I420,
     VLC_CODEC_I422,
-    VLC_CODEC_I420_10L,
-    VLC_CODEC_I420_10B,
-    VLC_CODEC_I420_16L,
     VLC_CODEC_RGB32,
     VLC_CODEC_RGB24,
     0
 };
 
+static const vlc_fourcc_t *get_allowed_chromas( filter_t *p_filter )
+{
+    switch (p_filter->fmt_out.video.i_chroma)
+    {
+        case VLC_CODEC_I420_10L:
+        case VLC_CODEC_I420_10B:
+        case VLC_CODEC_I420_16L:
+        case VLC_CODEC_CVPX_P010:
+        case VLC_CODEC_D3D9_OPAQUE_10B:
+        case VLC_CODEC_D3D11_OPAQUE_10B:
+        case VLC_CODEC_VAAPI_420_10BPP:
+            return pi_allowed_chromas_yuv10;
+        default:
+            return pi_allowed_chromas_yuv;
+    }
+}
+
 struct filter_sys_t
 {
     filter_chain_t *p_chain;
@@ -282,6 +311,7 @@ static int BuildChromaChain( filter_t *p_filter )
     int i_ret = VLC_EGENERIC;
 
     /* Now try chroma format list */
+    const vlc_fourcc_t *pi_allowed_chromas = get_allowed_chromas( p_filter );
     for( int i = 0; pi_allowed_chromas[i]; i++ )
     {
         const vlc_fourcc_t i_chroma = pi_allowed_chromas[i];
@@ -323,6 +353,7 @@ static int BuildFilterChain( filter_t *p_filter )
     int i_ret = VLC_EGENERIC;
 
     /* Now try chroma format list */
+    const vlc_fourcc_t *pi_allowed_chromas = get_allowed_chromas( p_filter );
     for( int i = 0; pi_allowed_chromas[i]; i++ )
     {
         filter_chain_Reset( p_filter->p_sys->p_chain, &p_filter->fmt_in, &p_filter->fmt_out );



More information about the vlc-commits mailing list