[FFmpeg-devel] [PATCH 01/10] checkasm: Add vc1dsp in-loop deblocking filter tests

Martin Storsjö martin at martin.st
Sat Mar 26 00:53:08 EET 2022


On Fri, 25 Mar 2022, Ben Avison wrote:

> Note that the benchmarking results for these functions are highly dependent
> upon the input data. Therefore, each function is benchmarked twice,
> corresponding to the best and worst case complexity of the reference C
> implementation. The performance of a real stream decode will fall somewhere
> between these two extremes.
>
> Signed-off-by: Ben Avison <bavison at riscosopen.org>
> ---
> tests/checkasm/Makefile   |  1 +
> tests/checkasm/checkasm.c |  3 ++
> tests/checkasm/checkasm.h |  1 +
> tests/checkasm/vc1dsp.c   | 94 +++++++++++++++++++++++++++++++++++++++
> tests/fate/checkasm.mak   |  1 +
> 5 files changed, 100 insertions(+)
> create mode 100644 tests/checkasm/vc1dsp.c
>
> +#define CHECK_LOOP_FILTER(func)                                             \
> +    do {                                                                    \
> +        if (check_func(h.func, "vc1dsp." #func)) {                          \
> +            declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, int, int);  \
> +            for (int count = 1000; count > 0; --count) {                    \
> +                int pq = rnd() % 31 + 1;                                    \
> +                RANDOMIZE_BUFFER8_MID_WEIGHTED(filter_buf, 24 * 24);        \
> +                call_ref(filter_buf0 + 4 * 24 + 4, 24, pq);                 \
> +                call_new(filter_buf1 + 4 * 24 + 4, 24, pq);                 \
> +                if (memcmp(filter_buf0, filter_buf1, 24 * 24))              \
> +                    fail();                                                 \
> +            }                                                               \
> +        }                                                                   \
> +        for (int j = 0; j < 24; ++j)                                        \
> +            for (int i = 0; i < 24; ++i)                                    \
> +                filter_buf1[24*j + i] = 0x60 + 0x40 * (i >= 4 && j >= 4);   \
> +        if (check_func(h.func, "vc1dsp." #func "_bestcase")) {              \
> +            declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, int, int);  \
> +            bench_new(filter_buf1 + 4 * 24 + 4, 24, 1);                     \
> +            (void) checked_call;                                            \
> +        }                                                                   \
> +        if (check_func(h.func, "vc1dsp." #func "_worstcase")) {             \
> +            declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *, int, int);  \
> +            bench_new(filter_buf1 + 4 * 24 + 4, 24, 31);                    \
> +            (void) checked_call;                                            \
> +        }                                                                   \

(not a full review, just something that cropped up in initial build 
testing)

Why do you have the "(void) checked_call;" here? The checked_call isn't 
something that is universally defined; its availability depends on the 
OS/arch combinations, on other combinations, call_new/call_ref just call 
the function straight away without a wrapper. In particular, on macOS on 
arm64, we don't use checked_call, due to differences in how parameters are 
packed on the stack in the darwin ABI compared to AAPCS.

// Martin



More information about the ffmpeg-devel mailing list