Move asm routines to common. Delete obsolete decoder routines. Use wider routines where applicable. ~1.07x overall faster decode on a quick 720p30 4Mbps test on Haswell.
Showing the changes to codec/decoder/core/src/decoder.cpp (1 of 12 files). Show all
Unified · Split
| @@ -848,6 +848,22 @@ void InitDecFuncs (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 847 unmodified lines | |||
| 848 | DeblockingInit (&pCtx->sDeblockingFunc, uiCpuFlag); | 848 | DeblockingInit (&pCtx->sDeblockingFunc, uiCpuFlag); |
| 849 | } | 849 | } |
| 850 | 850 | ||
| 851 | namespace { | ||
| 852 | |||
| 853 | template<void pfIdctResAddPred (uint8_t* pPred, int32_t iStride, int16_t* pRs)> | ||
| 854 | void IdctFourResAddPred_ (uint8_t* pPred, int32_t iStride, int16_t* pRs, const int8_t* pNzc) { | ||
| 855 | if (pNzc[0] || pRs[0 * 16]) | ||
| 856 | pfIdctResAddPred (pPred + 0 * iStride + 0, iStride, pRs + 0 * 16); | ||
| 857 | if (pNzc[1] || pRs[1 * 16]) | ||
| 858 | pfIdctResAddPred (pPred + 0 * iStride + 4, iStride, pRs + 1 * 16); | ||
| 859 | if (pNzc[4] || pRs[2 * 16]) | ||
| 860 | pfIdctResAddPred (pPred + 4 * iStride + 0, iStride, pRs + 2 * 16); | ||
| 861 | if (pNzc[5] || pRs[3 * 16]) | ||
| 862 | pfIdctResAddPred (pPred + 4 * iStride + 4, iStride, pRs + 3 * 16); | ||
| 863 | } | ||
| 864 | |||
| 865 | } // anon ns | ||
| 866 | |||
| 851 | void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { | 867 | void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { |
| 852 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_V ] = WelsI16x16LumaPredV_c; | 868 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_V ] = WelsI16x16LumaPredV_c; |
| 853 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_H ] = WelsI16x16LumaPredH_c; | 869 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_H ] = WelsI16x16LumaPredH_c; |
| @@ -896,12 +912,14 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 42 unmodified lines | |||
| 896 | pCtx->pGetIChromaPredFunc[C_PRED_DC_128] = WelsIChromaPredDcNA_c; | 912 | pCtx->pGetIChromaPredFunc[C_PRED_DC_128] = WelsIChromaPredDcNA_c; |
| 897 | 913 | ||
| 898 | pCtx->pIdctResAddPredFunc = IdctResAddPred_c; | 914 | pCtx->pIdctResAddPredFunc = IdctResAddPred_c; |
| 915 | pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_<IdctResAddPred_c>; | ||
| 899 | 916 | ||
| 900 | pCtx->pIdctResAddPredFunc8x8 = IdctResAddPred8x8_c; | 917 | pCtx->pIdctResAddPredFunc8x8 = IdctResAddPred8x8_c; |
| 901 | 918 | ||
| 902 | #if defined(HAVE_NEON) | 919 | #if defined(HAVE_NEON) |
| 903 | if (uiCpuFlag & WELS_CPU_NEON) { | 920 | if (uiCpuFlag & WELS_CPU_NEON) { |
| 904 | pCtx->pIdctResAddPredFunc = IdctResAddPred_neon; | 921 | pCtx->pIdctResAddPredFunc = IdctResAddPred_neon; |
| 922 | pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_<IdctResAddPred_neon>; | ||
| 905 | 923 | ||
| 906 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_neon; | 924 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_neon; |
| 907 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_neon; | 925 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_neon; |
| @@ -927,6 +945,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 19 unmodified lines | |||
| 927 | #if defined(HAVE_NEON_AARCH64) | 945 | #if defined(HAVE_NEON_AARCH64) |
| 928 | if (uiCpuFlag & WELS_CPU_NEON) { | 946 | if (uiCpuFlag & WELS_CPU_NEON) { |
| 929 | pCtx->pIdctResAddPredFunc = IdctResAddPred_AArch64_neon; | 947 | pCtx->pIdctResAddPredFunc = IdctResAddPred_AArch64_neon; |
| 948 | pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_<IdctResAddPred_AArch64_neon>; | ||
| 930 | 949 | ||
| 931 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_AArch64_neon; | 950 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_AArch64_neon; |
| 932 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_AArch64_neon; | 951 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_AArch64_neon; |
| @@ -957,6 +976,7 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 24 unmodified lines | |||
| 957 | #if defined(X86_ASM) | 976 | #if defined(X86_ASM) |
| 958 | if (uiCpuFlag & WELS_CPU_MMXEXT) { | 977 | if (uiCpuFlag & WELS_CPU_MMXEXT) { |
| 959 | pCtx->pIdctResAddPredFunc = IdctResAddPred_mmx; | 978 | pCtx->pIdctResAddPredFunc = IdctResAddPred_mmx; |
| 979 | pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_<IdctResAddPred_mmx>; | ||
| 960 | 980 | ||
| 961 | ///////mmx code opt--- | 981 | ///////mmx code opt--- |
| 962 | pCtx->pGetIChromaPredFunc[C_PRED_H] = WelsDecoderIChromaPredH_mmx; | 982 | pCtx->pGetIChromaPredFunc[C_PRED_H] = WelsDecoderIChromaPredH_mmx; |
| @@ -971,7 +991,9 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 8 unmodified lines | |||
| 971 | pCtx->pGetI4x4LumaPredFunc[I4_PRED_VL ] = WelsDecoderI4x4LumaPredVL_mmx; | 991 | pCtx->pGetI4x4LumaPredFunc[I4_PRED_VL ] = WelsDecoderI4x4LumaPredVL_mmx; |
| 972 | } | 992 | } |
| 973 | if (uiCpuFlag & WELS_CPU_SSE2) { | 993 | if (uiCpuFlag & WELS_CPU_SSE2) { |
| 974 | /////////sse2 code opt--- | 994 | pCtx->pIdctResAddPredFunc = IdctResAddPred_sse2; |
| 995 | pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_sse2; | ||
| 996 | |||
| 975 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_sse2; | 997 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_DC] = WelsDecoderI16x16LumaPredDc_sse2; |
| 976 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_sse2; | 998 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_P] = WelsDecoderI16x16LumaPredPlane_sse2; |
| 977 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_H] = WelsDecoderI16x16LumaPredH_sse2; | 999 | pCtx->pGetI16x16LumaPredFunc[I16_PRED_H] = WelsDecoderI16x16LumaPredH_sse2; |
| @@ -983,6 +1005,10 @@ void InitPredFunc (PWelsDecoderContext pCtx, uint32_t uiCpuFlag) { · 5 unmodified lines | |||
| 983 | pCtx->pGetIChromaPredFunc[C_PRED_DC_T] = WelsDecoderIChromaPredDcTop_sse2; | 1005 | pCtx->pGetIChromaPredFunc[C_PRED_DC_T] = WelsDecoderIChromaPredDcTop_sse2; |
| 984 | pCtx->pGetI4x4LumaPredFunc[I4_PRED_H] = WelsDecoderI4x4LumaPredH_sse2; | 1006 | pCtx->pGetI4x4LumaPredFunc[I4_PRED_H] = WelsDecoderI4x4LumaPredH_sse2; |
| 985 | } | 1007 | } |
| 1008 | if (uiCpuFlag & WELS_CPU_AVX2) { | ||
| 1009 | pCtx->pIdctResAddPredFunc = IdctResAddPred_avx2; | ||
| 1010 | pCtx->pIdctFourResAddPredFunc = IdctFourResAddPred_avx2; | ||
| 1011 | } | ||
| 986 | #endif | 1012 | #endif |
| 987 | } | 1013 | } |
| 988 | 1014 | ||