[vlc-commits] avcodec: assume a source is full range if not specified and an RGB format

Steve Lhomme git at videolan.org
Mon Jun 18 08:36:14 CEST 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Jan 26 10:47:14 2018 +0100| [a4029ace81dad34e1c898144f2cbafc71f923590] | committer: Jean-Baptiste Kempf

avcodec: assume a source is full range if not specified and an RGB format

There's a good chance that codec decoding to RGB are capture formats from
computers using full range display.

Ref #19127

(cherry picked from commit fd92c52e36832ee54207e095a9747e4d70145234)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/codec/avcodec/video.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index a25f6ca461..3bdbd46a93 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -204,8 +204,21 @@ static int lavc_GetVideoFormat(decoder_t *dec, video_format_t *restrict fmt,
                                  * __MAX(ctx->ticks_per_frame, 1);
     }
 
-    if( ctx->color_range == AVCOL_RANGE_JPEG )
+    /* FIXME we should only set the known values and let the core decide
+     * later of fallbacks, but we can't do that with a boolean */
+    switch ( ctx->color_range )
+    {
+    case AVCOL_RANGE_JPEG:
         fmt->b_color_range_full = true;
+        break;
+    case AVCOL_RANGE_UNSPECIFIED:
+        fmt->b_color_range_full = !vlc_fourcc_IsYUV( fmt->i_chroma );
+        break;
+    case AVCOL_RANGE_MPEG:
+    default:
+        fmt->b_color_range_full = false;
+        break;
+    }
 
     switch( ctx->colorspace )
     {



More information about the vlc-commits mailing list