]> granicus.if.org Git - libvpx/blob - vpx_dsp/x86/highbd_idct32x32_add_sse2.c
Merge "vp9: Adjust speed features for speed 8 at low resoln."
[libvpx] / vpx_dsp / x86 / highbd_idct32x32_add_sse2.c
1 /*
2  *  Copyright (c) 2015 The WebM project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10
11 #include "./vpx_dsp_rtcd.h"
12 #include "vpx_dsp/x86/inv_txfm_sse2.h"
13 #include "vpx_dsp/x86/transpose_sse2.h"
14 #include "vpx_dsp/x86/txfm_common_sse2.h"
15
16 void vpx_highbd_idct32x32_1_add_sse2(const tran_low_t *input, uint16_t *dest,
17                                      int stride, int bd) {
18   __m128i dc_value, d;
19   const __m128i zero = _mm_setzero_si128();
20   const __m128i one = _mm_set1_epi16(1);
21   const __m128i max = _mm_sub_epi16(_mm_slli_epi16(one, bd), one);
22   int a, i, j;
23   tran_low_t out;
24
25   out = HIGHBD_WRAPLOW(dct_const_round_shift(input[0] * cospi_16_64), bd);
26   out = HIGHBD_WRAPLOW(dct_const_round_shift(out * cospi_16_64), bd);
27   a = ROUND_POWER_OF_TWO(out, 6);
28
29   d = _mm_set1_epi32(a);
30   dc_value = _mm_packs_epi32(d, d);
31   for (i = 0; i < 32; ++i) {
32     for (j = 0; j < 4; ++j) {
33       d = _mm_loadu_si128((const __m128i *)(&dest[j * 8]));
34       d = _mm_adds_epi16(d, dc_value);
35       d = _mm_max_epi16(d, zero);
36       d = _mm_min_epi16(d, max);
37       _mm_storeu_si128((__m128i *)(&dest[j * 8]), d);
38     }
39     dest += stride;
40   }
41 }