summaryrefslogtreecommitdiffstats
path: root/media/libvpx/libvpx/vpx_dsp/loongarch/bitdepth_conversion_lsx.h
blob: b0db1e99c5244a96afde2346453962b156937cf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 *  Copyright (c) 2022 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef VPX_VPX_DSP_LOONGARCH_BITDEPTH_CONVERSION_LSX_H_
#define VPX_VPX_DSP_LOONGARCH_BITDEPTH_CONVERSION_LSX_H_

#include "./vpx_config.h"
#include "vpx/vpx_integer.h"
#include "vpx_dsp/vpx_dsp_common.h"
#include "vpx_util/loongson_intrinsics.h"

static INLINE __m128i load_tran_low(const tran_low_t *s) {
#if CONFIG_VP9_HIGHBITDEPTH
  __m128i v0_m = __lsx_vld(s, 0);
  __m128i v1_m = __lsx_vld(s + 4, 0);
  return __lsx_vsrlni_h_w(v0_m, v1_m, 0);
#else
  return __lsx_vld(s, 0);
#endif
}

static INLINE void store_tran_low(__m128i v, tran_low_t *s, int32_t c) {
#if CONFIG_VP9_HIGHBITDEPTH
  __m128i v0_m, v1_m;
  v1_m = __lsx_vexth_w_h(v);
  v0_m = __lsx_vsllwil_w_h(v, 0);
  __lsx_vst(v0_m, s + c, 0);
  __lsx_vst(v1_m, s + c + 4, 0);
#else
  __lsx_vst(v, s + c, 0);
#endif
}

#endif  // VPX_VPX_DSP_LOONGARCH_BITDEPTH_CONVERSION_LSX_H_