FFmpeg
aacencdsp.c
Go to the documentation of this file.
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_internal.h"
24 
25 #include "libavcodec/aacencdsp.h"
26 
27 #include "checkasm.h"
28 
29 #define randomize_float(buf, len) \
30  do { \
31  int i; \
32  for (i = 0; i < len; i++) { \
33  float f = (float)rnd() / (UINT_MAX >> 5) - 16.0f; \
34  buf[i] = f; \
35  } \
36  } while (0)
37 
39 {
40 #define BUF_SIZE 1024
41  LOCAL_ALIGNED_32(float, in, [BUF_SIZE]);
42 
43  declare_func(void, float *, const float *, int);
44 
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 (!float_near_ulp_array(out, out2, 1, BUF_SIZE))
55  fail();
56 
57  bench_new(out, in, BUF_SIZE);
58  }
59 
60  report("abs_pow34");
61 }
62 
63 
65 {
66  AACEncDSPContext s = { 0 };
68 
69  test_abs_pow34(&s);
70 }
mem_internal.h
out
FILE * out
Definition: movenc.c:55
AACEncDSPContext
Definition: aacencdsp.h:28
check_func
#define check_func(func,...)
Definition: checkasm.h:174
call_ref
#define call_ref(...)
Definition: checkasm.h:189
fail
#define fail()
Definition: checkasm.h:183
checkasm.h
BUF_SIZE
#define BUF_SIZE
s
#define s(width, name)
Definition: cbs_vp9.c:198
call_new
#define call_new(...)
Definition: checkasm.h:292
LOCAL_ALIGNED_32
#define LOCAL_ALIGNED_32(t, v,...)
Definition: mem_internal.h:156
checkasm_check_aacencdsp
void checkasm_check_aacencdsp(void)
Definition: aacencdsp.c:64
test_abs_pow34
static void test_abs_pow34(AACEncDSPContext *s)
Definition: aacencdsp.c:38
randomize_float
#define randomize_float(buf, len)
Definition: aacencdsp.c:29
report
#define report
Definition: checkasm.h:186
bench_new
#define bench_new(...)
Definition: checkasm.h:363
aacencdsp.h
float_near_ulp_array
int float_near_ulp_array(const float *a, const float *b, unsigned max_ulp, unsigned len)
Definition: checkasm.c:391
declare_func
#define declare_func(ret,...)
Definition: checkasm.h:178
ff_aacenc_dsp_init
static void ff_aacenc_dsp_init(AACEncDSPContext *s)
Definition: aacencdsp.h:60