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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 for (y = 0; y < height; ++y) { | 105 for (y = 0; y < height; ++y) { |
106 I444ToARGBRow(src_y, src_u, src_v, dst_argb, width); | 106 I444ToARGBRow(src_y, src_u, src_v, dst_argb, width); |
107 dst_argb += dst_stride_argb; | 107 dst_argb += dst_stride_argb; |
108 src_y += src_stride_y; | 108 src_y += src_stride_y; |
109 src_u += src_stride_u; | 109 src_u += src_stride_u; |
110 src_v += src_stride_v; | 110 src_v += src_stride_v; |
111 } | 111 } |
112 return 0; | 112 return 0; |
113 } | 113 } |
114 | 114 |
| 115 // Convert I444 to ABGR. |
| 116 LIBYUV_API |
| 117 int I444ToABGR(const uint8* src_y, int src_stride_y, |
| 118 const uint8* src_u, int src_stride_u, |
| 119 const uint8* src_v, int src_stride_v, |
| 120 uint8* dst_abgr, int dst_stride_abgr, |
| 121 int width, int height) { |
| 122 int y; |
| 123 void (*I444ToABGRRow)(const uint8* y_buf, |
| 124 const uint8* u_buf, |
| 125 const uint8* v_buf, |
| 126 uint8* rgb_buf, |
| 127 int width) = I444ToABGRRow_C; |
| 128 if (!src_y || !src_u || !src_v || |
| 129 !dst_abgr || |
| 130 width <= 0 || height == 0) { |
| 131 return -1; |
| 132 } |
| 133 // Negative height means invert the image. |
| 134 if (height < 0) { |
| 135 height = -height; |
| 136 dst_abgr = dst_abgr + (height - 1) * dst_stride_abgr; |
| 137 dst_stride_abgr = -dst_stride_abgr; |
| 138 } |
| 139 // Coalesce rows. |
| 140 if (src_stride_y == width && |
| 141 src_stride_u == width && |
| 142 src_stride_v == width && |
| 143 dst_stride_abgr == width * 4) { |
| 144 width *= height; |
| 145 height = 1; |
| 146 src_stride_y = src_stride_u = src_stride_v = dst_stride_abgr = 0; |
| 147 } |
| 148 #if defined(HAS_I444TOABGRROW_SSSE3) |
| 149 if (TestCpuFlag(kCpuHasSSSE3)) { |
| 150 I444ToABGRRow = I444ToABGRRow_Any_SSSE3; |
| 151 if (IS_ALIGNED(width, 8)) { |
| 152 I444ToABGRRow = I444ToABGRRow_SSSE3; |
| 153 } |
| 154 } |
| 155 #endif |
| 156 #if defined(HAS_I444TOABGRROW_AVX2) |
| 157 if (TestCpuFlag(kCpuHasAVX2)) { |
| 158 I444ToABGRRow = I444ToABGRRow_Any_AVX2; |
| 159 if (IS_ALIGNED(width, 16)) { |
| 160 I444ToABGRRow = I444ToABGRRow_AVX2; |
| 161 } |
| 162 } |
| 163 #endif |
| 164 #if defined(HAS_I444TOABGRROW_NEON) |
| 165 if (TestCpuFlag(kCpuHasNEON)) { |
| 166 I444ToABGRRow = I444ToABGRRow_Any_NEON; |
| 167 if (IS_ALIGNED(width, 8)) { |
| 168 I444ToABGRRow = I444ToABGRRow_NEON; |
| 169 } |
| 170 } |
| 171 #endif |
| 172 |
| 173 for (y = 0; y < height; ++y) { |
| 174 I444ToABGRRow(src_y, src_u, src_v, dst_abgr, width); |
| 175 dst_abgr += dst_stride_abgr; |
| 176 src_y += src_stride_y; |
| 177 src_u += src_stride_u; |
| 178 src_v += src_stride_v; |
| 179 } |
| 180 return 0; |
| 181 } |
| 182 |
115 // Convert I422 to ARGB. | 183 // Convert I422 to ARGB. |
116 LIBYUV_API | 184 LIBYUV_API |
117 int I422ToARGB(const uint8* src_y, int src_stride_y, | 185 int I422ToARGB(const uint8* src_y, int src_stride_y, |
118 const uint8* src_u, int src_stride_u, | 186 const uint8* src_u, int src_stride_u, |
119 const uint8* src_v, int src_stride_v, | 187 const uint8* src_v, int src_stride_v, |
120 uint8* dst_argb, int dst_stride_argb, | 188 uint8* dst_argb, int dst_stride_argb, |
121 int width, int height) { | 189 int width, int height) { |
122 int y; | 190 int y; |
123 void (*I422ToARGBRow)(const uint8* y_buf, | 191 void (*I422ToARGBRow)(const uint8* y_buf, |
124 const uint8* u_buf, | 192 const uint8* u_buf, |
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 src_u += src_stride_u; | 1901 src_u += src_stride_u; |
1834 src_v += src_stride_v; | 1902 src_v += src_stride_v; |
1835 } | 1903 } |
1836 return 0; | 1904 return 0; |
1837 } | 1905 } |
1838 | 1906 |
1839 #ifdef __cplusplus | 1907 #ifdef __cplusplus |
1840 } // extern "C" | 1908 } // extern "C" |
1841 } // namespace libyuv | 1909 } // namespace libyuv |
1842 #endif | 1910 #endif |
OLD | NEW |