| 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 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1436 src_u += 1; | 1436 src_u += 1; |
| 1437 src_v += 1; | 1437 src_v += 1; |
| 1438 rgb_buf += 6; // Advance 2 pixels. | 1438 rgb_buf += 6; // Advance 2 pixels. |
| 1439 } | 1439 } |
| 1440 if (width & 1) { | 1440 if (width & 1) { |
| 1441 YuvPixel(src_y[0], src_u[0], src_v[0], | 1441 YuvPixel(src_y[0], src_u[0], src_v[0], |
| 1442 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1442 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
| 1443 } | 1443 } |
| 1444 } | 1444 } |
| 1445 | 1445 |
| 1446 void I422ToRAWRow_C(const uint8* src_y, | |
| 1447 const uint8* src_u, | |
| 1448 const uint8* src_v, | |
| 1449 uint8* rgb_buf, | |
| 1450 const struct YuvConstants* yuvconstants, | |
| 1451 int width) { | |
| 1452 int x; | |
| 1453 for (x = 0; x < width - 1; x += 2) { | |
| 1454 YuvPixel(src_y[0], src_u[0], src_v[0], | |
| 1455 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | |
| 1456 YuvPixel(src_y[1], src_u[0], src_v[0], | |
| 1457 rgb_buf + 5, rgb_buf + 4, rgb_buf + 3, yuvconstants); | |
| 1458 src_y += 2; | |
| 1459 src_u += 1; | |
| 1460 src_v += 1; | |
| 1461 rgb_buf += 6; // Advance 2 pixels. | |
| 1462 } | |
| 1463 if (width & 1) { | |
| 1464 YuvPixel(src_y[0], src_u[0], src_v[0], | |
| 1465 rgb_buf + 2, rgb_buf + 1, rgb_buf + 0, yuvconstants); | |
| 1466 } | |
| 1467 } | |
| 1468 | |
| 1469 void I422ToARGB4444Row_C(const uint8* src_y, | 1446 void I422ToARGB4444Row_C(const uint8* src_y, |
| 1470 const uint8* src_u, | 1447 const uint8* src_u, |
| 1471 const uint8* src_v, | 1448 const uint8* src_v, |
| 1472 uint8* dst_argb4444, | 1449 uint8* dst_argb4444, |
| 1473 const struct YuvConstants* yuvconstants, | 1450 const struct YuvConstants* yuvconstants, |
| 1474 int width) { | 1451 int width) { |
| 1475 uint8 b0; | 1452 uint8 b0; |
| 1476 uint8 g0; | 1453 uint8 g0; |
| 1477 uint8 r0; | 1454 uint8 r0; |
| 1478 uint8 b1; | 1455 uint8 b1; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 src_uyvy += 4; | 1722 src_uyvy += 4; |
| 1746 rgb_buf += 8; // Advance 2 pixels. | 1723 rgb_buf += 8; // Advance 2 pixels. |
| 1747 } | 1724 } |
| 1748 if (width & 1) { | 1725 if (width & 1) { |
| 1749 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], | 1726 YuvPixel(src_uyvy[1], src_uyvy[0], src_uyvy[2], |
| 1750 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); | 1727 rgb_buf + 0, rgb_buf + 1, rgb_buf + 2, yuvconstants); |
| 1751 rgb_buf[3] = 255; | 1728 rgb_buf[3] = 255; |
| 1752 } | 1729 } |
| 1753 } | 1730 } |
| 1754 | 1731 |
| 1755 void I422ToBGRARow_C(const uint8* src_y, | |
| 1756 const uint8* src_u, | |
| 1757 const uint8* src_v, | |
| 1758 uint8* rgb_buf, | |
| 1759 const struct YuvConstants* yuvconstants, | |
| 1760 int width) { | |
| 1761 int x; | |
| 1762 for (x = 0; x < width - 1; x += 2) { | |
| 1763 YuvPixel(src_y[0], src_u[0], src_v[0], | |
| 1764 rgb_buf + 3, rgb_buf + 2, rgb_buf + 1, yuvconstants); | |
| 1765 rgb_buf[0] = 255; | |
| 1766 YuvPixel(src_y[1], src_u[0], src_v[0], | |
| 1767 rgb_buf + 7, rgb_buf + 6, rgb_buf + 5, yuvconstants); | |
| 1768 rgb_buf[4] = 255; | |
| 1769 src_y += 2; | |
| 1770 src_u += 1; | |
| 1771 src_v += 1; | |
| 1772 rgb_buf += 8; // Advance 2 pixels. | |
| 1773 } | |
| 1774 if (width & 1) { | |
| 1775 YuvPixel(src_y[0], src_u[0], src_v[0], | |
| 1776 rgb_buf + 3, rgb_buf + 2, rgb_buf + 1, yuvconstants); | |
| 1777 rgb_buf[0] = 255; | |
| 1778 } | |
| 1779 } | |
| 1780 | |
| 1781 void I422ToRGBARow_C(const uint8* src_y, | 1732 void I422ToRGBARow_C(const uint8* src_y, |
| 1782 const uint8* src_u, | 1733 const uint8* src_u, |
| 1783 const uint8* src_v, | 1734 const uint8* src_v, |
| 1784 uint8* rgb_buf, | 1735 uint8* rgb_buf, |
| 1785 const struct YuvConstants* yuvconstants, | 1736 const struct YuvConstants* yuvconstants, |
| 1786 int width) { | 1737 int width) { |
| 1787 int x; | 1738 int x; |
| 1788 for (x = 0; x < width - 1; x += 2) { | 1739 for (x = 0; x < width - 1; x += 2) { |
| 1789 YuvPixel(src_y[0], src_u[0], src_v[0], | 1740 YuvPixel(src_y[0], src_u[0], src_v[0], |
| 1790 rgb_buf + 1, rgb_buf + 2, rgb_buf + 3, yuvconstants); | 1741 rgb_buf + 1, rgb_buf + 2, rgb_buf + 3, yuvconstants); |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2622 ARGBToRGB24Row_SSSE3(row, dst_rgb24, twidth); | 2573 ARGBToRGB24Row_SSSE3(row, dst_rgb24, twidth); |
| 2623 src_y += twidth; | 2574 src_y += twidth; |
| 2624 src_u += twidth / 2; | 2575 src_u += twidth / 2; |
| 2625 src_v += twidth / 2; | 2576 src_v += twidth / 2; |
| 2626 dst_rgb24 += twidth * 3; | 2577 dst_rgb24 += twidth * 3; |
| 2627 width -= twidth; | 2578 width -= twidth; |
| 2628 } | 2579 } |
| 2629 } | 2580 } |
| 2630 #endif | 2581 #endif |
| 2631 | 2582 |
| 2632 #if defined(HAS_I422TORAWROW_AVX2) | |
| 2633 void I422ToRAWRow_AVX2(const uint8* src_y, | |
| 2634 const uint8* src_u, | |
| 2635 const uint8* src_v, | |
| 2636 uint8* dst_raw, | |
| 2637 const struct YuvConstants* yuvconstants, | |
| 2638 int width) { | |
| 2639 // Row buffer for intermediate ARGB pixels. | |
| 2640 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); | |
| 2641 while (width > 0) { | |
| 2642 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | |
| 2643 I422ToARGBRow_AVX2(src_y, src_u, src_v, row, yuvconstants, twidth); | |
| 2644 // TODO(fbarchard): ARGBToRAWRow_AVX2 | |
| 2645 ARGBToRAWRow_SSSE3(row, dst_raw, twidth); | |
| 2646 src_y += twidth; | |
| 2647 src_u += twidth / 2; | |
| 2648 src_v += twidth / 2; | |
| 2649 dst_raw += twidth * 3; | |
| 2650 width -= twidth; | |
| 2651 } | |
| 2652 } | |
| 2653 #endif | |
| 2654 | |
| 2655 #if defined(HAS_NV12TORGB565ROW_AVX2) | 2583 #if defined(HAS_NV12TORGB565ROW_AVX2) |
| 2656 void NV12ToRGB565Row_AVX2(const uint8* src_y, | 2584 void NV12ToRGB565Row_AVX2(const uint8* src_y, |
| 2657 const uint8* src_uv, | 2585 const uint8* src_uv, |
| 2658 uint8* dst_rgb565, | 2586 uint8* dst_rgb565, |
| 2659 const struct YuvConstants* yuvconstants, | 2587 const struct YuvConstants* yuvconstants, |
| 2660 int width) { | 2588 int width) { |
| 2661 // Row buffer for intermediate ARGB pixels. | 2589 // Row buffer for intermediate ARGB pixels. |
| 2662 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); | 2590 SIMD_ALIGNED32(uint8 row[MAXTWIDTH * 4]); |
| 2663 while (width > 0) { | 2591 while (width > 0) { |
| 2664 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; | 2592 int twidth = width > MAXTWIDTH ? MAXTWIDTH : width; |
| 2665 NV12ToARGBRow_AVX2(src_y, src_uv, row, yuvconstants, twidth); | 2593 NV12ToARGBRow_AVX2(src_y, src_uv, row, yuvconstants, twidth); |
| 2666 ARGBToRGB565Row_AVX2(row, dst_rgb565, twidth); | 2594 ARGBToRGB565Row_AVX2(row, dst_rgb565, twidth); |
| 2667 src_y += twidth; | 2595 src_y += twidth; |
| 2668 src_uv += twidth; | 2596 src_uv += twidth; |
| 2669 dst_rgb565 += twidth * 2; | 2597 dst_rgb565 += twidth * 2; |
| 2670 width -= twidth; | 2598 width -= twidth; |
| 2671 } | 2599 } |
| 2672 } | 2600 } |
| 2673 #endif | 2601 #endif |
| 2674 | 2602 |
| 2675 #ifdef __cplusplus | 2603 #ifdef __cplusplus |
| 2676 } // extern "C" | 2604 } // extern "C" |
| 2677 } // namespace libyuv | 2605 } // namespace libyuv |
| 2678 #endif | 2606 #endif |
| OLD | NEW |