Add skia::ConvertYUVAToRGBA function [chromium/src : main]

0 views
Skip to first unread message

ccameron chromium (Gerrit)

unread,
Feb 11, 2026, 6:43:19 AM (24 hours ago) Feb 11
to ccameron chromium, Dale Curtis, Kaylee Lubick, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Dale Curtis, Kaylee Lubick and ccameron chromium

ccameron chromium voted and added 2 comments

Votes added by ccameron chromium

Commit-Queue+1

2 comments

File media/base/video_frame.h
Line 624, Patchset 11: // set based to the result of GetSkColorSpace().
ccameron chromium . unresolved

The `SkColorSpace` needs to be carried *somewhere*. I tried doing it separately, but that just ended up being messy. This also means that for RGBA video frames, the `SkPixmap` can just be used directly.

File skia/ext/rgba_to_yuva.h
Line 56, Patchset 11: const SkPixmap& dst);
ccameron chromium . unresolved

The plan for this function is:

  • If the src and dst color spaces are equal, then just use `libyuv`.
  • Add a shader version when color space conversion is needed (if that indeed turns out to be more efficient).
  • Add an option to allow treating the src and dst color spaces as equal if they're "close" (in particular, the sRGB, Rec709, and Apple-Rec709 transfer functions will be treated as the same).
Open in Gerrit

Related details

Attention is currently required from:
  • Dale Curtis
  • Kaylee Lubick
  • 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: I1ffe0be5805dd8f86d0002ba987c14e47bbf724a
Gerrit-Change-Number: 7532127
Gerrit-PatchSet: 11
Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Kaylee Lubick <kjlu...@chromium.org>
Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: Kaylee Lubick <kjlu...@chromium.org>
Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Comment-Date: Wed, 11 Feb 2026 11:43:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Kaylee Lubick (Gerrit)

unread,
Feb 11, 2026, 10:43:59 AM (20 hours ago) Feb 11
to ccameron chromium, Dale Curtis, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Dale Curtis and ccameron chromium

Kaylee Lubick added 7 comments

File skia/ext/rgba_to_yuva.cc
Line 143, Patchset 12 (Latest): case SkYUVAInfo::PlaneConfig::kUnknown:
Kaylee Lubick . unresolved

Do we also want a default case in case the planeConfig is corrupted somehow?

Line 326, Patchset 12 (Latest): DCHECK_EQ(src_pixmaps.size(), static_cast<size_t>(src_yuva_info.numPlanes()));
Kaylee Lubick . unresolved

We probably want this to be a CHECK_EQ to make sure we have enough data to read, yeah?

Line 356, Patchset 12 (Latest): ReadYUVRow(src_pixmaps, src_yuva_info, src_bit_depth, y, src_row);
Kaylee Lubick . unresolved

Can we make y a size_t too to avoid an implicit conversion? This one is safer (from inspection) so I'm less worried about it.

Line 356, Patchset 12 (Latest): ReadYUVRow(src_pixmaps, src_yuva_info, src_bit_depth, y, src_row);
Kaylee Lubick . unresolved

There's an implicit signed-to-unsigned conversion here. Can we add a cast to make that explicit and also check that we have a reasonable input for this (because we'll be doing 2^src_bit_depth later and I wouldn't want that to overflow or something)

File skia/ext/rgba_to_yuva_unittest.cc
Line 208, Patchset 12 (Latest): const float s = 1023.f / 65535.f;
Kaylee Lubick . unresolved

nit: constexpr. Here and below

Line 295, Patchset 12 (Latest):
Kaylee Lubick . unresolved

Can we add a testcase for the invalid yuva_info -> RGBA behavior?

Line 333, Patchset 12 (Latest):}
Kaylee Lubick . unresolved

Can we add a test for the invalid yuva_info -> RGBA behavior? It doesn't have to use the same structure here since the assertions will be a bit different.

Open in Gerrit

