diff options
author | Mike Klein <mtklein@chromium.org> | 2017-04-17 19:32:05 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-19 17:43:58 +0000 |
commit | 44375176c06f00682518a03d4983554ca8fb5b6a (patch) | |
tree | 553fc077c2060173f3022e9831978f23704bd2b6 /tests | |
parent | 8f2911f8407b5e151768690ed40ecedde6cd7ad8 (diff) |
jumper, parametric_{r,g,b,a}
I've tried a couple of ideas for approx_powf():
1) accumulate integer powers of x, then 4th roots, then 16th roots
2) continue 1) all the way to 256th roots
3) decompose into pow2 and log2, exploiting IEEE float layout
4) slightly tune constants used in 3)
5) accumulate integer powers of x, then 3+4) with different tuning
6) follow a source online, basically 5 with finesse
7) a new source quoting and improving on the method in 6).
7) seems perfect, enough that maybe we can explore improving its speed
at cost of precision. Might be nice to get rid of those divides. If we
allow a small tolerance (2-5) in our tests, we could use the very simple
fast forms from 3) (e.g. PS 5). I wish I had some images to look at!
Anything involving roots seems to be subverted by poor rsqrt precision.
This change of course affects the pipelines created by the tests for
exponential and full parametric gamma curves. What's less obvious is
that it also means SkJumper can now for the first time run the pipeline
created by the mixed gamma curves test. This means we now need to relax
our tolerance for the table-based channel, just like we did when
implementing table_{r,g,b,a}.
This took me an embarassingly long time to figure out. *face palm*
Change-Id: I451ee3c970a0a4a4e285f8aa8f6ef709a654d247
Reviewed-on: https://skia-review.googlesource.com/13656
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ColorSpaceXformTest.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/ColorSpaceXformTest.cpp b/tests/ColorSpaceXformTest.cpp index 81fdc37caf..83317d95e4 100644 --- a/tests/ColorSpaceXformTest.cpp +++ b/tests/ColorSpaceXformTest.cpp @@ -252,6 +252,9 @@ DEF_TEST(ColorSpaceXform_NonMatchingGamma, r) { gammas->fType[0] = SkGammas::Type::kValue_Type; gammas->fData[0].fValue = 1.2f; + // See ColorSpaceXform_TableGamma... we've decided to allow some tolerance + // for SkJumper's implementation of tables. + const int tolerance = 12; gammas->fType[1] = SkGammas::Type::kTable_Type; gammas->fData[1].fTable.fSize = tableSize; gammas->fData[1].fTable.fOffset = 0; @@ -260,7 +263,7 @@ DEF_TEST(ColorSpaceXform_NonMatchingGamma, r) { gammas->fData[2].fParamOffset = sizeof(float) * tableSize; test_identity_xform(r, gammas, true); - test_identity_xform_A2B(r, kNonStandard_SkGammaNamed, gammas); + test_identity_xform_A2B(r, kNonStandard_SkGammaNamed, gammas, tolerance); } DEF_TEST(ColorSpaceXform_A2BCLUT, r) { |