convert_from_argb.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. /*
  2. * Copyright 2012 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_ARGB_H_
  11. #define INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_
  12. #include "libyuv/basic_types.h"
  13. #ifdef __cplusplus
  14. namespace libyuv {
  15. extern "C" {
  16. #endif
  17. // Copy ARGB to ARGB.
  18. #define ARGBToARGB ARGBCopy
  19. LIBYUV_API
  20. int ARGBCopy(const uint8_t* src_argb,
  21. int src_stride_argb,
  22. uint8_t* dst_argb,
  23. int dst_stride_argb,
  24. int width,
  25. int height);
  26. // Convert ARGB To BGRA.
  27. LIBYUV_API
  28. int ARGBToBGRA(const uint8_t* src_argb,
  29. int src_stride_argb,
  30. uint8_t* dst_bgra,
  31. int dst_stride_bgra,
  32. int width,
  33. int height);
  34. // Convert ARGB To ABGR.
  35. LIBYUV_API
  36. int ARGBToABGR(const uint8_t* src_argb,
  37. int src_stride_argb,
  38. uint8_t* dst_abgr,
  39. int dst_stride_abgr,
  40. int width,
  41. int height);
  42. // Convert ARGB To RGBA.
  43. LIBYUV_API
  44. int ARGBToRGBA(const uint8_t* src_argb,
  45. int src_stride_argb,
  46. uint8_t* dst_rgba,
  47. int dst_stride_rgba,
  48. int width,
  49. int height);
  50. // Aliases
  51. #define ARGBToAB30 ABGRToAR30
  52. #define ABGRToAB30 ARGBToAR30
  53. // Convert ABGR To AR30.
  54. LIBYUV_API
  55. int ABGRToAR30(const uint8_t* src_abgr,
  56. int src_stride_abgr,
  57. uint8_t* dst_ar30,
  58. int dst_stride_ar30,
  59. int width,
  60. int height);
  61. // Convert ARGB To AR30.
  62. LIBYUV_API
  63. int ARGBToAR30(const uint8_t* src_argb,
  64. int src_stride_argb,
  65. uint8_t* dst_ar30,
  66. int dst_stride_ar30,
  67. int width,
  68. int height);
  69. // Convert ARGB To RGB24.
  70. LIBYUV_API
  71. int ARGBToRGB24(const uint8_t* src_argb,
  72. int src_stride_argb,
  73. uint8_t* dst_rgb24,
  74. int dst_stride_rgb24,
  75. int width,
  76. int height);
  77. // Convert ARGB To RAW.
  78. LIBYUV_API
  79. int ARGBToRAW(const uint8_t* src_argb,
  80. int src_stride_argb,
  81. uint8_t* dst_raw,
  82. int dst_stride_raw,
  83. int width,
  84. int height);
  85. // Convert ARGB To RGB565.
  86. LIBYUV_API
  87. int ARGBToRGB565(const uint8_t* src_argb,
  88. int src_stride_argb,
  89. uint8_t* dst_rgb565,
  90. int dst_stride_rgb565,
  91. int width,
  92. int height);
  93. // Convert ARGB To RGB565 with 4x4 dither matrix (16 bytes).
  94. // Values in dither matrix from 0 to 7 recommended.
  95. // The order of the dither matrix is first byte is upper left.
  96. // TODO(fbarchard): Consider pointer to 2d array for dither4x4.
  97. // const uint8_t(*dither)[4][4];
  98. LIBYUV_API
  99. int ARGBToRGB565Dither(const uint8_t* src_argb,
  100. int src_stride_argb,
  101. uint8_t* dst_rgb565,
  102. int dst_stride_rgb565,
  103. const uint8_t* dither4x4,
  104. int width,
  105. int height);
  106. // Convert ARGB To ARGB1555.
  107. LIBYUV_API
  108. int ARGBToARGB1555(const uint8_t* src_argb,
  109. int src_stride_argb,
  110. uint8_t* dst_argb1555,
  111. int dst_stride_argb1555,
  112. int width,
  113. int height);
  114. // Convert ARGB To ARGB4444.
  115. LIBYUV_API
  116. int ARGBToARGB4444(const uint8_t* src_argb,
  117. int src_stride_argb,
  118. uint8_t* dst_argb4444,
  119. int dst_stride_argb4444,
  120. int width,
  121. int height);
  122. // Convert ARGB To I444.
  123. LIBYUV_API
  124. int ARGBToI444(const uint8_t* src_argb,
  125. int src_stride_argb,
  126. uint8_t* dst_y,
  127. int dst_stride_y,
  128. uint8_t* dst_u,
  129. int dst_stride_u,
  130. uint8_t* dst_v,
  131. int dst_stride_v,
  132. int width,
  133. int height);
  134. // Convert ARGB To I422.
  135. LIBYUV_API
  136. int ARGBToI422(const uint8_t* src_argb,
  137. int src_stride_argb,
  138. uint8_t* dst_y,
  139. int dst_stride_y,
  140. uint8_t* dst_u,
  141. int dst_stride_u,
  142. uint8_t* dst_v,
  143. int dst_stride_v,
  144. int width,
  145. int height);
  146. // Convert ARGB To I420. (also in convert.h)
  147. LIBYUV_API
  148. int ARGBToI420(const uint8_t* src_argb,
  149. int src_stride_argb,
  150. uint8_t* dst_y,
  151. int dst_stride_y,
  152. uint8_t* dst_u,
  153. int dst_stride_u,
  154. uint8_t* dst_v,
  155. int dst_stride_v,
  156. int width,
  157. int height);
  158. // Convert ARGB to J420. (JPeg full range I420).
  159. LIBYUV_API
  160. int ARGBToJ420(const uint8_t* src_argb,
  161. int src_stride_argb,
  162. uint8_t* dst_yj,
  163. int dst_stride_yj,
  164. uint8_t* dst_u,
  165. int dst_stride_u,
  166. uint8_t* dst_v,
  167. int dst_stride_v,
  168. int width,
  169. int height);
  170. // Convert ARGB to J422.
  171. LIBYUV_API
  172. int ARGBToJ422(const uint8_t* src_argb,
  173. int src_stride_argb,
  174. uint8_t* dst_yj,
  175. int dst_stride_yj,
  176. uint8_t* dst_u,
  177. int dst_stride_u,
  178. uint8_t* dst_v,
  179. int dst_stride_v,
  180. int width,
  181. int height);
  182. // Convert ARGB to J400. (JPeg full range).
  183. LIBYUV_API
  184. int ARGBToJ400(const uint8_t* src_argb,
  185. int src_stride_argb,
  186. uint8_t* dst_yj,
  187. int dst_stride_yj,
  188. int width,
  189. int height);
  190. // Convert RGBA to J400. (JPeg full range).
  191. LIBYUV_API
  192. int RGBAToJ400(const uint8_t* src_rgba,
  193. int src_stride_rgba,
  194. uint8_t* dst_yj,
  195. int dst_stride_yj,
  196. int width,
  197. int height);
  198. // Convert ARGB to I400.
  199. LIBYUV_API
  200. int ARGBToI400(const uint8_t* src_argb,
  201. int src_stride_argb,
  202. uint8_t* dst_y,
  203. int dst_stride_y,
  204. int width,
  205. int height);
  206. // Convert ARGB to G. (Reverse of J400toARGB, which replicates G back to ARGB)
  207. LIBYUV_API
  208. int ARGBToG(const uint8_t* src_argb,
  209. int src_stride_argb,
  210. uint8_t* dst_g,
  211. int dst_stride_g,
  212. int width,
  213. int height);
  214. // Convert ARGB To NV12.
  215. LIBYUV_API
  216. int ARGBToNV12(const uint8_t* src_argb,
  217. int src_stride_argb,
  218. uint8_t* dst_y,
  219. int dst_stride_y,
  220. uint8_t* dst_uv,
  221. int dst_stride_uv,
  222. int width,
  223. int height);
  224. // Convert ARGB To NV21.
  225. LIBYUV_API
  226. int ARGBToNV21(const uint8_t* src_argb,
  227. int src_stride_argb,
  228. uint8_t* dst_y,
  229. int dst_stride_y,
  230. uint8_t* dst_vu,
  231. int dst_stride_vu,
  232. int width,
  233. int height);
  234. // Convert ABGR To NV12.
  235. LIBYUV_API
  236. int ABGRToNV12(const uint8_t* src_abgr,
  237. int src_stride_abgr,
  238. uint8_t* dst_y,
  239. int dst_stride_y,
  240. uint8_t* dst_uv,
  241. int dst_stride_uv,
  242. int width,
  243. int height);
  244. // Convert ABGR To NV21.
  245. LIBYUV_API
  246. int ABGRToNV21(const uint8_t* src_abgr,
  247. int src_stride_abgr,
  248. uint8_t* dst_y,
  249. int dst_stride_y,
  250. uint8_t* dst_vu,
  251. int dst_stride_vu,
  252. int width,
  253. int height);
  254. // Convert ARGB To NV21.
  255. LIBYUV_API
  256. int ARGBToNV21(const uint8_t* src_argb,
  257. int src_stride_argb,
  258. uint8_t* dst_y,
  259. int dst_stride_y,
  260. uint8_t* dst_vu,
  261. int dst_stride_vu,
  262. int width,
  263. int height);
  264. // Convert ARGB To YUY2.
  265. LIBYUV_API
  266. int ARGBToYUY2(const uint8_t* src_argb,
  267. int src_stride_argb,
  268. uint8_t* dst_yuy2,
  269. int dst_stride_yuy2,
  270. int width,
  271. int height);
  272. // Convert ARGB To UYVY.
  273. LIBYUV_API
  274. int ARGBToUYVY(const uint8_t* src_argb,
  275. int src_stride_argb,
  276. uint8_t* dst_uyvy,
  277. int dst_stride_uyvy,
  278. int width,
  279. int height);
  280. #ifdef __cplusplus
  281. } // extern "C"
  282. } // namespace libyuv
  283. #endif
  284. #endif // INCLUDE_LIBYUV_CONVERT_FROM_ARGB_H_