Skip to content

Add colorimetry information API in Picture - #94

Merged
philn merged 2 commits into
rust-av:masterfrom
philn:colorimetry
Mar 22, 2024
Merged

philn merged 2 commits into
rust-av:masterfrom
philn:colorimetry

Conversation

@philn

@philn philn commented Mar 21, 2024

Copy link
Copy Markdown
Contributor

Fixes #93

@philn
philn requested a review from lu-zero March 21, 2024 15:38

@sdroege sdroege left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Comment thread src/lib.rs Outdated
DAV1D_COLOR_PRI_SMPTE431 => pixel::ColorPrimaries::P3DCI,
DAV1D_COLOR_PRI_SMPTE432 => pixel::ColorPrimaries::P3Display,
DAV1D_COLOR_PRI_EBU3213 => pixel::ColorPrimaries::Tech3213,
DAV1D_COLOR_PRI_RESERVED => unreachable!(),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that indeed unreachable? Also below in the same places

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With current dav1d git master yes, I've checked these appear only in the header file. Maybe we could make these methods return an Option<>?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lu-zero What do you think?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hacky way is to return pixel::ColorPrimaries::Unspecified as well, since the user would have no mean to deal with it anyway and add a mean to get the raw bitstream value in case the user knows how to use it since there are few "for future use" values. that assuming PRI_RESERVED maps to the bitstream value.

Anybody willing to read ISO/IEC 23091-4/ITU-T H.273 and doublecheck?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one? https://www.itu.int/rec/T-REC-H.273-202309-P/en

I'm not registered in TIES.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, in the spec the reserved value is specified as a range, for instance, for ColorPrimaries, it is 23-255, while DAV1D_COLOR_PRI_RESERVED is 255. Same goes for TransferCharacteristics (19-255) and MatrixCoefficients (15-255).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say that mapping it to Unspecified wouldn't feel too bad. Maybe I could future-proof av-data and add a Reserved(u8) but that's unrelated to this patch.

Comment thread src/lib.rs Resolved
@philn
philn force-pushed the colorimetry branch 2 times, most recently from 2ad25b7 to 2b29154 Compare March 22, 2024 16:21
Comment thread src/lib.rs Resolved

@sdroege sdroege left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mapping to unspecified makes most sense to me too

Comment thread src/lib.rs Resolved
@lu-zero

lu-zero commented Mar 22, 2024

Copy link
Copy Markdown
Member

I'd land it

@philn
philn merged commit 73fa84a into rust-av:master Mar 22, 2024
@philn

philn commented Mar 23, 2024

Copy link
Copy Markdown
Contributor Author

Thanks for the reviews :) Is a new release planned soon?

@philn
philn deleted the colorimetry branch March 23, 2024 09:13
@lu-zero

lu-zero commented Mar 23, 2024

Copy link
Copy Markdown
Member

If dav1d-1.4.1 didn't bring anything more we can make one even today (or tomorrow).

@philn

philn commented Mar 25, 2024

Copy link
Copy Markdown
Contributor Author

The release notes since 1.3.0 mention mostly optimizations. I've checked 1.4.1 works fine here (on x86_64) with current master branch of dav1d-rs and my WIP colorimetry branch of gst-plugin-dav1d ;)

@sdroege

sdroege commented Mar 26, 2024

Copy link
Copy Markdown
Contributor

There are no changes in the headers since 1.3.0 so yes that seems fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Colorimetry information

3 participants