restore_rgb_planes_c: 133065.7 restore_rgb_planes_rvv_i32: 33317.2
Showing the changes to libavcodec (5 of 5 files). Show all
Unified · Split
| @@ -25,5 +25,7 @@ RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o · 24 unmodified lines | ||
| 25 | 25 | OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \ |
| 26 | 26 | riscv/pixblockdsp_rvi.o |
| 27 | 27 | RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o |
| 28 | +OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o | |
| 29 | +RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o | |
| 28 | 30 | OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o |
| 29 | 31 | RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o |
| @@ -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 | + | |
| 26 | +void 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 | + | |
| 30 | +av_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 | +} | |
| @@ -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 | + | |
| 23 | +func 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 | |
| 28 | +1: | |
| 29 | + mv t6, a6 | |
| 30 | + addi a7, a7, -1 | |
| 31 | +2: | |
| 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 | |
| 53 | +endfunc | |
| @@ -77,7 +77,9 @@ av_cold void ff_utvideodsp_init(UTVideoDSPContext *c) · 76 unmodified lines | ||
| 77 | 77 | c->restore_rgb_planes = restore_rgb_planes_c; |
| 78 | 78 | c->restore_rgb_planes10 = restore_rgb_planes10_c; |
| 79 | 79 | |
| 80 | −#if ARCH_X86 | |
| 80 | +#if ARCH_RISCV | |
| 81 | + ff_utvideodsp_init_riscv(c); | |
| 82 | +#elif ARCH_X86 | |
| 81 | 83 | ff_utvideodsp_init_x86(c); |
| 82 | 84 | #endif |
| 83 | 85 | } |
| @@ -34,6 +34,7 @@ typedef struct UTVideoDSPContext { · 33 unmodified lines | ||
| 34 | 34 | } UTVideoDSPContext; |
| 35 | 35 | |
| 36 | 36 | void ff_utvideodsp_init(UTVideoDSPContext *c); |
| 37 | +void ff_utvideodsp_init_riscv(UTVideoDSPContext *c); | |
| 37 | 38 | void ff_utvideodsp_init_x86(UTVideoDSPContext *c); |
| 38 | 39 | |
| 39 | 40 | #endif /* AVCODEC_UTVIDEODSP_H */ |