aboutsummaryrefslogtreecommitdiff
path: root/source/scale.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2021-10-14 13:06:54 -0700
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2021-10-14 20:37:39 +0000
commit11cbf8f976a41ccb279dc67489832ea9f12d56d7 (patch)
tree07e2ffa24eaadc89eb70feb18de8d039de60b214 /source/scale.cc
parentdaf9778a24a138cf7578b1ddf70ca867c2882c2c (diff)
downloadlibyuv-11cbf8f976a41ccb279dc67489832ea9f12d56d7.tar.gz
Add LIBYUV_BIT_EXACT macro to force C to match SIMD
- C code use ARM path, so NEON and C match - C used on Intel platforms, disabling AVX. Bug: libyuv:908, b/202888439 Change-Id: Ie035a150a60d3cf4ee7c849a96819d43640cf020 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3223507 Commit-Queue: Frank Barchard <fbarchard@chromium.org> Reviewed-by: richard winterton <rrwinterton@gmail.com>
Diffstat (limited to 'source/scale.cc')
-rw-r--r--source/scale.cc38
1 files changed, 19 insertions, 19 deletions
diff --git a/source/scale.cc b/source/scale.cc
index 03b0486f..cda10e2b 100644
--- a/source/scale.cc
+++ b/source/scale.cc
@@ -911,7 +911,7 @@ static void ScalePlaneBox(int src_width,
for (j = 0; j < dst_height; ++j) {
int boxheight;
int iy = y >> 16;
- const uint8_t* src = src_ptr + iy * src_stride;
+ const uint8_t* src = src_ptr + iy * (int64_t)src_stride;
y += dy;
if (y > max_y) {
y = max_y;
@@ -970,7 +970,7 @@ static void ScalePlaneBox_16(int src_width,
for (j = 0; j < dst_height; ++j) {
int boxheight;
int iy = y >> 16;
- const uint16_t* src = src_ptr + iy * src_stride;
+ const uint16_t* src = src_ptr + iy * (int64_t)src_stride;
y += dy;
if (y > max_y) {
y = max_y;
@@ -1087,7 +1087,7 @@ void ScalePlaneBilinearDown(int src_width,
for (j = 0; j < dst_height; ++j) {
int yi = y >> 16;
- const uint8_t* src = src_ptr + yi * src_stride;
+ const uint8_t* src = src_ptr + yi * (int64_t)src_stride;
if (filtering == kFilterLinear) {
ScaleFilterCols(dst_ptr, src, dst_width, x, dx);
} else {
@@ -1178,7 +1178,7 @@ void ScalePlaneBilinearDown_16(int src_width,
for (j = 0; j < dst_height; ++j) {
int yi = y >> 16;
- const uint16_t* src = src_ptr + yi * src_stride;
+ const uint16_t* src = src_ptr + yi * (int64_t)src_stride;
if (filtering == kFilterLinear) {
ScaleFilterCols(dst_ptr, src, dst_width, x, dx);
} else {
@@ -1290,7 +1290,7 @@ void ScalePlaneBilinearUp(int src_width,
}
{
int yi = y >> 16;
- const uint8_t* src = src_ptr + yi * src_stride;
+ const uint8_t* src = src_ptr + yi * (int64_t)src_stride;
// Allocate 2 row buffers.
const int kRowSize = (dst_width + 31) & ~31;
@@ -1313,7 +1313,7 @@ void ScalePlaneBilinearUp(int src_width,
if (y > max_y) {
y = max_y;
yi = y >> 16;
- src = src_ptr + yi * src_stride;
+ src = src_ptr + yi * (int64_t)src_stride;
}
if (yi != lasty) {
ScaleFilterCols(rowptr, src, dst_width, x, dx);
@@ -1383,13 +1383,13 @@ void ScalePlaneUp2_Linear(int src_width,
#endif
if (dst_height == 1) {
- ScaleRowUp(src_ptr + ((src_height - 1) / 2) * src_stride, dst_ptr,
+ ScaleRowUp(src_ptr + ((src_height - 1) / 2) * (int64_t)src_stride, dst_ptr,
dst_width);
} else {
dy = FixedDiv(src_height - 1, dst_height - 1);
y = (1 << 15) - 1;
for (i = 0; i < dst_height; ++i) {
- ScaleRowUp(src_ptr + (y >> 16) * src_stride, dst_ptr, dst_width);
+ ScaleRowUp(src_ptr + (y >> 16) * (int64_t)src_stride, dst_ptr, dst_width);
dst_ptr += dst_stride;
y += dy;
}
@@ -1496,13 +1496,13 @@ void ScalePlaneUp2_12_Linear(int src_width,
#endif
if (dst_height == 1) {
- ScaleRowUp(src_ptr + ((src_height - 1) / 2) * src_stride, dst_ptr,
+ ScaleRowUp(src_ptr + ((src_height - 1) / 2) * (int64_t)src_stride, dst_ptr,
dst_width);
} else {
dy = FixedDiv(src_height - 1, dst_height - 1);
y = (1 << 15) - 1;
for (i = 0; i < dst_height; ++i) {
- ScaleRowUp(src_ptr + (y >> 16) * src_stride, dst_ptr, dst_width);
+ ScaleRowUp(src_ptr + (y >> 16) * (int64_t)src_stride, dst_ptr, dst_width);
dst_ptr += dst_stride;
y += dy;
}
@@ -1597,13 +1597,13 @@ void ScalePlaneUp2_16_Linear(int src_width,
#endif
if (dst_height == 1) {
- ScaleRowUp(src_ptr + ((src_height - 1) / 2) * src_stride, dst_ptr,
+ ScaleRowUp(src_ptr + ((src_height - 1) / 2) * (int64_t)src_stride, dst_ptr,
dst_width);
} else {
dy = FixedDiv(src_height - 1, dst_height - 1);
y = (1 << 15) - 1;
for (i = 0; i < dst_height; ++i) {
- ScaleRowUp(src_ptr + (y >> 16) * src_stride, dst_ptr, dst_width);
+ ScaleRowUp(src_ptr + (y >> 16) * (int64_t)src_stride, dst_ptr, dst_width);
dst_ptr += dst_stride;
y += dy;
}
@@ -1743,7 +1743,7 @@ void ScalePlaneBilinearUp_16(int src_width,
}
{
int yi = y >> 16;
- const uint16_t* src = src_ptr + yi * src_stride;
+ const uint16_t* src = src_ptr + yi * (int64_t)src_stride;
// Allocate 2 row buffers.
const int kRowSize = (dst_width + 31) & ~31;
@@ -1766,7 +1766,7 @@ void ScalePlaneBilinearUp_16(int src_width,
if (y > max_y) {
y = max_y;
yi = y >> 16;
- src = src_ptr + yi * src_stride;
+ src = src_ptr + yi * (int64_t)src_stride;
}
if (yi != lasty) {
ScaleFilterCols(rowptr, src, dst_width, x, dx);
@@ -1829,7 +1829,7 @@ static void ScalePlaneSimple(int src_width,
}
for (i = 0; i < dst_height; ++i) {
- ScaleCols(dst_ptr, src_ptr + (y >> 16) * src_stride, dst_width, x, dx);
+ ScaleCols(dst_ptr, src_ptr + (y >> 16) * (int64_t)src_stride, dst_width, x, dx);
dst_ptr += dst_stride;
y += dy;
}
@@ -1870,7 +1870,7 @@ static void ScalePlaneSimple_16(int src_width,
}
for (i = 0; i < dst_height; ++i) {
- ScaleCols(dst_ptr, src_ptr + (y >> 16) * src_stride, dst_width, x, dx);
+ ScaleCols(dst_ptr, src_ptr + (y >> 16) * (int64_t)src_stride, dst_width, x, dx);
dst_ptr += dst_stride;
y += dy;
}
@@ -1896,7 +1896,7 @@ void ScalePlane(const uint8_t* src,
// Negative height means invert the image.
if (src_height < 0) {
src_height = -src_height;
- src = src + (src_height - 1) * src_stride;
+ src = src + (src_height - 1) * (int64_t)src_stride;
src_stride = -src_stride;
}
@@ -1990,7 +1990,7 @@ void ScalePlane_16(const uint16_t* src,
// Negative height means invert the image.
if (src_height < 0) {
src_height = -src_height;
- src = src + (src_height - 1) * src_stride;
+ src = src + (src_height - 1) * (int64_t)src_stride;
src_stride = -src_stride;
}
@@ -2084,7 +2084,7 @@ void ScalePlane_12(const uint16_t* src,
// Negative height means invert the image.
if (src_height < 0) {
src_height = -src_height;
- src = src + (src_height - 1) * src_stride;
+ src = src + (src_height - 1) * (int64_t)src_stride;
src_stride = -src_stride;
}