FFmpeg
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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) \
29 void 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 
37 MC(pel, pixels, 4);
38 MC(pel, pixels, 6);
39 MC(pel, pixels, 8);
40 MC(pel, pixels, 12);
41 MC(pel, pixels, 16);
42 MC(pel, pixels, 24);
43 MC(pel, pixels, 32);
44 MC(pel, pixels, 48);
45 MC(pel, pixels, 64);
46 
47 MC(qpel, h, 4);
48 MC(qpel, h, 8);
49 MC(qpel, h, 12);
50 MC(qpel, h, 16);
51 MC(qpel, h, 24);
52 MC(qpel, h, 32);
53 MC(qpel, h, 48);
54 MC(qpel, h, 64);
55 
56 MC(qpel, v, 4);
57 MC(qpel, v, 8);
58 MC(qpel, v, 12);
59 MC(qpel, v, 16);
60 MC(qpel, v, 24);
61 MC(qpel, v, 32);
62 MC(qpel, v, 48);
63 MC(qpel, v, 64);
64 
65 MC(qpel, hv, 4);
66 MC(qpel, hv, 8);
67 MC(qpel, hv, 12);
68 MC(qpel, hv, 16);
69 MC(qpel, hv, 24);
70 MC(qpel, hv, 32);
71 MC(qpel, hv, 48);
72 MC(qpel, hv, 64);
73 
74 MC(epel, h, 32);
75 
76 MC(epel, v, 16);
77 MC(epel, v, 24);
78 MC(epel, v, 32);
79 
80 MC(epel, hv, 8);
81 MC(epel, hv, 12);
82 MC(epel, hv, 16);
83 MC(epel, hv, 24);
84 MC(epel, hv, 32);
85 
86 #undef MC
87 
88 #define BI_MC(PEL, DIR, WIDTH) \
89 void 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 
99 BI_MC(pel, pixels, 4);
100 BI_MC(pel, pixels, 6);
101 BI_MC(pel, pixels, 8);
102 BI_MC(pel, pixels, 12);
103 BI_MC(pel, pixels, 16);
104 BI_MC(pel, pixels, 24);
105 BI_MC(pel, pixels, 32);
106 BI_MC(pel, pixels, 48);
107 BI_MC(pel, pixels, 64);
108 
109 BI_MC(qpel, h, 16);
110 BI_MC(qpel, h, 24);
111 BI_MC(qpel, h, 32);
112 BI_MC(qpel, h, 48);
113 BI_MC(qpel, h, 64);
114 
115 BI_MC(qpel, v, 8);
116 BI_MC(qpel, v, 16);
117 BI_MC(qpel, v, 24);
118 BI_MC(qpel, v, 32);
119 BI_MC(qpel, v, 48);
120 BI_MC(qpel, v, 64);
121 
122 BI_MC(qpel, hv, 8);
123 BI_MC(qpel, hv, 16);
124 BI_MC(qpel, hv, 24);
125 BI_MC(qpel, hv, 32);
126 BI_MC(qpel, hv, 48);
127 BI_MC(qpel, hv, 64);
128 
129 BI_MC(epel, h, 4);
130 BI_MC(epel, h, 6);
131 BI_MC(epel, h, 8);
132 BI_MC(epel, h, 12);
133 BI_MC(epel, h, 16);
134 BI_MC(epel, h, 24);
135 BI_MC(epel, h, 32);
136 BI_MC(epel, h, 48);
137 BI_MC(epel, h, 64);
138 
139 BI_MC(epel, v, 12);
140 BI_MC(epel, v, 16);
141 BI_MC(epel, v, 24);
142 BI_MC(epel, v, 32);
143 
144 BI_MC(epel, hv, 8);
145 BI_MC(epel, hv, 16);
146 BI_MC(epel, hv, 24);
147 BI_MC(epel, hv, 32);
148 
149 #undef BI_MC
150 
151 #define UNI_MC(PEL, DIR, WIDTH) \
152 void 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)
160 UNI_MC(qpel, h, 4);
161 UNI_MC(qpel, h, 6);
162 UNI_MC(qpel, h, 8);
163 UNI_MC(qpel, h, 12);
164 UNI_MC(qpel, h, 16);
165 UNI_MC(qpel, h, 24);
166 UNI_MC(qpel, h, 32);
167 UNI_MC(qpel, h, 48);
168 UNI_MC(qpel, h, 64);
169 
170 UNI_MC(qpel, v, 24);
171 UNI_MC(qpel, v, 32);
172 UNI_MC(qpel, v, 48);
173 UNI_MC(qpel, v, 64);
174 
175 UNI_MC(qpel, hv, 8);
176 UNI_MC(qpel, hv, 16);
177 UNI_MC(qpel, hv, 24);
178 UNI_MC(qpel, hv, 32);
179 UNI_MC(qpel, hv, 48);
180 UNI_MC(qpel, hv, 64);
181 
182 UNI_MC(epel, v, 24);
183 UNI_MC(epel, v, 32);
184 
185 UNI_MC(epel, hv, 8);
186 UNI_MC(epel, hv, 12);
187 UNI_MC(epel, hv, 16);
188 UNI_MC(epel, hv, 24);
189 UNI_MC(epel, hv, 32);
190 
191 #undef UNI_MC
192 
193 #define UNI_W_MC(PEL, DIR, WIDTH) \
194 void 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 
208 UNI_W_MC(qpel, hv, 8);
209 UNI_W_MC(qpel, hv, 16);
210 UNI_W_MC(qpel, hv, 24);
211 UNI_W_MC(qpel, hv, 32);
212 UNI_W_MC(qpel, hv, 48);
213 UNI_W_MC(qpel, hv, 64);
214 
215 #undef UNI_W_MC
216 
217 void 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 
221 void 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 
225 void 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 
229 void 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 
233 void 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 
238 void ff_hevc_idct_4x4_lsx(int16_t *coeffs, int col_limit);
239 void ff_hevc_idct_8x8_lsx(int16_t *coeffs, int col_limit);
240 void ff_hevc_idct_16x16_lsx(int16_t *coeffs, int col_limit);
241 void ff_hevc_idct_32x32_lsx(int16_t *coeffs, int col_limit);
242 
243 void ff_hevc_add_residual4x4_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
244 void ff_hevc_add_residual8x8_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
245 void ff_hevc_add_residual16x16_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
246 void 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) \
249 void 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 
263 PEL_UNI_W(pel, pixels, 4);
264 PEL_UNI_W(pel, pixels, 6);
265 PEL_UNI_W(pel, pixels, 8);
266 PEL_UNI_W(pel, pixels, 12);
267 PEL_UNI_W(pel, pixels, 16);
268 PEL_UNI_W(pel, pixels, 24);
269 PEL_UNI_W(pel, pixels, 32);
270 PEL_UNI_W(pel, pixels, 48);
271 PEL_UNI_W(pel, pixels, 64);
272 
273 PEL_UNI_W(qpel, v, 4);
274 PEL_UNI_W(qpel, v, 6);
275 PEL_UNI_W(qpel, v, 8);
276 PEL_UNI_W(qpel, v, 12);
277 PEL_UNI_W(qpel, v, 16);
278 PEL_UNI_W(qpel, v, 24);
279 PEL_UNI_W(qpel, v, 32);
280 PEL_UNI_W(qpel, v, 48);
281 PEL_UNI_W(qpel, v, 64);
282 
283 PEL_UNI_W(qpel, h, 4);
284 PEL_UNI_W(qpel, h, 6);
285 PEL_UNI_W(qpel, h, 8);
286 PEL_UNI_W(qpel, h, 12);
287 PEL_UNI_W(qpel, h, 16);
288 PEL_UNI_W(qpel, h, 24);
289 PEL_UNI_W(qpel, h, 32);
290 PEL_UNI_W(qpel, h, 48);
291 PEL_UNI_W(qpel, h, 64);
292 
293 PEL_UNI_W(epel, hv, 4);
294 PEL_UNI_W(epel, hv, 6);
295 PEL_UNI_W(epel, hv, 8);
296 PEL_UNI_W(epel, hv, 12);
297 PEL_UNI_W(epel, hv, 16);
298 PEL_UNI_W(epel, hv, 24);
299 PEL_UNI_W(epel, hv, 32);
300 PEL_UNI_W(epel, hv, 48);
301 PEL_UNI_W(epel, hv, 64);
302 
303 PEL_UNI_W(epel, h, 4);
304 PEL_UNI_W(epel, h, 6);
305 PEL_UNI_W(epel, h, 8);
306 PEL_UNI_W(epel, h, 12);
307 PEL_UNI_W(epel, h, 16);
308 PEL_UNI_W(epel, h, 24);
309 PEL_UNI_W(epel, h, 32);
310 PEL_UNI_W(epel, h, 48);
311 PEL_UNI_W(epel, h, 64);
312 
313 PEL_UNI_W(epel, v, 4);
314 PEL_UNI_W(epel, v, 6);
315 PEL_UNI_W(epel, v, 8);
316 PEL_UNI_W(epel, v, 12);
317 PEL_UNI_W(epel, v, 16);
318 PEL_UNI_W(epel, v, 24);
319 PEL_UNI_W(epel, v, 32);
320 PEL_UNI_W(epel, v, 48);
321 PEL_UNI_W(epel, v, 64);
322 
323 #undef PEL_UNI_W
324 
325 #endif // #ifndef AVCODEC_LOONGARCH_HEVCDSP_LSX_H
ff_hevc_loop_filter_chroma_v_8_lsx
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)
Definition: hevc_lpf_sao_lsx.c:917
ff_hevc_idct_8x8_lsx
void ff_hevc_idct_8x8_lsx(int16_t *coeffs, int col_limit)
Definition: hevc_idct_lsx.c:360
ff_hevc_sao_edge_filter_8_lsx
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)
Definition: hevc_lpf_sao_lsx.c:2367
ff_hevc_idct_16x16_lsx
void ff_hevc_idct_16x16_lsx(int16_t *coeffs, int col_limit)
Definition: hevc_idct_lsx.c:386
MC
#define MC(PEL, DIR, WIDTH)
Definition: hevcdsp_lsx.h:28
ff_hevc_add_residual8x8_8_lsx
void ff_hevc_add_residual8x8_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_add_residual32x32_8_lsx
void ff_hevc_add_residual32x32_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
ff_hevc_add_residual16x16_8_lsx
void ff_hevc_add_residual16x16_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
PEL_UNI_W
#define PEL_UNI_W(PEL, DIR, WIDTH)
Definition: hevcdsp_lsx.h:248
dsp.h
height
#define height
Definition: dsp.h:89
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
BI_MC
#define BI_MC(PEL, DIR, WIDTH)
Definition: hevcdsp_lsx.h:88
stride
#define stride
Definition: h264pred_template.c:536
ff_hevc_loop_filter_chroma_h_8_lsx
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)
Definition: hevc_lpf_sao_lsx.c:863
ff_hevc_loop_filter_luma_h_8_lsx
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)
Definition: hevc_lpf_sao_lsx.c:26
ff_hevc_idct_32x32_lsx
void ff_hevc_idct_32x32_lsx(int16_t *coeffs, int col_limit)
Definition: hevc_idct_lsx.c:811
ff_hevc_idct_4x4_lsx
void ff_hevc_idct_4x4_lsx(int16_t *coeffs, int col_limit)
Definition: hevc_idct_lsx.c:330
ff_hevc_loop_filter_luma_v_8_lsx
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)
Definition: hevc_lpf_sao_lsx.c:438
UNI_MC
#define UNI_MC(PEL, DIR, WIDTH)
Definition: hevcdsp_lsx.h:151
UNI_W_MC
#define UNI_W_MC(PEL, DIR, WIDTH)
Definition: hevcdsp_lsx.h:193
int32_t
int32_t
Definition: audioconvert.c:56
h
h
Definition: vp9dsp_template.c:2070
width
#define width
Definition: dsp.h:89
ff_hevc_add_residual4x4_8_lsx
void ff_hevc_add_residual4x4_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride)
src
#define src
Definition: vp8dsp.c:248