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

Side by Side 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, 2 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 unified diff | Download patch
« no previous file with comments | « source/planar_functions.cc ('k') | source/row_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 2325
2326 dst_argb[0] = Clamp((int32)(db)); 2326 dst_argb[0] = Clamp((int32)(db));
2327 dst_argb[1] = Clamp((int32)(dg)); 2327 dst_argb[1] = Clamp((int32)(dg));
2328 dst_argb[2] = Clamp((int32)(dr)); 2328 dst_argb[2] = Clamp((int32)(dr));
2329 dst_argb[3] = Clamp((int32)(da)); 2329 dst_argb[3] = Clamp((int32)(da));
2330 src_argb += 4; 2330 src_argb += 4;
2331 dst_argb += 4; 2331 dst_argb += 4;
2332 } 2332 }
2333 } 2333 }
2334 2334
2335 // Samples assumed to be unsigned in low 9, 10 or 12 bits. Scale factor
2336 // adjust the sample range to 0 to 1 using a float multiply.
2337 // 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.
2338 // e.g. 10 bit scale is 1.0f / 1024.0f
2339 void HalfFloatRow_C(const uint16* src, int16* dst, float scale, int width) {
2340 int i;
2341 for (i = 0; i < width; ++i) {
2342 float value = src[i] * scale;
2343 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
2344 dst[i] = ((f >> 16) & 0x8000) |
2345 ((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) |
2346 ((f >> 13) & 0x03ff);
2347 }
2348 }
2349
2335 void ARGBLumaColorTableRow_C(const uint8* src_argb, uint8* dst_argb, int width, 2350 void ARGBLumaColorTableRow_C(const uint8* src_argb, uint8* dst_argb, int width,
2336 const uint8* luma, uint32 lumacoeff) { 2351 const uint8* luma, uint32 lumacoeff) {
2337 uint32 bc = lumacoeff & 0xff; 2352 uint32 bc = lumacoeff & 0xff;
2338 uint32 gc = (lumacoeff >> 8) & 0xff; 2353 uint32 gc = (lumacoeff >> 8) & 0xff;
2339 uint32 rc = (lumacoeff >> 16) & 0xff; 2354 uint32 rc = (lumacoeff >> 16) & 0xff;
2340 2355
2341 int i; 2356 int i;
2342 for (i = 0; i < width - 1; i += 2) { 2357 for (i = 0; i < width - 1; i += 2) {
2343 // Luminance in rows, color values in columns. 2358 // Luminance in rows, color values in columns.
2344 const uint8* luma0 = ((src_argb[0] * bc + src_argb[1] * gc + 2359 const uint8* luma0 = ((src_argb[0] * bc + src_argb[1] * gc +
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2618 dst_rgb565 += twidth * 2; 2633 dst_rgb565 += twidth * 2;
2619 width -= twidth; 2634 width -= twidth;
2620 } 2635 }
2621 } 2636 }
2622 #endif 2637 #endif
2623 2638
2624 #ifdef __cplusplus 2639 #ifdef __cplusplus
2625 } // extern "C" 2640 } // extern "C"
2626 } // namespace libyuv 2641 } // namespace libyuv
2627 #endif 2642 #endif
OLDNEW
« 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