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 |
+// 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; |
+ dst[i] = ((f >> 16) & 0x8000) | |
fbarchard1
2016/09/28 00:01:31
Remove ((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; |