[vlc-commits] [Git][videolan/vlc][3.0.x] 8 commits: dvbsub: keep the color range in the region output
Steve Lhomme (@robUx4)
gitlab at videolan.org
Thu May 22 07:41:54 UTC 2025
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
6282a01c by Steve Lhomme at 2025-05-22T06:48:55+00:00
dvbsub: keep the color range in the region output
(cherry picked from commit fb2f877d1981c4a207d8db58088f7907c1c1cbf4) (edited)
edited:
- adapted range variable
- - - - -
b715f900 by Steve Lhomme at 2025-05-22T06:48:55+00:00
spudec: output limited range by default
The YUV colors from DVDs are likely in limited range.
(cherry picked from commit e605d5b4696be26805834d581acbe5e9174af652) (edited)
edited:
- adapted range variable
- - - - -
bff85576 by Steve Lhomme at 2025-05-22T06:48:55+00:00
textst: document the palette colors are in limited range
As found in 9.14.4.2.2.1.1 Semantic definition of fields in PDS
of the Blu-ray specs.
(cherry picked from commit 888438ee92cab44f310e2eaf97f4ab71db578f2d) (edited)
edited:
- in 3.0 the p_sys comes from p_dec
- - - - -
d415d415 by Steve Lhomme at 2025-05-22T06:48:55+00:00
libass: output SDR full range by default
We don't want to keep the colorimetry of the video.
Until there's a proper spec for HDR colors.
(cherry picked from commit acf3fb486a5cd6a0444dc683360ade163bbbd5f8) (edited)
edited:
- moved the fmt_region init to match 4.0
- adapted the range variable
- - - - -
60cd6f53 by Steve Lhomme at 2025-05-22T06:48:55+00:00
kate: output SDR full range by default
We don't want to keep the colorimetry of the video.
(cherry picked from commit 68119b28d87d398911f69734512cfd48c0706e0d) (edited)
edited:
- adapted the range variable
- - - - -
f08736c2 by Steve Lhomme at 2025-05-22T06:48:55+00:00
text_render/svg: remove unneeded forward declarations
(cherry picked from commit ff0c91ff96cf37981fb1cd6fbf9763cef06b87ad)
- - - - -
e8716078 by Steve Lhomme at 2025-05-22T06:48:55+00:00
text_render/svg: set decoded pictures as SDR explictly
(cherry picked from commit e2fa4b9ebcddfd34a73d83f49b2e63fd83731f65) (edited)
edited:
- on 3.0 the range is a boolean
- - - - -
02013c32 by Steve Lhomme at 2025-05-22T06:48:55+00:00
subpicture: set regions to full range SDR by default
The caller of subpicture_region_New() can change it afterwards
in the region format and the picture format.
By default the values were undefined and might pick the
colorimetry of the video.
Ref. #27877 and #26180
Similar to 35396660acf211bc481dffb3e2225072a738ea41 adapted to 3.0
- - - - -
7 changed files:
- modules/codec/dvbsub.c
- modules/codec/kate.c
- modules/codec/libass.c
- modules/codec/spudec/parse.c
- modules/codec/textst.c
- modules/text_renderer/svg.c
- src/misc/subpicture.c
Changes:
=====================================
modules/codec/dvbsub.c
=====================================
@@ -199,6 +199,7 @@ typedef struct dvbsub_clut_s
dvbsub_color_t c_2b[4];
dvbsub_color_t c_4b[16];
dvbsub_color_t c_8b[256];
+ bool b_color_range_full;
struct dvbsub_clut_s *p_next;
@@ -546,6 +547,7 @@ static void default_clut_init( decoder_t *p_dec )
/* 256 entries CLUT */
memset( p_sys->default_clut.c_8b, 0xFF, 256 * sizeof(dvbsub_color_t) );
+ p_sys->default_clut.b_color_range_full = false;
}
static void decode_segment( decoder_t *p_dec, bs_t *s )
@@ -710,7 +712,8 @@ static void decode_clut( decoder_t *p_dec, bs_t *s )
bs_skip( s, 4 );
- if( bs_read( s, 1 ) )
+ p_clut->b_color_range_full = bs_read( s, 1 ) != 0;
+ if( p_clut->b_color_range_full )
{
y = bs_read( s, 8 );
cr = bs_read( s, 8 );
@@ -1614,6 +1617,7 @@ static subpicture_t *render( decoder_t *p_dec )
fmt.p_palette->palette[j][2] = p_color[j].Cr; /* V == Cr */
fmt.p_palette->palette[j][3] = 0xff - p_color[j].T;
}
+ fmt.b_color_range_full = p_clut->b_color_range_full;
p_spu_region = subpicture_region_New( &fmt );
fmt.p_palette = NULL; /* was stack var */
=====================================
modules/codec/kate.c
=====================================
@@ -876,6 +876,10 @@ static void TigerUpdateSubpicture( subpicture_t *p_subpic,
fmt.i_height =
fmt.i_visible_height = p_fmt_src->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.transfer = TRANSFER_FUNC_SRGB;
+ fmt.primaries = COLOR_PRIMARIES_SRGB;
+ fmt.space = COLOR_SPACE_SRGB;
+ fmt.b_color_range_full = true;
subpicture_region_t *p_r = subpicture_region_New( &fmt );
if( !p_r )
=====================================
modules/codec/libass.c
=====================================
@@ -505,13 +505,17 @@ static void SubpictureUpdate( subpicture_t *p_subpic,
/* Allocate the regions and draw them */
subpicture_region_t **pp_region_last = &p_subpic->p_region;
+ video_format_t fmt_region;
+ fmt_region = fmt;
+ fmt_region.transfer = TRANSFER_FUNC_SRGB;
+ fmt_region.primaries = COLOR_PRIMARIES_SRGB;
+ fmt_region.space = COLOR_SPACE_SRGB;
+ fmt_region.b_color_range_full = true;
for( int i = 0; i < i_region; i++ )
{
subpicture_region_t *r;
- video_format_t fmt_region;
/* */
- fmt_region = fmt;
fmt_region.i_width =
fmt_region.i_visible_width = region[i].x1 - region[i].x0;
fmt_region.i_height =
=====================================
modules/codec/spudec/parse.c
=====================================
@@ -863,6 +863,7 @@ static int Render( decoder_t *p_dec, subpicture_t *p_spu,
fmt.p_palette->palette[i_x][2] = p_spu_data->pi_yuv[i_x][2];
fmt.p_palette->palette[i_x][3] = p_spu_data->pi_alpha[i_x] * 0x11;
}
+ fmt.b_color_range_full = false;
p_spu->p_region = subpicture_region_New( &fmt );
if( !p_spu->p_region )
=====================================
modules/codec/textst.c
=====================================
@@ -179,7 +179,7 @@ static size_t textst_Decode_palette(decoder_t *p_dec, const uint8_t *p_data, siz
i_size = i_data = __MIN(i_data, i_size);
while (i_data > 4)
{
- p_dec->p_sys->palette[p_data[0]] = /* YCrCbT to ARGB */
+ p_dec->p_sys->palette[p_data[0]] = /* YCrCbT limited range to ARGB full range */
( (uint32_t)((float)p_data[1] +1.402f * (p_data[2]-128)) << 16 ) |
( (uint32_t)((float)p_data[1] -0.34414 * (p_data[3]-128) -0.71414 * (p_data[2]-128)) << 8 ) |
( (uint32_t)((float)p_data[1] +1.722 * (p_data[3]-128)) ) |
=====================================
modules/text_renderer/svg.c
=====================================
@@ -80,9 +80,6 @@ vlc_module_begin ()
set_callbacks( Create, Destroy )
vlc_module_end ()
-static void svg_RescaletoFit ( filter_t *, int *width, int *height, float * );
-static picture_t * svg_RenderPicture ( filter_t *p_filter, const char * );
-
static void svg_LoadTemplate( filter_t *p_filter )
{
filter_sys_t *p_sys = p_filter->p_sys;
@@ -256,6 +253,10 @@ static picture_t * svg_RenderPicture( filter_t *p_filter,
fmt.i_chroma = VLC_CODEC_BGRA;
fmt.i_width = fmt.i_visible_width = dim.width;
fmt.i_height = fmt.i_visible_height = dim.height;
+ fmt.transfer = TRANSFER_FUNC_SRGB;
+ fmt.primaries = COLOR_PRIMARIES_SRGB;
+ fmt.space = COLOR_SPACE_SRGB;
+ fmt.b_color_range_full = true;
picture_t *p_picture = picture_NewFromFormat( &fmt );
if( !p_picture )
=====================================
src/misc/subpicture.c
=====================================
@@ -243,6 +243,22 @@ subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
return NULL;
}
+ if (p_region->fmt.transfer == TRANSFER_FUNC_UNDEF)
+ p_region->fmt.transfer = TRANSFER_FUNC_SRGB;
+ if (p_region->fmt.primaries == COLOR_PRIMARIES_UNDEF)
+ p_region->fmt.primaries = COLOR_PRIMARIES_SRGB;
+ if (p_region->fmt.space == COLOR_SPACE_UNDEF)
+ p_region->fmt.space = COLOR_SPACE_SRGB;
+ p_region->fmt.b_color_range_full = true;
+
+ if (p_region->p_picture->format.transfer == TRANSFER_FUNC_UNDEF)
+ p_region->p_picture->format.transfer = TRANSFER_FUNC_SRGB;
+ if (p_region->p_picture->format.primaries == COLOR_PRIMARIES_UNDEF)
+ p_region->p_picture->format.primaries = COLOR_PRIMARIES_SRGB;
+ if (p_region->p_picture->format.space == COLOR_SPACE_UNDEF)
+ p_region->p_picture->format.space = COLOR_SPACE_SRGB;
+ p_region->p_picture->format.b_color_range_full = true;
+
return p_region;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b6be9a811b0144fbfa8c3b3eb159f74b8b3e2873...02013c329df488df030788e03673fcd5b966d0d4
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b6be9a811b0144fbfa8c3b3eb159f74b8b3e2873...02013c329df488df030788e03673fcd5b966d0d4
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