Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: bench/ColorCodecBench.cpp

Issue 2339233003: Support Float32 output from SkColorSpaceXform (Closed)
Patch Set: Remove gpu changes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gm/colorspacexform.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "ColorCodecBench.h" 8 #include "ColorCodecBench.h"
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
11 #include "SkCodecPriv.h"
11 #include "SkColorSpaceXform.h" 12 #include "SkColorSpaceXform.h"
12 #include "SkCommandLineFlags.h" 13 #include "SkCommandLineFlags.h"
13 14
14 #if defined(SK_TEST_QCMS) 15 #if defined(SK_TEST_QCMS)
15 DEFINE_bool(qcms, false, "Bench qcms color conversion"); 16 DEFINE_bool(qcms, false, "Bench qcms color conversion");
16 #endif 17 #endif
17 DEFINE_bool(xform_only, false, "Only time the color xform, do not include the de code time"); 18 DEFINE_bool(xform_only, false, "Only time the color xform, do not include the de code time");
18 DEFINE_bool(srgb, false, "Convert to srgb dst space"); 19 DEFINE_bool(srgb, false, "Convert to srgb dst space");
19 DEFINE_bool(half, false, "Convert to half floats"); 20 DEFINE_bool(half, false, "Convert to half floats");
20 21
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 sk_sp<SkColorSpace> srcSpace = SkColorSpace::NewICC(fSrcData->data(), fSrcDa ta->size()); 93 sk_sp<SkColorSpace> srcSpace = SkColorSpace::NewICC(fSrcData->data(), fSrcDa ta->size());
93 if (!srcSpace) { 94 if (!srcSpace) {
94 srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); 95 srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
95 } 96 }
96 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace, fDstSpace); 97 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace, fDstSpace);
97 SkASSERT(xform); 98 SkASSERT(xform);
98 99
99 void* dst = fDst.get(); 100 void* dst = fDst.get();
100 void* src = fSrc.get(); 101 void* src = fSrc.get();
101 for (int y = 0; y < fSrcInfo.height(); y++) { 102 for (int y = 0; y < fSrcInfo.height(); y++) {
102 xform->apply(dst, (uint32_t*) src, fSrcInfo.width(), fDstInfo.colorType( ), 103 xform->apply(dst, (uint32_t*) src, fSrcInfo.width(),
103 fDstInfo.alphaType()); 104 select_xform_format(fDstInfo.colorType()), fDstInfo.alphaTy pe());
104 dst = SkTAddOffset<void>(dst, fDstInfo.minRowBytes()); 105 dst = SkTAddOffset<void>(dst, fDstInfo.minRowBytes());
105 src = SkTAddOffset<void>(src, fSrcInfo.minRowBytes()); 106 src = SkTAddOffset<void>(src, fSrcInfo.minRowBytes());
106 } 107 }
107 } 108 }
108 109
109 #if defined(SK_TEST_QCMS) 110 #if defined(SK_TEST_QCMS)
110 void ColorCodecBench::xformOnlyQCMS() { 111 void ColorCodecBench::xformOnlyQCMS() {
111 SkAutoTCallVProc<qcms_profile, qcms_profile_release> 112 SkAutoTCallVProc<qcms_profile, qcms_profile_release>
112 srcSpace(qcms_profile_from_memory(fSrcData->data(), fSrcData->size() )); 113 srcSpace(qcms_profile_from_memory(fSrcData->data(), fSrcData->size() ));
113 SkASSERT(srcSpace); 114 SkASSERT(srcSpace);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 #endif 205 #endif
205 { 206 {
206 if (FLAGS_xform_only) { 207 if (FLAGS_xform_only) {
207 this->xformOnly(); 208 this->xformOnly();
208 } else { 209 } else {
209 this->decodeAndXform(); 210 this->decodeAndXform();
210 } 211 }
211 } 212 }
212 } 213 }
213 } 214 }
OLDNEW
« no previous file with comments | « no previous file | gm/colorspacexform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698