C908: vc1dsp.vc1_inv_trans_4x4_dc_c: 125.7 vc1dsp.vc1_inv_trans_4x4_dc_rvv_i32: 53.5 vc1dsp.vc1_inv_trans_4x8_dc_c: 230.7 vc1dsp.vc1_inv_trans_4x8_dc_rvv_i32: 65.5 vc1dsp.vc1_inv_trans_8x4_dc_c: 228.7 vc1dsp.vc1_inv_trans_8x4_dc_rvv_i64: 64.5 vc1dsp.vc1_inv_trans_8x8_dc_c: 476.5 vc1dsp.vc1_inv_trans_8x8_dc_rvv_i64: 80.2
Unified · Split
| @@ -40,5 +40,7 @@ OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \ · 39 unmodified lines | |||
| 40 | RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o | 40 | RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o |
| 41 | OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o | 41 | OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o |
| 42 | RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o | 42 | RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o |
| 43 | OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_init.o | ||
| 44 | RVV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvv.o | ||
| 43 | OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o | 45 | OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o |
| 44 | RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o | 46 | RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o |
| @@ -0,0 +1,49 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS). | ||
| 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 <stdint.h> | ||
| 22 | |||
| 23 | #include "libavutil/attributes.h" | ||
| 24 | #include "libavutil/cpu.h" | ||
| 25 | #include "libavutil/riscv/cpu.h" | ||
| 26 | #include "libavcodec/vc1.h" | ||
| 27 | |||
| 28 | void ff_vc1_inv_trans_8x8_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block); | ||
| 29 | void ff_vc1_inv_trans_4x8_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block); | ||
| 30 | void ff_vc1_inv_trans_8x4_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block); | ||
| 31 | void ff_vc1_inv_trans_4x4_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block); | ||
| 32 | |||
| 33 | av_cold void ff_vc1dsp_init_riscv(VC1DSPContext *dsp) | ||
| 34 | { | ||
| 35 | #if HAVE_RVV | ||
| 36 | int flags = av_get_cpu_flags(); | ||
| 37 | |||
| 38 | if (ff_get_rv_vlenb() >= 16) { | ||
| 39 | if (flags & AV_CPU_FLAG_RVV_I64) { | ||
| 40 | dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_rvv; | ||
| 41 | dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_rvv; | ||
| 42 | } | ||
| 43 | if (flags & AV_CPU_FLAG_RVV_I32) { | ||
| 44 | dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_rvv; | ||
| 45 | dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_rvv; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | #endif | ||
| 49 | } | ||
| @@ -0,0 +1,113 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS). | ||
| 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_vc1_inv_trans_8x8_dc_rvv, zve64x | ||
| 24 | lh t2, (a2) | ||
| 25 | vsetivli zero, 8, e8, mf2, ta, ma | ||
| 26 | vlse64.v v0, (a0), a1 | ||
| 27 | sh1add t2, t2, t2 | ||
| 28 | addi t2, t2, 1 | ||
| 29 | srai t2, t2, 1 | ||
| 30 | sh1add t2, t2, t2 | ||
| 31 | addi t2, t2, 16 | ||
| 32 | srai t2, t2, 5 | ||
| 33 | li t0, 8*8 | ||
| 34 | vsetvli zero, t0, e16, m8, ta, ma | ||
| 35 | vzext.vf2 v8, v0 | ||
| 36 | vadd.vx v8, v8, t2 | ||
| 37 | vmax.vx v8, v8, zero | ||
| 38 | vsetvli zero, zero, e8, m4, ta, ma | ||
| 39 | vnclipu.wi v0, v8, 0 | ||
| 40 | vsetivli zero, 8, e8, mf2, ta, ma | ||
| 41 | vsse64.v v0, (a0), a1 | ||
| 42 | ret | ||
| 43 | endfunc | ||
| 44 | |||
| 45 | func ff_vc1_inv_trans_4x8_dc_rvv, zve32x | ||
| 46 | lh t2, (a2) | ||
| 47 | vsetivli zero, 8, e8, mf2, ta, ma | ||
| 48 | vlse32.v v0, (a0), a1 | ||
| 49 | slli t1, t2, 4 | ||
| 50 | add t2, t2, t1 | ||
| 51 | addi t2, t2, 4 | ||
| 52 | srai t2, t2, 3 | ||
| 53 | sh1add t2, t2, t2 | ||
| 54 | slli t2, t2, 2 | ||
| 55 | addi t2, t2, 64 | ||
| 56 | srai t2, t2, 7 | ||
| 57 | li t0, 4*8 | ||
| 58 | vsetvli zero, t0, e16, m4, ta, ma | ||
| 59 | vzext.vf2 v4, v0 | ||
| 60 | vadd.vx v4, v4, t2 | ||
| 61 | vmax.vx v4, v4, zero | ||
| 62 | vsetvli zero, zero, e8, m2, ta, ma | ||
| 63 | vnclipu.wi v0, v4, 0 | ||
| 64 | vsetivli zero, 8, e8, mf2, ta, ma | ||
| 65 | vsse32.v v0, (a0), a1 | ||
| 66 | ret | ||
| 67 | endfunc | ||
| 68 | |||
| 69 | func ff_vc1_inv_trans_8x4_dc_rvv, zve64x | ||
| 70 | lh t2, (a2) | ||
| 71 | vsetivli zero, 8, e8, mf2, ta, ma | ||
| 72 | vlse64.v v0, (a0), a1 | ||
| 73 | sh1add t2, t2, t2 | ||
| 74 | addi t2, t2, 1 | ||
| 75 | srai t2, t2, 1 | ||
| 76 | slli t1, t2, 4 | ||
| 77 | add t2, t2, t1 | ||
| 78 | addi t2, t2, 64 | ||
| 79 | srai t2, t2, 7 | ||
| 80 | li t0, 8*4 | ||
| 81 | vsetvli zero, t0, e16, m4, ta, ma | ||
| 82 | vzext.vf2 v4, v0 | ||
| 83 | vadd.vx v4, v4, t2 | ||
| 84 | vmax.vx v4, v4, zero | ||
| 85 | vsetvli zero, zero, e8, m2, ta, ma | ||
| 86 | vnclipu.wi v0, v4, 0 | ||
| 87 | vsetivli zero, 8, e8, mf2, ta, ma | ||
| 88 | vsse64.v v0, (a0), a1 | ||
| 89 | ret | ||
| 90 | endfunc | ||
| 91 | |||
| 92 | func ff_vc1_inv_trans_4x4_dc_rvv, zve32x | ||
| 93 | lh t2, (a2) | ||
| 94 | vsetivli zero, 4, e8, mf2, ta, ma | ||
| 95 | vlse32.v v0, (a0), a1 | ||
| 96 | slli t1, t2, 4 | ||
| 97 | add t2, t2, t1 | ||
| 98 | addi t2, t2, 4 | ||
| 99 | srai t2, t2, 3 | ||
| 100 | slli t1, t2, 4 | ||
| 101 | add t2, t2, t1 | ||
| 102 | addi t2, t2, 64 | ||
| 103 | srai t2, t2, 7 | ||
| 104 | vsetivli zero, 4*4, e16, m2, ta, ma | ||
| 105 | vzext.vf2 v2, v0 | ||
| 106 | vadd.vx v2, v2, t2 | ||
| 107 | vmax.vx v2, v2, zero | ||
| 108 | vsetvli zero, zero, e8, m1, ta, ma | ||
| 109 | vnclipu.wi v0, v2, 0 | ||
| 110 | vsetivli zero, 4, e8, mf2, ta, ma | ||
| 111 | vsse32.v v0, (a0), a1 | ||
| 112 | ret | ||
| 113 | endfunc | ||
| @@ -1039,6 +1039,8 @@ av_cold void ff_vc1dsp_init(VC1DSPContext *dsp) · 1038 unmodified lines | |||
| 1039 | ff_vc1dsp_init_arm(dsp); | 1039 | ff_vc1dsp_init_arm(dsp); |
| 1040 | #elif ARCH_PPC | 1040 | #elif ARCH_PPC |
| 1041 | ff_vc1dsp_init_ppc(dsp); | 1041 | ff_vc1dsp_init_ppc(dsp); |
| 1042 | #elif ARCH_RISCV | ||
| 1043 | ff_vc1dsp_init_riscv(dsp); | ||
| 1042 | #elif ARCH_X86 | 1044 | #elif ARCH_X86 |
| 1043 | ff_vc1dsp_init_x86(dsp); | 1045 | ff_vc1dsp_init_x86(dsp); |
| 1044 | #elif ARCH_MIPS | 1046 | #elif ARCH_MIPS |
| @@ -89,6 +89,7 @@ void ff_vc1dsp_init(VC1DSPContext* c); · 88 unmodified lines | |||
| 89 | void ff_vc1dsp_init_aarch64(VC1DSPContext* dsp); | 89 | void ff_vc1dsp_init_aarch64(VC1DSPContext* dsp); |
| 90 | void ff_vc1dsp_init_arm(VC1DSPContext* dsp); | 90 | void ff_vc1dsp_init_arm(VC1DSPContext* dsp); |
| 91 | void ff_vc1dsp_init_ppc(VC1DSPContext *c); | 91 | void ff_vc1dsp_init_ppc(VC1DSPContext *c); |
| 92 | void ff_vc1dsp_init_riscv(VC1DSPContext *c); | ||
| 92 | void ff_vc1dsp_init_x86(VC1DSPContext* dsp); | 93 | void ff_vc1dsp_init_x86(VC1DSPContext* dsp); |
| 93 | void ff_vc1dsp_init_mips(VC1DSPContext* dsp); | 94 | void ff_vc1dsp_init_mips(VC1DSPContext* dsp); |
| 94 | void ff_vc1dsp_init_loongarch(VC1DSPContext* dsp); | 95 | void ff_vc1dsp_init_loongarch(VC1DSPContext* dsp); |