Commit 58f50df8 authored by fbarchard@google.com's avatar fbarchard@google.com

Add Rotate Plane

BUG=233
TEST=RotatePlane*
R=ryanpetrie@google.com

Review URL: https://webrtc-codereview.appspot.com/1582004

git-svn-id: http://libyuv.googlecode.com/svn/trunk@704 16f28f9a-4ce2-e073-06de-1de4eb20be90
parent e3230e4a
Name: libyuv
URL: http://code.google.com/p/libyuv/
Version: 703
Version: 704
License: BSD
License File: LICENSE
......
......@@ -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,
......
......@@ -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
......@@ -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,
......
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