1 /*
2 * Copyright (c) 2022 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 #ifndef VPX_VPX_DSP_LOONGARCH_BITDEPTH_CONVERSION_LSX_H_
12 #define VPX_VPX_DSP_LOONGARCH_BITDEPTH_CONVERSION_LSX_H_
13
14 #include "./vpx_config.h"
15 #include "vpx/vpx_integer.h"
16 #include "vpx_dsp/vpx_dsp_common.h"
17 #include "vpx_util/loongson_intrinsics.h"
18
load_tran_low(const tran_low_t * s)19 static INLINE __m128i load_tran_low(const tran_low_t *s) {
20 #if CONFIG_VP9_HIGHBITDEPTH
21 __m128i v0_m = __lsx_vld(s, 0);
22 __m128i v1_m = __lsx_vld(s + 4, 0);
23 return __lsx_vsrlni_h_w(v0_m, v1_m, 0);
24 #else
25 return __lsx_vld(s, 0);
26 #endif
27 }
28
store_tran_low(__m128i v,tran_low_t * s,int32_t c)29 static INLINE void store_tran_low(__m128i v, tran_low_t *s, int32_t c) {
30 #if CONFIG_VP9_HIGHBITDEPTH
31 __m128i v0_m, v1_m;
32 v1_m = __lsx_vexth_w_h(v);
33 v0_m = __lsx_vsllwil_w_h(v, 0);
34 __lsx_vst(v0_m, s + c, 0);
35 __lsx_vst(v1_m, s + c + 4, 0);
36 #else
37 __lsx_vst(v, s + c, 0);
38 #endif
39 }
40
41 #endif // VPX_VPX_DSP_LOONGARCH_BITDEPTH_CONVERSION_LSX_H_
42