aboutsummaryrefslogtreecommitdiffstats
path: root/tests/checkasm
diff options
context:
space:
mode:
authorRémi Denis-Courmont <remi@remlab.net>2023-11-15 18:21:18 +0200
committerRémi Denis-Courmont <remi@remlab.net>2023-11-18 22:01:59 +0200
commit8a984aca59b4c4842bae50cadb9eb481a455e6de (patch)
treed7139f7e883b160283345d3ee66c014f4310394a /tests/checkasm
parentcd6089dc9ce9406274ca08ea14df95cff0133fd3 (diff)
downloadffmpeg-8a984aca59b4c4842bae50cadb9eb481a455e6de.tar.gz
checkasm/flacdsp: add LPC test
Diffstat (limited to 'tests/checkasm')
-rw-r--r--tests/checkasm/flacdsp.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/checkasm/flacdsp.c b/tests/checkasm/flacdsp.c
index 51a0e0060b..b308237db1 100644
--- a/tests/checkasm/flacdsp.c
+++ b/tests/checkasm/flacdsp.c
@@ -54,6 +54,28 @@ 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(int pred_order)
+{
+ 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 < 32; i++)
+ coeffs[i] = rnd();
+ 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]);
@@ -72,6 +94,7 @@ void checkasm_check_flacdsp(void)
{ AV_SAMPLE_FMT_S16, 16 },
{ AV_SAMPLE_FMT_S32, 32 },
};
+ static const signed char pred_orders[] = { 13, 16, 29, 32 };
FLACDSPContext h;
int i, j;
@@ -88,4 +111,13 @@ void checkasm_check_flacdsp(void)
}
report("decorrelate");
+
+ for (i = 0; i < FF_ARRAY_ELEMS(pred_orders); i++)
+ if (check_func(h.lpc16, "flac_lpc_16_%d", pred_orders[i]))
+ check_lpc(pred_orders[i]);
+ for (i = 0; i < FF_ARRAY_ELEMS(pred_orders); i++)
+ if (check_func(h.lpc32, "flac_lpc_32_%d", pred_orders[i]))
+ check_lpc(pred_orders[i]);
+
+ report("lpc");
}