Changeset 5699 for pjproject/trunk/third_party/yuv/source/row_common.cc
- Timestamp:
- Nov 21, 2017 9:25:11 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/third_party/yuv/source/row_common.cc
r5633 r5699 1771 1771 } 1772 1772 1773 void SplitRGBRow_C(const uint8* src_rgb, 1774 uint8* dst_r, 1775 uint8* dst_g, 1776 uint8* dst_b, 1777 int width) { 1778 int x; 1779 for (x = 0; x < width; ++x) { 1780 dst_r[x] = src_rgb[0]; 1781 dst_g[x] = src_rgb[1]; 1782 dst_b[x] = src_rgb[2]; 1783 src_rgb += 3; 1784 } 1785 } 1786 1787 void MergeRGBRow_C(const uint8* src_r, 1788 const uint8* src_g, 1789 const uint8* src_b, 1790 uint8* dst_rgb, 1791 int width) { 1792 int x; 1793 for (x = 0; x < width; ++x) { 1794 dst_rgb[0] = src_r[x]; 1795 dst_rgb[1] = src_g[x]; 1796 dst_rgb[2] = src_b[x]; 1797 dst_rgb += 3; 1798 } 1799 } 1800 1801 void MergeUVRow_16_C(const uint16* src_u, 1802 const uint16* src_v, 1803 uint16* dst_uv, 1804 int scale, 1805 int width) { 1806 int x; 1807 for (x = 0; x < width - 1; x += 2) { 1808 dst_uv[0] = src_u[x] * scale; 1809 dst_uv[1] = src_v[x] * scale; 1810 dst_uv[2] = src_u[x + 1] * scale; 1811 dst_uv[3] = src_v[x + 1] * scale; 1812 dst_uv += 4; 1813 } 1814 if (width & 1) { 1815 dst_uv[0] = src_u[width - 1] * scale; 1816 dst_uv[1] = src_v[width - 1] * scale; 1817 } 1818 } 1819 1820 void MultiplyRow_16_C(const uint16* src_y, 1821 uint16* dst_y, 1822 int scale, 1823 int width) { 1824 int x; 1825 for (x = 0; x < width; ++x) { 1826 dst_y[x] = src_y[x] * scale; 1827 } 1828 } 1829 1773 1830 void CopyRow_C(const uint8* src, uint8* dst, int count) { 1774 1831 memcpy(dst, src, count); … … 2640 2697 #endif 2641 2698 2699 float ScaleSumSamples_C(const float* src, float* dst, float scale, int width) { 2700 float fsum = 0.f; 2701 int i; 2702 #if defined(__clang__) 2703 #pragma clang loop vectorize_width(4) 2704 #endif 2705 for (i = 0; i < width; ++i) { 2706 float v = *src++; 2707 fsum += v * v; 2708 *dst++ = v * scale; 2709 } 2710 return fsum; 2711 } 2712 2713 float ScaleMaxSamples_C(const float* src, float* dst, float scale, int width) { 2714 float fmax = 0.f; 2715 int i; 2716 for (i = 0; i < width; ++i) { 2717 float v = *src++; 2718 float vs = v * scale; 2719 fmax = (v > fmax) ? v : fmax; 2720 *dst++ = vs; 2721 } 2722 return fmax; 2723 } 2724 2725 void ScaleSamples_C(const float* src, float* dst, float scale, int width) { 2726 int i; 2727 for (i = 0; i < width; ++i) { 2728 *dst++ = *src++ * scale; 2729 } 2730 } 2731 2732 void GaussRow_C(const uint32* src, uint16* dst, int width) { 2733 int i; 2734 for (i = 0; i < width; ++i) { 2735 *dst++ = 2736 (src[0] + src[1] * 4 + src[2] * 6 + src[3] * 4 + src[4] + 128) >> 8; 2737 ++src; 2738 } 2739 } 2740 2741 // filter 5 rows with 1, 4, 6, 4, 1 coefficients to produce 1 row. 2742 void GaussCol_C(const uint16* src0, 2743 const uint16* src1, 2744 const uint16* src2, 2745 const uint16* src3, 2746 const uint16* src4, 2747 uint32* dst, 2748 int width) { 2749 int i; 2750 for (i = 0; i < width; ++i) { 2751 *dst++ = *src0++ + *src1++ * 4 + *src2++ * 6 + *src3++ * 4 + *src4++; 2752 } 2753 } 2754 2642 2755 #ifdef __cplusplus 2643 2756 } // extern "C"
Note: See TracChangeset
for help on using the changeset viewer.