gfx::HDRMetadata: Use skhdr types [chromium/src : main]

0 views
Skip to first unread message

ccameron chromium (Gerrit)

unread,
Mar 18, 2026, 7:12:01 PMMar 18
to ccameron chromium, Daniel Cheng, Dale Curtis, Sandeep Vijayasekar, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
Attention needed from Dale Curtis, Daniel Cheng and Sandeep Vijayasekar

ccameron chromium voted and added 1 comment

Votes added by ccameron chromium

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 10 (Latest):
ccameron chromium . resolved

ptal. This should have no functional effects -- just a long-overdue de-duping of structures that have moved to Skia.

sandv for chromecast
dalecurtis for media and friends
dcheng for IPC

Open in Gerrit

Related details

Attention is currently required from:
  • Dale Curtis
  • Daniel Cheng
  • Sandeep Vijayasekar
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
Gerrit-Change-Number: 7679172
Gerrit-PatchSet: 10
Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
Gerrit-Attention: Sandeep Vijayasekar <sa...@google.com>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Wed, 18 Mar 2026 23:11:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Dale Curtis (Gerrit)

unread,
Mar 18, 2026, 7:45:22 PMMar 18
to ccameron chromium, Daniel Cheng, Sandeep Vijayasekar, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
Attention needed from Daniel Cheng, Sandeep Vijayasekar and ccameron chromium

Dale Curtis added 6 comments

