planar_functions.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  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_PLANAR_FUNCTIONS_H_
  11. #define INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_
  12. #include "libyuv/basic_types.h"
  13. // TODO(fbarchard): Remove the following headers includes.
  14. #include "libyuv/convert.h"
  15. #include "libyuv/convert_argb.h"
  16. #ifdef __cplusplus
  17. namespace libyuv {
  18. extern "C" {
  19. #endif
  20. // Copy a plane of data.
  21. LIBYUV_API
  22. void CopyPlane(const uint8* src_y,
  23. int src_stride_y,
  24. uint8* dst_y,
  25. int dst_stride_y,
  26. int width,
  27. int height);
  28. LIBYUV_API
  29. void CopyPlane_16(const uint16* src_y,
  30. int src_stride_y,
  31. uint16* dst_y,
  32. int dst_stride_y,
  33. int width,
  34. int height);
  35. // Set a plane of data to a 32 bit value.
  36. LIBYUV_API
  37. void SetPlane(uint8* dst_y,
  38. int dst_stride_y,
  39. int width,
  40. int height,
  41. uint32 value);
  42. // Split interleaved UV plane into separate U and V planes.
  43. LIBYUV_API
  44. void SplitUVPlane(const uint8* src_uv,
  45. int src_stride_uv,
  46. uint8* dst_u,
  47. int dst_stride_u,
  48. uint8* dst_v,
  49. int dst_stride_v,
  50. int width,
  51. int height);
  52. // Merge separate U and V planes into one interleaved UV plane.
  53. LIBYUV_API
  54. void MergeUVPlane(const uint8* src_u,
  55. int src_stride_u,
  56. const uint8* src_v,
  57. int src_stride_v,
  58. uint8* dst_uv,
  59. int dst_stride_uv,
  60. int width,
  61. int height);
  62. // Split interleaved RGB plane into separate R, G and B planes.
  63. LIBYUV_API
  64. void SplitRGBPlane(const uint8* src_rgb,
  65. int src_stride_rgb,
  66. uint8* dst_r,
  67. int dst_stride_r,
  68. uint8* dst_g,
  69. int dst_stride_g,
  70. uint8* dst_b,
  71. int dst_stride_b,
  72. int width,
  73. int height);
  74. // Merge separate R, G and B planes into one interleaved RGB plane.
  75. LIBYUV_API
  76. void MergeRGBPlane(const uint8* src_r,
  77. int src_stride_r,
  78. const uint8* src_g,
  79. int src_stride_g,
  80. const uint8* src_b,
  81. int src_stride_b,
  82. uint8* dst_rgb,
  83. int dst_stride_rgb,
  84. int width,
  85. int height);
  86. // Copy I400. Supports inverting.
  87. LIBYUV_API
  88. int I400ToI400(const uint8* src_y,
  89. int src_stride_y,
  90. uint8* dst_y,
  91. int dst_stride_y,
  92. int width,
  93. int height);
  94. #define J400ToJ400 I400ToI400
  95. // Copy I422 to I422.
  96. #define I422ToI422 I422Copy
  97. LIBYUV_API
  98. int I422Copy(const uint8* src_y,
  99. int src_stride_y,
  100. const uint8* src_u,
  101. int src_stride_u,
  102. const uint8* src_v,
  103. int src_stride_v,
  104. uint8* dst_y,
  105. int dst_stride_y,
  106. uint8* dst_u,
  107. int dst_stride_u,
  108. uint8* dst_v,
  109. int dst_stride_v,
  110. int width,
  111. int height);
  112. // Copy I444 to I444.
  113. #define I444ToI444 I444Copy
  114. LIBYUV_API
  115. int I444Copy(const uint8* src_y,
  116. int src_stride_y,
  117. const uint8* src_u,
  118. int src_stride_u,
  119. const uint8* src_v,
  120. int src_stride_v,
  121. uint8* dst_y,
  122. int dst_stride_y,
  123. uint8* dst_u,
  124. int dst_stride_u,
  125. uint8* dst_v,
  126. int dst_stride_v,
  127. int width,
  128. int height);
  129. // Convert YUY2 to I422.
  130. LIBYUV_API
  131. int YUY2ToI422(const uint8* src_yuy2,
  132. int src_stride_yuy2,
  133. uint8* dst_y,
  134. int dst_stride_y,
  135. uint8* dst_u,
  136. int dst_stride_u,
  137. uint8* dst_v,
  138. int dst_stride_v,
  139. int width,
  140. int height);
  141. // Convert UYVY to I422.
  142. LIBYUV_API
  143. int UYVYToI422(const uint8* src_uyvy,
  144. int src_stride_uyvy,
  145. uint8* dst_y,
  146. int dst_stride_y,
  147. uint8* dst_u,
  148. int dst_stride_u,
  149. uint8* dst_v,
  150. int dst_stride_v,
  151. int width,
  152. int height);
  153. LIBYUV_API
  154. int YUY2ToNV12(const uint8* src_yuy2,
  155. int src_stride_yuy2,
  156. uint8* dst_y,
  157. int dst_stride_y,
  158. uint8* dst_uv,
  159. int dst_stride_uv,
  160. int width,
  161. int height);
  162. LIBYUV_API
  163. int UYVYToNV12(const uint8* src_uyvy,
  164. int src_stride_uyvy,
  165. uint8* dst_y,
  166. int dst_stride_y,
  167. uint8* dst_uv,
  168. int dst_stride_uv,
  169. int width,
  170. int height);
  171. LIBYUV_API
  172. int YUY2ToY(const uint8* src_yuy2,
  173. int src_stride_yuy2,
  174. uint8* dst_y,
  175. int dst_stride_y,
  176. int width,
  177. int height);
  178. // Convert I420 to I400. (calls CopyPlane ignoring u/v).
  179. LIBYUV_API
  180. int I420ToI400(const uint8* src_y,
  181. int src_stride_y,
  182. const uint8* src_u,
  183. int src_stride_u,
  184. const uint8* src_v,
  185. int src_stride_v,
  186. uint8* dst_y,
  187. int dst_stride_y,
  188. int width,
  189. int height);
  190. // Alias
  191. #define J420ToJ400 I420ToI400
  192. #define I420ToI420Mirror I420Mirror
  193. // I420 mirror.
  194. LIBYUV_API
  195. int I420Mirror(const uint8* src_y,
  196. int src_stride_y,
  197. const uint8* src_u,
  198. int src_stride_u,
  199. const uint8* src_v,
  200. int src_stride_v,
  201. uint8* dst_y,
  202. int dst_stride_y,
  203. uint8* dst_u,
  204. int dst_stride_u,
  205. uint8* dst_v,
  206. int dst_stride_v,
  207. int width,
  208. int height);
  209. // Alias
  210. #define I400ToI400Mirror I400Mirror
  211. // I400 mirror. A single plane is mirrored horizontally.
  212. // Pass negative height to achieve 180 degree rotation.
  213. LIBYUV_API
  214. int I400Mirror(const uint8* src_y,
  215. int src_stride_y,
  216. uint8* dst_y,
  217. int dst_stride_y,
  218. int width,
  219. int height);
  220. // Alias
  221. #define ARGBToARGBMirror ARGBMirror
  222. // ARGB mirror.
  223. LIBYUV_API
  224. int ARGBMirror(const uint8* src_argb,
  225. int src_stride_argb,
  226. uint8* dst_argb,
  227. int dst_stride_argb,
  228. int width,
  229. int height);
  230. // Convert NV12 to RGB565.
  231. LIBYUV_API
  232. int NV12ToRGB565(const uint8* src_y,
  233. int src_stride_y,
  234. const uint8* src_uv,
  235. int src_stride_uv,
  236. uint8* dst_rgb565,
  237. int dst_stride_rgb565,
  238. int width,
  239. int height);
  240. // I422ToARGB is in convert_argb.h
  241. // Convert I422 to BGRA.
  242. LIBYUV_API
  243. int I422ToBGRA(const uint8* src_y,
  244. int src_stride_y,
  245. const uint8* src_u,
  246. int src_stride_u,
  247. const uint8* src_v,
  248. int src_stride_v,
  249. uint8* dst_bgra,
  250. int dst_stride_bgra,
  251. int width,
  252. int height);
  253. // Convert I422 to ABGR.
  254. LIBYUV_API
  255. int I422ToABGR(const uint8* src_y,
  256. int src_stride_y,
  257. const uint8* src_u,
  258. int src_stride_u,
  259. const uint8* src_v,
  260. int src_stride_v,
  261. uint8* dst_abgr,
  262. int dst_stride_abgr,
  263. int width,
  264. int height);
  265. // Convert I422 to RGBA.
  266. LIBYUV_API
  267. int I422ToRGBA(const uint8* src_y,
  268. int src_stride_y,
  269. const uint8* src_u,
  270. int src_stride_u,
  271. const uint8* src_v,
  272. int src_stride_v,
  273. uint8* dst_rgba,
  274. int dst_stride_rgba,
  275. int width,
  276. int height);
  277. // Alias
  278. #define RGB24ToRAW RAWToRGB24
  279. LIBYUV_API
  280. int RAWToRGB24(const uint8* src_raw,
  281. int src_stride_raw,
  282. uint8* dst_rgb24,
  283. int dst_stride_rgb24,
  284. int width,
  285. int height);
  286. // Draw a rectangle into I420.
  287. LIBYUV_API
  288. int I420Rect(uint8* dst_y,
  289. int dst_stride_y,
  290. uint8* dst_u,
  291. int dst_stride_u,
  292. uint8* dst_v,
  293. int dst_stride_v,
  294. int x,
  295. int y,
  296. int width,
  297. int height,
  298. int value_y,
  299. int value_u,
  300. int value_v);
  301. // Draw a rectangle into ARGB.
  302. LIBYUV_API
  303. int ARGBRect(uint8* dst_argb,
  304. int dst_stride_argb,
  305. int x,
  306. int y,
  307. int width,
  308. int height,
  309. uint32 value);
  310. // Convert ARGB to gray scale ARGB.
  311. LIBYUV_API
  312. int ARGBGrayTo(const uint8* src_argb,
  313. int src_stride_argb,
  314. uint8* dst_argb,
  315. int dst_stride_argb,
  316. int width,
  317. int height);
  318. // Make a rectangle of ARGB gray scale.
  319. LIBYUV_API
  320. int ARGBGray(uint8* dst_argb,
  321. int dst_stride_argb,
  322. int x,
  323. int y,
  324. int width,
  325. int height);
  326. // Make a rectangle of ARGB Sepia tone.
  327. LIBYUV_API
  328. int ARGBSepia(uint8* dst_argb,
  329. int dst_stride_argb,
  330. int x,
  331. int y,
  332. int width,
  333. int height);
  334. // Apply a matrix rotation to each ARGB pixel.
  335. // matrix_argb is 4 signed ARGB values. -128 to 127 representing -2 to 2.
  336. // The first 4 coefficients apply to B, G, R, A and produce B of the output.
  337. // The next 4 coefficients apply to B, G, R, A and produce G of the output.
  338. // The next 4 coefficients apply to B, G, R, A and produce R of the output.
  339. // The last 4 coefficients apply to B, G, R, A and produce A of the output.
  340. LIBYUV_API
  341. int ARGBColorMatrix(const uint8* src_argb,
  342. int src_stride_argb,
  343. uint8* dst_argb,
  344. int dst_stride_argb,
  345. const int8* matrix_argb,
  346. int width,
  347. int height);
  348. // Deprecated. Use ARGBColorMatrix instead.
  349. // Apply a matrix rotation to each ARGB pixel.
  350. // matrix_argb is 3 signed ARGB values. -128 to 127 representing -1 to 1.
  351. // The first 4 coefficients apply to B, G, R, A and produce B of the output.
  352. // The next 4 coefficients apply to B, G, R, A and produce G of the output.
  353. // The last 4 coefficients apply to B, G, R, A and produce R of the output.
  354. LIBYUV_API
  355. int RGBColorMatrix(uint8* dst_argb,
  356. int dst_stride_argb,
  357. const int8* matrix_rgb,
  358. int x,
  359. int y,
  360. int width,
  361. int height);
  362. // Apply a color table each ARGB pixel.
  363. // Table contains 256 ARGB values.
  364. LIBYUV_API
  365. int ARGBColorTable(uint8* dst_argb,
  366. int dst_stride_argb,
  367. const uint8* table_argb,
  368. int x,
  369. int y,
  370. int width,
  371. int height);
  372. // Apply a color table each ARGB pixel but preserve destination alpha.
  373. // Table contains 256 ARGB values.
  374. LIBYUV_API
  375. int RGBColorTable(uint8* dst_argb,
  376. int dst_stride_argb,
  377. const uint8* table_argb,
  378. int x,
  379. int y,
  380. int width,
  381. int height);
  382. // Apply a luma/color table each ARGB pixel but preserve destination alpha.
  383. // Table contains 32768 values indexed by [Y][C] where 7 it 7 bit luma from
  384. // RGB (YJ style) and C is an 8 bit color component (R, G or B).
  385. LIBYUV_API
  386. int ARGBLumaColorTable(const uint8* src_argb,
  387. int src_stride_argb,
  388. uint8* dst_argb,
  389. int dst_stride_argb,
  390. const uint8* luma_rgb_table,
  391. int width,
  392. int height);
  393. // Apply a 3 term polynomial to ARGB values.
  394. // poly points to a 4x4 matrix. The first row is constants. The 2nd row is
  395. // coefficients for b, g, r and a. The 3rd row is coefficients for b squared,
  396. // g squared, r squared and a squared. The 4rd row is coefficients for b to
  397. // the 3, g to the 3, r to the 3 and a to the 3. The values are summed and
  398. // result clamped to 0 to 255.
  399. // A polynomial approximation can be dirived using software such as 'R'.
  400. LIBYUV_API
  401. int ARGBPolynomial(const uint8* src_argb,
  402. int src_stride_argb,
  403. uint8* dst_argb,
  404. int dst_stride_argb,
  405. const float* poly,
  406. int width,
  407. int height);
  408. // Convert plane of 16 bit shorts to half floats.
  409. // Source values are multiplied by scale before storing as half float.
  410. LIBYUV_API
  411. int HalfFloatPlane(const uint16* src_y,
  412. int src_stride_y,
  413. uint16* dst_y,
  414. int dst_stride_y,
  415. float scale,
  416. int width,
  417. int height);
  418. // Quantize a rectangle of ARGB. Alpha unaffected.
  419. // scale is a 16 bit fractional fixed point scaler between 0 and 65535.
  420. // interval_size should be a value between 1 and 255.
  421. // interval_offset should be a value between 0 and 255.
  422. LIBYUV_API
  423. int ARGBQuantize(uint8* dst_argb,
  424. int dst_stride_argb,
  425. int scale,
  426. int interval_size,
  427. int interval_offset,
  428. int x,
  429. int y,
  430. int width,
  431. int height);
  432. // Copy ARGB to ARGB.
  433. LIBYUV_API
  434. int ARGBCopy(const uint8* src_argb,
  435. int src_stride_argb,
  436. uint8* dst_argb,
  437. int dst_stride_argb,
  438. int width,
  439. int height);
  440. // Copy Alpha channel of ARGB to alpha of ARGB.
  441. LIBYUV_API
  442. int ARGBCopyAlpha(const uint8* src_argb,
  443. int src_stride_argb,
  444. uint8* dst_argb,
  445. int dst_stride_argb,
  446. int width,
  447. int height);
  448. // Extract the alpha channel from ARGB.
  449. LIBYUV_API
  450. int ARGBExtractAlpha(const uint8* src_argb,
  451. int src_stride_argb,
  452. uint8* dst_a,
  453. int dst_stride_a,
  454. int width,
  455. int height);
  456. // Copy Y channel to Alpha of ARGB.
  457. LIBYUV_API
  458. int ARGBCopyYToAlpha(const uint8* src_y,
  459. int src_stride_y,
  460. uint8* dst_argb,
  461. int dst_stride_argb,
  462. int width,
  463. int height);
  464. typedef void (*ARGBBlendRow)(const uint8* src_argb0,
  465. const uint8* src_argb1,
  466. uint8* dst_argb,
  467. int width);
  468. // Get function to Alpha Blend ARGB pixels and store to destination.
  469. LIBYUV_API
  470. ARGBBlendRow GetARGBBlend();
  471. // Alpha Blend ARGB images and store to destination.
  472. // Source is pre-multiplied by alpha using ARGBAttenuate.
  473. // Alpha of destination is set to 255.
  474. LIBYUV_API
  475. int ARGBBlend(const uint8* src_argb0,
  476. int src_stride_argb0,
  477. const uint8* src_argb1,
  478. int src_stride_argb1,
  479. uint8* dst_argb,
  480. int dst_stride_argb,
  481. int width,
  482. int height);
  483. // Alpha Blend plane and store to destination.
  484. // Source is not pre-multiplied by alpha.
  485. LIBYUV_API
  486. int BlendPlane(const uint8* src_y0,
  487. int src_stride_y0,
  488. const uint8* src_y1,
  489. int src_stride_y1,
  490. const uint8* alpha,
  491. int alpha_stride,
  492. uint8* dst_y,
  493. int dst_stride_y,
  494. int width,
  495. int height);
  496. // Alpha Blend YUV images and store to destination.
  497. // Source is not pre-multiplied by alpha.
  498. // Alpha is full width x height and subsampled to half size to apply to UV.
  499. LIBYUV_API
  500. int I420Blend(const uint8* src_y0,
  501. int src_stride_y0,
  502. const uint8* src_u0,
  503. int src_stride_u0,
  504. const uint8* src_v0,
  505. int src_stride_v0,
  506. const uint8* src_y1,
  507. int src_stride_y1,
  508. const uint8* src_u1,
  509. int src_stride_u1,
  510. const uint8* src_v1,
  511. int src_stride_v1,
  512. const uint8* alpha,
  513. int alpha_stride,
  514. uint8* dst_y,
  515. int dst_stride_y,
  516. uint8* dst_u,
  517. int dst_stride_u,
  518. uint8* dst_v,
  519. int dst_stride_v,
  520. int width,
  521. int height);
  522. // Multiply ARGB image by ARGB image. Shifted down by 8. Saturates to 255.
  523. LIBYUV_API
  524. int ARGBMultiply(const uint8* src_argb0,
  525. int src_stride_argb0,
  526. const uint8* src_argb1,
  527. int src_stride_argb1,
  528. uint8* dst_argb,
  529. int dst_stride_argb,
  530. int width,
  531. int height);
  532. // Add ARGB image with ARGB image. Saturates to 255.
  533. LIBYUV_API
  534. int ARGBAdd(const uint8* src_argb0,
  535. int src_stride_argb0,
  536. const uint8* src_argb1,
  537. int src_stride_argb1,
  538. uint8* dst_argb,
  539. int dst_stride_argb,
  540. int width,
  541. int height);
  542. // Subtract ARGB image (argb1) from ARGB image (argb0). Saturates to 0.
  543. LIBYUV_API
  544. int ARGBSubtract(const uint8* src_argb0,
  545. int src_stride_argb0,
  546. const uint8* src_argb1,
  547. int src_stride_argb1,
  548. uint8* dst_argb,
  549. int dst_stride_argb,
  550. int width,
  551. int height);
  552. // Convert I422 to YUY2.
  553. LIBYUV_API
  554. int I422ToYUY2(const uint8* src_y,
  555. int src_stride_y,
  556. const uint8* src_u,
  557. int src_stride_u,
  558. const uint8* src_v,
  559. int src_stride_v,
  560. uint8* dst_frame,
  561. int dst_stride_frame,
  562. int width,
  563. int height);
  564. // Convert I422 to UYVY.
  565. LIBYUV_API
  566. int I422ToUYVY(const uint8* src_y,
  567. int src_stride_y,
  568. const uint8* src_u,
  569. int src_stride_u,
  570. const uint8* src_v,
  571. int src_stride_v,
  572. uint8* dst_frame,
  573. int dst_stride_frame,
  574. int width,
  575. int height);
  576. // Convert unattentuated ARGB to preattenuated ARGB.
  577. LIBYUV_API
  578. int ARGBAttenuate(const uint8* src_argb,
  579. int src_stride_argb,
  580. uint8* dst_argb,
  581. int dst_stride_argb,
  582. int width,
  583. int height);
  584. // Convert preattentuated ARGB to unattenuated ARGB.
  585. LIBYUV_API
  586. int ARGBUnattenuate(const uint8* src_argb,
  587. int src_stride_argb,
  588. uint8* dst_argb,
  589. int dst_stride_argb,
  590. int width,
  591. int height);
  592. // Internal function - do not call directly.
  593. // Computes table of cumulative sum for image where the value is the sum
  594. // of all values above and to the left of the entry. Used by ARGBBlur.
  595. LIBYUV_API
  596. int ARGBComputeCumulativeSum(const uint8* src_argb,
  597. int src_stride_argb,
  598. int32* dst_cumsum,
  599. int dst_stride32_cumsum,
  600. int width,
  601. int height);
  602. // Blur ARGB image.
  603. // dst_cumsum table of width * (height + 1) * 16 bytes aligned to
  604. // 16 byte boundary.
  605. // dst_stride32_cumsum is number of ints in a row (width * 4).
  606. // radius is number of pixels around the center. e.g. 1 = 3x3. 2=5x5.
  607. // Blur is optimized for radius of 5 (11x11) or less.
  608. LIBYUV_API
  609. int ARGBBlur(const uint8* src_argb,
  610. int src_stride_argb,
  611. uint8* dst_argb,
  612. int dst_stride_argb,
  613. int32* dst_cumsum,
  614. int dst_stride32_cumsum,
  615. int width,
  616. int height,
  617. int radius);
  618. // Multiply ARGB image by ARGB value.
  619. LIBYUV_API
  620. int ARGBShade(const uint8* src_argb,
  621. int src_stride_argb,
  622. uint8* dst_argb,
  623. int dst_stride_argb,
  624. int width,
  625. int height,
  626. uint32 value);
  627. // Interpolate between two images using specified amount of interpolation
  628. // (0 to 255) and store to destination.
  629. // 'interpolation' is specified as 8 bit fraction where 0 means 100% src0
  630. // and 255 means 1% src0 and 99% src1.
  631. LIBYUV_API
  632. int InterpolatePlane(const uint8* src0,
  633. int src_stride0,
  634. const uint8* src1,
  635. int src_stride1,
  636. uint8* dst,
  637. int dst_stride,
  638. int width,
  639. int height,
  640. int interpolation);
  641. // Interpolate between two ARGB images using specified amount of interpolation
  642. // Internally calls InterpolatePlane with width * 4 (bpp).
  643. LIBYUV_API
  644. int ARGBInterpolate(const uint8* src_argb0,
  645. int src_stride_argb0,
  646. const uint8* src_argb1,
  647. int src_stride_argb1,
  648. uint8* dst_argb,
  649. int dst_stride_argb,
  650. int width,
  651. int height,
  652. int interpolation);
  653. // Interpolate between two YUV images using specified amount of interpolation
  654. // Internally calls InterpolatePlane on each plane where the U and V planes
  655. // are half width and half height.
  656. LIBYUV_API
  657. int I420Interpolate(const uint8* src0_y,
  658. int src0_stride_y,
  659. const uint8* src0_u,
  660. int src0_stride_u,
  661. const uint8* src0_v,
  662. int src0_stride_v,
  663. const uint8* src1_y,
  664. int src1_stride_y,
  665. const uint8* src1_u,
  666. int src1_stride_u,
  667. const uint8* src1_v,
  668. int src1_stride_v,
  669. uint8* dst_y,
  670. int dst_stride_y,
  671. uint8* dst_u,
  672. int dst_stride_u,
  673. uint8* dst_v,
  674. int dst_stride_v,
  675. int width,
  676. int height,
  677. int interpolation);
  678. #if defined(__pnacl__) || defined(__CLR_VER) || \
  679. (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
  680. #define LIBYUV_DISABLE_X86
  681. #endif
  682. // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
  683. #if defined(__has_feature)
  684. #if __has_feature(memory_sanitizer)
  685. #define LIBYUV_DISABLE_X86
  686. #endif
  687. #endif
  688. // The following are available on all x86 platforms:
  689. #if !defined(LIBYUV_DISABLE_X86) && \
  690. (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
  691. #define HAS_ARGBAFFINEROW_SSE2
  692. #endif
  693. // Row function for copying pixels from a source with a slope to a row
  694. // of destination. Useful for scaling, rotation, mirror, texture mapping.
  695. LIBYUV_API
  696. void ARGBAffineRow_C(const uint8* src_argb,
  697. int src_argb_stride,
  698. uint8* dst_argb,
  699. const float* uv_dudv,
  700. int width);
  701. LIBYUV_API
  702. void ARGBAffineRow_SSE2(const uint8* src_argb,
  703. int src_argb_stride,
  704. uint8* dst_argb,
  705. const float* uv_dudv,
  706. int width);
  707. // Shuffle ARGB channel order. e.g. BGRA to ARGB.
  708. // shuffler is 16 bytes and must be aligned.
  709. LIBYUV_API
  710. int ARGBShuffle(const uint8* src_bgra,
  711. int src_stride_bgra,
  712. uint8* dst_argb,
  713. int dst_stride_argb,
  714. const uint8* shuffler,
  715. int width,
  716. int height);
  717. // Sobel ARGB effect with planar output.
  718. LIBYUV_API
  719. int ARGBSobelToPlane(const uint8* src_argb,
  720. int src_stride_argb,
  721. uint8* dst_y,
  722. int dst_stride_y,
  723. int width,
  724. int height);
  725. // Sobel ARGB effect.
  726. LIBYUV_API
  727. int ARGBSobel(const uint8* src_argb,
  728. int src_stride_argb,
  729. uint8* dst_argb,
  730. int dst_stride_argb,
  731. int width,
  732. int height);
  733. // Sobel ARGB effect w/ Sobel X, Sobel, Sobel Y in ARGB.
  734. LIBYUV_API
  735. int ARGBSobelXY(const uint8* src_argb,
  736. int src_stride_argb,
  737. uint8* dst_argb,
  738. int dst_stride_argb,
  739. int width,
  740. int height);
  741. #ifdef __cplusplus
  742. } // extern "C"
  743. } // namespace libyuv
  744. #endif
  745. #endif // INCLUDE_LIBYUV_PLANAR_FUNCTIONS_H_