av1_idct8x8_msa.c 3.22 KB
Newer Older
Jingning Han's avatar
Jingning Han committed
1
/*
Yaowu Xu's avatar
Yaowu Xu committed
2
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
Jingning Han's avatar
Jingning Han committed
3
 *
Yaowu Xu's avatar
Yaowu Xu committed
4 5 6 7 8 9
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
Jingning Han's avatar
Jingning Han committed
10 11 12 13
 */

#include <assert.h>

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

Yaowu Xu's avatar
Yaowu Xu committed
18
void av1_iht8x8_64_add_msa(const int16_t *input, uint8_t *dst,
19
                           int32_t dst_stride, FWD_TXFM_PARAM *param) {
Jingning Han's avatar
Jingning Han committed
20
  v8i16 in0, in1, in2, in3, in4, in5, in6, in7;
21
  int32_t tx_type = param->tx_type;
Jingning Han's avatar
Jingning Han committed
22 23 24 25

  /* 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
26 27
  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
28 29 30 31

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

  /* 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
78
  AOM_ADDBLK_ST8x4_UB(dst, dst_stride, in0, in1, in2, in3);
Jingning Han's avatar
Jingning Han committed
79
  dst += (4 * dst_stride);
Yaowu Xu's avatar
Yaowu Xu committed
80
  AOM_ADDBLK_ST8x4_UB(dst, dst_stride, in4, in5, in6, in7);
Jingning Han's avatar
Jingning Han committed
81
}