Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub struct Image {
pub depth: u8,

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

pub alpha_present: bool,
Expand Down
3 changes: 2 additions & 1 deletion src/reformat/rgb_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ enum Mode {
struct YuvColorSpaceInfo {
channel_bytes: u32,
depth: u32,
full_range: bool,
full_range: bool, // VideoFullRangeFlag as specified in ISO/IEC 23091-2/ITU-T H.273.
max_channel: u16,
bias_y: f32,
bias_uv: f32,
Expand Down Expand Up @@ -100,6 +100,7 @@ impl YuvColorSpaceInfo {
depth: image.depth as u32,
full_range: image.full_range,
max_channel,
// See the formulas in ISO/IEC 23091-2.
bias_y: if image.full_range { 0.0 } else { (16 << (image.depth - 8)) as f32 },
bias_uv: (1 << (image.depth - 1)) as f32,
range_y: if image.full_range { max_channel } else { 219 << (image.depth - 8) } as f32,
Expand Down