/src/aom/aom_dsp/x86/bitdepth_conversion_avx2.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 <immintrin.h> |
13 | | |
14 | | #include "config/aom_config.h" |
15 | | #include "aom/aom_integer.h" |
16 | | #include "aom_dsp/aom_dsp_common.h" |
17 | | |
18 | 0 | static inline __m256i load_tran_low(const tran_low_t *a) { |
19 | 0 | const __m256i a_low = _mm256_loadu_si256((const __m256i *)a); |
20 | 0 | const __m256i a_high = _mm256_loadu_si256((const __m256i *)(a + 8)); |
21 | 0 | return _mm256_packs_epi32(a_low, a_high); |
22 | 0 | } |
23 | | |
24 | 0 | static inline void store_tran_low(__m256i a, tran_low_t *b) { |
25 | 0 | const __m256i one = _mm256_set1_epi16(1); |
26 | 0 | const __m256i a_hi = _mm256_mulhi_epi16(a, one); |
27 | 0 | const __m256i a_lo = _mm256_mullo_epi16(a, one); |
28 | 0 | const __m256i a_1 = _mm256_unpacklo_epi16(a_lo, a_hi); |
29 | 0 | const __m256i a_2 = _mm256_unpackhi_epi16(a_lo, a_hi); |
30 | 0 | _mm256_storeu_si256((__m256i *)b, a_1); |
31 | 0 | _mm256_storeu_si256((__m256i *)(b + 8), a_2); |
32 | 0 | } |