File media/base/android/jni_hdr_metadata.cc
Line 98, Patchset 10 (Latest): return static_cast<int32_t>(hdr_metadata_->HasCLLI()
Dale Curtis . unresolved

Should we change the return type here instead?

Line 103, Patchset 10 (Latest):int32_t JniHdrMetadata::MaxFrameAverageLuminance(JNIEnv* env) {
Dale Curtis . unresolved

Ditto

File media/formats/mp4/box_definitions.cc
Line 1349, Patchset 10 (Latest): static_cast<float>(level_information.max_content_light_level),
Dale Curtis . unresolved

Should we align the types to avoid the casts?

Line 1399, Patchset 10 (Latest): static_cast<float>(level_information.max_content_light_level),
Dale Curtis . unresolved

Ditto

File media/parsers/h265_parser.cc
Line 1527, Patchset 10 (Latest): return {static_cast<float>(max_content_light_level),
Dale Curtis . unresolved

Ditto on type alignment

File third_party/blink/renderer/core/html/canvas/predefined_color_space.cc
Line 126, Patchset 10 (Latest): v8_metadata->minimumLuminance(),
Dale Curtis . unresolved

Gemini: It looks like `minimumLuminance` and `maximumLuminance` are swapped here. The `skhdr::MasteringDisplayColorVolume` struct takes maximum luminance as the second argument and minimum as the third.

To prevent this kind of error, I'd recommend using designated initializers, which is done in many other places in this CL:

```cpp
hdr_metadata.SetMDCV(
skhdr::MasteringDisplayColorVolume{
.fDisplayPrimaries = {
v8_metadata->redPrimaryX(), v8_metadata->redPrimaryY(),
v8_metadata->greenPrimaryX(), v8_metadata->greenPrimaryY(),
v8_metadata->bluePrimaryX(), v8_metadata->bluePrimaryY(),
v8_metadata->whitePointX(), v8_metadata->whitePointY(),
},
.fMaximumDisplayMasteringLuminance = v8_metadata->maximumLuminance(),
.fMinimumDisplayMasteringLuminance = v8_metadata->minimumLuminance(),
});
```
Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Sandeep Vijayasekar
  • ccameron chromium
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
    Gerrit-Change-Number: 7679172
    Gerrit-PatchSet: 10
    Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
    Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
    Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
    Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
    Gerrit-Attention: Sandeep Vijayasekar <sa...@google.com>
    Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
    Gerrit-Comment-Date: Wed, 18 Mar 2026 23:45:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Daniel Cheng (Gerrit)

    unread,
    Mar 19, 2026, 11:14:17 AMMar 19
    to ccameron chromium, Daniel Cheng, Dale Curtis, Sandeep Vijayasekar, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
    Attention needed from Sandeep Vijayasekar and ccameron chromium

    Daniel Cheng added 1 comment

    File third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc
    Line 860, Patchset 11 (Latest): static_cast<float>(container->clli.maxCLL),
    Daniel Cheng . unresolved

    Do we need to care about rounding at all here? What happened previously?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Sandeep Vijayasekar
    • ccameron chromium
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
    Gerrit-Change-Number: 7679172
    Gerrit-PatchSet: 11
    Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
    Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
    Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
    Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
    Gerrit-Attention: Sandeep Vijayasekar <sa...@google.com>
    Gerrit-Comment-Date: Thu, 19 Mar 2026 15:14:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    ccameron chromium (Gerrit)

    unread,
    Mar 20, 2026, 5:44:40 AM (13 days ago) Mar 20
    to ccameron chromium, Daniel Cheng, Dale Curtis, Sandeep Vijayasekar, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
    Attention needed from Dale Curtis, Daniel Cheng and Sandeep Vijayasekar

    ccameron chromium added 9 comments

    Patchset-level comments
    File-level comment, Patchset 11 (Latest):
    ccameron chromium . resolved

    Thanks, updated

    File media/base/android/jni_hdr_metadata.cc
    Line 98, Patchset 10: return static_cast<int32_t>(hdr_metadata_->HasCLLI()
    Dale Curtis . unresolved

    Should we change the return type here instead?

    ccameron chromium

    E

    Line 98, Patchset 10: return static_cast<int32_t>(hdr_metadata_->HasCLLI()
    Dale Curtis . unresolved

    Should we change the return type here instead?

    ccameron chromium

    The types for CLLI are an unfortunate mess. There are two different definitions -- one used by CTA and one by W3C. There's some background [here](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/include/private/SkHdrMetadata.h;l=26;drc=7578ad6ba4a241db855165753be9fe75f6439d32).

    The CTA definition only supports integer values. The W3C version is non-integer. When I created the skhdr type I used floats so we could round-trip PNG encode/decode without losing precision (support for skia-based decoders was a forcing function to add HDR metadata to skia).

    So that's why we have this mismatch, and why we now have to cast the ints to floats. The alternatives are:

    • Have two types: CLLI_W3C and CLLI_CTA
    • Use integers, and accept that PNGs won't round-trip
    • To skhdr::ContentLightLevelInformation, add a `MakeUint16` function that takes `uint16_t`s, and `getUint16MaxContentLightLevel` function

    The last option is probably the best, so I added it [here](https://skia-review.googlesource.com/c/skia/+/1190056). It will require a skia roll, etc, so I'd rather land the massive patch (having it hang out and get stale makes me anxious!) and follow-on after I add the Skia interface.

    When I do that second pass I'll also probably want to change the default values being used here (they're zeros, but not obviously so).

    Line 103, Patchset 10:int32_t JniHdrMetadata::MaxFrameAverageLuminance(JNIEnv* env) {
    Dale Curtis . resolved

    Ditto

    ccameron chromium

    (see above)

    File media/formats/mp4/box_definitions.cc
    Line 1349, Patchset 10: static_cast<float>(level_information.max_content_light_level),
    Dale Curtis . resolved

    Should we align the types to avoid the casts?

    ccameron chromium

    (see above)

    Line 1399, Patchset 10: static_cast<float>(level_information.max_content_light_level),
    Dale Curtis . resolved

    Ditto

    ccameron chromium

    (see above)

    File media/parsers/h265_parser.cc
    Line 1527, Patchset 10: return {static_cast<float>(max_content_light_level),
    Dale Curtis . resolved

    Ditto on type alignment

    ccameron chromium

    (see above)

    File third_party/blink/renderer/core/html/canvas/predefined_color_space.cc
    Line 126, Patchset 10: v8_metadata->minimumLuminance(),
    Dale Curtis . resolved

    Gemini: It looks like `minimumLuminance` and `maximumLuminance` are swapped here. The `skhdr::MasteringDisplayColorVolume` struct takes maximum luminance as the second argument and minimum as the third.

    To prevent this kind of error, I'd recommend using designated initializers, which is done in many other places in this CL:

    ```cpp
    hdr_metadata.SetMDCV(
    skhdr::MasteringDisplayColorVolume{
    .fDisplayPrimaries = {
    v8_metadata->redPrimaryX(), v8_metadata->redPrimaryY(),
    v8_metadata->greenPrimaryX(), v8_metadata->greenPrimaryY(),
    v8_metadata->bluePrimaryX(), v8_metadata->bluePrimaryY(),
    v8_metadata->whitePointX(), v8_metadata->whitePointY(),
    },
    .fMaximumDisplayMasteringLuminance = v8_metadata->maximumLuminance(),
    .fMinimumDisplayMasteringLuminance = v8_metadata->minimumLuminance(),
    });
    ```
    ccameron chromium

    Fixed.

    Gemini review is so great. (Gemini-CLI was the one that wrote this code, so ... room for improvement).

    (And hopefully this prototype API will never see the light of day ... so glad we didn't expose this metadata to the web).

    File third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc
    Line 860, Patchset 11 (Latest): static_cast<float>(container->clli.maxCLL),
    Daniel Cheng . unresolved

    Do we need to care about rounding at all here? What happened previously?

    ccameron chromium

    (see the above comment about CLLI's multiple inconsistent rounding behaviors)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dale Curtis
    • Daniel Cheng
    • Sandeep Vijayasekar
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
    Gerrit-Change-Number: 7679172
    Gerrit-PatchSet: 11
    Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
    Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
    Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
    Gerrit-Attention: Sandeep Vijayasekar <sa...@google.com>
    Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
    Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
    Gerrit-Comment-Date: Fri, 20 Mar 2026 09:44:26 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
    Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dale Curtis (Gerrit)

    unread,
    Mar 22, 2026, 1:57:43 PM (11 days ago) Mar 22
    to ccameron chromium, Daniel Cheng, Sandeep Vijayasekar, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
    Attention needed from Daniel Cheng, Sandeep Vijayasekar and ccameron chromium

    Dale Curtis voted and added 3 comments

    Votes added by Dale Curtis

    Code-Review+1

    3 comments

    File media/base/android/jni_hdr_metadata.cc
    Line 98, Patchset 10: return static_cast<int32_t>(hdr_metadata_->HasCLLI()
    Dale Curtis . resolved

    Should we change the return type here instead?

    ccameron chromium

    The types for CLLI are an unfortunate mess. There are two different definitions -- one used by CTA and one by W3C. There's some background [here](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/include/private/SkHdrMetadata.h;l=26;drc=7578ad6ba4a241db855165753be9fe75f6439d32).

    The CTA definition only supports integer values. The W3C version is non-integer. When I created the skhdr type I used floats so we could round-trip PNG encode/decode without losing precision (support for skia-based decoders was a forcing function to add HDR metadata to skia).

    So that's why we have this mismatch, and why we now have to cast the ints to floats. The alternatives are:

    • Have two types: CLLI_W3C and CLLI_CTA
    • Use integers, and accept that PNGs won't round-trip
    • To skhdr::ContentLightLevelInformation, add a `MakeUint16` function that takes `uint16_t`s, and `getUint16MaxContentLightLevel` function

    The last option is probably the best, so I added it [here](https://skia-review.googlesource.com/c/skia/+/1190056). It will require a skia roll, etc, so I'd rather land the massive patch (having it hang out and get stale makes me anxious!) and follow-on after I add the Skia interface.

    When I do that second pass I'll also probably want to change the default values being used here (they're zeros, but not obviously so).

    Dale Curtis

    Acknowledged

    File media/gpu/av1_decoder.cc
    Line 126, Patchset 14 (Latest): return {static_cast<float>(cll.max_cll), static_cast<float>(cll.max_fall)};
    Dale Curtis . unresolved
    Gemini: Same here, designated initializers are preferred:
    ```cpp
    return {.fMaxCLL = static_cast<float>(cll.max_cll),
    .fMaxFALL = static_cast<float>(cll.max_fall)};
    ```
    File media/parsers/h264_parser.cc
    Line 231, Patchset 14 (Latest): return {static_cast<float>(max_content_light_level),
    Dale Curtis . unresolved
    Gemini: Prefer using designated initializers here for consistency and safety, as you did for MDCV in other files.
    ```cpp
    return {.fMaxCLL = static_cast<float>(max_content_light_level),
    .fMaxFALL = static_cast<float>(max_picture_average_light_level)};
    ```
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Daniel Cheng
    • Sandeep Vijayasekar
    • ccameron chromium
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
      Gerrit-Change-Number: 7679172
      Gerrit-PatchSet: 14
      Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
      Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
      Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
      Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
      Gerrit-Attention: Sandeep Vijayasekar <sa...@google.com>
      Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
      Gerrit-Comment-Date: Sun, 22 Mar 2026 17:57:30 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: ccameron chromium <ccam...@chromium.org>
      Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Daniel Cheng (Gerrit)

      unread,
      Mar 23, 2026, 3:25:52 PM (10 days ago) Mar 23
      to ccameron chromium, Daniel Cheng, Dale Curtis, Sandeep Vijayasekar, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
      Attention needed from Sandeep Vijayasekar and ccameron chromium

      Daniel Cheng voted and added 2 comments

      Votes added by Daniel Cheng

      Code-Review+1

      2 comments

      Patchset-level comments
      File third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc
      Line 860, Patchset 11: static_cast<float>(container->clli.maxCLL),
      Daniel Cheng . unresolved

      Do we need to care about rounding at all here? What happened previously?

      ccameron chromium

      (see the above comment about CLLI's multiple inconsistent rounding behaviors)

      Daniel Cheng

      I guess skia should have updated by now but I'm not going to push on this and I'll leave it to you. I personally think it's harder to make sure to go back and clean things up with the way C++ works but shrug.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Sandeep Vijayasekar
      • ccameron chromium
      Gerrit-Comment-Date: Mon, 23 Mar 2026 19:25:45 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: ccameron chromium <ccam...@chromium.org>
      Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Sandeep Vijayasekar (Gerrit)

      unread,
      Mar 24, 2026, 12:04:28 PM (9 days ago) Mar 24
      to ccameron chromium, Daniel Cheng, Dale Curtis, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
      Attention needed from ccameron chromium

      Sandeep Vijayasekar voted and added 1 comment

      Votes added by Sandeep Vijayasekar

      Code-Review+1

      1 comment

      Patchset-level comments
      File-level comment, Patchset 16 (Latest):
      Sandeep Vijayasekar . resolved

      CR for /chromecast

      Open in Gerrit

      Related details

      Attention is currently required from:
      • ccameron chromium
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
      Gerrit-Change-Number: 7679172
      Gerrit-PatchSet: 16
      Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
      Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
      Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
      Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
      Gerrit-Comment-Date: Tue, 24 Mar 2026 16:04:11 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      ccameron chromium (Gerrit)

      unread,
      Mar 24, 2026, 1:56:13 PM (9 days ago) Mar 24
      to ccameron chromium, Sandeep Vijayasekar, Daniel Cheng, Dale Curtis, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
      Attention needed from Dale Curtis and Daniel Cheng

      ccameron chromium voted and added 5 comments

      Votes added by ccameron chromium

      Commit-Queue+2

      5 comments

      File media/base/android/jni_hdr_metadata.cc
      Line 98, Patchset 10: return static_cast<int32_t>(hdr_metadata_->HasCLLI()
      Dale Curtis . resolved

      Should we change the return type here instead?

      ccameron chromium

      The types for CLLI are an unfortunate mess. There are two different definitions -- one used by CTA and one by W3C. There's some background [here](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/include/private/SkHdrMetadata.h;l=26;drc=7578ad6ba4a241db855165753be9fe75f6439d32).

      The CTA definition only supports integer values. The W3C version is non-integer. When I created the skhdr type I used floats so we could round-trip PNG encode/decode without losing precision (support for skia-based decoders was a forcing function to add HDR metadata to skia).

      So that's why we have this mismatch, and why we now have to cast the ints to floats. The alternatives are:

      • Have two types: CLLI_W3C and CLLI_CTA
      • Use integers, and accept that PNGs won't round-trip
      • To skhdr::ContentLightLevelInformation, add a `MakeUint16` function that takes `uint16_t`s, and `getUint16MaxContentLightLevel` function

      The last option is probably the best, so I added it [here](https://skia-review.googlesource.com/c/skia/+/1190056). It will require a skia roll, etc, so I'd rather land the massive patch (having it hang out and get stale makes me anxious!) and follow-on after I add the Skia interface.

      When I do that second pass I'll also probably want to change the default values being used here (they're zeros, but not obviously so).

      Dale Curtis

      Acknowledged

      ccameron chromium

      Updated to use the new Skia interface

      Line 103, Patchset 10:int32_t JniHdrMetadata::MaxFrameAverageLuminance(JNIEnv* env) {
      Dale Curtis . resolved

      Ditto

      ccameron chromium

      (see above)

      ccameron chromium

      Updated to use the new Skia interface

      File media/gpu/av1_decoder.cc
      Line 126, Patchset 14: return {static_cast<float>(cll.max_cll), static_cast<float>(cll.max_fall)};
      Dale Curtis . unresolved
      Gemini: Same here, designated initializers are preferred:
      ```cpp
      return {.fMaxCLL = static_cast<float>(cll.max_cll),
      .fMaxFALL = static_cast<float>(cll.max_fall)};
      ```
      ccameron chromium

      Changed to use `skhdr::ContentLightLevelInformation::MakeUint16`

      File media/parsers/h264_parser.cc
      Line 231, Patchset 14: return {static_cast<float>(max_content_light_level),
      Dale Curtis . unresolved
      Gemini: Prefer using designated initializers here for consistency and safety, as you did for MDCV in other files.
      ```cpp
      return {.fMaxCLL = static_cast<float>(max_content_light_level),
      .fMaxFALL = static_cast<float>(max_picture_average_light_level)};
      ```
      ccameron chromium

      Changed to use `skhdr::ContentLightLevelInformation::MakeUint16`

      File third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc
      Line 860, Patchset 11: static_cast<float>(container->clli.maxCLL),
      Daniel Cheng . unresolved

      Do we need to care about rounding at all here? What happened previously?

      ccameron chromium

      (see the above comment about CLLI's multiple inconsistent rounding behaviors)

      Daniel Cheng

      I guess skia should have updated by now but I'm not going to push on this and I'll leave it to you. I personally think it's harder to make sure to go back and clean things up with the way C++ works but shrug.

      ccameron chromium

      Updated to use `skhdr::ContentLightLevelInformation::MakeUint16`

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dale Curtis
      • Daniel Cheng
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
      Gerrit-Change-Number: 7679172
      Gerrit-PatchSet: 16
      Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
      Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
      Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
      Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
      Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
      Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
      Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
      Gerrit-Comment-Date: Tue, 24 Mar 2026 17:55:52 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: ccameron chromium <ccam...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      ccameron chromium (Gerrit)

      unread,
      Mar 24, 2026, 1:56:40 PM (9 days ago) Mar 24
      to ccameron chromium, Sandeep Vijayasekar, Daniel Cheng, Dale Curtis, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
      Attention needed from Dale Curtis and Daniel Cheng

      ccameron chromium voted and added 3 comments

      Votes added by ccameron chromium

      Commit-Queue+2

      3 comments

      File media/gpu/av1_decoder.cc
      Line 126, Patchset 14: return {static_cast<float>(cll.max_cll), static_cast<float>(cll.max_fall)};
      Dale Curtis . resolved
      Gemini: Same here, designated initializers are preferred:
      ```cpp
      return {.fMaxCLL = static_cast<float>(cll.max_cll),
      .fMaxFALL = static_cast<float>(cll.max_fall)};
      ```
      ccameron chromium

      Changed to use `skhdr::ContentLightLevelInformation::MakeUint16`

      ccameron chromium

      Done

      File media/parsers/h264_parser.cc
      Line 231, Patchset 14: return {static_cast<float>(max_content_light_level),
      Dale Curtis . resolved
      Gemini: Prefer using designated initializers here for consistency and safety, as you did for MDCV in other files.
      ```cpp
      return {.fMaxCLL = static_cast<float>(max_content_light_level),
      .fMaxFALL = static_cast<float>(max_picture_average_light_level)};
      ```
      ccameron chromium

      Changed to use `skhdr::ContentLightLevelInformation::MakeUint16`

      ccameron chromium

      Done

      File third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc
      Line 860, Patchset 11: static_cast<float>(container->clli.maxCLL),
      Daniel Cheng . resolved

      Do we need to care about rounding at all here? What happened previously?

      ccameron chromium

      (see the above comment about CLLI's multiple inconsistent rounding behaviors)

      Daniel Cheng

      I guess skia should have updated by now but I'm not going to push on this and I'll leave it to you. I personally think it's harder to make sure to go back and clean things up with the way C++ works but shrug.

      ccameron chromium

      Updated to use `skhdr::ContentLightLevelInformation::MakeUint16`

      ccameron chromium

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dale Curtis
      • Daniel Cheng
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
        Gerrit-Change-Number: 7679172
        Gerrit-PatchSet: 16
        Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
        Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
        Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
        Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
        Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
        Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
        Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
        Gerrit-Comment-Date: Tue, 24 Mar 2026 17:56:25 +0000
        satisfied_requirement
        open
        diffy

        ccameron chromium (Gerrit)

        unread,
        Mar 24, 2026, 4:44:46 PM (9 days ago) Mar 24
        to ccameron chromium, Sandeep Vijayasekar, Daniel Cheng, Dale Curtis, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
        Attention needed from Daniel Cheng

        ccameron chromium voted Commit-Queue+2

        Commit-Queue+2
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Daniel Cheng
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
        Gerrit-Change-Number: 7679172
        Gerrit-PatchSet: 16
        Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
        Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
        Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
        Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
        Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
        Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
        Gerrit-Comment-Date: Tue, 24 Mar 2026 20:44:26 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        open
        diffy

        Daniel Cheng (Gerrit)

        unread,
        Mar 24, 2026, 8:05:50 PM (9 days ago) Mar 24
        to ccameron chromium, Daniel Cheng, Sandeep Vijayasekar, Dale Curtis, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
        Attention needed from ccameron chromium

        Daniel Cheng voted

        Code-Review+1
        Commit-Queue+2
        Open in Gerrit

        Related details

        Attention is currently required from:
        • ccameron chromium
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
        Gerrit-Change-Number: 7679172
        Gerrit-PatchSet: 16
        Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
        Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
        Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
        Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
        Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
        Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
        Gerrit-Comment-Date: Wed, 25 Mar 2026 00:05:39 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        open
        diffy

        Daniel Cheng (Gerrit)

        unread,
        Mar 25, 2026, 2:14:21 AM (9 days ago) Mar 25
        to ccameron chromium, Daniel Cheng, Sandeep Vijayasekar, Dale Curtis, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org
        Attention needed from ccameron chromium

        Daniel Cheng voted Commit-Queue+2

        Gerrit-Comment-Date: Wed, 25 Mar 2026 06:14:09 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        open
        diffy

        Chromium LUCI CQ (Gerrit)

        unread,
        Mar 25, 2026, 2:41:36 AM (9 days ago) Mar 25
        to ccameron chromium, Daniel Cheng, Sandeep Vijayasekar, Dale Curtis, AyeAye, chromium...@chromium.org, halliwe...@chromium.org, cblume+im...@chromium.org, ozone-...@chromium.org, media-cro...@chromium.org, blink-rev...@chromium.org, kinuko...@chromium.org, chromeos-gfx-...@google.com, blink-...@chromium.org, mac-r...@chromium.org, max+watc...@igalia.com, mbarowsky+watc...@chromium.org, nickdiego+wa...@igalia.com, cc-...@chromium.org, feature-me...@chromium.org, ipc-securi...@chromium.org, penghu...@chromium.org

        Chromium LUCI CQ submitted the change

        Change information

        Commit message:
        gfx::HDRMetadata: Use skhdr types

        The HDR metadata structures have been added to Skia (so that they can be
        communicated from Skia decoders). Remove the now-redundant gfx metadata
        structure.

        Take this opportunity to use setters and getters for the members of
        gfx::HDRMetadata. This will allow future refactoring to reduce the size
        of the structure.

        Leave the messy AGTM interface in place. It will be addressed by a
        future patch. Also leave the extended range in place, because it, too,
        will need a nontrivial clean-up.
        Bug: 395659818
        Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
        Reviewed-by: Daniel Cheng <dch...@chromium.org>
        Commit-Queue: Daniel Cheng <dch...@chromium.org>
        Reviewed-by: Dale Curtis <dalec...@chromium.org>
        Reviewed-by: Sandeep Vijayasekar <sa...@google.com>
        Cr-Commit-Position: refs/heads/main@{#1604614}
        Files:
        • M cc/paint/gpu_raster_pixeltest.cc
        • M cc/paint/tone_map_util.cc
        • M chromecast/media/cma/base/decoder_config_adapter.cc
        • M chromecast/starboard/media/renderer/chromium_starboard_conversions.cc
        • M chromecast/starboard/media/renderer/chromium_starboard_conversions_test.cc
        • M components/viz/service/display/overlay_dc_unittest.cc
        • M components/viz/service/display/skia_renderer.cc
        • M media/base/android/jni_hdr_metadata.cc
        • M media/base/media_serializers.h
        • M media/ffmpeg/ffmpeg_common.cc
        • M media/ffmpeg/ffmpeg_common_unittest.cc
        • M media/formats/mp4/box_definitions.cc
        • M media/formats/mp4/hevc.cc
        • M media/formats/mp4/mp4_stream_parser_unittest.cc
        • M media/formats/webm/webm_colour_parser.cc
        • M media/formats/webm/webm_colour_parser.h
        • M media/formats/webm/webm_stream_parser_unittest.cc
        • M media/gpu/android/media_codec_video_decoder_unittest.cc
        • M media/gpu/av1_decoder.cc
        • M media/gpu/h264_decoder.cc
        • M media/gpu/h265_decoder.cc
        • M media/gpu/mac/vt_config_util_unittest.mm
        • M media/mojo/mojom/video_decoder_config_mojom_traits_unittest.cc
        • M media/parsers/h264_parser.cc
        • M media/parsers/h264_parser.h
        • M media/parsers/h265_parser.cc
        • M media/parsers/h265_parser.h
        • M media/renderers/video_resource_updater_unittest.cc
        • M media/renderers/win/media_foundation_video_stream.cc
        • M media/video/mappable_shared_image_video_frame_pool_unittest.cc
        • M third_party/blink/renderer/core/html/canvas/predefined_color_space.cc
        • M third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc
        • M third_party/blink/renderer/platform/image-decoders/png/png_image_decoder_test.cc
        • M third_party/blink/tools/blinkpy/presubmit/audit_non_blink_usage.py
        • M ui/gfx/android/android_surface_control_compat.cc
        • M ui/gfx/hdr_metadata.cc
        • M ui/gfx/hdr_metadata.h
        • M ui/gfx/hdr_metadata_mac.mm
        • M ui/gfx/mojom/BUILD.gn
        • M ui/gfx/mojom/hdr_metadata.mojom
        • M ui/gfx/mojom/hdr_metadata_mojom_traits.cc
        • M ui/gfx/mojom/hdr_metadata_mojom_traits.h
        • M ui/gfx/mojom/mojom_traits_unittest.cc
        • M ui/gl/hdr_metadata_helper_win.cc
        • M ui/gl/swap_chain_presenter.cc
        • M ui/ozone/platform/wayland/host/wayland_wp_color_manager.cc
        Change size: XL
        Delta: 46 files changed, 569 insertions(+), 652 deletions(-)
        Branch: refs/heads/main
        Submit Requirements:
        • requirement satisfiedCode-Review: +1 by Dale Curtis, +1 by Sandeep Vijayasekar, +1 by Daniel Cheng
        Open in Gerrit
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: merged
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Iaf20d8ebb40a2d065cfa921b32b791fcd59dcc4e
        Gerrit-Change-Number: 7679172
        Gerrit-PatchSet: 17
        Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
        Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
        Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
        Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
        Gerrit-Reviewer: Sandeep Vijayasekar <sa...@google.com>
        Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
        open
        diffy
        satisfied_requirement
        Reply all
        Reply to author
        Forward
        0 new messages