Related details

Attention is currently required from:
  • Dale Curtis
  • 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: I1ffe0be5805dd8f86d0002ba987c14e47bbf724a
Gerrit-Change-Number: 7532127
Gerrit-PatchSet: 12
Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Kaylee Lubick <kjlu...@chromium.org>
Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Comment-Date: Wed, 11 Feb 2026 15:43:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Dale Curtis (Gerrit)

unread,
Feb 11, 2026, 1:01:44 PM (18 hours ago) Feb 11
to ccameron chromium, Kaylee Lubick, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from ccameron chromium

Dale Curtis added 2 comments

File media/base/video_frame.h
Line 504, Patchset 12 (Latest): return ColorSpace().GetAsFullRangeRGB().ToSkColorSpace();
Dale Curtis . unresolved

Should this be CompatRGBColorSpace?

File skia/ext/rgba_to_yuva.h
Line 56, Patchset 11: const SkPixmap& dst);
ccameron chromium . unresolved

The plan for this function is:

  • If the src and dst color spaces are equal, then just use `libyuv`.
  • Add a shader version when color space conversion is needed (if that indeed turns out to be more efficient).
  • Add an option to allow treating the src and dst color spaces as equal if they're "close" (in particular, the sRGB, Rec709, and Apple-Rec709 transfer functions will be treated as the same).
Dale Curtis

By libyuv, you just mean CopyPlane?

Open in Gerrit

Related details

Attention is currently required from:
  • 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: I1ffe0be5805dd8f86d0002ba987c14e47bbf724a
Gerrit-Change-Number: 7532127
Gerrit-PatchSet: 12
Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Kaylee Lubick <kjlu...@chromium.org>
Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
Gerrit-Comment-Date: Wed, 11 Feb 2026 18:01:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: ccameron chromium <ccam...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

ccameron chromium (Gerrit)

unread,
Feb 11, 2026, 5:01:45 PM (14 hours ago) Feb 11
to ccameron chromium, Dale Curtis, Kaylee Lubick, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Dale Curtis and Kaylee Lubick

ccameron chromium added 10 comments

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

Thanks, updated!

File media/base/video_frame.h
Line 504, Patchset 12: return ColorSpace().GetAsFullRangeRGB().ToSkColorSpace();
Dale Curtis . unresolved

Should this be CompatRGBColorSpace?

ccameron chromium

I would add a separate `GetCompatSkColorSpace` for that. I put this next to `ColorSpace` to be emphatic about it.

File skia/ext/rgba_to_yuva.h
Line 56, Patchset 11: const SkPixmap& dst);
ccameron chromium . unresolved

The plan for this function is:

  • If the src and dst color spaces are equal, then just use `libyuv`.
  • Add a shader version when color space conversion is needed (if that indeed turns out to be more efficient).
  • Add an option to allow treating the src and dst color spaces as equal if they're "close" (in particular, the sRGB, Rec709, and Apple-Rec709 transfer functions will be treated as the same).
Dale Curtis

By libyuv, you just mean CopyPlane?

ccameron chromium

Things like `I420ToARGB`, etc.

File skia/ext/rgba_to_yuva.cc
Line 143, Patchset 12: case SkYUVAInfo::PlaneConfig::kUnknown:
Kaylee Lubick . unresolved

Do we also want a default case in case the planeConfig is corrupted somehow?

ccameron chromium

This only gets called if `SkYUVAInfo::isValid()` returns true, which requires that the plane config is not `kUnknown`. I added a testcase so we can see that it doesn't get hit.

Line 326, Patchset 12: DCHECK_EQ(src_pixmaps.size(), static_cast<size_t>(src_yuva_info.numPlanes()));
Kaylee Lubick . unresolved

We probably want this to be a CHECK_EQ to make sure we have enough data to read, yeah?

ccameron chromium

Changed this and the later ones to `CHECK`s.

