call skcms_OptimizeForSpeed()

I've guarded src and dst separately, so that we can land,
rebaseline just the src change, and then later (when it
does something), rebaseline optimizing dst separately.

Small threshold tweak to keep a unit test passing.

Change-Id: I57cc43c54b6065f58fa8f9448ea1d73fc42505f0
Reviewed-on: https://skia-review.googlesource.com/123181
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
Mike Klein 2018-04-23 15:39:21 -04:00 committed by Skia Commit-Bot
parent 98e18970c4
commit 3b8feb331a
2 changed files with 11 additions and 4 deletions

View File

@ -19,6 +19,14 @@ public:
, fDstProfile(dstProfile)
, fPremulFormat(premulFormat) {
skcms_EnsureUsableAsDestination(&fDstProfile, &skcms_sRGB_profile);
#ifndef SK_DONT_OPTIMIZE_SRC_PROFILES_FOR_SPEED
skcms_OptimizeForSpeed(&fSrcProfile);
#endif
#ifndef SK_DONT_OPTIMIZE_DST_PROFILES_FOR_SPEED
// (This doesn't do anything yet, but we'd sure like it to.)
skcms_OptimizeForSpeed(&fDstProfile);
#endif
}
bool apply(ColorFormat, void*, ColorFormat, const void*, int, SkAlphaType) const override;

View File

@ -1126,10 +1126,6 @@ static sk_sp<SkImage> create_picture_image(sk_sp<SkColorSpace> space) {
nullptr, nullptr, SkImage::BitDepth::kU8, std::move(space));
};
static inline bool almost_equal(int a, int b) {
return SkTAbs(a - b) <= 1;
}
DEF_TEST(Image_ColorSpace, r) {
sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB();
sk_sp<SkImage> image = GetResourceAsImage("images/mandrill_512_q075.jpg");
@ -1177,6 +1173,9 @@ DEF_TEST(Image_makeColorSpace, r) {
sk_sp<SkImage> p3Image = srgbImage->makeColorSpace(p3, SkTransferFunctionBehavior::kIgnore);
SkBitmap p3Bitmap;
bool success = p3Image->asLegacyBitmap(&p3Bitmap);
auto almost_equal = [](int a, int b) { return SkTAbs(a - b) <= 2; };
REPORTER_ASSERT(r, success);
REPORTER_ASSERT(r, almost_equal(0x28, SkGetPackedR32(*p3Bitmap.getAddr32(0, 0))));
REPORTER_ASSERT(r, almost_equal(0x40, SkGetPackedG32(*p3Bitmap.getAddr32(0, 0))));