Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: source/planar_functions.cc

Issue 2559693002: Add MSA optimized ARGB Attenuate/RGB565/Shuffle/Shader/Gray/Sepia row functions (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1689 } 1689 }
1690 #endif 1690 #endif
1691 #if defined(HAS_ARGBATTENUATEROW_NEON) 1691 #if defined(HAS_ARGBATTENUATEROW_NEON)
1692 if (TestCpuFlag(kCpuHasNEON)) { 1692 if (TestCpuFlag(kCpuHasNEON)) {
1693 ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON; 1693 ARGBAttenuateRow = ARGBAttenuateRow_Any_NEON;
1694 if (IS_ALIGNED(width, 8)) { 1694 if (IS_ALIGNED(width, 8)) {
1695 ARGBAttenuateRow = ARGBAttenuateRow_NEON; 1695 ARGBAttenuateRow = ARGBAttenuateRow_NEON;
1696 } 1696 }
1697 } 1697 }
1698 #endif 1698 #endif
1699 #if defined(HAS_ARGBATTENUATEROW_MSA)
1700 if (TestCpuFlag(kCpuHasMSA)) {
1701 ARGBAttenuateRow = ARGBAttenuateRow_Any_MSA;
1702 if (IS_ALIGNED(width, 8)) {
1703 ARGBAttenuateRow = ARGBAttenuateRow_MSA;
1704 }
1705 }
1706 #endif
1699 1707
1700 for (y = 0; y < height; ++y) { 1708 for (y = 0; y < height; ++y) {
1701 ARGBAttenuateRow(src_argb, dst_argb, width); 1709 ARGBAttenuateRow(src_argb, dst_argb, width);
1702 src_argb += src_stride_argb; 1710 src_argb += src_stride_argb;
1703 dst_argb += dst_stride_argb; 1711 dst_argb += dst_stride_argb;
1704 } 1712 }
1705 return 0; 1713 return 0;
1706 } 1714 }
1707 1715
1708 // Convert preattentuated ARGB to unattenuated ARGB. 1716 // Convert preattentuated ARGB to unattenuated ARGB.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 #if defined(HAS_ARGBGRAYROW_SSSE3) 1792 #if defined(HAS_ARGBGRAYROW_SSSE3)
1785 if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 8)) { 1793 if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 8)) {
1786 ARGBGrayRow = ARGBGrayRow_SSSE3; 1794 ARGBGrayRow = ARGBGrayRow_SSSE3;
1787 } 1795 }
1788 #endif 1796 #endif
1789 #if defined(HAS_ARGBGRAYROW_NEON) 1797 #if defined(HAS_ARGBGRAYROW_NEON)
1790 if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) { 1798 if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
1791 ARGBGrayRow = ARGBGrayRow_NEON; 1799 ARGBGrayRow = ARGBGrayRow_NEON;
1792 } 1800 }
1793 #endif 1801 #endif
1802 #if defined(HAS_ARGBGRAYROW_MSA)
1803 if (TestCpuFlag(kCpuHasMSA) && IS_ALIGNED(width, 8)) {
1804 ARGBGrayRow = ARGBGrayRow_MSA;
1805 }
1806 #endif
1794 1807
1795 for (y = 0; y < height; ++y) { 1808 for (y = 0; y < height; ++y) {
1796 ARGBGrayRow(src_argb, dst_argb, width); 1809 ARGBGrayRow(src_argb, dst_argb, width);
1797 src_argb += src_stride_argb; 1810 src_argb += src_stride_argb;
1798 dst_argb += dst_stride_argb; 1811 dst_argb += dst_stride_argb;
1799 } 1812 }
1800 return 0; 1813 return 0;
1801 } 1814 }
1802 1815
1803 // Make a rectangle of ARGB gray scale. 1816 // Make a rectangle of ARGB gray scale.
(...skipping 20 matching lines...) Expand all
1824 #if defined(HAS_ARGBGRAYROW_SSSE3) 1837 #if defined(HAS_ARGBGRAYROW_SSSE3)
1825 if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 8)) { 1838 if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 8)) {
1826 ARGBGrayRow = ARGBGrayRow_SSSE3; 1839 ARGBGrayRow = ARGBGrayRow_SSSE3;
1827 } 1840 }
1828 #endif 1841 #endif
1829 #if defined(HAS_ARGBGRAYROW_NEON) 1842 #if defined(HAS_ARGBGRAYROW_NEON)
1830 if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) { 1843 if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
1831 ARGBGrayRow = ARGBGrayRow_NEON; 1844 ARGBGrayRow = ARGBGrayRow_NEON;
1832 } 1845 }
1833 #endif 1846 #endif
1847 #if defined(HAS_ARGBGRAYROW_MSA)
1848 if (TestCpuFlag(kCpuHasMSA) && IS_ALIGNED(width, 8)) {
1849 ARGBGrayRow = ARGBGrayRow_MSA;
1850 }
1851 #endif
1852
1834 for (y = 0; y < height; ++y) { 1853 for (y = 0; y < height; ++y) {
1835 ARGBGrayRow(dst, dst, width); 1854 ARGBGrayRow(dst, dst, width);
1836 dst += dst_stride_argb; 1855 dst += dst_stride_argb;
1837 } 1856 }
1838 return 0; 1857 return 0;
1839 } 1858 }
1840 1859
1841 // Make a rectangle of ARGB Sepia tone. 1860 // Make a rectangle of ARGB Sepia tone.
1842 LIBYUV_API 1861 LIBYUV_API
1843 int ARGBSepia(uint8* dst_argb, 1862 int ARGBSepia(uint8* dst_argb,
(...skipping 17 matching lines...) Expand all
1861 #if defined(HAS_ARGBSEPIAROW_SSSE3) 1880 #if defined(HAS_ARGBSEPIAROW_SSSE3)
1862 if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 8)) { 1881 if (TestCpuFlag(kCpuHasSSSE3) && IS_ALIGNED(width, 8)) {
1863 ARGBSepiaRow = ARGBSepiaRow_SSSE3; 1882 ARGBSepiaRow = ARGBSepiaRow_SSSE3;
1864 } 1883 }
1865 #endif 1884 #endif
1866 #if defined(HAS_ARGBSEPIAROW_NEON) 1885 #if defined(HAS_ARGBSEPIAROW_NEON)
1867 if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) { 1886 if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
1868 ARGBSepiaRow = ARGBSepiaRow_NEON; 1887 ARGBSepiaRow = ARGBSepiaRow_NEON;
1869 } 1888 }
1870 #endif 1889 #endif
1890 #if defined(HAS_ARGBSEPIAROW_MSA)
1891 if (TestCpuFlag(kCpuHasMSA) && IS_ALIGNED(width, 8)) {
1892 ARGBSepiaRow = ARGBSepiaRow_MSA;
1893 }
1894 #endif
1895
1871 for (y = 0; y < height; ++y) { 1896 for (y = 0; y < height; ++y) {
1872 ARGBSepiaRow(dst, width); 1897 ARGBSepiaRow(dst, width);
1873 dst += dst_stride_argb; 1898 dst += dst_stride_argb;
1874 } 1899 }
1875 return 0; 1900 return 0;
1876 } 1901 }
1877 1902
1878 // Apply a 4x4 matrix to each ARGB pixel. 1903 // Apply a 4x4 matrix to each ARGB pixel.
1879 // Note: Normally for shading, but can be used to swizzle or invert. 1904 // Note: Normally for shading, but can be used to swizzle or invert.
1880 LIBYUV_API 1905 LIBYUV_API
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 #if defined(HAS_ARGBSHADEROW_SSE2) 2279 #if defined(HAS_ARGBSHADEROW_SSE2)
2255 if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(width, 4)) { 2280 if (TestCpuFlag(kCpuHasSSE2) && IS_ALIGNED(width, 4)) {
2256 ARGBShadeRow = ARGBShadeRow_SSE2; 2281 ARGBShadeRow = ARGBShadeRow_SSE2;
2257 } 2282 }
2258 #endif 2283 #endif
2259 #if defined(HAS_ARGBSHADEROW_NEON) 2284 #if defined(HAS_ARGBSHADEROW_NEON)
2260 if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) { 2285 if (TestCpuFlag(kCpuHasNEON) && IS_ALIGNED(width, 8)) {
2261 ARGBShadeRow = ARGBShadeRow_NEON; 2286 ARGBShadeRow = ARGBShadeRow_NEON;
2262 } 2287 }
2263 #endif 2288 #endif
2289 #if defined(HAS_ARGBSHADEROW_MSA)
2290 if (TestCpuFlag(kCpuHasMSA) && IS_ALIGNED(width, 4)) {
2291 ARGBShadeRow = ARGBShadeRow_MSA;
2292 }
2293 #endif
2264 2294
2265 for (y = 0; y < height; ++y) { 2295 for (y = 0; y < height; ++y) {
2266 ARGBShadeRow(src_argb, dst_argb, width, value); 2296 ARGBShadeRow(src_argb, dst_argb, width, value);
2267 src_argb += src_stride_argb; 2297 src_argb += src_stride_argb;
2268 dst_argb += dst_stride_argb; 2298 dst_argb += dst_stride_argb;
2269 } 2299 }
2270 return 0; 2300 return 0;
2271 } 2301 }
2272 2302
2273 // Interpolate 2 planes by specified amount (0 to 255). 2303 // Interpolate 2 planes by specified amount (0 to 255).
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
2448 } 2478 }
2449 #endif 2479 #endif
2450 #if defined(HAS_ARGBSHUFFLEROW_NEON) 2480 #if defined(HAS_ARGBSHUFFLEROW_NEON)
2451 if (TestCpuFlag(kCpuHasNEON)) { 2481 if (TestCpuFlag(kCpuHasNEON)) {
2452 ARGBShuffleRow = ARGBShuffleRow_Any_NEON; 2482 ARGBShuffleRow = ARGBShuffleRow_Any_NEON;
2453 if (IS_ALIGNED(width, 4)) { 2483 if (IS_ALIGNED(width, 4)) {
2454 ARGBShuffleRow = ARGBShuffleRow_NEON; 2484 ARGBShuffleRow = ARGBShuffleRow_NEON;
2455 } 2485 }
2456 } 2486 }
2457 #endif 2487 #endif
2488 #if defined(HAS_ARGBSHUFFLEROW_MSA)
2489 if (TestCpuFlag(kCpuHasMSA)) {
2490 ARGBShuffleRow = ARGBShuffleRow_Any_MSA;
2491 if (IS_ALIGNED(width, 8)) {
2492 ARGBShuffleRow = ARGBShuffleRow_MSA;
2493 }
2494 }
2495 #endif
2458 2496
2459 for (y = 0; y < height; ++y) { 2497 for (y = 0; y < height; ++y) {
2460 ARGBShuffleRow(src_bgra, dst_argb, shuffler, width); 2498 ARGBShuffleRow(src_bgra, dst_argb, shuffler, width);
2461 src_bgra += src_stride_bgra; 2499 src_bgra += src_stride_bgra;
2462 dst_argb += dst_stride_argb; 2500 dst_argb += dst_stride_argb;
2463 } 2501 }
2464 return 0; 2502 return 0;
2465 } 2503 }
2466 2504
2467 // Sobel ARGB effect. 2505 // Sobel ARGB effect.
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
3194 } 3232 }
3195 free_aligned_buffer_64(rows); 3233 free_aligned_buffer_64(rows);
3196 } 3234 }
3197 return 0; 3235 return 0;
3198 } 3236 }
3199 3237
3200 #ifdef __cplusplus 3238 #ifdef __cplusplus
3201 } // extern "C" 3239 } // extern "C"
3202 } // namespace libyuv 3240 } // namespace libyuv
3203 #endif 3241 #endif
OLDNEW
« no previous file with comments | « source/convert_from_argb.cc ('k') | source/row_any.cc » ('j') | source/row_msa.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698