The branch, master has been updated
via 95850f339e96ac4ea82dd32cecc2c8795edcb47e (commit)
via 99034b581f5608c1bb4edd52864b1bc973ad2dfb (commit)
from e05f8acabff468c1382277c1f31fa8e9d90c3202 (commit)
- Log -----------------------------------------------------------------
commit 95850f339e96ac4ea82dd32cecc2c8795edcb47e
Author: James Almer <[email protected]>
AuthorDate: Sat Oct 4 14:14:32 2025 -0300
Commit: James Almer <[email protected]>
CommitDate: Sun Oct 5 10:09:04 2025 -0300
tests/checkasm: add a test for dcadsp
Signed-off-by: James Almer <[email protected]>
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..809a0a0974
--- /dev/null
+++ b/tests/checkasm/dcadsp.c
@@ -0,0 +1,101 @@
+/*
+ * 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 <stdint.h>
+#include <string.h>
+
+#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)
+
+/* sign_extend(rnd(), 23) would be the correct approach here,
+ * but it results in differences that would require a much
+ * bigger EPS value, thus we use 16 (simplified as a cast). */
+#define randomize(buf, len) do { \
+ for (int i = 0; i < len; i++) \
+ (buf)[i] = (int16_t)rnd(); \
+} 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);
+ }
+ }
+}
+
+static void test_lfe_fir_fixed(void)
+{
+ LOCAL_ALIGNED_16(int32_t, dst0, [BUF_SIZE]);
+ LOCAL_ALIGNED_16(int32_t, dst1, [BUF_SIZE]);
+ LOCAL_ALIGNED_16(int32_t, lfe, [LFE_SIZE]);
+ const int32_t *coeffs = ff_dca_lfe_fir_64_fixed;
+
+ declare_func(void, int32_t *pcm_samples, const int32_t *lfe_samples,
+ const int32_t *filter_coeff, ptrdiff_t npcmblocks);
+
+ memset(dst0, 0, BUF_SIZE * sizeof(int32_t));
+ memset(dst1, 0, BUF_SIZE * sizeof(int32_t));
+ randomize(lfe, LFE_SIZE);
+ call_ref(dst0, lfe + LFE_HISTORY, coeffs, N);
+ call_new(dst1, lfe + LFE_HISTORY, coeffs, N);
+ if (memcmp(dst0, dst1, BUF_SIZE * sizeof(int32_t)))
+ 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");
+
+ if (check_func(dca.lfe_fir_fixed, "lfe_fir_fixed"))
+ test_lfe_fir_fixed();
+ report("lfe_fir_fixed");
+}
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 \
commit 99034b581f5608c1bb4edd52864b1bc973ad2dfb
Author: James Almer <[email protected]>
AuthorDate: Sat Oct 4 14:18:16 2025 -0300
Commit: James Almer <[email protected]>
CommitDate: Sat Oct 4 14:18:30 2025 -0300
avcodec/dcadsp: constify lfe_samples parameter
Signed-off-by: James Almer <[email protected]>
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)
-----------------------------------------------------------------------
Summary of changes:
libavcodec/dcadsp.c | 8 ++--
libavcodec/dcadsp.h | 4 +-
libavcodec/x86/dcadsp_init.c | 4 +-
tests/checkasm/Makefile | 2 +-
tests/checkasm/checkasm.c | 1 +
tests/checkasm/checkasm.h | 1 +
tests/checkasm/dcadsp.c | 101 +++++++++++++++++++++++++++++++++++++++++++
tests/fate/checkasm.mak | 1 +
8 files changed, 113 insertions(+), 9 deletions(-)
create mode 100644 tests/checkasm/dcadsp.c
hooks/post-receive
--
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]