/src/aom/aom_dsp/x86/convolve_sse2.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2018, 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 | | #ifndef AOM_AOM_DSP_X86_CONVOLVE_SSE2_H_ |
13 | | #define AOM_AOM_DSP_X86_CONVOLVE_SSE2_H_ |
14 | | |
15 | | #include "config/aom_scale_rtcd.h" |
16 | | |
17 | | // Note: |
18 | | // This header file should be put below any x86 intrinsics head file |
19 | | static inline void prepare_coeffs(const InterpFilterParams *const filter_params, |
20 | | const int subpel_q4, |
21 | 0 | __m128i *const coeffs /* [4] */) { |
22 | 0 | const int16_t *filter = av1_get_interp_filter_subpel_kernel( |
23 | 0 | filter_params, subpel_q4 & SUBPEL_MASK); |
24 | 0 | const __m128i coeff = _mm_loadu_si128((__m128i *)filter); |
25 | | |
26 | | // coeffs 0 1 0 1 0 1 0 1 |
27 | 0 | coeffs[0] = _mm_shuffle_epi32(coeff, 0x00); |
28 | | // coeffs 2 3 2 3 2 3 2 3 |
29 | 0 | coeffs[1] = _mm_shuffle_epi32(coeff, 0x55); |
30 | | // coeffs 4 5 4 5 4 5 4 5 |
31 | 0 | coeffs[2] = _mm_shuffle_epi32(coeff, 0xaa); |
32 | | // coeffs 6 7 6 7 6 7 6 7 |
33 | 0 | coeffs[3] = _mm_shuffle_epi32(coeff, 0xff); |
34 | 0 | } Unexecuted instantiation: aom_subpixel_8t_intrin_ssse3.c:prepare_coeffs Unexecuted instantiation: highbd_convolve_ssse3.c:prepare_coeffs Unexecuted instantiation: convolve_2d_sse2.c:prepare_coeffs Unexecuted instantiation: jnt_convolve_sse2.c:prepare_coeffs Unexecuted instantiation: jnt_convolve_ssse3.c:prepare_coeffs Unexecuted instantiation: resize_ssse3.c:prepare_coeffs Unexecuted instantiation: highbd_convolve_2d_ssse3.c:prepare_coeffs Unexecuted instantiation: highbd_convolve_2d_sse4.c:prepare_coeffs Unexecuted instantiation: highbd_jnt_convolve_sse4.c:prepare_coeffs |
35 | | |
36 | | static inline __m128i convolve(const __m128i *const s, |
37 | 0 | const __m128i *const coeffs) { |
38 | 0 | const __m128i res_0 = _mm_madd_epi16(s[0], coeffs[0]); |
39 | 0 | const __m128i res_1 = _mm_madd_epi16(s[1], coeffs[1]); |
40 | 0 | const __m128i res_2 = _mm_madd_epi16(s[2], coeffs[2]); |
41 | 0 | const __m128i res_3 = _mm_madd_epi16(s[3], coeffs[3]); |
42 | |
|
43 | 0 | const __m128i res = |
44 | 0 | _mm_add_epi32(_mm_add_epi32(res_0, res_1), _mm_add_epi32(res_2, res_3)); |
45 | |
|
46 | 0 | return res; |
47 | 0 | } Unexecuted instantiation: aom_subpixel_8t_intrin_ssse3.c:convolve Unexecuted instantiation: highbd_convolve_ssse3.c:convolve Unexecuted instantiation: convolve_2d_sse2.c:convolve Unexecuted instantiation: jnt_convolve_sse2.c:convolve Unexecuted instantiation: jnt_convolve_ssse3.c:convolve Unexecuted instantiation: resize_ssse3.c:convolve Unexecuted instantiation: highbd_convolve_2d_ssse3.c:convolve Unexecuted instantiation: highbd_convolve_2d_sse4.c:convolve Unexecuted instantiation: highbd_jnt_convolve_sse4.c:convolve |
48 | | |
49 | | static inline __m128i convolve_lo_x(const __m128i *const s, |
50 | 0 | const __m128i *const coeffs) { |
51 | 0 | __m128i ss[4]; |
52 | 0 | ss[0] = _mm_unpacklo_epi8(s[0], _mm_setzero_si128()); |
53 | 0 | ss[1] = _mm_unpacklo_epi8(s[1], _mm_setzero_si128()); |
54 | 0 | ss[2] = _mm_unpacklo_epi8(s[2], _mm_setzero_si128()); |
55 | 0 | ss[3] = _mm_unpacklo_epi8(s[3], _mm_setzero_si128()); |
56 | 0 | return convolve(ss, coeffs); |
57 | 0 | } Unexecuted instantiation: aom_subpixel_8t_intrin_ssse3.c:convolve_lo_x Unexecuted instantiation: highbd_convolve_ssse3.c:convolve_lo_x Unexecuted instantiation: convolve_2d_sse2.c:convolve_lo_x Unexecuted instantiation: jnt_convolve_sse2.c:convolve_lo_x Unexecuted instantiation: jnt_convolve_ssse3.c:convolve_lo_x Unexecuted instantiation: resize_ssse3.c:convolve_lo_x Unexecuted instantiation: highbd_convolve_2d_ssse3.c:convolve_lo_x Unexecuted instantiation: highbd_convolve_2d_sse4.c:convolve_lo_x Unexecuted instantiation: highbd_jnt_convolve_sse4.c:convolve_lo_x |
58 | | |
59 | | static inline __m128i convolve_lo_y(const __m128i *const s, |
60 | 0 | const __m128i *const coeffs) { |
61 | 0 | __m128i ss[4]; |
62 | 0 | ss[0] = _mm_unpacklo_epi8(s[0], _mm_setzero_si128()); |
63 | 0 | ss[1] = _mm_unpacklo_epi8(s[2], _mm_setzero_si128()); |
64 | 0 | ss[2] = _mm_unpacklo_epi8(s[4], _mm_setzero_si128()); |
65 | 0 | ss[3] = _mm_unpacklo_epi8(s[6], _mm_setzero_si128()); |
66 | 0 | return convolve(ss, coeffs); |
67 | 0 | } Unexecuted instantiation: aom_subpixel_8t_intrin_ssse3.c:convolve_lo_y Unexecuted instantiation: highbd_convolve_ssse3.c:convolve_lo_y Unexecuted instantiation: convolve_2d_sse2.c:convolve_lo_y Unexecuted instantiation: jnt_convolve_sse2.c:convolve_lo_y Unexecuted instantiation: jnt_convolve_ssse3.c:convolve_lo_y Unexecuted instantiation: resize_ssse3.c:convolve_lo_y Unexecuted instantiation: highbd_convolve_2d_ssse3.c:convolve_lo_y Unexecuted instantiation: highbd_convolve_2d_sse4.c:convolve_lo_y Unexecuted instantiation: highbd_jnt_convolve_sse4.c:convolve_lo_y |
68 | | |
69 | | static inline __m128i convolve_hi_y(const __m128i *const s, |
70 | 0 | const __m128i *const coeffs) { |
71 | 0 | __m128i ss[4]; |
72 | 0 | ss[0] = _mm_unpackhi_epi8(s[0], _mm_setzero_si128()); |
73 | 0 | ss[1] = _mm_unpackhi_epi8(s[2], _mm_setzero_si128()); |
74 | 0 | ss[2] = _mm_unpackhi_epi8(s[4], _mm_setzero_si128()); |
75 | 0 | ss[3] = _mm_unpackhi_epi8(s[6], _mm_setzero_si128()); |
76 | 0 | return convolve(ss, coeffs); |
77 | 0 | } Unexecuted instantiation: aom_subpixel_8t_intrin_ssse3.c:convolve_hi_y Unexecuted instantiation: highbd_convolve_ssse3.c:convolve_hi_y Unexecuted instantiation: convolve_2d_sse2.c:convolve_hi_y Unexecuted instantiation: jnt_convolve_sse2.c:convolve_hi_y Unexecuted instantiation: jnt_convolve_ssse3.c:convolve_hi_y Unexecuted instantiation: resize_ssse3.c:convolve_hi_y Unexecuted instantiation: highbd_convolve_2d_ssse3.c:convolve_hi_y Unexecuted instantiation: highbd_convolve_2d_sse4.c:convolve_hi_y Unexecuted instantiation: highbd_jnt_convolve_sse4.c:convolve_hi_y |
78 | | |
79 | | static inline __m128i comp_avg(const __m128i *const data_ref_0, |
80 | | const __m128i *const res_unsigned, |
81 | | const __m128i *const wt, |
82 | 0 | const int use_dist_wtd_avg) { |
83 | 0 | __m128i res; |
84 | 0 | if (use_dist_wtd_avg) { |
85 | 0 | const __m128i data_lo = _mm_unpacklo_epi16(*data_ref_0, *res_unsigned); |
86 | 0 | const __m128i data_hi = _mm_unpackhi_epi16(*data_ref_0, *res_unsigned); |
87 | |
|
88 | 0 | const __m128i wt_res_lo = _mm_madd_epi16(data_lo, *wt); |
89 | 0 | const __m128i wt_res_hi = _mm_madd_epi16(data_hi, *wt); |
90 | |
|
91 | 0 | const __m128i res_lo = _mm_srai_epi32(wt_res_lo, DIST_PRECISION_BITS); |
92 | 0 | const __m128i res_hi = _mm_srai_epi32(wt_res_hi, DIST_PRECISION_BITS); |
93 | |
|
94 | 0 | res = _mm_packs_epi32(res_lo, res_hi); |
95 | 0 | } else { |
96 | 0 | const __m128i wt_res = _mm_add_epi16(*data_ref_0, *res_unsigned); |
97 | 0 | res = _mm_srai_epi16(wt_res, 1); |
98 | 0 | } |
99 | 0 | return res; |
100 | 0 | } Unexecuted instantiation: aom_subpixel_8t_intrin_ssse3.c:comp_avg Unexecuted instantiation: highbd_convolve_ssse3.c:comp_avg Unexecuted instantiation: convolve_2d_sse2.c:comp_avg Unexecuted instantiation: jnt_convolve_sse2.c:comp_avg Unexecuted instantiation: jnt_convolve_ssse3.c:comp_avg Unexecuted instantiation: resize_ssse3.c:comp_avg Unexecuted instantiation: highbd_convolve_2d_ssse3.c:comp_avg Unexecuted instantiation: highbd_convolve_2d_sse4.c:comp_avg Unexecuted instantiation: highbd_jnt_convolve_sse4.c:comp_avg |
101 | | |
102 | | static inline __m128i convolve_rounding(const __m128i *const res_unsigned, |
103 | | const __m128i *const offset_const, |
104 | | const __m128i *const round_const, |
105 | 0 | const int round_shift) { |
106 | 0 | const __m128i res_signed = _mm_sub_epi16(*res_unsigned, *offset_const); |
107 | 0 | const __m128i res_round = |
108 | 0 | _mm_srai_epi16(_mm_add_epi16(res_signed, *round_const), round_shift); |
109 | 0 | return res_round; |
110 | 0 | } Unexecuted instantiation: aom_subpixel_8t_intrin_ssse3.c:convolve_rounding Unexecuted instantiation: highbd_convolve_ssse3.c:convolve_rounding Unexecuted instantiation: convolve_2d_sse2.c:convolve_rounding Unexecuted instantiation: jnt_convolve_sse2.c:convolve_rounding Unexecuted instantiation: jnt_convolve_ssse3.c:convolve_rounding Unexecuted instantiation: resize_ssse3.c:convolve_rounding Unexecuted instantiation: highbd_convolve_2d_ssse3.c:convolve_rounding Unexecuted instantiation: highbd_convolve_2d_sse4.c:convolve_rounding Unexecuted instantiation: highbd_jnt_convolve_sse4.c:convolve_rounding |
111 | | |
112 | | static inline __m128i highbd_convolve_rounding_sse2( |
113 | | const __m128i *const res_unsigned, const __m128i *const offset_const, |
114 | 0 | const __m128i *const round_const, const int round_shift) { |
115 | 0 | const __m128i res_signed = _mm_sub_epi32(*res_unsigned, *offset_const); |
116 | 0 | const __m128i res_round = |
117 | 0 | _mm_srai_epi32(_mm_add_epi32(res_signed, *round_const), round_shift); |
118 | |
|
119 | 0 | return res_round; |
120 | 0 | } Unexecuted instantiation: aom_subpixel_8t_intrin_ssse3.c:highbd_convolve_rounding_sse2 Unexecuted instantiation: highbd_convolve_ssse3.c:highbd_convolve_rounding_sse2 Unexecuted instantiation: convolve_2d_sse2.c:highbd_convolve_rounding_sse2 Unexecuted instantiation: jnt_convolve_sse2.c:highbd_convolve_rounding_sse2 Unexecuted instantiation: jnt_convolve_ssse3.c:highbd_convolve_rounding_sse2 Unexecuted instantiation: resize_ssse3.c:highbd_convolve_rounding_sse2 Unexecuted instantiation: highbd_convolve_2d_ssse3.c:highbd_convolve_rounding_sse2 Unexecuted instantiation: highbd_convolve_2d_sse4.c:highbd_convolve_rounding_sse2 Unexecuted instantiation: highbd_jnt_convolve_sse4.c:highbd_convolve_rounding_sse2 |
121 | | |
122 | | #endif // AOM_AOM_DSP_X86_CONVOLVE_SSE2_H_ |