rotate.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * Copyright 2011 The LibYuv Project Authors. All rights reserved.
  3. *
  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.
  9. */
  10. #ifndef INCLUDE_LIBYUV_ROTATE_H_
  11. #define INCLUDE_LIBYUV_ROTATE_H_
  12. #include "libyuv/basic_types.h"
  13. #ifdef __cplusplus
  14. namespace libyuv {
  15. extern "C" {
  16. #endif
  17. // Supported rotation.
  18. typedef enum RotationMode {
  19. kRotate0 = 0, // No rotation.
  20. kRotate90 = 90, // Rotate 90 degrees clockwise.
  21. kRotate180 = 180, // Rotate 180 degrees.
  22. kRotate270 = 270, // Rotate 270 degrees clockwise.
  23. // Deprecated.
  24. kRotateNone = 0,
  25. kRotateClockwise = 90,
  26. kRotateCounterClockwise = 270,
  27. } RotationModeEnum;
  28. // Rotate I420 frame.
  29. LIBYUV_API
  30. int I420Rotate(const uint8_t* src_y,
  31. int src_stride_y,
  32. const uint8_t* src_u,
  33. int src_stride_u,
  34. const uint8_t* src_v,
  35. int src_stride_v,
  36. uint8_t* dst_y,
  37. int dst_stride_y,
  38. uint8_t* dst_u,
  39. int dst_stride_u,
  40. uint8_t* dst_v,
  41. int dst_stride_v,
  42. int width,
  43. int height,
  44. enum RotationMode mode);
  45. // Rotate I444 frame.
  46. LIBYUV_API
  47. int I444Rotate(const uint8_t* src_y,
  48. int src_stride_y,
  49. const uint8_t* src_u,
  50. int src_stride_u,
  51. const uint8_t* src_v,
  52. int src_stride_v,
  53. uint8_t* dst_y,
  54. int dst_stride_y,
  55. uint8_t* dst_u,
  56. int dst_stride_u,
  57. uint8_t* dst_v,
  58. int dst_stride_v,
  59. int width,
  60. int height,
  61. enum RotationMode mode);
  62. // Rotate NV12 input and store in I420.
  63. LIBYUV_API
  64. int NV12ToI420Rotate(const uint8_t* src_y,
  65. int src_stride_y,
  66. const uint8_t* src_uv,
  67. int src_stride_uv,
  68. uint8_t* dst_y,
  69. int dst_stride_y,
  70. uint8_t* dst_u,
  71. int dst_stride_u,
  72. uint8_t* dst_v,
  73. int dst_stride_v,
  74. int width,
  75. int height,
  76. enum RotationMode mode);
  77. // Rotate a plane by 0, 90, 180, or 270.
  78. LIBYUV_API
  79. int RotatePlane(const uint8_t* src,
  80. int src_stride,
  81. uint8_t* dst,
  82. int dst_stride,
  83. int width,
  84. int height,
  85. enum RotationMode mode);
  86. // Rotate planes by 90, 180, 270. Deprecated.
  87. LIBYUV_API
  88. void RotatePlane90(const uint8_t* src,
  89. int src_stride,
  90. uint8_t* dst,
  91. int dst_stride,
  92. int width,
  93. int height);
  94. LIBYUV_API
  95. void RotatePlane180(const uint8_t* src,
  96. int src_stride,
  97. uint8_t* dst,
  98. int dst_stride,
  99. int width,
  100. int height);
  101. LIBYUV_API
  102. void RotatePlane270(const uint8_t* src,
  103. int src_stride,
  104. uint8_t* dst,
  105. int dst_stride,
  106. int width,
  107. int height);
  108. LIBYUV_API
  109. void RotateUV90(const uint8_t* src,
  110. int src_stride,
  111. uint8_t* dst_a,
  112. int dst_stride_a,
  113. uint8_t* dst_b,
  114. int dst_stride_b,
  115. int width,
  116. int height);
  117. // Rotations for when U and V are interleaved.
  118. // These functions take one input pointer and
  119. // split the data into two buffers while
  120. // rotating them. Deprecated.
  121. LIBYUV_API
  122. void RotateUV180(const uint8_t* src,
  123. int src_stride,
  124. uint8_t* dst_a,
  125. int dst_stride_a,
  126. uint8_t* dst_b,
  127. int dst_stride_b,
  128. int width,
  129. int height);
  130. LIBYUV_API
  131. void RotateUV270(const uint8_t* src,
  132. int src_stride,
  133. uint8_t* dst_a,
  134. int dst_stride_a,
  135. uint8_t* dst_b,
  136. int dst_stride_b,
  137. int width,
  138. int height);
  139. // The 90 and 270 functions are based on transposes.
  140. // Doing a transpose with reversing the read/write
  141. // order will result in a rotation by +- 90 degrees.
  142. // Deprecated.
  143. LIBYUV_API
  144. void TransposePlane(const uint8_t* src,
  145. int src_stride,
  146. uint8_t* dst,
  147. int dst_stride,
  148. int width,
  149. int height);
  150. LIBYUV_API
  151. void TransposeUV(const uint8_t* src,
  152. int src_stride,
  153. uint8_t* dst_a,
  154. int dst_stride_a,
  155. uint8_t* dst_b,
  156. int dst_stride_b,
  157. int width,
  158. int height);
  159. #ifdef __cplusplus
  160. } // extern "C"
  161. } // namespace libyuv
  162. #endif
  163. #endif // INCLUDE_LIBYUV_ROTATE_H_