-
Notifications
You must be signed in to change notification settings - Fork 11
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
cICP chunk specification might be in disagreement with H273 #129
Comments
The original I couldn't find any discussion about extending these fields to 2 bytes each. |
IIRC, we originally proposed 1 byte because that is what JXL did. I was rereading H.273 yesterday to see if I missed anything when my power went out. It just came back. I'll continue reading and tell you what I find. |
FWIW AVIF seems to use 8 bits too: https://github.com/AOMediaCodec/libavif/blob/dd2ef69cc98b5dc7430da2580a97389a6d9bf12f/src/obu.c#L263 Also it seems that their syntax does not allow expressing limited range for sRGB data (if I read the code right), but that depends on the specific primaries. |
I thought it was because that is what H.273 specifies? The JPEG-XL library seems to accept a small set of the H.273 values, as enumerations, but then extends that set with values greater than 255:
|
That representation does not correspond to the bitstream implementation though :) |
CICP (H.273 and ISO/IEC 23091-2:2021) specifies that the range of Colour primaries, Transfer characteristics, and Matrix coefficients (excluding the associated VideoFullRangeFlag) is all 0 - 255. So these three values can all be stored in one-byte fields. ISO BMFF (ISO/IEC 14496-12:2022) stores these three values in two-byte fields in the 'colr' box of the 'nclx' type. See Section 12.1.5.2:
So using two bytes for these three fields in https://w3c.github.io/PNG-spec/#11cICP most likely was influenced by the 'colr' box of ISO BMFF. |
I finally have power again and am able to reread H.273. Some things I found:
All of this confirms what Wan-Teh Chang said. I don't have a copy of ISO/IEC 14496-12:2022. I suppose I'll get a copy. Even if we completely intend to ignore it and only follow CICP, it would be good to have read publications adjacent to what we're trying to accomplish. But I'll do that later. Then I wondered "Where did we get the idea it was something other than a byte each?" I found this issue which mentions 7 bytes is required. But that is all I found. @palemieux you were mentioned there. Do you know how we can track it further back? For now, I'm happy making all of these one byte. |
It looks like several ISO/ITU image standards have gotten into the habit of using 2 bytes, e.g. ITU-T T.814 | ISO/IEC 15444-15: It is not clear why. I think the argument for 2 byte is probably that it enhances compatibility with ISO/ITU standards. Perhaps we should NOTE that explicitly in the document. |
Do we even want to do 2 bytes though? |
I would not object to a single byte. |
I think I'd personally prefer 1 byte, but no strong opinion. That said, I find the "decimal" value in the current wording ("The cICP chunk contains four decimal values [...]") to be somewhat confusing -- as far I can see it is only used in the spec to refer to numbers represented in the text, and never for the bitstream itself. It also makes someone wonder about whether the values are supposed to be stored as base-10 ASCII ;) |
I took a stab at cleanin-up the cICP chunk, including constraining the fields to 1 byte each, per the discussion above. |
What it is trying to say is that those four bytes contain ASCII characters, and here are their decimal values (to make it clear how they are encoded; in the early days of the Web there were all sorts of text encodings flying around). |
I expect @cconcolato would know why ISO BMFF uses 2 bytes for these 0..255 enumeration values. |
Puzzled by this from the abstract of RP 2077:2013:
Isn't that exactly what we are citing it for? (I don't have a spec purchase budget for paywalled specs, so haven't read the actual spec) |
That works for the cICP characters, and it makes sense there; I was referring to...
|
The idea is to cite SMPTE RP 2077 since the mapping between narrow- and full-range images is complex. For example, it is generally possible to map a narrow-range image to a full-range image only if the narrow-range image came from a full-range image. The note should probably say: "see SMPTE RP 2077 for additional information on mapping between narrow- and full-range images." |
* Conform to Rec. ITU-T h.273 (#129) Clean-up cICP chunk * Remove misleading example
See also w3c/png#129 for an editorial issue in the PNG specification wrt the size of the fields of the cICP chunk. PAIR=sboukortt@google.com Change-Id: Ia7717f161bd1569691e07c9216957814f2c073f0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3705739 Reviewed-by: Wan-Teh Chang <wtc@google.com> Reviewed-by: Chris Blume <cblume@chromium.org> Commit-Queue: Luca Versari <veluca@google.com> Reviewed-by: Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/main@{#1017577} NOKEYCHECK=True GitOrigin-RevId: f115626f38397e70e4d8afe507886f367c31d7c2
The cICP chunk spec specifies 7 bytes in total, in particular 2 for each of Matrix Coefficients, Primaries and Transfer Curve, but H.273 mentions that one byte should be sufficient.
Is this just an editorial issue, or is there some deeper reason behind this choice?
The text was updated successfully, but these errors were encountered: