History

lavc/utvideodsp: R-V V restore_rgb_planes

restore_rgb_planes_c: 133065.7 restore_rgb_planes_rvv_i32: 33317.2

Rémi Denis-Courmont committed 3 years ago

Commit 4aea0da1 parent 6aff17a5 files · +97 −1Browse files

Unified · Split

5 files
  1. libavcodec/riscv/Makefile +2 −0
  2. libavcodec/riscv/utvideodsp_init.c +38 −0
  3. libavcodec/riscv/utvideodsp_rvv.S +53 −0
  4. libavcodec/utvideodsp.c +3 −1
  5. libavcodec/utvideodsp.h +1 −0
libavcodec/riscv/Makefile+2−0
@@ -25,5 +25,7 @@ RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o · 24 unmodified lines
25OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \25OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \
26 riscv/pixblockdsp_rvi.o26 riscv/pixblockdsp_rvi.o
27RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o27RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o
28OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o
29RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o
28OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o30OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
29RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o31RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o
libavcodec/riscv/utvideodsp_init.c+38−0
@@ -0,0 +1,38 @@
1/*
2 * Copyright © 2023 Rémi Denis-Courmont.
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "config.h"
22#include "libavutil/attributes.h"
23#include "libavutil/cpu.h"
24#include "libavcodec/utvideodsp.h"
25
26void ff_restore_rgb_planes_rvv(uint8_t *r, uint8_t *g, uint8_t *b,
27 ptrdiff_t linesize_r, ptrdiff_t linesize_g,
28 ptrdiff_t linesize_b, int width, int height);
29
30av_cold void ff_utvideodsp_init_riscv(UTVideoDSPContext *c)
31{
32#if HAVE_RVV
33 int flags = av_get_cpu_flags();
34
35 if (flags & AV_CPU_FLAG_RVV_I32)
36 c->restore_rgb_planes = ff_restore_rgb_planes_rvv;
37#endif
38}
libavcodec/riscv/utvideodsp_rvv.S+53−0
@@ -0,0 +1,53 @@
1/*
2 * Copyright © 2023 Rémi Denis-Courmont.
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "libavutil/riscv/asm.S"
22
23func ff_restore_rgb_planes_rvv, zve32x
24 li t1, -0x80
25 sub a3, a3, a6
26 sub a4, a4, a6
27 sub a5, a5, a6
281:
29 mv t6, a6
30 addi a7, a7, -1
312:
32 vsetvli t0, t6, e8, m8, ta, ma
33 vle8.v v16, (a1)
34 sub t6, t6, t0
35 vle8.v v8, (a0)
36 vadd.vx v16, v16, t1
37 add a1, t0, a1
38 vle8.v v24, (a2)
39 vadd.vv v8, v8, v16
40 vadd.vv v24, v24, v16
41 vse8.v v8, (a0)
42 add a0, t0, a0
43 vse8.v v24, (a2)
44 add a2, t0, a2
45 bnez t6, 2b
46
47 add a0, a3, a0
48 add a1, a4, a1
49 add a2, a5, a2
50 bnez a7, 1b
51
52 ret
53endfunc
libavcodec/utvideodsp.c+3−1
@@ -77,7 +77,9 @@ av_cold void ff_utvideodsp_init(UTVideoDSPContext *c) · 76 unmodified lines
77 c->restore_rgb_planes = restore_rgb_planes_c;77 c->restore_rgb_planes = restore_rgb_planes_c;
78 c->restore_rgb_planes10 = restore_rgb_planes10_c;78 c->restore_rgb_planes10 = restore_rgb_planes10_c;
79 79
80#if ARCH_X8680#if ARCH_RISCV
81 ff_utvideodsp_init_riscv(c);
82#elif ARCH_X86
81 ff_utvideodsp_init_x86(c);83 ff_utvideodsp_init_x86(c);
82#endif84#endif
83}85}
libavcodec/utvideodsp.h+1−0
@@ -34,6 +34,7 @@ typedef struct UTVideoDSPContext { · 33 unmodified lines
34} UTVideoDSPContext;34} UTVideoDSPContext;
35 35
36void ff_utvideodsp_init(UTVideoDSPContext *c);36void ff_utvideodsp_init(UTVideoDSPContext *c);
37void ff_utvideodsp_init_riscv(UTVideoDSPContext *c);
37void ff_utvideodsp_init_x86(UTVideoDSPContext *c);38void ff_utvideodsp_init_x86(UTVideoDSPContext *c);
38 39
39#endif /* AVCODEC_UTVIDEODSP_H */40#endif /* AVCODEC_UTVIDEODSP_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