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

Side by Side Diff: source/row_any.cc

Issue 1995293002: Add ARGBExtractAlpha function (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Use ANY11 instead of ANY11B Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The LibYuv Project Authors. All rights reserved. 2 * Copyright 2012 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 ANY21C(NV12ToRGB565Row_Any_AVX2, NV12ToRGB565Row_AVX2, 1, 1, 2, 2, 15) 290 ANY21C(NV12ToRGB565Row_Any_AVX2, NV12ToRGB565Row_AVX2, 1, 1, 2, 2, 15)
291 #endif 291 #endif
292 #ifdef HAS_NV12TORGB565ROW_NEON 292 #ifdef HAS_NV12TORGB565ROW_NEON
293 ANY21C(NV12ToRGB565Row_Any_NEON, NV12ToRGB565Row_NEON, 1, 1, 2, 2, 7) 293 ANY21C(NV12ToRGB565Row_Any_NEON, NV12ToRGB565Row_NEON, 1, 1, 2, 2, 7)
294 #endif 294 #endif
295 #undef ANY21C 295 #undef ANY21C
296 296
297 // Any 1 to 1. 297 // Any 1 to 1.
298 #define ANY11(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \ 298 #define ANY11(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \
299 void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, int width) { \ 299 void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, int width) { \
300 SIMD_ALIGNED(uint8 temp[128 * 2]); \ 300 SIMD_ALIGNED(uint8 temp[128 * 2]); \
magjed_chromium 2016/05/25 08:19:46 What's the reason for using 128 instead of (MASK +
fbarchard1 2016/05/25 18:44:12 simplicity. they used to be the width of a single
301 memset(temp, 0, 128); /* for YUY2 and msan */ \ 301 memset(temp, 0, 128); /* for YUY2 and msan */ \
302 int r = width & MASK; \ 302 int r = width & MASK; \
303 int n = width & ~MASK; \ 303 int n = width & ~MASK; \
304 if (n > 0) { \ 304 if (n > 0) { \
305 ANY_SIMD(src_ptr, dst_ptr, n); \ 305 ANY_SIMD(src_ptr, dst_ptr, n); \
306 } \ 306 } \
307 memcpy(temp, src_ptr + (n >> UVSHIFT) * SBPP, SS(r, UVSHIFT) * SBPP); \ 307 memcpy(temp, src_ptr + (n >> UVSHIFT) * SBPP, SS(r, UVSHIFT) * SBPP); \
308 ANY_SIMD(temp, temp + 128, MASK + 1); \ 308 ANY_SIMD(temp, temp + 128, MASK + 1); \
309 memcpy(dst_ptr + n * BPP, temp + 128, r * BPP); \ 309 memcpy(dst_ptr + n * BPP, temp + 128, r * BPP); \
310 } 310 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 #endif 459 #endif
460 #ifdef HAS_ARGBATTENUATEROW_AVX2 460 #ifdef HAS_ARGBATTENUATEROW_AVX2
461 ANY11(ARGBAttenuateRow_Any_AVX2, ARGBAttenuateRow_AVX2, 0, 4, 4, 7) 461 ANY11(ARGBAttenuateRow_Any_AVX2, ARGBAttenuateRow_AVX2, 0, 4, 4, 7)
462 #endif 462 #endif
463 #ifdef HAS_ARGBUNATTENUATEROW_AVX2 463 #ifdef HAS_ARGBUNATTENUATEROW_AVX2
464 ANY11(ARGBUnattenuateRow_Any_AVX2, ARGBUnattenuateRow_AVX2, 0, 4, 4, 7) 464 ANY11(ARGBUnattenuateRow_Any_AVX2, ARGBUnattenuateRow_AVX2, 0, 4, 4, 7)
465 #endif 465 #endif
466 #ifdef HAS_ARGBATTENUATEROW_NEON 466 #ifdef HAS_ARGBATTENUATEROW_NEON
467 ANY11(ARGBAttenuateRow_Any_NEON, ARGBAttenuateRow_NEON, 0, 4, 4, 7) 467 ANY11(ARGBAttenuateRow_Any_NEON, ARGBAttenuateRow_NEON, 0, 4, 4, 7)
468 #endif 468 #endif
469 #ifdef HAS_ARGBEXTRACTALPHAROW_SSE2
470 ANY11(ARGBExtractAlphaRow_Any_SSE2, ARGBExtractAlphaRow_SSE2, 0, 4, 1, 7)
471 #endif
472 #ifdef HAS_ARGBEXTRACTALPHAROW_NEON
473 ANY11(ARGBExtractAlphaRow_Any_NEON, ARGBExtractAlphaRow_NEON, 0, 4, 1, 7)
474 #endif
469 #undef ANY11 475 #undef ANY11
470 476
471 // Any 1 to 1 with yuvconstants 477 // Any 1 to 1 with yuvconstants
472 #define ANY11C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \ 478 #define ANY11C(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \
473 void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, \ 479 void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, \
474 const struct YuvConstants* yuvconstants, int width) { \ 480 const struct YuvConstants* yuvconstants, int width) { \
475 SIMD_ALIGNED(uint8 temp[128 * 2]); \ 481 SIMD_ALIGNED(uint8 temp[128 * 2]); \
476 memset(temp, 0, 128); /* for YUY2 and msan */ \ 482 memset(temp, 0, 128); /* for YUY2 and msan */ \
477 int r = width & MASK; \ 483 int r = width & MASK; \
478 int n = width & ~MASK; \ 484 int n = width & ~MASK; \
(...skipping 30 matching lines...) Expand all
509 } \ 515 } \
510 memcpy(temp, src_ptr + (n >> UVSHIFT) * SBPP, SS(r, UVSHIFT) * SBPP); \ 516 memcpy(temp, src_ptr + (n >> UVSHIFT) * SBPP, SS(r, UVSHIFT) * SBPP); \
511 memcpy(temp + 128, dst_ptr + n * BPP, r * BPP); \ 517 memcpy(temp + 128, dst_ptr + n * BPP, r * BPP); \
512 ANY_SIMD(temp, temp + 128, MASK + 1); \ 518 ANY_SIMD(temp, temp + 128, MASK + 1); \
513 memcpy(dst_ptr + n * BPP, temp + 128, r * BPP); \ 519 memcpy(dst_ptr + n * BPP, temp + 128, r * BPP); \
514 } 520 }
515 521
516 #ifdef HAS_ARGBCOPYALPHAROW_AVX2 522 #ifdef HAS_ARGBCOPYALPHAROW_AVX2
517 ANY11B(ARGBCopyAlphaRow_Any_AVX2, ARGBCopyAlphaRow_AVX2, 0, 4, 4, 15) 523 ANY11B(ARGBCopyAlphaRow_Any_AVX2, ARGBCopyAlphaRow_AVX2, 0, 4, 4, 15)
518 #endif 524 #endif
519 #ifdef HAS_ARGBCOPYYTOALPHAROW_SSE2 525 #ifdef HAS_ARGBCOPYALPHAROW_SSE2
520 ANY11B(ARGBCopyAlphaRow_Any_SSE2, ARGBCopyAlphaRow_SSE2, 0, 4, 4, 7) 526 ANY11B(ARGBCopyAlphaRow_Any_SSE2, ARGBCopyAlphaRow_SSE2, 0, 4, 4, 7)
521 #endif 527 #endif
522 #ifdef HAS_ARGBCOPYYTOALPHAROW_AVX2 528 #ifdef HAS_ARGBCOPYYTOALPHAROW_AVX2
523 ANY11B(ARGBCopyYToAlphaRow_Any_AVX2, ARGBCopyYToAlphaRow_AVX2, 0, 1, 4, 15) 529 ANY11B(ARGBCopyYToAlphaRow_Any_AVX2, ARGBCopyYToAlphaRow_AVX2, 0, 1, 4, 15)
524 #endif 530 #endif
525 #ifdef HAS_ARGBCOPYYTOALPHAROW_SSE2 531 #ifdef HAS_ARGBCOPYYTOALPHAROW_SSE2
526 ANY11B(ARGBCopyYToAlphaRow_Any_SSE2, ARGBCopyYToAlphaRow_SSE2, 0, 1, 4, 7) 532 ANY11B(ARGBCopyYToAlphaRow_Any_SSE2, ARGBCopyYToAlphaRow_SSE2, 0, 1, 4, 7)
527 #endif 533 #endif
528 #undef ANY11B 534 #undef ANY11B
529 535
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 #endif 815 #endif
810 #ifdef HAS_UYVYTOUVROW_NEON 816 #ifdef HAS_UYVYTOUVROW_NEON
811 ANY12S(UYVYToUVRow_Any_NEON, UYVYToUVRow_NEON, 1, 4, 15) 817 ANY12S(UYVYToUVRow_Any_NEON, UYVYToUVRow_NEON, 1, 4, 15)
812 #endif 818 #endif
813 #undef ANY12S 819 #undef ANY12S
814 820
815 #ifdef __cplusplus 821 #ifdef __cplusplus
816 } // extern "C" 822 } // extern "C"
817 } // namespace libyuv 823 } // namespace libyuv
818 #endif 824 #endif
OLDNEW
« no previous file with comments | « source/planar_functions.cc ('k') | source/row_common.cc » ('j') | source/row_gcc.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698