Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] checkasm/flacdsp: add LPC test
@ 2023-11-15 16:21 Rémi Denis-Courmont
  2023-11-15 16:39 ` Rémi Denis-Courmont
  0 siblings, 1 reply; 2+ messages in thread
From: Rémi Denis-Courmont @ 2023-11-15 16:21 UTC (permalink / raw)
  To: ffmpeg-devel

---
 tests/checkasm/flacdsp.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c
index 51a0e0060b..589a3fe834 100644
--- a/tests/checkasm/flacdsp.c
+++ b/tests/checkasm/flacdsp.c
@@ -54,6 +54,27 @@ static void check_decorrelate(uint8_t **ref_dst, uint8_t **ref_src, uint8_t **ne
     bench_new(new_dst, (int32_t **)new_src, channels, BUF_SIZE / sizeof(int32_t), 8);
 }
 
+static void check_lpc(FLACDSPContext *c)
+{
+    int pred_order = (rnd() % 32) + 1;
+    int qlevel = rnd() % 16;
+    LOCAL_ALIGNED_16(int32_t, coeffs, [32]);
+    LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]);
+    LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]);
+
+    declare_func(void, int32_t *, const int[32], int, int, int);
+
+    for (int i = 0; i < BUF_SIZE; i++)
+        dst0[i] = rnd();
+
+    memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t));
+    call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE);
+    call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE);
+    if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0)
+       fail();
+    bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE);
+}
+
 void checkasm_check_flacdsp(void)
 {
     LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]);
@@ -88,4 +109,11 @@ void checkasm_check_flacdsp(void)
     }
 
     report("decorrelate");
+
+    if (check_func(h.lpc16, "flac_lpc_16"))
+        check_lpc(&h);
+    if (check_func(h.lpc32, "flac_lpc_32"))
+        check_lpc(&h);
+
+    report("lpc");
 }
-- 
2.42.0

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] checkasm/flacdsp: add LPC test
  2023-11-15 16:21 [FFmpeg-devel] [PATCH] checkasm/flacdsp: add LPC test Rémi Denis-Courmont
@ 2023-11-15 16:39 ` Rémi Denis-Courmont
  0 siblings, 0 replies; 2+ messages in thread
From: Rémi Denis-Courmont @ 2023-11-15 16:39 UTC (permalink / raw)
  To: ffmpeg-devel

Le keskiviikkona 15. marraskuuta 2023, 18.21.34 EET Rémi Denis-Courmont a 
écrit :
> ---
>  tests/checkasm/flacdsp.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c
> index 51a0e0060b..589a3fe834 100644
> --- a/tests/checkasm/flacdsp.c
> +++ b/tests/checkasm/flacdsp.c
> @@ -54,6 +54,27 @@ static void check_decorrelate(uint8_t **ref_dst, uint8_t
> **ref_src, uint8_t **ne bench_new(new_dst, (int32_t **)new_src, channels,
> BUF_SIZE / sizeof(int32_t), 8); }
> 
> +static void check_lpc(FLACDSPContext *c)
> +{
> +    int pred_order = (rnd() % 32) + 1;
> +    int qlevel = rnd() % 16;
> +    LOCAL_ALIGNED_16(int32_t, coeffs, [32]);
> +    LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]);
> +    LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]);
> +
> +    declare_func(void, int32_t *, const int[32], int, int, int);

Hmmph, nevermind, forgot to initialise the coefficients.

> +
> +    for (int i = 0; i < BUF_SIZE; i++)
> +        dst0[i] = rnd();
> +
> +    memcpy(dst1, dst0, BUF_SIZE * sizeof (int32_t));
> +    call_ref(dst0, coeffs, pred_order, qlevel, BUF_SIZE);
> +    call_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE);
> +    if (memcmp(dst0, dst1, BUF_SIZE * sizeof (int32_t)) != 0)
> +       fail();
> +    bench_new(dst1, coeffs, pred_order, qlevel, BUF_SIZE);
> +}
> +
>  void checkasm_check_flacdsp(void)
>  {
>      LOCAL_ALIGNED_16(uint8_t, ref_dst, [BUF_SIZE*MAX_CHANNELS]);
> @@ -88,4 +109,11 @@ void checkasm_check_flacdsp(void)
>      }
> 
>      report("decorrelate");
> +
> +    if (check_func(h.lpc16, "flac_lpc_16"))
> +        check_lpc(&h);
> +    if (check_func(h.lpc32, "flac_lpc_32"))
> +        check_lpc(&h);
> +
> +    report("lpc");
>  }


-- 
Rémi Denis-Courmont
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".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-11-15 16:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-15 16:21 [FFmpeg-devel] [PATCH] checkasm/flacdsp: add LPC test Rémi Denis-Courmont
2023-11-15 16:39 ` Rémi Denis-Courmont

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