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

Unified Diff: source/convert_from.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
Index: source/convert_from.cc
diff --git a/source/convert_from.cc b/source/convert_from.cc
index 46abdebcd633341a0a4a88c6599b6733b45db7f2..2341dca95e41de4b4d39d96ff6056fbd1784f6d0 100644
--- a/source/convert_from.cc
+++ b/source/convert_from.cc
@@ -46,9 +46,11 @@ static int I420ToI4xx(const uint8* src_y, int src_stride_y,
dst_uv_width <= 0 || dst_uv_height <= 0) {
return -1;
}
- ScalePlane(src_y, src_stride_y, src_y_width, src_y_height,
- dst_y, dst_stride_y, dst_y_width, dst_y_height,
- kFilterBilinear);
+ if (dst_y) {
+ ScalePlane(src_y, src_stride_y, src_y_width, src_y_height,
+ dst_y, dst_stride_y, dst_y_width, dst_y_height,
+ kFilterBilinear);
+ }
ScalePlane(src_u, src_stride_u, src_uv_width, src_uv_height,
dst_u, dst_stride_u, dst_uv_width, dst_uv_height,
kFilterBilinear);
@@ -372,7 +374,7 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
// Coalesce rows.
int halfwidth = (width + 1) >> 1;
int halfheight = (height + 1) >> 1;
- if (!src_y || !src_u || !src_v || !dst_y || !dst_uv ||
+ if (!src_u || !src_v || !dst_uv ||
width <= 0 || height == 0) {
return -1;
}
@@ -380,7 +382,9 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
if (height < 0) {
height = -height;
halfheight = (height + 1) >> 1;
- dst_y = dst_y + (height - 1) * dst_stride_y;
+ if (dst_y) {
+ dst_y = dst_y + (height - 1) * dst_stride_y;
+ }
dst_uv = dst_uv + (halfheight - 1) * dst_stride_uv;
dst_stride_y = -dst_stride_y;
dst_stride_uv = -dst_stride_uv;
@@ -424,7 +428,9 @@ int I420ToNV12(const uint8* src_y, int src_stride_y,
}
#endif
- 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);
+ }
for (y = 0; y < halfheight; ++y) {
// Merge a row of U and V into a row of UV.
MergeUVRow_(src_u, src_v, dst_uv, halfwidth);
« source/convert.cc ('K') | « source/convert.cc ('k') | source/planar_functions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698