convert_from.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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_CONVERT_FROM_H_
  11. #define INCLUDE_LIBYUV_CONVERT_FROM_H_
  12. #include "libyuv/basic_types.h"
  13. #include "libyuv/rotate.h"
  14. #ifdef __cplusplus
  15. namespace libyuv {
  16. extern "C" {
  17. #endif
  18. // See Also convert.h for conversions from formats to I420.
  19. // Convert 8 bit YUV to 10 bit.
  20. #define H420ToH010 I420ToI010
  21. LIBYUV_API
  22. int I420ToI010(const uint8_t* src_y,
  23. int src_stride_y,
  24. const uint8_t* src_u,
  25. int src_stride_u,
  26. const uint8_t* src_v,
  27. int src_stride_v,
  28. uint16_t* dst_y,
  29. int dst_stride_y,
  30. uint16_t* dst_u,
  31. int dst_stride_u,
  32. uint16_t* dst_v,
  33. int dst_stride_v,
  34. int width,
  35. int height);
  36. // Convert 8 bit YUV to 12 bit.
  37. #define H420ToH012 I420ToI012
  38. LIBYUV_API
  39. int I420ToI012(const uint8_t* src_y,
  40. int src_stride_y,
  41. const uint8_t* src_u,
  42. int src_stride_u,
  43. const uint8_t* src_v,
  44. int src_stride_v,
  45. uint16_t* dst_y,
  46. int dst_stride_y,
  47. uint16_t* dst_u,
  48. int dst_stride_u,
  49. uint16_t* dst_v,
  50. int dst_stride_v,
  51. int width,
  52. int height);
  53. LIBYUV_API
  54. int I420ToI422(const uint8_t* src_y,
  55. int src_stride_y,
  56. const uint8_t* src_u,
  57. int src_stride_u,
  58. const uint8_t* src_v,
  59. int src_stride_v,
  60. uint8_t* dst_y,
  61. int dst_stride_y,
  62. uint8_t* dst_u,
  63. int dst_stride_u,
  64. uint8_t* dst_v,
  65. int dst_stride_v,
  66. int width,
  67. int height);
  68. LIBYUV_API
  69. int I420ToI444(const uint8_t* src_y,
  70. int src_stride_y,
  71. const uint8_t* src_u,
  72. int src_stride_u,
  73. const uint8_t* src_v,
  74. int src_stride_v,
  75. uint8_t* dst_y,
  76. int dst_stride_y,
  77. uint8_t* dst_u,
  78. int dst_stride_u,
  79. uint8_t* dst_v,
  80. int dst_stride_v,
  81. int width,
  82. int height);
  83. // Copy to I400. Source can be I420, I422, I444, I400, NV12 or NV21.
  84. LIBYUV_API
  85. int I400Copy(const uint8_t* src_y,
  86. int src_stride_y,
  87. uint8_t* dst_y,
  88. int dst_stride_y,
  89. int width,
  90. int height);
  91. LIBYUV_API
  92. int I420ToNV12(const uint8_t* src_y,
  93. int src_stride_y,
  94. const uint8_t* src_u,
  95. int src_stride_u,
  96. const uint8_t* src_v,
  97. int src_stride_v,
  98. uint8_t* dst_y,
  99. int dst_stride_y,
  100. uint8_t* dst_uv,
  101. int dst_stride_uv,
  102. int width,
  103. int height);
  104. LIBYUV_API
  105. int I420ToNV21(const uint8_t* src_y,
  106. int src_stride_y,
  107. const uint8_t* src_u,
  108. int src_stride_u,
  109. const uint8_t* src_v,
  110. int src_stride_v,
  111. uint8_t* dst_y,
  112. int dst_stride_y,
  113. uint8_t* dst_vu,
  114. int dst_stride_vu,
  115. int width,
  116. int height);
  117. LIBYUV_API
  118. int I420ToYUY2(const uint8_t* src_y,
  119. int src_stride_y,
  120. const uint8_t* src_u,
  121. int src_stride_u,
  122. const uint8_t* src_v,
  123. int src_stride_v,
  124. uint8_t* dst_yuy2,
  125. int dst_stride_yuy2,
  126. int width,
  127. int height);
  128. LIBYUV_API
  129. int I420ToUYVY(const uint8_t* src_y,
  130. int src_stride_y,
  131. const uint8_t* src_u,
  132. int src_stride_u,
  133. const uint8_t* src_v,
  134. int src_stride_v,
  135. uint8_t* dst_uyvy,
  136. int dst_stride_uyvy,
  137. int width,
  138. int height);
  139. // The following are from convert_argb.h
  140. // DEPRECATED: The prototypes will be removed in future. Use convert_argb.h
  141. // Convert I420 to ARGB.
  142. LIBYUV_API
  143. int I420ToARGB(const uint8_t* src_y,
  144. int src_stride_y,
  145. const uint8_t* src_u,
  146. int src_stride_u,
  147. const uint8_t* src_v,
  148. int src_stride_v,
  149. uint8_t* dst_argb,
  150. int dst_stride_argb,
  151. int width,
  152. int height);
  153. // Convert I420 to ABGR.
  154. LIBYUV_API
  155. int I420ToABGR(const uint8_t* src_y,
  156. int src_stride_y,
  157. const uint8_t* src_u,
  158. int src_stride_u,
  159. const uint8_t* src_v,
  160. int src_stride_v,
  161. uint8_t* dst_abgr,
  162. int dst_stride_abgr,
  163. int width,
  164. int height);
  165. // Convert I420 to specified format.
  166. // "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the
  167. // buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
  168. LIBYUV_API
  169. int ConvertFromI420(const uint8_t* y,
  170. int y_stride,
  171. const uint8_t* u,
  172. int u_stride,
  173. const uint8_t* v,
  174. int v_stride,
  175. uint8_t* dst_sample,
  176. int dst_sample_stride,
  177. int width,
  178. int height,
  179. uint32_t fourcc);
  180. #ifdef __cplusplus
  181. } // extern "C"
  182. } // namespace libyuv
  183. #endif
  184. #endif // INCLUDE_LIBYUV_CONVERT_FROM_H_