Index: source/row_common.cc |
diff --git a/source/row_common.cc b/source/row_common.cc |
index aefa38c49541f02829f50cfa0ea1218883172bf7..96961d6b61f994cbfa3783da1967950b31598132 100644 |
--- a/source/row_common.cc |
+++ b/source/row_common.cc |
@@ -2332,6 +2332,21 @@ void ARGBPolynomialRow_C(const uint8* src_argb, |
} |
} |
+// Samples assumed to be unsigned in low 9, 10 or 12 bits. Scale factor |
+// adjust the sample range to 0 to 1 using a float multiply. |
+// e.g. 9 bit scale is 1.0f / 512.0f |
hubbe
2016/09/27 23:25:56
Should be 511 I think.
(and 1023 below.)
fbarchard1
2016/09/28 00:01:31
Depends on the exact range you want to map across.
|
+// e.g. 10 bit scale is 1.0f / 1024.0f |
+void HalfFloatRow_C(const uint16* src, int16* dst, float scale, int width) { |
+ int i; |
+ for (i = 0; i < width; ++i) { |
+ float value = src[i] * scale; |
+ uint32 f = *(uint32*)&value; |
hubbe
2016/09/27 23:25:56
Why not use the 2^-112 trick?
AFAIk it produces th
fbarchard1
2016/09/28 00:01:31
Acknowledged.
C code is for reference and I wante
hubbe
2016/09/28 00:41:18
Will there also be an optimized C code version for
fbarchard1
2016/09/28 00:53:40
Acknowledged.
In this version I've removed the si
|
+ dst[i] = ((f >> 16) & 0x8000) | |
+ ((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) | |
+ ((f >> 13) & 0x03ff); |
+ } |
+} |
+ |
void ARGBLumaColorTableRow_C(const uint8* src_argb, uint8* dst_argb, int width, |
const uint8* luma, uint32 lumacoeff) { |
uint32 bc = lumacoeff & 0xff; |