add: ➕ 添加说明文件
This commit is contained in:
parent
ee7dbcbafd
commit
47363f3368
36
README.md
Normal file
36
README.md
Normal file
@ -0,0 +1,36 @@
|
||||
# 增益系数计算
|
||||
|
||||
> 该项目用来简单验证定点增益计算的算法的
|
||||
|
||||
## 原理
|
||||
|
||||
原本是:`sample(origin) * gain_factor(float) = sample(after_gain)`
|
||||
|
||||
|
||||
转换定点`sample(origin) * (gain_factor << Q) (int32) = sample(after_gain) >> Q`
|
||||
|
||||
## 使用方法
|
||||
|
||||
把计算出来的增益系数直接拿来使用就行
|
||||
|
||||
```C
|
||||
//===============calc positive===========================
|
||||
int32_t positive_gain_scale_array[31] = {
|
||||
1073741824, 1204758144, 1351760896, 1516700672, 1701766144, 1909412992, 2142396544, 1201904256, 1348558720, 1513107840, 1697734912, 1904889856, 2137321600, 1199057152, 1345364224, 1509523456, 1693713280, 1900377472, 2132258560, 1196216704, 1342177280, 1505947648, 1689701120, 1895875840, 2127207680, 1193383168, 1338997888, 1502380288, 1685698432, 1891384832, 2122168576,
|
||||
};
|
||||
uint8_t positive_q_array[31] = {
|
||||
30, 30, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 26,
|
||||
};
|
||||
|
||||
//===============calc negative===========================
|
||||
int32_t negetive_gain_scale_array[31] = {
|
||||
1073741824, 956973376, 852903424, 760150976, 677485312, 603809408, 538145664, 479622848, 427464320, 380977984, 339546976, 302621568, 269711744, 240380848, 214239664, 190941296, 170176608, 151670064, 135176080, 120475816, 107374184, 95697344, 85290344, 76015096, 67748528, 60380940, 53814568, 47962284, 42746432, 38097796, 33954700,
|
||||
};
|
||||
uint8_t negetive_q_array[31] = {
|
||||
30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
|
||||
};
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
EOF
|
||||
Loading…
Reference in New Issue
Block a user