From 9456b062277d2809c97f4633c116ffa8d485afdd Mon Sep 17 00:00:00 2001 From: Wan-Teh Chang Date: Wed, 7 Oct 2026 15:21:20 -0700 Subject: [PATCH] Remove the Abs() function in source/scale_uv.cc The Abs() function is used at two places in source/scale_uv.cc as follows: src_width = Abs(src_width); However, before we reach those two places, we have rejected src_width <= 0 as invalid input. Therefore the two Abs(src_width) calls have no effects. Bug: None Change-Id: I04c48ad5d1270b9b93abb18f2b41b90ec818d5ea Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/8531148 Reviewed-by: Frank Barchard Commit-Queue: Wan-Teh Chang --- source/scale_uv.cc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/source/scale_uv.cc b/source/scale_uv.cc index 7094cd0e6..78ec765c4 100644 --- a/source/scale_uv.cc +++ b/source/scale_uv.cc @@ -51,10 +51,6 @@ extern "C" { #define HAS_SCALEPLANEVERTICAL 1 #endif -static __inline int Abs(int v) { - return v >= 0 ? v : -v; -} - #define MIN1(x) ((x) < 1 ? 1 : (x)) // ScaleUV, 1/2 @@ -1154,7 +1150,6 @@ static int ScaleUV(const uint8_t* src, } ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y, &dx, &dy); - src_width = Abs(src_width); if (clip_x) { int64_t clipf = (int64_t)(clip_x)*dx; x += (clipf & 0xffff); @@ -1312,7 +1307,6 @@ int UVScale_16(const uint16_t* src_uv, src_uv = src_uv + (src_height - 1) * (ptrdiff_t)src_stride_uv; src_stride_uv = -src_stride_uv; } - src_width = Abs(src_width); #ifdef HAS_UVCOPY if (!filtering && src_width == dst_width && (src_height % dst_height == 0)) {