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

Unified Diff: source/row_common.cc

Issue 2371293002: Add low level support for 12 bit 420, 422 and 444 YUV video frame conversion. (Closed)
Patch Set: Created 4 years, 3 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 | « source/planar_functions.cc ('k') | source/row_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « source/planar_functions.cc ('k') | source/row_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698