From patchwork Fri Oct 22 08:52:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wu Jianhua X-Patchwork-Id: 31208 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2084:0:0:0:0 with SMTP id a4csp1557375ioa; Fri, 22 Oct 2021 01:53:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ15GkvKq+IL6sel97tcJPiDq1gKb7O6W0vITpnpDUYgWE9GN4U0YMZRsVTn+rp9WSdDrz X-Received: by 2002:aa7:cb8a:: with SMTP id r10mr15292456edt.237.1634892819595; Fri, 22 Oct 2021 01:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634892819; cv=none; d=google.com; s=arc-20160816; b=hQLDfx/jno13xzxcX3oc4Ry6LUQHXpCAvPclSfCnmMZRQtN/dAzT4LHAXrmR+A3Pxb 1Q31X1e3pJCk9l5JIKTa4cTaIo6aD0bmW/g93ZTumZkz6mRk2UUWeTCbHbiBy66n1ALb 19zPL0idZckTRQC/wiEPSxMbY1T/YlomsO5UE8NhGOXit6rL6u5QzGjYbM6CdvwVsf+U MzrH/HoBYLpEiJKBJYKT/PUFfhfFolZmLiHkeRk6uGUAWjuOglr5WOekMWlkd60Y6OdO M7xSaszINKTMCt7bAOWfhCawViry5v9ipII4CrXNjnAtf8dBAa8ba1PBPX9R4O7fhJYg 27RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=9/AbSYrer0OkGa3hKUx0m3BU5OjaKZZLDfvjQweH0YI=; b=Y4dwhjG8gSfXcK/idB0EV3RcuK4h8jr9hZvbz+3xPXPoPD5IPkDLH8tuK8NR+EeARS nWZDzbYLe+QSC8Vjb259NG6q9qOPLTljyLmg2Brp6kwhT83x5pQeR+Eq1avxSDRTuIMx jfa/jQpqV7Z58L2GNHjVOzX0RyOLe/OlP5FqQ6WIhvNOYX7Q1wECTp84kaBh7dsylxNv U56aKh397D8AIpCRrC6gC94nRrncxYOr2peITRxM17XtXyUnolrzlH96PyMeNRhEUV5S RpK9k9MklffJvPw7Yx4h/h91mltwFLxUuCLoDuSKl1ZNvJQEVUffnkPJ8KdR/EUZlG3S ZH4g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dr16si12227250ejc.246.2021.10.22.01.53.39; Fri, 22 Oct 2021 01:53:39 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D1AEF68A881; Fri, 22 Oct 2021 11:53:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 55D5368A755 for ; Fri, 22 Oct 2021 11:53:07 +0300 (EEST) X-IronPort-AV: E=McAfee;i="6200,9189,10144"; a="216176990" X-IronPort-AV: E=Sophos;i="5.87,172,1631602800"; d="scan'208";a="216176990" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2021 01:52:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,172,1631602800"; d="scan'208";a="495586630" Received: from otc-skl-e5-server.sh.intel.com ([10.239.43.106]) by orsmga008.jf.intel.com with ESMTP; 22 Oct 2021 01:52:52 -0700 From: Wu Jianhua To: ffmpeg-devel@ffmpeg.org Date: Fri, 22 Oct 2021 16:52:31 +0800 Message-Id: <20211022085231.93931-4-jianhua.wu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211022085231.93931-1-jianhua.wu@intel.com> References: <20211022085231.93931-1-jianhua.wu@intel.com> Subject: [FFmpeg-devel] [PATCH 4/4] tests/checkasm: add check for vf_exposure 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: Wu Jianhua MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: laCrvskSGyuc Signed-off-by: Wu Jianhua --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/vf_exposure.c | 68 ++++++++++++++++++++++++++++++++++++ tests/fate/checkasm.mak | 1 + 5 files changed, 74 insertions(+) create mode 100644 tests/checkasm/vf_exposure.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 4ef5fa87da..7b86ffca6b 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -37,6 +37,7 @@ AVFILTEROBJS-$(CONFIG_AFIR_FILTER) += af_afir.o AVFILTEROBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o AVFILTEROBJS-$(CONFIG_COLORSPACE_FILTER) += vf_colorspace.o AVFILTEROBJS-$(CONFIG_EQ_FILTER) += vf_eq.o +AVFILTEROBJS-$(CONFIG_EXPOSURE_FILTER) += vf_exposure.o AVFILTEROBJS-$(CONFIG_GBLUR_FILTER) += vf_gblur.o AVFILTEROBJS-$(CONFIG_HFLIP_FILTER) += vf_hflip.o AVFILTEROBJS-$(CONFIG_THRESHOLD_FILTER) += vf_threshold.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index b1353f7cbe..50961d9961 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -169,6 +169,9 @@ static const struct { #if CONFIG_EQ_FILTER { "vf_eq", checkasm_check_vf_eq }, #endif + #if CONFIG_EXPOSURE_FILTER + { "vf_exposure", checkasm_check_vf_exposure }, + #endif #if CONFIG_GBLUR_FILTER { "vf_gblur", checkasm_check_vf_gblur }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 68b0697d3e..b402894ad3 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -78,6 +78,7 @@ void checkasm_check_utvideodsp(void); void checkasm_check_v210dec(void); void checkasm_check_v210enc(void); void checkasm_check_vf_eq(void); +void checkasm_check_vf_exposure(void); void checkasm_check_vf_gblur(void); void checkasm_check_vf_hflip(void); void checkasm_check_vf_threshold(void); diff --git a/tests/checkasm/vf_exposure.c b/tests/checkasm/vf_exposure.c new file mode 100644 index 0000000000..fb79c920df --- /dev/null +++ b/tests/checkasm/vf_exposure.c @@ -0,0 +1,68 @@ +/* + * 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 +#include "checkasm.h" +#include "libavfilter/exposure.h" + +#define PIXELS 256 +#define BUF_SIZE (PIXELS * 4) + +#define randomize_buffers(buf, size) \ + do { \ + int j; \ + float *tmp_buf = (float *)buf; \ + for (j = 0; j < size; j++) \ + tmp_buf[j] = (float)(rnd() & 0xFF); \ + } while (0) + +static void check_exposure(float *dst_ref, float *dst_new, float black, float scale) +{ + declare_func(void, float *dst, int length, float black, float scale); + call_ref(dst_ref, PIXELS, black, scale); + call_new(dst_new, PIXELS, black, scale); + + if (!float_near_abs_eps_array(dst_ref, dst_new, 0.01f, PIXELS)) { + fail(); + } + bench_new(dst_new, PIXELS, black, scale); +} + +void checkasm_check_vf_exposure(void) +{ + float *dst_ref = av_malloc(BUF_SIZE); + float *dst_new = av_malloc(BUF_SIZE); + ExposureContext s; + + s.black = 0.1; + s.exposure = 1.4; + + randomize_buffers(dst_ref, PIXELS); + memcpy(dst_new, dst_ref, BUF_SIZE); + + ff_exposure_init(&s); + + if (check_func(s.exposure_func, "exposure")) { + check_exposure(dst_ref, dst_new, s.black, s.scale); + } + report("exposure"); + + av_freep(&dst_ref); + av_freep(&dst_new); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 6e7edbe655..4d4cd6cc88 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -34,6 +34,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \ fate-checkasm-vf_blend \ fate-checkasm-vf_colorspace \ fate-checkasm-vf_eq \ + fate-checkasm-vf_exposure \ fate-checkasm-vf_gblur \ fate-checkasm-vf_hflip \ fate-checkasm-vf_nlmeans \