Line 356, Patchset 12: ReadYUVRow(src_pixmaps, src_yuva_info, src_bit_depth, y, src_row);
Kaylee Lubick . unresolved

There's an implicit signed-to-unsigned conversion here. Can we add a cast to make that explicit and also check that we have a reasonable input for this (because we'll be doing 2^src_bit_depth later and I wouldn't want that to overflow or something)

ccameron chromium

Changed the argument to a `size_t`.

Line 356, Patchset 12: ReadYUVRow(src_pixmaps, src_yuva_info, src_bit_depth, y, src_row);
Kaylee Lubick . unresolved

Can we make y a size_t too to avoid an implicit conversion? This one is safer (from inspection) so I'm less worried about it.

ccameron chromium

Changed `w` and `h` to `size_t`.

File skia/ext/rgba_to_yuva_unittest.cc
Line 208, Patchset 12: const float s = 1023.f / 65535.f;
Kaylee Lubick . resolved

nit: constexpr. Here and below

ccameron chromium

Done

Line 295, Patchset 12:
Kaylee Lubick . resolved

Can we add a testcase for the invalid yuva_info -> RGBA behavior?

ccameron chromium

Added a test.

Kaylee Lubick . unresolved

Can we add a test for the invalid yuva_info -> RGBA behavior? It doesn't have to use the same structure here since the assertions will be a bit different.

ccameron chromium

(I was able to add it in the same structure).

Open in Gerrit

Related details

Attention is currently required from:
  • Dale Curtis
  • Kaylee Lubick
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: I1ffe0be5805dd8f86d0002ba987c14e47bbf724a
Gerrit-Change-Number: 7532127
Gerrit-PatchSet: 13
Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Kaylee Lubick <kjlu...@chromium.org>
Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: Kaylee Lubick <kjlu...@chromium.org>
Gerrit-Attention: Dale Curtis <dalec...@chromium.org>
Gerrit-Comment-Date: Wed, 11 Feb 2026 22:01:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Kaylee Lubick <kjlu...@chromium.org>
Comment-In-Reply-To: ccameron chromium <ccam...@chromium.org>
Comment-In-Reply-To: Dale Curtis <dalec...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Dale Curtis (Gerrit)

unread,
Feb 11, 2026, 5:59:31 PM (13 hours ago) Feb 11
to ccameron chromium, Kaylee Lubick, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from Kaylee Lubick and ccameron chromium

Dale Curtis added 2 comments

File media/base/video_frame.h
Line 504, Patchset 12: return ColorSpace().GetAsFullRangeRGB().ToSkColorSpace();
Dale Curtis . unresolved

Should this be CompatRGBColorSpace?

ccameron chromium

I would add a separate `GetCompatSkColorSpace` for that. I put this next to `ColorSpace` to be emphatic about it.

Dale Curtis

I think this needs a bit more commentary on when to use it then, since it's not obvious even to me when you'd want to use Compat versus this one.

File skia/ext/rgba_to_yuva.h
Line 56, Patchset 11: const SkPixmap& dst);
ccameron chromium . unresolved

The plan for this function is:

  • If the src and dst color spaces are equal, then just use `libyuv`.
  • Add a shader version when color space conversion is needed (if that indeed turns out to be more efficient).
  • Add an option to allow treating the src and dst color spaces as equal if they're "close" (in particular, the sRGB, Rec709, and Apple-Rec709 transfer functions will be treated as the same).
Dale Curtis

By libyuv, you just mean CopyPlane?

ccameron chromium

Things like `I420ToARGB`, etc.

Dale Curtis

Ah, I guess you meant in cases where primary, transfer are the same. You'd still need to make sure you choose the right matrix to give to libyuv then.

I was thinking you'd instead figure out how to write a SIMD optimized version using the Skia matrices though, so we don't end up with slightly different color spaces coming out on occasion.

Open in Gerrit

Related details

