/src/aom/aom_dsp/x86/bitdepth_conversion_sse2.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2016, Alliance for Open Media. All rights reserved. |
3 | | * |
4 | | * This source code is subject to the terms of the BSD 2 Clause License and |
5 | | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
6 | | * was not distributed with this source code in the LICENSE file, you can |
7 | | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
8 | | * Media Patent License 1.0 was not distributed with this source code in the |
9 | | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
10 | | */ |
11 | | |
12 | | #include <xmmintrin.h> |
13 | | |
14 | | #include "config/aom_config.h" |
15 | | #include "aom/aom_integer.h" |
16 | | #include "aom_dsp/aom_dsp_common.h" |
17 | | |
18 | | // Load 8 16 bit values. If the source is 32 bits then pack down with |
19 | | // saturation. |
20 | 0 | static inline __m128i load_tran_low(const tran_low_t *a) { |
21 | 0 | const __m128i a_low = _mm_load_si128((const __m128i *)a); |
22 | 0 | return _mm_packs_epi32(a_low, *(const __m128i *)(a + 4)); |
23 | 0 | } Unexecuted instantiation: avg_intrin_sse2.c:load_tran_low Unexecuted instantiation: aom_quantize_avx.c:load_tran_low |
24 | | |
25 | 0 | static inline void unpack_trans(__m128i a, __m128i *a_1, __m128i *a_2) { |
26 | 0 | const __m128i one = _mm_set1_epi16(1); |
27 | 0 | const __m128i a_hi = _mm_mulhi_epi16(a, one); |
28 | 0 | const __m128i a_lo = _mm_mullo_epi16(a, one); |
29 | 0 | *a_1 = _mm_unpacklo_epi16(a_lo, a_hi); |
30 | 0 | *a_2 = _mm_unpackhi_epi16(a_lo, a_hi); |
31 | 0 | } Unexecuted instantiation: avg_intrin_sse2.c:unpack_trans Unexecuted instantiation: aom_quantize_avx.c:unpack_trans |
32 | | |
33 | | // Store 8 16 bit values. If the destination is 32 bits then sign extend the |
34 | | // values by multiplying by 1. |
35 | 0 | static inline void store_tran_low(__m128i a, tran_low_t *b) { |
36 | 0 | __m128i a_1, a_2; |
37 | 0 | unpack_trans(a, &a_1, &a_2); |
38 | 0 | _mm_store_si128((__m128i *)(b), a_1); |
39 | 0 | _mm_store_si128((__m128i *)(b + 4), a_2); |
40 | 0 | } Unexecuted instantiation: avg_intrin_sse2.c:store_tran_low Unexecuted instantiation: aom_quantize_avx.c:store_tran_low |
41 | | // Stores the second result at an offset of 8 (instead of 4) to match the output |
42 | | // with that of AVX2 implementation and the function is similar to |
43 | | // store_tran_low(). |
44 | 0 | static inline void store_tran_low_offset_4(__m128i a, tran_low_t *b) { |
45 | 0 | __m128i a_1, a_2; |
46 | 0 | unpack_trans(a, &a_1, &a_2); |
47 | 0 | _mm_store_si128((__m128i *)(b), a_1); |
48 | 0 | _mm_store_si128((__m128i *)(b + 8), a_2); |
49 | 0 | } Unexecuted instantiation: avg_intrin_sse2.c:store_tran_low_offset_4 Unexecuted instantiation: aom_quantize_avx.c:store_tran_low_offset_4 |