skia2/bench/ColorCodecBench.h
msarett 6bdbf4412b Improve naive SkColorXform to half floats
This should give us a good baseline to explore using SkRasterPipeline.

A particular colorxform to half float drops from 425us to 282us on my desktop.

Color Xform to Half Float (HP z620)
Original                              425us
Trans16 (not 32)                      355us
Vector Trans16                        378us
Trans16 + Keep Halfs in Vector        335us
Vector Trans16 + Keep Halfs in Vector 282us
Final                                 282us

Color Xform to Half Float (Nexus 5X)
Original                              556us
Final                                 472us

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2159993003
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot

Review-Url: https://codereview.chromium.org/2159993003
2016-07-19 09:07:55 -07:00

52 lines
1.4 KiB
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef ColorCodecBench_DEFINED
#define ColorCodecBench_DEFINED
#include "Benchmark.h"
#include "SkData.h"
#include "SkImageInfo.h"
#if defined(SK_TEST_QCMS)
#include "qcms.h"
#endif
class ColorCodecBench : public Benchmark {
public:
ColorCodecBench(const char* name, sk_sp<SkData> encoded);
protected:
const char* onGetName() override;
bool isSuitableFor(Backend backend) override;
void onDraw(int n, SkCanvas* canvas) override;
void onDelayedSetup() override;
private:
void decodeAndXform();
void xformOnly();
#if !defined(GOOGLE3)
void decodeAndXformQCMS();
void xformOnlyQCMS();
#endif
SkString fName;
sk_sp<SkData> fEncoded;
SkImageInfo fSrcInfo;
SkImageInfo fDstInfo;
SkAutoMalloc fDst;
SkAutoMalloc fSrc;
sk_sp<SkColorSpace> fDstSpace;
#if defined(SK_TEST_QCMS)
SkAutoTCallVProc<qcms_profile, qcms_profile_release> fDstSpaceQCMS;
#endif
sk_sp<SkData> fSrcData;
typedef Benchmark INHERITED;
};
#endif // ColorCodecBench_DEFINED