OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebM 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 |
11 #include <tmmintrin.h> /* SSSE3 */ | 11 #include <tmmintrin.h> /* SSSE3 */ |
12 | 12 |
13 #include "vp8/encoder/block.h" | 13 #include "vp8/encoder/block.h" |
14 | 14 |
15 /* bitscan reverse (bsr) */ | 15 /* bitscan reverse (bsr) */ |
16 #if defined(_MSC_VER) | 16 #if defined(_MSC_VER) |
17 #include <intrin.h> | 17 #include <intrin.h> |
18 #pragma intrinsic(_BitScanReverse) | 18 #pragma intrinsic(_BitScanReverse) |
19 static int bsr(int mask) { | 19 static int bsr(int mask) { |
20 int eob; | 20 int eob; |
21 _BitScanReverse(&eob, mask); | 21 _BitScanReverse(&eob, mask); |
22 eob++; | 22 eob++; |
23 if (mask == 0) | 23 if (mask == 0) |
24 eob = 0; | 24 eob = 0; |
25 return eob; | 25 return eob; |
26 } | 26 } |
27 #else | 27 #else |
28 static int bsr(int mask) { | 28 static int bsr(int mask) { |
29 int eob; | 29 int eob; |
| 30 #if defined(__GNUC__) && __GNUC__ |
| 31 __asm__ __volatile__("bsr %1, %0" : "=r" (eob) : "r" (mask) : "flags"); |
| 32 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) |
30 asm volatile("bsr %1, %0" : "=r" (eob) : "r" (mask) : "flags"); | 33 asm volatile("bsr %1, %0" : "=r" (eob) : "r" (mask) : "flags"); |
| 34 #endif |
31 eob++; | 35 eob++; |
32 if (mask == 0) | 36 if (mask == 0) |
33 eob = 0; | 37 eob = 0; |
34 return eob; | 38 return eob; |
35 } | 39 } |
36 #endif | 40 #endif |
37 | 41 |
38 void vp8_fast_quantize_b_ssse3(BLOCK *b, BLOCKD *d) { | 42 void vp8_fast_quantize_b_ssse3(BLOCK *b, BLOCKD *d) { |
39 int eob, mask; | 43 int eob, mask; |
40 | 44 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 x = _mm_packs_epi16(x0, x1); | 105 x = _mm_packs_epi16(x0, x1); |
102 | 106 |
103 x = _mm_shuffle_epi8(x, zig_zag); | 107 x = _mm_shuffle_epi8(x, zig_zag); |
104 | 108 |
105 mask = _mm_movemask_epi8(x); | 109 mask = _mm_movemask_epi8(x); |
106 | 110 |
107 eob = bsr(mask); | 111 eob = bsr(mask); |
108 | 112 |
109 *d->eob = 0xFF & eob; | 113 *d->eob = 0xFF & eob; |
110 } | 114 } |
OLD | NEW |