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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkOpts.h ('k') | tests/Float16Test.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkOpts.cpp
diff --git a/src/core/SkOpts.cpp b/src/core/SkOpts.cpp
index fbc4f6cd6243313a6670b8882b2807885200343c..7534ac503d8d7ad1c13d7816157c9a48e192f4d4 100644
--- a/src/core/SkOpts.cpp
+++ b/src/core/SkOpts.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkHalf.h"
#include "SkOnce.h"
#include "SkOpts.h"
@@ -20,6 +21,19 @@
#include "SkUtils_opts.h"
#include "SkXfermode_opts.h"
+namespace SK_OPTS_NS {
+ static void float_to_half(uint16_t dst[], const float src[], int n) {
+ while (n-->0) {
+ *dst++ = SkFloatToHalf(*src++);
+ }
+ }
+ static void half_to_float(float dst[], const uint16_t src[], int n) {
+ while (n-->0) {
+ *dst++ = SkHalfToFloat(*src++);
+ }
+ }
+}
+
#if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
#if defined(SK_BUILD_FOR_WIN32)
#include <intrin.h>
@@ -90,6 +104,9 @@ namespace SkOpts {
decltype(inverted_CMYK_to_RGB1) inverted_CMYK_to_RGB1 = sk_default::inverted_CMYK_to_RGB1;
decltype(inverted_CMYK_to_BGR1) inverted_CMYK_to_BGR1 = sk_default::inverted_CMYK_to_BGR1;
+ decltype(half_to_float) half_to_float = sk_default::half_to_float;
+ decltype(float_to_half) float_to_half = sk_default::float_to_half;
+
// Each Init_foo() is defined in src/opts/SkOpts_foo.cpp.
void Init_ssse3();
void Init_sse41();
« 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