FFmpeg
Loading...
Searching...
No Matches
hevcdsp_lsx.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Loongson Technology Corporation Limited
3 * Contributed by Lu Wang <wanglu@loongson.cn>
4 * Hao Chen <chenhao@loongson.cn>
5 *
6 * This file is part of FFmpeg.
7 *
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef AVCODEC_LOONGARCH_HEVCDSP_LSX_H
24#define AVCODEC_LOONGARCH_HEVCDSP_LSX_H
25
26#include "libavcodec/hevc/dsp.h"
27
28#define MC(PEL, DIR, WIDTH) \
29void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_lsx(int16_t *dst, \
30 const uint8_t *src, \
31 ptrdiff_t src_stride, \
32 int height, \
33 intptr_t mx, \
34 intptr_t my, \
35 int width)
36
37MC(pel, pixels, 4);
38MC(pel, pixels, 6);
39MC(pel, pixels, 8);
40MC(pel, pixels, 12);
41MC(pel, pixels, 16);
42MC(pel, pixels, 24);
43MC(pel, pixels, 32);
44MC(pel, pixels, 48);
45MC(pel, pixels, 64);
46
47MC(qpel, h, 4);
48MC(qpel, h, 8);
49MC(qpel, h, 12);
50MC(qpel, h, 16);
51MC(qpel, h, 24);
52MC(qpel, h, 32);
53MC(qpel, h, 48);
54MC(qpel, h, 64);
55
56MC(qpel, v, 4);
57MC(qpel, v, 8);
58MC(qpel, v, 12);
59MC(qpel, v, 16);
60MC(qpel, v, 24);
61MC(qpel, v, 32);
62MC(qpel, v, 48);
63MC(qpel, v, 64);
64
65MC(qpel, hv, 4);
66MC(qpel, hv, 8);
67MC(qpel, hv, 12);
68MC(qpel, hv, 16);
69MC(qpel, hv, 24);
70MC(qpel, hv, 32);
71MC(qpel, hv, 48);
72MC(qpel, hv, 64);
73
74MC(epel, h, 32);
75
76MC(epel, v, 16);
77MC(epel, v, 24);
78MC(epel, v, 32);
79
80MC(epel, hv, 8);
81MC(epel, hv, 12);
82MC(epel, hv, 16);
83MC(epel, hv, 24);
84MC(epel, hv, 32);
85
86#undef MC
87
88#define BI_MC(PEL, DIR, WIDTH) \
89void ff_hevc_put_hevc_bi_##PEL##_##DIR##WIDTH##_8_lsx(uint8_t *dst, \
90 ptrdiff_t dst_stride, \
91 const uint8_t *src, \
92 ptrdiff_t src_stride, \
93 const int16_t *src_16bit, \
94 int height, \
95 intptr_t mx, \
96 intptr_t my, \
97 int width)
98
99BI_MC(pel, pixels, 4);
100BI_MC(pel, pixels, 6);
101BI_MC(pel, pixels, 8);
102BI_MC(pel, pixels, 12);
103BI_MC(pel, pixels, 16);
104BI_MC(pel, pixels, 24);
105BI_MC(pel, pixels, 32);
106BI_MC(pel, pixels, 48);
107BI_MC(pel, pixels, 64);
108
109BI_MC(qpel, h, 16);
110BI_MC(qpel, h, 24);
111BI_MC(qpel, h, 32);
112BI_MC(qpel, h, 48);
113BI_MC(qpel, h, 64);
114
115BI_MC(qpel, v, 8);
116BI_MC(qpel, v, 16);
117BI_MC(qpel, v, 24);
118BI_MC(qpel, v, 32);
119BI_MC(qpel, v, 48);
120BI_MC(qpel, v, 64);
121
122BI_MC(qpel, hv, 8);
123BI_MC(qpel, hv, 16);
124BI_MC(qpel, hv, 24);
125BI_MC(qpel, hv, 32);
126BI_MC(qpel, hv, 48);
127BI_MC(qpel, hv, 64);
128
129BI_MC(epel, h, 4);
130BI_MC(epel, h, 6);
131BI_MC(epel, h, 8);
132BI_MC(epel, h, 12);
133BI_MC(epel, h, 16);
134BI_MC(epel, h, 24);
135BI_MC(epel, h, 32);
136BI_MC(epel, h, 48);
137BI_MC(epel, h, 64);
138
139BI_MC(epel, v, 12);
140BI_MC(epel, v, 16);
141BI_MC(epel, v, 24);
142BI_MC(epel, v, 32);
143
144BI_MC(epel, hv, 8);
145BI_MC(epel, hv, 16);
146BI_MC(epel, hv, 24);
147BI_MC(epel, hv, 32);
148
149#undef BI_MC
150
151#define UNI_MC(PEL, DIR, WIDTH) \
152void ff_hevc_put_hevc_uni_##PEL##_##DIR##WIDTH##_8_lsx(uint8_t *dst, \
153 ptrdiff_t dst_stride, \
154 const uint8_t *src, \
155 ptrdiff_t src_stride, \
156 int height, \
157 intptr_t mx, \
158 intptr_t my, \
159 int width)
160UNI_MC(qpel, h, 4);
161UNI_MC(qpel, h, 6);
162UNI_MC(qpel, h, 8);
163UNI_MC(qpel, h, 12);
164UNI_MC(qpel, h, 16);
165UNI_MC(qpel, h, 24);
166UNI_MC(qpel, h, 32);
167UNI_MC(qpel, h, 48);
168UNI_MC(qpel, h, 64);
169
170UNI_MC(qpel, v, 24);
171UNI_MC(qpel, v, 32);
172UNI_MC(qpel, v, 48);
173UNI_MC(qpel, v, 64);
174
175UNI_MC(qpel, hv, 8);
176UNI_MC(qpel, hv, 16);
177UNI_MC(qpel, hv, 24);
178UNI_MC(qpel, hv, 32);
179UNI_MC(qpel, hv, 48);
180UNI_MC(qpel, hv, 64);
181
182UNI_MC(epel, v, 24);
183UNI_MC(epel, v, 32);
184
185UNI_MC(epel, hv, 8);
186UNI_MC(epel, hv, 12);
187UNI_MC(epel, hv, 16);
188UNI_MC(epel, hv, 24);
189UNI_MC(epel, hv, 32);
190
191#undef UNI_MC
192
193#define UNI_W_MC(PEL, DIR, WIDTH) \
194void ff_hevc_put_hevc_uni_w_##PEL##_##DIR##WIDTH##_8_lsx(uint8_t *dst, \
195 ptrdiff_t \
196 dst_stride, \
197 const uint8_t *src, \
198 ptrdiff_t \
199 src_stride, \
200 int height, \
201 int denom, \
202 int weight, \
203 int offset, \
204 intptr_t mx, \
205 intptr_t my, \
206 int width)
207
208UNI_W_MC(qpel, hv, 8);
209UNI_W_MC(qpel, hv, 16);
210UNI_W_MC(qpel, hv, 24);
211UNI_W_MC(qpel, hv, 32);
212UNI_W_MC(qpel, hv, 48);
213UNI_W_MC(qpel, hv, 64);
214
215#undef UNI_W_MC
216
217void ff_hevc_loop_filter_luma_h_8_lsx(uint8_t *src, ptrdiff_t stride,
218 int32_t beta, const int32_t *tc,
219 const uint8_t *p_is_pcm, const uint8_t *q_is_pcm);
220
221void ff_hevc_loop_filter_luma_v_8_lsx(uint8_t *src, ptrdiff_t stride,
222 int32_t beta, const int32_t *tc,
223 const uint8_t *p_is_pcm, const uint8_t *q_is_pcm);
224
225void ff_hevc_loop_filter_chroma_h_8_lsx(uint8_t *src, ptrdiff_t stride,
226 const int32_t *tc, const uint8_t *p_is_pcm,
227 const uint8_t *q_is_pcm);
228
229void ff_hevc_loop_filter_chroma_v_8_lsx(uint8_t *src, ptrdiff_t stride,
230 const int32_t *tc, const uint8_t *p_is_pcm,
231 const uint8_t *q_is_pcm);
232
233void ff_hevc_sao_edge_filter_8_lsx(uint8_t *dst, const uint8_t *src,
234 ptrdiff_t stride_dst,
235 const int16_t *sao_offset_val,
236 int eo, int width, int height);
237
238void ff_hevc_idct_4x4_lsx(int16_t *coeffs, int col_limit);
239void ff_hevc_idct_8x8_lsx(int16_t *coeffs, int col_limit);
240void ff_hevc_idct_16x16_lsx(int16_t *coeffs, int col_limit);
241void ff_hevc_idct_32x32_lsx(int16_t *coeffs, int col_limit);
242
243void ff_hevc_add_residual4x4_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
244void ff_hevc_add_residual8x8_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
245void ff_hevc_add_residual16x16_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
246void ff_hevc_add_residual32x32_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
247
248#define PEL_UNI_W(PEL, DIR, WIDTH) \
249void ff_hevc_put_hevc_##PEL##_uni_w_##DIR##WIDTH##_8_lsx(uint8_t *dst, \
250 ptrdiff_t \
251 dst_stride, \
252 const uint8_t *src, \
253 ptrdiff_t \
254 src_stride, \
255 int height, \
256 int denom, \
257 int wx, \
258 int ox, \
259 intptr_t mx, \
260 intptr_t my, \
261 int width)
262
263PEL_UNI_W(pel, pixels, 4);
264PEL_UNI_W(pel, pixels, 6);
265PEL_UNI_W(pel, pixels, 8);
266PEL_UNI_W(pel, pixels, 12);
267PEL_UNI_W(pel, pixels, 16);
268PEL_UNI_W(pel, pixels, 24);
269PEL_UNI_W(pel, pixels, 32);
270PEL_UNI_W(pel, pixels, 48);
271PEL_UNI_W(pel, pixels, 64);
272
273PEL_UNI_W(qpel, v, 4);
274PEL_UNI_W(qpel, v, 6);
275PEL_UNI_W(qpel, v, 8);
276PEL_UNI_W(qpel, v, 12);
277PEL_UNI_W(qpel, v, 16);
278PEL_UNI_W(qpel, v, 24);
279PEL_UNI_W(qpel, v, 32);
280PEL_UNI_W(qpel, v, 48);
281PEL_UNI_W(qpel, v, 64);
282
283PEL_UNI_W(qpel, h, 4);
284PEL_UNI_W(qpel, h, 6);
285PEL_UNI_W(qpel, h, 8);
286PEL_UNI_W(qpel, h, 12);
287PEL_UNI_W(qpel, h, 16);
288PEL_UNI_W(qpel, h, 24);
289PEL_UNI_W(qpel, h, 32);
290PEL_UNI_W(qpel, h, 48);
291PEL_UNI_W(qpel, h, 64);
292
293PEL_UNI_W(epel, hv, 4);
294PEL_UNI_W(epel, hv, 6);
295PEL_UNI_W(epel, hv, 8);
296PEL_UNI_W(epel, hv, 12);
297PEL_UNI_W(epel, hv, 16);
298PEL_UNI_W(epel, hv, 24);
299PEL_UNI_W(epel, hv, 32);
300PEL_UNI_W(epel, hv, 48);
301PEL_UNI_W(epel, hv, 64);
302
303PEL_UNI_W(epel, h, 4);
304PEL_UNI_W(epel, h, 6);
305PEL_UNI_W(epel, h, 8);
306PEL_UNI_W(epel, h, 12);
307PEL_UNI_W(epel, h, 16);
308PEL_UNI_W(epel, h, 24);
309PEL_UNI_W(epel, h, 32);
310PEL_UNI_W(epel, h, 48);
311PEL_UNI_W(epel, h, 64);
312
313PEL_UNI_W(epel, v, 4);
314PEL_UNI_W(epel, v, 6);
315PEL_UNI_W(epel, v, 8);
316PEL_UNI_W(epel, v, 12);
317PEL_UNI_W(epel, v, 16);
318PEL_UNI_W(epel, v, 24);
319PEL_UNI_W(epel, v, 32);
320PEL_UNI_W(epel, v, 48);
321PEL_UNI_W(epel, v, 64);
322
323#undef PEL_UNI_W
324
325#endif // #ifndef AVCODEC_LOONGARCH_HEVCDSP_LSX_H
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
int32_t
void ff_hevc_idct_16x16_lsx(int16_t *coeffs, int col_limit)
void ff_hevc_idct_4x4_lsx(int16_t *coeffs, int col_limit)
#define UNI_MC(PEL, DIR, WIDTH)
void ff_hevc_sao_edge_filter_8_lsx(uint8_t *dst, const uint8_t *src, ptrdiff_t stride_dst, const int16_t *sao_offset_val, int eo, int width, int height)
void ff_hevc_add_residual16x16_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
void ff_hevc_idct_32x32_lsx(int16_t *coeffs, int col_limit)
void ff_hevc_add_residual4x4_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
void ff_hevc_loop_filter_chroma_h_8_lsx(uint8_t *src, ptrdiff_t stride, const int32_t *tc, const uint8_t *p_is_pcm, const uint8_t *q_is_pcm)
void ff_hevc_idct_8x8_lsx(int16_t *coeffs, int col_limit)
#define BI_MC(PEL, DIR, WIDTH)
Definition hevcdsp_lsx.h:88
void ff_hevc_add_residual8x8_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
#define PEL_UNI_W(PEL, DIR, WIDTH)
#define MC(PEL, DIR, WIDTH)
Definition hevcdsp_lsx.h:28
void ff_hevc_loop_filter_luma_h_8_lsx(uint8_t *src, ptrdiff_t stride, int32_t beta, const int32_t *tc, const uint8_t *p_is_pcm, const uint8_t *q_is_pcm)
#define UNI_W_MC(PEL, DIR, WIDTH)
void ff_hevc_add_residual32x32_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
void ff_hevc_loop_filter_chroma_v_8_lsx(uint8_t *src, ptrdiff_t stride, const int32_t *tc, const uint8_t *p_is_pcm, const uint8_t *q_is_pcm)
void ff_hevc_loop_filter_luma_v_8_lsx(uint8_t *src, ptrdiff_t stride, int32_t beta, const int32_t *tc, const uint8_t *p_is_pcm, const uint8_t *q_is_pcm)
#define stride
#define src
Definition vp8dsp.c:248
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89