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

Side by Side Diff: src/core/SkOpts.cpp

Issue 1686543003: skeleton for float <-> half optimized procs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: bench Created 4 years, 10 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 | « src/core/SkOpts.h ('k') | tests/Float16Test.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 2015 Google Inc. 2 * Copyright 2015 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 "SkHalf.h"
8 #include "SkOnce.h" 9 #include "SkOnce.h"
9 #include "SkOpts.h" 10 #include "SkOpts.h"
10 11
11 #define SK_OPTS_NS sk_default 12 #define SK_OPTS_NS sk_default
12 #include "SkBlitMask_opts.h" 13 #include "SkBlitMask_opts.h"
13 #include "SkBlitRow_opts.h" 14 #include "SkBlitRow_opts.h"
14 #include "SkBlurImageFilter_opts.h" 15 #include "SkBlurImageFilter_opts.h"
15 #include "SkColorCubeFilter_opts.h" 16 #include "SkColorCubeFilter_opts.h"
16 #include "SkMatrix_opts.h" 17 #include "SkMatrix_opts.h"
17 #include "SkMorphologyImageFilter_opts.h" 18 #include "SkMorphologyImageFilter_opts.h"
18 #include "SkSwizzler_opts.h" 19 #include "SkSwizzler_opts.h"
19 #include "SkTextureCompressor_opts.h" 20 #include "SkTextureCompressor_opts.h"
20 #include "SkUtils_opts.h" 21 #include "SkUtils_opts.h"
21 #include "SkXfermode_opts.h" 22 #include "SkXfermode_opts.h"
22 23
24 namespace SK_OPTS_NS {
25 static void float_to_half(uint16_t dst[], const float src[], int n) {
26 while (n-->0) {
27 *dst++ = SkFloatToHalf(*src++);
28 }
29 }
30 static void half_to_float(float dst[], const uint16_t src[], int n) {
31 while (n-->0) {
32 *dst++ = SkHalfToFloat(*src++);
33 }
34 }
35 }
36
23 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) 37 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
24 #if defined(SK_BUILD_FOR_WIN32) 38 #if defined(SK_BUILD_FOR_WIN32)
25 #include <intrin.h> 39 #include <intrin.h>
26 static void cpuid (uint32_t abcd[4]) { __cpuid ((int*)abcd, 1); } 40 static void cpuid (uint32_t abcd[4]) { __cpuid ((int*)abcd, 1); }
27 static void cpuid7(uint32_t abcd[4]) { __cpuidex((int*)abcd, 7, 0); } 41 static void cpuid7(uint32_t abcd[4]) { __cpuidex((int*)abcd, 7, 0); }
28 static uint64_t xgetbv(uint32_t xcr) { return _xgetbv(xcr); } 42 static uint64_t xgetbv(uint32_t xcr) { return _xgetbv(xcr); }
29 #else 43 #else
30 #include <cpuid.h> 44 #include <cpuid.h>
31 #if !defined(__cpuid_count) // Old Mac Clang doesn't have this defined. 45 #if !defined(__cpuid_count) // Old Mac Clang doesn't have this defined.
32 #define __cpuid_count(eax, ecx, a, b, c, d) \ 46 #define __cpuid_count(eax, ecx, a, b, c, d) \
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 decltype(RGBA_to_rgbA) RGBA_to_rgbA = sk_default::RGBA_to_ rgbA; 97 decltype(RGBA_to_rgbA) RGBA_to_rgbA = sk_default::RGBA_to_ rgbA;
84 decltype(RGBA_to_bgrA) RGBA_to_bgrA = sk_default::RGBA_to_ bgrA; 98 decltype(RGBA_to_bgrA) RGBA_to_bgrA = sk_default::RGBA_to_ bgrA;
85 decltype(RGB_to_RGB1) RGB_to_RGB1 = sk_default::RGB_to_R GB1; 99 decltype(RGB_to_RGB1) RGB_to_RGB1 = sk_default::RGB_to_R GB1;
86 decltype(RGB_to_BGR1) RGB_to_BGR1 = sk_default::RGB_to_B GR1; 100 decltype(RGB_to_BGR1) RGB_to_BGR1 = sk_default::RGB_to_B GR1;
87 decltype(gray_to_RGB1) gray_to_RGB1 = sk_default::gray_to_ RGB1; 101 decltype(gray_to_RGB1) gray_to_RGB1 = sk_default::gray_to_ RGB1;
88 decltype(grayA_to_RGBA) grayA_to_RGBA = sk_default::grayA_to _RGBA; 102 decltype(grayA_to_RGBA) grayA_to_RGBA = sk_default::grayA_to _RGBA;
89 decltype(grayA_to_rgbA) grayA_to_rgbA = sk_default::grayA_to _rgbA; 103 decltype(grayA_to_rgbA) grayA_to_rgbA = sk_default::grayA_to _rgbA;
90 decltype(inverted_CMYK_to_RGB1) inverted_CMYK_to_RGB1 = sk_default::inverted _CMYK_to_RGB1; 104 decltype(inverted_CMYK_to_RGB1) inverted_CMYK_to_RGB1 = sk_default::inverted _CMYK_to_RGB1;
91 decltype(inverted_CMYK_to_BGR1) inverted_CMYK_to_BGR1 = sk_default::inverted _CMYK_to_BGR1; 105 decltype(inverted_CMYK_to_BGR1) inverted_CMYK_to_BGR1 = sk_default::inverted _CMYK_to_BGR1;
92 106
107 decltype(half_to_float) half_to_float = sk_default::half_to_float;
108 decltype(float_to_half) float_to_half = sk_default::float_to_half;
109
93 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp. 110 // Each Init_foo() is defined in src/opts/SkOpts_foo.cpp.
94 void Init_ssse3(); 111 void Init_ssse3();
95 void Init_sse41(); 112 void Init_sse41();
96 void Init_sse42() {} 113 void Init_sse42() {}
97 void Init_avx() {} 114 void Init_avx() {}
98 void Init_avx2() {} 115 void Init_avx2() {}
99 void Init_neon(); 116 void Init_neon();
100 117
101 static void init() { 118 static void init() {
102 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o r feature? 119 // TODO: Chrome's not linking _sse* opts on iOS simulator builds. Bug o r feature?
(...skipping 25 matching lines...) Expand all
128 145
129 SK_DECLARE_STATIC_ONCE(gInitOnce); 146 SK_DECLARE_STATIC_ONCE(gInitOnce);
130 void Init() { SkOnce(&gInitOnce, init); } 147 void Init() { SkOnce(&gInitOnce, init); }
131 148
132 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 149 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
133 static struct AutoInit { 150 static struct AutoInit {
134 AutoInit() { Init(); } 151 AutoInit() { Init(); }
135 } gAutoInit; 152 } gAutoInit;
136 #endif 153 #endif
137 } 154 }
OLDNEW
« no previous file with comments | « src/core/SkOpts.h ('k') | tests/Float16Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698