1 /*
2 * Copyright (c) 2018 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 #include <assert.h>
12
13 #include "./vp9_rtcd.h"
14 #include "vpx_dsp/vpx_dsp_common.h"
15 #include "vpx_dsp/ppc/inv_txfm_vsx.h"
16 #include "vpx_dsp/ppc/bitdepth_conversion_vsx.h"
17
18 #include "vp9/common/vp9_enums.h"
19
vp9_iht4x4_16_add_vsx(const tran_low_t * input,uint8_t * dest,int stride,int tx_type)20 void vp9_iht4x4_16_add_vsx(const tran_low_t *input, uint8_t *dest, int stride,
21 int tx_type) {
22 int16x8_t in[2], out[2];
23
24 in[0] = load_tran_low(0, input);
25 in[1] = load_tran_low(8 * sizeof(*input), input);
26
27 switch (tx_type) {
28 case DCT_DCT:
29 vpx_idct4_vsx(in, out);
30 vpx_idct4_vsx(out, in);
31 break;
32 case ADST_DCT:
33 vpx_idct4_vsx(in, out);
34 vp9_iadst4_vsx(out, in);
35 break;
36 case DCT_ADST:
37 vp9_iadst4_vsx(in, out);
38 vpx_idct4_vsx(out, in);
39 break;
40 default:
41 assert(tx_type == ADST_ADST);
42 vp9_iadst4_vsx(in, out);
43 vp9_iadst4_vsx(out, in);
44 break;
45 }
46
47 vpx_round_store4x4_vsx(in, out, dest, stride);
48 }
49
vp9_iht8x8_64_add_vsx(const tran_low_t * input,uint8_t * dest,int stride,int tx_type)50 void vp9_iht8x8_64_add_vsx(const tran_low_t *input, uint8_t *dest, int stride,
51 int tx_type) {
52 int16x8_t in[8], out[8];
53
54 // load input data
55 in[0] = load_tran_low(0, input);
56 in[1] = load_tran_low(8 * sizeof(*input), input);
57 in[2] = load_tran_low(2 * 8 * sizeof(*input), input);
58 in[3] = load_tran_low(3 * 8 * sizeof(*input), input);
59 in[4] = load_tran_low(4 * 8 * sizeof(*input), input);
60 in[5] = load_tran_low(5 * 8 * sizeof(*input), input);
61 in[6] = load_tran_low(6 * 8 * sizeof(*input), input);
62 in[7] = load_tran_low(7 * 8 * sizeof(*input), input);
63
64 switch (tx_type) {
65 case DCT_DCT:
66 vpx_idct8_vsx(in, out);
67 vpx_idct8_vsx(out, in);
68 break;
69 case ADST_DCT:
70 vpx_idct8_vsx(in, out);
71 vp9_iadst8_vsx(out, in);
72 break;
73 case DCT_ADST:
74 vp9_iadst8_vsx(in, out);
75 vpx_idct8_vsx(out, in);
76 break;
77 default:
78 assert(tx_type == ADST_ADST);
79 vp9_iadst8_vsx(in, out);
80 vp9_iadst8_vsx(out, in);
81 break;
82 }
83
84 vpx_round_store8x8_vsx(in, dest, stride);
85 }
86
vp9_iht16x16_256_add_vsx(const tran_low_t * input,uint8_t * dest,int stride,int tx_type)87 void vp9_iht16x16_256_add_vsx(const tran_low_t *input, uint8_t *dest,
88 int stride, int tx_type) {
89 int16x8_t in0[16], in1[16];
90
91 LOAD_INPUT16(load_tran_low, input, 0, 8 * sizeof(*input), in0);
92 LOAD_INPUT16(load_tran_low, input, 8 * 8 * 2 * sizeof(*input),
93 8 * sizeof(*input), in1);
94
95 switch (tx_type) {
96 case DCT_DCT:
97 vpx_idct16_vsx(in0, in1);
98 vpx_idct16_vsx(in0, in1);
99 break;
100 case ADST_DCT:
101 vpx_idct16_vsx(in0, in1);
102 vpx_iadst16_vsx(in0, in1);
103 break;
104 case DCT_ADST:
105 vpx_iadst16_vsx(in0, in1);
106 vpx_idct16_vsx(in0, in1);
107 break;
108 default:
109 assert(tx_type == ADST_ADST);
110 vpx_iadst16_vsx(in0, in1);
111 vpx_iadst16_vsx(in0, in1);
112 break;
113 }
114
115 vpx_round_store16x16_vsx(in0, in1, dest, stride);
116 }
117