Showing the changes to codec/processing/src/downsample (3 of 24 files). Show all
Unified · Split
| @@ -75,6 +75,16 @@ void CDownsampling::InitDownsampleFuncs (SDownsampleFuncs& sDownsampleFunc, int · 74 unmodified lines | ||
| 75 | 75 | } |
| 76 | 76 | #endif//X86_ASM |
| 77 | 77 | |
| 78 | +#if defined(HAVE_NEON) | |
| 79 | + if (iCpuFlag & WELS_CPU_NEON) { | |
| 80 | + sDownsampleFunc.pfHalfAverage[0] = DyadicBilinearDownsamplerWidthx32_neon; | |
| 81 | + sDownsampleFunc.pfHalfAverage[1] = DyadicBilinearDownsampler_neon; | |
| 82 | + sDownsampleFunc.pfHalfAverage[2] = DyadicBilinearDownsampler_neon; | |
| 83 | + sDownsampleFunc.pfHalfAverage[3] = DyadicBilinearDownsampler_neon; | |
| 84 | + sDownsampleFunc.pfGeneralRatioChroma = GeneralBilinearAccurateDownsamplerWrap_neon; | |
| 85 | + sDownsampleFunc.pfGeneralRatioLuma = GeneralBilinearAccurateDownsamplerWrap_neon; | |
| 86 | + } | |
| 87 | +#endif | |
| 78 | 88 | } |
| 79 | 89 | |
| 80 | 90 | EResult CDownsampling::Process (int32_t iType, SPixMap* pSrcPixMap, SPixMap* pDstPixMap) { |
| @@ -103,7 +103,20 @@ void GeneralBilinearAccurateDownsampler_sse2 (uint8_t* pDst, const int32_t kiDst · 102 unmodified lines | ||
| 103 | 103 | WELSVP_EXTERN_C_END |
| 104 | 104 | #endif |
| 105 | 105 | |
| 106 | +#ifdef HAVE_NEON | |
| 107 | +WELSVP_EXTERN_C_BEGIN | |
| 108 | +// iSrcWidth no limitation | |
| 109 | +HalveDownsampleFunc DyadicBilinearDownsampler_neon; | |
| 110 | +// iSrcWidth = x32 pixels | |
| 111 | +HalveDownsampleFunc DyadicBilinearDownsamplerWidthx32_neon; | |
| 112 | + | |
| 113 | +GeneralDownsampleFunc GeneralBilinearAccurateDownsamplerWrap_neon; | |
| 114 | + | |
| 115 | +void GeneralBilinearAccurateDownsampler_neon( uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, const int32_t kiDstHeight, | |
| 116 | + uint8_t* pSrc, const int32_t kiSrcStride, const uint32_t kuiScaleX, const uint32_t kuiScaleY); | |
| 106 | 117 | |
| 118 | +WELSVP_EXTERN_C_END | |
| 119 | +#endif | |
| 107 | 120 | |
| 108 | 121 | |
| 109 | 122 | class CDownsampling : public IStrategy { |
| @@ -229,4 +229,14 @@ void GeneralBilinearAccurateDownsampler_c (uint8_t* pDst, const int32_t kiDstStr · 228 unmodified lines | ||
| 229 | 229 | //} |
| 230 | 230 | #endif //X86_ASM |
| 231 | 231 | |
| 232 | +#ifdef HAVE_NEON | |
| 233 | +void GeneralBilinearAccurateDownsamplerWrap_neon(uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, const int32_t kiDstHeight, | |
| 234 | + uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { | |
| 235 | + const int32_t kiScaleBit = 15; | |
| 236 | + const uint32_t kuiScale = (1 << kiScaleBit); | |
| 237 | + uint32_t uiScalex = (uint32_t)((float)kiSrcWidth / (float)kiDstWidth * kuiScale); | |
| 238 | + uint32_t uiScaley = (uint32_t)((float)kiSrcHeight / (float)kiDstHeight * kuiScale); | |
| 239 | + GeneralBilinearAccurateDownsampler_neon(pDst, kiDstStride, kiDstWidth, kiDstHeight, pSrc, kiSrcStride, uiScalex, uiScaley); | |
| 240 | +} | |
| 241 | +#endif | |
| 232 | 242 | WELSVP_NAMESPACE_END |