[vlc-commits] [Git][videolan/vlc][master] 2 commits: x264: leave full range handling to the video format

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Oct 7 09:15:49 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
3e819cd6 by Steve Lhomme at 2023-10-07T09:01:08+00:00
x264: leave full range handling to the video format

It should not be up to a chroma.

- - - - -
c452ab76 by Steve Lhomme at 2023-10-07T09:01:08+00:00
jpeg: request full range I420 instead of J420

- - - - -


2 changed files:

- modules/codec/jpeg.c
- modules/codec/x264.c


Changes:

=====================================
modules/codec/jpeg.c
=====================================
@@ -636,7 +636,8 @@ static int OpenEncoder(vlc_object_t *p_this)
     p_sys->i_quality = var_GetInteger(p_enc, ENC_CFG_PREFIX "quality");
     p_sys->i_blocksize = 3 * p_enc->fmt_in.video.i_visible_width * p_enc->fmt_in.video.i_visible_height;
 
-    p_enc->fmt_in.i_codec = VLC_CODEC_J420;
+    p_enc->fmt_in.i_codec = VLC_CODEC_I420;
+    p_enc->fmt_in.video.color_range = COLOR_RANGE_FULL;
 
     static const struct vlc_encoder_operations ops =
     {


=====================================
modules/codec/x264.c
=====================================
@@ -765,7 +765,6 @@ static int  Open ( vlc_object_t *p_this )
     int i_qmin = 0, i_qmax = 0;
     x264_nal_t *nal;
     int i, i_nal;
-    bool fullrange = false;
 
 #ifdef PLUGIN_X262
     if( p_enc->fmt_out.i_codec != VLC_CODEC_MP2V &&
@@ -795,8 +794,9 @@ static int  Open ( vlc_object_t *p_this )
     if( !p_sys )
         return VLC_ENOMEM;
 
-    fullrange = var_GetBool( p_enc, SOUT_CFG_PREFIX "fullrange" );
-    fullrange |= p_enc->fmt_in.video.color_range == COLOR_RANGE_FULL;
+    if (var_GetBool( p_enc, SOUT_CFG_PREFIX "fullrange" ))
+        p_enc->fmt_in.video.color_range = COLOR_RANGE_FULL;
+
     char *psz_profile = var_GetString( p_enc, SOUT_CFG_PREFIX "profile" );
 # ifdef PLUGIN_X264_10B
     const int mask = X264_CSP_HIGH_DEPTH;
@@ -808,17 +808,17 @@ static int  Open ( vlc_object_t *p_this )
 
         if( !strcmp( psz_profile, "high10" ) )
         {
-            p_enc->fmt_in.i_codec = mask ? VLC_CODEC_I420_10L : fullrange ? VLC_CODEC_J420 : VLC_CODEC_I420;
+            p_enc->fmt_in.i_codec = mask ? VLC_CODEC_I420_10L : VLC_CODEC_I420;
             p_sys->i_colorspace = X264_CSP_I420 | mask;
         }
         else if( !strcmp( psz_profile, "high422" ) )
         {
-            p_enc->fmt_in.i_codec = mask ? VLC_CODEC_I422_10L : fullrange ? VLC_CODEC_J422 : VLC_CODEC_I422;
+            p_enc->fmt_in.i_codec = mask ? VLC_CODEC_I422_10L : VLC_CODEC_I422;
             p_sys->i_colorspace = X264_CSP_I422 | mask;
         }
         else if( !strcmp( psz_profile, "high444" ) )
         {
-            p_enc->fmt_in.i_codec = mask ? VLC_CODEC_I444_10L : fullrange ? VLC_CODEC_J444 : VLC_CODEC_I444;
+            p_enc->fmt_in.i_codec = mask ? VLC_CODEC_I444_10L : VLC_CODEC_I444;
             p_sys->i_colorspace = X264_CSP_I444 | mask;
         }
         else
@@ -828,7 +828,7 @@ static int  Open ( vlc_object_t *p_this )
             free( psz_profile );
             return VLC_EGENERIC;
 # else
-            p_enc->fmt_in.i_codec = fullrange ? VLC_CODEC_J420 : VLC_CODEC_I420;
+            p_enc->fmt_in.i_codec = VLC_CODEC_I420;
             p_sys->i_colorspace = X264_CSP_I420;
 # endif
         }
@@ -840,7 +840,7 @@ static int  Open ( vlc_object_t *p_this )
         msg_Err( p_enc, "Only high-profiles and 10-bit are supported");
         return VLC_EGENERIC;
 # else
-        p_enc->fmt_in.i_codec = fullrange ? VLC_CODEC_J420 : VLC_CODEC_I420;
+        p_enc->fmt_in.i_codec = VLC_CODEC_I420;
         p_sys->i_colorspace = X264_CSP_I420;
 # endif
     }
@@ -873,7 +873,7 @@ static int  Open ( vlc_object_t *p_this )
     p_sys->param.i_csp = p_sys->i_colorspace;
     p_sys->param.i_width  = p_enc->fmt_in.video.i_visible_width;
     p_sys->param.i_height = p_enc->fmt_in.video.i_visible_height;
-    p_sys->param.vui.b_fullrange = fullrange;
+    p_sys->param.vui.b_fullrange = p_enc->fmt_in.video.color_range == COLOR_RANGE_FULL;
 
     switch( p_enc->fmt_in.video.space )
     {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe938751058cf15bc83107c87314a9fdc362a7f7...c452ab7615bf79698f6e3212b9e586663182a948

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe938751058cf15bc83107c87314a9fdc362a7f7...c452ab7615bf79698f6e3212b9e586663182a948
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list