convert_argb.h 30 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042
  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_ARGB_H_
  11. #define INCLUDE_LIBYUV_CONVERT_ARGB_H_
  12. #include "libyuv/basic_types.h"
  13. #include "libyuv/rotate.h" // For enum RotationMode.
  14. // TODO(fbarchard): This set of functions should exactly match convert.h
  15. // TODO(fbarchard): Add tests. Create random content of right size and convert
  16. // with C vs Opt and or to I420 and compare.
  17. // TODO(fbarchard): Some of these functions lack parameter setting.
  18. #ifdef __cplusplus
  19. namespace libyuv {
  20. extern "C" {
  21. #endif
  22. // Alias.
  23. #define ARGBToARGB ARGBCopy
  24. // Copy ARGB to ARGB.
  25. LIBYUV_API
  26. int ARGBCopy(const uint8_t* src_argb,
  27. int src_stride_argb,
  28. uint8_t* dst_argb,
  29. int dst_stride_argb,
  30. int width,
  31. int height);
  32. // Convert I420 to ARGB.
  33. LIBYUV_API
  34. int I420ToARGB(const uint8_t* src_y,
  35. int src_stride_y,
  36. const uint8_t* src_u,
  37. int src_stride_u,
  38. const uint8_t* src_v,
  39. int src_stride_v,
  40. uint8_t* dst_argb,
  41. int dst_stride_argb,
  42. int width,
  43. int height);
  44. // Convert I420 to ABGR.
  45. LIBYUV_API
  46. int I420ToABGR(const uint8_t* src_y,
  47. int src_stride_y,
  48. const uint8_t* src_u,
  49. int src_stride_u,
  50. const uint8_t* src_v,
  51. int src_stride_v,
  52. uint8_t* dst_abgr,
  53. int dst_stride_abgr,
  54. int width,
  55. int height);
  56. // Convert J420 to ARGB.
  57. LIBYUV_API
  58. int J420ToARGB(const uint8_t* src_y,
  59. int src_stride_y,
  60. const uint8_t* src_u,
  61. int src_stride_u,
  62. const uint8_t* src_v,
  63. int src_stride_v,
  64. uint8_t* dst_argb,
  65. int dst_stride_argb,
  66. int width,
  67. int height);
  68. // Convert J420 to ABGR.
  69. LIBYUV_API
  70. int J420ToABGR(const uint8_t* src_y,
  71. int src_stride_y,
  72. const uint8_t* src_u,
  73. int src_stride_u,
  74. const uint8_t* src_v,
  75. int src_stride_v,
  76. uint8_t* dst_abgr,
  77. int dst_stride_abgr,
  78. int width,
  79. int height);
  80. // Convert H420 to ARGB.
  81. LIBYUV_API
  82. int H420ToARGB(const uint8_t* src_y,
  83. int src_stride_y,
  84. const uint8_t* src_u,
  85. int src_stride_u,
  86. const uint8_t* src_v,
  87. int src_stride_v,
  88. uint8_t* dst_argb,
  89. int dst_stride_argb,
  90. int width,
  91. int height);
  92. // Convert H420 to ABGR.
  93. LIBYUV_API
  94. int H420ToABGR(const uint8_t* src_y,
  95. int src_stride_y,
  96. const uint8_t* src_u,
  97. int src_stride_u,
  98. const uint8_t* src_v,
  99. int src_stride_v,
  100. uint8_t* dst_abgr,
  101. int dst_stride_abgr,
  102. int width,
  103. int height);
  104. // Convert U420 to ARGB.
  105. LIBYUV_API
  106. int U420ToARGB(const uint8_t* src_y,
  107. int src_stride_y,
  108. const uint8_t* src_u,
  109. int src_stride_u,
  110. const uint8_t* src_v,
  111. int src_stride_v,
  112. uint8_t* dst_argb,
  113. int dst_stride_argb,
  114. int width,
  115. int height);
  116. // Convert U420 to ABGR.
  117. LIBYUV_API
  118. int U420ToABGR(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_abgr,
  125. int dst_stride_abgr,
  126. int width,
  127. int height);
  128. // Convert I422 to ARGB.
  129. LIBYUV_API
  130. int I422ToARGB(const uint8_t* src_y,
  131. int src_stride_y,
  132. const uint8_t* src_u,
  133. int src_stride_u,
  134. const uint8_t* src_v,
  135. int src_stride_v,
  136. uint8_t* dst_argb,
  137. int dst_stride_argb,
  138. int width,
  139. int height);
  140. // Convert I422 to ABGR.
  141. LIBYUV_API
  142. int I422ToABGR(const uint8_t* src_y,
  143. int src_stride_y,
  144. const uint8_t* src_u,
  145. int src_stride_u,
  146. const uint8_t* src_v,
  147. int src_stride_v,
  148. uint8_t* dst_abgr,
  149. int dst_stride_abgr,
  150. int width,
  151. int height);
  152. // Convert J422 to ARGB.
  153. LIBYUV_API
  154. int J422ToARGB(const uint8_t* src_y,
  155. int src_stride_y,
  156. const uint8_t* src_u,
  157. int src_stride_u,
  158. const uint8_t* src_v,
  159. int src_stride_v,
  160. uint8_t* dst_argb,
  161. int dst_stride_argb,
  162. int width,
  163. int height);
  164. // Convert J422 to ABGR.
  165. LIBYUV_API
  166. int J422ToABGR(const uint8_t* src_y,
  167. int src_stride_y,
  168. const uint8_t* src_u,
  169. int src_stride_u,
  170. const uint8_t* src_v,
  171. int src_stride_v,
  172. uint8_t* dst_abgr,
  173. int dst_stride_abgr,
  174. int width,
  175. int height);
  176. // Convert H422 to ARGB.
  177. LIBYUV_API
  178. int H422ToARGB(const uint8_t* src_y,
  179. int src_stride_y,
  180. const uint8_t* src_u,
  181. int src_stride_u,
  182. const uint8_t* src_v,
  183. int src_stride_v,
  184. uint8_t* dst_argb,
  185. int dst_stride_argb,
  186. int width,
  187. int height);
  188. // Convert H422 to ABGR.
  189. LIBYUV_API
  190. int H422ToABGR(const uint8_t* src_y,
  191. int src_stride_y,
  192. const uint8_t* src_u,
  193. int src_stride_u,
  194. const uint8_t* src_v,
  195. int src_stride_v,
  196. uint8_t* dst_abgr,
  197. int dst_stride_abgr,
  198. int width,
  199. int height);
  200. // Convert U422 to ARGB.
  201. LIBYUV_API
  202. int U422ToARGB(const uint8_t* src_y,
  203. int src_stride_y,
  204. const uint8_t* src_u,
  205. int src_stride_u,
  206. const uint8_t* src_v,
  207. int src_stride_v,
  208. uint8_t* dst_argb,
  209. int dst_stride_argb,
  210. int width,
  211. int height);
  212. // Convert U422 to ABGR.
  213. LIBYUV_API
  214. int U422ToABGR(const uint8_t* src_y,
  215. int src_stride_y,
  216. const uint8_t* src_u,
  217. int src_stride_u,
  218. const uint8_t* src_v,
  219. int src_stride_v,
  220. uint8_t* dst_abgr,
  221. int dst_stride_abgr,
  222. int width,
  223. int height);
  224. // Convert I444 to ARGB.
  225. LIBYUV_API
  226. int I444ToARGB(const uint8_t* src_y,
  227. int src_stride_y,
  228. const uint8_t* src_u,
  229. int src_stride_u,
  230. const uint8_t* src_v,
  231. int src_stride_v,
  232. uint8_t* dst_argb,
  233. int dst_stride_argb,
  234. int width,
  235. int height);
  236. // Convert I444 to ABGR.
  237. LIBYUV_API
  238. int I444ToABGR(const uint8_t* src_y,
  239. int src_stride_y,
  240. const uint8_t* src_u,
  241. int src_stride_u,
  242. const uint8_t* src_v,
  243. int src_stride_v,
  244. uint8_t* dst_abgr,
  245. int dst_stride_abgr,
  246. int width,
  247. int height);
  248. // Convert J444 to ARGB.
  249. LIBYUV_API
  250. int J444ToARGB(const uint8_t* src_y,
  251. int src_stride_y,
  252. const uint8_t* src_u,
  253. int src_stride_u,
  254. const uint8_t* src_v,
  255. int src_stride_v,
  256. uint8_t* dst_argb,
  257. int dst_stride_argb,
  258. int width,
  259. int height);
  260. // Convert J444 to ABGR.
  261. LIBYUV_API
  262. int J444ToABGR(const uint8_t* src_y,
  263. int src_stride_y,
  264. const uint8_t* src_u,
  265. int src_stride_u,
  266. const uint8_t* src_v,
  267. int src_stride_v,
  268. uint8_t* dst_abgr,
  269. int dst_stride_abgr,
  270. int width,
  271. int height);
  272. // Convert H444 to ARGB.
  273. LIBYUV_API
  274. int H444ToARGB(const uint8_t* src_y,
  275. int src_stride_y,
  276. const uint8_t* src_u,
  277. int src_stride_u,
  278. const uint8_t* src_v,
  279. int src_stride_v,
  280. uint8_t* dst_argb,
  281. int dst_stride_argb,
  282. int width,
  283. int height);
  284. // Convert H444 to ABGR.
  285. LIBYUV_API
  286. int H444ToABGR(const uint8_t* src_y,
  287. int src_stride_y,
  288. const uint8_t* src_u,
  289. int src_stride_u,
  290. const uint8_t* src_v,
  291. int src_stride_v,
  292. uint8_t* dst_abgr,
  293. int dst_stride_abgr,
  294. int width,
  295. int height);
  296. // Convert U444 to ARGB.
  297. LIBYUV_API
  298. int U444ToARGB(const uint8_t* src_y,
  299. int src_stride_y,
  300. const uint8_t* src_u,
  301. int src_stride_u,
  302. const uint8_t* src_v,
  303. int src_stride_v,
  304. uint8_t* dst_argb,
  305. int dst_stride_argb,
  306. int width,
  307. int height);
  308. // Convert U444 to ABGR.
  309. LIBYUV_API
  310. int U444ToABGR(const uint8_t* src_y,
  311. int src_stride_y,
  312. const uint8_t* src_u,
  313. int src_stride_u,
  314. const uint8_t* src_v,
  315. int src_stride_v,
  316. uint8_t* dst_abgr,
  317. int dst_stride_abgr,
  318. int width,
  319. int height);
  320. // Convert I010 to ARGB.
  321. LIBYUV_API
  322. int I010ToARGB(const uint16_t* src_y,
  323. int src_stride_y,
  324. const uint16_t* src_u,
  325. int src_stride_u,
  326. const uint16_t* src_v,
  327. int src_stride_v,
  328. uint8_t* dst_argb,
  329. int dst_stride_argb,
  330. int width,
  331. int height);
  332. // Convert I010 to ABGR.
  333. LIBYUV_API
  334. int I010ToABGR(const uint16_t* src_y,
  335. int src_stride_y,
  336. const uint16_t* src_u,
  337. int src_stride_u,
  338. const uint16_t* src_v,
  339. int src_stride_v,
  340. uint8_t* dst_abgr,
  341. int dst_stride_abgr,
  342. int width,
  343. int height);
  344. // Convert H010 to ARGB.
  345. LIBYUV_API
  346. int H010ToARGB(const uint16_t* src_y,
  347. int src_stride_y,
  348. const uint16_t* src_u,
  349. int src_stride_u,
  350. const uint16_t* src_v,
  351. int src_stride_v,
  352. uint8_t* dst_argb,
  353. int dst_stride_argb,
  354. int width,
  355. int height);
  356. // Convert H010 to ABGR.
  357. LIBYUV_API
  358. int H010ToABGR(const uint16_t* src_y,
  359. int src_stride_y,
  360. const uint16_t* src_u,
  361. int src_stride_u,
  362. const uint16_t* src_v,
  363. int src_stride_v,
  364. uint8_t* dst_abgr,
  365. int dst_stride_abgr,
  366. int width,
  367. int height);
  368. // Convert U010 to ARGB.
  369. LIBYUV_API
  370. int U010ToARGB(const uint16_t* src_y,
  371. int src_stride_y,
  372. const uint16_t* src_u,
  373. int src_stride_u,
  374. const uint16_t* src_v,
  375. int src_stride_v,
  376. uint8_t* dst_argb,
  377. int dst_stride_argb,
  378. int width,
  379. int height);
  380. // Convert U010 to ABGR.
  381. LIBYUV_API
  382. int U010ToABGR(const uint16_t* src_y,
  383. int src_stride_y,
  384. const uint16_t* src_u,
  385. int src_stride_u,
  386. const uint16_t* src_v,
  387. int src_stride_v,
  388. uint8_t* dst_abgr,
  389. int dst_stride_abgr,
  390. int width,
  391. int height);
  392. // Convert I210 to ARGB.
  393. LIBYUV_API
  394. int I210ToARGB(const uint16_t* src_y,
  395. int src_stride_y,
  396. const uint16_t* src_u,
  397. int src_stride_u,
  398. const uint16_t* src_v,
  399. int src_stride_v,
  400. uint8_t* dst_argb,
  401. int dst_stride_argb,
  402. int width,
  403. int height);
  404. // Convert I210 to ABGR.
  405. LIBYUV_API
  406. int I210ToABGR(const uint16_t* src_y,
  407. int src_stride_y,
  408. const uint16_t* src_u,
  409. int src_stride_u,
  410. const uint16_t* src_v,
  411. int src_stride_v,
  412. uint8_t* dst_abgr,
  413. int dst_stride_abgr,
  414. int width,
  415. int height);
  416. // Convert H210 to ARGB.
  417. LIBYUV_API
  418. int H210ToARGB(const uint16_t* src_y,
  419. int src_stride_y,
  420. const uint16_t* src_u,
  421. int src_stride_u,
  422. const uint16_t* src_v,
  423. int src_stride_v,
  424. uint8_t* dst_argb,
  425. int dst_stride_argb,
  426. int width,
  427. int height);
  428. // Convert H210 to ABGR.
  429. LIBYUV_API
  430. int H210ToABGR(const uint16_t* src_y,
  431. int src_stride_y,
  432. const uint16_t* src_u,
  433. int src_stride_u,
  434. const uint16_t* src_v,
  435. int src_stride_v,
  436. uint8_t* dst_abgr,
  437. int dst_stride_abgr,
  438. int width,
  439. int height);
  440. // Convert U210 to ARGB.
  441. LIBYUV_API
  442. int U210ToARGB(const uint16_t* src_y,
  443. int src_stride_y,
  444. const uint16_t* src_u,
  445. int src_stride_u,
  446. const uint16_t* src_v,
  447. int src_stride_v,
  448. uint8_t* dst_argb,
  449. int dst_stride_argb,
  450. int width,
  451. int height);
  452. // Convert U210 to ABGR.
  453. LIBYUV_API
  454. int U210ToABGR(const uint16_t* src_y,
  455. int src_stride_y,
  456. const uint16_t* src_u,
  457. int src_stride_u,
  458. const uint16_t* src_v,
  459. int src_stride_v,
  460. uint8_t* dst_abgr,
  461. int dst_stride_abgr,
  462. int width,
  463. int height);
  464. // Convert I420 with Alpha to preattenuated ARGB.
  465. LIBYUV_API
  466. int I420AlphaToARGB(const uint8_t* src_y,
  467. int src_stride_y,
  468. const uint8_t* src_u,
  469. int src_stride_u,
  470. const uint8_t* src_v,
  471. int src_stride_v,
  472. const uint8_t* src_a,
  473. int src_stride_a,
  474. uint8_t* dst_argb,
  475. int dst_stride_argb,
  476. int width,
  477. int height,
  478. int attenuate);
  479. // Convert I420 with Alpha to preattenuated ABGR.
  480. LIBYUV_API
  481. int I420AlphaToABGR(const uint8_t* src_y,
  482. int src_stride_y,
  483. const uint8_t* src_u,
  484. int src_stride_u,
  485. const uint8_t* src_v,
  486. int src_stride_v,
  487. const uint8_t* src_a,
  488. int src_stride_a,
  489. uint8_t* dst_abgr,
  490. int dst_stride_abgr,
  491. int width,
  492. int height,
  493. int attenuate);
  494. // Convert I400 (grey) to ARGB. Reverse of ARGBToI400.
  495. LIBYUV_API
  496. int I400ToARGB(const uint8_t* src_y,
  497. int src_stride_y,
  498. uint8_t* dst_argb,
  499. int dst_stride_argb,
  500. int width,
  501. int height);
  502. // Convert J400 (jpeg grey) to ARGB.
  503. LIBYUV_API
  504. int J400ToARGB(const uint8_t* src_y,
  505. int src_stride_y,
  506. uint8_t* dst_argb,
  507. int dst_stride_argb,
  508. int width,
  509. int height);
  510. // Alias.
  511. #define YToARGB I400ToARGB
  512. // Convert NV12 to ARGB.
  513. LIBYUV_API
  514. int NV12ToARGB(const uint8_t* src_y,
  515. int src_stride_y,
  516. const uint8_t* src_uv,
  517. int src_stride_uv,
  518. uint8_t* dst_argb,
  519. int dst_stride_argb,
  520. int width,
  521. int height);
  522. // Convert NV21 to ARGB.
  523. LIBYUV_API
  524. int NV21ToARGB(const uint8_t* src_y,
  525. int src_stride_y,
  526. const uint8_t* src_vu,
  527. int src_stride_vu,
  528. uint8_t* dst_argb,
  529. int dst_stride_argb,
  530. int width,
  531. int height);
  532. // Convert NV12 to ABGR.
  533. LIBYUV_API
  534. int NV12ToABGR(const uint8_t* src_y,
  535. int src_stride_y,
  536. const uint8_t* src_uv,
  537. int src_stride_uv,
  538. uint8_t* dst_abgr,
  539. int dst_stride_abgr,
  540. int width,
  541. int height);
  542. // Convert NV21 to ABGR.
  543. LIBYUV_API
  544. int NV21ToABGR(const uint8_t* src_y,
  545. int src_stride_y,
  546. const uint8_t* src_vu,
  547. int src_stride_vu,
  548. uint8_t* dst_abgr,
  549. int dst_stride_abgr,
  550. int width,
  551. int height);
  552. // Convert NV12 to RGB24.
  553. LIBYUV_API
  554. int NV12ToRGB24(const uint8_t* src_y,
  555. int src_stride_y,
  556. const uint8_t* src_uv,
  557. int src_stride_uv,
  558. uint8_t* dst_rgb24,
  559. int dst_stride_rgb24,
  560. int width,
  561. int height);
  562. // Convert NV21 to RGB24.
  563. LIBYUV_API
  564. int NV21ToRGB24(const uint8_t* src_y,
  565. int src_stride_y,
  566. const uint8_t* src_vu,
  567. int src_stride_vu,
  568. uint8_t* dst_rgb24,
  569. int dst_stride_rgb24,
  570. int width,
  571. int height);
  572. // Convert NV21 to YUV24.
  573. LIBYUV_API
  574. int NV21ToYUV24(const uint8_t* src_y,
  575. int src_stride_y,
  576. const uint8_t* src_vu,
  577. int src_stride_vu,
  578. uint8_t* dst_yuv24,
  579. int dst_stride_yuv24,
  580. int width,
  581. int height);
  582. // Convert NV12 to RAW.
  583. LIBYUV_API
  584. int NV12ToRAW(const uint8_t* src_y,
  585. int src_stride_y,
  586. const uint8_t* src_uv,
  587. int src_stride_uv,
  588. uint8_t* dst_raw,
  589. int dst_stride_raw,
  590. int width,
  591. int height);
  592. // Convert NV21 to RAW.
  593. LIBYUV_API
  594. int NV21ToRAW(const uint8_t* src_y,
  595. int src_stride_y,
  596. const uint8_t* src_vu,
  597. int src_stride_vu,
  598. uint8_t* dst_raw,
  599. int dst_stride_raw,
  600. int width,
  601. int height);
  602. // Convert M420 to ARGB.
  603. LIBYUV_API
  604. int M420ToARGB(const uint8_t* src_m420,
  605. int src_stride_m420,
  606. uint8_t* dst_argb,
  607. int dst_stride_argb,
  608. int width,
  609. int height);
  610. // Convert YUY2 to ARGB.
  611. LIBYUV_API
  612. int YUY2ToARGB(const uint8_t* src_yuy2,
  613. int src_stride_yuy2,
  614. uint8_t* dst_argb,
  615. int dst_stride_argb,
  616. int width,
  617. int height);
  618. // Convert UYVY to ARGB.
  619. LIBYUV_API
  620. int UYVYToARGB(const uint8_t* src_uyvy,
  621. int src_stride_uyvy,
  622. uint8_t* dst_argb,
  623. int dst_stride_argb,
  624. int width,
  625. int height);
  626. // Convert I010 to AR30.
  627. LIBYUV_API
  628. int I010ToAR30(const uint16_t* src_y,
  629. int src_stride_y,
  630. const uint16_t* src_u,
  631. int src_stride_u,
  632. const uint16_t* src_v,
  633. int src_stride_v,
  634. uint8_t* dst_ar30,
  635. int dst_stride_ar30,
  636. int width,
  637. int height);
  638. // Convert I010 to AB30.
  639. LIBYUV_API
  640. int I010ToAB30(const uint16_t* src_y,
  641. int src_stride_y,
  642. const uint16_t* src_u,
  643. int src_stride_u,
  644. const uint16_t* src_v,
  645. int src_stride_v,
  646. uint8_t* dst_ab30,
  647. int dst_stride_ab30,
  648. int width,
  649. int height);
  650. // Convert H010 to AR30.
  651. LIBYUV_API
  652. int H010ToAR30(const uint16_t* src_y,
  653. int src_stride_y,
  654. const uint16_t* src_u,
  655. int src_stride_u,
  656. const uint16_t* src_v,
  657. int src_stride_v,
  658. uint8_t* dst_ar30,
  659. int dst_stride_ar30,
  660. int width,
  661. int height);
  662. // Convert H010 to AB30.
  663. LIBYUV_API
  664. int H010ToAB30(const uint16_t* src_y,
  665. int src_stride_y,
  666. const uint16_t* src_u,
  667. int src_stride_u,
  668. const uint16_t* src_v,
  669. int src_stride_v,
  670. uint8_t* dst_ab30,
  671. int dst_stride_ab30,
  672. int width,
  673. int height);
  674. // Convert U010 to AR30.
  675. LIBYUV_API
  676. int U010ToAR30(const uint16_t* src_y,
  677. int src_stride_y,
  678. const uint16_t* src_u,
  679. int src_stride_u,
  680. const uint16_t* src_v,
  681. int src_stride_v,
  682. uint8_t* dst_ar30,
  683. int dst_stride_ar30,
  684. int width,
  685. int height);
  686. // Convert U010 to AB30.
  687. LIBYUV_API
  688. int U010ToAB30(const uint16_t* src_y,
  689. int src_stride_y,
  690. const uint16_t* src_u,
  691. int src_stride_u,
  692. const uint16_t* src_v,
  693. int src_stride_v,
  694. uint8_t* dst_ab30,
  695. int dst_stride_ab30,
  696. int width,
  697. int height);
  698. // Convert I210 to AR30.
  699. LIBYUV_API
  700. int I210ToAR30(const uint16_t* src_y,
  701. int src_stride_y,
  702. const uint16_t* src_u,
  703. int src_stride_u,
  704. const uint16_t* src_v,
  705. int src_stride_v,
  706. uint8_t* dst_ar30,
  707. int dst_stride_ar30,
  708. int width,
  709. int height);
  710. // Convert I210 to AB30.
  711. LIBYUV_API
  712. int I210ToAB30(const uint16_t* src_y,
  713. int src_stride_y,
  714. const uint16_t* src_u,
  715. int src_stride_u,
  716. const uint16_t* src_v,
  717. int src_stride_v,
  718. uint8_t* dst_ab30,
  719. int dst_stride_ab30,
  720. int width,
  721. int height);
  722. // Convert H210 to AR30.
  723. LIBYUV_API
  724. int H210ToAR30(const uint16_t* src_y,
  725. int src_stride_y,
  726. const uint16_t* src_u,
  727. int src_stride_u,
  728. const uint16_t* src_v,
  729. int src_stride_v,
  730. uint8_t* dst_ar30,
  731. int dst_stride_ar30,
  732. int width,
  733. int height);
  734. // Convert H210 to AB30.
  735. LIBYUV_API
  736. int H210ToAB30(const uint16_t* src_y,
  737. int src_stride_y,
  738. const uint16_t* src_u,
  739. int src_stride_u,
  740. const uint16_t* src_v,
  741. int src_stride_v,
  742. uint8_t* dst_ab30,
  743. int dst_stride_ab30,
  744. int width,
  745. int height);
  746. // Convert U210 to AR30.
  747. LIBYUV_API
  748. int U210ToAR30(const uint16_t* src_y,
  749. int src_stride_y,
  750. const uint16_t* src_u,
  751. int src_stride_u,
  752. const uint16_t* src_v,
  753. int src_stride_v,
  754. uint8_t* dst_ar30,
  755. int dst_stride_ar30,
  756. int width,
  757. int height);
  758. // Convert U210 to AB30.
  759. LIBYUV_API
  760. int U210ToAB30(const uint16_t* src_y,
  761. int src_stride_y,
  762. const uint16_t* src_u,
  763. int src_stride_u,
  764. const uint16_t* src_v,
  765. int src_stride_v,
  766. uint8_t* dst_ab30,
  767. int dst_stride_ab30,
  768. int width,
  769. int height);
  770. // BGRA little endian (argb in memory) to ARGB.
  771. LIBYUV_API
  772. int BGRAToARGB(const uint8_t* src_bgra,
  773. int src_stride_bgra,
  774. uint8_t* dst_argb,
  775. int dst_stride_argb,
  776. int width,
  777. int height);
  778. // ABGR little endian (rgba in memory) to ARGB.
  779. LIBYUV_API
  780. int ABGRToARGB(const uint8_t* src_abgr,
  781. int src_stride_abgr,
  782. uint8_t* dst_argb,
  783. int dst_stride_argb,
  784. int width,
  785. int height);
  786. // RGBA little endian (abgr in memory) to ARGB.
  787. LIBYUV_API
  788. int RGBAToARGB(const uint8_t* src_rgba,
  789. int src_stride_rgba,
  790. uint8_t* dst_argb,
  791. int dst_stride_argb,
  792. int width,
  793. int height);
  794. // Deprecated function name.
  795. #define BG24ToARGB RGB24ToARGB
  796. // RGB little endian (bgr in memory) to ARGB.
  797. LIBYUV_API
  798. int RGB24ToARGB(const uint8_t* src_rgb24,
  799. int src_stride_rgb24,
  800. uint8_t* dst_argb,
  801. int dst_stride_argb,
  802. int width,
  803. int height);
  804. // RGB big endian (rgb in memory) to ARGB.
  805. LIBYUV_API
  806. int RAWToARGB(const uint8_t* src_raw,
  807. int src_stride_raw,
  808. uint8_t* dst_argb,
  809. int dst_stride_argb,
  810. int width,
  811. int height);
  812. // RGB big endian (rgb in memory) to RGBA.
  813. LIBYUV_API
  814. int RAWToRGBA(const uint8_t* src_raw,
  815. int src_stride_raw,
  816. uint8_t* dst_rgba,
  817. int dst_stride_rgba,
  818. int width,
  819. int height);
  820. // RGB16 (RGBP fourcc) little endian to ARGB.
  821. LIBYUV_API
  822. int RGB565ToARGB(const uint8_t* src_rgb565,
  823. int src_stride_rgb565,
  824. uint8_t* dst_argb,
  825. int dst_stride_argb,
  826. int width,
  827. int height);
  828. // RGB15 (RGBO fourcc) little endian to ARGB.
  829. LIBYUV_API
  830. int ARGB1555ToARGB(const uint8_t* src_argb1555,
  831. int src_stride_argb1555,
  832. uint8_t* dst_argb,
  833. int dst_stride_argb,
  834. int width,
  835. int height);
  836. // RGB12 (R444 fourcc) little endian to ARGB.
  837. LIBYUV_API
  838. int ARGB4444ToARGB(const uint8_t* src_argb4444,
  839. int src_stride_argb4444,
  840. uint8_t* dst_argb,
  841. int dst_stride_argb,
  842. int width,
  843. int height);
  844. // Aliases
  845. #define AB30ToARGB AR30ToABGR
  846. #define AB30ToABGR AR30ToARGB
  847. #define AB30ToAR30 AR30ToAB30
  848. // Convert AR30 To ARGB.
  849. LIBYUV_API
  850. int AR30ToARGB(const uint8_t* src_ar30,
  851. int src_stride_ar30,
  852. uint8_t* dst_argb,
  853. int dst_stride_argb,
  854. int width,
  855. int height);
  856. // Convert AR30 To ABGR.
  857. LIBYUV_API
  858. int AR30ToABGR(const uint8_t* src_ar30,
  859. int src_stride_ar30,
  860. uint8_t* dst_abgr,
  861. int dst_stride_abgr,
  862. int width,
  863. int height);
  864. // Convert AR30 To AB30.
  865. LIBYUV_API
  866. int AR30ToAB30(const uint8_t* src_ar30,
  867. int src_stride_ar30,
  868. uint8_t* dst_ab30,
  869. int dst_stride_ab30,
  870. int width,
  871. int height);
  872. #ifdef HAVE_JPEG
  873. // src_width/height provided by capture
  874. // dst_width/height for clipping determine final size.
  875. LIBYUV_API
  876. int MJPGToARGB(const uint8_t* sample,
  877. size_t sample_size,
  878. uint8_t* dst_argb,
  879. int dst_stride_argb,
  880. int src_width,
  881. int src_height,
  882. int dst_width,
  883. int dst_height);
  884. #endif
  885. // Convert Android420 to ARGB.
  886. LIBYUV_API
  887. int Android420ToARGB(const uint8_t* src_y,
  888. int src_stride_y,
  889. const uint8_t* src_u,
  890. int src_stride_u,
  891. const uint8_t* src_v,
  892. int src_stride_v,
  893. int src_pixel_stride_uv,
  894. uint8_t* dst_argb,
  895. int dst_stride_argb,
  896. int width,
  897. int height);
  898. // Convert Android420 to ABGR.
  899. LIBYUV_API
  900. int Android420ToABGR(const uint8_t* src_y,
  901. int src_stride_y,
  902. const uint8_t* src_u,
  903. int src_stride_u,
  904. const uint8_t* src_v,
  905. int src_stride_v,
  906. int src_pixel_stride_uv,
  907. uint8_t* dst_abgr,
  908. int dst_stride_abgr,
  909. int width,
  910. int height);
  911. // Convert camera sample to ARGB with cropping, rotation and vertical flip.
  912. // "sample_size" is needed to parse MJPG.
  913. // "dst_stride_argb" number of bytes in a row of the dst_argb plane.
  914. // Normally this would be the same as dst_width, with recommended alignment
  915. // to 16 bytes for better efficiency.
  916. // If rotation of 90 or 270 is used, stride is affected. The caller should
  917. // allocate the I420 buffer according to rotation.
  918. // "dst_stride_u" number of bytes in a row of the dst_u plane.
  919. // Normally this would be the same as (dst_width + 1) / 2, with
  920. // recommended alignment to 16 bytes for better efficiency.
  921. // If rotation of 90 or 270 is used, stride is affected.
  922. // "crop_x" and "crop_y" are starting position for cropping.
  923. // To center, crop_x = (src_width - dst_width) / 2
  924. // crop_y = (src_height - dst_height) / 2
  925. // "src_width" / "src_height" is size of src_frame in pixels.
  926. // "src_height" can be negative indicating a vertically flipped image source.
  927. // "crop_width" / "crop_height" is the size to crop the src to.
  928. // Must be less than or equal to src_width/src_height
  929. // Cropping parameters are pre-rotation.
  930. // "rotation" can be 0, 90, 180 or 270.
  931. // "fourcc" is a fourcc. ie 'I420', 'YUY2'
  932. // Returns 0 for successful; -1 for invalid parameter. Non-zero for failure.
  933. LIBYUV_API
  934. int ConvertToARGB(const uint8_t* sample,
  935. size_t sample_size,
  936. uint8_t* dst_argb,
  937. int dst_stride_argb,
  938. int crop_x,
  939. int crop_y,
  940. int src_width,
  941. int src_height,
  942. int crop_width,
  943. int crop_height,
  944. enum RotationMode rotation,
  945. uint32_t fourcc);
  946. #ifdef __cplusplus
  947. } // extern "C"
  948. } // namespace libyuv
  949. #endif
  950. #endif // INCLUDE_LIBYUV_CONVERT_ARGB_H_