Unified · Split
| @@ -834,17 +834,12 @@ WELS_ASM_FUNC_END · 833 unmodified lines | ||
| 834 | 834 | |
| 835 | 835 | |
| 836 | 836 | WELS_ASM_FUNC_BEGIN WelsNonZeroCount_neon |
| 837 | − | |
| 838 | − vld1.64 {d0-d2}, [r0] | |
| 839 | − | |
| 840 | − vceq.s8 q0, q0, #0 | |
| 841 | − vceq.s8 d2, d2, #0 | |
| 842 | − vmvn q0, q0 | |
| 843 | − vmvn d2, d2 | |
| 844 | − vabs.s8 q0, q0 | |
| 845 | − vabs.s8 d2, d2 | |
| 846 | − | |
| 847 | − vst1.64 {d0-d2}, [r0] | |
| 837 | + mov r1, #1 | |
| 838 | + vdup.8 q2, r1 | |
| 839 | + vld1.64 {d0,d1,d2}, [r0] | |
| 840 | + vmin.s8 q0, q0, q2 | |
| 841 | + vmin.s8 d2, d2, d4 | |
| 842 | + vst1.64 {d0,d1,d2}, [r0] | |
| 848 | 843 | WELS_ASM_FUNC_END |
| 849 | 844 | |
| 850 | 845 | #ifdef __APPLE__ |
| @@ -553,16 +553,12 @@ bs_mv_check_jump1: · 552 unmodified lines | ||
| 553 | 553 | #endif |
| 554 | 554 | |
| 555 | 555 | WELS_ASM_AARCH64_FUNC_BEGIN WelsNonZeroCount_AArch64_neon |
| 556 | + mov w1, #1 | |
| 557 | + dup v3.8b, w1 | |
| 556 | 558 | ld1 {v0.8b, v1.8b, v2.8b}, [x0] |
| 557 | − ins v0.d[1], v1.d[0] | |
| 558 | − uzp1 v0.2d, v0.2d, v1.2d | |
| 559 | − cmeq v0.16b, v0.16b, #0 | |
| 560 | − cmeq v2.8b, v2.8b, #0 | |
| 561 | − mvn v0.16b, v0.16b | |
| 562 | − mvn v2.8b, v2.8b | |
| 563 | − abs v0.16b, v0.16b | |
| 564 | − abs v2.8b, v2.8b | |
| 565 | − ins v1.d[0], v0.d[1] | |
| 559 | + umin v0.8b, v0.8b, v3.8b | |
| 560 | + umin v1.8b, v1.8b, v3.8b | |
| 561 | + umin v2.8b, v2.8b, v3.8b | |
| 566 | 562 | st1 {v0.8b, v1.8b, v2.8b}, [x0] |
| 567 | 563 | WELS_ASM_AARCH64_FUNC_END |
| 568 | 564 | |
| @@ -15,6 +15,8 @@ void DeblockChromaLt4H_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int · 14 unmodified lines | ||
| 15 | 15 | int8_t* pTc); |
| 16 | 16 | void DeblockChromaEq4H_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta); |
| 17 | 17 | |
| 18 | +void WelsNonZeroCount_c (int8_t* pNonZeroCount); | |
| 19 | + | |
| 18 | 20 | #if defined(__cplusplus) |
| 19 | 21 | extern "C" { |
| 20 | 22 | #endif//__cplusplus |
| @@ -32,6 +34,7 @@ void DeblockChromaLt4V_ssse3 (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, · 11 unmodified lines | ||
| 32 | 34 | void DeblockChromaEq4H_ssse3 (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta); |
| 33 | 35 | void DeblockChromaLt4H_ssse3 (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta, |
| 34 | 36 | int8_t* pTC); |
| 37 | +void WelsNonZeroCount_sse2 (int8_t* pNonZeroCount); | |
| 35 | 38 | #endif |
| 36 | 39 | |
| 37 | 40 | #if defined(HAVE_NEON) |
| @@ -48,6 +51,7 @@ void DeblockChromaEq4V_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, · 10 unmodified lines | ||
| 48 | 51 | void DeblockChromaLt4H_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta, |
| 49 | 52 | int8_t* pTC); |
| 50 | 53 | void DeblockChromaEq4H_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta); |
| 54 | +void WelsNonZeroCount_neon (int8_t* pNonZeroCount); | |
| 51 | 55 | #endif |
| 52 | 56 | |
| 53 | 57 | #if defined(HAVE_NEON_AARCH64) |
| @@ -61,6 +65,7 @@ void DeblockChromaEq4V_AArch64_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t i · 7 unmodified lines | ||
| 61 | 65 | void DeblockChromaLt4H_AArch64_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta, |
| 62 | 66 | int8_t* pTC); |
| 63 | 67 | void DeblockChromaEq4H_AArch64_neon (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int32_t iAlpha, int32_t iBeta); |
| 68 | +void WelsNonZeroCount_AArch64_neon (int8_t* pNonZeroCount); | |
| 64 | 69 | #endif |
| 65 | 70 | #if defined(__cplusplus) |
| 66 | 71 | } |
| @@ -180,6 +180,13 @@ void DeblockChromaEq4H_c (uint8_t* pPixCb, uint8_t* pPixCr, int32_t iStride, int · 179 unmodified lines | ||
| 180 | 180 | DeblockChromaEq4_c (pPixCb, pPixCr, 1, iStride, iAlpha, iBeta); |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | +void WelsNonZeroCount_c (int8_t* pNonZeroCount) { | |
| 184 | + int32_t i; | |
| 185 | + for (i = 0; i < 24; i++) { | |
| 186 | + pNonZeroCount[i] = !!pNonZeroCount[i]; | |
| 187 | + } | |
| 188 | +} | |
| 189 | + | |
| 183 | 190 | #ifdef X86_ASM |
| 184 | 191 | extern "C" { |
| 185 | 192 | void DeblockLumaLt4H_ssse3 (uint8_t* pPixY, int32_t iStride, int32_t iAlpha, int32_t iBeta, int8_t* pTc) { |
| @@ -5276,3 +5276,14 @@ WELS_EXTERN DeblockLumaTransposeV2H_sse2 · 5275 unmodified lines | ||
| 5276 | 5276 | pop r3 |
| 5277 | 5277 | ret |
| 5278 | 5278 | |
| 5279 | +WELS_EXTERN WelsNonZeroCount_sse2 | |
| 5280 | + %assign push_num 0 | |
| 5281 | + LOAD_1_PARA | |
| 5282 | + movdqu xmm0, [r0] | |
| 5283 | + movq xmm1, [r0+16] | |
| 5284 | + WELS_DB1 xmm2 | |
| 5285 | + pminub xmm0, xmm2 | |
| 5286 | + pminub xmm1, xmm2 | |
| 5287 | + movdqu [r0], xmm0 | |
| 5288 | + movq [r0+16], xmm1 | |
| 5289 | + ret | |
| @@ -99,18 +99,6 @@ · 98 unmodified lines | ||
| 99 | 99 | // } |
| 100 | 100 | .endm |
| 101 | 101 | #endif |
| 102 | −// r0 int8_t* non_zero_count, | |
| 103 | −WELS_ASM_FUNC_BEGIN SetNonZeroCount_neon | |
| 104 | − vld1.64 {d0-d2}, [r0] | |
| 105 | − vceq.s8 q0, q0, #0 | |
| 106 | − vceq.s8 d2, d2, #0 | |
| 107 | − vmvn q0, q0 | |
| 108 | − vmvn d2, d2 | |
| 109 | − vabs.s8 q0, q0 | |
| 110 | − vabs.s8 d2, d2 | |
| 111 | − vst1.64 {d0-d2}, [r0] | |
| 112 | −WELS_ASM_FUNC_END | |
| 113 | − | |
| 114 | 102 | |
| 115 | 103 | // uint8_t *pred, const int32_t stride, int16_t *rs |
| 116 | 104 | WELS_ASM_FUNC_BEGIN IdctResAddPred_neon |
| @@ -100,20 +100,6 @@ · 99 unmodified lines | ||
| 100 | 100 | // } |
| 101 | 101 | .endm |
| 102 | 102 | #endif |
| 103 | −// x0 int8_t* non_zero_count, | |
| 104 | −WELS_ASM_AARCH64_FUNC_BEGIN SetNonZeroCount_AArch64_neon | |
| 105 | − mov x1, x0 | |
| 106 | − ld1 {v0.16b}, [x1], #16 | |
| 107 | − ld1 {v1.8b}, [x1] | |
| 108 | − cmeq v0.16b, v0.16b, #0 | |
| 109 | − cmeq v1.8b, v1.8b, #0 | |
| 110 | − mvn v0.16b, v0.16b | |
| 111 | − mvn v1.8b, v1.8b | |
| 112 | − abs v0.16b, v0.16b | |
| 113 | − abs v1.8b, v1.8b | |
| 114 | − st1 {v0.16b}, [x0], #16 | |
| 115 | − st1 {v1.8b}, [x0] | |
| 116 | −WELS_ASM_AARCH64_FUNC_END | |
| 117 | 103 | |
| 118 | 104 | // uint8_t *pred, const int32_t stride, int16_t *rs |
| 119 | 105 | WELS_ASM_AARCH64_FUNC_BEGIN IdctResAddPred_AArch64_neon |
| @@ -73,13 +73,11 @@ void WelsBlockZero8x8_sse2(int16_t * block, int32_t stride); · 72 unmodified lines | ||
| 73 | 73 | #endif |
| 74 | 74 | |
| 75 | 75 | #if defined(HAVE_NEON) |
| 76 | −void SetNonZeroCount_neon (int8_t* pNonZeroCount); | |
| 77 | 76 | void WelsBlockZero16x16_neon(int16_t * block, int32_t stride); |
| 78 | 77 | void WelsBlockZero8x8_neon(int16_t * block, int32_t stride); |
| 79 | 78 | #endif |
| 80 | 79 | |
| 81 | 80 | #if defined(HAVE_NEON_AARCH64) |
| 82 | −void SetNonZeroCount_AArch64_neon (int8_t* pNonZeroCount); | |
| 83 | 81 | void WelsBlockZero16x16_AArch64_neon(int16_t * block, int32_t stride); |
| 84 | 82 | void WelsBlockZero8x8_AArch64_neon(int16_t * block, int32_t stride); |
| 85 | 83 | #endif |
| @@ -87,8 +85,6 @@ void WelsBlockZero8x8_AArch64_neon(int16_t * block, int32_t stride); · 1 unmodified line | ||
| 87 | 85 | } |
| 88 | 86 | #endif//__cplusplus |
| 89 | 87 | |
| 90 | −void SetNonZeroCount_c (int8_t* pNonZeroCount); | |
| 91 | − | |
| 92 | 88 | void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu); |
| 93 | 89 | void WelsBlockZero16x16_c(int16_t * block, int32_t stride); |
| 94 | 90 | void WelsBlockZero8x8_c(int16_t * block, int32_t stride); |
| @@ -1690,25 +1690,13 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 1689 unmodified lines | ||
| 1690 | 1690 | } |
| 1691 | 1691 | |
| 1692 | 1692 | void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) { |
| 1693 | − pFunc->pWelsSetNonZeroCountFunc = SetNonZeroCount_c; | |
| 1694 | − | |
| 1695 | −#ifdef HAVE_NEON | |
| 1696 | − if (iCpu & WELS_CPU_NEON) { | |
| 1697 | − pFunc->pWelsSetNonZeroCountFunc = SetNonZeroCount_neon; | |
| 1698 | − } | |
| 1699 | −#endif | |
| 1700 | − | |
| 1701 | −#ifdef HAVE_NEON_AARCH64 | |
| 1702 | − if (iCpu & WELS_CPU_NEON) { | |
| 1703 | − pFunc->pWelsSetNonZeroCountFunc = SetNonZeroCount_AArch64_neon; | |
| 1704 | − } | |
| 1705 | −#endif | |
| 1706 | − | |
| 1693 | + pFunc->pWelsSetNonZeroCountFunc = WelsNonZeroCount_c; | |
| 1707 | 1694 | pFunc->pWelsBlockZero16x16Func = WelsBlockZero16x16_c; |
| 1708 | − pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_c; | |
| 1709 | − //TO DO add neon and X86 | |
| 1695 | + pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_c; | |
| 1696 | + | |
| 1710 | 1697 | #ifdef HAVE_NEON |
| 1711 | 1698 | if (iCpu & WELS_CPU_NEON) { |
| 1699 | + pFunc->pWelsSetNonZeroCountFunc = WelsNonZeroCount_neon; | |
| 1712 | 1700 | pFunc->pWelsBlockZero16x16Func = WelsBlockZero16x16_neon; |
| 1713 | 1701 | pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_neon; |
| 1714 | 1702 | } |
| @@ -1716,6 +1704,7 @@ void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) { · 1 unmodified line | ||
| 1716 | 1704 | |
| 1717 | 1705 | #ifdef HAVE_NEON_AARCH64 |
| 1718 | 1706 | if (iCpu & WELS_CPU_NEON) { |
| 1707 | + pFunc->pWelsSetNonZeroCountFunc = WelsNonZeroCount_AArch64_neon; | |
| 1719 | 1708 | pFunc->pWelsBlockZero16x16Func = WelsBlockZero16x16_AArch64_neon; |
| 1720 | 1709 | pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_AArch64_neon; |
| 1721 | 1710 | } |
| @@ -1723,6 +1712,7 @@ void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) { · 1 unmodified line | ||
| 1723 | 1712 | |
| 1724 | 1713 | #if defined(X86_ASM) |
| 1725 | 1714 | if (iCpu & WELS_CPU_SSE2) { |
| 1715 | + pFunc->pWelsSetNonZeroCountFunc = WelsNonZeroCount_sse2; | |
| 1726 | 1716 | pFunc->pWelsBlockZero16x16Func = WelsBlockZero16x16_sse2; |
| 1727 | 1717 | pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_sse2; |
| 1728 | 1718 | } |
| @@ -1730,14 +1720,6 @@ void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) { · 1 unmodified line | ||
| 1730 | 1720 | |
| 1731 | 1721 | } |
| 1732 | 1722 | |
| 1733 | −void SetNonZeroCount_c (int8_t* pNonZeroCount) { | |
| 1734 | − int32_t i; | |
| 1735 | − | |
| 1736 | − for (i = 0; i < 24; i++) { | |
| 1737 | − pNonZeroCount[i] = !!pNonZeroCount[i]; | |
| 1738 | − } | |
| 1739 | −} | |
| 1740 | − | |
| 1741 | 1723 | void WelsBlockInit (int16_t* pBlock, int iW, int iH, int iStride, uint8_t uiVal) { |
| 1742 | 1724 | int32_t i; |
| 1743 | 1725 | int16_t* pDst = pBlock; |
| @@ -65,12 +65,10 @@ typedef struct TagDeblockingFilter { · 64 unmodified lines | ||
| 65 | 65 | extern "C" { |
| 66 | 66 | #endif//__cplusplus |
| 67 | 67 | #if defined(HAVE_NEON) |
| 68 | −void WelsNonZeroCount_neon (int8_t* pNonZeroCount); | |
| 69 | 68 | void DeblockingBSCalcEnc_neon (int8_t* pNzc, SMVUnitXY* pMv, int32_t iBoundryFlag, int32_t iMbStride, |
| 70 | 69 | uint8_t (*pBS)[4][4]); |
| 71 | 70 | #endif |
| 72 | 71 | #if defined(HAVE_NEON_AARCH64) |
| 73 | −void WelsNonZeroCount_AArch64_neon (int8_t* pNonZeroCount); | |
| 74 | 72 | void DeblockingBSCalcEnc_AArch64_neon (int8_t* pNzc, SMVUnitXY* pMv, int32_t iBoundryFlag, int32_t iMbStride, |
| 75 | 73 | uint8_t (*pBS)[4][4]); |
| 76 | 74 | #endif |
| @@ -79,7 +77,6 @@ void DeblockingBSCalcEnc_AArch64_neon (int8_t* pNzc, SMVUnitXY* pMv, int32_t iBo · 2 unmodified lines | ||
| 79 | 77 | #endif//__cplusplus |
| 80 | 78 | void DeblockingInit (DeblockingFunc* pFunc, int32_t iCpu); |
| 81 | 79 | |
| 82 | −void WelsNonZeroCount_c (int8_t* pNonZeroCount); | |
| 83 | 80 | void WelsBlockFuncInit (PSetNoneZeroCountZeroFunc* pfSetNZCZero, int32_t iCpu); |
| 84 | 81 | |
| 85 | 82 | void PerformDeblockingFilter (sWelsEncCtx* pEnc); |
| @@ -774,13 +774,6 @@ void PerformDeblockingFilter (sWelsEncCtx* pEnc) { · 773 unmodified lines | ||
| 774 | 774 | } |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | −void WelsNonZeroCount_c (int8_t* pNonZeroCount) { | |
| 778 | − int32_t i; | |
| 779 | − | |
| 780 | − for (i = 0; i < 24; i++) { | |
| 781 | − pNonZeroCount[i] = !!pNonZeroCount[i]; | |
| 782 | − } | |
| 783 | −} | |
| 784 | 777 | void WelsBlockFuncInit (PSetNoneZeroCountZeroFunc* pfSetNZCZero, int32_t iCpu) { |
| 785 | 778 | *pfSetNZCZero = WelsNonZeroCount_c; |
| 786 | 779 | #ifdef HAVE_NEON |
| @@ -793,6 +786,11 @@ void WelsBlockFuncInit (PSetNoneZeroCountZeroFunc* pfSetNZCZero, int32_t iCpu) · 6 unmodified lines | ||
| 793 | 786 | *pfSetNZCZero = WelsNonZeroCount_AArch64_neon; |
| 794 | 787 | } |
| 795 | 788 | #endif |
| 789 | +#if defined(X86_ASM) | |
| 790 | + if (iCpu & WELS_CPU_SSE2) { | |
| 791 | + *pfSetNZCZero = WelsNonZeroCount_sse2; | |
| 792 | + } | |
| 793 | +#endif | |
| 796 | 794 | } |
| 797 | 795 | |
| 798 | 796 | void DeblockingInit (DeblockingFunc* pFunc, int32_t iCpu) { |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | #include <gtest/gtest.h> |
| 2 | 2 | #include "macros.h" |
| 3 | 3 | #include "decode_mb_aux.h" |
| 4 | −#include "../../codec/decoder/core/src/decode_slice.cpp" | |
| 4 | +#include "deblocking.h" | |
| 5 | 5 | using namespace WelsDec; |
| 6 | 6 | void IdctResAddPred_ref (uint8_t* pPred, const int32_t kiStride, int16_t* pRs) { |
| 7 | 7 | int16_t iSrc[16]; |
| @@ -98,7 +98,7 @@ TEST(DecoderDecodeMbAux, method) \ · 90 unmodified lines | ||
| 98 | 98 | {\ |
| 99 | 99 | int8_t iNonZeroCount[2][24];\ |
| 100 | 100 | for(int32_t i = 0; i < 24; i++) {\ |
| 101 | − iNonZeroCount[0][i] = iNonZeroCount[1][i] = (rand() % 256)-128;\ | |
| 101 | + iNonZeroCount[0][i] = iNonZeroCount[1][i] = (rand() % 25);\ | |
| 102 | 102 | }\ |
| 103 | 103 | method(iNonZeroCount[0]);\ |
| 104 | 104 | SetNonZeroCount_ref(iNonZeroCount[1]);\ |
| @@ -106,7 +106,7 @@ TEST(DecoderDecodeMbAux, method) \ · 1 unmodified line | ||
| 106 | 106 | ASSERT_EQ (iNonZeroCount[0][i], iNonZeroCount[1][i]);\ |
| 107 | 107 | }\ |
| 108 | 108 | for(int32_t i =0; i<24; i++) {\ |
| 109 | − iNonZeroCount[0][i] = iNonZeroCount[1][i] = -128;\ | |
| 109 | + iNonZeroCount[0][i] = iNonZeroCount[1][i] = 0;\ | |
| 110 | 110 | }\ |
| 111 | 111 | method(iNonZeroCount[0]);\ |
| 112 | 112 | SetNonZeroCount_ref(iNonZeroCount[1]);\ |
| @@ -114,7 +114,7 @@ TEST(DecoderDecodeMbAux, method) \ · 1 unmodified line | ||
| 114 | 114 | ASSERT_EQ (iNonZeroCount[0][i], iNonZeroCount[1][i]);\ |
| 115 | 115 | }\ |
| 116 | 116 | for(int32_t i =0; i<24; i++) {\ |
| 117 | − iNonZeroCount[0][i] = iNonZeroCount[1][i] = 127;\ | |
| 117 | + iNonZeroCount[0][i] = iNonZeroCount[1][i] = 16;\ | |
| 118 | 118 | }\ |
| 119 | 119 | method(iNonZeroCount[0]);\ |
| 120 | 120 | SetNonZeroCount_ref(iNonZeroCount[1]);\ |
| @@ -123,12 +123,16 @@ TEST(DecoderDecodeMbAux, method) \ · 2 unmodified lines | ||
| 123 | 123 | }\ |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | −GENERATE_SETNONZEROCOUNT (SetNonZeroCount_c) | |
| 126 | +GENERATE_SETNONZEROCOUNT (WelsNonZeroCount_c) | |
| 127 | + | |
| 128 | +#if defined(X86_ASM) | |
| 129 | +GENERATE_SETNONZEROCOUNT (WelsNonZeroCount_sse2) | |
| 130 | +#endif | |
| 127 | 131 | |
| 128 | 132 | #if defined(HAVE_NEON) |
| 129 | −GENERATE_SETNONZEROCOUNT (SetNonZeroCount_neon) | |
| 133 | +GENERATE_SETNONZEROCOUNT (WelsNonZeroCount_neon) | |
| 130 | 134 | #endif |
| 131 | 135 | |
| 132 | 136 | #if defined(HAVE_NEON_AARCH64) |
| 133 | −GENERATE_SETNONZEROCOUNT (SetNonZeroCount_AArch64_neon) | |
| 137 | +GENERATE_SETNONZEROCOUNT (WelsNonZeroCount_AArch64_neon) | |
| 134 | 138 | #endif |