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
96 c->mct_decode[FF_DWT53] = rct_int;96 c->mct_decode[FF_DWT53] = rct_int;
97 c->mct_decode[FF_DWT97_INT] = ict_int;97 c->mct_decode[FF_DWT97_INT] = ict_int;
98 98
99#if ARCH_X8699#if ARCH_RISCV
100 ff_jpeg2000dsp_init_riscv(c);
101#elif ARCH_X86
100 ff_jpeg2000dsp_init_x86(c);102 ff_jpeg2000dsp_init_x86(c);
101#endif103#endif
102}104}
libavcodec/jpeg2000dsp.h+1−0
@@ -33,6 +33,7 @@ typedef struct Jpeg2000DSPContext { · 32 unmodified lines
33extern const float ff_jpeg2000_f_ict_params[4];33extern const float ff_jpeg2000_f_ict_params[4];
34 34
35void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c);35void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c);
36void ff_jpeg2000dsp_init_riscv(Jpeg2000DSPContext *c);
36void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c);37void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c);
37 38
38#endif /* AVCODEC_JPEG2000DSP_H */39#endif /* AVCODEC_JPEG2000DSP_H */
libavcodec/riscv/Makefile+2−0
@@ -16,6 +16,8 @@ OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o · 15 unmodified lines
16RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o16RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o
17OBJS-$(CONFIG_G722DSP) += riscv/g722dsp_init.o17OBJS-$(CONFIG_G722DSP) += riscv/g722dsp_init.o
18RVV-OBJS-$(CONFIG_G722DSP) += riscv/g722dsp_rvv.o18RVV-OBJS-$(CONFIG_G722DSP) += riscv/g722dsp_rvv.o
19OBJS-$(CONFIG_JPEG2000_DECODER) += riscv/jpeg2000dsp_init.o
20RVV-OBJS-$(CONFIG_JPEG2000_DECODER) += riscv/jpeg2000dsp_rvv.o
19OBJS-$(CONFIG_H264CHROMA) += riscv/h264_chroma_init_riscv.o21OBJS-$(CONFIG_H264CHROMA) += riscv/h264_chroma_init_riscv.o
20RVV-OBJS-$(CONFIG_H264CHROMA) += riscv/h264_mc_chroma.o22RVV-OBJS-$(CONFIG_H264CHROMA) += riscv/h264_mc_chroma.o
21OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_init.o23OBJS-$(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
26void ff_ict_float_rvv(void *src0, void *src1, void *src2, int csize);
27
28av_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
23func 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)
291:
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
49endfunc

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