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

Unified Diff: ui/gfx/half_float.cc

Issue 2648043002: Create FP16 LUTs when needed (Closed)
Patch Set: mark all floats as floats (not doubles) Created 3 years, 11 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 | « ui/gfx/half_float.h ('k') | ui/gfx/half_float_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/half_float.cc
diff --git a/ui/gfx/half_float.cc b/ui/gfx/half_float.cc
new file mode 100644
index 0000000000000000000000000000000000000000..930d0cacce954a1882468ab18e129e2764d35186
--- /dev/null
+++ b/ui/gfx/half_float.cc
@@ -0,0 +1,16 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/half_float.h"
+
+namespace gfx {
+
+void FloatToHalfFloat(const float* input, HalfFloat* output, size_t num) {
+ for (size_t i = 0; i < num; i++) {
+ float tmp = input[i] * 1.9259299444e-34f;
+ uint32_t tmp2 = *reinterpret_cast<uint32_t*>(&tmp) + (1 << 12);
+ output[i] = (tmp2 & 0x80000000UL) >> 16 | (tmp2 >> 13);
+ }
+}
+};
« no previous file with comments | « ui/gfx/half_float.h ('k') | ui/gfx/half_float_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698