From: "Rémi Denis-Courmont" <remi@remlab.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] checkasm: add aacencdsp.quant_bands test Date: Fri, 31 May 2024 21:18:12 +0300 Message-ID: <20240531181812.47154-1-remi@remlab.net> (raw) --- tests/checkasm/aacencdsp.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/checkasm/aacencdsp.c b/tests/checkasm/aacencdsp.c index 1756c4ecd5..756f92fd8f 100644 --- a/tests/checkasm/aacencdsp.c +++ b/tests/checkasm/aacencdsp.c @@ -22,7 +22,9 @@ #include "libavutil/mem_internal.h" +#include "libavcodec/aacenc_utils.h" #include "libavcodec/aacencdsp.h" +#include "libavcodec/aactab.h" #include "checkasm.h" @@ -35,6 +37,8 @@ } \ } while (0) +#define randomize_elem(tab) (tab[rnd() % FF_ARRAY_ELEMS(tab)]) + static void test_abs_pow34(AACEncDSPContext *s) { #define BUF_SIZE 1024 @@ -60,6 +64,38 @@ static void test_abs_pow34(AACEncDSPContext *s) report("abs_pow34"); } +static void test_quant_bands(AACEncDSPContext *s) +{ + int maxval = randomize_elem(aac_cb_maxval); + float q34 = randomize_elem(ff_aac_pow34sf_tab); + float rounding = (rnd() & 1) ? ROUND_TO_ZERO : ROUND_STANDARD; + LOCAL_ALIGNED_32(float, in, [BUF_SIZE]); + LOCAL_ALIGNED_32(float, scaled, [BUF_SIZE]); + + declare_func(void, int *, const float *, const float *, int, int, int, + const float, const float); + + randomize_float(in, BUF_SIZE); + randomize_float(scaled, BUF_SIZE); + + for (int sign = 0; sign <= 1; sign++) { + if (check_func(s->quant_bands, "quant_bands_%s", + sign ? "signed" : "unsigned")) { + LOCAL_ALIGNED_32(int, out, [BUF_SIZE]); + LOCAL_ALIGNED_32(int, out2, [BUF_SIZE]); + + call_ref(out, in, scaled, BUF_SIZE, sign, maxval, q34, rounding); + call_new(out2, in, scaled, BUF_SIZE, sign, maxval, q34, rounding); + + if (memcmp(out, out2, BUF_SIZE * sizeof (int))) + fail(); + + bench_new(out, in, scaled, BUF_SIZE, sign, maxval, q34, rounding); + } + } + + report("abs_pow34"); +} void checkasm_check_aacencdsp(void) { @@ -67,4 +103,5 @@ void checkasm_check_aacencdsp(void) ff_aacenc_dsp_init(&s); test_abs_pow34(&s); + test_quant_bands(&s); } -- 2.45.1 _______________________________________________ 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 reply other threads:[~2024-05-31 18:18 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-31 18:18 Rémi Denis-Courmont [this message] 2024-05-31 18:25 ` Lynne via ffmpeg-devel 2024-05-31 19:02 ` Rémi Denis-Courmont 2024-06-01 1:03 ` James Almer 2024-06-01 6:51 ` Rémi Denis-Courmont
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=20240531181812.47154-1-remi@remlab.net \ --to=remi@remlab.net \ --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