aboutsummaryrefslogtreecommitdiff
path: root/source/planar_functions.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2021-04-09 13:04:57 -0700
committerFrank Barchard <fbarchard@chromium.org>2021-04-09 20:17:55 +0000
commit287158925b0e03ea4499a18b4e08478c5781541b (patch)
tree2be2a0f3cdc0fc01bacded73ca7eb6cd1da2d6b0 /source/planar_functions.cc
parent2cd098f83b446067a999bb7ab4d856892c956cdc (diff)
downloadlibyuv-287158925b0e03ea4499a18b4e08478c5781541b.tar.gz
use width + 1 for odd width tests
Bug: libyuv:894, libyuv:898, libyuv:899 Change-Id: Ieba8eaeb8b06f0323824967776673e339b263220 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/2809701 Reviewed-by: Frank Barchard <fbarchard@chromium.org> Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
Diffstat (limited to 'source/planar_functions.cc')
-rw-r--r--source/planar_functions.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/planar_functions.cc b/source/planar_functions.cc
index adc4eefc..1fba98f0 100644
--- a/source/planar_functions.cc
+++ b/source/planar_functions.cc
@@ -1003,6 +1003,8 @@ void SplitARGBPlaneAlpha(const uint8_t* src_argb,
uint8_t* dst_b, uint8_t* dst_a, int width) =
SplitARGBRow_C;
+ assert(height > 0);
+
if (src_stride_argb == width * 4 && dst_stride_r == width &&
dst_stride_g == width && dst_stride_b == width && dst_stride_a == width) {
width *= height;
@@ -1068,6 +1070,7 @@ void SplitARGBPlaneOpaque(const uint8_t* src_argb,
int y;
void (*SplitXRGBRow)(const uint8_t* src_rgb, uint8_t* dst_r, uint8_t* dst_g,
uint8_t* dst_b, int width) = SplitXRGBRow_C;
+ assert(height > 0);
if (src_stride_argb == width * 4 && dst_stride_r == width &&
dst_stride_g == width && dst_stride_b == width) {
@@ -1131,6 +1134,7 @@ void SplitARGBPlane(const uint8_t* src_argb,
int dst_stride_a,
int width,
int height) {
+ // Negative height means invert the image.
if (height < 0) {
height = -height;
dst_r = dst_r + (height - 1) * dst_stride_r;
@@ -1171,6 +1175,8 @@ void MergeARGBPlaneAlpha(const uint8_t* src_r,
const uint8_t* src_b, const uint8_t* src_a,
uint8_t* dst_argb, int width) = MergeARGBRow_C;
+ assert(height > 0);
+
if (src_stride_r == width && src_stride_g == width && src_stride_b == width &&
src_stride_a == width && dst_stride_argb == width * 4) {
width *= height;
@@ -1229,6 +1235,8 @@ void MergeARGBPlaneOpaque(const uint8_t* src_r,
const uint8_t* src_b, uint8_t* dst_argb, int width) =
MergeXRGBRow_C;
+ assert(height > 0);
+
if (src_stride_r == width && src_stride_g == width && src_stride_b == width &&
dst_stride_argb == width * 4) {
width *= height;