From: James Almer <jamrial@gmail.com> To: ffmpeg-devel@ffmpeg.org Subject: Re: [FFmpeg-devel] [PATCH 5/6] lavc/apv: AVX2 transquant for x86-64 Date: Sat, 19 Apr 2025 22:48:29 -0300 Message-ID: <1642f7ab-33d7-460d-80e2-e17e4dd379f3@gmail.com> (raw) In-Reply-To: <20250419190712.1265201-6-sw@jkqxz.net> [-- Attachment #1.1.1: Type: text/plain, Size: 6849 bytes --] On 4/19/2025 4:07 PM, Mark Thompson wrote: > Typical checkasm result on Alder Lake: > > decode_transquant_8_c: 408.7 ( 1.00x) > decode_transquant_8_avx2: 94.2 ( 4.34x) > decode_transquant_10_c: 413.1 ( 1.00x) > decode_transquant_10_avx2: 87.5 ( 4.72x) > --- > libavcodec/apv_dsp.c | 4 + > libavcodec/apv_dsp.h | 2 + > libavcodec/x86/Makefile | 2 + > libavcodec/x86/apv_dsp.asm | 243 ++++++++++++++++++++++++++++++++++ > libavcodec/x86/apv_dsp_init.c | 41 ++++++ > tests/checkasm/Makefile | 1 + > tests/checkasm/apv_dsp.c | 113 ++++++++++++++++ > tests/checkasm/checkasm.c | 3 + > tests/checkasm/checkasm.h | 1 + > 9 files changed, 410 insertions(+) > create mode 100644 libavcodec/x86/apv_dsp.asm > create mode 100644 libavcodec/x86/apv_dsp_init.c > create mode 100644 tests/checkasm/apv_dsp.c [...] > diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile > index d5c50e5599..193c1e4633 100644 > --- a/tests/checkasm/Makefile > +++ b/tests/checkasm/Makefile > @@ -28,6 +28,7 @@ AVCODECOBJS-$(CONFIG_AAC_DECODER) += aacpsdsp.o \ > sbrdsp.o > AVCODECOBJS-$(CONFIG_AAC_ENCODER) += aacencdsp.o > AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o > +AVCODECOBJS-$(CONFIG_APV_DECODER) += apv_dsp.o > AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o > AVCODECOBJS-$(CONFIG_DIRAC_DECODER) += diracdsp.o > AVCODECOBJS-$(CONFIG_EXR_DECODER) += exrdsp.o > diff --git a/tests/checkasm/apv_dsp.c b/tests/checkasm/apv_dsp.c > new file mode 100644 > index 0000000000..a0272d8edc > --- /dev/null > +++ b/tests/checkasm/apv_dsp.c > @@ -0,0 +1,113 @@ > +/* > + * 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 <stdint.h> > + > +#include "checkasm.h" > + > +#include "libavutil/attributes.h" > +#include "libavutil/mem_internal.h" > +#include "libavcodec/apv_dsp.h" > + > + > +static void check_decode_transquant_8(void) > +{ > + LOCAL_ALIGNED_16(int16_t, input, [64]); > + LOCAL_ALIGNED_16(int16_t, qmatrix, [64]); > + LOCAL_ALIGNED_16(uint8_t, new_output, [64]); > + LOCAL_ALIGNED_16(uint8_t, ref_output, [64]); > + > + declare_func(void, > + uint8_t *output, > + ptrdiff_t pitch, > + const int16_t *input, > + const int16_t *qmatrix, > + int64_t bit_depth, > + int64_t qp_shift); > + > + for (int i = 0; i < 64; i++) { > + // Any signed 12-bit integer. > + input[i] = rnd() % 2048 - 1024; > + > + // qmatrix input is premultiplied by level_scale, so > + // range is 1 to 255 * 71. Interesting values are all > + // at the low end of that, though. > + qmatrix[i] = rnd() % 16 + 16; > + } > + > + call_ref(ref_output, 8, input, qmatrix, 8, 4); > + call_new(new_output, 8, input, qmatrix, 8, 4); > + > + for (int i = 0; i < 64; i++) { > + if (ref_output[i] != new_output[i]) memcmp? > + fail(); > + } > + > + bench_new(new_output, 8, input, qmatrix, 8, 4); > +} > + > +static void check_decode_transquant_10(void) > +{ > + LOCAL_ALIGNED_16( int16_t, input, [64]); > + LOCAL_ALIGNED_16( int16_t, qmatrix, [64]); > + LOCAL_ALIGNED_16(uint16_t, new_output, [64]); > + LOCAL_ALIGNED_16(uint16_t, ref_output, [64]); > + > + declare_func(void, > + uint16_t *output, > + ptrdiff_t pitch, > + const int16_t *input, > + const int16_t *qmatrix, > + int64_t bit_depth, > + int64_t qp_shift); > + > + for (int i = 0; i < 64; i++) { > + // Any signed 14-bit integer. > + input[i] = rnd() % 16384 - 8192; > + > + // qmatrix input is premultiplied by level_scale, so > + // range is 1 to 255 * 71. Interesting values are all > + // at the low end of that, though. > + qmatrix[i] = 16; //rnd() % 16 + 16; > + } > + > + call_ref(ref_output, 16, input, qmatrix, 10, 4); > + call_new(new_output, 16, input, qmatrix, 10, 4); > + > + for (int i = 0; i < 64; i++) { > + if (ref_output[i] != new_output[i]) > + fail(); > + } > + > + bench_new(new_output, 16, input, qmatrix, 10, 4); > +} > + > +void checkasm_check_apv_dsp(void) > +{ > + APVDSPContext dsp; > + > + ff_apv_dsp_init(&dsp); > + > + if (check_func(dsp.decode_transquant, "decode_transquant_8")) > + check_decode_transquant_8(); > + > + if (check_func(dsp.decode_transquant, "decode_transquant_10")) > + check_decode_transquant_10(); > + > + report("apv_dsp"); > +} > diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c > index 412b8b2cd1..3bb82ed0e5 100644 > --- a/tests/checkasm/checkasm.c > +++ b/tests/checkasm/checkasm.c > @@ -129,6 +129,9 @@ static const struct { > #if CONFIG_ALAC_DECODER > { "alacdsp", checkasm_check_alacdsp }, > #endif > + #if CONFIG_APV_DECODER > + { "apv_dsp", checkasm_check_apv_dsp }, > + #endif > #if CONFIG_AUDIODSP > { "audiodsp", checkasm_check_audiodsp }, > #endif > diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h > index ad239fb2a4..a6b5965e02 100644 > --- a/tests/checkasm/checkasm.h > +++ b/tests/checkasm/checkasm.h > @@ -83,6 +83,7 @@ void checkasm_check_ac3dsp(void); > void checkasm_check_aes(void); > void checkasm_check_afir(void); > void checkasm_check_alacdsp(void); > +void checkasm_check_apv_dsp(void); > void checkasm_check_audiodsp(void); > void checkasm_check_av_tx(void); > void checkasm_check_blend(void); Also add an entry to tests/fate/checkasm.mak while at it. [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 495 bytes --] [-- Attachment #2: 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:[~2025-04-20 1:48 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2025-04-19 19:06 [FFmpeg-devel] [PATCH 0/6] APV support Mark Thompson 2025-04-19 19:06 ` [FFmpeg-devel] [PATCH 1/6] lavc: APV codec ID and descriptor Mark Thompson 2025-04-19 19:07 ` [FFmpeg-devel] [PATCH 2/6] lavf: APV demuxer Mark Thompson 2025-04-20 16:07 ` Derek Buitenhuis 2025-04-20 16:20 ` James Almer 2025-04-20 16:57 ` Mark Thompson 2025-04-20 18:59 ` James Almer 2025-04-21 0:54 ` Michael Niedermayer 2025-04-21 14:59 ` Mark Thompson 2025-04-21 15:22 ` Andreas Rheinhardt 2025-04-21 21:30 ` Michael Niedermayer 2025-04-19 19:07 ` [FFmpeg-devel] [PATCH 3/6] lavc/cbs: APV support Mark Thompson 2025-04-19 19:07 ` [FFmpeg-devel] [PATCH 4/6] lavc: APV decoder Mark Thompson 2025-04-21 14:09 ` James Almer 2025-04-19 19:07 ` [FFmpeg-devel] [PATCH 5/6] lavc/apv: AVX2 transquant for x86-64 Mark Thompson 2025-04-19 20:34 ` Mark Thompson 2025-04-19 21:16 ` James Almer 2025-04-20 1:48 ` James Almer [this message] 2025-04-19 19:07 ` [FFmpeg-devel] [PATCH 6/6] lavc: APV metadata bitstream filter Mark Thompson
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=1642f7ab-33d7-460d-80e2-e17e4dd379f3@gmail.com \ --to=jamrial@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