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 | 11 |
12 #include "vpx_config.h" | 12 #include "vpx_config.h" |
13 #include "vp8_rtcd.h" | 13 #include "vp8_rtcd.h" |
14 #include "vpx_ports/x86.h" | 14 #include "vpx_ports/x86.h" |
15 #include "vpx_mem/vpx_mem.h" | 15 #include "vpx_mem/vpx_mem.h" |
16 #include "vp8/encoder/block.h" | 16 #include "vp8/encoder/block.h" |
17 #include "vp8/common/entropy.h" /* vp8_default_inv_zig_zag */ | 17 #include "vp8/common/entropy.h" /* vp8_default_inv_zig_zag */ |
18 | 18 |
19 #include <mmintrin.h> /* MMX */ | 19 #include <mmintrin.h> /* MMX */ |
20 #include <xmmintrin.h> /* SSE */ | 20 #include <xmmintrin.h> /* SSE */ |
21 #include <emmintrin.h> /* SSE2 */ | 21 #include <emmintrin.h> /* SSE2 */ |
22 | 22 |
23 #define SELECT_EOB(i, z) \ | 23 #define SELECT_EOB(i, z) \ |
24 do { \ | 24 do { \ |
25 short boost = *zbin_boost_ptr; \ | 25 short boost = *zbin_boost_ptr; \ |
26 int cmp = (x[z] < boost) | (y[z] == 0); \ | 26 int cmp = (x[z] < boost) | (y[z] == 0); \ |
27 zbin_boost_ptr++; \ | 27 zbin_boost_ptr++; \ |
28 if (cmp) \ | 28 if (cmp) \ |
29 goto select_eob_end_##i; \ | 29 break; \ |
30 qcoeff_ptr[z] = y[z]; \ | 30 qcoeff_ptr[z] = y[z]; \ |
31 eob = i; \ | 31 eob = i; \ |
32 zbin_boost_ptr = b->zrun_zbin_boost; \ | 32 zbin_boost_ptr = b->zrun_zbin_boost; \ |
33 select_eob_end_##i:; \ | |
34 } while (0) | 33 } while (0) |
35 | 34 |
36 void vp8_regular_quantize_b_sse2(BLOCK *b, BLOCKD *d) | 35 void vp8_regular_quantize_b_sse2(BLOCK *b, BLOCKD *d) |
37 { | 36 { |
38 char eob = 0; | 37 char eob = 0; |
39 short *zbin_boost_ptr = b->zrun_zbin_boost; | 38 short *zbin_boost_ptr = b->zrun_zbin_boost; |
40 short *qcoeff_ptr = d->qcoeff; | 39 short *qcoeff_ptr = d->qcoeff; |
41 DECLARE_ALIGNED_ARRAY(16, short, x, 16); | 40 DECLARE_ALIGNED_ARRAY(16, short, x, 16); |
42 DECLARE_ALIGNED_ARRAY(16, short, y, 16); | 41 DECLARE_ALIGNED_ARRAY(16, short, y, 16); |
43 | 42 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 219 |
221 x0 = _mm_max_epi16(x0, x1); | 220 x0 = _mm_max_epi16(x0, x1); |
222 | 221 |
223 /* okay, just 2! */ | 222 /* okay, just 2! */ |
224 x1 = _mm_shufflelo_epi16(x0, 0x1); // 0b00000001 | 223 x1 = _mm_shufflelo_epi16(x0, 0x1); // 0b00000001 |
225 | 224 |
226 x0 = _mm_max_epi16(x0, x1); | 225 x0 = _mm_max_epi16(x0, x1); |
227 | 226 |
228 *d->eob = 0xFF & _mm_cvtsi128_si32(x0); | 227 *d->eob = 0xFF & _mm_cvtsi128_si32(x0); |
229 } | 228 } |
OLD | NEW |