STM32F1 CMSIS DSP

Started by tha, July 04, 2021, 07:28:44 AM

Previous topic - Next topic

tha

Q15 and Q31

The real algorithms ถูกกำหนดในลักษณะที่คล้ายกันและใช้ N/2 complex transforms เบื้องหลัง the scenes.

The complex transforms ใช้รวมภายในการปรับขนาดเพื่อป้องกัน fixed-point overflows. The overall scaling เท่ากับ 1/(fftLen/2).

A separate instance structure ต้องถูกกำหนดสำหรับแต่ละ transform ที่ใช้แต่ twiddle factor และ bit reversal tables สามารถถูกใช้ใหม่.

นอกจากนี้ยังมี an associated initialization function สำหรับแต่ละ data type. The initialization function ดำเนินการทำงานต่อไปนี้ :

•   เซ็ตค่าของ the internal structure fields.
•    เริ่มต้น twiddle factor table and bit reversal table pointers.
•    เริ่มต้น the internal complex FFT data structure.

การใช้ the initialization function เป็นตัวเลือก. อย่างไรก็ตาม, ถ้า the initialization function ถูกใช้, ดังนั้น the instance structure ไม่สามารถถูกวางลงใน a const data section. เพื่อวาง an instance structure ลงใน a const data section, the instance structure ควรถูกเริ่มต้นอย่าง manual ดังต่อไปนี้ :

arm_rfft_instance_q31 S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};
arm_rfft_instance_q15 S = {fftLenReal, fftLenBy2, ifftFlagR, bitReverseFlagR, twidCoefRModifier, pTwiddleAReal, pTwiddleBReal, pCfft};

โดยที่ fftLenReal คือความยาวของ the real transform; fftLenBy2 ความยาวของ the internal complex transform. ifftFlagR เลือก forward (=0) or inverse (=1) transform. bitReverseFlagR เลือก bit reversed output (=0) หรือ normal order output (=1). twidCoefRModifier ก้าวย่าง modifier สำหรับ the twiddle factor table. ค่าจะขึ้นอยู่กับ the FFT length; pTwiddleAReal ชี้ไปยัง the A array of twiddle coefficients; pTwiddleBReal ชี้ไปยัง the B array of twiddle coefficients; pCfft ชี้ไปยัง the CFFT Instance structure. The CFFT structure ต้องถูกเริ่มต้นด้วย. อ้างอิงถึง arm_cfft_radix4_f32() สำหรับรายละเอียดเกี่ยวกับ static initialization of the complex FFT instance structure.

end of RealFFT_Table group

tha



เลิกใช้:
อย่าใช้ฟังก์ชันนี้ มันถูกแทนที่โดย arm_rfft_fast_f32 และจะถูกลบออกในอนาคต

Parameters
[in]     *S   ชี้ไปยัง an instance ของ the floating-point RFFT/RIFFT structure.
[in]     *pSrc   ชี้ไปยัง the input buffer.
[out]     *pDst   ชี้ไปยัง the output buffer.

Returns
       none


tha



Parameters
[in]   *S   ชี้ไปยัง an arm_rfft_fast_instance_f32 structure.
[in]   *p   ชี้ไปยัง the input buffer.
[in]   *pOut   ชี้ไปยัง the output buffer.
[in]   ifftFlag   RFFT ถ้า flag เป็น 0, RIFFT ถ้า flag เป็น 1

Returns
none.



tha



Parameters
[in,out]   *S   ชี้ไปยัง an arm_rfft_fast_instance_f32 structure.
[in]   fftLen   ความยาวของ the Real Sequence.

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter fftLen ระบุความยาวของ RFFT/CIFFT process. Supported FFT Lengths คือ 32, 64, 128, 256, 512, 1024, 2048, 4096.

Function นี้ยังเริ่มต้น Twiddle factor table pointer and Bit reversal table pointer อีกด้วย.


tha


tha



Parameters
[in,out]   *S   ชี้ไปยัง an instance of the Q15 RFFT/RIFFT structure.
[in]   fftLenReal     ความยาวของ the FFT.
[in]   ifftFlagR   flag ที่เลือก forward (ifftFlagR=0) หรือ inverse (ifftFlagR=1) transform.
[in]   bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0) bit reversal
                                        of output.

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter fftLenReal ระบุความยาวของ RFFT/RIFFT Process. Supported FFT Lengths คือ 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192.

The parameter ifftFlagR ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlagR เพื่อคำนวณ RIFFT, มิฉะนั้น RFFT ถูกคำนวณ.

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

Function นี้ยังเริ่มต้น Twiddle factor table อีกด้วย.


tha



Parameters
[in,out]   *S   ชี้ไปยัง an instance of the Q31 RFFT/RIFFT structure.
[in]   fftLenReal     ความยาวของ the FFT.
[in]   ifftFlagR   flag ที่เลือก forward (ifftFlagR=0) หรือ inverse (ifftFlagR=1) transform.
[in]   bitReverseFlag   flag ที่เปิดการใช้งาน (bitReverseFlag=1) หรือปิดการใช้งาน (bitReverseFlag=0) bit reversal
                                        of output.

Returns
The function คืนค่า ARM_MATH_SUCCESS ถ้าการเริ่มต้นทำสำเร็จหรือ ARM_MATH_ARGUMENT_ERROR ถ้า fftLen ไม่ใช่ค่าที่รองรับ.

Description:

The parameter fftLenReal ระบุความยาวของ RFFT/RIFFT Process. Supported FFT Lengths คือ 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192.

The parameter ifftFlagR ควบคุมว่า a forward หรือ inverse transform ถูกคำนวณ. Set(=1) ifftFlagR เพื่อคำนวณ RIFFT, มิฉะนั้น RFFT ถูกคำนวณ.

The parameter bitReverseFlag ควบคุมว่า output อยู่ใน normal order หรือ bit reversed order. Set(=1) bitReverseFlag สำหรับ output ถูกอยู่ใน normal order มิฉะนั้น output อยู่ใน bit reversed order.

Function นี้ยังเริ่มต้น Twiddle factor table อีกด้วย.


tha



Parameters
[in]   *S   ชี้ไปยัง an instance of the Q15 RFFT/RIFFT structure.
[in]   *pSrc   ชี้ไปยัง the input buffer.
[out]   *pDst   ชี้ไปยัง the output buffer.

Returns
        none.

Input an output formats:

อินพุตภายในจะถูกลดขนาดลง 2 สำหรับทุก stage เพื่อหลีกเลี่ยง saturations ภายใน CFFT/CIFFT process. ดังนั้น the output format จะแตกต่างกันสำหรับ different RFFT sizes. The input and output formats สำหรับ different RFFT sizes และจำนวนของบิตที่จะเพิ่มสเกลถูกกล่าวถึงในตารางข้างล่างสำหรับ RFFT and RIFFT: