Also use it in the commented out sse2 version - in case it gets taken into use at some point. (It only works on 32 bit x86 at the moment.) This makes sure the scaling factors are rounded similarly to the in GeneralBilinearAccurateDownsampler_c, making sure the accelerated versions of these function return identical results to the C version.
Showing the changes to codec/processing/src/downsample/downsamplefuncs.cpp (1 of 1 file). Show all
Unified · Split
| @@ -208,8 +208,8 @@ void GeneralBilinearAccurateDownsampler_c (uint8_t* pDst, const int32_t kiDstStr · 207 unmodified lines | ||
| 208 | 208 | // const int32_t kiScaleBitWidth = 16, kiScaleBitHeight = 15; |
| 209 | 209 | // const uint32_t kuiScaleWidth = (1 << kiScaleBitWidth), kuiScaleHeight = (1 << kiScaleBitHeight); |
| 210 | 210 | // |
| 211 | −// uint32_t uiScalex = (uint32_t) ((float)kiSrcWidth / (float)kiDstWidth * kuiScaleWidth); | |
| 212 | −// uint32_t uiScaley = (uint32_t) ((float)kiSrcHeight / (float)kiDstHeight * kuiScaleHeight); | |
| 211 | +// uint32_t uiScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kuiScaleWidth); | |
| 212 | +// uint32_t uiScaley = WELS_ROUND ((float)kiSrcHeight / (float)kiDstHeight * kuiScaleHeight); | |
| 213 | 213 | // |
| 214 | 214 | // GeneralBilinearFastDownsampler_sse2 (pDst, kiDstStride, kiDstWidth, kiDstHeight, |
| 215 | 215 | // pSrc, kiSrcStride, kiSrcWidth, kiSrcHeight, uiScalex, uiScaley); |
| @@ -221,8 +221,8 @@ void GeneralBilinearAccurateDownsampler_c (uint8_t* pDst, const int32_t kiDstStr · 5 unmodified lines | ||
| 221 | 221 | // const int32_t kiScaleBit = 15; |
| 222 | 222 | // const uint32_t kuiScale = (1 << kiScaleBit); |
| 223 | 223 | // |
| 224 | −// uint32_t uiScalex = (uint32_t) ((float)kiSrcWidth / (float)kiDstWidth * kuiScale); | |
| 225 | −// uint32_t uiScaley = (uint32_t) ((float)kiSrcHeight / (float)kiDstHeight * kuiScale); | |
| 224 | +// uint32_t uiScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kuiScale); | |
| 225 | +// uint32_t uiScaley = WELS_ROUND ((float)kiSrcHeight / (float)kiDstHeight * kuiScale); | |
| 226 | 226 | // |
| 227 | 227 | // GeneralBilinearAccurateDownsampler_sse2 (pDst, kiDstStride, kiDstWidth, kiDstHeight, |
| 228 | 228 | // pSrc, kiSrcStride, kiSrcWidth, kiSrcHeight, uiScalex, uiScaley); |
| @@ -235,8 +235,8 @@ void GeneralBilinearAccurateDownsamplerWrap_neon (uint8_t* pDst, const int32_t k · 6 unmodified lines | ||
| 235 | 235 | uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { |
| 236 | 236 | const int32_t kiScaleBit = 15; |
| 237 | 237 | const uint32_t kuiScale = (1 << kiScaleBit); |
| 238 | − uint32_t uiScalex = (uint32_t) ((float)kiSrcWidth / (float)kiDstWidth * kuiScale); | |
| 239 | − uint32_t uiScaley = (uint32_t) ((float)kiSrcHeight / (float)kiDstHeight * kuiScale); | |
| 238 | + uint32_t uiScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kuiScale); | |
| 239 | + uint32_t uiScaley = WELS_ROUND ((float)kiSrcHeight / (float)kiDstHeight * kuiScale); | |
| 240 | 240 | GeneralBilinearAccurateDownsampler_neon (pDst, kiDstStride, kiDstWidth, kiDstHeight, pSrc, kiSrcStride, uiScalex, |
| 241 | 241 | uiScaley); |
| 242 | 242 | } |