diff options
Diffstat (limited to 'vpx_dsp/x86/bitdepth_conversion_avx2.h')
-rw-r--r-- | vpx_dsp/x86/bitdepth_conversion_avx2.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/vpx_dsp/x86/bitdepth_conversion_avx2.h b/vpx_dsp/x86/bitdepth_conversion_avx2.h index b9116f049..7bbdac7ef 100644 --- a/vpx_dsp/x86/bitdepth_conversion_avx2.h +++ b/vpx_dsp/x86/bitdepth_conversion_avx2.h @@ -27,4 +27,33 @@ static INLINE __m256i load_tran_low(const tran_low_t *a) { #endif } +// Store 8 16 bit values. If the destination is 32 bits then sign extend the +// values by multiplying by 1. +static INLINE void store_tran_low(__m128i a, tran_low_t *b) { +#if CONFIG_VP9_HIGHBITDEPTH + const __m128i one = _mm_set1_epi16(1); + const __m128i a_hi = _mm_mulhi_epi16(a, one); + const __m128i a_lo = _mm_mullo_epi16(a, one); + const __m128i a_1 = _mm_unpacklo_epi16(a_lo, a_hi); + const __m128i a_2 = _mm_unpackhi_epi16(a_lo, a_hi); + _mm_store_si128((__m128i *)(b), a_1); + _mm_store_si128((__m128i *)(b + 4), a_2); +#else + _mm_store_si128((__m128i *)(b), a); +#endif +} + +static INLINE void store_tran_low_256(__m256i a, tran_low_t *b) { +#if CONFIG_VP9_HIGHBITDEPTH + const __m256i one = _mm256_set1_epi16(1); + const __m256i a_hi = _mm256_mulhi_epi16(a, one); + const __m256i a_lo = _mm256_mullo_epi16(a, one); + const __m256i a_1 = _mm256_unpacklo_epi16(a_lo, a_hi); + const __m256i a_2 = _mm256_unpackhi_epi16(a_lo, a_hi); + _mm256_storeu_si256((__m256i *)(b), a_1); + _mm256_storeu_si256((__m256i *)(b + 8), a_2); +#else + _mm256_storeu_si256((__m256i *)(b), a); +#endif +} #endif // VPX_DSP_X86_BITDEPTH_CONVERSION_AVX2_H_ |