1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:17:44 +00:00

LibVideo: Rename "ColorRange" to "VideoFullRangeFlag"

That matches the terminology used in ITU-T Rec. H.273,
PNG's cICP chunk, and the ICC cicpTag.

Also change the enum values to match the values in the spec --
0 means "not full range" and 1 means "full range".

(For now, keep the "Unspecified" entry around, and give it value 2.
This value is not in the spec.)

No intended behavior change.
This commit is contained in:
Nico Weber 2023-02-08 14:16:37 -05:00 committed by Linus Groh
parent 49474d8718
commit 89b98830f6
7 changed files with 29 additions and 29 deletions

View file

@ -143,11 +143,11 @@ DecoderErrorOr<void> Parser::refresh_probs(FrameContext const& frame_context)
return {};
}
DecoderErrorOr<ColorRange> Parser::read_color_range()
DecoderErrorOr<VideoFullRangeFlag> Parser::read_video_full_range_flag()
{
if (TRY_READ(m_bit_stream->read_bit()))
return ColorRange::Full;
return ColorRange::Studio;
return VideoFullRangeFlag::Full;
return VideoFullRangeFlag::Studio;
}
/* (6.2) */
@ -303,11 +303,11 @@ DecoderErrorOr<ColorConfig> Parser::parse_color_config(FrameContext const& frame
auto color_space = static_cast<ColorSpace>(TRY_READ(m_bit_stream->read_bits(3)));
VERIFY(color_space <= ColorSpace::RGB);
ColorRange color_range;
VideoFullRangeFlag video_full_range_flag;
bool subsampling_x, subsampling_y;
if (color_space != ColorSpace::RGB) {
color_range = TRY(read_color_range());
video_full_range_flag = TRY(read_video_full_range_flag());
if (frame_context.profile == 1 || frame_context.profile == 3) {
subsampling_x = TRY_READ(m_bit_stream->read_bit());
subsampling_y = TRY_READ(m_bit_stream->read_bit());
@ -318,7 +318,7 @@ DecoderErrorOr<ColorConfig> Parser::parse_color_config(FrameContext const& frame
subsampling_y = true;
}
} else {
color_range = ColorRange::Full;
video_full_range_flag = VideoFullRangeFlag::Full;
if (frame_context.profile == 1 || frame_context.profile == 3) {
subsampling_x = false;
subsampling_y = false;
@ -330,7 +330,7 @@ DecoderErrorOr<ColorConfig> Parser::parse_color_config(FrameContext const& frame
}
}
return ColorConfig { bit_depth, color_space, color_range, subsampling_x, subsampling_y };
return ColorConfig { bit_depth, color_space, video_full_range_flag, subsampling_x, subsampling_y };
}
DecoderErrorOr<Gfx::Size<u32>> Parser::parse_frame_size()