From 6b5a8efff7759c941f5a11ead2f67330dea2f14c Mon Sep 17 00:00:00 2001 From: "fbarchard@google.com" Date: Tue, 9 Oct 2012 02:49:59 +0000 Subject: [PATCH] I400 invert support which fixes a valgrind bug BUG=117 TEST=I400ToI400Invert_OptVsC Review URL: https://webrtc-codereview.appspot.com/859010 git-svn-id: http://libyuv.googlecode.com/svn/trunk@398 16f28f9a-4ce2-e073-06de-1de4eb20be90 --- README.chromium | 2 +- include/libyuv/planar_functions.h | 7 +++++-- include/libyuv/version.h | 2 +- source/planar_functions.cc | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/README.chromium b/README.chromium index e5bfb8e31..b3da154c1 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 397 +Version: 398 License: BSD License File: LICENSE diff --git a/include/libyuv/planar_functions.h b/include/libyuv/planar_functions.h index 7e43dabb2..61d6e9e4a 100644 --- a/include/libyuv/planar_functions.h +++ b/include/libyuv/planar_functions.h @@ -27,8 +27,11 @@ void SetPlane(uint8* dst_y, int dst_stride_y, int width, int height, uint32 value); -// Alias. -#define I400ToI400 CopyPlane +// Copy I400. Supports inverting. +LIBYUV_API +int I400ToI400(const uint8* src_y, int src_stride_y, + uint8* dst_y, int dst_stride_y, + int width, int height); // Copy a plane of data (I420 to I400). LIBYUV_API diff --git a/include/libyuv/version.h b/include/libyuv/version.h index e782ae184..b12c2e7ac 100644 --- a/include/libyuv/version.h +++ b/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 397 +#define LIBYUV_VERSION 398 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/planar_functions.cc b/source/planar_functions.cc index a7f5086a1..58c102639 100644 --- a/source/planar_functions.cc +++ b/source/planar_functions.cc @@ -55,6 +55,24 @@ void CopyPlane(const uint8* src_y, int src_stride_y, } } +// Copy I400. +LIBYUV_API +int I400ToI400(const uint8* src_y, int src_stride_y, + uint8* dst_y, int dst_stride_y, + int width, int height) { + if (!src_y || !dst_y || width <= 0 || height == 0) { + return -1; + } + // Negative height means invert the image. + if (height < 0) { + height = -height; + 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; +} + // Convert I420 to I400. LIBYUV_API int I420ToI400(const uint8* src_y, int src_stride_y,