aboutsummaryrefslogtreecommitdiff
path: root/source/scale_common.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2023-01-04 14:27:04 -0800
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-01-04 23:11:52 +0000
commit6e4b0acb4b3d5858c77a044aad46132998ac4a76 (patch)
tree311527482deeaa517aee2c01e8f004e63ca3c602 /source/scale_common.cc
parentf8626a72248f7063c9bf3bbe96333a4af6e8b36f (diff)
downloadlibyuv-6e4b0acb4b3d5858c77a044aad46132998ac4a76.tar.gz
I422Rotate take stride for temporary buffers
- Minor variable name changes first/last to top/bottom - Comments explaining rotate temporary buffers usage - Add asserts for scale parameter - Use NULL and stddef.h instead of 0 - Use void * for allocation in row.h - Add () around size parameter in macros Bug: libyuv:926, libyuv:949 Change-Id: Ib55417570926ccada0a0f8abd1753dc12e5b162e Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4136762 Reviewed-by: Wan-Teh Chang <wtc@google.com> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/scale_common.cc')
-rw-r--r--source/scale_common.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/scale_common.cc b/source/scale_common.cc
index 398f3f65..55749a2e 100644
--- a/source/scale_common.cc
+++ b/source/scale_common.cc
@@ -145,6 +145,8 @@ void ScaleRowDown2Linear_16To8_C(const uint16_t* src_ptr,
const uint16_t* s = src_ptr;
int x;
(void)src_stride;
+ assert(scale >= 256);
+ assert(scale <= 32768);
for (x = 0; x < dst_width - 1; x += 2) {
dst[0] = STATIC_CAST(uint8_t, C16TO8((s[0] + s[1] + 1) >> 1, scale));
dst[1] = STATIC_CAST(uint8_t, C16TO8((s[2] + s[3] + 1) >> 1, scale));
@@ -226,6 +228,8 @@ void ScaleRowDown2Box_16To8_C(const uint16_t* src_ptr,
const uint16_t* s = src_ptr;
const uint16_t* t = src_ptr + src_stride;
int x;
+ assert(scale >= 256);
+ assert(scale <= 32768);
for (x = 0; x < dst_width - 1; x += 2) {
dst[0] = STATIC_CAST(uint8_t,
C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
@@ -1550,7 +1554,7 @@ void ScalePlaneVertical(int src_height,
enum FilterMode filtering) {
// TODO(fbarchard): Allow higher bpp.
int dst_width_bytes = dst_width * bpp;
- void (*InterpolateRow)(uint8_t * dst_argb, const uint8_t* src_argb,
+ void (*InterpolateRow)(uint8_t* dst_argb, const uint8_t* src_argb,
ptrdiff_t src_stride, int dst_width,
int source_y_fraction) = InterpolateRow_C;
const int max_y = (src_height > 1) ? ((src_height - 1) << 16) - 1 : 0;
@@ -1629,7 +1633,7 @@ void ScalePlaneVertical_16(int src_height,
enum FilterMode filtering) {
// TODO(fbarchard): Allow higher wpp.
int dst_width_words = dst_width * wpp;
- void (*InterpolateRow)(uint16_t * dst_argb, const uint16_t* src_argb,
+ void (*InterpolateRow)(uint16_t* dst_argb, const uint16_t* src_argb,
ptrdiff_t src_stride, int dst_width,
int source_y_fraction) = InterpolateRow_16_C;
const int max_y = (src_height > 1) ? ((src_height - 1) << 16) - 1 : 0;
@@ -1708,7 +1712,7 @@ void ScalePlaneVertical_16To8(int src_height,
// TODO(fbarchard): Allow higher wpp.
int dst_width_words = dst_width * wpp;
// TODO(https://crbug.com/libyuv/931): Add NEON 32 bit and AVX2 versions.
- void (*InterpolateRow_16To8)(uint8_t * dst_argb, const uint16_t* src_argb,
+ void (*InterpolateRow_16To8)(uint8_t* dst_argb, const uint16_t* src_argb,
ptrdiff_t src_stride, int scale, int dst_width,
int source_y_fraction) = InterpolateRow_16To8_C;
const int max_y = (src_height > 1) ? ((src_height - 1) << 16) - 1 : 0;