[vlc-commits] [Git][videolan/vlc][master] 10 commits: dvbsub: keep the color range in the region output
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed May 21 06:05:01 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
fb2f877d by Steve Lhomme at 2025-05-21T07:31:04+02:00
dvbsub: keep the color range in the region output
- - - - -
e605d5b4 by Steve Lhomme at 2025-05-21T07:31:05+02:00
spudec: output limited range by default
The YUV colors from DVDs are likely in limited range.
- - - - -
888438ee by Steve Lhomme at 2025-05-21T07:31:05+02: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.
- - - - -
acf3fb48 by Steve Lhomme at 2025-05-21T07:31:05+02: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.
- - - - -
68119b28 by Steve Lhomme at 2025-05-21T07:31:05+02:00
kate: output SDR full range by default
We don't want to keep the colorimetry of the video.
- - - - -
483744a6 by Steve Lhomme at 2025-05-21T07:31:05+02:00
libaribcaption: output SDR full range by default
We don't want to keep the colorimetry of the video.
- - - - -
e2fa4b9e by Steve Lhomme at 2025-05-21T07:31:05+02:00
text_render/svg: set decoded pictures as SDR explictly
- - - - -
ff0c91ff by Steve Lhomme at 2025-05-21T07:31:05+02:00
text_render/svg: remove unneeded forward declarations
- - - - -
484fef53 by Steve Lhomme at 2025-05-21T07:31:05+02:00
subpicture: assume text regions are full range SDR by default
The caller of subpicture_region_NewText() can change it afterwards.
But default the values were undefined and might pick the
colorimetry of the video.
Ref. #27877 and #26180
- - - - -
35396660 by Steve Lhomme at 2025-05-21T07:32:45+02: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.
But the default values were undefined and might pick the
colorimetry of the video.
This is the same values already used in region_FixFmt().
Ref. #27877 and #26180
- - - - -
8 changed files:
- modules/codec/arib/libaribcaption.c
- 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/arib/libaribcaption.c
=====================================
@@ -162,6 +162,10 @@ static void SubpictureUpdate(subpicture_t *p_subpic,
fmt_region.i_chroma = VLC_CODEC_RGBA;
fmt_region.i_x_offset = 0;
fmt_region.i_y_offset = 0;
+ fmt_region.transfer = TRANSFER_FUNC_SRGB;
+ fmt_region.primaries = COLOR_PRIMARIES_SRGB;
+ fmt_region.space = COLOR_SPACE_SRGB;
+ fmt_region.color_range = COLOR_RANGE_FULL;
/* Allocate the regions and draw them */
for (uint32_t i = 0; i < i_image_count; i++) {
=====================================
modules/codec/dvbsub.c
=====================================
@@ -210,6 +210,7 @@ typedef struct dvbsub_clut_s
dvbsub_color_t c_2b[4];
dvbsub_color_t c_4b[16];
dvbsub_color_t c_8b[256];
+ video_color_range_t color_range;
struct dvbsub_clut_s *p_next;
@@ -550,6 +551,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.color_range = COLOR_RANGE_LIMITED;
}
static void decode_segment( decoder_t *p_dec, bs_t *s )
@@ -712,7 +714,8 @@ static void decode_clut( decoder_t *p_dec, bs_t *s, uint16_t i_segment_length )
bs_skip( s, 4 );
- if( bs_read( s, 1 ) )
+ p_clut->color_range = bs_read( s, 1 ) ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
+ if( p_clut->color_range == COLOR_RANGE_FULL )
{
y = bs_read( s, 8 );
cr = bs_read( s, 8 );
@@ -1602,6 +1605,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.color_range = p_clut->color_range;
p_spu_region = subpicture_region_New( &fmt );
fmt.p_palette = NULL; /* was stack var */
=====================================
modules/codec/kate.c
=====================================
@@ -852,6 +852,10 @@ exit:
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.color_range = COLOR_RANGE_FULL;
subpicture_region_t *p_r = subpicture_region_New( &fmt );
if( !p_r )
=====================================
modules/codec/libass.c
=====================================
@@ -482,6 +482,10 @@ static void SubpictureUpdate( subpicture_t *p_subpic,
fmt_region.i_chroma = VLC_CODEC_RGBA;
fmt_region.i_x_offset = 0;
fmt_region.i_y_offset = 0;
+ fmt_region.transfer = TRANSFER_FUNC_SRGB;
+ fmt_region.primaries = COLOR_PRIMARIES_SRGB;
+ fmt_region.space = COLOR_SPACE_SRGB;
+ fmt_region.color_range = COLOR_RANGE_FULL;
for( int i = 0; i < i_region; i++ )
{
subpicture_region_t *r;
=====================================
modules/codec/spudec/parse.c
=====================================
@@ -875,6 +875,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.color_range = COLOR_RANGE_LIMITED;
subpicture_region_t *p_region = subpicture_region_New( &fmt );
fmt.p_palette = NULL;
=====================================
modules/codec/textst.c
=====================================
@@ -182,7 +182,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_sys->palette[p_data[0]] = /* YCrCbT to ARGB */
+ 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
=====================================
@@ -77,9 +77,6 @@ vlc_module_begin ()
set_callback_text_renderer( Create, 99 )
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;
@@ -255,6 +252,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.color_range = COLOR_RANGE_FULL;
picture_t *p_picture = picture_NewFromFormat( &fmt );
if( !p_picture )
=====================================
src/misc/subpicture.c
=====================================
@@ -269,6 +269,14 @@ subpicture_region_t *subpicture_region_New( const video_format_t *p_fmt )
return NULL;
video_format_Copy( &p_region->fmt, p_fmt );
+ 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;
+ if (p_region->fmt.color_range == COLOR_RANGE_UNDEF)
+ p_region->fmt.color_range = COLOR_RANGE_FULL;
p_region->p_picture = picture_NewFromFormat( &p_region->fmt );
if( !p_region->p_picture )
{
@@ -309,6 +317,10 @@ subpicture_region_t *subpicture_region_NewText( void )
p_region->text_flags |= VLC_SUBPIC_TEXT_FLAG_IS_TEXT;
video_format_Init( &p_region->fmt, 0 );
+ p_region->fmt.transfer = TRANSFER_FUNC_SRGB;
+ p_region->fmt.primaries = COLOR_PRIMARIES_SRGB;
+ p_region->fmt.space = COLOR_SPACE_SRGB;
+ p_region->fmt.color_range = COLOR_RANGE_FULL;
return p_region;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b65d5ca6c6bc70655b7fad09256e9088345f663e...35396660acf211bc481dffb3e2225072a738ea41
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b65d5ca6c6bc70655b7fad09256e9088345f663e...35396660acf211bc481dffb3e2225072a738ea41
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