[vlc-devel] [PATCH 3/4] es: change the video_format_t color range to an enum
Steve Lhomme
robux4 at ycbcr.xyz
Thu Dec 13 10:02:42 CET 2018
In many cases we don't know the value so it's better to use UNDEF.
A boolean also prevents from overwriting a value only when it's undefined.
The es_out display now separates the color space and the color range. One may
be known without the other.
---
include/vlc_codec.h | 2 ++
include/vlc_es.h | 2 +-
modules/access/screen/win32.c | 2 +-
modules/access/v4l2/demux.c | 6 +++---
modules/codec/aom.c | 2 +-
modules/codec/avcodec/avcommon.h | 13 ++++++++++++-
modules/codec/avcodec/video.c | 12 ++++--------
modules/codec/dav1d.c | 2 +-
modules/codec/jpeg.c | 2 +-
modules/codec/png.c | 2 +-
modules/codec/videotoolbox.m | 2 +-
modules/codec/vpx.c | 2 +-
modules/codec/x264.c | 2 +-
modules/demux/mkv/matroska_segment_parse.cpp | 4 ++--
modules/demux/mp4/essetup.c | 9 ++++++---
modules/demux/mp4/heif.c | 3 ++-
modules/hw/d3d9/dxva2_deinterlace.c | 3 ++-
modules/mux/mp4/libmp4mux.c | 2 +-
modules/packetizer/av1.c | 2 +-
modules/packetizer/av1_obu.c | 8 ++++----
modules/packetizer/h264.c | 6 +++++-
modules/packetizer/hevc.c | 4 +++-
modules/packetizer/mpeg4video.c | 2 +-
modules/stream_out/transcode/encoder/video.c | 2 +-
modules/video_output/placebo_utils.c | 2 +-
modules/video_output/win32/direct3d11.c | 4 ++--
src/input/es_out.c | 18 ++++++++++++++----
27 files changed, 75 insertions(+), 45 deletions(-)
diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index f0b6d572fa..941d40458f 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -273,6 +273,8 @@ static inline int decoder_UpdateVideoFormat( decoder_t *dec )
{
vlc_assert( dec->fmt_in.i_cat == VIDEO_ES && dec->cbs != NULL );
+ if ( dec->fmt_in.video.color_range != COLOR_RANGE_UNDEF )
+ dec->fmt_out.video.color_range = dec->fmt_in.video.color_range;
if ( dec->fmt_in.video.space != COLOR_SPACE_UNDEF )
dec->fmt_out.video.space = dec->fmt_in.video.space;
if ( dec->fmt_in.video.transfer != TRANSFER_FUNC_UNDEF )
diff --git a/include/vlc_es.h b/include/vlc_es.h
index f123b5ddd6..9f0a6b040f 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -374,7 +374,7 @@ struct video_format_t
video_color_primaries_t primaries; /**< color primaries */
video_transfer_func_t transfer; /**< transfer function */
video_color_space_t space; /**< YCbCr color space */
- bool b_color_range_full; /**< 0-255 instead of 16-235 */
+ video_color_range_t color_range; /**< 0-255 instead of 16-235 */
video_chroma_location_t chroma_location; /**< YCbCr chroma location */
video_multiview_mode_t multiview_mode; /** Multiview mode, 2D, 3D */
diff --git a/modules/access/screen/win32.c b/modules/access/screen/win32.c
index adf4fdb386..9db41cc6ba 100644
--- a/modules/access/screen/win32.c
+++ b/modules/access/screen/win32.c
@@ -136,7 +136,7 @@ int screen_InitCapture( demux_t *p_demux )
p_sys->fmt.video.i_sar_num = p_sys->fmt.video.i_sar_den = 1;
p_sys->fmt.video.i_chroma = i_chroma;
p_sys->fmt.video.transfer = TRANSFER_FUNC_SRGB;
- p_sys->fmt.video.b_color_range_full = true;
+ p_sys->fmt.video.color_range = COLOR_RANGE_FULL;
switch( i_chroma )
{
diff --git a/modules/access/v4l2/demux.c b/modules/access/v4l2/demux.c
index 961ec32840..782398c87a 100644
--- a/modules/access/v4l2/demux.c
+++ b/modules/access/v4l2/demux.c
@@ -436,7 +436,7 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
es_fmt.video.primaries = COLOR_PRIMARIES_SRGB;
es_fmt.video.transfer = TRANSFER_FUNC_SRGB;
es_fmt.video.space = COLOR_SPACE_BT601;
- es_fmt.video.b_color_range_full = true;
+ es_fmt.video.color_range = COLOR_RANGE_FULL;
break;
case V4L2_COLORSPACE_SRGB:
es_fmt.video.primaries = COLOR_PRIMARIES_SRGB;
@@ -529,10 +529,10 @@ static int InitVideo (demux_t *demux, int fd, uint32_t caps)
case V4L2_QUANTIZATION_DEFAULT:
break;
case V4L2_QUANTIZATION_FULL_RANGE:
- es_fmt.video.b_color_range_full = true;
+ es_fmt.video.color_range = COLOR_RANGE_FULL;
break;
case V4L2_QUANTIZATION_LIM_RANGE:
- es_fmt.video.b_color_range_full = false;
+ es_fmt.video.color_range = COLOR_RANGE_LIMITED;
break;
default:
msg_Err (demux, "unknown quantization: %u",
diff --git a/modules/codec/aom.c b/modules/codec/aom.c
index 6c130f4114..7b95b18661 100644
--- a/modules/codec/aom.c
+++ b/modules/codec/aom.c
@@ -225,7 +225,7 @@ static void OutputFrame(decoder_t *dec, const struct aom_image *img)
v->primaries = iso_23001_8_cp_to_vlc_primaries(img->cp);
v->transfer = iso_23001_8_tc_to_vlc_xfer(img->tc);
v->space = iso_23001_8_mc_to_vlc_coeffs(img->mc);
- v->b_color_range_full = img->range == AOM_CR_FULL_RANGE;
+ v->color_range = img->range == AOM_CR_FULL_RANGE ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
}
dec->fmt_out.video.projection_mode = dec->fmt_in.video.projection_mode;
diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h
index ab6e7e72e3..9e43db4360 100644
--- a/modules/codec/avcodec/avcommon.h
+++ b/modules/codec/avcodec/avcommon.h
@@ -143,8 +143,19 @@ static inline vlc_rational_t FromAVRational(const AVRational rat)
static inline void set_video_color_settings( const video_format_t *p_fmt, AVCodecContext *p_context )
{
- if( p_fmt->b_color_range_full )
+ switch( p_fmt->color_range )
+ {
+ case COLOR_RANGE_FULL:
p_context->color_range = AVCOL_RANGE_JPEG;
+ break;
+ case COLOR_RANGE_LIMITED:
+ p_context->color_range = AVCOL_RANGE_MPEG;
+ case COLOR_RANGE_UNDEF: /* do nothing */
+ break;
+ default:
+ p_context->color_range = AVCOL_RANGE_UNSPECIFIED;
+ break;
+ }
switch( p_fmt->space )
{
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 50cae13171..9e83695e73 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -238,19 +238,15 @@ static int lavc_GetVideoFormat(decoder_t *dec, video_format_t *restrict fmt,
* __MAX(ctx->ticks_per_frame, 1);
}
- /* 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 );
+ fmt->color_range = COLOR_RANGE_FULL;
break;
case AVCOL_RANGE_MPEG:
- default:
- fmt->b_color_range_full = false;
+ fmt->color_range = COLOR_RANGE_LIMITED;
+ break;
+ default: /* do nothing */
break;
}
diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c
index 18d7b3435b..6cb507252c 100644
--- a/modules/codec/dav1d.c
+++ b/modules/codec/dav1d.c
@@ -128,7 +128,7 @@ static int NewPicture(Dav1dPicture *img, void *cookie)
v->primaries = iso_23001_8_cp_to_vlc_primaries(img->p.pri);
v->transfer = iso_23001_8_tc_to_vlc_xfer(img->p.trc);
v->space = iso_23001_8_mc_to_vlc_coeffs(img->p.mtrx);
- v->b_color_range_full = img->p.fullrange;
+ v->color_range = img->p.fullrange ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
}
v->projection_mode = dec->fmt_in.video.projection_mode;
diff --git a/modules/codec/jpeg.c b/modules/codec/jpeg.c
index e72382cd9a..5f50f80819 100644
--- a/modules/codec/jpeg.c
+++ b/modules/codec/jpeg.c
@@ -180,7 +180,7 @@ static int OpenDecoder(vlc_object_t *p_this)
p_dec->fmt_out.video.i_chroma =
p_dec->fmt_out.i_codec = VLC_CODEC_RGB24;
p_dec->fmt_out.video.transfer = TRANSFER_FUNC_SRGB;
- p_dec->fmt_out.video.b_color_range_full = true;
+ p_dec->fmt_out.video.color_range = COLOR_RANGE_FULL;
video_format_FixRgb(&p_dec->fmt_out.video);
return VLC_SUCCESS;
diff --git a/modules/codec/png.c b/modules/codec/png.c
index 4f4c86b121..ad63e6321f 100644
--- a/modules/codec/png.c
+++ b/modules/codec/png.c
@@ -126,7 +126,7 @@ static int OpenDecoder( vlc_object_t *p_this )
/* Set output properties */
p_dec->fmt_out.i_codec = VLC_CODEC_RGBA;
p_dec->fmt_out.video.transfer = TRANSFER_FUNC_SRGB;
- p_dec->fmt_out.video.b_color_range_full = true;
+ p_dec->fmt_out.video.color_range = COLOR_RANGE_FULL;
/* Set callbacks */
p_dec->pf_decode = DecodeBlock;
diff --git a/modules/codec/videotoolbox.m b/modules/codec/videotoolbox.m
index e7753aebee..755779ff63 100644
--- a/modules/codec/videotoolbox.m
+++ b/modules/codec/videotoolbox.m
@@ -488,7 +488,7 @@ static bool ConfigureVoutH264(decoder_t *p_dec)
p_dec->fmt_out.video.primaries = primaries;
p_dec->fmt_out.video.transfer = transfer;
p_dec->fmt_out.video.space = colorspace;
- p_dec->fmt_out.video.b_color_range_full = full_range;
+ p_dec->fmt_out.video.color_range = full_range ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
}
}
diff --git a/modules/codec/vpx.c b/modules/codec/vpx.c
index 7c111e66d0..f03c7fae62 100644
--- a/modules/codec/vpx.c
+++ b/modules/codec/vpx.c
@@ -269,7 +269,7 @@ static int Decode(decoder_t *dec, block_t *block)
v->primaries = vpx_color_mapping_table[img->cs].primaries;
v->transfer = vpx_color_mapping_table[img->cs].transfer;
v->space = vpx_color_mapping_table[img->cs].space;
- v->b_color_range_full = img->range == VPX_CR_FULL_RANGE;
+ v->color_range = img->range == VPX_CR_FULL_RANGE ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
}
dec->fmt_out.video.projection_mode = dec->fmt_in.video.projection_mode;
diff --git a/modules/codec/x264.c b/modules/codec/x264.c
index 3802b24f4f..209d4a288c 100644
--- a/modules/codec/x264.c
+++ b/modules/codec/x264.c
@@ -816,7 +816,7 @@ static int Open ( vlc_object_t *p_this )
return VLC_ENOMEM;
fullrange = var_GetBool( p_enc, SOUT_CFG_PREFIX "fullrange" );
- fullrange |= p_enc->fmt_in.video.b_color_range_full;
+ fullrange |= p_enc->fmt_in.video.color_range == COLOR_RANGE_FULL;
p_enc->fmt_in.i_codec = fullrange ? VLC_CODEC_J420 : VLC_CODEC_I420;
p_sys->i_colorspace = X264_CSP_I420;
char *psz_profile = var_GetString( p_enc, SOUT_CFG_PREFIX "profile" );
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 549519e98d..e122530955 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -709,11 +709,11 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
switch( static_cast<uint8>(range) )
{
case 1:
- vars.tk->fmt.video.b_color_range_full = 0;
+ vars.tk->fmt.video.color_range = COLOR_RANGE_LIMITED;
name ="limited";
break;
case 2:
- vars.tk->fmt.video.b_color_range_full = 1;
+ vars.tk->fmt.video.color_range = COLOR_RANGE_FULL;
name ="full";
break;
case 3: // Matrix coefficients + Transfer characteristics
diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index 0af20f89e1..bd864e1b8a 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -504,8 +504,11 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
iso_23001_8_tc_to_vlc_xfer( BOXDATA( p_colr )->nclc.i_transfer_function_idx );
p_track->fmt.video.space =
iso_23001_8_mc_to_vlc_coeffs( BOXDATA( p_colr )->nclc.i_matrix_idx );
- p_track->fmt.video.b_color_range_full = BOXDATA(p_colr)->i_type == VLC_FOURCC( 'n', 'c', 'l', 'x' ) &&
- (BOXDATA(p_colr)->nclc.i_full_range >> 7) != 0;
+ if ( BOXDATA(p_colr)->i_type == VLC_FOURCC( 'n', 'c', 'l', 'x' ) &&
+ (BOXDATA(p_colr)->nclc.i_full_range >> 7) != 0 )
+ p_track->fmt.video.color_range = COLOR_RANGE_FULL;
+ else
+ p_track->fmt.video.color_range = COLOR_RANGE_LIMITED;
}
}
@@ -725,7 +728,7 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
iso_23001_8_mc_to_vlc_coeffs( p_data->i_matrix_coeffs );
}
- p_track->fmt.video.b_color_range_full = p_data->i_fullrange;
+ p_track->fmt.video.color_range = p_data->i_fullrange ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
p_track->fmt.video.i_bits_per_pixel = p_data->i_bit_depth;
if( p_data->i_codec_init_datasize )
diff --git a/modules/demux/mp4/heif.c b/modules/demux/mp4/heif.c
index e923bb3357..dd33904962 100644
--- a/modules/demux/mp4/heif.c
+++ b/modules/demux/mp4/heif.c
@@ -390,7 +390,8 @@ static int SetPictureProperties( demux_t *p_demux, uint32_t i_item_id,
p_prop->data.p_colr->nclc.i_transfer_function_idx );
fmt->video.space = iso_23001_8_mc_to_vlc_coeffs(
p_prop->data.p_colr->nclc.i_matrix_idx );
- fmt->video.b_color_range_full = p_prop->data.p_colr->nclc.i_full_range;
+ fmt->video.color_range = p_prop->data.p_colr->nclc.i_full_range ?
+ COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
break;
case ATOM_clli:
fmt->video.lighting.MaxCLL = p_prop->data.p_CoLL->i_maxCLL;
diff --git a/modules/hw/d3d9/dxva2_deinterlace.c b/modules/hw/d3d9/dxva2_deinterlace.c
index 0f44ca442c..01b9c6f696 100644
--- a/modules/hw/d3d9/dxva2_deinterlace.c
+++ b/modules/hw/d3d9/dxva2_deinterlace.c
@@ -87,7 +87,8 @@ static void Flush(filter_t *filter)
static void FillExtendedFormat( const video_format_t *p_fmt,
DXVA2_ExtendedFormat *out )
{
- out->NominalRange = p_fmt->b_color_range_full ? DXVA2_NominalRange_0_255 : DXVA2_NominalRange_16_235;
+ out->NominalRange = p_fmt->color_range == COLOR_RANGE_FULL ?
+ DXVA2_NominalRange_0_255 : DXVA2_NominalRange_16_235;
switch (p_fmt->space)
{
case COLOR_SPACE_BT601:
diff --git a/modules/mux/mp4/libmp4mux.c b/modules/mux/mp4/libmp4mux.c
index 1e28967a42..7620008feb 100644
--- a/modules/mux/mp4/libmp4mux.c
+++ b/modules/mux/mp4/libmp4mux.c
@@ -993,7 +993,7 @@ static bo_t *GetColrBox(const video_format_t *p_vfmt, bool b_mov)
bo_add_16be(p_box, vlc_primaries_to_iso_23001_8_cp(p_vfmt->primaries));
bo_add_16be(p_box, vlc_xfer_to_iso_23001_8_tc(p_vfmt->transfer));
bo_add_16be(p_box, vlc_coeffs_to_iso_23001_8_mc(p_vfmt->space));
- bo_add_8(p_box, p_vfmt->b_color_range_full ? 0x80 : 0x00);
+ bo_add_8(p_box, p_vfmt->color_range == COLOR_RANGE_FULL ? 0x80 : 0x00);
}
return p_box;
}
diff --git a/modules/packetizer/av1.c b/modules/packetizer/av1.c
index f30d3434a1..47ac8fd363 100644
--- a/modules/packetizer/av1.c
+++ b/modules/packetizer/av1.c
@@ -147,7 +147,7 @@ static void UpdateDecoderFormat(decoder_t *p_dec)
p_dec->fmt_out.video.primaries = prim;
p_dec->fmt_out.video.transfer = xfer;
p_dec->fmt_out.video.space = space;
- p_dec->fmt_out.video.b_color_range_full = full;
+ p_dec->fmt_out.video.color_range = full ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
}
if(!p_dec->fmt_in.i_extra && !p_dec->fmt_out.i_extra)
diff --git a/modules/packetizer/av1_obu.c b/modules/packetizer/av1_obu.c
index 4e97470266..0488c36e93 100644
--- a/modules/packetizer/av1_obu.c
+++ b/modules/packetizer/av1_obu.c
@@ -194,17 +194,17 @@ static bool av1_parse_color_config(bs_t *p_bs,
if(p_cc->mono_chrome)
{
- p_cc->color_range = bs_read1(p_bs);
+ p_cc->color_range = bs_read1(p_bs) ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
}
else if( p_cc->color_primaries == 1 &&
p_cc->transfer_characteristics == 13 &&
p_cc->matrix_coefficients == 0 )
{
- p_cc->color_range = 1;
+ p_cc->color_range = COLOR_RANGE_FULL;
}
else
{
- p_cc->color_range = bs_read1(p_bs);
+ p_cc->color_range = bs_read1(p_bs) ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
if(seq_profile > 1)
{
if(BitDepth == 12)
@@ -542,7 +542,7 @@ bool AV1_get_colorimetry(const av1_OBU_sequence_header_t *p_seq,
*p_primaries = iso_23001_8_cp_to_vlc_primaries(p_seq->color_config.color_primaries);
*p_transfer = iso_23001_8_tc_to_vlc_xfer(p_seq->color_config.transfer_characteristics);
*p_colorspace = iso_23001_8_mc_to_vlc_coeffs(p_seq->color_config.matrix_coefficients);
- *p_full_range = p_seq->color_config.color_range;
+ *p_full_range = p_seq->color_config.color_range == COLOR_RANGE_FULL;
return true;
}
diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index f239b8531b..463aa3bee5 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -227,10 +227,14 @@ static void ActivateSets( decoder_t *p_dec, const h264_sequence_parameter_set_t
}
}
if( p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF )
+ {
+ bool color_full;
h264_get_colorimetry( p_sps, &p_dec->fmt_out.video.primaries,
&p_dec->fmt_out.video.transfer,
&p_dec->fmt_out.video.space,
- &p_dec->fmt_out.video.b_color_range_full );
+ &color_full );
+ p_dec->fmt_out.video.color_range = color_full ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
+ }
}
if( p_dec->fmt_out.i_extra == 0 && p_pps )
diff --git a/modules/packetizer/hevc.c b/modules/packetizer/hevc.c
index aff8de39f4..b773adfdb9 100644
--- a/modules/packetizer/hevc.c
+++ b/modules/packetizer/hevc.c
@@ -560,11 +560,13 @@ static void ActivateSets(decoder_t *p_dec,
if(p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF)
{
+ bool color_full;
(void) hevc_get_colorimetry( p_sps,
&p_dec->fmt_out.video.primaries,
&p_dec->fmt_out.video.transfer,
&p_dec->fmt_out.video.space,
- &p_dec->fmt_out.video.b_color_range_full);
+ &color_full);
+ p_dec->fmt_out.video.color_range = color_full ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
}
unsigned sizes[4];
diff --git a/modules/packetizer/mpeg4video.c b/modules/packetizer/mpeg4video.c
index e457d0c9cf..281e911a22 100644
--- a/modules/packetizer/mpeg4video.c
+++ b/modules/packetizer/mpeg4video.c
@@ -475,7 +475,7 @@ static int ParseVO( decoder_t *p_dec, block_t *p_vo )
p_dec->fmt_out.video.primaries = iso_23001_8_cp_to_vlc_primaries( colour_primaries );
p_dec->fmt_out.video.transfer = iso_23001_8_tc_to_vlc_xfer( colour_xfer );
p_dec->fmt_out.video.space = iso_23001_8_mc_to_vlc_coeffs( colour_matrix_coeff );
- p_dec->fmt_out.video.b_color_range_full = full_range;
+ p_dec->fmt_out.video.color_range = full_range ? COLOR_RANGE_FULL : COLOR_RANGE_LIMITED;
}
}
diff --git a/modules/stream_out/transcode/encoder/video.c b/modules/stream_out/transcode/encoder/video.c
index cfdaf655a3..ece2d3b0c6 100644
--- a/modules/stream_out/transcode/encoder/video.c
+++ b/modules/stream_out/transcode/encoder/video.c
@@ -238,7 +238,7 @@ void transcode_encoder_video_configure( vlc_object_t *p_obj,
p_enc_out->space = p_src->space;
p_enc_out->transfer = p_src->transfer;
p_enc_out->primaries = p_src->primaries;
- p_enc_out->b_color_range_full = p_src->b_color_range_full;
+ p_enc_out->color_range = p_src->color_range;
/* set masks when RGB */
video_format_FixRgb(&p_enc->p_encoder->fmt_in.video);
diff --git a/modules/video_output/placebo_utils.c b/modules/video_output/placebo_utils.c
index 90edf77be1..8dcb1e5f21 100644
--- a/modules/video_output/placebo_utils.c
+++ b/modules/video_output/placebo_utils.c
@@ -439,7 +439,7 @@ struct pl_color_repr vlc_placebo_ColorRepr(const video_format_t *fmt)
return (struct pl_color_repr) {
.sys = sys,
.alpha = PL_ALPHA_PREMULTIPLIED,
- .levels = unlikely(fmt->b_color_range_full)
+ .levels = unlikely(fmt->color_range == COLOR_RANGE_FULL)
? PL_COLOR_LEVELS_PC
: PL_COLOR_LEVELS_TV,
.bits = {
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 5fd66467e1..4489131ae5 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1049,7 +1049,7 @@ static void D3D11SetColorSpace(vout_display_t *vd)
goto done;
}
- bool src_full_range = vd->source.b_color_range_full ||
+ bool src_full_range = vd->source.color_range == COLOR_RANGE_FULL ||
/* the YUV->RGB conversion already output full range */
is_d3d11_opaque(vd->source.i_chroma) ||
vlc_fourcc_IsYUV(vd->source.i_chroma);
@@ -1490,7 +1490,7 @@ static int Direct3D11CreateFormatResources(vout_display_t *vd, const video_forma
hr = D3D11_CompilePixelShader(vd, &sys->hd3d, sys->legacy_shader, &sys->d3d_dev,
&sys->display, fmt->transfer, fmt->primaries,
- fmt->b_color_range_full,
+ fmt->color_range == COLOR_RANGE_FULL,
&sys->picQuad);
if (FAILED(hr))
{
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 0cdd08cfe2..22033131af 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3517,10 +3517,20 @@ static void EsOutUpdateInfo( es_out_t *out, es_out_id_t *es, const vlc_meta_t *p
};
static_assert(ARRAY_SIZE(space_names) == COLOR_SPACE_MAX+1,
"Color space table mismatch");
- info_category_AddInfo( p_cat, _("Color space"), _("%s %s Range"),
- vlc_gettext(space_names[fmt->video.space]),
- vlc_gettext(fmt->video.b_color_range_full
- ? N_("Full") : N_("Limited")) );
+ info_category_AddInfo( p_cat, _("Color space"), "%s",
+ vlc_gettext(space_names[fmt->video.space]) );
+ }
+ if( fmt->video.color_range != COLOR_RANGE_UNDEF )
+ {
+ static const char range_names[][16] = {
+ [COLOR_RANGE_UNDEF] = N_("Undefined"),
+ [COLOR_RANGE_FULL] = N_("Full"),
+ [COLOR_RANGE_LIMITED] = N_("Limited"),
+ };
+ static_assert(ARRAY_SIZE(range_names) == COLOR_RANGE_MAX+1,
+ "Color range table mismatch");
+ info_category_AddInfo( p_cat, _("Color Range"), "%s",
+ vlc_gettext(range_names[fmt->video.color_range]) );
}
if( fmt->video.chroma_location != CHROMA_LOCATION_UNDEF )
{
--
2.17.1
More information about the vlc-devel
mailing list