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

Thomas Guillem git at videolan.org
Fri Mar 16 16:08:27 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 16 09:12:40 2018 +0100| [4e9d965d4c5a60ad43bc746e6c47ad1c67b34f0c] | committer: Thomas Guillem

chroma: chain: favor YUV10 if output is YUV10

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

 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 213c3267c6..123b3a594b 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;
@@ -277,6 +306,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];
@@ -318,6 +348,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