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
23# decoders/encoders23# decoders/encoders
24AVCODECOBJS-$(CONFIG_AAC_DECODER) += aacpsdsp.o \24AVCODECOBJS-$(CONFIG_AAC_DECODER) += aacpsdsp.o \
25 sbrdsp.o25 sbrdsp.o
26AVCODECOBJS-$(CONFIG_AAC_ENCODER) += aacencdsp.o
26AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o27AVCODECOBJS-$(CONFIG_ALAC_DECODER) += alacdsp.o
27AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o28AVCODECOBJS-$(CONFIG_DCA_DECODER) += synth_filter.o
28AVCODECOBJS-$(CONFIG_EXR_DECODER) += exrdsp.o29AVCODECOBJS-$(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
39static 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
64void 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
77 { "aacpsdsp", checkasm_check_aacpsdsp },77 { "aacpsdsp", checkasm_check_aacpsdsp },
78 { "sbrdsp", checkasm_check_sbrdsp },78 { "sbrdsp", checkasm_check_sbrdsp },
79 #endif79 #endif
80 #if CONFIG_AAC_ENCODER
81 { "aacencdsp", checkasm_check_aacencdsp },
82 #endif
80 #if CONFIG_AC3DSP83 #if CONFIG_AC3DSP
81 { "ac3dsp", checkasm_check_ac3dsp },84 { "ac3dsp", checkasm_check_ac3dsp },
82 #endif85 #endif
tests/checkasm/checkasm.h+1−0
@@ -43,6 +43,7 @@ · 42 unmodified lines
43#include "libavutil/lfg.h"43#include "libavutil/lfg.h"
44#include "libavutil/timer.h"44#include "libavutil/timer.h"
45 45
46void checkasm_check_aacencdsp(void);
46void checkasm_check_aacpsdsp(void);47void checkasm_check_aacpsdsp(void);
47void checkasm_check_ac3dsp(void);48void checkasm_check_ac3dsp(void);
48void checkasm_check_afir(void);49void checkasm_check_afir(void);
tests/fate/checkasm.mak+2−1
@@ -1,4 +1,5 @@
1FATE_CHECKASM = fate-checkasm-aacpsdsp \1FATE_CHECKASM = fate-checkasm-aacencdsp \
2 fate-checkasm-aacpsdsp \
2 fate-checkasm-ac3dsp \3 fate-checkasm-ac3dsp \
3 fate-checkasm-af_afir \4 fate-checkasm-af_afir \
4 fate-checkasm-alacdsp \5 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