2 * Copyright (c) 2021 Loongson Technology Corporation Limited
3 * Contributed by Hao Chen <chenhao@loongson.cn>
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 #ifndef AVCODEC_LOONGARCH_VP9DSP_LOONGARCH_H
23 #define AVCODEC_LOONGARCH_VP9DSP_LOONGARCH_H
28 #define VP9_8TAP_LOONGARCH_LSX_FUNC(SIZE, type, type_idx) \
29 void ff_put_8tap_##type##_##SIZE##h_lsx(uint8_t *dst, ptrdiff_t dststride, \
31 ptrdiff_t srcstride, \
32 int h, int mx, int my); \
34 void ff_put_8tap_##type##_##SIZE##v_lsx(uint8_t *dst, ptrdiff_t dststride, \
36 ptrdiff_t srcstride, \
37 int h, int mx, int my); \
39 void ff_put_8tap_##type##_##SIZE##hv_lsx(uint8_t *dst, ptrdiff_t dststride, \
41 ptrdiff_t srcstride, \
42 int h, int mx, int my); \
44 void ff_avg_8tap_##type##_##SIZE##h_lsx(uint8_t *dst, ptrdiff_t dststride, \
46 ptrdiff_t srcstride, \
47 int h, int mx, int my); \
49 void ff_avg_8tap_##type##_##SIZE##v_lsx(uint8_t *dst, ptrdiff_t dststride, \
51 ptrdiff_t srcstride, \
52 int h, int mx, int my); \
54 void ff_avg_8tap_##type##_##SIZE##hv_lsx(uint8_t *dst, ptrdiff_t dststride, \
56 ptrdiff_t srcstride, \
57 int h, int mx, int my);
59 #define VP9_COPY_LOONGARCH_LSX_FUNC(SIZE) \
60 void ff_copy##SIZE##_lsx(uint8_t *dst, ptrdiff_t dststride, \
61 const uint8_t *src, ptrdiff_t srcstride, \
62 int h, int mx, int my); \
64 void ff_avg##SIZE##_lsx(uint8_t *dst, ptrdiff_t dststride, \
65 const uint8_t *src, ptrdiff_t srcstride, \
66 int h, int mx, int my);
68 VP9_8TAP_LOONGARCH_LSX_FUNC(64, regular, FILTER_8TAP_REGULAR);
69 VP9_8TAP_LOONGARCH_LSX_FUNC(32, regular, FILTER_8TAP_REGULAR);
70 VP9_8TAP_LOONGARCH_LSX_FUNC(16, regular, FILTER_8TAP_REGULAR);
71 VP9_8TAP_LOONGARCH_LSX_FUNC(8, regular, FILTER_8TAP_REGULAR);
72 VP9_8TAP_LOONGARCH_LSX_FUNC(4, regular, FILTER_8TAP_REGULAR);
74 VP9_8TAP_LOONGARCH_LSX_FUNC(64, sharp, FILTER_8TAP_SHARP);
75 VP9_8TAP_LOONGARCH_LSX_FUNC(32, sharp, FILTER_8TAP_SHARP);
76 VP9_8TAP_LOONGARCH_LSX_FUNC(16, sharp, FILTER_8TAP_SHARP);
77 VP9_8TAP_LOONGARCH_LSX_FUNC(8, sharp, FILTER_8TAP_SHARP);
78 VP9_8TAP_LOONGARCH_LSX_FUNC(4, sharp, FILTER_8TAP_SHARP);
80 VP9_8TAP_LOONGARCH_LSX_FUNC(64, smooth, FILTER_8TAP_SMOOTH);
81 VP9_8TAP_LOONGARCH_LSX_FUNC(32, smooth, FILTER_8TAP_SMOOTH);
82 VP9_8TAP_LOONGARCH_LSX_FUNC(16, smooth, FILTER_8TAP_SMOOTH);
83 VP9_8TAP_LOONGARCH_LSX_FUNC(8, smooth, FILTER_8TAP_SMOOTH);
84 VP9_8TAP_LOONGARCH_LSX_FUNC(4, smooth, FILTER_8TAP_SMOOTH);
86 VP9_COPY_LOONGARCH_LSX_FUNC(64);
87 VP9_COPY_LOONGARCH_LSX_FUNC(32);
88 VP9_COPY_LOONGARCH_LSX_FUNC(16);
89 VP9_COPY_LOONGARCH_LSX_FUNC(8);
91 #undef VP9_8TAP_LOONGARCH_LSX_FUNC
92 #undef VP9_COPY_LOONGARCH_LSX_FUNC
94 void ff_vert_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
96 void ff_vert_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
98 void ff_hor_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
100 void ff_hor_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
102 void ff_dc_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
104 void ff_dc_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
106 void ff_dc_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
108 void ff_dc_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
110 void ff_dc_left_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
112 void ff_dc_left_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
114 void ff_dc_left_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
115 const uint8_t *left, const uint8_t *top);
116 void ff_dc_left_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
117 const uint8_t *left, const uint8_t *top);
118 void ff_dc_top_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
120 void ff_dc_top_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
122 void ff_dc_top_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
123 const uint8_t *left, const uint8_t *top);
124 void ff_dc_top_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
125 const uint8_t *left, const uint8_t *top);
126 void ff_dc_128_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
127 const uint8_t *left, const uint8_t *top);
128 void ff_dc_128_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
129 const uint8_t *left, const uint8_t *top);
130 void ff_dc_127_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
131 const uint8_t *left, const uint8_t *top);
132 void ff_dc_127_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
133 const uint8_t *left, const uint8_t *top);
134 void ff_dc_129_16x16_lsx(uint8_t *dst, ptrdiff_t stride,
135 const uint8_t *left, const uint8_t *top);
136 void ff_dc_129_32x32_lsx(uint8_t *dst, ptrdiff_t stride,
137 const uint8_t *left, const uint8_t *top);
138 void ff_tm_4x4_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
140 void ff_tm_8x8_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
142 void ff_tm_16x16_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
144 void ff_tm_32x32_lsx(uint8_t *dst, ptrdiff_t stride, const uint8_t *left,
146 void ff_loop_filter_h_16_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
147 int32_t i, int32_t h);
148 void ff_loop_filter_v_16_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
149 int32_t i, int32_t h);
150 void ff_loop_filter_h_4_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
151 int32_t i, int32_t h);
152 void ff_loop_filter_v_4_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
153 int32_t i, int32_t h);
154 void ff_loop_filter_h_44_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
155 int32_t i, int32_t h);
156 void ff_loop_filter_v_44_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
157 int32_t i, int32_t h);
158 void ff_loop_filter_h_8_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
159 int32_t i, int32_t h);
160 void ff_loop_filter_v_8_8_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
161 int32_t i, int32_t h);
162 void ff_loop_filter_h_88_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
163 int32_t i, int32_t h);
164 void ff_loop_filter_v_88_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
165 int32_t i, int32_t h);
166 void ff_loop_filter_h_84_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
167 int32_t i, int32_t h);
168 void ff_loop_filter_v_84_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
169 int32_t i, int32_t h);
170 void ff_loop_filter_h_48_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
171 int32_t i, int32_t h);
172 void ff_loop_filter_v_48_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
173 int32_t i, int32_t h);
174 void ff_loop_filter_h_16_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
175 int32_t i, int32_t h);
176 void ff_loop_filter_v_16_16_lsx(uint8_t *dst, ptrdiff_t stride, int32_t e,
177 int32_t i, int32_t h);
178 void ff_idct_idct_8x8_add_lsx(uint8_t *dst, ptrdiff_t stride,
179 int16_t *block, int eob);
180 void ff_idct_idct_16x16_add_lsx(uint8_t *dst, ptrdiff_t stride,
181 int16_t *block, int eob);
182 void ff_idct_idct_32x32_add_lsx(uint8_t *dst, ptrdiff_t stride,
183 int16_t *block, int eob);
185 #endif /* AVCODEC_LOONGARCH_VP9DSP_LOONGARCH_H */