Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
Opus
Commits
42667b0a
Commit
42667b0a
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
real fft no longer needs an internal buffer.
parent
4508ebd5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libcelt/kiss_fft.c
+20
-20
20 additions, 20 deletions
libcelt/kiss_fft.c
libcelt/kiss_fft.h
+4
-0
4 additions, 0 deletions
libcelt/kiss_fft.h
libcelt/kiss_fftr.c
+14
-17
14 additions, 17 deletions
libcelt/kiss_fftr.c
with
38 additions
and
37 deletions
libcelt/kiss_fft.c
+
20
−
20
View file @
42667b0a
...
...
@@ -478,8 +478,8 @@ static void ki_bfly_generic(
static
void
compute_bitrev_table
(
int
*
Fout
,
int
f
,
int
Fout
,
int
*
f
,
const
size_t
fstride
,
int
in_stride
,
int
*
factors
,
...
...
@@ -495,7 +495,7 @@ void compute_bitrev_table(
int
j
;
for
(
j
=
0
;
j
<
p
;
j
++
)
{
Fout
[
j
]
=
f
;
*
f
=
Fout
+
j
;
f
+=
fstride
*
in_stride
;
}
}
else
{
...
...
@@ -539,18 +539,18 @@ void kf_work(
}
}
static
void
ki_work
(
kiss_fft_cpx
*
Fout
,
const
kiss_fft_cpx
*
f
,
const
size_t
fstride
,
int
in_stride
,
int
*
factors
,
const
kiss_fft_cfg
st
,
int
N
,
int
s2
,
int
m2
)
void
ki_work
(
kiss_fft_cpx
*
Fout
,
const
kiss_fft_cpx
*
f
,
const
size_t
fstride
,
int
in_stride
,
int
*
factors
,
const
kiss_fft_cfg
st
,
int
N
,
int
s2
,
int
m2
)
{
int
i
;
kiss_fft_cpx
*
Fout_beg
=
Fout
;
...
...
@@ -636,7 +636,7 @@ kiss_fft_cfg kiss_fft_alloc(int nfft,void * mem,size_t * lenmem )
/* bitrev */
st
->
bitrev
=
(
int
*
)((
char
*
)
st
+
memneeded
-
sizeof
(
int
)
*
nfft
);
compute_bitrev_table
(
st
->
bitrev
,
0
,
1
,
1
,
st
->
factors
,
st
);
compute_bitrev_table
(
0
,
st
->
bitrev
,
1
,
1
,
st
->
factors
,
st
);
}
return
st
;
}
...
...
@@ -654,10 +654,10 @@ void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,
int
i
;
for
(
i
=
0
;
i
<
st
->
nfft
;
i
++
)
{
fout
[
i
]
=
fin
[
st
->
bitrev
[
i
]];
fout
[
st
->
bitrev
[
i
]]
=
fin
[
i
]
;
#ifndef FIXED_POINT
fout
[
i
].
r
*=
st
->
scale
;
fout
[
i
].
i
*=
st
->
scale
;
fout
[
st
->
bitrev
[
i
]
].
r
*=
st
->
scale
;
fout
[
st
->
bitrev
[
i
]
].
i
*=
st
->
scale
;
#endif
}
kf_work
(
fout
,
fin
,
1
,
in_stride
,
st
->
factors
,
st
,
1
,
in_stride
,
1
);
...
...
@@ -678,7 +678,7 @@ void kiss_ifft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout
/* Bit-reverse the input */
int
i
;
for
(
i
=
0
;
i
<
st
->
nfft
;
i
++
)
fout
[
i
]
=
fin
[
st
->
bitrev
[
i
]];
fout
[
st
->
bitrev
[
i
]]
=
fin
[
i
]
;
ki_work
(
fout
,
fin
,
1
,
in_stride
,
st
->
factors
,
st
,
1
,
in_stride
,
1
);
}
}
...
...
This diff is collapsed.
Click to expand it.
libcelt/kiss_fft.h
+
4
−
0
View file @
42667b0a
...
...
@@ -85,6 +85,10 @@ typedef struct kiss_fft_state* kiss_fft_cfg;
kiss_fft_cfg
kiss_fft_alloc
(
int
nfft
,
void
*
mem
,
size_t
*
lenmem
);
/** Internal function. Can be useful when you want to do the bit-reversing yourself */
void
ki_work
(
kiss_fft_cpx
*
Fout
,
const
kiss_fft_cpx
*
f
,
const
size_t
fstride
,
int
in_stride
,
int
*
factors
,
const
kiss_fft_cfg
st
,
int
N
,
int
s2
,
int
m2
);
/**
* kiss_fft(cfg,in_out_buf)
*
...
...
This diff is collapsed.
Click to expand it.
libcelt/kiss_fftr.c
+
14
−
17
View file @
42667b0a
...
...
@@ -26,7 +26,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
struct
kiss_fftr_state
{
kiss_fft_cfg
substate
;
kiss_fft_cpx
*
tmpbuf
;
kiss_twiddle_cpx
*
super_twiddles
;
#ifdef USE_SIMD
long
pad
;
...
...
@@ -46,7 +45,7 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,void * mem,size_t * lenmem)
nfft
>>=
1
;
kiss_fft_alloc
(
nfft
,
NULL
,
&
subsize
);
memneeded
=
sizeof
(
struct
kiss_fftr_state
)
+
subsize
+
sizeof
(
kiss_fft_cpx
)
*
(
nfft
)
+
sizeof
(
kiss_twiddle_cpx
)
*
nfft
;
memneeded
=
sizeof
(
struct
kiss_fftr_state
)
+
subsize
+
sizeof
(
kiss_twiddle_cpx
)
*
nfft
;
if
(
lenmem
==
NULL
)
{
st
=
(
kiss_fftr_cfg
)
KISS_FFT_MALLOC
(
memneeded
);
...
...
@@ -59,8 +58,7 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,void * mem,size_t * lenmem)
return
NULL
;
st
->
substate
=
(
kiss_fft_cfg
)
(
st
+
1
);
/*just beyond kiss_fftr_state struct */
st
->
tmpbuf
=
(
kiss_fft_cpx
*
)
(((
char
*
)
st
->
substate
)
+
subsize
);
st
->
super_twiddles
=
(
kiss_twiddle_cpx
*
)(
st
->
tmpbuf
+
nfft
);
st
->
super_twiddles
=
(
kiss_twiddle_cpx
*
)
(((
char
*
)
st
->
substate
)
+
subsize
);
kiss_fft_alloc
(
nfft
,
st
->
substate
,
&
subsize
);
#ifndef FIXED_POINT
st
->
substate
->
scale
*=
.
5
;
...
...
@@ -135,26 +133,25 @@ void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata,kiss_fft_scalar
ncfft
=
st
->
substate
->
nfft
;
st
->
tmpbuf
[
0
].
r
=
freqdata
[
0
]
+
freqdata
[
1
];
st
->
tmpbuf
[
0
].
i
=
freqdata
[
0
]
-
freqdata
[
1
];
timedata
[
2
*
st
->
substate
->
bitrev
[
0
]]
=
freqdata
[
0
]
+
freqdata
[
1
];
timedata
[
2
*
st
->
substate
->
bitrev
[
0
]
+
1
]
=
freqdata
[
0
]
-
freqdata
[
1
];
for
(
k
=
1
;
k
<=
ncfft
/
2
;
++
k
)
{
kiss_fft_cpx
fk
,
fnkc
,
fek
,
fok
,
tmp
;
int
k1
,
k2
;
k1
=
st
->
substate
->
bitrev
[
k
];
k2
=
st
->
substate
->
bitrev
[
ncfft
-
k
];
fk
.
r
=
freqdata
[
2
*
k
];
fk
.
i
=
freqdata
[
2
*
k
+
1
];
fnkc
.
r
=
freqdata
[
2
*
(
ncfft
-
k
)];
fnkc
.
i
=
-
freqdata
[
2
*
(
ncfft
-
k
)
+
1
];
fnkc
.
r
=
freqdata
[
2
*
(
ncfft
-
k
)];
fnkc
.
i
=
-
freqdata
[
2
*
(
ncfft
-
k
)
+
1
];
C_ADD
(
fek
,
fk
,
fnkc
);
C_SUB
(
tmp
,
fk
,
fnkc
);
C_MUL
(
fok
,
tmp
,
st
->
super_twiddles
[
k
]);
C_ADD
(
st
->
tmpbuf
[
k
],
fek
,
fok
);
C_SUB
(
st
->
tmpbuf
[
ncfft
-
k
],
fek
,
fok
);
#ifdef USE_SIMD
st
->
tmpbuf
[
ncfft
-
k
].
i
*=
_mm_set1_ps
(
-
1
.
0
);
#else
st
->
tmpbuf
[
ncfft
-
k
].
i
*=
-
1
;
#endif
timedata
[
2
*
k1
]
=
fek
.
r
+
fok
.
r
;
timedata
[
2
*
k1
+
1
]
=
fek
.
i
+
fok
.
i
;
timedata
[
2
*
k2
]
=
fek
.
r
-
fok
.
r
;
timedata
[
2
*
k2
+
1
]
=
fok
.
i
-
fek
.
i
;
}
kiss_
i
fft
(
st
->
substate
,
st
->
tmpbuf
,
(
kiss_fft_cpx
*
)
timedata
);
ki_work
((
kiss_fft
_cpx
*
)
timedata
,
NULL
,
1
,
1
,
st
->
substate
->
factors
,
st
->
substate
,
1
,
1
,
1
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment