You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
201 lines
15 KiB
HTML
201 lines
15 KiB
HTML
<!-- HTML header for doxygen 1.9.2-->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>CMSIS-DSP: Real FFT Functions</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<script type="text/javascript" src="footer.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function() { init_search(); });
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/x-mathjax-config">
|
|
MathJax.Hub.Config({
|
|
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
|
jax: ["input/TeX","output/HTML-CSS"],
|
|
});
|
|
</script>
|
|
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
|
|
<link href="$extra_stylesheet" rel="stylesheet" type="text/css" />
|
|
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
|
|
<link href="version.css" rel="stylesheet" type="text/css" />
|
|
<script type="text/javascript" src="../version.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 55px;">
|
|
<td id="projectlogo" style="padding: 1.5em;"><img alt="Logo" src="cmsis_logo_white_small.png"/></td>
|
|
<td style="padding-left: 1em; padding-bottom: 1em;padding-top: 1em;">
|
|
<div id="projectname">CMSIS-DSP
|
|
 <span id="projectnumber"><script type="text/javascript">
|
|
<!--
|
|
writeHeader.call(this);
|
|
writeVersionDropdown(this);
|
|
//-->
|
|
</script>
|
|
</span>
|
|
</div>
|
|
<div id="projectbrief">CMSIS DSP Software Library</div>
|
|
</td>
|
|
<!--END !PROJECT_NAME-->
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.2 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
|
|
/* @license-end */
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Usage and Description</span></a></li>
|
|
<li class="current"><a href="modules.html"><span> API Reference</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.svg"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function(){initNavTree('group__RealFFT.html',''); initResizable(); });
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#groups">Content</a> </div>
|
|
<div class="headertitle"><div class="title">Real FFT Functions<div class="ingroups"><a class="el" href="group__groupTransforms.html">Transform Functions</a></div></div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="groups" name="groups"></a>
|
|
Content</h2></td></tr>
|
|
<tr class="memitem:group__RealFFTF16"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__RealFFTF16.html">Real FFT F16 Functions</a></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:group__RealFFTF64"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__RealFFTF64.html">Real FFT F64 Functions</a></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:group__RealFFTQ15"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__RealFFTQ15.html">Real FFT Q15 Functions</a></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:group__RealFFTQ31"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__RealFFTQ31.html">Real FFT Q31 Functions</a></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:group__RealFFT__Table"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__RealFFT__Table.html">Real FFT Tables</a></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:group__RealFFTF32"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__RealFFTF32.html">Real FFT F32 Functions</a></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:group__DeprecatedRealFFT"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__DeprecatedRealFFT.html">Deprecated Real FFT Functions</a></td></tr>
|
|
<tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
|
|
<dl class="section user"><dt></dt><dd>The CMSIS DSP library includes specialized algorithms for computing the FFT of real data sequences. The FFT is defined over complex data but in many applications the input is real. Real FFT algorithms take advantage of the symmetry properties of the FFT and have a speed advantage over complex algorithms of the same length. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd>The Fast RFFT algorithm relays on the mixed radix CFFT that save processor usage. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd>The real length N forward FFT of a sequence is computed using the steps shown below. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd><div class="image">
|
|
<img src="RFFT.gif" alt=""/>
|
|
<div class="caption">
|
|
Real Fast Fourier Transform</div></div>
|
|
</dd></dl>
|
|
<dl class="section user"><dt></dt><dd>The real sequence is initially treated as if it were complex to perform a CFFT. Later, a processing stage reshapes the data to obtain half of the frequency spectrum in complex format.</dd></dl>
|
|
<dl class="section user"><dt></dt><dd>The input for the inverse RFFT should keep the same format as the output of the forward RFFT. A first processing stage pre-process the data to later perform an inverse CFFT. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd><div class="image">
|
|
<img src="RIFFT.gif" alt=""/>
|
|
<div class="caption">
|
|
Real Inverse Fast Fourier Transform</div></div>
|
|
</dd></dl>
|
|
<dl class="section user"><dt></dt><dd>The algorithms for floating-point, Q15, and Q31 data are slightly different and we describe each algorithm in turn. </dd></dl>
|
|
<dl class="section user"><dt>Floating-point</dt><dd>The main functions are <a class="el" href="group__RealFFTF32.html#ga5d2ec62f3e35575eba467d09ddcd98b5">arm_rfft_fast_f32()</a> and <a class="el" href="group__RealFFTF32.html#gac5fceb172551e7c11eb4d0e17ef15aa3">arm_rfft_fast_init_f32()</a>. The older functions <a class="el" href="group__DeprecatedRealFFT.html#ga3df1766d230532bc068fc4ed69d0fcdc">arm_rfft_f32()</a> and <a class="el" href="group__DeprecatedRealFFT.html#ga10717ee326bf50832ef1c25b85a23068">arm_rfft_init_f32()</a> have been deprecated but are still documented. For f16, the functions are <a class="el" href="group__RealFFTF16.html#gaf018157c88626e83de3d9143f5273d18">arm_rfft_fast_f16()</a> and <a class="el" href="group__RealFFTF16.html#gacc1c721dd5a690a4c90cfb0264058659">arm_rfft_fast_init_f16()</a>. For f64, the functions are <a class="el" href="group__RealFFTF64.html#gae3b00f039305039732f7364171da89fb">arm_rfft_fast_f64()</a> and <a class="el" href="group__RealFFTF64.html#ga51ca806ce1aa56a231684add8d2820bb">arm_rfft_fast_init_f64()</a>. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd>The FFT of a real N-point sequence has even symmetry in the frequency domain. The second half of the data equals the conjugate of the first half flipped in frequency. This conjugate part is not computed by the float RFFT. As consequence, the output of a N point real FFT should be a N//2 + 1 complex numbers so N + 2 floats. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd>It happens that the first complex of number of the RFFT output is actually all real. Its real part represents the DC offset. The value at Nyquist frequency is also real.</dd></dl>
|
|
<dl class="section user"><dt></dt><dd>Those two complex numbers can be encoded with 2 floats rather than using two numbers with an imaginary part set to zero. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd>The implementation is using a trick so that the output buffer can be N float : the last real is packaged in the imaginary part of the first complex (since this imaginary part is not used and is zero).</dd></dl>
|
|
<dl class="section user"><dt></dt><dd>The real FFT functions pack the frequency domain data in this fashion. The forward transform outputs the data in this form and the inverse transform expects input data in this form. The function always performs the needed bitreversal so that the input and output data is always in normal order. The functions support lengths of [32, 64, 128, ..., 4096] samples. </dd></dl>
|
|
<dl class="section user"><dt>Q15 and Q31</dt><dd>The real algorithms are defined in a similar manner and utilize N/2 complex transforms behind the scenes.</dd></dl>
|
|
<dl class="section user"><dt></dt><dd>But warning, contrary to the float version, the fixed point implementation RFFT is also computing the conjugate part (except for MVE version) so the output buffer must be bigger. Also the fixed point RFFTs are not using any trick to pack the DC and Nyquist frequency in the same complex number. The RIFFT is not using the conjugate part but it is still using the Nyquist frequency value. The details are given in the documentation for the functions. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd>The complex transforms used internally include scaling to prevent fixed-point overflows. The overall scaling equals 1/(fftLen/2). Due to the use of complex transform internally, the source buffer is modified by the rfft. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd>A separate instance structure must be defined for each transform used but twiddle factor and bit reversal tables can be reused. </dd></dl>
|
|
<dl class="section user"><dt></dt><dd>There is also an associated initialization function for each data type. The initialization function performs the following operations:<ul>
|
|
<li>Sets the values of the internal structure fields.</li>
|
|
<li>Initializes twiddle factor table and bit reversal table pointers.</li>
|
|
<li>Initializes the internal complex FFT data structure. </li>
|
|
</ul>
|
|
</dd></dl>
|
|
<dl class="section user"><dt></dt><dd>Use of the initialization function is optional <b>except for MVE versions where it is mandatory</b>. If you don't use the initialization functions, then the structures should be initialized with code similar to the one below: <pre>
|
|
<a class="el" href="structarm__rfft__instance__q31.html" title="Instance structure for the Q31 RFFT/RIFFT function.">arm_rfft_instance_q31</a> S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};
|
|
<a class="el" href="structarm__rfft__instance__q15.html" title="Instance structure for the Q15 RFFT/RIFFT function.">arm_rfft_instance_q15</a> S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};
|
|
</pre> where <code>fftLenReal</code> is the length of the real transform; <code>fftLenBy2</code> length of the internal complex transform (fftLenReal/2). <code>ifftFlagR</code> Selects forward (=0) or inverse (=1) transform. <code>bitReverseFlagR</code> Selects bit reversed output (=0) or normal order output (=1). <code>twidCoefRModifier</code> stride modifier for the twiddle factor table. The value is based on the FFT length; <code>pTwiddleAReal</code>points to the A array of twiddle coefficients; <code>pTwiddleBReal</code>points to the B array of twiddle coefficients; <code>pCfft</code> points to the CFFT Instance structure. The CFFT structure must also be initialized. <br />
|
|
</dd></dl>
|
|
<dl class="section user"><dt></dt><dd>Note that with MVE versions you can't initialize instance structures directly and <b>must use the initialization function</b>. </dd></dl>
|
|
</div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="footer">
|
|
<script type="text/javascript">
|
|
<!--
|
|
writeFooter.call(this);
|
|
//-->
|
|
</script>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|