Electoday 2025

ไมโครคอนโทรลเลอร์ => ARM Processors => Topic started by: tha on July 18, 2021, 07:30:46 AM

Title: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 18, 2021, 07:30:46 AM
file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/group__groupCmplxMath.html

(https://i.imgur.com/5u9hIGZ.png)

Description

เซ็ตของ functions นี้ทำงานบน complex data vectors. The data ใน the complex arrays ถูกเก็บใน an interleaved fashion (real, imag, real, imag, ...). ใน the API functions, the number ของ samples ใน a complex array อ้างอิงถึงจำนวนของ complex values; the array บรรจุเป็นสองเท่าจำนวนของ real values นี้.

ปล. ยังจำกันได้อยู่ไหม complex number 1+j2 ที่มีค่าจริงกับค่าจินตนาการ ลองไปทบทวนกันดูนะครับ
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 18, 2021, 07:47:34 AM
file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/group__cmplx__conj.html

(https://i.imgur.com/yGpsZwQ.png)

Description

ผัน the elements of a complex data vector.

The pSrc ชี้ไปยัง the source data และ pDst ชี้ไปยังที่ๆผลลัพธ์ควรถูกเขียน. numSamples ระบุจำนวนของ complex samples และ the data ในแต่ละ array ถูกเก็บใน an interleaved fashion (real, imag, real, imag, ...). แต่ละ array มีทั้งหมด 2*numSamples values. The underlying algorithm ถูกใช้:

for(n=0; n<numSamples; n++) {
    pDst[(2*n)+0)] = pSrc[(2*n)+0];     // real part
    pDst[(2*n)+1)] = -pSrc[(2*n)+1];    // imag part
}

