Commit 6bb9f53f authored by fbarchard@google.com's avatar fbarchard@google.com

Adding I400Mirror allows unittesting of YUV mirroring

BUG=none
TEST=none
Review URL: https://webrtc-codereview.appspot.com/928008

git-svn-id: http://libyuv.googlecode.com/svn/trunk@446 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent b22871fe
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 445
Version: 446
License: BSD
License File: LICENSE
......
......@@ -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
......
......@@ -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
......@@ -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,
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment