Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: source/planar_functions.cc

Issue 2271053003: Allow NULL for dst_y in planar formats. BUG=libyuv:631 TEST=unittests build/pass (Closed) Base URL: https://chromium.googlesource.com/libyuv/libyuv@master
Patch Set: Allow NULL for dst_y in planar formats. BUG=libyuv:631 TEST=unittests build/pass Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« source/convert.cc ('K') | « source/convert_from.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/planar_functions.cc
diff --git a/source/planar_functions.cc b/source/planar_functions.cc
index 237ab68315be82d0f40d2b8b4ea6305277ae7e6e..811ee5b72ccfa5eaf719f785444ad1ef04140a44 100644
--- a/source/planar_functions.cc
+++ b/source/planar_functions.cc
@@ -128,8 +128,8 @@ int I422Copy(const uint8* src_y, int src_stride_y,
uint8* dst_v, int dst_stride_v,
int width, int height) {
int halfwidth = (width + 1) >> 1;
- if (!src_y || !src_u || !src_v ||
- !dst_y || !dst_u || !dst_v ||
+ if (!src_u || !src_v ||
+ !dst_u || !dst_v ||
width <= 0 || height == 0) {
return -1;
}
@@ -143,7 +143,10 @@ int I422Copy(const uint8* src_y, int src_stride_y,
src_stride_u = -src_stride_u;
src_stride_v = -src_stride_v;
}
- CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
+
+ if (dst_y) {
+ CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
+ }
CopyPlane(src_u, src_stride_u, dst_u, dst_stride_u, halfwidth, height);
CopyPlane(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth, height);
return 0;
@@ -158,8 +161,8 @@ int I444Copy(const uint8* src_y, int src_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int width, int height) {
- if (!src_y || !src_u || !src_v ||
- !dst_y || !dst_u || !dst_v ||
+ if (!src_u || !src_v ||
+ !dst_u || !dst_v ||
width <= 0 || height == 0) {
return -1;
}
@@ -174,7 +177,9 @@ int I444Copy(const uint8* src_y, int src_stride_y,
src_stride_v = -src_stride_v;
}
- CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
+ if (dst_y) {
+ CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
+ }
CopyPlane(src_u, src_stride_u, dst_u, dst_stride_u, width, height);
CopyPlane(src_v, src_stride_v, dst_v, dst_stride_v, width, height);
return 0;
@@ -214,6 +219,7 @@ int I420ToI400(const uint8* src_y, int src_stride_y,
src_y = src_y + (height - 1) * src_stride_y;
src_stride_y = -src_stride_y;
}
+
CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
return 0;
}
« source/convert.cc ('K') | « source/convert_from.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698