OLD | NEW |
1 // VERSION 2 | 1 // VERSION 2 |
2 /* | 2 /* |
3 * Copyright 2011 The LibYuv Project Authors. All rights reserved. | 3 * Copyright 2011 The LibYuv Project Authors. All rights reserved. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license | 5 * Use of this source code is governed by a BSD-style license |
6 * that can be found in the LICENSE file in the root of the source | 6 * that can be found in the LICENSE file in the root of the source |
7 * tree. An additional intellectual property rights grant can be found | 7 * tree. An additional intellectual property rights grant can be found |
8 * in the file PATENTS. All contributing project authors may | 8 * in the file PATENTS. All contributing project authors may |
9 * be found in the AUTHORS file in the root of the source tree. | 9 * be found in the AUTHORS file in the root of the source tree. |
10 */ | 10 */ |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // Shuffle table for converting RGB24 to ARGB. | 114 // Shuffle table for converting RGB24 to ARGB. |
115 static uvec8 kShuffleMaskRGB24ToARGB = { | 115 static uvec8 kShuffleMaskRGB24ToARGB = { |
116 0u, 1u, 2u, 12u, 3u, 4u, 5u, 13u, 6u, 7u, 8u, 14u, 9u, 10u, 11u, 15u | 116 0u, 1u, 2u, 12u, 3u, 4u, 5u, 13u, 6u, 7u, 8u, 14u, 9u, 10u, 11u, 15u |
117 }; | 117 }; |
118 | 118 |
119 // Shuffle table for converting RAW to ARGB. | 119 // Shuffle table for converting RAW to ARGB. |
120 static uvec8 kShuffleMaskRAWToARGB = { | 120 static uvec8 kShuffleMaskRAWToARGB = { |
121 2u, 1u, 0u, 12u, 5u, 4u, 3u, 13u, 8u, 7u, 6u, 14u, 11u, 10u, 9u, 15u | 121 2u, 1u, 0u, 12u, 5u, 4u, 3u, 13u, 8u, 7u, 6u, 14u, 11u, 10u, 9u, 15u |
122 }; | 122 }; |
123 | 123 |
| 124 // Shuffle table for converting RAW to RGB24. First 8. |
| 125 static const uvec8 kShuffleMaskRAWToRGB24_0 = { |
| 126 2u, 1u, 0u, 5u, 4u, 3u, 8u, 7u, |
| 127 128u, 128u, 128u, 128u, 128u, 128u, 128u, 128u |
| 128 }; |
| 129 |
| 130 // Shuffle table for converting RAW to RGB24. Middle 8. |
| 131 static const uvec8 kShuffleMaskRAWToRGB24_1 = { |
| 132 2u, 7u, 6u, 5u, 10u, 9u, 8u, 13u, |
| 133 128u, 128u, 128u, 128u, 128u, 128u, 128u, 128u |
| 134 }; |
| 135 |
| 136 // Shuffle table for converting RAW to RGB24. Last 8. |
| 137 static const uvec8 kShuffleMaskRAWToRGB24_2 = { |
| 138 8u, 7u, 12u, 11u, 10u, 15u, 14u, 13u, |
| 139 128u, 128u, 128u, 128u, 128u, 128u, 128u, 128u |
| 140 }; |
| 141 |
124 // Shuffle table for converting ARGB to RGB24. | 142 // Shuffle table for converting ARGB to RGB24. |
125 static uvec8 kShuffleMaskARGBToRGB24 = { | 143 static uvec8 kShuffleMaskARGBToRGB24 = { |
126 0u, 1u, 2u, 4u, 5u, 6u, 8u, 9u, 10u, 12u, 13u, 14u, 128u, 128u, 128u, 128u | 144 0u, 1u, 2u, 4u, 5u, 6u, 8u, 9u, 10u, 12u, 13u, 14u, 128u, 128u, 128u, 128u |
127 }; | 145 }; |
128 | 146 |
129 // Shuffle table for converting ARGB to RAW. | 147 // Shuffle table for converting ARGB to RAW. |
130 static uvec8 kShuffleMaskARGBToRAW = { | 148 static uvec8 kShuffleMaskARGBToRAW = { |
131 2u, 1u, 0u, 6u, 5u, 4u, 10u, 9u, 8u, 14u, 13u, 12u, 128u, 128u, 128u, 128u | 149 2u, 1u, 0u, 6u, 5u, 4u, 10u, 9u, 8u, 14u, 13u, 12u, 128u, 128u, 128u, 128u |
132 }; | 150 }; |
133 | 151 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 "sub $0x10,%2 \n" | 283 "sub $0x10,%2 \n" |
266 "jg 1b \n" | 284 "jg 1b \n" |
267 : "+r"(src_raw), // %0 | 285 : "+r"(src_raw), // %0 |
268 "+r"(dst_argb), // %1 | 286 "+r"(dst_argb), // %1 |
269 "+r"(width) // %2 | 287 "+r"(width) // %2 |
270 : "m"(kShuffleMaskRAWToARGB) // %3 | 288 : "m"(kShuffleMaskRAWToARGB) // %3 |
271 : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5" | 289 : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5" |
272 ); | 290 ); |
273 } | 291 } |
274 | 292 |
| 293 void RAWToRGB24Row_SSSE3(const uint8* src_raw, uint8* dst_rgb24, int width) { |
| 294 asm volatile ( |
| 295 "movdqa %3,%%xmm3 \n" |
| 296 "movdqa %4,%%xmm4 \n" |
| 297 "movdqa %5,%%xmm5 \n" |
| 298 LABELALIGN |
| 299 "1: \n" |
| 300 "movdqu " MEMACCESS(0) ",%%xmm0 \n" |
| 301 "movdqu " MEMACCESS2(0x4,0) ",%%xmm1 \n" |
| 302 "movdqu " MEMACCESS2(0x8,0) ",%%xmm2 \n" |
| 303 "lea " MEMLEA(0x18,0) ",%0 \n" |
| 304 "pshufb %%xmm3,%%xmm0 \n" |
| 305 "pshufb %%xmm4,%%xmm1 \n" |
| 306 "pshufb %%xmm5,%%xmm2 \n" |
| 307 "movq %%xmm0," MEMACCESS(1) " \n" |
| 308 "movq %%xmm1," MEMACCESS2(0x8,1) " \n" |
| 309 "movq %%xmm2," MEMACCESS2(0x10,1) " \n" |
| 310 "lea " MEMLEA(0x18,1) ",%1 \n" |
| 311 "sub $0x8,%2 \n" |
| 312 "jg 1b \n" |
| 313 : "+r"(src_raw), // %0 |
| 314 "+r"(dst_rgb24), // %1 |
| 315 "+r"(width) // %2 |
| 316 : "m"(kShuffleMaskRAWToRGB24_0), // %3 |
| 317 "m"(kShuffleMaskRAWToRGB24_1), // %4 |
| 318 "m"(kShuffleMaskRAWToRGB24_2) // %5 |
| 319 : "memory", "cc", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5" |
| 320 ); |
| 321 } |
| 322 |
275 void RGB565ToARGBRow_SSE2(const uint8* src, uint8* dst, int width) { | 323 void RGB565ToARGBRow_SSE2(const uint8* src, uint8* dst, int width) { |
276 asm volatile ( | 324 asm volatile ( |
277 "mov $0x1080108,%%eax \n" | 325 "mov $0x1080108,%%eax \n" |
278 "movd %%eax,%%xmm5 \n" | 326 "movd %%eax,%%xmm5 \n" |
279 "pshufd $0x0,%%xmm5,%%xmm5 \n" | 327 "pshufd $0x0,%%xmm5,%%xmm5 \n" |
280 "mov $0x20802080,%%eax \n" | 328 "mov $0x20802080,%%eax \n" |
281 "movd %%eax,%%xmm6 \n" | 329 "movd %%eax,%%xmm6 \n" |
282 "pshufd $0x0,%%xmm6,%%xmm6 \n" | 330 "pshufd $0x0,%%xmm6,%%xmm6 \n" |
283 "pcmpeqb %%xmm3,%%xmm3 \n" | 331 "pcmpeqb %%xmm3,%%xmm3 \n" |
284 "psllw $0xb,%%xmm3 \n" | 332 "psllw $0xb,%%xmm3 \n" |
(...skipping 4995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5280 ); | 5328 ); |
5281 } | 5329 } |
5282 #endif // HAS_ARGBLUMACOLORTABLEROW_SSSE3 | 5330 #endif // HAS_ARGBLUMACOLORTABLEROW_SSSE3 |
5283 | 5331 |
5284 #endif // defined(__x86_64__) || defined(__i386__) | 5332 #endif // defined(__x86_64__) || defined(__i386__) |
5285 | 5333 |
5286 #ifdef __cplusplus | 5334 #ifdef __cplusplus |
5287 } // extern "C" | 5335 } // extern "C" |
5288 } // namespace libyuv | 5336 } // namespace libyuv |
5289 #endif | 5337 #endif |
OLD | NEW |