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_COMMON_INTRIN_H_
13 #define AOM_AOM_DSP_X86_CONVOLVE_COMMON_INTRIN_H_
14
15 // Note:
16 // This header file should be put below any x86 intrinsics head file
17
add_store(CONV_BUF_TYPE * const dst,const __m128i * const res,const int do_average)18 static INLINE void add_store(CONV_BUF_TYPE *const dst, const __m128i *const res,
19 const int do_average) {
20 __m128i d;
21 if (do_average) {
22 d = _mm_load_si128((__m128i *)dst);
23 d = _mm_add_epi32(d, *res);
24 d = _mm_srai_epi32(d, 1);
25 } else {
26 d = *res;
27 }
28 _mm_store_si128((__m128i *)dst, d);
29 }
30
31 #endif // AOM_AOM_DSP_X86_CONVOLVE_COMMON_INTRIN_H_
32