Attention is currently required from:
  • Kaylee Lubick
  • 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: I1ffe0be5805dd8f86d0002ba987c14e47bbf724a
Gerrit-Change-Number: 7532127
Gerrit-PatchSet: 13
Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
Gerrit-Reviewer: Kaylee Lubick <kjlu...@chromium.org>
Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
Gerrit-Attention: Kaylee Lubick <kjlu...@chromium.org>
Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
Gerrit-Comment-Date: Wed, 11 Feb 2026 22:59:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Kaylee Lubick (Gerrit)

unread,
Feb 11, 2026, 6:03:40 PM (13 hours ago) Feb 11
to ccameron chromium, Dale Curtis, Chromium LUCI CQ, chromium...@chromium.org, Rijubrata Bhaumik, chfreme...@chromium.org, feature-me...@chromium.org, jophba...@chromium.org, mfoltz+wa...@chromium.org
Attention needed from ccameron chromium

Kaylee Lubick voted and added 5 comments

Votes added by Kaylee Lubick

Code-Review+1

5 comments

File skia/ext/rgba_to_yuva.cc
Line 143, Patchset 12: case SkYUVAInfo::PlaneConfig::kUnknown:
Kaylee Lubick . resolved

Do we also want a default case in case the planeConfig is corrupted somehow?

ccameron chromium

This only gets called if `SkYUVAInfo::isValid()` returns true, which requires that the plane config is not `kUnknown`. I added a testcase so we can see that it doesn't get hit.

Kaylee Lubick

Acknowledged

Line 326, Patchset 12: DCHECK_EQ(src_pixmaps.size(), static_cast<size_t>(src_yuva_info.numPlanes()));
Kaylee Lubick . resolved

We probably want this to be a CHECK_EQ to make sure we have enough data to read, yeah?

ccameron chromium

Changed this and the later ones to `CHECK`s.

Kaylee Lubick

Acknowledged

Line 356, Patchset 12: ReadYUVRow(src_pixmaps, src_yuva_info, src_bit_depth, y, src_row);
Kaylee Lubick . resolved

Can we make y a size_t too to avoid an implicit conversion? This one is safer (from inspection) so I'm less worried about it.

ccameron chromium

Changed `w` and `h` to `size_t`.

Kaylee Lubick

Acknowledged

Line 356, Patchset 12: ReadYUVRow(src_pixmaps, src_yuva_info, src_bit_depth, y, src_row);
Kaylee Lubick . resolved

There's an implicit signed-to-unsigned conversion here. Can we add a cast to make that explicit and also check that we have a reasonable input for this (because we'll be doing 2^src_bit_depth later and I wouldn't want that to overflow or something)

ccameron chromium

Changed the argument to a `size_t`.

Kaylee Lubick

Acknowledged

File skia/ext/rgba_to_yuva_unittest.cc
Line 333, Patchset 12:}
Kaylee Lubick . resolved

Can we add a test for the invalid yuva_info -> RGBA behavior? It doesn't have to use the same structure here since the assertions will be a bit different.

ccameron chromium

(I was able to add it in the same structure).

Kaylee Lubick

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • 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: I1ffe0be5805dd8f86d0002ba987c14e47bbf724a
    Gerrit-Change-Number: 7532127
    Gerrit-PatchSet: 13
    Gerrit-Owner: ccameron chromium <ccam...@chromium.org>
    Gerrit-Reviewer: Dale Curtis <dalec...@chromium.org>
    Gerrit-Reviewer: Kaylee Lubick <kjlu...@chromium.org>
    Gerrit-Reviewer: ccameron chromium <ccam...@chromium.org>
    Gerrit-CC: Rijubrata Bhaumik <rijubrat...@intel.com>
    Gerrit-Attention: ccameron chromium <ccam...@chromium.org>
    Gerrit-Comment-Date: Wed, 11 Feb 2026 23:03:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages