rotate.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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* src_y,
  31. int src_stride_y,
  32. const uint8* src_u,
  33. int src_stride_u,
  34. const uint8* src_v,
  35. int src_stride_v,
  36. uint8* dst_y,
  37. int dst_stride_y,
  38. uint8* dst_u,
  39. int dst_stride_u,
  40. uint8* dst_v,
  41. int dst_stride_v,
  42. int src_width,
  43. int src_height,
  44. enum RotationMode mode);
  45. // Rotate NV12 input and store in I420.
  46. LIBYUV_API
  47. int NV12ToI420Rotate(const uint8* src_y,
  48. int src_stride_y,
  49. const uint8* src_uv,
  50. int src_stride_uv,
  51. uint8* dst_y,
  52. int dst_stride_y,
  53. uint8* dst_u,
  54. int dst_stride_u,
  55. uint8* dst_v,
  56. int dst_stride_v,
  57. int src_width,
  58. int src_height,
  59. enum RotationMode mode);
  60. // Rotate a plane by 0, 90, 180, or 270.
  61. LIBYUV_API
  62. int RotatePlane(const uint8* src,
  63. int src_stride,
  64. uint8* dst,
  65. int dst_stride,
  66. int src_width,
  67. int src_height,
  68. enum RotationMode mode);
  69. // Rotate planes by 90, 180, 270. Deprecated.
  70. LIBYUV_API
  71. void RotatePlane90(const uint8* src,
  72. int src_stride,
  73. uint8* dst,
  74. int dst_stride,
  75. int width,
  76. int height);
  77. LIBYUV_API
  78. void RotatePlane180(const uint8* src,
  79. int src_stride,
  80. uint8* dst,
  81. int dst_stride,
  82. int width,
  83. int height);
  84. LIBYUV_API
  85. void RotatePlane270(const uint8* src,
  86. int src_stride,
  87. uint8* dst,
  88. int dst_stride,
  89. int width,
  90. int height);
  91. LIBYUV_API
  92. void RotateUV90(const uint8* src,
  93. int src_stride,
  94. uint8* dst_a,
  95. int dst_stride_a,
  96. uint8* dst_b,
  97. int dst_stride_b,
  98. int width,
  99. int height);
  100. // Rotations for when U and V are interleaved.
  101. // These functions take one input pointer and
  102. // split the data into two buffers while
  103. // rotating them. Deprecated.
  104. LIBYUV_API
  105. void RotateUV180(const uint8* src,
  106. int src_stride,
  107. uint8* dst_a,
  108. int dst_stride_a,
  109. uint8* dst_b,
  110. int dst_stride_b,
  111. int width,
  112. int height);
  113. LIBYUV_API
  114. void RotateUV270(const uint8* src,
  115. int src_stride,
  116. uint8* dst_a,
  117. int dst_stride_a,
  118. uint8* dst_b,
  119. int dst_stride_b,
  120. int width,
  121. int height);
  122. // The 90 and 270 functions are based on transposes.
  123. // Doing a transpose with reversing the read/write
  124. // order will result in a rotation by +- 90 degrees.
  125. // Deprecated.
  126. LIBYUV_API
  127. void TransposePlane(const uint8* src,
  128. int src_stride,
  129. uint8* dst,
  130. int dst_stride,
  131. int width,
  132. int height);
  133. LIBYUV_API
  134. void TransposeUV(const uint8* src,
  135. int src_stride,
  136. uint8* dst_a,
  137. int dst_stride_a,
  138. uint8* dst_b,
  139. int dst_stride_b,
  140. int width,
  141. int height);
  142. #ifdef __cplusplus
  143. } // extern "C"
  144. } // namespace libyuv
  145. #endif
  146. #endif // INCLUDE_LIBYUV_ROTATE_H_