计算增益使用的Q偏移值
Go to file
impressionyang c6a3e0c1be update:💄 更新编码格式
update: 更新增益计算为函数
2024-08-01 16:29:41 +08:00
.clang-format update:💄 更新编码格式 2024-08-01 16:28:37 +08:00
.gitignore add: 首次添加仓库 2024-07-30 15:45:14 +08:00
main.c update:💄 更新编码格式 2024-08-01 16:29:41 +08:00
Makefile update: 增益计算OK 2024-07-31 21:55:05 +08:00
README.md add: 添加说明文件 2024-07-31 22:00:09 +08:00

增益系数计算

该项目用来简单验证定点增益计算的算法的

原理

原本是:sample(origin) * gain_factor(float) = sample(after_gain)

转换定点sample(origin) * (gain_factor << Q) (int32) = sample(after_gain) >> Q

使用方法

把计算出来的增益系数直接拿来使用就行

//===============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