diff --git a/README.chromium b/README.chromium index 5b56406dc..0f7e175e4 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 703 +Version: 704 License: BSD License File: LICENSE diff --git a/include/libyuv/rotate.h b/include/libyuv/rotate.h index 0b81da086..20b7c04c8 100644 --- a/include/libyuv/rotate.h +++ b/include/libyuv/rotate.h @@ -50,7 +50,13 @@ int NV12ToI420Rotate(const uint8* src_y, int src_stride_y, uint8* dst_v, int dst_stride_v, int src_width, int src_height, enum RotationMode mode); -// Rotate planes by 90, 180, 270 +// Rotate a plane by 0, 90, 180, or 270. +LIBYUV_API +int RotatePlane(const uint8* src, int src_stride, + uint8* dst, int dst_stride, + int src_width, int src_height, enum RotationMode mode); + +// Rotate planes by 90, 180, 270. Deprecated. LIBYUV_API void RotatePlane90(const uint8* src, int src_stride, uint8* dst, int dst_stride, @@ -75,7 +81,7 @@ void RotateUV90(const uint8* src, int src_stride, // Rotations for when U and V are interleaved. // These functions take one input pointer and // split the data into two buffers while -// rotating them. +// rotating them. Deprecated. LIBYUV_API void RotateUV180(const uint8* src, int src_stride, uint8* dst_a, int dst_stride_a, @@ -91,6 +97,7 @@ void RotateUV270(const uint8* src, int src_stride, // The 90 and 270 functions are based on transposes. // Doing a transpose with reversing the read/write // order will result in a rotation by +- 90 degrees. +// Deprecated. LIBYUV_API void TransposePlane(const uint8* src, int src_stride, uint8* dst, int dst_stride, diff --git a/include/libyuv/version.h b/include/libyuv/version.h index 63747919f..dff587d73 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 703 +#define LIBYUV_VERSION 704 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/rotate.cc b/source/rotate.cc index 8a4ede9f2..1fe3c454e 100644 --- a/source/rotate.cc +++ b/source/rotate.cc @@ -1089,6 +1089,50 @@ void RotateUV180(const uint8* src, int src_stride, } } +LIBYUV_API +int RotatePlane(const uint8* src, int src_stride, + uint8* dst, int dst_stride, + int width, int height, + RotationMode mode) { + if (!src || width <= 0 || height == 0 || !dst) { + return -1; + } + + // Negative height means invert the image. + if (height < 0) { + height = -height; + src = src + (height - 1) * src_stride; + src_stride = -src_stride; + } + + switch (mode) { + case kRotate0: + // copy frame + CopyPlane(src, src_stride, + dst, dst_stride, + width, height); + return 0; + case kRotate90: + RotatePlane90(src, src_stride, + dst, dst_stride, + width, height); + return 0; + case kRotate270: + RotatePlane270(src, src_stride, + dst, dst_stride, + width, height); + return 0; + case kRotate180: + RotatePlane180(src, src_stride, + dst, dst_stride, + width, height); + return 0; + default: + break; + } + return -1; +} + LIBYUV_API int I420Rotate(const uint8* src_y, int src_stride_y, const uint8* src_u, int src_stride_u,