-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support DisplayP3
and BT.2020 + PQ
#96
base: main
Are you sure you want to change the base?
Support DisplayP3
and BT.2020 + PQ
#96
Conversation
In the current implementation, 10-bit signals can be stored, but they are derived from 8-bit signals, offering no visual improvement. All incoming data has been assumed to be 8-bit sRGB. This PR takes the first step in removing these assumptions by enabling the storage of signals with higher bit depth. It lays the groundwork for full support of writing HDR images.
.value_name("sRGB/displayP3/rec2020Pq") | ||
.value_parser(parse_color_space) | ||
.required(true) | ||
.help("The color space passed values are in [possible values: sRGB, displayP3, rec2020Pq] ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.help("The color space passed values are in [possible values: sRGB, displayP3, rec2020Pq] ")) | |
.help("The color space passed values are in [possible values: sRGB, displayP3, rec2020Pq]")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that your parse_color_space()
ignores casing, perhaps this should be written without any, too.
(Though personally I favour sticking to case-sensitive cmdline arguments...)
match s.to_lowercase().as_str() { | ||
"srgb" => Ok(ColorSpace::Srgb), | ||
"displayp3" => Ok(ColorSpace::DisplayP3), | ||
"rec2020Pq" => Ok(ColorSpace::Rec2020Pq), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise to_lowercase()
can't ever match:
"rec2020Pq" => Ok(ColorSpace::Rec2020Pq), | |
"rec2020pq" => Ok(ColorSpace::Rec2020Pq), |
// Since there's no matrix for Display P3 implemented, the one of BT709 is used. | ||
// Although this isn't perfectly accurate, it should be acceptable as long as the decoder uses the same approach. | ||
ColorSpace::DisplayP3 => MatrixCoefficients::BT709, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should use the BT709
matrix coefficients for DisplayP3
inside rgb_to_ycbcr()
in this case?
(at which point you can maybe create a fn color_matrix(self) -> [3; f32]
on MatrixCoefficients
?)
This PR adds support for storing
Display P3
andRec.2020 + PQ
aside from sRGB. Functionality to specify which color space to use has also been added tocavif-rs
. Be mindful that exported HDR images are not well supported on the web.Isolated changes: c4e20dc