2 * Copyright 2011 The LibYuv Project Authors. All rights reserved.
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
11 #ifndef INCLUDE_LIBYUV_ROTATE_H_ // NOLINT
12 #define INCLUDE_LIBYUV_ROTATE_H_
14 #include "libyuv/basic_types.h"
21 // Supported rotation.
22 typedef enum RotationMode {
23 kRotate0 = 0, // No rotation.
24 kRotate90 = 90, // Rotate 90 degrees clockwise.
25 kRotate180 = 180, // Rotate 180 degrees.
26 kRotate270 = 270, // Rotate 270 degrees clockwise.
30 kRotateClockwise = 90,
31 kRotateCounterClockwise = 270,
36 int I420Rotate(const uint8* src_y, int src_stride_y,
37 const uint8* src_u, int src_stride_u,
38 const uint8* src_v, int src_stride_v,
39 uint8* dst_y, int dst_stride_y,
40 uint8* dst_u, int dst_stride_u,
41 uint8* dst_v, int dst_stride_v,
42 int src_width, int src_height, enum RotationMode mode);
44 // Rotate NV12 input and store in I420.
46 int NV12ToI420Rotate(const uint8* src_y, int src_stride_y,
47 const uint8* src_uv, int src_stride_uv,
48 uint8* dst_y, int dst_stride_y,
49 uint8* dst_u, int dst_stride_u,
50 uint8* dst_v, int dst_stride_v,
51 int src_width, int src_height, enum RotationMode mode);
53 // Rotate a plane by 0, 90, 180, or 270.
55 int RotatePlane(const uint8* src, int src_stride,
56 uint8* dst, int dst_stride,
57 int src_width, int src_height, enum RotationMode mode);
59 // Rotate planes by 90, 180, 270. Deprecated.
61 void RotatePlane90(const uint8* src, int src_stride,
62 uint8* dst, int dst_stride,
63 int width, int height);
66 void RotatePlane180(const uint8* src, int src_stride,
67 uint8* dst, int dst_stride,
68 int width, int height);
71 void RotatePlane270(const uint8* src, int src_stride,
72 uint8* dst, int dst_stride,
73 int width, int height);
76 void RotateUV90(const uint8* src, int src_stride,
77 uint8* dst_a, int dst_stride_a,
78 uint8* dst_b, int dst_stride_b,
79 int width, int height);
81 // Rotations for when U and V are interleaved.
82 // These functions take one input pointer and
83 // split the data into two buffers while
84 // rotating them. Deprecated.
86 void RotateUV180(const uint8* src, int src_stride,
87 uint8* dst_a, int dst_stride_a,
88 uint8* dst_b, int dst_stride_b,
89 int width, int height);
92 void RotateUV270(const uint8* src, int src_stride,
93 uint8* dst_a, int dst_stride_a,
94 uint8* dst_b, int dst_stride_b,
95 int width, int height);
97 // The 90 and 270 functions are based on transposes.
98 // Doing a transpose with reversing the read/write
99 // order will result in a rotation by +- 90 degrees.
102 void TransposePlane(const uint8* src, int src_stride,
103 uint8* dst, int dst_stride,
104 int width, int height);
107 void TransposeUV(const uint8* src, int src_stride,
108 uint8* dst_a, int dst_stride_a,
109 uint8* dst_b, int dst_stride_b,
110 int width, int height);
114 } // namespace libyuv
117 #endif // INCLUDE_LIBYUV_ROTATE_H_ NOLINT