k230 banana_f3 put_hevc_pel_pixels4_8_c: 61.6 ( 1.00x) 69.5 ( 1.00x) put_hevc_pel_pixels4_8_rvv_i32: 24.6 ( 2.50x) 28.0 ( 2.48x) put_hevc_pel_pixels8_8_c: 209.8 ( 1.00x) 215.5 ( 1.00x) put_hevc_pel_pixels8_8_rvv_i32: 52.6 ( 3.99x) 38.2 ( 5.64x) put_hevc_pel_pixels16_8_c: 839.4 ( 1.00x) 830.0 ( 1.00x) put_hevc_pel_pixels16_8_rvv_i32: 126.6 ( 6.63x) 90.5 ( 9.17x) put_hevc_pel_pixels32_8_c: 3246.6 ( 1.00x) 3246.7 ( 1.00x) put_hevc_pel_pixels32_8_rvv_i32: 311.6 (10.42x) 257.0 (12.63x) put_hevc_pel_pixels64_8_c: 12894.6 ( 1.00x) 12892.7 ( 1.00x) put_hevc_pel_pixels64_8_rvv_i32: 1135.8 (11.35x) 778.0 (16.57x)
Showing the changes to libavcodec (5 of 5 files). Show all
Unified · Split
| @@ -265,6 +265,8 @@ int i = 0; · 264 unmodified lines | ||
| 265 | 265 | ff_hevc_dsp_init_arm(hevcdsp, bit_depth); |
| 266 | 266 | #elif ARCH_PPC |
| 267 | 267 | ff_hevc_dsp_init_ppc(hevcdsp, bit_depth); |
| 268 | +#elif ARCH_RISCV | |
| 269 | + ff_hevc_dsp_init_riscv(hevcdsp, bit_depth); | |
| 268 | 270 | #elif ARCH_WASM |
| 269 | 271 | ff_hevc_dsp_init_wasm(hevcdsp, bit_depth); |
| 270 | 272 | #elif ARCH_X86 |
| @@ -133,6 +133,7 @@ extern const int8_t ff_hevc_qpel_filters[4][16]; · 132 unmodified lines | ||
| 133 | 133 | void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth); |
| 134 | 134 | void ff_hevc_dsp_init_arm(HEVCDSPContext *c, const int bit_depth); |
| 135 | 135 | void ff_hevc_dsp_init_ppc(HEVCDSPContext *c, const int bit_depth); |
| 136 | +void ff_hevc_dsp_init_riscv(HEVCDSPContext *c, const int bit_depth); | |
| 136 | 137 | void ff_hevc_dsp_init_wasm(HEVCDSPContext *c, const int bit_depth); |
| 137 | 138 | void ff_hevc_dsp_init_x86(HEVCDSPContext *c, const int bit_depth); |
| 138 | 139 | void ff_hevc_dsp_init_mips(HEVCDSPContext *c, const int bit_depth); |
| @@ -35,6 +35,8 @@ RVV-OBJS-$(CONFIG_H264DSP) += riscv/h264addpx_rvv.o riscv/h264dsp_rvv.o \ · 34 unmodified lines | ||
| 35 | 35 | riscv/h264idct_rvv.o |
| 36 | 36 | OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_init.o |
| 37 | 37 | RVV-OBJS-$(CONFIG_H264QPEL) += riscv/h264qpel_rvv.o |
| 38 | +OBJS-$(CONFIG_HEVC_DECODER) += riscv/hevcdsp_init.o | |
| 39 | +RVV-OBJS-$(CONFIG_HEVC_DECODER) += riscv/h26x/h2656_inter_rvv.o | |
| 38 | 40 | OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_init.o |
| 39 | 41 | RVV-OBJS-$(CONFIG_HUFFYUV_DECODER) += riscv/huffyuvdsp_rvv.o |
| 40 | 42 | OBJS-$(CONFIG_IDCTDSP) += riscv/idctdsp_init.o |
| @@ -0,0 +1,24 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 2024 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 "libavcodec/riscv/h26x/asm.S" | |
| 22 | + | |
| 23 | +func_put_pixels 256, 64, h2656 | |
| 24 | +func_put_pixels 128, 64, h2656 | |
| @@ -0,0 +1,67 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 2024 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 "config.h" | |
| 22 | + | |
| 23 | +#include "libavutil/attributes.h" | |
| 24 | +#include "libavutil/cpu.h" | |
| 25 | +#include "libavutil/riscv/cpu.h" | |
| 26 | + | |
| 27 | +#include "libavcodec/hevc/dsp.h" | |
| 28 | +#include "libavcodec/riscv/h26x/h2656dsp.h" | |
| 29 | + | |
| 30 | +#define RVV_FNASSIGN(member, v, h, fn, ext) \ | |
| 31 | + member[1][v][h] = ff_h2656_put_pixels_##8_##ext; \ | |
| 32 | + member[3][v][h] = ff_h2656_put_pixels_##8_##ext; \ | |
| 33 | + member[5][v][h] = ff_h2656_put_pixels_##8_##ext; \ | |
| 34 | + member[7][v][h] = ff_h2656_put_pixels_##8_##ext; \ | |
| 35 | + member[9][v][h] = ff_h2656_put_pixels_##8_##ext; | |
| 36 | + | |
| 37 | +void ff_hevc_dsp_init_riscv(HEVCDSPContext *c, const int bit_depth) | |
| 38 | +{ | |
| 39 | +#if HAVE_RVV | |
| 40 | + const int flags = av_get_cpu_flags(); | |
| 41 | + int vlenb; | |
| 42 | + | |
| 43 | + if (!(flags & AV_CPU_FLAG_RVV_I32) || !(flags & AV_CPU_FLAG_RVB)) | |
| 44 | + return; | |
| 45 | + | |
| 46 | + vlenb = ff_get_rv_vlenb(); | |
| 47 | + if (vlenb >= 32) { | |
| 48 | + switch (bit_depth) { | |
| 49 | + case 8: | |
| 50 | + RVV_FNASSIGN(c->put_hevc_qpel, 0, 0, pel_pixels, rvv_256); | |
| 51 | + RVV_FNASSIGN(c->put_hevc_epel, 0, 0, pel_pixels, rvv_256); | |
| 52 | + break; | |
| 53 | + default: | |
| 54 | + break; | |
| 55 | + } | |
| 56 | + } else if (vlenb >= 16) { | |
| 57 | + switch (bit_depth) { | |
| 58 | + case 8: | |
| 59 | + RVV_FNASSIGN(c->put_hevc_qpel, 0, 0, pel_pixels, rvv_128); | |
| 60 | + RVV_FNASSIGN(c->put_hevc_epel, 0, 0, pel_pixels, rvv_128); | |
| 61 | + break; | |
| 62 | + default: | |
| 63 | + break; | |
| 64 | + } | |
| 65 | + } | |
| 66 | +#endif | |
| 67 | +} | |