資源簡介
從webrtc摳出來的代碼實現無需噪音樣本的降噪.具體使用請查看我的博客
代碼片段和文件信息
/*
?*??Copyright?(c)?2012?The?WebRTC?project?authors.?All?Rights?Reserved.
?*
?*??Use?of?this?source?code?is?governed?by?a?BSD-style?license
?*??that?can?be?found?in?the?LICENSE?file?in?the?root?of?the?source
?*??tree.?An?additional?intellectual?property?rights?grant?can?be?found
?*??in?the?file?PATENTS.??All?contributing?project?authors?may
?*??be?found?in?the?AUTHORS?file?in?the?root?of?the?source?tree.
?*/
/*?analog_agc.c
?*
?*?Using?a?feedback?system?determines?an?appropriate?analog?volume?level
?*?given?an?input?signal?and?current?volume?level.?Targets?a?conservative
?*?signal?level?and?is?intended?for?use?with?a?digital?AGC?to?apply
?*?additional?gain.
?*
?*/
#include?
#include?
#ifdef?AGC_DEBUG?//test?log
#include?
#endif
#include?“analog_agc.h“
/*?The?slope?of?in?Q13*/
static?const?int16_t?kSlope1[8]?=?{21793?12517?7189?4129?2372?1362?472?78};
/*?The?offset?in?Q14?*/
static?const?int16_t?kOffset1[8]?=?{25395?23911?22206?20737?19612?18805?17951
????????17367};
/*?The?slope?of?in?Q13*/
static?const?int16_t?kSlope2[8]?=?{2063?1731?1452?1218?1021?857?597?337};
/*?The?offset?in?Q14?*/
static?const?int16_t?kOffset2[8]?=?{18432?18379?18290?18177?18052?17920?17670
????????17286};
static?const?int16_t?kMuteGuardTimeMs?=?8000;
static?const?int16_t?kInitCheck?=?42;
/*?Default?settings?if?config?is?not?used?*/
#define?AGC_DEFAULT_TARGET_LEVEL?3
#define?AGC_DEFAULT_COMP_GAIN?9
/*?This?is?the?target?level?for?the?analog?part?in?ENV?scale.?To?convert?to?RMS?scale?you
?*?have?to?add?OFFSET_ENV_TO_RMS.
?*/
#define?ANALOG_TARGET_LEVEL?11
#define?ANALOG_TARGET_LEVEL_2?5?//?ANALOG_TARGET_LEVEL?/?2
/*?Offset?between?RMS?scale?(analog?part)?and?ENV?scale?(digital?part).?This?value?actually
?*?varies?with?the?FIXED_ANALOG_TARGET_LEVEL?hence?we?should?in?the?future?replace?it?with
?*?a?table.
?*/
#define?OFFSET_ENV_TO_RMS?9
/*?The?reference?input?level?at?which?the?digital?part?gives?an?output?of?targetLevelDbfs
?*?(desired?level)?if?we?have?no?compression?gain.?This?level?should?be?set?high?enough?not
?*?to?compress?the?peaks?due?to?the?dynamics.
?*/
#define?DIGITAL_REF_AT_0_COMP_GAIN?4
/*?Speed?of?reference?level?decrease.
?*/
#define?DIFF_REF_TO_ANALOG?5
#ifdef?MIC_LEVEL_FEEDBACK
#define?NUM_BLOCKS_IN_SAT_BEFORE_CHANGE_TARGET?7
#endif
/*?Size?of?analog?gain?table?*/
#define?GAIN_TBL_LEN?32
/*?Matlab?code:
?*?fprintf(1?‘\t%i?%i?%i?%i\n‘?round(10.^(linspace(01032)/20)?*?2^12));
?*/
/*?Q12?*/
static?const?uint16_t?kGainTableAnalog[GAIN_TBL_LEN]?=?{4096?4251?4412?4579?4752
????????4932?5118?5312?5513?5722?5938?6163?6396?6638?6889?7150?7420?7701?7992
????????8295?8609?8934?9273?9623?9987?10365?10758?11165?11587?12025?12480?12953};
/*?Gain/Suppression?tables?for?virtual?Mic?(in?Q10)?*/
static?const?uint16_t?kGainTableVirtualMic[128]?=?{1052?1081?1110?1141?1172?1204
????????1237?1271?1305?1341?1378?1416?1454?1494?1535?1577?1620?1664?1710?175
- 上一篇:白盒測試 實驗報告
- 下一篇:片上網絡NOC基本架構
評論
共有 條評論