[FFmpeg-devel] [PATCH 2/2] swscale/unscaled: remove redundant subtraction
Niklas Haas
ffmpeg at haasn.xyz
Tue Dec 17 16:27:41 EET 2024
From: Niklas Haas <git at haasn.dev>
tmp is already right-shifted to dst_depth, so tmp >> dst_depth is always 0.
Signed-off-by: Niklas Haas <git at haasn.dev>
Sponsored-by: Sovereign Tech Fund
---
libswscale/swscale_unscaled.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index ea6fb038bc..97a51097f2 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -2098,17 +2098,17 @@ static int packedCopyWrapper(SwsInternal *c, const uint8_t *const src[],
for (i = 0; i < height; i++) {\
const uint8_t *dither= dithers[shift-1][i&7];\
for (j = 0; j < length-7; j+=8) {\
- tmp = (bswap(src[j+0]) + dither[0])>>shift; dst[j+0] = dbswap(tmp - (tmp>>dst_depth));\
- tmp = (bswap(src[j+1]) + dither[1])>>shift; dst[j+1] = dbswap(tmp - (tmp>>dst_depth));\
- tmp = (bswap(src[j+2]) + dither[2])>>shift; dst[j+2] = dbswap(tmp - (tmp>>dst_depth));\
- tmp = (bswap(src[j+3]) + dither[3])>>shift; dst[j+3] = dbswap(tmp - (tmp>>dst_depth));\
- tmp = (bswap(src[j+4]) + dither[4])>>shift; dst[j+4] = dbswap(tmp - (tmp>>dst_depth));\
- tmp = (bswap(src[j+5]) + dither[5])>>shift; dst[j+5] = dbswap(tmp - (tmp>>dst_depth));\
- tmp = (bswap(src[j+6]) + dither[6])>>shift; dst[j+6] = dbswap(tmp - (tmp>>dst_depth));\
- tmp = (bswap(src[j+7]) + dither[7])>>shift; dst[j+7] = dbswap(tmp - (tmp>>dst_depth));\
+ dst[j+0] = dbswap((bswap(src[j+0]) + dither[0])>>shift);\
+ dst[j+1] = dbswap((bswap(src[j+1]) + dither[1])>>shift);\
+ dst[j+2] = dbswap((bswap(src[j+2]) + dither[2])>>shift);\
+ dst[j+3] = dbswap((bswap(src[j+3]) + dither[3])>>shift);\
+ dst[j+4] = dbswap((bswap(src[j+4]) + dither[4])>>shift);\
+ dst[j+5] = dbswap((bswap(src[j+5]) + dither[5])>>shift);\
+ dst[j+6] = dbswap((bswap(src[j+6]) + dither[6])>>shift);\
+ dst[j+7] = dbswap((bswap(src[j+7]) + dither[7])>>shift);\
}\
for (; j < length; j++) {\
- tmp = (bswap(src[j]) + dither[j&7])>>shift; dst[j] = dbswap(tmp - (tmp>>dst_depth));\
+ dst[j] = dbswap((bswap(src[j]) + dither[j&7])>>shift);\
}\
dst += dstStride;\
src += srcStride;\
--
2.47.0
More information about the ffmpeg-devel
mailing list