完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我正在使用PIC32处理音频处理应用程序。为了保持足够快的速度来实时处理音频,我使用整数数学。我已经通过使用乘法和位移位运算来近似分数整数,如SO:这基本上使得整数作为分数*(n/32768)的值而起作用,例如,如果它们由1个符号位和15个小数位组成。这是很好的,因为我有一个读写16位整数的编***音频均衡器过滤库帮助手册的1.7.2节中的Q15和Q31数据类型的章节时,它表示Q15由1个符号位和15个小数位组成,值符号*(n/32768)和THA。t乘两个Q15数,一个如下:在我看来,这两种方法的作用完全相同。两者以相同的方式表示值(以它们的比特表示的方式),并且乘法是使用相同的方法来完成的。它们的功能不同,我看不到。然后看来,使用Q15格式除了提供与DSP库函数一起工作之外,没有任何优势,因为类型不起作用,只是语法问题。我有什么遗漏了吗?
以上来自于百度翻译 以下为原文 Hi, I am working on an audio processing application using PIC32. In order to keep things fast enough to process audio in real time I am using integer math. I was already approximating fractional integers by using multiply and bitshift operations like so: int16_t a, b, c;int32_t temp32;temp32 = (a * b);c = temp32 >> 15;which essentially causes the integers to function as fractional types with a value of sign * (N/32768), e.g. as if they consisted of 1 sign bit and 15 fractional bits. This works well since I have a codec which reads and writes 16 bit integers. When reading the section on the Q15 and Q31 data types in section 1.7.2 of the Audio Equalizer Filtering Library Help manual, it says Q15 consists of 1 sign bit and 15 fractional bits, with a value sign * (N/32768), and that to multiply two Q15 numbers one does the following: libq_q15_t A16, B16, C16;libq_q31_t Temp32;Temp32 = A16 * B16;C16 = Temp32>>(16-1);It seems to me that these two methods function in exactly the same way. Both represent values in the same manner (in terms of what their bits represent), and multiplication is accomplished using the same method. They literally do not function differently in any way that I can see. It then seems that using the Q15 format provides no advantage other than being built to work with the DSP library functions, which, given that the types do not function differently, is only a matter of syntax. Is there something I am missing? |
|
相关推荐
6个回答
|
|
很酷,谢谢你确认我的结论。我现在知道,Q15只是一个不同的“看”一个整数的方法,正如我所怀疑的,而且,如果我需要更多的证据,我在手册中进一步挖掘之后发现了这条有趣的线:
以上来自于百度翻译 以下为原文 Cool, thanks for confirming my conclusions. I now understand that Q15 is just a different way of "looking at" an integer, as I had suspected. Also, if I needed any more proof, I found this hilarious line after some further digging in the manual: typedef int16_t libq_q0d15_t; |
|
|
|
是否为Q格式DSP命令自动移位?显然不是针对核心逻辑命令。我还没有看过PIC32,但在其他芯片中,如果选择了Q格式和DSP乘法、除法和MAC,则使用的汇编代码略有不同。
以上来自于百度翻译 以下为原文 Are the bitshifts automatic for Q format DSP commands? Obviously not for core logic commands. I have not looked at PIC32 yet, but am realling in other chips there is a slightly different assembly code used if Q formats are selected and DSP multiply, divide, and MAC are used? |
|
|
|
是的,轮班是自动的。也有舍入和饱和的选择,以及在1条指令中称为2个Q15乘法(称为“打包”)的能力。
以上来自于百度翻译 以下为原文 Yes, the shifts are automatic. There is also the option of rounding and saturation, as well as the capability of doing e.g. 2 Q15 multiplies in 1 instruction (referred to as 'packed') |
|
|
|
如何为这些自动转换写指令?你能分享一些关于这个主题的文献吗?我提到的Q15指南并没有谈到这一点。也许是因为这些指令只是汇编程序而已?这是在MX和MZ上还是MZ上可用的东西?
以上来自于百度翻译 以下为原文 How does one go about writing instructions for these automatic shifts? Can you please share some documentation on the subject? The Q15 guide I mentioned does not talk about this. Perhaps it is because these instructions are assembler only? Is this something that is available on both MX and MZ or just MZ? |
|
|
|
Buffin函数是可用的,在XC32编译器指南中查看。MIPS DSP命令被记录在MDE90034-2B-MIPS32 DSP-AFP03.01.PDF中,可从想象技术网站(现在)获得。DSP功能可在MZ和MK上使用,不幸的不是MX或MM。
以上来自于百度翻译 以下为原文 builtin functions are available, look in the XC32 compiler guide. The MIPS DSP commands are documented in MD00374-2B-MIPS32DSP-AFP-03.01.PDF, available from the Imagination Tech web site(for now). The DSP functions are available on MZ and MK, unfortunately not MX or MM. |
|
|
|
0.1*(2 ^ 15)=327。8查找不可分割的数字,你会看到用128位的芯片。仍然是一种近似。如果有更好的方法,耐心。Q1.5是查找表的理想选择,用于电机控制的正弦和COS。可以用于线绘制。狗咬我,B.I.我,咬我。(LH)
以上来自于百度翻译 以下为原文 0.1 * (2^15) = 3,276.8 Look out for numbers that don't divide, you will see chips using 128 bits. Still an approximation. If there is a better way, patient it. Q1.5 is ideal for lookup tables to pre-calculate sin and cos for motor control. Can be used for line drawing. A Dog bit me, b.i. it me, bit me. (LH) |
|
|
|
只有小组成员才能发言,加入小组>>
5248 浏览 9 评论
2036 浏览 8 评论
1956 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3217 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2264 浏览 5 评论
782浏览 1评论
676浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
602浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
684浏览 0评论
581浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-26 12:48 , Processed in 1.373339 second(s), Total 57, Slave 51 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号