From: flow gg <hlefthleft@gmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH] ac3dsp: RISC-V V float_to_fixed24 Date: Fri, 24 Nov 2023 06:39:39 +0800 Message-ID: <CAEa-L+vP97ZZdbi5+Z=qTPbP1KjYHA+fV3fhm+D7usVoQ3WM8A@mail.gmail.com> (raw) In-Reply-To: <1868170.tdWV9SEqCh@basile.remlab.net> [-- Attachment #1: Type: text/plain, Size: 812 bytes --] Okay, changed Rémi Denis-Courmont <remi@remlab.net> 于2023年11月24日周五 01:09写道: > Le torstaina 23. marraskuuta 2023, 1.17.03 EET flow gg a écrit : > > Hello, I saw the new commit "avcodec/ac3dsp: make len a size_t in > > float_to_fixed24." > > > > So I removed the part #if (__riscv_xlen == 64) and restored the patch. > > You're not checking for Zba. Also 'bnez' would be more logical than > 'bgtz' > for an unsigned counter. > > -- > レミ・デニ-クールモン > http://www.remlab.net/ > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > [-- Attachment #2: lavc-ac3dsp-R-V-V-float_to_fixed24.patch --] [-- Type: text/x-patch, Size: 3559 bytes --] From af221d659ebc1e97b6d274681061fa8331d0b147 Mon Sep 17 00:00:00 2001 From: sunyuechi <sunyuechi@iscas.ac.cn> Date: Wed, 22 Nov 2023 14:57:29 +0800 Subject: [PATCH] lavc/ac3dsp: R-V V float_to_fixed24 c910 float_to_fixed24_c: 2207.2 float_to_fixed24_rvv_f32: 696.2 --- libavcodec/riscv/Makefile | 3 ++- libavcodec/riscv/ac3dsp_init.c | 3 +++ libavcodec/riscv/ac3dsp_rvv.S | 39 ++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 libavcodec/riscv/ac3dsp_rvv.S diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index 8f2a519827..ac7b7c2929 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -1,7 +1,8 @@ OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \ - riscv/ac3dsp_rvb.o + riscv/ac3dsp_rvb.o \ + riscv/ac3dsp_rvv.o OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \ diff --git a/libavcodec/riscv/ac3dsp_init.c b/libavcodec/riscv/ac3dsp_init.c index 20f294f1de..25244943cb 100644 --- a/libavcodec/riscv/ac3dsp_init.c +++ b/libavcodec/riscv/ac3dsp_init.c @@ -26,6 +26,7 @@ #include "libavcodec/ac3dsp.h" void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs); +void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, unsigned int len); av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) { @@ -34,5 +35,7 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) if (flags & AV_CPU_FLAG_RVB_ADDR) { if (flags & AV_CPU_FLAG_RVB_BASIC) c->extract_exponents = ff_extract_exponents_rvb; + if (flags & AV_CPU_FLAG_RVV_F32) + c->float_to_fixed24 = ff_float_to_fixed24_rvv; } } diff --git a/libavcodec/riscv/ac3dsp_rvv.S b/libavcodec/riscv/ac3dsp_rvv.S new file mode 100644 index 0000000000..82c14ea275 --- /dev/null +++ b/libavcodec/riscv/ac3dsp_rvv.S @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "libavutil/riscv/asm.S" + +func ff_float_to_fixed24_rvv, zve32f + li t1, 1 << 24 + fcvt.s.w f0, t1 +1: + vsetvli t0, a2, e32, m4, ta, ma + sub a2, a2, t0 + vle32.v v0, (a1) + vfmul.vf v0, v0, f0 + vfcvt.x.f.v v0, v0 + sh2add a1, t0, a1 + vse32.v v0, (a0) + sh2add a0, t0, a0 + bnez a2, 1b + + ret +endfunc -- 2.43.0 [-- Attachment #3: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2023-11-23 22:40 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-11-22 12:00 flow gg 2023-11-22 13:40 ` Rémi Denis-Courmont 2023-11-22 14:30 ` flow gg 2023-11-22 14:35 ` flow gg 2023-11-22 14:51 ` Rémi Denis-Courmont 2023-11-22 16:37 ` flow gg 2023-11-22 16:49 ` James Almer 2023-11-22 23:17 ` flow gg 2023-11-23 17:08 ` Rémi Denis-Courmont 2023-11-23 22:39 ` flow gg [this message] 2023-12-01 18:35 ` Rémi Denis-Courmont 2023-12-01 18:38 ` Rémi Denis-Courmont 2023-12-01 19:50 ` flow gg 2023-12-01 20:16 ` flow gg 2023-11-22 17:18 ` James Almer 2023-11-22 17:34 ` flow gg 2023-11-23 7:11 ` flow gg
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAEa-L+vP97ZZdbi5+Z=qTPbP1KjYHA+fV3fhm+D7usVoQ3WM8A@mail.gmail.com' \ --to=hlefthleft@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git