History

avcodec/hevc: Add pel_uni_w_pixels4/6/8/12/16/24/32/48/64 asm opt

tests/checkasm/checkasm: C LSX LASX put_hevc_pel_uni_w_pixels4_8_c: 2.7 1.0 put_hevc_pel_uni_w_pixels6_8_c: 6.2 2.0 1.5 put_hevc_pel_uni_w_pixels8_8_c: 10.7 2.5 1.7 put_hevc_pel_uni_w_pixels12_8_c: 23.0 5.5 5.0 put_hevc_pel_uni_w_pixels16_8_c: 41.0 8.2 5.0 put_hevc_pel_uni_w_pixels24_8_c: 91.0 19.7 13.2 put_hevc_pel_uni_w_pixels32_8_c: 161.7 32.5 16.2 put_hevc_pel_uni_w_pixels48_8_c: 354.5 73.7 43.0 put_hevc_pel_uni_w_pixels64_8_c: 641.5 130.0 64.2 Speedup of decoding H265 4K 30FPS 30Mbps on 3A6000 with 8 threads is 1fps(47fps-->48fps).

jinbo committed 2 years ago

Commit a28eea21 parent cfbdda65 files · +596 −1Browse files

Unified · Split

5 files
  1. libavcodec/loongarch/Makefile +2 −1
  2. libavcodec/loongarch/hevc_mc.S +471 −0
  3. libavcodec/loongarch/hevcdsp_init_loongarch.c +43 −0
  4. libavcodec/loongarch/hevcdsp_lasx.h +53 −0
  5. libavcodec/loongarch/hevcdsp_lsx.h +27 −0
