mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-02-16 23:29:52 +08:00
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
This commit is contained in:
parent
e3230e4a93
commit
58f50df879
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 703
|
Version: 704
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,13 @@ int NV12ToI420Rotate(const uint8* src_y, int src_stride_y,
|
|||||||
uint8* dst_v, int dst_stride_v,
|
uint8* dst_v, int dst_stride_v,
|
||||||
int src_width, int src_height, enum RotationMode mode);
|
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
|
LIBYUV_API
|
||||||
void RotatePlane90(const uint8* src, int src_stride,
|
void RotatePlane90(const uint8* src, int src_stride,
|
||||||
uint8* dst, int dst_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.
|
// Rotations for when U and V are interleaved.
|
||||||
// These functions take one input pointer and
|
// These functions take one input pointer and
|
||||||
// split the data into two buffers while
|
// split the data into two buffers while
|
||||||
// rotating them.
|
// rotating them. Deprecated.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
void RotateUV180(const uint8* src, int src_stride,
|
void RotateUV180(const uint8* src, int src_stride,
|
||||||
uint8* dst_a, int dst_stride_a,
|
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.
|
// The 90 and 270 functions are based on transposes.
|
||||||
// Doing a transpose with reversing the read/write
|
// Doing a transpose with reversing the read/write
|
||||||
// order will result in a rotation by +- 90 degrees.
|
// order will result in a rotation by +- 90 degrees.
|
||||||
|
// Deprecated.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
void TransposePlane(const uint8* src, int src_stride,
|
void TransposePlane(const uint8* src, int src_stride,
|
||||||
uint8* dst, int dst_stride,
|
uint8* dst, int dst_stride,
|
||||||
|
|||||||
@ -11,6 +11,6 @@
|
|||||||
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
#ifndef INCLUDE_LIBYUV_VERSION_H_ // NOLINT
|
||||||
#define INCLUDE_LIBYUV_VERSION_H_
|
#define INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
#define LIBYUV_VERSION 703
|
#define LIBYUV_VERSION 704
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_ NOLINT
|
#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
|
LIBYUV_API
|
||||||
int I420Rotate(const uint8* src_y, int src_stride_y,
|
int I420Rotate(const uint8* src_y, int src_stride_y,
|
||||||
const uint8* src_u, int src_stride_u,
|
const uint8* src_u, int src_stride_u,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user