Skip to content

Commit

Permalink
Drop support for HDR -> SDR ColorTransforms.
Browse files Browse the repository at this point in the history
They don't work anymore with SkiaRenderer, have poor power characteristics,
and haven't shown up in the wild. I.e., sites are only serving HDR content
to HDR displays.

This also fixes a compilation error with the SMPTEST2084 shader when not
using GLSL.

BUG=1023671,1015599

Change-Id: I855992d369364beb899dc145c1595d42aef3b5be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1913613
Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Reviewed-by: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714991}
  • Loading branch information
dalecurtis authored and Commit Bot committed Nov 13, 2019
1 parent f9965cd commit 647c309
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
1 change: 1 addition & 0 deletions ui/gfx/color_space.cc
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ void ColorSpace::GetRangeAdjustMatrix(SkMatrix44* matrix) const {

bool ColorSpace::ToSkYUVColorSpace(SkYUVColorSpace* out) const {
if (range_ == RangeID::FULL) {
// TODO(dalecurtis): This is probably not right for BT.2020.
*out = kJPEG_SkYUVColorSpace;
return true;
}
Expand Down
28 changes: 1 addition & 27 deletions ui/gfx/color_transform.cc
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ class ColorTransformToLinear : public ColorTransformPerChannelTransferFn {
" float v2 = v;\n"
" #endif\n";
} else {
*src << " float v2 = v\n";
*src << " " << scalar_type << " v2 = v;\n";
}
*src << " v2 = pow(max(pow(v2, 1.0 / m2) - c1, 0.0) /\n"
" (c2 - c3 * pow(v2, 1.0 / m2)), 1.0 / m1);\n"
Expand Down Expand Up @@ -874,32 +874,6 @@ void ColorTransformInternal::AppendColorSpaceToColorSpaceTransform(
ColorSpace src,
const ColorSpace& dst,
ColorTransform::Intent intent) {
if (intent == ColorTransform::Intent::INTENT_PERCEPTUAL) {
switch (src.transfer_) {
case ColorSpace::TransferID::SMPTEST2084:
if (!dst.IsHDR()) {
// We don't have an HDR display, so replace SMPTE 2084 with
// something that returns ranges more or less suitable for a normal
// display.
src.transfer_ = ColorSpace::TransferID::SMPTEST2084_NON_HDR;
}
break;

case ColorSpace::TransferID::ARIB_STD_B67:
if (!dst.IsHDR()) {
// Interpreting HLG using a gamma 2.4 works reasonably well for SDR
// displays.
src.transfer_ = ColorSpace::TransferID::GAMMA24;
}
break;

default: // Do nothing
break;
}

// TODO(hubbe): shrink gamuts here (never stretch gamuts)
}

steps_.push_back(
std::make_unique<ColorTransformMatrix>(GetRangeAdjustMatrix(src)));

Expand Down

0 comments on commit 647c309

Please sign in to comment.