jpeg2000_ict_float_c: 3112.2 jpeg2000_ict_float_rvv_f32: 1225.0
Unified · Split
| @@ -96,7 +96,9 @@ av_cold void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c) · 95 unmodified lines | ||
| 96 | 96 | c->mct_decode[FF_DWT53] = rct_int; |
| 97 | 97 | c->mct_decode[FF_DWT97_INT] = ict_int; |
| 98 | 98 | |
| 99 | −#if ARCH_X86 | |
| 99 | +#if ARCH_RISCV | |
| 100 | + ff_jpeg2000dsp_init_riscv(c); | |
| 101 | +#elif ARCH_X86 | |
| 100 | 102 | ff_jpeg2000dsp_init_x86(c); |
| 101 | 103 | #endif |
| 102 | 104 | } |
| @@ -33,6 +33,7 @@ typedef struct Jpeg2000DSPContext { · 32 unmodified lines | ||
| 33 | 33 | extern const float ff_jpeg2000_f_ict_params[4]; |
| 34 | 34 | |
| 35 | 35 | void ff_jpeg2000dsp_init(Jpeg2000DSPContext *c); |
| 36 | +void ff_jpeg2000dsp_init_riscv(Jpeg2000DSPContext *c); | |
| 36 | 37 | void ff_jpeg2000dsp_init_x86(Jpeg2000DSPContext *c); |
| 37 | 38 | |
| 38 | 39 | #endif /* AVCODEC_JPEG2000DSP_H */ |
| @@ -16,6 +16,8 @@ OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_init.o · 15 unmodified lines | ||
| 16 | 16 | RVV-OBJS-$(CONFIG_FMTCONVERT) += riscv/fmtconvert_rvv.o |
| 17 | 17 | OBJS-$(CONFIG_G722DSP) += riscv/g722dsp_init.o |
| 18 | 18 | 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 | |
| 19 | 21 | OBJS-$(CONFIG_H264CHROMA) += riscv/h264_chroma_init_riscv.o |
| 20 | 22 | RVV-OBJS-$(CONFIG_H264CHROMA) += riscv/h264_mc_chroma.o |
| 21 | 23 | OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_init.o |
| @@ -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 | +} | |
| @@ -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 | |