This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 7cf5e905868edbfecc4822feef47416fb5d71cac Author: Andreas Rheinhardt <[email protected]> AuthorDate: Tue Mar 24 13:54:58 2026 +0100 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Sat Mar 28 11:25:38 2026 +0100 tests/checkasm: Add sbcdsp tests Only sbc_analyze_4 and sbc_analyze_8 for now. Signed-off-by: Andreas Rheinhardt <[email protected]> --- tests/checkasm/Makefile | 1 + tests/checkasm/checkasm.c | 3 ++ tests/checkasm/checkasm.h | 1 + tests/checkasm/sbcdsp.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++ tests/fate/checkasm.mak | 1 + 5 files changed, 85 insertions(+) diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 6c525356aa..956f139090 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -48,6 +48,7 @@ AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_deblock.o hevc_de AVCODECOBJS-$(CONFIG_PNG_DECODER) += png.o AVCODECOBJS-$(CONFIG_RV34DSP) += rv34dsp.o AVCODECOBJS-$(CONFIG_RV40_DECODER) += rv40dsp.o +AVCODECOBJS-$(CONFIG_SBC_ENCODER) += sbcdsp.o AVCODECOBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o AVCODECOBJS-$(CONFIG_TAK_DECODER) += takdsp.o AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index b1504b14bb..b38e5926cb 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -249,6 +249,9 @@ static const struct { #if CONFIG_RV40_DECODER { "rv40dsp", checkasm_check_rv40dsp }, #endif + #if CONFIG_SBC_ENCODER + { "sbcdsp", checkasm_check_sbcdsp }, + #endif #if CONFIG_SVQ1_ENCODER { "svq1enc", checkasm_check_svq1enc }, #endif diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index f653207363..cded57d3ea 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -135,6 +135,7 @@ void checkasm_check_pixblockdsp(void); void checkasm_check_pixelutils(void); void checkasm_check_png(void); void checkasm_check_qpeldsp(void); +void checkasm_check_sbcdsp(void); void checkasm_check_sbrdsp(void); void checkasm_check_rv34dsp(void); void checkasm_check_rv40dsp(void); diff --git a/tests/checkasm/sbcdsp.c b/tests/checkasm/sbcdsp.c new file mode 100644 index 0000000000..aefe066fe2 --- /dev/null +++ b/tests/checkasm/sbcdsp.c @@ -0,0 +1,79 @@ +/* + * 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 <stddef.h> +#include <stdint.h> + +#include "checkasm.h" +#include "libavcodec/sbcdsp.h" +#include "libavcodec/sbcdsp_data.h" +#include "libavutil/macros.h" +#include "libavutil/mem_internal.h" + +enum { + SBC_MAX_SUBBANDS = 8, +}; + +#define randomize_buffer(buf) \ +do { \ + for (size_t k = 0; k < FF_ARRAY_ELEMS(buf); ++k) \ + buf[k] = rnd(); \ +} while (0) + +static void check_sbc_analyze(SBCDSPContext *sbcdsp) +{ + DECLARE_ALIGNED(SBC_ALIGN, int16_t, in)[10 * SBC_MAX_SUBBANDS]; + DECLARE_ALIGNED(SBC_ALIGN, int32_t, out_ref)[SBC_MAX_SUBBANDS]; + DECLARE_ALIGNED(SBC_ALIGN, int32_t, out_new)[SBC_MAX_SUBBANDS]; + + declare_func_emms(AV_CPU_FLAG_MMX, void, const int16_t *in, int32_t *out, const int16_t *consts); + + for (int i = 0; i < 2; ++i) { + if (check_func(i ? sbcdsp->sbc_analyze_8 : sbcdsp->sbc_analyze_4, "sbc_analyze_%u", i ? 8 : 4)) { + randomize_buffer(in); + randomize_buffer(out_ref); + memcpy(out_new, out_ref, sizeof(out_new)); + + // the input is always 16-byte aligned for sbc_analyze_8 + // for sbc_analyze_4 it can be 0 or 8 mod 16. + const int16_t *const inp = i || rnd() & 1 ? in : in + 4; + // Use the proper const tables as random ones can cause overflow + #define CONST(SIZE, ODDEVEN) sbcdsp_analysis_consts_fixed ## SIZE ## _simd_ ## ODDEVEN + const int16_t *const consts = rnd() & 1 ? (i ? CONST(8, odd) : CONST(4, odd)) + : (i ? CONST(8, even) : CONST(4, even)); + + call_ref(inp, out_ref, consts); + call_new(inp, out_new, consts); + + if (memcmp(out_ref, out_new, sizeof(out_new))) + fail(); + + bench_new(inp, out_new, consts); + } + } + report("sbc_analyze"); +} + +void checkasm_check_sbcdsp(void) +{ + SBCDSPContext sbcdsp; + + ff_sbcdsp_init(&sbcdsp); + + check_sbc_analyze(&sbcdsp); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index 8441bb3719..d75b885db1 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -53,6 +53,7 @@ FATE_CHECKASM = fate-checkasm-aacencdsp \ fate-checkasm-sbrdsp \ fate-checkasm-rv34dsp \ fate-checkasm-rv40dsp \ + fate-checkasm-sbcdsp \ fate-checkasm-scene_sad \ fate-checkasm-svq1enc \ fate-checkasm-synth_filter \ _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
