diff --git a/README.chromium b/README.chromium index a0afc9dfb..767780475 100644 --- a/README.chromium +++ b/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 445 +Version: 446 License: BSD License File: LICENSE diff --git a/include/libyuv/planar_functions.h b/include/libyuv/planar_functions.h index f0bae55b6..688bef5dc 100644 --- a/include/libyuv/planar_functions.h +++ b/include/libyuv/planar_functions.h @@ -74,6 +74,17 @@ int I420Mirror(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); + +// Alias +#define I400ToI400Mirror I400Mirror + +// I400 mirror. A single plane is mirrored horizontally. +// Pass negative height to achieve 180 degree rotation. +LIBYUV_API +int I400Mirror(const uint8* src_y, int src_stride_y, + uint8* dst_y, int dst_stride_y, + int width, int height); + // Alias #define ARGBToARGBMirror ARGBMirror diff --git a/include/libyuv/version.h b/include/libyuv/version.h index da99c5e97..e5c9c063e 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 445 +#define LIBYUV_VERSION 446 #endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT diff --git a/source/planar_functions.cc b/source/planar_functions.cc index 2d0366fbf..6de5f0342 100644 --- a/source/planar_functions.cc +++ b/source/planar_functions.cc @@ -247,6 +247,26 @@ int UYVYToI422(const uint8* src_uyvy, int src_stride_uyvy, return 0; } +// Mirror I400 with optional flipping +LIBYUV_API +int I400Mirror(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; + } + + MirrorPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height); + return 0; +} + // Mirror I420 with optional flipping LIBYUV_API int I420Mirror(const uint8* src_y, int src_stride_y, diff --git a/unit_test/convert_test.cc b/unit_test/convert_test.cc index 36739526b..e5d161d95 100644 --- a/unit_test/convert_test.cc +++ b/unit_test/convert_test.cc @@ -706,6 +706,7 @@ TESTATOB(BayerGBRG, 1, 1, ARGB, 4, 0) TESTATOB(BayerGRBG, 1, 1, ARGB, 4, 0) TESTATOB(I400, 1, 1, ARGB, 4, 0) TESTATOB(I400, 1, 1, I400, 1, 0) +TESTATOB(I400, 1, 1, I400Mirror, 1, 0) TESTATOB(ARGB, 4, 4, ARGBMirror, 4, 0) #define TESTATOBRANDOM(FMT_A, BPP_A, STRIDE_A, FMT_B, BPP_B, STRIDE_B, DIFF) \ @@ -771,6 +772,7 @@ TESTATOBRANDOM(I400, 1, 1, ARGB, 4, 4, 0) TESTATOBRANDOM(YUY2, 4, 2, ARGB, 4, 4, 0) TESTATOBRANDOM(UYVY, 4, 2, ARGB, 4, 4, 0) TESTATOBRANDOM(I400, 1, 1, I400, 1, 1, 0) +TESTATOBRANDOM(I400, 1, 1, I400Mirror, 1, 1, 0) TESTATOBRANDOM(ARGB, 4, 4, ARGBMirror, 4, 4, 0) TEST_F(libyuvTest, Test565) {