[FFmpeg-devel] [PATCH v2 1/2] checkasm: updated tests for sw_scale

Martin Storsjö martin at martin.st
Thu Aug 4 14:36:41 EEST 2022


On Wed, 27 Jul 2022, Swinney, Jonathan wrote:

> - added a test for yuv2plane1
> - fixed test for yuv2planeX for aarch64 which was previously not working
>  at all
> - updated the test for yuv2planeX to check exact results or approximated
>  results
>
> Signed-off-by: Jonathan Swinney <jswinney at amazon.com>
> ---
> libswscale/x86/swscale.c  |   8 +-
> tests/checkasm/sw_scale.c | 189 ++++++++++++++++++++++++++++++--------
> 2 files changed, 155 insertions(+), 42 deletions(-)
>
> diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
> index 628f12137c..32d441245d 100644
> --- a/libswscale/x86/swscale.c
> +++ b/libswscale/x86/swscale.c
> @@ -534,7 +534,8 @@ switch(c->dstBpc){ \
>         ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
>         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2, ,
>                             HAVE_ALIGNED_STACK || ARCH_X86_64);
> -        ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2);
> +        if (!(c->flags & SWS_ACCURATE_RND))
> +            ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2);
>
>         switch (c->srcFormat) {
>         case AV_PIX_FMT_YA8:
> @@ -583,14 +584,15 @@ switch(c->dstBpc){ \
>         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,
>                             if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4,
>                             HAVE_ALIGNED_STACK || ARCH_X86_64);
> -        if (c->dstBpc == 16 && !isBE(c->dstFormat))
> +        if (c->dstBpc == 16 && !isBE(c->dstFormat) && !(c->flags & SWS_ACCURATE_RND))
>             c->yuv2plane1 = ff_yuv2plane1_16_sse4;
>     }
>
>     if (EXTERNAL_AVX(cpu_flags)) {
>         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx, ,
>                             HAVE_ALIGNED_STACK || ARCH_X86_64);
> -        ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx);
> +        if (!(c->flags & SWS_ACCURATE_RND))
> +            ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx);
>
>         switch (c->srcFormat) {
>         case AV_PIX_FMT_YUYV422:

I think it would be good to have someone who's more familiar with swscale 
(or just someone else overall) acknowledge these changes too.

> diff --git a/tests/checkasm/sw_scale.c b/tests/checkasm/sw_scale.c
> index b643a47c30..b01fc31fd9 100644
> --- a/tests/checkasm/sw_scale.c
> +++ b/tests/checkasm/sw_scale.c
> @@ -18,6 +18,7 @@
>  */
>
> #include <string.h>
> +#include <stdbool.h>

We don't generally use stdbool in ffmpeg, even if it's C99 - just use a 
plain int and 0/1.


Other than that, the checkasm changes look fine (I coauthored part of 
them - and your cleanup of my WIP patch looks good!).

// Martin



More information about the ffmpeg-devel mailing list