aboutsummaryrefslogtreecommitdiff
path: root/source/scale.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/scale.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/scale.cc')
-rw-r--r--source/scale.cc63
1 files changed, 34 insertions, 29 deletions
diff --git a/source/scale.cc b/source/scale.cc
index d5c782b8..59e29637 100644
--- a/source/scale.cc
+++ b/source/scale.cc
@@ -2137,6 +2137,7 @@ int I420Scale(const uint8_t* src_y,
int src_halfheight = SUBSAMPLE(src_height, 1, 1);
int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
int dst_halfheight = SUBSAMPLE(dst_height, 1, 1);
+
if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_u || !dst_v ||
dst_width <= 0 || dst_height <= 0) {
@@ -2174,6 +2175,7 @@ int I420Scale_16(const uint16_t* src_y,
int src_halfheight = SUBSAMPLE(src_height, 1, 1);
int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
int dst_halfheight = SUBSAMPLE(dst_height, 1, 1);
+
if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_u || !dst_v ||
dst_width <= 0 || dst_height <= 0) {
@@ -2211,6 +2213,7 @@ int I420Scale_12(const uint16_t* src_y,
int src_halfheight = SUBSAMPLE(src_height, 1, 1);
int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
int dst_halfheight = SUBSAMPLE(dst_height, 1, 1);
+
if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_u || !dst_v ||
dst_width <= 0 || dst_height <= 0) {
@@ -2348,21 +2351,22 @@ int I422Scale(const uint8_t* src_y,
int dst_stride_v,
int dst_width,
int dst_height,
- enum libyuv::FilterMode filtering) {
+ enum FilterMode filtering) {
+ int src_halfwidth = SUBSAMPLE(src_width, 1, 1);
+ int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
+
if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_u || !dst_v ||
dst_width <= 0 || dst_height <= 0) {
return -1;
}
- int src_halfwidth = SUBSAMPLE(src_width, 1, 1);
- int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
- libyuv::ScalePlane(src_y, src_stride_y, src_width, src_height, dst_y,
- dst_stride_y, dst_width, dst_height, filtering);
- libyuv::ScalePlane(src_u, src_stride_u, src_halfwidth, src_height, dst_u,
- dst_stride_u, dst_halfwidth, dst_height, filtering);
- libyuv::ScalePlane(src_v, src_stride_v, src_halfwidth, src_height, dst_v,
- dst_stride_v, dst_halfwidth, dst_height, filtering);
+ ScalePlane(src_y, src_stride_y, src_width, src_height, dst_y, dst_stride_y,
+ dst_width, dst_height, filtering);
+ ScalePlane(src_u, src_stride_u, src_halfwidth, src_height, dst_u,
+ dst_stride_u, dst_halfwidth, dst_height, filtering);
+ ScalePlane(src_v, src_stride_v, src_halfwidth, src_height, dst_v,
+ dst_stride_v, dst_halfwidth, dst_height, filtering);
return 0;
}
@@ -2383,22 +2387,22 @@ int I422Scale_16(const uint16_t* src_y,
int dst_stride_v,
int dst_width,
int dst_height,
- enum libyuv::FilterMode filtering) {
+ enum FilterMode filtering) {
+ int src_halfwidth = SUBSAMPLE(src_width, 1, 1);
+ int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
+
if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_u || !dst_v ||
dst_width <= 0 || dst_height <= 0) {
return -1;
}
- int src_halfwidth = SUBSAMPLE(src_width, 1, 1);
- int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
-
- libyuv::ScalePlane_16(src_y, src_stride_y, src_width, src_height, dst_y,
- dst_stride_y, dst_width, dst_height, filtering);
- libyuv::ScalePlane_16(src_u, src_stride_u, src_halfwidth, src_height, dst_u,
- dst_stride_u, dst_halfwidth, dst_height, filtering);
- libyuv::ScalePlane_16(src_v, src_stride_v, src_halfwidth, src_height, dst_v,
- dst_stride_v, dst_halfwidth, dst_height, filtering);
+ ScalePlane_16(src_y, src_stride_y, src_width, src_height, dst_y, dst_stride_y,
+ dst_width, dst_height, filtering);
+ ScalePlane_16(src_u, src_stride_u, src_halfwidth, src_height, dst_u,
+ dst_stride_u, dst_halfwidth, dst_height, filtering);
+ ScalePlane_16(src_v, src_stride_v, src_halfwidth, src_height, dst_v,
+ dst_stride_v, dst_halfwidth, dst_height, filtering);
return 0;
}
@@ -2419,22 +2423,22 @@ int I422Scale_12(const uint16_t* src_y,
int dst_stride_v,
int dst_width,
int dst_height,
- enum libyuv::FilterMode filtering) {
+ enum FilterMode filtering) {
+ int src_halfwidth = SUBSAMPLE(src_width, 1, 1);
+ int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
+
if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_u || !dst_v ||
dst_width <= 0 || dst_height <= 0) {
return -1;
}
- int src_halfwidth = SUBSAMPLE(src_width, 1, 1);
- int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
-
- libyuv::ScalePlane_12(src_y, src_stride_y, src_width, src_height, dst_y,
- dst_stride_y, dst_width, dst_height, filtering);
- libyuv::ScalePlane_12(src_u, src_stride_u, src_halfwidth, src_height, dst_u,
- dst_stride_u, dst_halfwidth, dst_height, filtering);
- libyuv::ScalePlane_12(src_v, src_stride_v, src_halfwidth, src_height, dst_v,
- dst_stride_v, dst_halfwidth, dst_height, filtering);
+ ScalePlane_12(src_y, src_stride_y, src_width, src_height, dst_y, dst_stride_y,
+ dst_width, dst_height, filtering);
+ ScalePlane_12(src_u, src_stride_u, src_halfwidth, src_height, dst_u,
+ dst_stride_u, dst_halfwidth, dst_height, filtering);
+ ScalePlane_12(src_v, src_stride_v, src_halfwidth, src_height, dst_v,
+ dst_stride_v, dst_halfwidth, dst_height, filtering);
return 0;
}
@@ -2459,6 +2463,7 @@ int NV12Scale(const uint8_t* src_y,
int src_halfheight = SUBSAMPLE(src_height, 1, 1);
int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
int dst_halfheight = SUBSAMPLE(dst_height, 1, 1);
+
if (!src_y || !src_uv || src_width <= 0 || src_height == 0 ||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_uv ||
dst_width <= 0 || dst_height <= 0) {