idct8x8_msa.c 3.04 KB
Newer Older
Jingning Han's avatar
Jingning Han committed
1 2 3 4 5 6 7 8 9 10 11 12
/*
 *  Copyright (c) 2015 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.
 */

#include <assert.h>

Yaowu Xu's avatar
Yaowu Xu committed
13
#include "av1/common/enums.h"
Yaowu Xu's avatar
Yaowu Xu committed
14
#include "aom_dsp/mips/inv_txfm_msa.h"
Jingning Han's avatar
Jingning Han committed
15 16

void vp10_iht8x8_64_add_msa(const int16_t *input, uint8_t *dst,
clang-format's avatar
clang-format committed
17
                            int32_t dst_stride, int32_t tx_type) {
Jingning Han's avatar
Jingning Han committed
18 19 20 21 22
  v8i16 in0, in1, in2, in3, in4, in5, in6, in7;

  /* load vector elements of 8x8 block */
  LD_SH8(input, 8, in0, in1, in2, in3, in4, in5, in6, in7);

clang-format's avatar
clang-format committed
23 24
  TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
                     in4, in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
25 26 27 28

  switch (tx_type) {
    case DCT_DCT:
      /* DCT in horizontal */
clang-format's avatar
clang-format committed
29 30
      VPX_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
                     in4, in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
31
      /* DCT in vertical */
clang-format's avatar
clang-format committed
32 33 34 35
      TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
                         in3, in4, in5, in6, in7);
      VPX_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
                     in4, in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
36 37 38
      break;
    case ADST_DCT:
      /* DCT in horizontal */
clang-format's avatar
clang-format committed
39 40
      VPX_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
                     in4, in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
41
      /* ADST in vertical */
clang-format's avatar
clang-format committed
42 43 44 45
      TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
                         in3, in4, in5, in6, in7);
      VPX_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
                in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
46 47 48
      break;
    case DCT_ADST:
      /* ADST in horizontal */
clang-format's avatar
clang-format committed
49 50
      VPX_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
                in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
51
      /* DCT in vertical */
clang-format's avatar
clang-format committed
52 53 54 55
      TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
                         in3, in4, in5, in6, in7);
      VPX_IDCT8x8_1D(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3,
                     in4, in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
56 57 58
      break;
    case ADST_ADST:
      /* ADST in horizontal */
clang-format's avatar
clang-format committed
59 60
      VPX_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
                in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
61
      /* ADST in vertical */
clang-format's avatar
clang-format committed
62 63 64 65
      TRANSPOSE8x8_SH_SH(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2,
                         in3, in4, in5, in6, in7);
      VPX_ADST8(in0, in1, in2, in3, in4, in5, in6, in7, in0, in1, in2, in3, in4,
                in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
66
      break;
clang-format's avatar
clang-format committed
67
    default: assert(0); break;
Jingning Han's avatar
Jingning Han committed
68 69 70 71 72 73 74
  }

  /* final rounding (add 2^4, divide by 2^5) and shift */
  SRARI_H4_SH(in0, in1, in2, in3, 5);
  SRARI_H4_SH(in4, in5, in6, in7, 5);

  /* add block and store 8x8 */
Yaowu Xu's avatar
Yaowu Xu committed
75
  VPX_ADDBLK_ST8x4_UB(dst, dst_stride, in0, in1, in2, in3);
Jingning Han's avatar
Jingning Han committed
76
  dst += (4 * dst_stride);
Yaowu Xu's avatar
Yaowu Xu committed
77
  VPX_ADDBLK_ST8x4_UB(dst, dst_stride, in4, in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
78
}