From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id E8F544BF13 for ; Sat, 4 Oct 2025 17:23:48 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'h6rgOURv3lfb9ybNJWW/a6Fadsd0xB+nMR+4LTQHUpY=', expected b'p1Xq8Ug6y2gx5GUjyZWkcXr7Q2qjPm04mBftYIlJZH4=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1759598615; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=h6rgOURv3lfb9ybNJWW/a6Fadsd0xB+nMR+4LTQHUpY=; b=qQgZvqv+y8DlTUsquJudPvw2/gmh7vXgTMkUD7bftS8ICfsWFZnREcgzF9rIqn7CYUCmw UkWcydGEqoXhmdnV7YSWPsBsd0VpqID6Uf9Hai2eLGyo68RQAa3hnfXK1dL3l5n2j4lbcbk XaZIE3x5U/VQf4IooZETGmXm3nhM3kZRzRVHFR8YCWlWCSzoNTRZ0H1o+RizNqzfXEIelKT W8qEYwx2qH9S7FS9xY6o9jrGPuDDrlDbdSrUA+rFj/p+mGKpiafHPlkCVLQAuePoboFc94q vsBQDoWlqKexuxLn7koLt3f0rBk0XHT9U/ME0XZMO+lyL1/uFHF1LsNAFVDQ== Received: from [172.19.0.2] (unknown [172.19.0.2]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 6AC2768F00E; Sat, 4 Oct 2025 20:23:35 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1759598601; b=oinoMqcKbgJqd6a2Fnv/YiJMZGgoUd7ycNS+dnHBt2DE9p5q9WTtvMe/56vvMo0Z1Yn06 pOTdozzhLUSvX6OvzBb1aNumuRmcn/v5FY/fWMwb1g04R7u4dvAoaCP7Hvk/JL/j1gyNXkd a5uB68rSUEi6yUyP30v1glc3J/W/xlws5lS99v7LHPkt3GF3WdS477EvnHWylmuFGYs0MgT aIZJKB9CtjfgNbHPVnMzR3ep5uv8rINO2RsP0PJlyJS7g8NYjLxlO1W73qOb4rLi4OF6TFD W/OGDDTj43ysDa4u6FMUkL7qMnEYtAj4kY4T34wfh+pR1EvnByt8fRnLE0CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1759598601; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=YLFTYNgIyF9LWXaty5tD8L/Cre/bF937L7aS0hu1TpM=; b=VPH5RGddnXRBBhykP/Uqm0DbsBZtDSYtnOfkXGUjYbg6GONtyyOmrEThgJAzAAjbFD0/a nuCew0QS6ykCRdd375idfuD8OpaJBjIvnzXsSXAh7vOAefEVzjHqG9UiO4MbY0xo4QvEB6t njCTl/2ML7NOtK+3t7Ngdjd7IlydxQZBQHjkoAcyUFH5lwutAJg/n43hlMOPFvTTfEenY86 UyCL5YkQzTndL5eaJPGebYrODF2ISAJm4vJJGrVjjgKPAI9efIWCg7xqGgoWeOKFjsPvtLv ap8Jha5JX7VpzOrzKnF+Ybwn91Q5SjE9kkm/GzT+QTMVJQOoFizROBDcs37Q== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1759598594; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=p1Xq8Ug6y2gx5GUjyZWkcXr7Q2qjPm04mBftYIlJZH4=; b=DatCSbC5EWoEJj4Eiklx3sck89BOYE6PsWRsn88uM3eQpYQ5qNLllz6rehtzuTkNU0T5D zfiw/wPQfDidEplVmoaGXbM5c7qJMmgBZ/f15V6suTy5hPNvpCv6tze8YyQ57vfT+ej2je8 ry84hjUT0yXOJKLKAAJSh3FkSIbqQOCveqHba1/NCkl+CX8zDIzHNfLnibe1KFBPlpFgX6W oTzVNFuSf/7emDJTWgWPdBW/yvRMd8gFeVkE3HmxECvZGizeR98F7xecBhI8sKOtSh98pL5 ZXSwo971hJKjSvLZ/9eTsr5x19DNArU3/UphWuCZo4P+ay+TILgIRVsAGztQ== Received: from be50bb5a3685 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id F011468E72C for ; Sat, 4 Oct 2025 20:23:13 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Sat, 04 Oct 2025 17:23:13 -0000 Message-ID: <175959859414.69.16185432441262168876@bf249f23a2c8> Message-ID-Hash: KGW4W2MHDMDWVMWHNLVAW3B7TQBKEZUN X-Message-ID-Hash: KGW4W2MHDMDWVMWHNLVAW3B7TQBKEZUN X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] tests/checkasm: add a test for dcadsp (PR #20646) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: James Almer via ffmpeg-devel Cc: James Almer Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20646 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20646 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20646.patch >>From 99034b581f5608c1bb4edd52864b1bc973ad2dfb Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 4 Oct 2025 14:18:16 -0300 Subject: [PATCH 1/2] avcodec/dcadsp: constify lfe_samples parameter Signed-off-by: James Almer --- libavcodec/dcadsp.c | 8 ++++---- libavcodec/dcadsp.h | 4 ++-- libavcodec/x86/dcadsp_init.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/dcadsp.c b/libavcodec/dcadsp.c index 5ad1f644f2..d5fc5c4eb2 100644 --- a/libavcodec/dcadsp.c +++ b/libavcodec/dcadsp.c @@ -54,7 +54,7 @@ static void decode_joint_c(int32_t **dst, int32_t **src, } } -static void lfe_fir_float_c(float *pcm_samples, int32_t *lfe_samples, +static void lfe_fir_float_c(float *pcm_samples, const int32_t *lfe_samples, const float *filter_coeff, ptrdiff_t npcmblocks, int dec_select) { @@ -84,13 +84,13 @@ static void lfe_fir_float_c(float *pcm_samples, int32_t *lfe_samples, } } -static void lfe_fir0_float_c(float *pcm_samples, int32_t *lfe_samples, +static void lfe_fir0_float_c(float *pcm_samples, const int32_t *lfe_samples, const float *filter_coeff, ptrdiff_t npcmblocks) { lfe_fir_float_c(pcm_samples, lfe_samples, filter_coeff, npcmblocks, 0); } -static void lfe_fir1_float_c(float *pcm_samples, int32_t *lfe_samples, +static void lfe_fir1_float_c(float *pcm_samples, const int32_t *lfe_samples, const float *filter_coeff, ptrdiff_t npcmblocks) { lfe_fir_float_c(pcm_samples, lfe_samples, filter_coeff, npcmblocks, 1); @@ -193,7 +193,7 @@ static void sub_qmf64_float_c(SynthFilterContext *synth, } } -static void lfe_fir_fixed_c(int32_t *pcm_samples, int32_t *lfe_samples, +static void lfe_fir_fixed_c(int32_t *pcm_samples, const int32_t *lfe_samples, const int32_t *filter_coeff, ptrdiff_t npcmblocks) { // Select decimation factor diff --git a/libavcodec/dcadsp.h b/libavcodec/dcadsp.h index c29755267b..b99ec55619 100644 --- a/libavcodec/dcadsp.h +++ b/libavcodec/dcadsp.h @@ -40,7 +40,7 @@ typedef struct DCADSPContext { ptrdiff_t sb_start, ptrdiff_t sb_end, ptrdiff_t ofs, ptrdiff_t len); - void (*lfe_fir_float[2])(float *pcm_samples, int32_t *lfe_samples, + void (*lfe_fir_float[2])(float *pcm_samples, const int32_t *lfe_samples, const float *filter_coeff, ptrdiff_t npcmblocks); void (*lfe_x96_float)(float *dst, const float *src, @@ -56,7 +56,7 @@ typedef struct DCADSPContext { const float *filter_coeff, ptrdiff_t npcmblocks, float scale); - void (*lfe_fir_fixed)(int32_t *pcm_samples, int32_t *lfe_samples, + void (*lfe_fir_fixed)(int32_t *pcm_samples, const int32_t *lfe_samples, const int32_t *filter_coeff, ptrdiff_t npcmblocks); void (*lfe_x96_fixed)(int32_t *dst, const int32_t *src, diff --git a/libavcodec/x86/dcadsp_init.c b/libavcodec/x86/dcadsp_init.c index 0c78dd1c9e..c01bfffaba 100644 --- a/libavcodec/x86/dcadsp_init.c +++ b/libavcodec/x86/dcadsp_init.c @@ -22,9 +22,9 @@ #include "libavcodec/dcadsp.h" #define LFE_FIR_FLOAT_FUNC(opt) \ -void ff_lfe_fir0_float_##opt(float *pcm_samples, int32_t *lfe_samples, \ +void ff_lfe_fir0_float_##opt(float *pcm_samples, const int32_t *lfe_samples, \ const float *filter_coeff, ptrdiff_t npcmblocks); \ -void ff_lfe_fir1_float_##opt(float *pcm_samples, int32_t *lfe_samples, \ +void ff_lfe_fir1_float_##opt(float *pcm_samples, const int32_t *lfe_samples, \ const float *filter_coeff, ptrdiff_t npcmblocks); LFE_FIR_FLOAT_FUNC(sse2) -- 2.49.1 >>From 8fb6c8f16c8ad9e9a5019059089d1f1dc6d91933 Mon Sep 17 00:00:00 2001 From: James Almer Date: Sat, 4 Oct 2025 14:14:32 -0300 Subject: [PATCH 2/2] tests/checkasm: add a test for dcadsp Signed-off-by: James Almer --- tests/checkasm/Makefile | 2 +- tests/checkasm/checkasm.c | 1 + tests/checkasm/checkasm.h | 1 + tests/checkasm/dcadsp.c | 74 +++++++++++++++++++++++++++++++++++++++ tests/fate/checkasm.mak | 1 + 5 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 tests/checkasm/dcadsp.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 1589a15e2f..82bcc21b01 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -31,7 +31,7 @@ AVCODECOBJS-$(CONFIG_AAC_DECODER) += aacpsdsp.o \ AVCODECOBJS-$(CONFIG_AAC_ENCODER) += aacencdsp.o AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o AVCODECOBJS-$(CONFIG_APV_DECODER) += apv_dsp.o -AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o +AVCODECOBJS-$(CONFIG_DCA_DECODER) += dcadsp.o synth_filter.o AVCODECOBJS-$(CONFIG_DIRAC_DECODER) += diracdsp.o AVCODECOBJS-$(CONFIG_EXR_DECODER) += exrdsp.o AVCODECOBJS-$(CONFIG_FLAC_DECODER) += flacdsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index e59d366f2b..d542f953e8 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -142,6 +142,7 @@ static const struct { { "bswapdsp", checkasm_check_bswapdsp }, #endif #if CONFIG_DCA_DECODER + { "dcadsp", checkasm_check_dcadsp }, { "synth_filter", checkasm_check_synth_filter }, #endif #if CONFIG_DIRAC_DECODER diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index eda806e870..0382963daa 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -92,6 +92,7 @@ void checkasm_check_blockdsp(void); void checkasm_check_bswapdsp(void); void checkasm_check_colordetect(void); void checkasm_check_colorspace(void); +void checkasm_check_dcadsp(void); void checkasm_check_diracdsp(void); void checkasm_check_exrdsp(void); void checkasm_check_fdctdsp(void); diff --git a/tests/checkasm/dcadsp.c b/tests/checkasm/dcadsp.c new file mode 100644 index 0000000000..d76e3f0765 --- /dev/null +++ b/tests/checkasm/dcadsp.c @@ -0,0 +1,74 @@ +/* + * 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 "libavcodec/dcadata.h" +#include "libavcodec/dcadsp.h" +#include "libavutil/common.h" +#include "libavutil/mem_internal.h" + +#include "checkasm.h" + +#define N 32 +#define BLOCKSIZE 128 +#define BUF_SIZE (N * BLOCKSIZE) +#define LFE_HISTORY 8 +#define LFE_SIZE (N + LFE_HISTORY + 1) + +#define randomize(buf, len) do { \ + for (int i = 0; i < len; i++) \ + (buf)[i] = av_clip_intp2(rnd(), 16); \ +} while (0) + +#define EPS 0.0005f + +static void test_lfe_fir_float(const DCADSPContext *dca) +{ + LOCAL_ALIGNED_16(float, dst0, [BUF_SIZE]); + LOCAL_ALIGNED_16(float, dst1, [BUF_SIZE]); + LOCAL_ALIGNED_16(int32_t, lfe, [LFE_SIZE]); + + declare_func(void, float *pcm_samples, const int32_t *lfe_samples, + const float *filter_coeff, ptrdiff_t npcmblocks); + + for (int i = 0; i < 2; i++) { + const float *coeffs = i ? ff_dca_lfe_fir_128 : ff_dca_lfe_fir_64; + if (check_func(dca->lfe_fir_float[i], "lfe_fir%d_float", i)) { + memset(dst0, 0, BUF_SIZE * sizeof(float)); + memset(dst1, 0, BUF_SIZE * sizeof(float)); + randomize(lfe, LFE_SIZE); + call_ref(dst0, lfe + LFE_HISTORY, coeffs, N); + call_new(dst1, lfe + LFE_HISTORY, coeffs, N); + if (!float_near_abs_eps_array(dst0, dst1, EPS, BUF_SIZE)) + fail(); + bench_new(dst1, lfe + LFE_HISTORY, coeffs, N); + } + } +} + +void checkasm_check_dcadsp(void) +{ + DCADSPContext dca; + + ff_dcadsp_init(&dca); + + test_lfe_fir_float(&dca); + report("lfe_fir_float"); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 178b630fba..233950023c 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -9,6 +9,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp \ fate-checkasm-av_tx \ fate-checkasm-blockdsp \ fate-checkasm-bswapdsp \ + fate-checkasm-dcadsp \ fate-checkasm-diracdsp \ fate-checkasm-exrdsp \ fate-checkasm-fdctdsp \ -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org