viphotman 发表于 2019-11-20 16:16

ARM DSP 库的FFT算法点数增加到8192的疑问?

<p>&nbsp;</p>

<p>&nbsp;&nbsp; 最近要用到ARM M4的芯片做一个FFT算法,对音频信号做分析;但是ARM 的DSP库最大只有4096个点的FFT算法;</p>

<p>&nbsp;&nbsp; 若要做8192的FFT,要生成一个旋转因子表与位反转表,但是位反转表不知道怎么生成?希望有网友帮忙解释一下;</p>

<p>方案一:打算看能不能自己修改出一个8192点的FFT;</p>

<p>调用函数:</p>

<pre>
<code class="language-cpp">void arm_cfft_f32(
    const arm_cfft_instance_f32 * S,
    float32_t * p1,
    uint8_t ifftFlag,
    uint8_t bitReverseFlag)</code></pre>

<p>Parameters 参数解释<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<strong>S</strong>&nbsp;&nbsp; &nbsp;points to an instance of the floating-point CFFT structure<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; <strong>&nbsp;p1</strong>&nbsp;&nbsp; &nbsp;points to the complex data buffer of size 2*fftLen. Processing occurs in-place<br />
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<strong>ifftFlag&nbsp;&nbsp; &nbsp;</strong>flag that selects transform direction</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value = 0: forward transform<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value = 1: inverse transform</p>

<p>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<strong>bitReverseFlag&nbsp;&nbsp; &nbsp;</strong>flag that enables / disables bit reversal of output</p>

<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value = 0: disables bit reversal of output<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value = 1: enables bit reversal of output</p>

<p>&nbsp;</p>

<p>这其中S里包含旋转因子表与位反转表;</p>

<p>如16点的:</p>

<p>const arm_cfft_instance_f32 arm_cfft_sR_f32_len16 = {<br />
&nbsp;&nbsp; &nbsp;16, twiddleCoef_16, armBitRevIndexTable16, ARMBITREVINDEXTABLE__16_TABLE_LENGTH<br />
};</p>

<p>旋转因子生成有函数,所以8192的也能生成;</p>

<p>/**&nbsp;&nbsp; &nbsp;<br />
* \par&nbsp;&nbsp; &nbsp;<br />
* Example code for Floating-point Twiddle factors Generation:&nbsp;&nbsp; &nbsp;<br />
* \par&nbsp;&nbsp; &nbsp;<br />
* &lt;pre&gt;for(i = 0; i&lt; N/; i++)&nbsp;&nbsp; &nbsp;<br />
* {&nbsp;&nbsp; &nbsp;<br />
*&nbsp;&nbsp; &nbsp;twiddleCoef= cos(i * 2*PI/(float)N);&nbsp;&nbsp; &nbsp;<br />
*&nbsp;&nbsp; &nbsp;twiddleCoef= sin(i * 2*PI/(float)N);&nbsp;&nbsp; &nbsp;<br />
* } &lt;/pre&gt;&nbsp;&nbsp; &nbsp;<br />
* \par&nbsp;&nbsp; &nbsp;<br />
* where N = 16&nbsp;&nbsp; &nbsp;and PI = 3.14159265358979&nbsp;&nbsp; &nbsp;<br />
* \par&nbsp;&nbsp; &nbsp;<br />
* Cos and Sin values are in interleaved fashion&nbsp;&nbsp; &nbsp;<br />
*&nbsp;&nbsp;&nbsp; &nbsp;<br />
*/<br />
const float32_t twiddleCoef_16 = {<br />
&nbsp;&nbsp;&nbsp; 1.000000000f,&nbsp; 0.000000000f,<br />
&nbsp;&nbsp;&nbsp; 0.923879533f,&nbsp; 0.382683432f,<br />
&nbsp;&nbsp;&nbsp; 0.707106781f,&nbsp; 0.707106781f,<br />
&nbsp;&nbsp;&nbsp; 0.382683432f,&nbsp; 0.923879533f,<br />
&nbsp;&nbsp;&nbsp; 0.000000000f,&nbsp; 1.000000000f,<br />
&nbsp;&nbsp; -0.382683432f,&nbsp; 0.923879533f,<br />
&nbsp;&nbsp; -0.707106781f,&nbsp; 0.707106781f,<br />
&nbsp;&nbsp; -0.923879533f,&nbsp; 0.382683432f,<br />
&nbsp;&nbsp; -1.000000000f,&nbsp; 0.000000000f,<br />
&nbsp;&nbsp; -0.923879533f, -0.382683432f,<br />
&nbsp;&nbsp; -0.707106781f, -0.707106781f,<br />
&nbsp;&nbsp; -0.382683432f, -0.923879533f,<br />
&nbsp;&nbsp; -0.000000000f, -1.000000000f,<br />
&nbsp;&nbsp;&nbsp; 0.382683432f, -0.923879533f,<br />
&nbsp;&nbsp;&nbsp; 0.707106781f, -0.707106781f,<br />
&nbsp;&nbsp;&nbsp; 0.923879533f, -0.382683432f<br />
};</p>

<p>反转表,为个表没看懂是怎么生成的,希望有网友帮忙解释一下;</p>

<p>const uint16_t armBitRevIndexTable16 =<br />
{<br />
&nbsp;&nbsp; //8x2, size 20<br />
&nbsp;&nbsp; 8,64, 24,72, 16,64, 40,80, 32,64, 56,88, 48,72, 88,104, 72,96, 104,112<br />
};</p>

<p>&nbsp;</p>

Shellywho 发表于 2024-12-29 11:54

<p></p>


<p>您好,请问这个问题有解决吗,我最近也遇到了这个问题,分析20kHz以上频率的信号,需要更高的频率分辨率</p>

viphotman 发表于 2025-1-13 18:15

Shellywho 发表于 2024-12-29 11:54
您好,请问这个问题有解决吗,我最近也遇到了这个问题,分析20kHz以上频率的信号,需要更高的频率分辨 ...

<p>已经解决,用程序自己生成数据</p>
页: [1]
查看完整版本: ARM DSP 库的FFT算法点数增加到8192的疑问?