History

lavc/jpeg2000dsp: R-V V ict_float

jpeg2000_ict_float_c: 3112.2 jpeg2000_ict_float_rvv_f32: 1225.0

Rémi Denis-Courmont committed 3 years ago

Commit 73dea2b1 parent b2a441a5 files · +91 −1Browse files

Showing the changes to libavcodec (5 of 5 files). Show all

Unified · Split

5 files
  1. libavcodec/jpeg2000dsp.c +3 −1
  2. libavcodec/jpeg2000dsp.h +1 −0
  3. libavcodec/riscv/Makefile +2 −0
  4. libavcodec/riscv/jpeg2000dsp_init.c +36 −0
  5. libavcodec/riscv/jpeg2000dsp_rvv.S +49 −0
libavcodec/jpeg2000dsp.c+3−1
@@ -96,7 +96,9 @@ av_cold void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c) · 95 unmodified lines
9696 c->mct_decode[FF_DWT53] = rct_int;
9797 c->mct_decode[FF_DWT97_INT] = ict_int;
9898
99−#if ARCH_X86
99+#if ARCH_RISCV
100+ ff_jpeg2000dsp_init_riscv(c);
101+#elif ARCH_X86
100102 ff_jpeg2000dsp_init_x86(c);
101103 #endif
102104 }
libavcodec/jpeg2000dsp.h+1−0
@@ -33,6 +33,7 @@ typedef struct Jpeg2000DSPContext { · 32 unmodified lines
3333 extern const float ff_jpeg2000_f_ict_params[4];
3434
3535 void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c);
36+void ff_jpeg2000dsp_init_riscv(Jpeg2000DSPContext *c);
3637 void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c);
3738
3839 #endif /* AVCODEC_JPEG2000DSP_H */
libavcodec/riscv/Makefile+2−0
@@ -16,6 +16,8 @@ OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o · 15 unmodified lines
1616 RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o
1717 OBJS-$(CONFIG_G722DSP) += riscv/g722dsp_init.o
1818 RVV-OBJS-$(CONFIG_G722DSP) += riscv/g722dsp_rvv.o
19+OBJS-$(CONFIG_JPEG2000_DECODER) += riscv/jpeg2000dsp_init.o
20+RVV-OBJS-$(CONFIG_JPEG2000_DECODER) += riscv/jpeg2000dsp_rvv.o
1921 OBJS-$(CONFIG_H264CHROMA) += riscv/h264_chroma_init_riscv.o
2022 RVV-OBJS-$(CONFIG_H264CHROMA) += riscv/h264_mc_chroma.o
2123 OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_init.o
libavcodec/riscv/jpeg2000dsp_init.c+36−0
@@ -0,0 +1,36 @@
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/jpeg2000dsp.h"
25+
26+void ff_ict_float_rvv(void *src0, void *src1, void *src2, int csize);
27+
28+av_cold void ff_jpeg2000dsp_init_riscv(Jpeg2000DSPContext *c)
29+{
30+#if HAVE_RVV
31+ int flags = av_get_cpu_flags();
32+
33+ if ((flags & AV_CPU_FLAG_RVV_F32) && (flags & AV_CPU_FLAG_RVB_ADDR))
34+ c->mct_decode[FF_DWT97] = ff_ict_float_rvv;
35+#endif
36+}
libavcodec/riscv/jpeg2000dsp_rvv.S+49−0
@@ -0,0 +1,49 @@
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+
23+func ff_ict_float_rvv, zve32f
24+ lla t0, ff_jpeg2000_f_ict_params
25+ flw ft0, 0(t0)
26+ flw ft1, 4(t0)
27+ flw ft2, 8(t0)
28+ flw ft3, 12(t0)
29+1:
30+ vsetvli t0, a3, e32, m8, ta, ma
31+ vle32.v v8, (a0)
32+ sub a3, a3, t0
33+ vle32.v v16, (a1)
34+ vle32.v v24, (a2)
35+ vfmul.vf v0, v16, ft1
36+ vfmadd.vf v16, ft3, v8
37+ vfsub.vv v0, v8, v0
38+ vfmacc.vf v8, ft0, v24
39+ vfnmsac.vf v0, ft2, v24
40+ vse32.v v8, (a0)
41+ sh2add a0, t0, a0
42+ vse32.v v0, (a1)
43+ sh2add a1, t0, a1
44+ vse32.v v16, (a2)
45+ sh2add a2, t0, a2
46+ bnez a3, 1b
47+
48+ ret
49+endfunc

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