มีฟังชั่นที่แยกกันสำหรับ floating-point, Q15 and Q31 data types.
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 18, 2021, 07:51:08 AM
(https://i.imgur.com/XSQXJRr.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 18, 2021, 07:55:01 AM
(https://i.imgur.com/npLbJ99.png)

Scaling and Overflow Behavior:

The function ใช้ saturating arithmetic. The Q15 ค่า -1 (0x8000) จะถูกทำให้อิ่มตัวไปยัง the maximum allowable positive value 0x7FFF.

References __QASX(), __QSAX(), and __SIMD32.
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 18, 2021, 07:58:49 AM
(https://i.imgur.com/OGE1K5Q.png)

Scaling and Overflow Behavior:

The function ใช้ saturating arithmetic. The Q31 ค่า -1 (0x80000000) จะถูกทำให้อิ่มตัวไปยัง the maximum allowable positive value 0x7FFFFFFF.

References __QSUB().
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 18, 2021, 10:24:46 AM
file:///D:/System%20Workbench/STM32CubeF1-master/Drivers/CMSIS/docs/DSP/html/group__cmplx__dot__prod.html

(https://i.imgur.com/DsKRDpe.png)

Description

คำนวณ the dot product ของ two complex vectors. The vectors ถูกคูณ element-by-element และจากนั้นรวม.

The pSrcA ชี้ไปยัง the first complex input vector และ pSrcB ชี้ไปยัง the second complex input vector. numSamples ระบุจำนวนของ complex samples และ the data ในแต่ละ array ถูกเก็บใน an interleaved fashion (real, imag, real, imag, ...). แต่ละ array มีทั้งหมด 2*numSamples values

The underlying algorithm ถูกใช้:

realResult=0;
imagResult=0;
for(n=0; n<numSamples; n++) {
    realResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+0] - pSrcA[(2*n)+1]*pSrcB[(2*n)+1];
    imagResult += pSrcA[(2*n)+0]*pSrcB[(2*n)+1] + pSrcA[(2*n)+1]*pSrcB[(2*n)+0];
}
มีฟังชั่นที่แยกกันสำหรับ floating-point, Q15 and Q31 data types.
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 18, 2021, 10:26:27 AM
(https://i.imgur.com/5NFvMlQ.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 18, 2021, 10:34:26 AM
(https://i.imgur.com/XJklcWw.png)

Scaling and Overflow Behavior:

The function ถูกจัดให้มีใช้โดยใช้ an internal 64-bit accumulator. The intermediate 1.15 by 1.15 multiplications ถูกดำเนินการด้วย full precision และให้ผล a 2.30 result. เหล่านี้ถูก accumulated ใน a 64-bit accumulator ด้วย 34.30 precision. ในขั้นตอนสุดท้าย, the accumulators ถูกแปลงไปเป็น 8.24 format. The return results realResult และ imagResult อยู่ใน 8.24 format.
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 18, 2021, 10:43:56 AM
(https://i.imgur.com/WLzy9KM.png)

Scaling and Overflow Behavior:

The function ถูกจัดให้มีใช้โดยใช้ an internal 64-bit accumulator. The intermediate 1.31 by 1.31 multiplications ถูกดำเนินการด้วย 64-bit precision และจากนั้นถูกเลื่อนไปเป็น 16.48 format. The internal real และ imaginary accumulators อยู่ใน 16.48 format และจัดให้มี 15 guard bits. การบวกเป็นแบบ nonsaturating และไม่มี overflow จะเกิดขึ้นตราบเท่าที่ numSamples น้อยกว่า 32768. The return results realResult และ imagResult อยู่ใน 16.48 format. Input down scaling ไม่ถูกต้องการ.
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 07:02:46 AM
(https://i.imgur.com/Er7TmgZ.png)

Description

คำนวณหาขนาดของ the elements of a complex data vector.

The pSrc ชี้ไปยัง the source data และ pDst ชี้ไปยังที่ๆผลลัพธ์ควรถูกเขียน. numSamples ระบุจำนวนของ complex samples ใน the input array และ the data ถูกเก็บใน an interleaved fashion (real, imag, real, imag, ...). The input array มีทั้งหมด 2*numSamples values; the output array มีทั้งหมด numSamples values The underlying algorithm ถูกใช้:

for(n=0; n<numSamples; n++) {
    pDst[n] = sqrt(pSrc[(2*n)+0]^2 + pSrc[(2*n)+1]^2);
}

มีฟังชั่นที่แยกกันสำหรับ floating-point, Q15 and Q31 data types.
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 07:07:38 AM
(https://i.imgur.com/0cb8VWq.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 07:09:35 AM
(https://i.imgur.com/4B6EzBM.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 07:11:15 AM
(https://i.imgur.com/x3wITMy.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 08:16:48 AM
(https://i.imgur.com/R5nhhNK.png)

Description

คำนวณหาขนาดยกกำลังของ the elements of a complex data vector.

The pSrc ชี้ไปยัง the source data และ pDst ชี้ไปยังที่ๆผลลัพธ์ควรถูกเขียน. numSamples ระบุจำนวนของ complex samples ใน the input array และ the data ถูกเก็บใน an interleaved fashion (real, imag, real, imag, ...). The input array มีทั้งหมด 2*numSamples values; the output array มีทั้งหมด numSamples values The underlying algorithm ถูกใช้:

for(n=0; n<numSamples; n++) {
    pDst[n] = pSrc[(2*n)+0]^2 + pSrc[(2*n)+1]^2;
}

มีฟังชั่นที่แยกกันสำหรับ floating-point, Q15 and Q31 data types.
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 08:18:51 AM
(https://i.imgur.com/B1Qe2Bl.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 08:20:43 AM
(https://i.imgur.com/KXW9rYP.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 08:22:53 AM
(https://i.imgur.com/VnPrsRe.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 09:28:05 AM
(https://i.imgur.com/PGD0FUa.png)

Description

คูณ a complex vector ด้วย complex vector อื่นและสร้าง a complex result. The data ใน the complex arrays ถูกเก็บใน an interleaved fashion (real, imag, real, imag, ...). The parameter numSamples แสดงจำนวนของ complex samples ที่ดำเนินการ. The complex arrays มีทั้งหมด 2*numSamples real values.

The underlying algorithm ถูกใช้:

for(n=0; n<numSamples; n++) {
    pDst[(2*n)+0] = pSrcA[(2*n)+0] * pSrcB[(2*n)+0] - pSrcA[(2*n)+1] * pSrcB[(2*n)+1];
    pDst[(2*n)+1] = pSrcA[(2*n)+0] * pSrcB[(2*n)+1] + pSrcA[(2*n)+1] * pSrcB[(2*n)+0];
}

มีฟังชั่นที่แยกกันสำหรับ floating-point, Q15 and Q31 data types.
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 09:30:55 AM
(https://i.imgur.com/m64mfBh.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 09:32:55 AM
(https://i.imgur.com/a2ZkA8D.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 09:35:10 AM
(https://i.imgur.com/GM790MW.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 10:39:57 AM
(https://i.imgur.com/3lt9te6.png)

Description

คูณ a complex vector ด้วย a real vector และสร้าง a complex result. The data ใน the complex arrays ถูกเก็บใน an interleaved fashion (real, imag, real, imag, ...). The parameter numSamples แสดงจำนวนของ complex samples ที่ดำเนินการd. The complex arrays มีทั้งหมด 2*numSamples real values ในขณะที่ the real array มีทั้งหมด numSamples real values..

The underlying algorithm ถูกใช้:

for(n=0; n<numSamples; n++) {
    pCmplxDst[(2*n)+0] = pSrcCmplx[(2*n)+0] * pSrcReal[n];
    pCmplxDst[(2*n)+1] = pSrcCmplx[(2*n)+1] * pSrcReal[n];
}

มีฟังชั่นที่แยกกันสำหรับ floating-point, Q15 and Q31 data types.
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 10:42:36 AM
(https://i.imgur.com/SSl4hTX.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 10:44:36 AM
(https://i.imgur.com/GlCJFne.png)
Title: Re: STM32F1 CMSIS DSP Complex Math Functions
Post by: tha on July 19, 2021, 10:46:13 AM
(https://i.imgur.com/S2qzMvw.png)