OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 2 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 src_v += 1; | 1346 src_v += 1; |
1347 rgb_buf += 8; // Advance 2 pixels. | 1347 rgb_buf += 8; // Advance 2 pixels. |
1348 } | 1348 } |
1349 if (width & 1) { | 1349 if (width & 1) { |
1350 YuvPixel(src_y[0], src_u[0], src_v[0], | 1350 YuvPixel(src_y[0], src_u[0], src_v[0], |
1351 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1351 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
1352 rgb_buf[3] = 255; | 1352 rgb_buf[3] = 255; |
1353 } | 1353 } |
1354 } | 1354 } |
1355 | 1355 |
| 1356 void I422AlphaToARGBRow_C(const uint8* src_y, |
| 1357 const uint8* src_u, |
| 1358 const uint8* src_v, |
| 1359 const uint8* src_a, |
| 1360 uint8* rgb_buf, |
| 1361 struct YuvConstants* yuvconstants, |
| 1362 int width) { |
| 1363 int x; |
| 1364 for (x = 0; x < width - 1; x += 2) { |
| 1365 YuvPixel(src_y[0], src_u[0], src_v[0], |
| 1366 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
| 1367 rgb_buf[3] = src_a[0]; |
| 1368 YuvPixel(src_y[1], src_u[0], src_v[0], |
| 1369 rgb_buf + 4, rgb_buf + 5, rgb_buf + 6, yuvconstants); |
| 1370 rgb_buf[7] = src_a[1]; |
| 1371 src_y += 2; |
| 1372 src_u += 1; |
| 1373 src_v += 1; |
| 1374 src_a += 2; |
| 1375 rgb_buf += 8; // Advance 2 pixels. |
| 1376 } |
| 1377 if (width & 1) { |
| 1378 YuvPixel(src_y[0], src_u[0], src_v[0], |
| 1379 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
| 1380 rgb_buf[3] = src_a[0]; |
| 1381 } |
| 1382 } |
| 1383 |
| 1384 void I422ToABGRRow_C(const uint8* src_y, |
| 1385 const uint8* src_u, |
| 1386 const uint8* src_v, |
| 1387 uint8* rgb_buf, |
| 1388 struct YuvConstants* yuvconstants, |
| 1389 int width) { |
| 1390 int x; |
| 1391 for (x = 0; x < width - 1; x += 2) { |
| 1392 YuvPixel(src_y[0], src_u[0], src_v[0], |
| 1393 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
| 1394 rgb_buf[3] = 255; |
| 1395 YuvPixel(src_y[1], src_u[0], src_v[0], |
| 1396 rgb_buf + 6, rgb_buf + 5, rgb_buf + 4, yuvconstants); |
| 1397 rgb_buf[7] = 255; |
| 1398 src_y += 2; |
| 1399 src_u += 1; |
| 1400 src_v += 1; |
| 1401 rgb_buf += 8; // Advance 2 pixels. |
| 1402 } |
| 1403 if (width & 1) { |
| 1404 YuvPixel(src_y[0], src_u[0], src_v[0], |
| 1405 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
| 1406 rgb_buf[3] = 255; |
| 1407 } |
| 1408 } |
| 1409 |
| 1410 void I422AlphaToABGRRow_C(const uint8* src_y, |
| 1411 const uint8* src_u, |
| 1412 const uint8* src_v, |
| 1413 const uint8* src_a, |
| 1414 uint8* rgb_buf, |
| 1415 struct YuvConstants* yuvconstants, |
| 1416 int width) { |
| 1417 int x; |
| 1418 for (x = 0; x < width - 1; x += 2) { |
| 1419 YuvPixel(src_y[0], src_u[0], src_v[0], |
| 1420 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
| 1421 rgb_buf[3] = src_a[0]; |
| 1422 YuvPixel(src_y[1], src_u[0], src_v[0], |
| 1423 rgb_buf + 6, rgb_buf + 5, rgb_buf + 4, yuvconstants); |
| 1424 rgb_buf[7] = src_a[1]; |
| 1425 src_y += 2; |
| 1426 src_u += 1; |
| 1427 src_v += 1; |
| 1428 src_a += 2; |
| 1429 rgb_buf += 8; // Advance 2 pixels. |
| 1430 } |
| 1431 if (width & 1) { |
| 1432 YuvPixel(src_y[0], src_u[0], src_v[0], |
| 1433 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); |
| 1434 rgb_buf[3] = src_a[0]; |
| 1435 } |
| 1436 } |
| 1437 |
1356 void I422ToRGB24Row_C(const uint8* src_y, | 1438 void I422ToRGB24Row_C(const uint8* src_y, |
1357 const uint8* src_u, | 1439 const uint8* src_u, |
1358 const uint8* src_v, | 1440 const uint8* src_v, |
1359 uint8* rgb_buf, | 1441 uint8* rgb_buf, |
1360 struct YuvConstants* yuvconstants, | 1442 struct YuvConstants* yuvconstants, |
1361 int width) { | 1443 int width) { |
1362 int x; | 1444 int x; |
1363 for (x = 0; x < width - 1; x += 2) { | 1445 for (x = 0; x < width - 1; x += 2) { |
1364 YuvPixel(src_y[0], src_u[0], src_v[0], | 1446 YuvPixel(src_y[0], src_u[0], src_v[0], |
1365 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1447 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 src_v += 1; | 1762 src_v += 1; |
1681 rgb_buf += 8; // Advance 2 pixels. | 1763 rgb_buf += 8; // Advance 2 pixels. |
1682 } | 1764 } |
1683 if (width & 1) { | 1765 if (width & 1) { |
1684 YuvPixel(src_y[0], src_u[0], src_v[0], | 1766 YuvPixel(src_y[0], src_u[0], src_v[0], |
1685 rgb_buf + 3, rgb_buf + 2, rgb_buf + 1, yuvconstants); | 1767 rgb_buf + 3, rgb_buf + 2, rgb_buf + 1, yuvconstants); |
1686 rgb_buf[0] = 255; | 1768 rgb_buf[0] = 255; |
1687 } | 1769 } |
1688 } | 1770 } |
1689 | 1771 |
1690 void I422ToABGRRow_C(const uint8* src_y, | |
1691 const uint8* src_u, | |
1692 const uint8* src_v, | |
1693 uint8* rgb_buf, | |
1694 struct YuvConstants* yuvconstants, | |
1695 int width) { | |
1696 int x; | |
1697 for (x = 0; x < width - 1; x += 2) { | |
1698 YuvPixel(src_y[0], src_u[0], src_v[0], | |
1699 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | |
1700 rgb_buf[3] = 255; | |
1701 YuvPixel(src_y[1], src_u[0], src_v[0], | |
1702 rgb_buf + 6, rgb_buf + 5, rgb_buf + 4, yuvconstants); | |
1703 rgb_buf[7] = 255; | |
1704 src_y += 2; | |
1705 src_u += 1; | |
1706 src_v += 1; | |
1707 rgb_buf += 8; // Advance 2 pixels. | |
1708 } | |
1709 if (width & 1) { | |
1710 YuvPixel(src_y[0], src_u[0], src_v[0], | |
1711 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | |
1712 rgb_buf[3] = 255; | |
1713 } | |
1714 } | |
1715 | |
1716 void I422ToRGBARow_C(const uint8* src_y, | 1772 void I422ToRGBARow_C(const uint8* src_y, |
1717 const uint8* src_u, | 1773 const uint8* src_u, |
1718 const uint8* src_v, | 1774 const uint8* src_v, |
1719 uint8* rgb_buf, | 1775 uint8* rgb_buf, |
1720 struct YuvConstants* yuvconstants, | 1776 struct YuvConstants* yuvconstants, |
1721 int width) { | 1777 int width) { |
1722 int x; | 1778 int x; |
1723 for (x = 0; x < width - 1; x += 2) { | 1779 for (x = 0; x < width - 1; x += 2) { |
1724 YuvPixel(src_y[0], src_u[0], src_v[0], | 1780 YuvPixel(src_y[0], src_u[0], src_v[0], |
1725 rgb_buf + 1, rgb_buf + 2, rgb_buf + 3, yuvconstants); | 1781 rgb_buf + 1, rgb_buf + 2, rgb_buf + 3, yuvconstants); |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 ARGBToRGB565Row_SSE2(row, dst_rgb565, twidth); | 2461 ARGBToRGB565Row_SSE2(row, dst_rgb565, twidth); |
2406 src_y += twidth; | 2462 src_y += twidth; |
2407 src_u += twidth / 2; | 2463 src_u += twidth / 2; |
2408 src_v += twidth / 2; | 2464 src_v += twidth / 2; |
2409 dst_rgb565 += twidth * 2; | 2465 dst_rgb565 += twidth * 2; |
2410 width -= twidth; | 2466 width -= twidth; |
2411 } | 2467 } |
2412 } | 2468 } |
2413 #endif | 2469 #endif |
2414 | 2470 |
2415 void I422AlphaToARGBRow_C(const uint8* src_y, | |
2416 const uint8* src_u, | |
2417 const uint8* src_v, | |
2418 const uint8* src_a, | |
2419 uint8* dst_argb, | |
2420 struct YuvConstants* yuvconstants, | |
2421 int width) { | |
2422 | |
2423 I422ToARGBRow_C(src_y, src_u, src_v, dst_argb, &kYuvConstants, width); | |
2424 ARGBCopyYToAlphaRow_C(src_a, dst_argb, width); | |
2425 } | |
2426 | |
2427 void I422AlphaToABGRRow_C(const uint8* src_y, | |
2428 const uint8* src_u, | |
2429 const uint8* src_v, | |
2430 const uint8* src_a, | |
2431 uint8* dst_abgr, | |
2432 struct YuvConstants* yuvconstants, | |
2433 int width) { | |
2434 I422ToABGRRow_C(src_y, src_u, src_v, dst_abgr, &kYuvConstants, width); | |
2435 ARGBCopyYToAlphaRow_C(src_a, dst_abgr, width); | |
2436 } | |
2437 | |
2438 #if defined(HAS_I422TOARGB1555ROW_SSSE3) | 2471 #if defined(HAS_I422TOARGB1555ROW_SSSE3) |
2439 void I422ToARGB1555Row_SSSE3(const uint8* src_y, | 2472 void I422ToARGB1555Row_SSSE3(const uint8* src_y, |
2440 const uint8* src_u, | 2473 const uint8* src_u, |
2441 const uint8* src_v, | 2474 const uint8* src_v, |
2442 uint8* dst_argb1555, | 2475 uint8* dst_argb1555, |
2443 struct YuvConstants* yuvconstants, | 2476 struct YuvConstants* yuvconstants, |
2444 int width) { | 2477 int width) { |
2445 // Row buffer for intermediate ARGB pixels. | 2478 // Row buffer for intermediate ARGB pixels. |
2446 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); | 2479 SIMD_ALIGNED(uint8 row[MAXTWIDTH * 4]); |
2447 while (width > 0) { | 2480 while (width > 0) { |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2627 dst_rgb565 += twidth * 2; | 2660 dst_rgb565 += twidth * 2; |
2628 width -= twidth; | 2661 width -= twidth; |
2629 } | 2662 } |
2630 } | 2663 } |
2631 #endif | 2664 #endif |
2632 | 2665 |
2633 #ifdef __cplusplus | 2666 #ifdef __cplusplus |
2634 } // extern "C" | 2667 } // extern "C" |
2635 } // namespace libyuv | 2668 } // namespace libyuv |
2636 #endif | 2669 #endif |
OLD | NEW |