From patchwork Fri Mar 25 18:52:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Avison X-Patchwork-Id: 34986 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:ab0:5fda:0:0:0:0:0 with SMTP id g26csp1432409uaj; Fri, 25 Mar 2022 11:54:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNn7mishMw/qj/ulg1o+2zy0Pkdy9RG0vru2mLyrQsV9lbATsXMvAocF5XeKwV3mf5CO9C X-Received: by 2002:a17:906:6a11:b0:6d7:76cc:12f6 with SMTP id qw17-20020a1709066a1100b006d776cc12f6mr13101255ejc.456.1648234456806; Fri, 25 Mar 2022 11:54:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648234456; cv=none; d=google.com; s=arc-20160816; b=XqJWTdw2hJUwatvOML7I4N+HAG344wwD3/Sj+aslhGL/u6N7rxnPAAed/n/clGiQLQ 5xfXWZ1sA0U07ARGOxn46DmjIC4HyMT/g4EJcKQSlJPWFh8YgT2QMcX9MjKkYOcH/hHx jqwt7sz9A3zIGTLgpja6JHn/cuNQhJSdf9GPGLn3j7b6UKK+ksLA9OBAEmeKzjZrOi8+ TUZGwWyVJ1w6jZTiqOV8KXv7Z1nSftDbjOz4xSZhT17hInpsvjD1DI/PCTB7K6OUI1RB JMRL8qsMGmqOat83fiekKNYIR2i99hY8e3xIqF011wWGYiaN2DxHZdMVTOELBv4Kf8LK ItgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:delivered-to; bh=XFpyAbr2cfMje5LP5wCen3ZeUmGXsu5VS6RxqfVUnlA=; b=d2JTyQxbFu+9drGslg4MyQZk506ZtLjYbbiZlJrfLDiKNA+P0EVh0Q92pE+xKaUtNX SjTMkj92T0IxEaATI6E721h06paC6UwENwvrrF4NFtxPpt0Iig26Buf2+hvsD/EOSC9y pYLcEdxXezCRh81Et6vVgRqRU9qDmHg3/xcNSJa5sJXcg7EJtJyf9cwfH6bTEK3ctvO9 aT7aFupFUzfZLZRZbJrxMJR0wlPRJ/SIdQ4mKUfWyobBe/pguEw0e6QNUhkeZB1N2DMv JeaQWJ6lK8DtmI5VaD0eLI+MD90DhBpSyWpSliM4hxcOwgijShcQ5Z4FHCFNO76j3oQP /nFg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z24-20020a50f158000000b00418ed563a99si4012749edl.484.2022.03.25.11.54.16; Fri, 25 Mar 2022 11:54:16 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 877A368B239; Fri, 25 Mar 2022 20:53:49 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from outmail148101.authsmtp.com (unknown [62.13.148.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9F14368B227 for ; Fri, 25 Mar 2022 20:53:42 +0200 (EET) Received: from mail-c233.authsmtp.com (mail-c233.authsmtp.com [62.13.128.233]) by punt16.authsmtp.com. (8.15.2/8.15.2) with ESMTP id 22PIrgBZ019632; Fri, 25 Mar 2022 18:53:42 GMT (envelope-from bavison@riscosopen.org) Received: from rpi2021 (237.63.9.51.dyn.plus.net [51.9.63.237]) (authenticated bits=0) by mail.authsmtp.com (8.15.2/8.15.2) with ESMTPSA id 22PIrdwI046493 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 25 Mar 2022 18:53:40 GMT (envelope-from bavison@riscosopen.org) Received: by rpi2021 (sSMTP sendmail emulation); Fri, 25 Mar 2022 18:53:39 +0000 From: Ben Avison To: ffmpeg-devel@ffmpeg.org Date: Fri, 25 Mar 2022 18:52:50 +0000 Message-Id: <20220325185257.513933-4-bavison@riscosopen.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220325185257.513933-1-bavison@riscosopen.org> References: <20220317185819.466470-1-bavison@riscosopen.org> <20220325185257.513933-1-bavison@riscosopen.org> MIME-Version: 1.0 X-Server-Quench: e3546d95-ac6c-11ec-a0f2-84349711df28 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCd1YggXA1ZfRRob ESQCJDVBUg4iPRpU DBlFKhFVNl8UURhQ KkJXbgASJgdBAnRQ QXkJW1ZWQFx5U2Z2 YQ5QIwBcfENQWQZ0 UktOXVBXFgB3AFID BH5nEE01DgVCfnp5 ZghjWHJZWgovdkN5 RBpdEHBXNmEzdWEe BRNFJgMCch5CehxB Y1d+VSdbY21JDRoR IyQTd2hqemwHHWxe QgwGLlsJRBRDNzIw DxEOFikjBlVNTik/ aAQ7NhsEHVYcNl53 Ol8oXEoVP1cOBxZC BCkA X-Authentic-SMTP: 61633632303230.1021:7600 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 51.9.63.237/2525 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. Subject: [FFmpeg-devel] [PATCH 03/10] checkasm: Add idctdsp add/put-pixels-clamped tests X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Ben Avison Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: eghRFLjVMSXw Disable ff_add_pixels_clamped_arm, which was found to fail the test. As this is normally only used for Arms prior to Armv6 (ARM11) it seems quite unlikely that anyone is still using this, so I haven't put in the effort to debug it. Signed-off-by: Ben Avison --- libavcodec/arm/idctdsp_init_arm.c | 2 + tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/idctdsp.c | 85 +++++++++++++++++++++++++++++++ tests/fate/checkasm.mak | 1 + 6 files changed, 93 insertions(+) create mode 100644 tests/checkasm/idctdsp.c diff --git a/libavcodec/arm/idctdsp_init_arm.c b/libavcodec/arm/idctdsp_init_arm.c index ebc90e4b49..8c8f7daf06 100644 --- a/libavcodec/arm/idctdsp_init_arm.c +++ b/libavcodec/arm/idctdsp_init_arm.c @@ -83,7 +83,9 @@ av_cold void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx, } } +#if 0 // FIXME: this implementation fails checkasm test c->add_pixels_clamped = ff_add_pixels_clamped_arm; +#endif if (have_armv5te(cpu_flags)) ff_idctdsp_init_armv5te(c, avctx, high_bit_depth); diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 7133a6ee66..f6b1008855 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -9,6 +9,7 @@ AVCODECOBJS-$(CONFIG_G722DSP) += g722dsp.o AVCODECOBJS-$(CONFIG_H264DSP) += h264dsp.o AVCODECOBJS-$(CONFIG_H264PRED) += h264pred.o AVCODECOBJS-$(CONFIG_H264QPEL) += h264qpel.o +AVCODECOBJS-$(CONFIG_IDCTDSP) += idctdsp.o AVCODECOBJS-$(CONFIG_LLVIDDSP) += llviddsp.o AVCODECOBJS-$(CONFIG_LLVIDENCDSP) += llviddspenc.o AVCODECOBJS-$(CONFIG_VC1DSP) += vc1dsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index c2efd81b6d..57134f96ea 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -123,6 +123,9 @@ static const struct { #if CONFIG_HUFFYUV_DECODER { "huffyuvdsp", checkasm_check_huffyuvdsp }, #endif + #if CONFIG_IDCTDSP + { "idctdsp", checkasm_check_idctdsp }, + #endif #if CONFIG_JPEG2000_DECODER { "jpeg2000dsp", checkasm_check_jpeg2000dsp }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 52ab18a5b1..a86db140e3 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -64,6 +64,7 @@ void checkasm_check_hevc_idct(void); void checkasm_check_hevc_pel(void); void checkasm_check_hevc_sao(void); void checkasm_check_huffyuvdsp(void); +void checkasm_check_idctdsp(void); void checkasm_check_jpeg2000dsp(void); void checkasm_check_llviddsp(void); void checkasm_check_llviddspenc(void); diff --git a/tests/checkasm/idctdsp.c b/tests/checkasm/idctdsp.c new file mode 100644 index 0000000000..d94728b672 --- /dev/null +++ b/tests/checkasm/idctdsp.c @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2022 Ben Avison + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +#include "checkasm.h" + +#include "libavcodec/idctdsp.h" + +#include "libavutil/common.h" +#include "libavutil/internal.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/mem_internal.h" + +#define RANDOMIZE_BUFFER16(name, size) \ + do { \ + int i; \ + for (i = 0; i < size; ++i) { \ + uint16_t r = rnd(); \ + AV_WN16A(name##0 + i, r); \ + AV_WN16A(name##1 + i, r); \ + } \ + } while (0) + +#define RANDOMIZE_BUFFER8(name, size) \ + do { \ + int i; \ + for (i = 0; i < size; ++i) { \ + uint8_t r = rnd(); \ + name##0[i] = r; \ + name##1[i] = r; \ + } \ + } while (0) + +#define CHECK_ADD_PUT_CLAMPED(func) \ + do { \ + if (check_func(h.func, "idctdsp." #func)) { \ + declare_func_emms(AV_CPU_FLAG_MMX, void, const int16_t *, uint8_t *, ptrdiff_t); \ + RANDOMIZE_BUFFER16(src, 64); \ + RANDOMIZE_BUFFER8(dst, 10 * 24); \ + call_ref(src0, dst0 + 24 + 8, 24); \ + call_new(src1, dst1 + 24 + 8, 24); \ + if (memcmp(dst0, dst1, 10 * 24)) \ + fail(); \ + bench_new(src1, dst1 + 24 + 8, 24); \ + } \ + } while (0) + +void checkasm_check_idctdsp(void) +{ + /* Source buffers are only as big as needed, since any over-read won't affect results */ + LOCAL_ALIGNED_16(int16_t, src0, [64]); + LOCAL_ALIGNED_16(int16_t, src1, [64]); + /* Destination buffers have borders of one row above/below and 8 columns left/right to catch overflows */ + LOCAL_ALIGNED_8(uint8_t, dst0, [10 * 24]); + LOCAL_ALIGNED_8(uint8_t, dst1, [10 * 24]); + + AVCodecContext avctx = { 0 }; + IDCTDSPContext h; + + ff_idctdsp_init(&h, &avctx); + + CHECK_ADD_PUT_CLAMPED(add_pixels_clamped); + CHECK_ADD_PUT_CLAMPED(put_pixels_clamped); + CHECK_ADD_PUT_CLAMPED(put_signed_pixels_clamped); + + report("idctdsp"); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 99e6bb13c4..c6273db183 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -19,6 +19,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \ fate-checkasm-hevc_pel \ fate-checkasm-hevc_sao \ fate-checkasm-huffyuvdsp \ + fate-checkasm-idctdsp \ fate-checkasm-jpeg2000dsp \ fate-checkasm-llviddsp \ fate-checkasm-llviddspenc \