libavcodec/loongarch/Makefile+2−1
@@ -28,7 +28,8 @@ LSX-OBJS-$(CONFIG_HEVC_DECODER) += loongarch/hevcdsp_lsx.o \ · 27 unmodified lines
28 loongarch/hevc_mc_bi_lsx.o \28 loongarch/hevc_mc_bi_lsx.o \
29 loongarch/hevc_mc_uni_lsx.o \29 loongarch/hevc_mc_uni_lsx.o \
30 loongarch/hevc_mc_uniw_lsx.o \30 loongarch/hevc_mc_uniw_lsx.o \
31 loongarch/hevc_add_res.o31 loongarch/hevc_add_res.o \
32 loongarch/hevc_mc.o
32LSX-OBJS-$(CONFIG_H264DSP) += loongarch/h264idct.o \33LSX-OBJS-$(CONFIG_H264DSP) += loongarch/h264idct.o \
33 loongarch/h264idct_loongarch.o \34 loongarch/h264idct_loongarch.o \
34 loongarch/h264dsp.o35 loongarch/h264dsp.o
libavcodec/loongarch/hevc_mc.S+471−0
@@ -0,0 +1,471 @@
1/*
2 * Copyright (c) 2023 Loongson Technology Corporation Limited
3 * Contributed by jinbo <jinbo@loongson.cn>
4 *
5 * This file is part of FFmpeg.
6 *
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.
11 *
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.
16 *
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
20 */
21
22#include "loongson_asm.S"
23
24.macro LOAD_VAR bit
25 addi.w t1, a5, 6 //shift
26 addi.w t3, zero, 1 //one
27 sub.w t4, t1, t3
28 sll.w t3, t3, t4 //offset
29.if \bit == 128
30 vreplgr2vr.w vr1, a6 //wx
31 vreplgr2vr.w vr2, t3 //offset
32 vreplgr2vr.w vr3, t1 //shift
33 vreplgr2vr.w vr4, a7 //ox
34.else
35 xvreplgr2vr.w xr1, a6
36 xvreplgr2vr.w xr2, t3
37 xvreplgr2vr.w xr3, t1
38 xvreplgr2vr.w xr4, a7
39.endif
40.endm
41
42.macro HEVC_PEL_UNI_W_PIXELS8_LSX src0, dst0, w
43 vldrepl.d vr0, \src0, 0
44 vsllwil.hu.bu vr0, vr0, 0
45 vexth.wu.hu vr5, vr0
46 vsllwil.wu.hu vr0, vr0, 0
47 vslli.w vr0, vr0, 6
48 vslli.w vr5, vr5, 6
49 vmul.w vr0, vr0, vr1
50 vmul.w vr5, vr5, vr1
51 vadd.w vr0, vr0, vr2
52 vadd.w vr5, vr5, vr2
53 vsra.w vr0, vr0, vr3
54 vsra.w vr5, vr5, vr3
55 vadd.w vr0, vr0, vr4
56 vadd.w vr5, vr5, vr4
57 vssrani.h.w vr5, vr0, 0
58 vssrani.bu.h vr5, vr5, 0
59.if \w == 6
60 fst.s f5, \dst0, 0
61 vstelm.h vr5, \dst0, 4, 2
62.else
63 fst.d f5, \dst0, 0
64.endif
65.endm
66
67.macro HEVC_PEL_UNI_W_PIXELS8x2_LASX src0, dst0, w
68 vldrepl.d vr0, \src0, 0
69 add.d t2, \src0, a3
70 vldrepl.d vr5, t2, 0
71 xvpermi.q xr0, xr5, 0x02
72 xvsllwil.hu.bu xr0, xr0, 0
73 xvexth.wu.hu xr5, xr0
74 xvsllwil.wu.hu xr0, xr0, 0
75 xvslli.w xr0, xr0, 6
76 xvslli.w xr5, xr5, 6
77 xvmul.w xr0, xr0, xr1
78 xvmul.w xr5, xr5, xr1
79 xvadd.w xr0, xr0, xr2
80 xvadd.w xr5, xr5, xr2
81 xvsra.w xr0, xr0, xr3
82 xvsra.w xr5, xr5, xr3
83 xvadd.w xr0, xr0, xr4
84 xvadd.w xr5, xr5, xr4
85 xvssrani.h.w xr5, xr0, 0
86 xvpermi.q xr0, xr5, 0x01
87 xvssrani.bu.h xr0, xr5, 0
88 add.d t3, \dst0, a1
89.if \w == 6
90 vstelm.w vr0, \dst0, 0, 0
91 vstelm.h vr0, \dst0, 4, 2
92 vstelm.w vr0, t3, 0, 2
93 vstelm.h vr0, t3, 4, 6
94.else
95 vstelm.d vr0, \dst0, 0, 0
96 vstelm.d vr0, t3, 0, 1
97.endif
98.endm
99
100.macro HEVC_PEL_UNI_W_PIXELS16_LSX src0, dst0
101 vld vr0, \src0, 0
102 vexth.hu.bu vr7, vr0
103 vexth.wu.hu vr8, vr7
104 vsllwil.wu.hu vr7, vr7, 0
105 vsllwil.hu.bu vr5, vr0, 0
106 vexth.wu.hu vr6, vr5
107 vsllwil.wu.hu vr5, vr5, 0
108 vslli.w vr5, vr5, 6
109 vslli.w vr6, vr6, 6
110 vslli.w vr7, vr7, 6
111 vslli.w vr8, vr8, 6
112 vmul.w vr5, vr5, vr1
113 vmul.w vr6, vr6, vr1
114 vmul.w vr7, vr7, vr1
115 vmul.w vr8, vr8, vr1
116 vadd.w vr5, vr5, vr2
117 vadd.w vr6, vr6, vr2
118 vadd.w vr7, vr7, vr2
119 vadd.w vr8, vr8, vr2
120 vsra.w vr5, vr5, vr3
121 vsra.w vr6, vr6, vr3
122 vsra.w vr7, vr7, vr3
123 vsra.w vr8, vr8, vr3
124 vadd.w vr5, vr5, vr4
125 vadd.w vr6, vr6, vr4
126 vadd.w vr7, vr7, vr4
127 vadd.w vr8, vr8, vr4
128 vssrani.h.w vr6, vr5, 0
129 vssrani.h.w vr8, vr7, 0
130 vssrani.bu.h vr8, vr6, 0
131 vst vr8, \dst0, 0
132.endm
133
134.macro HEVC_PEL_UNI_W_PIXELS16_LASX src0, dst0
135 vld vr0, \src0, 0
136 xvpermi.d xr0, xr0, 0xd8
137 xvsllwil.hu.bu xr0, xr0, 0
138 xvexth.wu.hu xr6, xr0
139 xvsllwil.wu.hu xr5, xr0, 0
140 xvslli.w xr5, xr5, 6
141 xvslli.w xr6, xr6, 6
142 xvmul.w xr5, xr5, xr1
143 xvmul.w xr6, xr6, xr1
144 xvadd.w xr5, xr5, xr2
145 xvadd.w xr6, xr6, xr2
146 xvsra.w xr5, xr5, xr3
147 xvsra.w xr6, xr6, xr3
148 xvadd.w xr5, xr5, xr4
149 xvadd.w xr6, xr6, xr4
150 xvssrani.h.w xr6, xr5, 0
151 xvpermi.q xr7, xr6, 0x01
152 xvssrani.bu.h xr7, xr6, 0
153 vst vr7, \dst0, 0
154.endm
155
156.macro HEVC_PEL_UNI_W_PIXELS32_LASX src0, dst0, w
157.if \w == 16
158 vld vr0, \src0, 0
159 add.d t2, \src0, a3
160 vld vr5, t2, 0
161 xvpermi.q xr0, xr5, 0x02
162.else //w=24/32
163 xvld xr0, \src0, 0
164.endif
165 xvexth.hu.bu xr7, xr0
166 xvexth.wu.hu xr8, xr7
167 xvsllwil.wu.hu xr7, xr7, 0
168 xvsllwil.hu.bu xr5, xr0, 0
169 xvexth.wu.hu xr6, xr5
170 xvsllwil.wu.hu xr5, xr5, 0
171 xvslli.w xr5, xr5, 6
172 xvslli.w xr6, xr6, 6
173 xvslli.w xr7, xr7, 6
174 xvslli.w xr8, xr8, 6
175 xvmul.w xr5, xr5, xr1
176 xvmul.w xr6, xr6, xr1
177 xvmul.w xr7, xr7, xr1
178 xvmul.w xr8, xr8, xr1
179 xvadd.w xr5, xr5, xr2
180 xvadd.w xr6, xr6, xr2
181 xvadd.w xr7, xr7, xr2
182 xvadd.w xr8, xr8, xr2
183 xvsra.w xr5, xr5, xr3
184 xvsra.w xr6, xr6, xr3
185 xvsra.w xr7, xr7, xr3
186 xvsra.w xr8, xr8, xr3
187 xvadd.w xr5, xr5, xr4
188 xvadd.w xr6, xr6, xr4
189 xvadd.w xr7, xr7, xr4
190 xvadd.w xr8, xr8, xr4
191 xvssrani.h.w xr6, xr5, 0
192 xvssrani.h.w xr8, xr7, 0
193 xvssrani.bu.h xr8, xr6, 0
194.if \w == 16
195 vst vr8, \dst0, 0
196 add.d t2, \dst0, a1
197 xvpermi.q xr8, xr8, 0x01
198 vst vr8, t2, 0
199.elseif \w == 24
200 vst vr8, \dst0, 0
201 xvstelm.d xr8, \dst0, 16, 2
202.else
203 xvst xr8, \dst0, 0
204.endif
205.endm
206
207function ff_hevc_put_hevc_pel_uni_w_pixels4_8_lsx
208 LOAD_VAR 128
209 srli.w t0, a4, 1
210.LOOP_PIXELS4:
211 vldrepl.w vr0, a2, 0
212 add.d t1, a2, a3
213 vldrepl.w vr5, t1, 0
214 vsllwil.hu.bu vr0, vr0, 0
215 vsllwil.wu.hu vr0, vr0, 0
216 vsllwil.hu.bu vr5, vr5, 0
217 vsllwil.wu.hu vr5, vr5, 0
218 vslli.w vr0, vr0, 6
219 vslli.w vr5, vr5, 6
220 vmul.w vr0, vr0, vr1
221 vmul.w vr5, vr5, vr1
222 vadd.w vr0, vr0, vr2
223 vadd.w vr5, vr5, vr2
224 vsra.w vr0, vr0, vr3
225 vsra.w vr5, vr5, vr3
226 vadd.w vr0, vr0, vr4
227 vadd.w vr5, vr5, vr4
228 vssrani.h.w vr5, vr0, 0
229 vssrani.bu.h vr5, vr5, 0
230 fst.s f5, a0, 0
231 add.d t2, a0, a1
232 vstelm.w vr5, t2, 0, 1
233 alsl.d a2, a3, a2, 1
234 alsl.d a0, a1, a0, 1
235 addi.w t0, t0, -1
236 bnez t0, .LOOP_PIXELS4
237endfunc
238
239function ff_hevc_put_hevc_pel_uni_w_pixels6_8_lsx
240 LOAD_VAR 128
241.LOOP_PIXELS6:
242 HEVC_PEL_UNI_W_PIXELS8_LSX a2, a0, 6
243 add.d a2, a2, a3
244 add.d a0, a0, a1
245 addi.w a4, a4, -1
246 bnez a4, .LOOP_PIXELS6
247endfunc
248
249function ff_hevc_put_hevc_pel_uni_w_pixels6_8_lasx
250 LOAD_VAR 256
251 srli.w t0, a4, 1
252.LOOP_PIXELS6_LASX:
253 HEVC_PEL_UNI_W_PIXELS8x2_LASX a2, a0, 6
254 alsl.d a2, a3, a2, 1
255 alsl.d a0, a1, a0, 1
256 addi.w t0, t0, -1
257 bnez t0, .LOOP_PIXELS6_LASX
258endfunc
259
260function ff_hevc_put_hevc_pel_uni_w_pixels8_8_lsx
261 LOAD_VAR 128
262.LOOP_PIXELS8:
263 HEVC_PEL_UNI_W_PIXELS8_LSX a2, a0, 8
264 add.d a2, a2, a3
265 add.d a0, a0, a1
266 addi.w a4, a4, -1
267 bnez a4, .LOOP_PIXELS8
268endfunc
269
270function ff_hevc_put_hevc_pel_uni_w_pixels8_8_lasx
271 LOAD_VAR 256
272 srli.w t0, a4, 1
273.LOOP_PIXELS8_LASX:
274 HEVC_PEL_UNI_W_PIXELS8x2_LASX a2, a0, 8
275 alsl.d a2, a3, a2, 1
276 alsl.d a0, a1, a0, 1
277 addi.w t0, t0, -1
278 bnez t0, .LOOP_PIXELS8_LASX
279endfunc
280
281function ff_hevc_put_hevc_pel_uni_w_pixels12_8_lsx
282 LOAD_VAR 128
283.LOOP_PIXELS12:
284 vld vr0, a2, 0
285 vexth.hu.bu vr7, vr0
286 vsllwil.wu.hu vr7, vr7, 0
287 vsllwil.hu.bu vr5, vr0, 0
288 vexth.wu.hu vr6, vr5
289 vsllwil.wu.hu vr5, vr5, 0
290 vslli.w vr5, vr5, 6
291 vslli.w vr6, vr6, 6
292 vslli.w vr7, vr7, 6
293 vmul.w vr5, vr5, vr1
294 vmul.w vr6, vr6, vr1
295 vmul.w vr7, vr7, vr1
296 vadd.w vr5, vr5, vr2
297 vadd.w vr6, vr6, vr2
298 vadd.w vr7, vr7, vr2
299 vsra.w vr5, vr5, vr3
300 vsra.w vr6, vr6, vr3
301 vsra.w vr7, vr7, vr3
302 vadd.w vr5, vr5, vr4
303 vadd.w vr6, vr6, vr4
304 vadd.w vr7, vr7, vr4
305 vssrani.h.w vr6, vr5, 0
306 vssrani.h.w vr7, vr7, 0
307 vssrani.bu.h vr7, vr6, 0
308 fst.d f7, a0, 0
309 vstelm.w vr7, a0, 8, 2
310 add.d a2, a2, a3
311 add.d a0, a0, a1
312 addi.w a4, a4, -1
313 bnez a4, .LOOP_PIXELS12
314endfunc
315
316function ff_hevc_put_hevc_pel_uni_w_pixels12_8_lasx
317 LOAD_VAR 256
318.LOOP_PIXELS12_LASX:
319 vld vr0, a2, 0
320 xvpermi.d xr0, xr0, 0xd8
321 xvsllwil.hu.bu xr0, xr0, 0
322 xvexth.wu.hu xr6, xr0
323 xvsllwil.wu.hu xr5, xr0, 0
324 xvslli.w xr5, xr5, 6
325 xvslli.w xr6, xr6, 6
326 xvmul.w xr5, xr5, xr1
327 xvmul.w xr6, xr6, xr1
328 xvadd.w xr5, xr5, xr2
329 xvadd.w xr6, xr6, xr2
330 xvsra.w xr5, xr5, xr3
331 xvsra.w xr6, xr6, xr3
332 xvadd.w xr5, xr5, xr4
333 xvadd.w xr6, xr6, xr4
334 xvssrani.h.w xr6, xr5, 0
335 xvpermi.q xr7, xr6, 0x01
336 xvssrani.bu.h xr7, xr6, 0
337 fst.d f7, a0, 0
338 vstelm.w vr7, a0, 8, 2
339 add.d a2, a2, a3
340 add.d a0, a0, a1
341 addi.w a4, a4, -1
342 bnez a4, .LOOP_PIXELS12_LASX
343endfunc
344
345function ff_hevc_put_hevc_pel_uni_w_pixels16_8_lsx
346 LOAD_VAR 128
347.LOOP_PIXELS16:
348 HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
349 add.d a2, a2, a3
350 add.d a0, a0, a1
351 addi.w a4, a4, -1
352 bnez a4, .LOOP_PIXELS16
353endfunc
354
355function ff_hevc_put_hevc_pel_uni_w_pixels16_8_lasx
356 LOAD_VAR 256
357 srli.w t0, a4, 1
358.LOOP_PIXELS16_LASX:
359 HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 16
360 alsl.d a2, a3, a2, 1
361 alsl.d a0, a1, a0, 1
362 addi.w t0, t0, -1
363 bnez t0, .LOOP_PIXELS16_LASX
364endfunc
365
366function ff_hevc_put_hevc_pel_uni_w_pixels24_8_lsx
367 LOAD_VAR 128
368.LOOP_PIXELS24:
369 HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
370 addi.d t0, a2, 16
371 addi.d t1, a0, 16
372 HEVC_PEL_UNI_W_PIXELS8_LSX t0, t1, 8
373 add.d a2, a2, a3
374 add.d a0, a0, a1
375 addi.w a4, a4, -1
376 bnez a4, .LOOP_PIXELS24
377endfunc
378
379function ff_hevc_put_hevc_pel_uni_w_pixels24_8_lasx
380 LOAD_VAR 256
381.LOOP_PIXELS24_LASX:
382 HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 24
383 add.d a2, a2, a3
384 add.d a0, a0, a1
385 addi.w a4, a4, -1
386 bnez a4, .LOOP_PIXELS24_LASX
387endfunc
388
389function ff_hevc_put_hevc_pel_uni_w_pixels32_8_lsx
390 LOAD_VAR 128
391.LOOP_PIXELS32:
392 HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
393 addi.d t0, a2, 16
394 addi.d t1, a0, 16
395 HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
396 add.d a2, a2, a3
397 add.d a0, a0, a1
398 addi.w a4, a4, -1
399 bnez a4, .LOOP_PIXELS32
400endfunc
401
402function ff_hevc_put_hevc_pel_uni_w_pixels32_8_lasx
403 LOAD_VAR 256
404.LOOP_PIXELS32_LASX:
405 HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 32
406 add.d a2, a2, a3
407 add.d a0, a0, a1
408 addi.w a4, a4, -1
409 bnez a4, .LOOP_PIXELS32_LASX
410endfunc
411
412function ff_hevc_put_hevc_pel_uni_w_pixels48_8_lsx
413 LOAD_VAR 128
414.LOOP_PIXELS48:
415 HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
416 addi.d t0, a2, 16
417 addi.d t1, a0, 16
418 HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
419 addi.d t0, a2, 32
420 addi.d t1, a0, 32
421 HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
422 add.d a2, a2, a3
423 add.d a0, a0, a1
424 addi.w a4, a4, -1
425 bnez a4, .LOOP_PIXELS48
426endfunc
427
428function ff_hevc_put_hevc_pel_uni_w_pixels48_8_lasx
429 LOAD_VAR 256
430.LOOP_PIXELS48_LASX:
431 HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 32
432 addi.d t0, a2, 32
433 addi.d t1, a0, 32
434 HEVC_PEL_UNI_W_PIXELS16_LASX t0, t1
435 add.d a2, a2, a3
436 add.d a0, a0, a1
437 addi.w a4, a4, -1
438 bnez a4, .LOOP_PIXELS48_LASX
439endfunc
440
441function ff_hevc_put_hevc_pel_uni_w_pixels64_8_lsx
442 LOAD_VAR 128
443.LOOP_PIXELS64:
444 HEVC_PEL_UNI_W_PIXELS16_LSX a2, a0
445 addi.d t0, a2, 16
446 addi.d t1, a0, 16
447 HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
448 addi.d t0, a2, 32
449 addi.d t1, a0, 32
450 HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
451 addi.d t0, a2, 48
452 addi.d t1, a0, 48
453 HEVC_PEL_UNI_W_PIXELS16_LSX t0, t1
454 add.d a2, a2, a3
455 add.d a0, a0, a1
456 addi.w a4, a4, -1
457 bnez a4, .LOOP_PIXELS64
458endfunc
459
460function ff_hevc_put_hevc_pel_uni_w_pixels64_8_lasx
461 LOAD_VAR 256
462.LOOP_PIXELS64_LASX:
463 HEVC_PEL_UNI_W_PIXELS32_LASX a2, a0, 32
464 addi.d t0, a2, 32
465 addi.d t1, a0, 32
466 HEVC_PEL_UNI_W_PIXELS32_LASX t0, t1, 32
467 add.d a2, a2, a3
468 add.d a0, a0, a1
469 addi.w a4, a4, -1
470 bnez a4, .LOOP_PIXELS64_LASX
471endfunc
libavcodec/loongarch/hevcdsp_init_loongarch.c+43−0
@@ -22,6 +22,7 @@ · 21 unmodified lines
22 22
23#include "libavutil/loongarch/cpu.h"23#include "libavutil/loongarch/cpu.h"
24#include "hevcdsp_lsx.h"24#include "hevcdsp_lsx.h"
25#include "hevcdsp_lasx.h"
25 26
26void ff_hevc_dsp_init_loongarch(HEVCDSPContext *c, const int bit_depth)27void ff_hevc_dsp_init_loongarch(HEVCDSPContext *c, const int bit_depth)
27{28{
@@ -160,6 +161,26 @@ void ff_hevc_dsp_init_loongarch(HEVCDSPContext *c, const int bit_depth) · 132 unmodified lines
160 c->put_hevc_epel_uni[6][1][1] = ff_hevc_put_hevc_uni_epel_hv24_8_lsx;161 c->put_hevc_epel_uni[6][1][1] = ff_hevc_put_hevc_uni_epel_hv24_8_lsx;
161 c->put_hevc_epel_uni[7][1][1] = ff_hevc_put_hevc_uni_epel_hv32_8_lsx;162 c->put_hevc_epel_uni[7][1][1] = ff_hevc_put_hevc_uni_epel_hv32_8_lsx;
162 163
164 c->put_hevc_qpel_uni_w[1][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels4_8_lsx;
165 c->put_hevc_qpel_uni_w[2][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels6_8_lsx;
166 c->put_hevc_qpel_uni_w[3][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels8_8_lsx;
167 c->put_hevc_qpel_uni_w[4][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels12_8_lsx;
168 c->put_hevc_qpel_uni_w[5][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels16_8_lsx;
169 c->put_hevc_qpel_uni_w[6][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels24_8_lsx;
170 c->put_hevc_qpel_uni_w[7][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels32_8_lsx;
171 c->put_hevc_qpel_uni_w[8][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels48_8_lsx;
172 c->put_hevc_qpel_uni_w[9][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels64_8_lsx;
173
174 c->put_hevc_epel_uni_w[1][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels4_8_lsx;
175 c->put_hevc_epel_uni_w[2][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels6_8_lsx;
176 c->put_hevc_epel_uni_w[3][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels8_8_lsx;
177 c->put_hevc_epel_uni_w[4][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels12_8_lsx;
178 c->put_hevc_epel_uni_w[5][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels16_8_lsx;
179 c->put_hevc_epel_uni_w[6][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels24_8_lsx;
180 c->put_hevc_epel_uni_w[7][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels32_8_lsx;
181 c->put_hevc_epel_uni_w[8][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels48_8_lsx;
182 c->put_hevc_epel_uni_w[9][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels64_8_lsx;
183
163 c->put_hevc_qpel_uni_w[3][1][1] = ff_hevc_put_hevc_uni_w_qpel_hv8_8_lsx;184 c->put_hevc_qpel_uni_w[3][1][1] = ff_hevc_put_hevc_uni_w_qpel_hv8_8_lsx;
164 c->put_hevc_qpel_uni_w[5][1][1] = ff_hevc_put_hevc_uni_w_qpel_hv16_8_lsx;185 c->put_hevc_qpel_uni_w[5][1][1] = ff_hevc_put_hevc_uni_w_qpel_hv16_8_lsx;
165 c->put_hevc_qpel_uni_w[6][1][1] = ff_hevc_put_hevc_uni_w_qpel_hv24_8_lsx;186 c->put_hevc_qpel_uni_w[6][1][1] = ff_hevc_put_hevc_uni_w_qpel_hv24_8_lsx;
@@ -196,4 +217,26 @@ void ff_hevc_dsp_init_loongarch(HEVCDSPContext *c, const int bit_depth) · 30 unmodified lines
196 c->add_residual[3] = ff_hevc_add_residual32x32_8_lsx;217 c->add_residual[3] = ff_hevc_add_residual32x32_8_lsx;
197 }218 }
198 }219 }
220
221 if (have_lasx(cpu_flags)) {
222 if (bit_depth == 8) {
223 c->put_hevc_qpel_uni_w[2][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels6_8_lasx;
224 c->put_hevc_qpel_uni_w[3][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels8_8_lasx;
225 c->put_hevc_qpel_uni_w[4][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels12_8_lasx;
226 c->put_hevc_qpel_uni_w[5][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels16_8_lasx;
227 c->put_hevc_qpel_uni_w[6][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels24_8_lasx;
228 c->put_hevc_qpel_uni_w[7][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels32_8_lasx;
229 c->put_hevc_qpel_uni_w[8][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels48_8_lasx;
230 c->put_hevc_qpel_uni_w[9][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels64_8_lasx;
231
232 c->put_hevc_epel_uni_w[2][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels6_8_lasx;
233 c->put_hevc_epel_uni_w[3][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels8_8_lasx;
234 c->put_hevc_epel_uni_w[4][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels12_8_lasx;
235 c->put_hevc_epel_uni_w[5][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels16_8_lasx;
236 c->put_hevc_epel_uni_w[6][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels24_8_lasx;
237 c->put_hevc_epel_uni_w[7][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels32_8_lasx;
238 c->put_hevc_epel_uni_w[8][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels48_8_lasx;
239 c->put_hevc_epel_uni_w[9][0][0] = ff_hevc_put_hevc_pel_uni_w_pixels64_8_lasx;
240 }
241 }
199}242}
libavcodec/loongarch/hevcdsp_lasx.h+53−0
@@ -0,0 +1,53 @@
1/*
2 * Copyright (c) 2023 Loongson Technology Corporation Limited
3 * Contributed by jinbo <jinbo@loongson.cn>
4 *
5 * This file is part of FFmpeg.
6 *
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.
11 *
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.
16 *
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
20 */
21
22#ifndef AVCODEC_LOONGARCH_HEVCDSP_LASX_H
23#define AVCODEC_LOONGARCH_HEVCDSP_LASX_H
24
25#include "libavcodec/hevcdsp.h"
26
27#define PEL_UNI_W(PEL, DIR, WIDTH) \
28void ff_hevc_put_hevc_##PEL##_uni_w_##DIR##WIDTH##_8_lasx(uint8_t *dst, \
29 ptrdiff_t \
30 dst_stride, \
31 const uint8_t *src, \
32 ptrdiff_t \
33 src_stride, \
34 int height, \
35 int denom, \
36 int wx, \
37 int ox, \
38 intptr_t mx, \
39 intptr_t my, \
40 int width)
41
42PEL_UNI_W(pel, pixels, 6);
43PEL_UNI_W(pel, pixels, 8);
44PEL_UNI_W(pel, pixels, 12);
45PEL_UNI_W(pel, pixels, 16);
46PEL_UNI_W(pel, pixels, 24);
47PEL_UNI_W(pel, pixels, 32);
48PEL_UNI_W(pel, pixels, 48);
49PEL_UNI_W(pel, pixels, 64);
50
51#undef PEL_UNI_W
52
53#endif // #ifndef AVCODEC_LOONGARCH_HEVCDSP_LASX_H
libavcodec/loongarch/hevcdsp_lsx.h+27−0
@@ -232,4 +232,31 @@ void ff_hevc_add_residual8x8_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t s · 231 unmodified lines
232void ff_hevc_add_residual16x16_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);232void ff_hevc_add_residual16x16_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
233void ff_hevc_add_residual32x32_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);233void ff_hevc_add_residual32x32_8_lsx(uint8_t *dst, const int16_t *res, ptrdiff_t stride);
234 234
235#define PEL_UNI_W(PEL, DIR, WIDTH) \
236void ff_hevc_put_hevc_##PEL##_uni_w_##DIR##WIDTH##_8_lsx(uint8_t *dst, \
237 ptrdiff_t \
238 dst_stride, \
239 const uint8_t *src, \
240 ptrdiff_t \
241 src_stride, \
242 int height, \
243 int denom, \
244 int wx, \
245 int ox, \
246 intptr_t mx, \
247 intptr_t my, \
248 int width)
249
250PEL_UNI_W(pel, pixels, 4);
251PEL_UNI_W(pel, pixels, 6);
252PEL_UNI_W(pel, pixels, 8);
253PEL_UNI_W(pel, pixels, 12);
254PEL_UNI_W(pel, pixels, 16);
255PEL_UNI_W(pel, pixels, 24);
256PEL_UNI_W(pel, pixels, 32);
257PEL_UNI_W(pel, pixels, 48);
258PEL_UNI_W(pel, pixels, 64);
259
260#undef PEL_UNI_W
261
235#endif // #ifndef AVCODEC_LOONGARCH_HEVCDSP_LSX_H262#endif // #ifndef AVCODEC_LOONGARCH_HEVCDSP_LSX_H

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t