Skip to content

Commit 2134184

Browse files
authored
Add reference comments about VideoFullRangeFlag (#24)
* Add reference comments about VideoFullRangeFlag
1 parent 71733dc commit 2134184

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/image.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub struct Image {
5050
pub depth: u8,
5151

5252
pub yuv_format: PixelFormat,
53-
pub full_range: bool,
53+
pub full_range: bool, // VideoFullRangeFlag as specified in ISO/IEC 23091-2/ITU-T H.273.
5454
pub chroma_sample_position: ChromaSamplePosition,
5555

5656
pub alpha_present: bool,

src/reformat/rgb_impl.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ enum Mode {
5555
struct YuvColorSpaceInfo {
5656
channel_bytes: u32,
5757
depth: u32,
58-
full_range: bool,
58+
full_range: bool, // VideoFullRangeFlag as specified in ISO/IEC 23091-2/ITU-T H.273.
5959
max_channel: u16,
6060
bias_y: f32,
6161
bias_uv: f32,
@@ -100,6 +100,7 @@ impl YuvColorSpaceInfo {
100100
depth: image.depth as u32,
101101
full_range: image.full_range,
102102
max_channel,
103+
// See the formulas in ISO/IEC 23091-2.
103104
bias_y: if image.full_range { 0.0 } else { (16 << (image.depth - 8)) as f32 },
104105
bias_uv: (1 << (image.depth - 1)) as f32,
105106
range_y: if image.full_range { max_channel } else { 219 << (image.depth - 8) } as f32,

0 commit comments

Comments
 (0)