History

checkasm: test for abs_pow34

sunyuechi committed 2 years ago

Commit 1c3620b1 parent e880a975 files · +77 −1Browse files

Unified · Split

5 files
  1. tests/checkasm/Makefile +1 −0
  2. tests/checkasm/aacencdsp.c +70 −0
  3. tests/checkasm/checkasm.c +3 −0
  4. tests/checkasm/checkasm.h +1 −0
  5. tests/fate/checkasm.mak +2 −1
tests/checkasm/Makefile+1−0
@@ -23,6 +23,7 @@ AVCODECOBJS-$(CONFIG_VIDEODSP) += videodsp.o · 22 unmodified lines
2323 # decoders/encoders
2424 AVCODECOBJS-$(CONFIG_AAC_DECODER) += aacpsdsp.o \
2525 sbrdsp.o
26+AVCODECOBJS-$(CONFIG_AAC_ENCODER) += aacencdsp.o
2627 AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o
2728 AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o
2829 AVCODECOBJS-$(CONFIG_EXR_DECODER) += exrdsp.o
tests/checkasm/aacencdsp.c+70−0
@@ -0,0 +1,70 @@
1+/*
2+ * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
3+ *
4+ * This file is part of FFmpeg.
5+ *
6+ * FFmpeg is free software; you can redistribute it and/or modify
7+ * it under the terms of the GNU General Public License as published by
8+ * the Free Software Foundation; either version 2 of the License, or
9+ * (at your option) any later version.
10+ *
11+ * FFmpeg is distributed in the hope that it will be useful,
12+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+ * GNU General Public License for more details.
15+ *
16+ * You should have received a copy of the GNU General Public License along
17+ * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
18+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19+ */
20+
21+#include <string.h>
22+
23+#include "libavutil/mem.h"
24+#include "libavutil/mem_internal.h"
25+
26+#include "libavcodec/aacenc.h"
27+
28+#include "checkasm.h"
29+
30+#define randomize_float(buf, len) \
31+ do { \
32+ int i; \
33+ for (i = 0; i < len; i++) { \
34+ float f = (float)rnd() / (UINT_MAX >> 5) - 16.0f; \
35+ buf[i] = f; \
36+ } \
37+ } while (0)
38+
39+static void test_abs_pow34(AACEncContext *s) {
40+#define BUF_SIZE 1024
41+ LOCAL_ALIGNED_32(float, in, [BUF_SIZE]);
42+
43+ declare_func(void, float *, const float *, int);
44+
45+ randomize_float(in, BUF_SIZE);
46+
47+ if (check_func(s->abs_pow34, "abs_pow34")) {
48+ LOCAL_ALIGNED_32(float, out, [BUF_SIZE]);
49+ LOCAL_ALIGNED_32(float, out2, [BUF_SIZE]);
50+
51+ call_ref(out, in, BUF_SIZE);
52+ call_new(out2, in, BUF_SIZE);
53+
54+ if (memcmp(out, out2, BUF_SIZE * sizeof(float)) != 0)
55+ fail();
56+
57+ bench_new(out, in, BUF_SIZE);
58+ }
59+
60+ report("abs_pow34");
61+}
62+
63+
64+void checkasm_check_aacencdsp(void)
65+{
66+ AACEncContext s = { 0 };
67+ ff_aac_dsp_init(&s);
68+
69+ test_abs_pow34(&s);
70+}
tests/checkasm/checkasm.c+3−0
@@ -77,6 +77,9 @@ static const struct { · 76 unmodified lines
7777 { "aacpsdsp", checkasm_check_aacpsdsp },
7878 { "sbrdsp", checkasm_check_sbrdsp },
7979 #endif
80+ #if CONFIG_AAC_ENCODER
81+ { "aacencdsp", checkasm_check_aacencdsp },
82+ #endif
8083 #if CONFIG_AC3DSP
8184 { "ac3dsp", checkasm_check_ac3dsp },
8285 #endif
tests/checkasm/checkasm.h+1−0
@@ -43,6 +43,7 @@ · 42 unmodified lines
4343 #include "libavutil/lfg.h"
4444 #include "libavutil/timer.h"
4545
46+void checkasm_check_aacencdsp(void);
4647 void checkasm_check_aacpsdsp(void);
4748 void checkasm_check_ac3dsp(void);
4849 void checkasm_check_afir(void);
tests/fate/checkasm.mak+2−1
@@ -1,4 +1,5 @@
1−FATE_CHECKASM = fate-checkasm-aacpsdsp \
1+FATE_CHECKASM = fate-checkasm-aacencdsp \
2+ fate-checkasm-aacpsdsp \
23 fate-checkasm-ac3dsp \
34 fate-checkasm-af_afir \
45 fate-checkasm-alacdsp \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t