[FFmpeg-devel] [PATCH 1/2] checkasm/takdsp: add decorrelate_sf test
Martin Storsjö
martin at martin.st
Fri Dec 22 11:52:41 EET 2023
On Thu, 21 Dec 2023, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> tests/checkasm/takdsp.c | 36 +++++++++++++++++++++++++++++++++---
> 1 file changed, 33 insertions(+), 3 deletions(-)
> @@ -113,6 +113,35 @@ static void test_decorrelate_sm(TAKDSPContext *s) {
> report("decorrelate_sm");
> }
>
> +static void test_decorrelate_sf(TAKDSPContext *s) {
> + declare_func(void, int32_t *, int32_t *, int, int, int);
> +
> + if (check_func(s->decorrelate_sf, "decorrelate_sf")) {
> + LOCAL_ALIGNED_32(int32_t, p1, [BUF_SIZE]);
> + LOCAL_ALIGNED_32(int32_t, p1_2, [BUF_SIZE]);
> + LOCAL_ALIGNED_32(int32_t, p2, [BUF_SIZE]);
> + LOCAL_ALIGNED_32(int32_t, p2_2, [BUF_SIZE]);
> + int dshift, dfactor;
> +
> + randomize(p1, BUF_SIZE);
> + memcpy(p1, p1_2, BUF_SIZE);
The source/destination of the memcpy is flipped here. And it needs a
*sizeof(*p1).
> + randomize(p2, BUF_SIZE);
> + memcpy(p2_2, p2, BUF_SIZE);
> + dshift = (rnd() & 0xF) + 1;
> + dfactor = sign_extend(rnd(), 10);
> + call_ref(p1, p2, BUF_SIZE, dshift, dfactor);
> + call_new(p1_2, p2_2, BUF_SIZE, dshift, dfactor);
This function only mutates p1, not p2, so the copy of p2_2 is not entirely
necessary.
> +
> + if (memcmp(p2, p2_2, BUF_SIZE) != 0){
As we're mutating p1, that one is the one that should be checked. Also
*sizeof(*p1) in the memcmp. And space between ) and {.
// Martin
More information about the ffmpeg-devel
mailing list