IQtoQN

This Macro converts a 32-bit number in GLOBAL_Q format to 16-bit number in QN format.
Declaration C int _IQtoQN(_iq A)
C++ int IQtoQN(const iq &A)
Input IQ number in GLOBAL_Q format
Output Equivalent value of input in QN format (16-bit fixed point number)
Usage This macro may be used in cases where the input and output data is 16-bits, but the intermediate operations are operated using IQ data types.
Example:
Sum of product computation using the input sequence that is not in GLOBAL_Q format:
Y = X0*C0 + X1*C1 + X2*C2 // X0, X1, X2 in Q15 format
//C0,C1, C2 in GLOBAL_Q format
We can convert the Q15 values to IQ, perform the intermediate sums using IQ and then store the result back as Q15:
short X0, X1, X2; // Q15 short
iq C0, C1, C2; // GLOBAL_Q
short Y; // Q15
_iq sum // IQ (GLOBAL_Q)
sum = _IQmpy(_Q15toIQ(X0), C0);
sum += _IQmpy(_Q15toIQ(X1), C1);
sum += _IQmpy(_Q15toIQ(X2), C2);
Y = _IQtoQ15(sum);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值