Revert of More robust check for sRGB gamma tables (patchset #2 id:60001 of https://codereview.chromium.org/2263233003/ )
Reason for revert: From the previous commit message: "This check is not fast. If we find that it doesn't help us recognize sRGB curves, we should delete it." Turns out it doesn't help. Looks to me like the tables are not sRGB. Original issue's description: > More robust check for sRGB gamma tables > > This is in response to a UMA showing that 5% dst gammas are > unidentified tables. We want to see if some of these tables > should be marked as sRGB. > https://uma.googleplex.com/p/chrome/histograms?endDate=latest&dayCount=1&histograms=Blink.ColorSpace.Destination&fixupData=true&showMax=true&filters=isofficial%2Ceq%2CTrue&implicitFilters=isofficial > > This check is not fast. If we find that it doesn't help > us recognize sRGB curves, we should delete it. > > BUG=skia:5656 > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2263233003 > > Committed: https://skia.googlesource.com/skia/+/4ff08df15a8042cdb4fc90a82e1044847d0de300 TBR=mtklein@google.com,brianosman@google.com # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=skia:5656 Review-Url: https://codereview.chromium.org/2315863003
This commit is contained in:
parent
221722b7f9
commit
e54f4b7cf3
@ -262,14 +262,6 @@ static float read_big_endian_16_dot_16(const uint8_t buf[4]) {
|
||||
return SkFixedToFloat(read_big_endian_i32(buf));
|
||||
}
|
||||
|
||||
static inline float srgb_fn(float x) {
|
||||
if (x <= 0.04045f) {
|
||||
return x * (1.0f / 12.92f);
|
||||
}
|
||||
|
||||
return powf(x * (1.0f / 1.055f) + (0.055f / 1.055f), 2.4f);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param outData Set to the appropriate value on success. If we have table or
|
||||
* parametric gamma, it is the responsibility of the caller to set
|
||||
@ -378,35 +370,9 @@ static SkGammas::Type parse_gamma(SkGammas::Data* outData, SkGammas::Params* out
|
||||
}
|
||||
}
|
||||
|
||||
// Perform a more robust check for sRGB. See if the table is a close
|
||||
// match to an sRGB table. This is in addition to the previous sRGB
|
||||
// checks for a couple reasons:
|
||||
// (1) It is much slower.
|
||||
// (2) The 26 entry "sRGB" curve is actually so inaccurate that it fails
|
||||
// this check. But it still wants to be sRGB.
|
||||
float x = 0.0f;
|
||||
float dx = 1.0f / ((float) (count - 1));
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
float y = srgb_fn(x);
|
||||
|
||||
// Convert y to the same format as the table (0.16 fixed point), so we can
|
||||
// compare values.
|
||||
uint16_t srgbY = sk_float_round2int(y * (float) (1 << 16));
|
||||
uint16_t actualY = read_big_endian_u16((const uint8_t*) &table[i]);
|
||||
|
||||
// We allow "off by 1" curves to try to not be affected by rounding decisions.
|
||||
if (SkTAbs((int32_t) srgbY - (int32_t) actualY) > 1) {
|
||||
// Curve is not sRGB, will use table representation.
|
||||
outData->fTable.fSize = count;
|
||||
return SkGammas::Type::kTable_Type;
|
||||
}
|
||||
|
||||
x += dx;
|
||||
}
|
||||
|
||||
outData->fNamed = SkColorSpace::kSRGB_GammaNamed;
|
||||
return SkGammas::Type::kNamed_Type;
|
||||
|
||||
// Otherwise, we will represent gamma with a table.
|
||||
outData->fTable.fSize = count;
|
||||
return SkGammas::Type::kTable_Type;
|
||||
}
|
||||
case kTAG_ParaCurveType: {
|
||||
enum ParaCurveType {
|
||||
|
Loading…
Reference in New Issue
Block a user