aboutsummaryrefslogtreecommitdiff
path: root/source/planar_functions.cc
diff options
context:
space:
mode:
authorFrank Barchard <fbarchard@google.com>2022-04-07 11:53:03 -0700
committerlibyuv LUCI CQ <libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-07 21:06:44 +0000
commit2ad73733d93e0fc8932178e4211b3b4c36443ad1 (patch)
treee8ecd7b4bedb6cdd627a85f4dc52a53858814260 /source/planar_functions.cc
parenta77d615e1067fe5bb48444a073f7ee08fd273b8a (diff)
downloadlibyuv-2ad73733d93e0fc8932178e4211b3b4c36443ad1.tar.gz
I422Rotate update to remove name space for ios build warning
- Remove libyuv:: from within libyuv to resolve a build warning on IOS. - Check src_y parameter is not NULL if there is a dst_y parameter - Apply clang-format - Bump version Performance on Intel Skylake Xeon ARGBRotate90_Opt (795 ms) I420Rotate90_Opt (283 ms) I422Rotate90_Opt (867 ms) <-- scales and rotates I444Rotate90_Opt (565 ms) NV12Rotate90_Opt (289 ms) Performance on Pixel 4 (Cortex A76) ARGBRotate90_Opt (4208 ms) I420Rotate90_Opt (273 ms) I422Rotate90_Opt (1207 ms) I444Rotate90_Opt (718 ms) NV12Rotate90_Opt (282 ms) Bug: libyuv:926 Change-Id: I42e1b93a9595f6ed075918e91bed977dd3d23f6f Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3576778 Reviewed-by: Mirko Bonadei <mbonadei@chromium.org> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
Diffstat (limited to 'source/planar_functions.cc')
-rw-r--r--source/planar_functions.cc38
1 files changed, 27 insertions, 11 deletions
diff --git a/source/planar_functions.cc b/source/planar_functions.cc
index 9ff4afe0..a6979264 100644
--- a/source/planar_functions.cc
+++ b/source/planar_functions.cc
@@ -239,9 +239,11 @@ int I422Copy(const uint8_t* src_y,
int width,
int height) {
int halfwidth = (width + 1) >> 1;
- if (!src_u || !src_v || !dst_u || !dst_v || width <= 0 || height == 0) {
+
+ if ((!src_y && dst_y) || !src_u || !src_v || !dst_u || !dst_v || width <= 0 || height == 0) {
return -1;
}
+
// Negative height means invert the image.
if (height < 0) {
height = -height;
@@ -277,7 +279,7 @@ int I444Copy(const uint8_t* src_y,
int dst_stride_v,
int width,
int height) {
- if (!src_u || !src_v || !dst_u || !dst_v || width <= 0 || height == 0) {
+ if ((!src_y && dst_y) || !src_u || !src_v || !dst_u || !dst_v || width <= 0 || height == 0) {
return -1;
}
// Negative height means invert the image.
@@ -316,9 +318,11 @@ int I210Copy(const uint16_t* src_y,
int width,
int height) {
int halfwidth = (width + 1) >> 1;
- if (!src_u || !src_v || !dst_u || !dst_v || width <= 0 || height == 0) {
+
+ if ((!src_y && dst_y) || !src_u || !src_v || !dst_u || !dst_v || width <= 0 || height == 0) {
return -1;
}
+
// Negative height means invert the image.
if (height < 0) {
height = -height;
@@ -331,14 +335,11 @@ int I210Copy(const uint16_t* src_y,
}
if (dst_y) {
- libyuv::CopyPlane_16(src_y, src_stride_y, dst_y, dst_stride_y, width,
- height);
+ CopyPlane_16(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
}
// Copy UV planes.
- libyuv::CopyPlane_16(src_u, src_stride_u, dst_u, dst_stride_u, halfwidth,
- height);
- libyuv::CopyPlane_16(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth,
- height);
+ CopyPlane_16(src_u, src_stride_u, dst_u, dst_stride_u, halfwidth, height);
+ CopyPlane_16(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth, height);
return 0;
}
@@ -404,12 +405,13 @@ int NV12Copy(const uint8_t* src_y,
int dst_stride_uv,
int width,
int height) {
+ int halfwidth = (width + 1) >> 1;
+ int halfheight = (height + 1) >> 1;
+
if (!src_y || !dst_y || !src_uv || !dst_uv || width <= 0 || height == 0) {
return -1;
}
- int halfwidth = (width + 1) >> 1;
- int halfheight = (height + 1) >> 1;
// Negative height means invert the image.
if (height < 0) {
height = -height;
@@ -876,9 +878,11 @@ int NV21ToNV12(const uint8_t* src_y,
int height) {
int halfwidth = (width + 1) >> 1;
int halfheight = (height + 1) >> 1;
+
if (!src_vu || !dst_uv || width <= 0 || height == 0) {
return -1;
}
+
if (dst_y) {
CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
}
@@ -2218,10 +2222,12 @@ int I420Mirror(const uint8_t* src_y,
int height) {
int halfwidth = (width + 1) >> 1;
int halfheight = (height + 1) >> 1;
+
if (!src_y || !src_u || !src_v || !dst_u || !dst_v || width <= 0 ||
height == 0) {
return -1;
}
+
// Negative height means invert the image.
if (height < 0) {
height = -height;
@@ -2256,9 +2262,11 @@ int NV12Mirror(const uint8_t* src_y,
int height) {
int halfwidth = (width + 1) >> 1;
int halfheight = (height + 1) >> 1;
+
if (!src_y || !src_uv || !dst_uv || width <= 0 || height == 0) {
return -1;
}
+
// Negative height means invert the image.
if (height < 0) {
height = -height;
@@ -2557,6 +2565,7 @@ int I420Blend(const uint8_t* src_y0,
BlendPlaneRow_C;
void (*ScaleRowDown2)(const uint8_t* src_ptr, ptrdiff_t src_stride,
uint8_t* dst_ptr, int dst_width) = ScaleRowDown2Box_C;
+
if (!src_y0 || !src_u0 || !src_v0 || !src_y1 || !src_u1 || !src_v1 ||
!alpha || !dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
return -1;
@@ -3042,6 +3051,7 @@ int I420Rect(uint8_t* dst_y,
uint8_t* start_y = dst_y + y * dst_stride_y + x;
uint8_t* start_u = dst_u + (y / 2) * dst_stride_u + (x / 2);
uint8_t* start_v = dst_v + (y / 2) * dst_stride_v + (x / 2);
+
if (!dst_y || !dst_u || !dst_v || width <= 0 || height == 0 || x < 0 ||
y < 0 || value_y < 0 || value_y > 255 || value_u < 0 || value_u > 255 ||
value_v < 0 || value_v > 255) {
@@ -3955,10 +3965,12 @@ int I420Interpolate(const uint8_t* src0_y,
int interpolation) {
int halfwidth = (width + 1) >> 1;
int halfheight = (height + 1) >> 1;
+
if (!src0_y || !src0_u || !src0_v || !src1_y || !src1_u || !src1_v ||
!dst_y || !dst_u || !dst_v || width <= 0 || height == 0) {
return -1;
}
+
InterpolatePlane(src0_y, src0_stride_y, src1_y, src1_stride_y, dst_y,
dst_stride_y, width, height, interpolation);
InterpolatePlane(src0_u, src0_stride_u, src1_u, src1_stride_u, dst_u,
@@ -4860,9 +4872,11 @@ int YUY2ToNV12(const uint8_t* src_yuy2,
void (*InterpolateRow)(uint8_t * dst_ptr, const uint8_t* src_ptr,
ptrdiff_t src_stride, int dst_width,
int source_y_fraction) = InterpolateRow_C;
+
if (!src_yuy2 || !dst_y || !dst_uv || width <= 0 || height == 0) {
return -1;
}
+
// Negative height means invert the image.
if (height < 0) {
height = -height;
@@ -4992,9 +5006,11 @@ int UYVYToNV12(const uint8_t* src_uyvy,
void (*InterpolateRow)(uint8_t * dst_ptr, const uint8_t* src_ptr,
ptrdiff_t src_stride, int dst_width,
int source_y_fraction) = InterpolateRow_C;
+
if (!src_uyvy || !dst_y || !dst_uv || width <= 0 || height == 0) {
return -1;
}
+
// Negative height means invert the image.
if (height < 0) {
height = -height;