| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move Half FP16 implementations to libcore, to allow ART compiler to
optimize these methods with intrinsic implementations.
For example, on ARM64 with ARMv8.2 FP16 half registers and instructions:
- Half toFloat/toHalf can be implemented with FCVT;
- Half floor/ceil/round can be implmented with FRINT(pna);
- Half max/min can be implmented with FMIN/FMAX.
Such fast Half FP16 intrinsics can help accelerate ColorLong ARGB
encoding/decoding in Android framework.
Change-Id: I6225ebf8aa825b0394ce8f13e12db317f5c6e3fd
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This CL fixes Half.toFloat() in handling SNaN inputs,
to make sure the Java implementation has same semantics
as the hardware implementations (Arm and Intel).
1. Armv8.2 implementation (FCVT):
// tested as ART intrinsic on Pixel3
__ Fmov(h31, w1); // input: w1 register
__ Fcvt(s0, h31); // output: s0 register
2. X86 implementation (VCVTPH2PS):
// clang -mf16c test.c
float x86_toFloat(short h) {
__v8hi v = {h, 0, 0, 0, 0, 0, 0, 0};
__v4sf r = __builtin_ia32_vcvtph2ps(v);
return r[0];
}
3. Java implementation (software):
android.util.Half.toFloat(short);
Test: Exhaustive testing of 0x0..0xFFFF input bits on above three
implementations and compare output values.
Change-Id: Iff137858379bf43e59cde94c9d19c2054a3d4f93
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Half has a dependency on an internal sun.misc.FloatingDecimal
that can be replaced by an equivalent call on java.lang.Float
(which calls through to FloatingDecimal).
Any performance hit is worth it for a smaller API surface.
Bug: 111055375
Test: Build
Change-Id: Iecdf3aa9414922a77edbdc439b0c2b88033b3af8
|
| |
|
|
|
|
| |
Bug: 35765416
Test: HalfTest
Change-Id: I7ef52428f8b4e2c05b91d7eb37cc4cb5ecc5c6b9
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This class can be used to define color spaces. A color space has a color model
and a profile connection space (CIE XYZ D50). This implementation can be used
to query various properties of RGB color spaces or perform conversions between
various color spaces (RGB, XYZ and Lab).
Refer to the documentation for more details.
Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.ColorSpaceTest
Bug: 32984164
Change-Id: Ie2117c1212c1375a7d403d3c1afaf73d7c2e0b47
|
| |
|
|
|
|
|
|
|
| |
This CL has a companion CL to add the @HalfFloat annotation to the
support library.
Test: cts-tradefed run singleCommand cts-dev --module CtsUtilTestCases --test android.util.cts.HalfTest
Bug: 29940137
Change-Id: I4e1dc456687c1c026437150e9cc94a54f3264d4e
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Half floats (often called fp16) are commonly used to store floating
point data efficiently without having to use lossy compression schemes.
Half floats are commonly used in the following cases:
- Wide gamut colors
- Meshes (OpenGL and Vulkan)
- HDR images/textures
- Lookup tables as textures (OpenGL and Vulkan), particularly
in physically-based renderers
- Maching learning/compute
OpenGL and Renderscript both provide Java language APIs that accept
half floats but the platform offers no support to create fp16 values
from fp32 data. The Half class is an IEEE 754 compliant implementation
of half floats that can be used to feed OpenGL and Renderscript properly
encoded values. A comprehensive series of test is also added to CTS.
Test: cts-tradefed run singleCommand cts-dev --module CtsUtilTestCases --test android.util.cts.HalfTest
Bug: 29940137
Change-Id: I908bde7b3c6f65f7a24e0ab5652be4d16cc0358d
|
|
|
Denormals are fully supported.
This will be useful to store wide-gamut colors in a compact form
(a full RGBA color can be stored in a long using half floats for
each component).
Test: cts-tradefed run singleCommand cts-dev --module CtsUtilTestCases --test android.util.cts.HalfTest
Change-Id: I7e071edd2b66fdf6b375ce0e3e1a72ec3fb635b5
|