Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Lynne <dev@lynne.ee>
To: Ffmpeg Devel <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] checkasm/tx: add checkasm support for the iMDCT
Date: Sun, 4 Sep 2022 07:01:10 +0200 (CEST)
Message-ID: <NB5rv7j--3-2@lynne.ee> (raw)

[-- Attachment #1: Type: text/plain, Size: 87 bytes --]

Patch attached. Just adds supports for inverse transforms
and in particular an iMDCT.


[-- Attachment #2: 0001-checkasm-tx-add-checkasm-support-for-the-iMDCT.patch --]
[-- Type: text/x-diff, Size: 5444 bytes --]

From 91cb5b3c3357d46d00b6fe46449942a84c7e4bd4 Mon Sep 17 00:00:00 2001
From: Lynne <dev@lynne.ee>
Date: Sun, 4 Sep 2022 02:40:07 +0200
Subject: [PATCH] checkasm/tx: add checkasm support for the iMDCT

---
 tests/checkasm/av_tx.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/tests/checkasm/av_tx.c b/tests/checkasm/av_tx.c
index 9d3823e8ed..1fa6da45ac 100644
--- a/tests/checkasm/av_tx.c
+++ b/tests/checkasm/av_tx.c
@@ -43,35 +43,36 @@ static const int check_lens[] = {
     2, 4, 8, 16, 32, 64, 1024, 16384,
 };
 
-static AVTXContext *tx_refs[6 /*AVTXType*/][FF_ARRAY_ELEMS(check_lens)];
+static AVTXContext *tx_refs[AV_TX_NB][2 /* Direction */][FF_ARRAY_ELEMS(check_lens)] = { 0 };
 static int init = 0;
 
 static void free_tx_refs(void)
 {
     for (int i = 0; i < FF_ARRAY_ELEMS(tx_refs); i++)
         for (int j = 0; j < FF_ARRAY_ELEMS(*tx_refs); j++)
-            av_tx_uninit(&tx_refs[i][j]);
+            for (int k = 0; k < FF_ARRAY_ELEMS(**tx_refs); k++)
+                av_tx_uninit(&tx_refs[i][j][k]);
 }
 
-#define CHECK_TEMPLATE(PREFIX, TYPE, DATA_TYPE, SCALE, LENGTHS, CHECK_EXPRESSION) \
+#define CHECK_TEMPLATE(PREFIX, TYPE, DIR, DATA_TYPE, SCALE_TYPE, LENGTHS, CHECK_EXPRESSION) \
     do {                                                                          \
         int err;                                                                  \
         AVTXContext *tx;                                                          \
         av_tx_fn fn;                                                              \
         int num_checks = 0;                                                       \
         int last_check = 0;                                                       \
-        const void *scale = &SCALE;                                               \
                                                                                   \
         for (int i = 0; i < FF_ARRAY_ELEMS(LENGTHS); i++) {                       \
             int len = LENGTHS[i];                                                 \
+            const SCALE_TYPE scale = 1.0 / len;                                   \
                                                                                   \
-            if ((err = av_tx_init(&tx, &fn, TYPE, 0, len, &scale, 0x0)) < 0) {    \
+            if ((err = av_tx_init(&tx, &fn, TYPE, DIR, len, &scale, 0x0)) < 0) {  \
                 fprintf(stderr, "av_tx: %s\n", av_err2str(err));                  \
                 return;                                                           \
             }                                                                     \
                                                                                   \
             if (check_func(fn, PREFIX "_%i", len)) {                              \
-                AVTXContext *tx_ref = tx_refs[TYPE][i];                           \
+                AVTXContext *tx_ref = tx_refs[TYPE][DIR][i];                      \
                 if (!tx_ref)                                                      \
                     tx_ref = tx;                                                  \
                 num_checks++;                                                     \
@@ -84,8 +85,8 @@ static void free_tx_refs(void)
                     break;                                                        \
                 }                                                                 \
                 bench_new(tx, out_new, in, sizeof(DATA_TYPE));                    \
-                av_tx_uninit(&tx_refs[TYPE][i]);                                  \
-                tx_refs[TYPE][i] = tx;                                            \
+                av_tx_uninit(&tx_refs[TYPE][DIR][i]);                             \
+                tx_refs[TYPE][DIR][i] = tx;                                       \
             } else {                                                              \
                 av_tx_uninit(&tx);                                                \
             }                                                                     \
@@ -99,9 +100,6 @@ static void free_tx_refs(void)
 
 void checkasm_check_av_tx(void)
 {
-    const float scale_float = 1.0f;
-    const double scale_double = 1.0f;
-
     declare_func(void, AVTXContext *tx, void *out, void *in, ptrdiff_t stride);
 
     void *in      = av_malloc(16384*2*8);
@@ -109,11 +107,14 @@ void checkasm_check_av_tx(void)
     void *out_new = av_malloc(16384*2*8);
 
     randomize_complex(in, 16384, AVComplexFloat, SCALE_NOOP);
-    CHECK_TEMPLATE("float_fft", AV_TX_FLOAT_FFT, AVComplexFloat, scale_float, check_lens,
+    CHECK_TEMPLATE("float_fft", AV_TX_FLOAT_FFT, 0, AVComplexFloat, float, check_lens,
                    !float_near_abs_eps_array(out_ref, out_new, EPS, len*2));
 
+    CHECK_TEMPLATE("float_imdct", AV_TX_FLOAT_MDCT, 1, float, float, check_lens,
+                   !float_near_abs_eps_array(out_ref, out_new, EPS, len));
+
     randomize_complex(in, 16384, AVComplexDouble, SCALE_NOOP);
-    CHECK_TEMPLATE("double_fft", AV_TX_DOUBLE_FFT, AVComplexDouble, scale_double, check_lens,
+    CHECK_TEMPLATE("double_fft", AV_TX_DOUBLE_FFT, 0, AVComplexDouble, double, check_lens,
                    !double_near_abs_eps_array(out_ref, out_new, EPS, len*2));
 
     av_free(in);
-- 
2.37.2.609.g9ff673ca1a


[-- 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".

                 reply	other threads:[~2022-09-04  5:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=NB5rv7j--3-2@lynne.ee \
    --to=dev@lynne.ee \
    --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