aboutsummaryrefslogtreecommitdiff
path: root/source/scale.cc
diff options
context:
space:
mode:
authorWan-Teh Chang <wtc@google.com>2023-05-20 16:18:10 -0700
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-05-22 19:10:13 +0000
commitdcbe0820709c274beb4624588d1aa14b25557d62 (patch)
tree4e267ce77d3ab003be570d0175f796e27cad7df2 /source/scale.cc
parentde3e7fd14728d923d0bdc8e3aca06c8a61f014ce (diff)
downloadlibyuv-dcbe0820709c274beb4624588d1aa14b25557d62.tar.gz
Save boxwidth - minboxwidth in a local variable
Avoid repetitions of the expression boxwidth - minboxwidth. Change-Id: Ib53fb6b06a926b80ff9a64cc5d499aeef0894c99 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4408062 Commit-Queue: Frank Barchard <fbarchard@chromium.org> Reviewed-by: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/scale.cc')
-rw-r--r--source/scale.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/scale.cc b/source/scale.cc
index 90abaefe..591a6a93 100644
--- a/source/scale.cc
+++ b/source/scale.cc
@@ -820,9 +820,10 @@ static void ScaleAddCols2_C(int dst_width,
int ix = x >> 16;
x += dx;
boxwidth = MIN1((x >> 16) - ix);
- assert(((boxwidth - minboxwidth) == 0) || ((boxwidth - minboxwidth) == 1));
+ int scaletbl_index = boxwidth - minboxwidth;
+ assert((scaletbl_index == 0) || (scaletbl_index == 1));
*dst_ptr++ = (uint8_t)(SumPixels(boxwidth, src_ptr + ix) *
- scaletbl[boxwidth - minboxwidth] >>
+ scaletbl[scaletbl_index] >>
16);
}
}
@@ -843,10 +844,10 @@ static void ScaleAddCols2_16_C(int dst_width,
int ix = x >> 16;
x += dx;
boxwidth = MIN1((x >> 16) - ix);
- assert(((boxwidth - minboxwidth) == 0) || ((boxwidth - minboxwidth) == 1));
- *dst_ptr++ = SumPixels_16(boxwidth, src_ptr + ix) *
- scaletbl[boxwidth - minboxwidth] >>
- 16;
+ int scaletbl_index = boxwidth - minboxwidth;
+ assert((scaletbl_index == 0) || (scaletbl_index == 1));
+ *dst_ptr++ =
+ SumPixels_16(boxwidth, src_ptr + ix) * scaletbl[scaletbl_index] >> 16;
}
}