av1_idct8x8_msa.c 3.16 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 15
#include "av1/common/enums.h"
#include "aom_dsp/mips/inv_txfm_msa.h"
Jingning Han's avatar
Jingning Han committed
16

Yaowu Xu's avatar
Yaowu Xu committed
17 18
void av1_iht8x8_64_add_msa(const int16_t *input, uint8_t *dst,
                           int32_t dst_stride, int32_t tx_type) {
Jingning Han's avatar
Jingning Han committed
19 20 21 22 23
  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
24 25
  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
26 27 28 29

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

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