try Herb's new to_srgb
This was 6-8% faster than the previous code on my Trashcan. Change-Id: I70081009e233c83226d6d302f871fb7e86cdc438 Reviewed-on: https://skia-review.googlesource.com/16986 Reviewed-by: Matt Sarett <msarett@google.com> Reviewed-by: Herb Derby <herb@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
c090c647e4
commit
f45e3d78a4
@ -125,3 +125,21 @@ public:
|
||||
}
|
||||
};
|
||||
DEF_BENCH( return (new SkRasterPipeline_2dot2); )
|
||||
|
||||
class SkRasterPipelineToSRGB : public Benchmark {
|
||||
public:
|
||||
bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; }
|
||||
const char* onGetName() override {
|
||||
return "SkRasterPipeline_to_srgb";
|
||||
}
|
||||
|
||||
void onDraw(int loops, SkCanvas*) override {
|
||||
SkRasterPipeline p;
|
||||
p.append(SkRasterPipeline::to_srgb);
|
||||
|
||||
while (loops --> 0) {
|
||||
p.run(0,N);
|
||||
}
|
||||
}
|
||||
};
|
||||
DEF_BENCH( return (new SkRasterPipelineToSRGB); )
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -621,12 +621,11 @@ STAGE(from_srgb) {
|
||||
}
|
||||
STAGE(to_srgb) {
|
||||
auto fn = [&](F l) {
|
||||
F sqrt = rcp (rsqrt(l)),
|
||||
ftrt = rsqrt(rsqrt(l));
|
||||
auto lo = l * 12.46f;
|
||||
auto hi = min(1.0f, mad(0.411192f, ftrt,
|
||||
mad(0.689206f, sqrt, -0.0988f)));
|
||||
return if_then_else(l < 0.0043f, lo, hi);
|
||||
F t = rsqrt(l);
|
||||
auto lo = l * 12.92f;
|
||||
auto hi = mad(t, mad(t, -0.0024542345f, 0.013832027f), 1.1334244f)
|
||||
* rcp(0.14513608f + t);
|
||||
return if_then_else(l < 0.00465985f, lo, hi);
|
||||
};
|
||||
r = fn(r);
|
||||
g = fn(g);
|
||||
|
Loading…
Reference in New Issue
Block a user