FFmpeg
Loading...
Searching...
No Matches
tests
checkasm
vorbisdsp.c
Go to the documentation of this file.
1
/*
2
* This file is part of FFmpeg.
3
*
4
* FFmpeg is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* FFmpeg is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along
15
* with FFmpeg; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
*/
18
19
#include <
float.h
>
20
#include <stdio.h>
21
#include <string.h>
22
23
#include "
libavutil/mem_internal.h
"
24
25
#include "
libavcodec/vorbisdsp.h
"
26
27
#include "
checkasm.h
"
28
29
#define LEN 512
30
31
static
void
test_inverse_coupling
(
void
)
32
{
33
LOCAL_ALIGNED_16
(
float
,
src0
, [
LEN
]);
34
LOCAL_ALIGNED_16
(
float
,
src1
, [
LEN
]);
35
LOCAL_ALIGNED_16
(
float
, cdst, [
LEN
]);
36
LOCAL_ALIGNED_16
(
float
, odst, [
LEN
]);
37
LOCAL_ALIGNED_16
(
float
, cdst1, [
LEN
]);
38
LOCAL_ALIGNED_16
(
float
, odst1, [
LEN
]);
39
40
declare_func
(
void
,
float
*restrict mag,
float
*restrict ang,
41
ptrdiff_t blocksize);
42
43
randomize_stddev
(
src0
,
LEN
, 10.0);
44
randomize_stddev
(
src1
,
LEN
, 10.0);
45
46
memcpy(cdst,
src0
,
LEN
*
sizeof
(*
src0
));
47
memcpy(cdst1,
src1
,
LEN
*
sizeof
(*
src1
));
48
memcpy(odst,
src0
,
LEN
*
sizeof
(*
src0
));
49
memcpy(odst1,
src1
,
LEN
*
sizeof
(*
src1
));
50
51
call_ref
(cdst, cdst1,
LEN
);
52
call_new
(odst, odst1,
LEN
);
53
for
(
int
i
= 0;
i
<
LEN
;
i
++) {
54
if
(!
float_near_abs_eps
(cdst[
i
], odst[
i
], FLT_EPSILON) ||
55
!
float_near_abs_eps
(cdst1[
i
], odst1[
i
], FLT_EPSILON)) {
56
fprintf(stderr,
"%d: %- .12f - %- .12f = % .12g\n"
,
57
i
, cdst[
i
], odst[
i
], cdst[
i
] - odst[
i
]);
58
fprintf(stderr,
"%d: %- .12f - %- .12f = % .12g\n"
,
59
i
, cdst1[
i
], odst1[
i
], cdst1[
i
] - odst1[
i
]);
60
fail
();
61
break
;
62
}
63
}
64
bench_new
(
src0
,
src1
,
LEN
);
65
}
66
67
void
checkasm_check_vorbisdsp
(
void
)
68
{
69
VorbisDSPContext
dsp;
70
71
ff_vorbisdsp_init
(&dsp);
72
73
if
(
check_func
(dsp.
vorbis_inverse_coupling
,
"inverse_coupling"
))
74
test_inverse_coupling
();
75
report
(
"inverse_coupling"
);
76
}
LEN
#define LEN
i
#define i(width, name, range_min, range_max)
Definition
cbs_h264.c:63
checkasm.h
randomize_stddev
#define randomize_stddev(buf, size, stddev)
Definition
checkasm.h:140
float.h
declare_func
#define declare_func
Definition
test.h:489
fail
#define fail
Definition
test.h:479
bench_new
#define bench_new
Definition
test.h:487
check_func
#define check_func
Definition
test.h:481
call_new
#define call_new
Definition
test.h:486
call_ref
#define call_ref
Definition
test.h:485
float_near_abs_eps
#define float_near_abs_eps
Definition
utils.h:449
report
#define report
Definition
test.h:480
ff_vorbisdsp_init
av_cold void ff_vorbisdsp_init(VorbisDSPContext *dsp)
Definition
vorbisdsp.c:46
mem_internal.h
LOCAL_ALIGNED_16
#define LOCAL_ALIGNED_16(t, v,...)
Definition
mem_internal.h:130
VorbisDSPContext
Definition
vorbisdsp.h:24
VorbisDSPContext::vorbis_inverse_coupling
void(* vorbis_inverse_coupling)(float *mag, float *ang, ptrdiff_t blocksize)
Definition
vorbisdsp.h:26
src1
#define src1
Definition
h264pred.c:141
src0
#define src0
Definition
h264pred.c:140
test_inverse_coupling
static void test_inverse_coupling(void)
Definition
vorbisdsp.c:31
checkasm_check_vorbisdsp
void checkasm_check_vorbisdsp(void)
Definition
vorbisdsp.c:67
vorbisdsp.h
Generated on Wed Aug 19 2026 20:20:54 for FFmpeg by
1.13.2