Showing the changes to codec/processing/src/downsample (2 of 10 files). Show all
Unified · Split
| @@ -45,6 +45,7 @@ · 44 unmodified lines | ||
| 45 | 45 | #include "util.h" |
| 46 | 46 | #include "WelsFrameWork.h" |
| 47 | 47 | #include "IWelsVP.h" |
| 48 | +#include "macros.h" | |
| 48 | 49 | |
| 49 | 50 | WELSVP_NAMESPACE_BEGIN |
| 50 | 51 | |
| @@ -73,8 +73,8 @@ void GeneralBilinearFastDownsampler_c (uint8_t* pDst, const int32_t kiDstStride, · 72 unmodified lines | ||
| 73 | 73 | uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { |
| 74 | 74 | const uint32_t kuiScaleBitWidth = 16, kuiScaleBitHeight = 15; |
| 75 | 75 | const uint32_t kuiScaleWidth = (1 << kuiScaleBitWidth), kuiScaleHeight = (1 << kuiScaleBitHeight); |
| 76 | − int32_t fScalex = (int32_t) ((float)kiSrcWidth / (float)kiDstWidth * kuiScaleWidth); | |
| 77 | − int32_t fScaley = (int32_t) ((float)kiSrcHeight / (float)kiDstHeight * kuiScaleHeight); | |
| 76 | + int32_t fScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kuiScaleWidth); | |
| 77 | + int32_t fScaley = WELS_ROUND ((float)kiSrcHeight / (float)kiDstHeight * kuiScaleHeight); | |
| 78 | 78 | uint32_t x; |
| 79 | 79 | int32_t iYInverse, iXInverse; |
| 80 | 80 | |
| @@ -142,8 +142,8 @@ void GeneralBilinearAccurateDownsampler_c (uint8_t* pDst, const int32_t kiDstStr · 61 unmodified lines | ||
| 142 | 142 | uint8_t* pSrc, const int32_t kiSrcStride, const int32_t kiSrcWidth, const int32_t kiSrcHeight) { |
| 143 | 143 | const int32_t kiScaleBit = 15; |
| 144 | 144 | const int32_t kiScale = (1 << kiScaleBit); |
| 145 | − int32_t iScalex = (int32_t) ((float)kiSrcWidth / (float)kiDstWidth * kiScale); | |
| 146 | − int32_t iScaley = (int32_t) ((float)kiSrcHeight / (float)kiDstHeight * kiScale); | |
| 145 | + int32_t iScalex = WELS_ROUND ((float)kiSrcWidth / (float)kiDstWidth * kiScale); | |
| 146 | + int32_t iScaley = WELS_ROUND ((float)kiSrcHeight / (float)kiDstHeight * kiScale); | |
| 147 | 147 | int64_t x; |
| 148 | 148 | int32_t iYInverse, iXInverse; |
| 149 | 149 | |