Showing the changes to codec/processing/src/downsample/downsamplefuncs.cpp (1 of 1 file). Show all
Unified · Split
| @@ -247,58 +247,48 @@ void GeneralBilinearAccurateDownsampler_c (uint8_t* pDst, const int32_t kiDstStr · 246 unmodified lines | ||
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | − | |
| 251 | −#ifdef X86_ASM | |
| 252 | −void GeneralBilinearFastDownsamplerWrap_sse2 (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, | |
| 250 | +#if defined(X86_ASM) || defined(HAVE_NEON) || defined(HAVE_NEON_AARCH64) | |
| 251 | +static void GeneralBilinearDownsamplerWrap (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, | |
| 253 | 252 | const int32_t kiDstHeight, |
| 254 | − uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { | |
| 255 | − const int32_t kiScaleBitWidth = 16, kiScaleBitHeight = 15; | |
| 253 | + uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight, | |
| 254 | + const int32_t kiScaleBitWidth, const int32_t kiScaleBitHeight, | |
| 255 | + void (*func) (uint8_t* pDst, int32_t iDstStride, int32_t iDstWidth, int32_t iDstHeight, | |
| 256 | + uint8_t* pSrc, int32_t iSrcStride, uint32_t uiScaleX, uint32_t uiScaleY)) { | |
| 256 | 257 | const uint32_t kuiScaleWidth = (1 << kiScaleBitWidth), kuiScaleHeight = (1 << kiScaleBitHeight); |
| 257 | 258 | |
| 258 | 259 | uint32_t uiScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kuiScaleWidth); |
| 259 | 260 | uint32_t uiScaley = WELS_ROUND ((float)kiSrcHeight / (float)kiDstHeight * kuiScaleHeight); |
| 260 | 261 | |
| 261 | − GeneralBilinearFastDownsampler_sse2 (pDst, kiDstStride, kiDstWidth, kiDstHeight, | |
| 262 | − pSrc, kiSrcStride, uiScalex, uiScaley); | |
| 262 | + func (pDst, kiDstStride, kiDstWidth, kiDstHeight, pSrc, kiSrcStride, uiScalex, uiScaley); | |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | −void GeneralBilinearAccurateDownsamplerWrap_sse2 (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, | |
| 266 | − const int32_t kiDstHeight, | |
| 267 | − uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { | |
| 268 | − const int32_t kiScaleBit = 15; | |
| 269 | − const uint32_t kuiScale = (1 << kiScaleBit); | |
| 265 | +#define DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP(suffix) \ | |
| 266 | + void GeneralBilinearFastDownsamplerWrap_ ## suffix ( \ | |
| 267 | + uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, const int32_t kiDstHeight, \ | |
| 268 | + uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { \ | |
| 269 | + GeneralBilinearDownsamplerWrap (pDst, kiDstStride, kiDstWidth, kiDstHeight, \ | |
| 270 | + pSrc, kiSrcStride, kiSrcWidth, kiSrcHeight, 16, 15, GeneralBilinearFastDownsampler_ ## suffix); \ | |
| 271 | + } | |
| 270 | 272 | |
| 271 | − uint32_t uiScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kuiScale); | |
| 272 | − uint32_t uiScaley = WELS_ROUND ((float)kiSrcHeight / (float)kiDstHeight * kuiScale); | |
| 273 | +#define DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP(suffix) \ | |
| 274 | + void GeneralBilinearAccurateDownsamplerWrap_ ## suffix ( \ | |
| 275 | + uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, const int32_t kiDstHeight, \ | |
| 276 | + uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { \ | |
| 277 | + GeneralBilinearDownsamplerWrap (pDst, kiDstStride, kiDstWidth, kiDstHeight, \ | |
| 278 | + pSrc, kiSrcStride, kiSrcWidth, kiSrcHeight, 15, 15, GeneralBilinearAccurateDownsampler_ ## suffix); \ | |
| 279 | + } | |
| 280 | +#endif | |
| 273 | 281 | |
| 274 | − GeneralBilinearAccurateDownsampler_sse2 (pDst, kiDstStride, kiDstWidth, kiDstHeight, | |
| 275 | − pSrc, kiSrcStride, uiScalex, uiScaley); | |
| 276 | −} | |
| 282 | +#ifdef X86_ASM | |
| 283 | +DEFINE_GENERAL_BILINEAR_FAST_DOWNSAMPLER_WRAP (sse2) | |
| 284 | +DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP (sse2) | |
| 277 | 285 | #endif //X86_ASM |
| 278 | 286 | |
| 279 | 287 | #ifdef HAVE_NEON |
| 280 | −void GeneralBilinearAccurateDownsamplerWrap_neon (uint8_t* pDst, const int32_t kiDstStride, const int32_t kiDstWidth, | |
| 281 | − const int32_t kiDstHeight, | |
| 282 | − uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { | |
| 283 | − const int32_t kiScaleBit = 15; | |
| 284 | − const uint32_t kuiScale = (1 << kiScaleBit); | |
| 285 | − uint32_t uiScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kuiScale); | |
| 286 | − uint32_t uiScaley = WELS_ROUND ((float)kiSrcHeight / (float)kiDstHeight * kuiScale); | |
| 287 | − GeneralBilinearAccurateDownsampler_neon (pDst, kiDstStride, kiDstWidth, kiDstHeight, pSrc, kiSrcStride, uiScalex, | |
| 288 | − uiScaley); | |
| 289 | −} | |
| 288 | +DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP (neon) | |
| 290 | 289 | #endif |
| 291 | 290 | |
| 292 | 291 | #ifdef HAVE_NEON_AARCH64 |
| 293 | −void GeneralBilinearAccurateDownsamplerWrap_AArch64_neon (uint8_t* pDst, const int32_t kiDstStride, | |
| 294 | − const int32_t kiDstWidth, const int32_t kiDstHeight, | |
| 295 | − uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { | |
| 296 | − const int32_t kiScaleBit = 15; | |
| 297 | − const uint32_t kuiScale = (1 << kiScaleBit); | |
| 298 | − uint32_t uiScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kuiScale); | |
| 299 | − uint32_t uiScaley = WELS_ROUND ((float)kiSrcHeight / (float)kiDstHeight * kuiScale); | |
| 300 | − GeneralBilinearAccurateDownsampler_AArch64_neon (pDst, kiDstStride, kiDstWidth, kiDstHeight, pSrc, kiSrcStride, | |
| 301 | − uiScalex, uiScaley); | |
| 302 | −} | |
| 292 | +DEFINE_GENERAL_BILINEAR_ACCURATE_DOWNSAMPLER_WRAP (AArch64_neon) | |
| 303 | 293 | #endif |
| 304 | 294 | WELSVP_NAMESPACE_END |