OLD | NEW |
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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 #define ANY12(NAMEANY, ANY_SIMD, UVSHIFT, BPP, DUVSHIFT, MASK) \ | 665 #define ANY12(NAMEANY, ANY_SIMD, UVSHIFT, BPP, DUVSHIFT, MASK) \ |
666 void NAMEANY(const uint8* src_ptr, uint8* dst_u, uint8* dst_v, int width) {\ | 666 void NAMEANY(const uint8* src_ptr, uint8* dst_u, uint8* dst_v, int width) {\ |
667 SIMD_ALIGNED(uint8 temp[128 * 3]); \ | 667 SIMD_ALIGNED(uint8 temp[128 * 3]); \ |
668 memset(temp, 0, 128); /* for msan */ \ | 668 memset(temp, 0, 128); /* for msan */ \ |
669 int r = width & MASK; \ | 669 int r = width & MASK; \ |
670 int n = width & ~MASK; \ | 670 int n = width & ~MASK; \ |
671 if (n > 0) { \ | 671 if (n > 0) { \ |
672 ANY_SIMD(src_ptr, dst_u, dst_v, n); \ | 672 ANY_SIMD(src_ptr, dst_u, dst_v, n); \ |
673 } \ | 673 } \ |
674 memcpy(temp, src_ptr + (n >> UVSHIFT) * BPP, SS(r, UVSHIFT) * BPP); \ | 674 memcpy(temp, src_ptr + (n >> UVSHIFT) * BPP, SS(r, UVSHIFT) * BPP); \ |
675 if ((width & 1) && BPP == 4) { /* repeat last 4 bytes for subsampler */ \ | 675 /* repeat last 4 bytes for 422 subsampler */ \ |
| 676 if ((width & 1) && BPP == 4 && DUVSHIFT == 1) { \ |
676 memcpy(temp + SS(r, UVSHIFT) * BPP, \ | 677 memcpy(temp + SS(r, UVSHIFT) * BPP, \ |
677 temp + SS(r, UVSHIFT) * BPP - BPP, 4); \ | 678 temp + SS(r, UVSHIFT) * BPP - BPP, 4); \ |
678 } \ | 679 } \ |
| 680 /* repeat last 4 - 12 bytes for 411 subsampler */ \ |
| 681 if (((width & 1) == 1) && BPP == 4 && DUVSHIFT == 2) { \ |
| 682 memcpy(temp + SS(r, UVSHIFT) * BPP, \ |
| 683 temp + SS(r, UVSHIFT) * BPP - BPP, 4); \ |
| 684 memcpy(temp + SS(r, UVSHIFT) * BPP + 4, \ |
| 685 temp + SS(r, UVSHIFT) * BPP - BPP, 8); \ |
| 686 } \ |
| 687 if (((width & 1) == 2) && BPP == 4 && DUVSHIFT == 2) { \ |
| 688 memcpy(temp + SS(r, UVSHIFT) * BPP, \ |
| 689 temp + SS(r, UVSHIFT) * BPP - BPP * 2, 8); \ |
| 690 } \ |
| 691 if (((width & 1) == 3) && BPP == 4 && DUVSHIFT == 2) { \ |
| 692 memcpy(temp + SS(r, UVSHIFT) * BPP, \ |
| 693 temp + SS(r, UVSHIFT) * BPP - BPP, 4); \ |
| 694 } \ |
679 ANY_SIMD(temp, temp + 128, temp + 256, MASK + 1); \ | 695 ANY_SIMD(temp, temp + 128, temp + 256, MASK + 1); \ |
680 memcpy(dst_u + (n >> DUVSHIFT), temp + 128, SS(r, DUVSHIFT)); \ | 696 memcpy(dst_u + (n >> DUVSHIFT), temp + 128, SS(r, DUVSHIFT)); \ |
681 memcpy(dst_v + (n >> DUVSHIFT), temp + 256, SS(r, DUVSHIFT)); \ | 697 memcpy(dst_v + (n >> DUVSHIFT), temp + 256, SS(r, DUVSHIFT)); \ |
682 } | 698 } |
683 | 699 |
684 #ifdef HAS_SPLITUVROW_SSE2 | 700 #ifdef HAS_SPLITUVROW_SSE2 |
685 ANY12(SplitUVRow_Any_SSE2, SplitUVRow_SSE2, 0, 2, 0, 15) | 701 ANY12(SplitUVRow_Any_SSE2, SplitUVRow_SSE2, 0, 2, 0, 15) |
686 #endif | 702 #endif |
687 #ifdef HAS_SPLITUVROW_AVX2 | 703 #ifdef HAS_SPLITUVROW_AVX2 |
688 ANY12(SplitUVRow_Any_AVX2, SplitUVRow_AVX2, 0, 2, 0, 31) | 704 ANY12(SplitUVRow_Any_AVX2, SplitUVRow_AVX2, 0, 2, 0, 31) |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 #endif | 811 #endif |
796 #ifdef HAS_UYVYTOUVROW_NEON | 812 #ifdef HAS_UYVYTOUVROW_NEON |
797 ANY12S(UYVYToUVRow_Any_NEON, UYVYToUVRow_NEON, 1, 4, 15) | 813 ANY12S(UYVYToUVRow_Any_NEON, UYVYToUVRow_NEON, 1, 4, 15) |
798 #endif | 814 #endif |
799 #undef ANY12S | 815 #undef ANY12S |
800 | 816 |
801 #ifdef __cplusplus | 817 #ifdef __cplusplus |
802 } // extern "C" | 818 } // extern "C" |
803 } // namespace libyuv | 819 } // namespace libyuv |
804 #endif | 820 #endif |
OLD | NEW |