Merge branch 'master' into patch-1

This commit is contained in:
Hailin Zhou 2025-01-11 23:20:02 +08:00 committed by GitHub
commit fa413b35e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
144 changed files with 7 additions and 33707 deletions

1
.gitignore vendored
View File

@ -145,7 +145,6 @@ Release/
/src/mod/applications/mod_nibblebill/Makefile /src/mod/applications/mod_nibblebill/Makefile
/src/mod/applications/mod_osp/Makefile /src/mod/applications/mod_osp/Makefile
/src/mod/applications/mod_osp/Makefile.in /src/mod/applications/mod_osp/Makefile.in
/src/mod/applications/mod_rss/Makefile
/src/mod/applications/mod_snipe_hunt/Makefile /src/mod/applications/mod_snipe_hunt/Makefile
/src/mod/applications/mod_test/test/Makefile /src/mod/applications/mod_test/test/Makefile
/src/mod/applications/mod_test/test/Makefile.in /src/mod/applications/mod_test/test/Makefile.in

View File

@ -79,7 +79,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa
conf\vanilla\autoload_configs\logfile.conf.xml = conf\vanilla\autoload_configs\logfile.conf.xml conf\vanilla\autoload_configs\logfile.conf.xml = conf\vanilla\autoload_configs\logfile.conf.xml
conf\vanilla\autoload_configs\modules.conf.xml = conf\vanilla\autoload_configs\modules.conf.xml conf\vanilla\autoload_configs\modules.conf.xml = conf\vanilla\autoload_configs\modules.conf.xml
conf\vanilla\autoload_configs\openmrcp.conf.xml = conf\vanilla\autoload_configs\openmrcp.conf.xml conf\vanilla\autoload_configs\openmrcp.conf.xml = conf\vanilla\autoload_configs\openmrcp.conf.xml
conf\vanilla\autoload_configs\rss.conf.xml = conf\vanilla\autoload_configs\rss.conf.xml
conf\vanilla\autoload_configs\sofia.conf.xml = conf\vanilla\autoload_configs\sofia.conf.xml conf\vanilla\autoload_configs\sofia.conf.xml = conf\vanilla\autoload_configs\sofia.conf.xml
conf\vanilla\autoload_configs\switch.conf.xml = conf\vanilla\autoload_configs\switch.conf.xml conf\vanilla\autoload_configs\switch.conf.xml = conf\vanilla\autoload_configs\switch.conf.xml
conf\vanilla\autoload_configs\syslog.conf.xml = conf\vanilla\autoload_configs\syslog.conf.xml conf\vanilla\autoload_configs\syslog.conf.xml = conf\vanilla\autoload_configs\syslog.conf.xml
@ -199,8 +198,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_rpc", "src\mod\xml_
{BED7539C-0099-4A14-AD5D-30828F15A171} = {BED7539C-0099-4A14-AD5D-30828F15A171} {BED7539C-0099-4A14-AD5D-30828F15A171} = {BED7539C-0099-4A14-AD5D-30828F15A171}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rss", "src\mod\applications\mod_rss\mod_rss.2017.vcxproj", "{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_conference", "src\mod\applications\mod_conference\mod_conference.2017.vcxproj", "{C24FB505-05D7-4319-8485-7540B44C8603}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_conference", "src\mod\applications\mod_conference\mod_conference.2017.vcxproj", "{C24FB505-05D7-4319-8485-7540B44C8603}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dptools", "src\mod\applications\mod_dptools\mod_dptools.2017.vcxproj", "{B5881A85-FE70-4F64-8607-2CAAE52669C6}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dptools", "src\mod\applications\mod_dptools\mod_dptools.2017.vcxproj", "{B5881A85-FE70-4F64-8607-2CAAE52669C6}"
@ -219,8 +216,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "libs\win32\pthre
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g723_1", "src\mod\codecs\mod_g723_1\mod_g723_1.2017.vcxproj", "{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g723_1", "src\mod\codecs\mod_g723_1\mod_g723_1.2017.vcxproj", "{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_iSAC", "src\mod\codecs\mod_isac\mod_iSAC.2017.vcxproj", "{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_native_file", "src\mod\formats\mod_native_file\mod_native_file.2017.vcxproj", "{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_native_file", "src\mod\formats\mod_native_file\mod_native_file.2017.vcxproj", "{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\libudns.2017.vcxproj", "{4043FC6A-9A30-4577-8AD5-9B233C9575D8}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\libudns.2017.vcxproj", "{4043FC6A-9A30-4577-8AD5-9B233C9575D8}"
@ -293,8 +288,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_shout", "src\mod\format
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libogg", "libs\win32\libogg\libogg.2017.vcxproj", "{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libogg", "libs\win32\libogg\libogg.2017.vcxproj", "{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_snom", "src\mod\applications\mod_snom\mod_snom.2017.vcxproj", "{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_zh", "src\mod\say\mod_say_zh\mod_say_zh.2017.vcxproj", "{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_zh", "src\mod\say\mod_say_zh\mod_say_zh.2017.vcxproj", "{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_managed", "src\mod\languages\mod_managed\mod_managed.2017.vcxproj", "{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_managed", "src\mod\languages\mod_managed\mod_managed.2017.vcxproj", "{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}"
@ -398,8 +391,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spy", "src\mod\applicat
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_httapi", "src\mod\applications\mod_httapi\mod_httapi.2017.vcxproj", "{4748FF56-CA85-4809-97D6-A94C0FAC1D77}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_httapi", "src\mod\applications\mod_httapi\mod_httapi.2017.vcxproj", "{4748FF56-CA85-4809-97D6-A94C0FAC1D77}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_abstraction", "src\mod\applications\mod_abstraction\mod_abstraction.2017.vcxproj", "{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sms", "src\mod\applications\mod_sms\mod_sms.2017.vcxproj", "{2469B306-B027-4FF2-8815-C9C1EA2CAE79}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sms", "src\mod\applications\mod_sms\mod_sms.2017.vcxproj", "{2469B306-B027-4FF2-8815-C9C1EA2CAE79}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "xmlrpc-c", "xmlrpc-c", "{9DE35039-A8F6-4FBF-B1B6-EB527F802411}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "xmlrpc-c", "xmlrpc-c", "{9DE35039-A8F6-4FBF-B1B6-EB527F802411}"
@ -722,17 +713,6 @@ Global
{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.Build.0 = Release|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.Build.0 = Release|Win32
{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.ActiveCfg = Release|x64
{CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.Build.0 = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.Build.0 = Release|x64
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|Win32.ActiveCfg = Release|x64
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.ActiveCfg = Release|x64
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.Build.0 = Release|x64
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.ActiveCfg = Debug|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.Build.0 = Debug|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.ActiveCfg = Debug|x64
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.Build.0 = Debug|x64
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.ActiveCfg = Release|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.Build.0 = Release|Win32
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.ActiveCfg = Release|x64
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.Build.0 = Release|x64
{C24FB505-05D7-4319-8485-7540B44C8603}.All|Win32.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.All|Win32.ActiveCfg = Release|x64
{C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.ActiveCfg = Release|x64
{C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.Build.0 = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.Build.0 = Release|x64
@ -832,17 +812,6 @@ Global
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.Build.0 = Release Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.Build.0 = Release Passthrough|Win32
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.ActiveCfg = Release Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.ActiveCfg = Release Passthrough|x64
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.Build.0 = Release Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.Build.0 = Release Passthrough|x64
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.All|Win32.ActiveCfg = Release|x64
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.All|x64.ActiveCfg = Release|x64
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.All|x64.Build.0 = Release|x64
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.Debug|Win32.ActiveCfg = Debug|Win32
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.Debug|Win32.Build.0 = Debug|Win32
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.Debug|x64.ActiveCfg = Debug|x64
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.Debug|x64.Build.0 = Debug|x64
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.Release|Win32.ActiveCfg = Release|Win32
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.Release|Win32.Build.0 = Release|Win32
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.Release|x64.ActiveCfg = Release|x64
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD}.Release|x64.Build.0 = Release|x64
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|Win32.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|Win32.ActiveCfg = Release|x64
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.ActiveCfg = Release|x64
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.Build.0 = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.Build.0 = Release|x64
@ -1231,17 +1200,6 @@ Global
{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.Build.0 = Release|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.Build.0 = Release|Win32
{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|x64
{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.Build.0 = Release|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.Build.0 = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|Win32.ActiveCfg = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.ActiveCfg = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.Build.0 = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.ActiveCfg = Debug|Win32
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.Build.0 = Debug|Win32
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.ActiveCfg = Debug|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.Build.0 = Debug|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.ActiveCfg = Release|Win32
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.Build.0 = Release|Win32
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.ActiveCfg = Release|x64
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.Build.0 = Release|x64
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|Win32.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|Win32.ActiveCfg = Release|x64
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.ActiveCfg = Release|x64
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.Build.0 = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.Build.0 = Release|x64
@ -1770,17 +1728,6 @@ Global
{4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|Win32.Build.0 = Release|Win32 {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|Win32.Build.0 = Release|Win32
{4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|x64.ActiveCfg = Release|x64 {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|x64.ActiveCfg = Release|x64
{4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|x64.Build.0 = Release|x64 {4748FF56-CA85-4809-97D6-A94C0FAC1D77}.Release|x64.Build.0 = Release|x64
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.All|Win32.ActiveCfg = Release|x64
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.All|x64.ActiveCfg = Release|x64
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.All|x64.Build.0 = Release|x64
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Debug|Win32.ActiveCfg = Debug|Win32
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Debug|Win32.Build.0 = Debug|Win32
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Debug|x64.ActiveCfg = Debug|x64
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Debug|x64.Build.0 = Debug|x64
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Release|Win32.ActiveCfg = Release|Win32
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Release|Win32.Build.0 = Release|Win32
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Release|x64.ActiveCfg = Release|x64
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}.Release|x64.Build.0 = Release|x64
{2469B306-B027-4FF2-8815-C9C1EA2CAE79}.All|Win32.ActiveCfg = Release|x64 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.All|Win32.ActiveCfg = Release|x64
{2469B306-B027-4FF2-8815-C9C1EA2CAE79}.All|x64.ActiveCfg = Release|x64 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.All|x64.ActiveCfg = Release|x64
{2469B306-B027-4FF2-8815-C9C1EA2CAE79}.All|x64.Build.0 = Release|x64 {2469B306-B027-4FF2-8815-C9C1EA2CAE79}.All|x64.Build.0 = Release|x64
@ -2506,7 +2453,6 @@ Global
{30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{1C453396-D912-4213-89FD-9B489162B7B5} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A} {1C453396-D912-4213-89FD-9B489162B7B5} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}
{CBEC7225-0C21-4DA8-978E-1F158F8AD950} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5} {CBEC7225-0C21-4DA8-978E-1F158F8AD950} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5}
{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{B5881A85-FE70-4F64-8607-2CAAE52669C6} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B5881A85-FE70-4F64-8607-2CAAE52669C6} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{05515420-16DE-4E63-BE73-85BE85BA5142} = {9ADF1E48-2F5C-4ED7-A893-596259FABFE0} {05515420-16DE-4E63-BE73-85BE85BA5142} = {9ADF1E48-2F5C-4ED7-A893-596259FABFE0}
@ -2516,7 +2462,6 @@ Global
{0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{FEA1EEF7-876F-48DE-88BF-C0E3E606D758} = {F881ADA2-2F1A-4046-9FEB-191D9422D781} {FEA1EEF7-876F-48DE-88BF-C0E3E606D758} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
{7F1610F1-DD5A-4CF7-8610-30AB12C60ADD} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
{9254C4B0-6F60-42B6-BB3A-36D63FC001C7} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {9254C4B0-6F60-42B6-BB3A-36D63FC001C7} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{71A967D5-0E99-4CEF-A587-98836EE6F2EF} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {71A967D5-0E99-4CEF-A587-98836EE6F2EF} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
@ -2553,7 +2498,6 @@ Global
{D3D8B329-20BE-475E-9E83-653CEA0E0EF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {D3D8B329-20BE-475E-9E83-653CEA0E0EF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{38FE0559-9910-43A8-9E45-3E5004C27692} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {38FE0559-9910-43A8-9E45-3E5004C27692} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
{0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E} = {0C808854-54D1-4230-BFF5-77B5FD905000} {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E} = {0C808854-54D1-4230-BFF5-77B5FD905000}
{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0} = {0C808854-54D1-4230-BFF5-77B5FD905000} {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0} = {0C808854-54D1-4230-BFF5-77B5FD905000}
@ -2602,7 +2546,6 @@ Global
{50AAC2CE-BFC9-4912-87CC-C6381850D735} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {50AAC2CE-BFC9-4912-87CC-C6381850D735} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{A61D7CB4-75A5-4A55-8CA1-BE5AF615D921} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {A61D7CB4-75A5-4A55-8CA1-BE5AF615D921} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{4748FF56-CA85-4809-97D6-A94C0FAC1D77} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {4748FF56-CA85-4809-97D6-A94C0FAC1D77} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{2469B306-B027-4FF2-8815-C9C1EA2CAE79} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {2469B306-B027-4FF2-8815-C9C1EA2CAE79} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
{9DE35039-A8F6-4FBF-B1B6-EB527F802411} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {9DE35039-A8F6-4FBF-B1B6-EB527F802411} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}

13
LICENSE
View File

@ -1309,11 +1309,6 @@ Copyright: 2009-2012 10gen Inc.
2001 Unicode, Inc. 2001 Unicode, Inc.
License: Apache-2.0 License: Apache-2.0
Files: src/mod/applications/mod_stress/FFTReal.h
src/mod/applications/mod_stress/FFTReal.cpp
Copyright: 1999 Laurent de Soras
License: unclear
Files: src/mod/loggers/mod_syslog/mod_syslog.c Files: src/mod/loggers/mod_syslog/mod_syslog.c
Copyright: 2005-2010, James Martelletti <james@nerdc0re.com> Copyright: 2005-2010, James Martelletti <james@nerdc0re.com>
License: MPL-1.1 License: MPL-1.1
@ -1578,14 +1573,6 @@ Files: src/include/switch_profile.h
Copyright: 2009,2010, Sangoma Technologies Copyright: 2009,2010, Sangoma Technologies
License: BSD-3-clause License: BSD-3-clause
Files: src/mod/codecs/mod_isac/*
Copyright: 2011-2012 The WebRTC project authors
License: BSD-3-clause
Files: src/mod/codecs/mod_isac/mod_isac.c
Copyright: 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
License: MPL-1.1
Files: libs/srtp/* Files: libs/srtp/*
Copyright: 2001-2006, Cisco Systems, Inc. Copyright: 2001-2006, Cisco Systems, Inc.
2005 Ingate Systems AB 2005 Ingate Systems AB

View File

@ -1,4 +1,3 @@
#applications/mod_abstraction
applications/mod_av applications/mod_av
#applications/mod_avmd #applications/mod_avmd
#applications/mod_bert #applications/mod_bert
@ -35,16 +34,11 @@ applications/mod_httapi
#applications/mod_prefix #applications/mod_prefix
#applications/mod_rad_auth #applications/mod_rad_auth
#applications/mod_redis #applications/mod_redis
#applications/mod_rss
applications/mod_signalwire applications/mod_signalwire
applications/mod_sms applications/mod_sms
#applications/mod_snapshot #applications/mod_snapshot
#applications/mod_snom
#applications/mod_sonar
#applications/mod_soundtouch
applications/mod_spandsp applications/mod_spandsp
#applications/mod_spy #applications/mod_spy
#applications/mod_stress
applications/mod_test applications/mod_test
#applications/mod_translate #applications/mod_translate
applications/mod_valet_parking applications/mod_valet_parking
@ -66,7 +60,6 @@ codecs/mod_g723_1
codecs/mod_g729 codecs/mod_g729
codecs/mod_h26x codecs/mod_h26x
#codecs/mod_ilbc #codecs/mod_ilbc
#codecs/mod_isac
codecs/mod_opus codecs/mod_opus
#codecs/mod_silk #codecs/mod_silk
#codecs/mod_siren #codecs/mod_siren

View File

@ -1,4 +1,3 @@
applications/mod_abstraction
applications/mod_av applications/mod_av
applications/mod_avmd applications/mod_avmd
applications/mod_bert applications/mod_bert
@ -35,16 +34,11 @@ applications/mod_oreka
applications/mod_prefix applications/mod_prefix
#applications/mod_rad_auth #applications/mod_rad_auth
applications/mod_redis applications/mod_redis
applications/mod_rss
applications/mod_signalwire applications/mod_signalwire
applications/mod_sms applications/mod_sms
applications/mod_snapshot applications/mod_snapshot
applications/mod_snom
applications/mod_sonar
applications/mod_soundtouch
applications/mod_spandsp applications/mod_spandsp
applications/mod_spy applications/mod_spy
applications/mod_stress
applications/mod_test applications/mod_test
applications/mod_translate applications/mod_translate
applications/mod_valet_parking applications/mod_valet_parking
@ -65,7 +59,6 @@ codecs/mod_g723_1
codecs/mod_g729 codecs/mod_g729
codecs/mod_h26x codecs/mod_h26x
codecs/mod_ilbc codecs/mod_ilbc
codecs/mod_isac
codecs/mod_opus codecs/mod_opus
codecs/mod_silk codecs/mod_silk
codecs/mod_siren codecs/mod_siren

1
ci.sh
View File

@ -92,7 +92,6 @@ configure_freeswitch()
# "Disable"/"Comment out" mods # "Disable"/"Comment out" mods
sed -i \ sed -i \
-e '/mod_ilbc/s/^/#/g' \ -e '/mod_ilbc/s/^/#/g' \
-e '/mod_isac/s/^/#/g' \
-e '/mod_mongo/s/^/#/g' \ -e '/mod_mongo/s/^/#/g' \
-e '/mod_pocketsphinx/s/^/#/g' \ -e '/mod_pocketsphinx/s/^/#/g' \
-e '/mod_siren/s/^/#/g' \ -e '/mod_siren/s/^/#/g' \

View File

@ -1,7 +0,0 @@
<configuration name="rss.conf" description="RSS Parser">
<feeds>
<!-- Just download the files to wherever and refer to them here -->
<!-- <feed name="Slash Dot">/home/rss/rss.rss</feed> -->
<!-- <feed name="News Forge">/home/rss/newsforge.rss</feed> -->
</feeds>
</configuration>

View File

@ -48,9 +48,6 @@
<load module="mod_fsv"/> <load module="mod_fsv"/>
<!--<load module="mod_translate"/>--> <!--<load module="mod_translate"/>-->
<!-- SNOM Module -->
<!--<load module="mod_snom"/>-->
<!-- Dialplan Interfaces --> <!-- Dialplan Interfaces -->
<!-- <load module="mod_dialplan_directory"/> --> <!-- <load module="mod_dialplan_directory"/> -->
<load module="mod_dialplan_xml"/> <load module="mod_dialplan_xml"/>
@ -88,7 +85,6 @@
<!-- <load module="mod_flite"/> --> <!-- <load module="mod_flite"/> -->
<!-- <load module="mod_pocketsphinx"/> --> <!-- <load module="mod_pocketsphinx"/> -->
<!-- <load module="mod_openmrcp"/> --> <!-- <load module="mod_openmrcp"/> -->
<!-- <load module="mod_rss"/> -->
<!-- Say --> <!-- Say -->
<load module="mod_say_en"/> <load module="mod_say_en"/>

View File

@ -1,7 +0,0 @@
<configuration name="rss.conf" description="RSS Parser">
<feeds>
<!-- Just download the files to wherever and refer to them here -->
<!-- <feed name="Slash Dot">/home/rss/rss.rss</feed> -->
<!-- <feed name="News Forge">/home/rss/newsforge.rss</feed> -->
</feeds>
</configuration>

View File

@ -116,24 +116,6 @@
</condition> </condition>
</extension> </extension>
--> -->
<!--
snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
-->
<extension name="snom-demo-2">
<condition field="destination_number" expression="^9001$">
<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
<action application="transfer" data="3000"/>
</condition>
</extension>
<extension name="snom-demo-1">
<condition field="destination_number" expression="^9000$">
<!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
<action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<extension name="eavesdrop"> <extension name="eavesdrop">
<condition field="destination_number" expression="^88(.*)$|^\*0(.*)$"> <condition field="destination_number" expression="^88(.*)$|^\*0(.*)$">

View File

@ -115,24 +115,6 @@
</condition> </condition>
</extension> </extension>
--> -->
<!--
snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
-->
<extension name="snom-demo-2">
<condition field="destination_number" expression="^9001$">
<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
<action application="transfer" data="3000"/>
</condition>
</extension>
<extension name="snom-demo-1">
<condition field="destination_number" expression="^9000$">
<!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
<action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<extension name="eavesdrop"> <extension name="eavesdrop">
<condition field="destination_number" expression="^88(.*)$|^\*0(.*)$"> <condition field="destination_number" expression="^88(.*)$|^\*0(.*)$">

View File

@ -1,5 +0,0 @@
<configuration name="abstraction.conf" description="Abstraction">
<apis>
<api name="user_name" description="Return Name for extension" syntax="&lt;exten&gt;" parse="(.*)" destination="user_data" argument="$1@default var effective_caller_id_name"/>
</apis>
</configuration>

View File

@ -41,7 +41,6 @@
<load module="mod_loopback"/> <load module="mod_loopback"/>
<!-- <load module="mod_woomera"/> --> <!-- <load module="mod_woomera"/> -->
<!-- <load module="mod_freetdm"/> --> <!-- <load module="mod_freetdm"/> -->
<!-- <load module="mod_unicall"/> -->
<!-- <load module="mod_skinny"/> --> <!-- <load module="mod_skinny"/> -->
<!-- <load module="mod_khomp"/> --> <!-- <load module="mod_khomp"/> -->
<load module="mod_rtc"/> <load module="mod_rtc"/>
@ -76,9 +75,6 @@
<load module="mod_httapi"/> <load module="mod_httapi"/>
<!--<load module="mod_translate"/>--> <!--<load module="mod_translate"/>-->
<!-- SNOM Module -->
<!--<load module="mod_snom"/>-->
<!-- Dialplan Interfaces --> <!-- Dialplan Interfaces -->
<!-- <load module="mod_dialplan_directory"/> --> <!-- <load module="mod_dialplan_directory"/> -->
<load module="mod_dialplan_xml"/> <load module="mod_dialplan_xml"/>
@ -93,7 +89,6 @@
<!--<load module="mod_h26x"/>--> <!--<load module="mod_h26x"/>-->
<load module="mod_b64"/> <load module="mod_b64"/>
<!--<load module="mod_siren"/>--> <!--<load module="mod_siren"/>-->
<!--<load module="mod_isac"/>-->
<load module="mod_opus"/> <load module="mod_opus"/>
<!-- File Format Interfaces --> <!-- File Format Interfaces -->
@ -125,7 +120,6 @@
<!-- <load module="mod_flite"/> --> <!-- <load module="mod_flite"/> -->
<!-- <load module="mod_pocketsphinx"/> --> <!-- <load module="mod_pocketsphinx"/> -->
<!-- <load module="mod_tts_commandline"/> --> <!-- <load module="mod_tts_commandline"/> -->
<!-- <load module="mod_rss"/> -->
<!-- Say --> <!-- Say -->
<load module="mod_say_en"/> <load module="mod_say_en"/>

View File

@ -1,7 +0,0 @@
<configuration name="rss.conf" description="RSS Parser">
<feeds>
<!-- Just download the files to wherever and refer to them here -->
<!-- <feed name="Slash Dot">/home/rss/rss.rss</feed> -->
<!-- <feed name="News Forge">/home/rss/newsforge.rss</feed> -->
</feeds>
</configuration>

View File

@ -1,25 +0,0 @@
<configuration name="unicall.conf" description="Unicall Configuration">
<settings>
<param name="context" value="default"/>
<param name="dialplan" value="XML"/>
<param name="suppress-dtmf-tone" value="true"/>
</settings>
<spans>
<span id="1">
<param name="protocol-class" value="mfcr2"/>
<param name="protocol-variant" value="ar"/>
<param name="protocol-end" value="peer"/>
<param name="outgoing-allowed" value="true"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
</span>
<span id="2">
<param name="protocol-class" value="mfcr2"/>
<param name="protocol-variant" value="ar"/>
<param name="protocol-end" value="peer"/>
<param name="outgoing-allowed" value="true"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
</span>
</spans>
</configuration>

View File

@ -179,24 +179,6 @@
</condition> </condition>
</extension> </extension>
--> -->
<!--
Snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference
-->
<extension name="snom-demo-2">
<condition field="destination_number" expression="^9001$">
<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
<action application="transfer" data="3000"/>
</condition>
</extension>
<extension name="snom-demo-1">
<condition field="destination_number" expression="^9000$">
<!--<key> <light> <label> <user> <host> <profile> <action_name> <action>-->
<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
<action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<extension name="eavesdrop"> <extension name="eavesdrop">
<condition field="destination_number" expression="^88(\d{4})$|^\*0(.*)$"> <condition field="destination_number" expression="^88(\d{4})$|^\*0(.*)$">

View File

@ -1079,7 +1079,7 @@ if test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
fi fi
# Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready # Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready
# Untested modules : mod_osp mod_soundtouch mod_opal mod_h323 mod_khomp # Untested modules : mod_osp mod_opal mod_h323 mod_khomp
# mod_erlang_event mod_snmp mod_perl mod_java mod_managed # mod_erlang_event mod_snmp mod_perl mod_java mod_managed
# #
#saved_CFLAGS="$CFLAGS" #saved_CFLAGS="$CFLAGS"
@ -1469,10 +1469,6 @@ PKG_CHECK_MODULES([OPUS], [opus >= 1.1],[
AM_CONDITIONAL([HAVE_OPUS],[true])],[ AM_CONDITIONAL([HAVE_OPUS],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPUS],[false])]) AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_OPUS],[false])])
PKG_CHECK_MODULES([SOUNDTOUCH], [soundtouch >= 1.7.0],[
AM_CONDITIONAL([HAVE_SOUNDTOUCH],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SOUNDTOUCH],[false])])
flite="true" flite="true"
PKG_CHECK_MODULES([FLITE], [flite >= 2],[],[ PKG_CHECK_MODULES([FLITE], [flite >= 2],[],[
AC_CHECK_LIB([flite], [flite_init],[ AC_CHECK_LIB([flite], [flite_init],[
@ -2088,7 +2084,6 @@ AC_CONFIG_FILES([Makefile
tests/unit/Makefile tests/unit/Makefile
src/Makefile src/Makefile
src/mod/Makefile src/mod/Makefile
src/mod/applications/mod_abstraction/Makefile
src/mod/applications/mod_avmd/Makefile src/mod/applications/mod_avmd/Makefile
src/mod/applications/mod_bert/Makefile src/mod/applications/mod_bert/Makefile
src/mod/applications/mod_blacklist/Makefile src/mod/applications/mod_blacklist/Makefile
@ -2126,17 +2121,12 @@ AC_CONFIG_FILES([Makefile
src/mod/applications/mod_rad_auth/Makefile src/mod/applications/mod_rad_auth/Makefile
src/mod/applications/mod_random/Makefile src/mod/applications/mod_random/Makefile
src/mod/applications/mod_redis/Makefile src/mod/applications/mod_redis/Makefile
src/mod/applications/mod_rss/Makefile
src/mod/applications/mod_skel/Makefile src/mod/applications/mod_skel/Makefile
src/mod/applications/mod_signalwire/Makefile src/mod/applications/mod_signalwire/Makefile
src/mod/applications/mod_sms/Makefile src/mod/applications/mod_sms/Makefile
src/mod/applications/mod_snapshot/Makefile src/mod/applications/mod_snapshot/Makefile
src/mod/applications/mod_snom/Makefile
src/mod/applications/mod_sonar/Makefile
src/mod/applications/mod_soundtouch/Makefile
src/mod/applications/mod_spandsp/Makefile src/mod/applications/mod_spandsp/Makefile
src/mod/applications/mod_spy/Makefile src/mod/applications/mod_spy/Makefile
src/mod/applications/mod_stress/Makefile
src/mod/applications/mod_test/Makefile src/mod/applications/mod_test/Makefile
src/mod/applications/mod_translate/Makefile src/mod/applications/mod_translate/Makefile
src/mod/applications/mod_valet_parking/Makefile src/mod/applications/mod_valet_parking/Makefile
@ -2157,7 +2147,6 @@ AC_CONFIG_FILES([Makefile
src/mod/codecs/mod_g729/Makefile src/mod/codecs/mod_g729/Makefile
src/mod/codecs/mod_h26x/Makefile src/mod/codecs/mod_h26x/Makefile
src/mod/codecs/mod_ilbc/Makefile src/mod/codecs/mod_ilbc/Makefile
src/mod/codecs/mod_isac/Makefile
src/mod/codecs/mod_opus/Makefile src/mod/codecs/mod_opus/Makefile
src/mod/codecs/mod_openh264/Makefile src/mod/codecs/mod_openh264/Makefile
src/mod/codecs/mod_silk/Makefile src/mod/codecs/mod_silk/Makefile
@ -2179,7 +2168,6 @@ AC_CONFIG_FILES([Makefile
src/mod/endpoints/mod_rtmp/Makefile src/mod/endpoints/mod_rtmp/Makefile
src/mod/endpoints/mod_skinny/Makefile src/mod/endpoints/mod_skinny/Makefile
src/mod/endpoints/mod_sofia/Makefile src/mod/endpoints/mod_sofia/Makefile
src/mod/endpoints/mod_unicall/Makefile
src/mod/endpoints/mod_rtc/Makefile src/mod/endpoints/mod_rtc/Makefile
src/mod/endpoints/mod_verto/Makefile src/mod/endpoints/mod_verto/Makefile
src/mod/event_handlers/mod_amqp/Makefile src/mod/event_handlers/mod_amqp/Makefile

23
debian/bootstrap.sh vendored
View File

@ -47,7 +47,6 @@ avoid_mods=(
endpoints/mod_khomp endpoints/mod_khomp
endpoints/mod_opal endpoints/mod_opal
endpoints/mod_reference endpoints/mod_reference
endpoints/mod_unicall
event_handlers/mod_smpp event_handlers/mod_smpp
event_handlers/mod_event_zmq event_handlers/mod_event_zmq
formats/mod_webm formats/mod_webm
@ -78,8 +77,6 @@ avoid_mods_wheezy=(
applications/mod_cv applications/mod_cv
applications/mod_hiredis applications/mod_hiredis
formats/mod_shout formats/mod_shout
applications/mod_sonar
applications/mod_soundtouch
formats/mod_vlc formats/mod_vlc
) )
avoid_mods_trusty=( avoid_mods_trusty=(
@ -516,7 +513,6 @@ Recommends:
freeswitch-meta-codecs (= \${binary:Version}), freeswitch-meta-codecs (= \${binary:Version}),
freeswitch-music, freeswitch-music,
freeswitch-sounds, freeswitch-sounds,
freeswitch-mod-abstraction (= \${binary:Version}),
freeswitch-mod-avmd (= \${binary:Version}), freeswitch-mod-avmd (= \${binary:Version}),
freeswitch-mod-blacklist (= \${binary:Version}), freeswitch-mod-blacklist (= \${binary:Version}),
freeswitch-mod-callcenter (= \${binary:Version}), freeswitch-mod-callcenter (= \${binary:Version}),
@ -544,15 +540,10 @@ Recommends:
freeswitch-mod-oreka (= \${binary:Version}), freeswitch-mod-oreka (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}), freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-redis (= \${binary:Version}), freeswitch-mod-redis (= \${binary:Version}),
freeswitch-mod-rss (= \${binary:Version}),
freeswitch-mod-sms (= \${binary:Version}), freeswitch-mod-sms (= \${binary:Version}),
freeswitch-mod-snapshot (= \${binary:Version}), freeswitch-mod-snapshot (= \${binary:Version}),
freeswitch-mod-snom (= \${binary:Version}),
freeswitch-mod-sonar (= \${binary:Version}),
freeswitch-mod-soundtouch (= \${binary:Version}),
freeswitch-mod-spandsp (= \${binary:Version}), freeswitch-mod-spandsp (= \${binary:Version}),
freeswitch-mod-spy (= \${binary:Version}), freeswitch-mod-spy (= \${binary:Version}),
freeswitch-mod-stress (= \${binary:Version}),
freeswitch-mod-valet-parking (= \${binary:Version}), freeswitch-mod-valet-parking (= \${binary:Version}),
freeswitch-mod-vmd (= \${binary:Version}), freeswitch-mod-vmd (= \${binary:Version}),
freeswitch-mod-voicemail (= \${binary:Version}), freeswitch-mod-voicemail (= \${binary:Version}),
@ -601,7 +592,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-meta-mod-say (= \${binary:Version}), freeswitch-meta-mod-say (= \${binary:Version}),
freeswitch-music, freeswitch-music,
freeswitch-sounds, freeswitch-sounds,
freeswitch-mod-abstraction (= \${binary:Version}),
freeswitch-mod-avmd (= \${binary:Version}), freeswitch-mod-avmd (= \${binary:Version}),
freeswitch-mod-av (= \${binary:Version}), freeswitch-mod-av (= \${binary:Version}),
freeswitch-mod-blacklist (= \${binary:Version}), freeswitch-mod-blacklist (= \${binary:Version}),
@ -633,17 +623,12 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-pgsql (= \${binary:Version}), freeswitch-mod-pgsql (= \${binary:Version}),
freeswitch-mod-png (= \${binary:Version}), freeswitch-mod-png (= \${binary:Version}),
freeswitch-mod-redis (= \${binary:Version}), freeswitch-mod-redis (= \${binary:Version}),
freeswitch-mod-rss (= \${binary:Version}),
freeswitch-mod-signalwire (= \${binary:Version}), freeswitch-mod-signalwire (= \${binary:Version}),
freeswitch-mod-shout (= \${binary:Version}), freeswitch-mod-shout (= \${binary:Version}),
freeswitch-mod-sms (= \${binary:Version}), freeswitch-mod-sms (= \${binary:Version}),
freeswitch-mod-snapshot (= \${binary:Version}), freeswitch-mod-snapshot (= \${binary:Version}),
freeswitch-mod-snom (= \${binary:Version}),
freeswitch-mod-sonar (= \${binary:Version}),
freeswitch-mod-soundtouch (= \${binary:Version}),
freeswitch-mod-spandsp (= \${binary:Version}), freeswitch-mod-spandsp (= \${binary:Version}),
freeswitch-mod-spy (= \${binary:Version}), freeswitch-mod-spy (= \${binary:Version}),
freeswitch-mod-stress (= \${binary:Version}),
freeswitch-mod-translate (= \${binary:Version}), freeswitch-mod-translate (= \${binary:Version}),
freeswitch-mod-valet-parking (= \${binary:Version}), freeswitch-mod-valet-parking (= \${binary:Version}),
freeswitch-mod-video-filter (= \${binary:Version}), freeswitch-mod-video-filter (= \${binary:Version}),
@ -709,7 +694,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-g723-1 (= \${binary:Version}), freeswitch-mod-g723-1 (= \${binary:Version}),
freeswitch-mod-g729 (= \${binary:Version}), freeswitch-mod-g729 (= \${binary:Version}),
freeswitch-mod-h26x (= \${binary:Version}), freeswitch-mod-h26x (= \${binary:Version}),
freeswitch-mod-isac (= \${binary:Version}),
freeswitch-mod-opus (= \${binary:Version}), freeswitch-mod-opus (= \${binary:Version}),
freeswitch-mod-silk (= \${binary:Version}), freeswitch-mod-silk (= \${binary:Version}),
freeswitch-mod-spandsp (= \${binary:Version}), freeswitch-mod-spandsp (= \${binary:Version}),
@ -734,7 +718,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-g723-1-dbg (= \${binary:Version}), freeswitch-mod-g723-1-dbg (= \${binary:Version}),
freeswitch-mod-g729-dbg (= \${binary:Version}), freeswitch-mod-g729-dbg (= \${binary:Version}),
freeswitch-mod-h26x-dbg (= \${binary:Version}), freeswitch-mod-h26x-dbg (= \${binary:Version}),
freeswitch-mod-isac-dbg (= \${binary:Version}),
freeswitch-mod-opus-dbg (= \${binary:Version}), freeswitch-mod-opus-dbg (= \${binary:Version}),
freeswitch-mod-silk-dbg (= \${binary:Version}), freeswitch-mod-silk-dbg (= \${binary:Version}),
freeswitch-mod-spandsp-dbg (= \${binary:Version}), freeswitch-mod-spandsp-dbg (= \${binary:Version}),
@ -833,7 +816,6 @@ Architecture: amd64 armhf arm64
Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-meta-codecs-dbg (= \${binary:Version}), freeswitch-meta-codecs-dbg (= \${binary:Version}),
freeswitch-meta-mod-say (= \${binary:Version}), freeswitch-meta-mod-say (= \${binary:Version}),
freeswitch-mod-abstraction-dbg (= \${binary:Version}),
freeswitch-mod-avmd-dbg (= \${binary:Version}), freeswitch-mod-avmd-dbg (= \${binary:Version}),
freeswitch-mod-av-dbg (= \${binary:Version}), freeswitch-mod-av-dbg (= \${binary:Version}),
freeswitch-mod-blacklist-dbg (= \${binary:Version}), freeswitch-mod-blacklist-dbg (= \${binary:Version}),
@ -865,15 +847,10 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}),
freeswitch-mod-pgsql-dbg (= \${binary:Version}), freeswitch-mod-pgsql-dbg (= \${binary:Version}),
freeswitch-mod-png-dbg (= \${binary:Version}), freeswitch-mod-png-dbg (= \${binary:Version}),
freeswitch-mod-redis-dbg (= \${binary:Version}), freeswitch-mod-redis-dbg (= \${binary:Version}),
freeswitch-mod-rss-dbg (= \${binary:Version}),
freeswitch-mod-sms-dbg (= \${binary:Version}), freeswitch-mod-sms-dbg (= \${binary:Version}),
freeswitch-mod-snapshot-dbg (= \${binary:Version}), freeswitch-mod-snapshot-dbg (= \${binary:Version}),
freeswitch-mod-snom-dbg (= \${binary:Version}),
freeswitch-mod-sonar-dbg (= \${binary:Version}),
freeswitch-mod-soundtouch-dbg (= \${binary:Version}),
freeswitch-mod-spandsp-dbg (= \${binary:Version}), freeswitch-mod-spandsp-dbg (= \${binary:Version}),
freeswitch-mod-spy-dbg (= \${binary:Version}), freeswitch-mod-spy-dbg (= \${binary:Version}),
freeswitch-mod-stress-dbg (= \${binary:Version}),
freeswitch-mod-translate-dbg (= \${binary:Version}), freeswitch-mod-translate-dbg (= \${binary:Version}),
freeswitch-mod-valet-parking-dbg (= \${binary:Version}), freeswitch-mod-valet-parking-dbg (= \${binary:Version}),
freeswitch-mod-video-filter-dbg (= \${binary:Version}), freeswitch-mod-video-filter-dbg (= \${binary:Version}),

View File

@ -3,11 +3,6 @@
## mod/applications ## mod/applications
Module: applications/mod_abstraction
Description: Abstraction layer for APIs
This module provides a way to create new API functions via regex
rewriting.
Module: applications/mod_av Module: applications/mod_av
Description: mod_av Description: mod_av
Adds mod_av. Adds mod_av.
@ -183,10 +178,6 @@ Description: Redis limit backend
This module provides a mechanism to use Redis as a backend data This module provides a mechanism to use Redis as a backend data
store. store.
Module: applications/mod_rss
Description: RSS browser
This module provides an RSS browser.
Module: applications/mod_skel Module: applications/mod_skel
Description: Adds mod_skel Description: Adds mod_skel
Adds mod_skel. Adds mod_skel.
@ -206,20 +197,6 @@ Description: Snapshot
This module can record a sliding window of audio and take snapshots This module can record a sliding window of audio and take snapshots
to disk. to disk.
Module: applications/mod_snom
Description: SNOM specific features
This module implements features specific to SNOM phones.
Module: applications/mod_sonar
Description: Sonar ping timer
This module measures the latency on an audio link by sending audible
audio sonar pings.
Module: applications/mod_soundtouch
Description: Soundtouch
This module implements example media bugs.
Build-Depends: libsoundtouch-dev
Module: applications/mod_spandsp Module: applications/mod_spandsp
Description: SpanDSP Description: SpanDSP
This module implements spandsp fax, dsp, and codec functionality. This module implements spandsp fax, dsp, and codec functionality.
@ -228,10 +205,6 @@ Module: applications/mod_spy
Description: UserSpy Description: UserSpy
This module adds the ability to monitor the audio of a channel. This module adds the ability to monitor the audio of a channel.
Module: applications/mod_stress
Description: Voice stress detection
This module attempts to detect voice stress on an audio channel.
Module: applications/mod_translate Module: applications/mod_translate
Description: Number translation Description: Number translation
This module implements number translation. This module implements number translation.
@ -319,10 +292,6 @@ Description: mod_ilbc
Adds mod_ilbc. Adds mod_ilbc.
Build-Depends: libilbc-dev Build-Depends: libilbc-dev
Module: codecs/mod_isac
Description: mod_isac
Adds mod_isac.
Module: codecs/mod_openh264 Module: codecs/mod_openh264
Description: Adds mod_openh264 Description: Adds mod_openh264
Adds mod_openh264. Adds mod_openh264.
@ -433,10 +402,6 @@ Module: endpoints/mod_sofia
Description: mod_sofia Description: mod_sofia
Adds mod_sofia. Adds mod_sofia.
Module: endpoints/mod_unicall
Description: mod_unicall
Adds mod_unicall.
Module: endpoints/mod_verto Module: endpoints/mod_verto
Description: Adds mod_verto. Description: Adds mod_verto.
Adds mod_verto. Adds mod_verto.

13
debian/copyright vendored
View File

@ -1309,11 +1309,6 @@ Copyright: 2009-2012 10gen Inc.
2001 Unicode, Inc. 2001 Unicode, Inc.
License: Apache-2.0 License: Apache-2.0
Files: src/mod/applications/mod_stress/FFTReal.h
src/mod/applications/mod_stress/FFTReal.cpp
Copyright: 1999 Laurent de Soras
License: unclear
Files: src/mod/loggers/mod_syslog/mod_syslog.c Files: src/mod/loggers/mod_syslog/mod_syslog.c
Copyright: 2005-2010, James Martelletti <james@nerdc0re.com> Copyright: 2005-2010, James Martelletti <james@nerdc0re.com>
License: MPL-1.1 License: MPL-1.1
@ -1573,14 +1568,6 @@ Files: libs/libcodec2/src/pack.c
Copyright: 2010 Perens LLC <bruce@perens.com> Copyright: 2010 Perens LLC <bruce@perens.com>
License: GPL-3+ License: GPL-3+
Files: src/mod/codecs/mod_isac/*
Copyright: 2011-2012 The WebRTC project authors
License: BSD-3-clause
Files: src/mod/codecs/mod_isac/mod_isac.c
Copyright: 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
License: MPL-1.1
Files: libs/srtp/* Files: libs/srtp/*
Copyright: 2001-2006, Cisco Systems, Inc. Copyright: 2001-2006, Cisco Systems, Inc.
2005 Ingate Systems AB 2005 Ingate Systems AB

View File

@ -227,14 +227,6 @@ FreeSWITCH development files
###################################################################################################################### ######################################################################################################################
# FreeSWITCH Application Modules # FreeSWITCH Application Modules
###################################################################################################################### ######################################################################################################################
%package application-abstraction
Summary: FreeSWITCH mod_abstraction
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
%description application-abstraction
Provide an abstraction to FreeSWITCH API calls
%package application-avmd %package application-avmd
Summary: FreeSWITCH voicemail detector Summary: FreeSWITCH voicemail detector
Group: System/Libraries Group: System/Libraries
@ -476,15 +468,6 @@ Requires: %{name} = %{version}-%{release}
Provides FreeSWITCH mod_redis, access to the redis key value pair db system from Provides FreeSWITCH mod_redis, access to the redis key value pair db system from
FreeSWITCH FreeSWITCH
%package application-rss
Summary: FreeSWITCH mod_rss
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
%description application-rss
Provides FreeSWITCH mod_rss, edisrse and read an XML based RSS feed, then read
the entries aloud via a TTS engine
%package application-signalwire %package application-signalwire
Summary: FreeSWITCH mod_signalwire Summary: FreeSWITCH mod_signalwire
Group: System/Libraries Group: System/Libraries
@ -513,27 +496,6 @@ Requires: %{name} = %{version}-%{release}
Provides FreeSWITCH mod_snapshot, allows recording a sliding window of audio Provides FreeSWITCH mod_snapshot, allows recording a sliding window of audio
and taking snapshots to disk. and taking snapshots to disk.
%package application-snom
Summary: FreeSWITCH mod_snom
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
%description application-snom
Provides FreeSWITCH mod_snom, an application for controlling the functionality
and appearance of the programmable softkeys on Snom phones
%package application-soundtouch
Summary: FreeSWITCH mod_soundtouch
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
BuildRequires: soundtouch-devel >= 1.7.1
%description application-soundtouch
Provides FreeSWITCH mod_soundtouch, uses the soundtouch library, which can do
pitch shifting and other audio effects, so you can pipe the audio of a call
(or any other channel audio) through this module and achieve those effects. You
can specifically adjust pitch, rate, and tempo.
%package application-spy %package application-spy
Summary: FreeSWITCH mod_spy Summary: FreeSWITCH mod_spy
Group: System/Libraries Group: System/Libraries
@ -543,15 +505,6 @@ Requires: %{name} = %{version}-%{release}
Provides FreeSWITCH mod_spy, implements userspy application which provides Provides FreeSWITCH mod_spy, implements userspy application which provides
persistent eavesdrop on all channels bridged to a certain user persistent eavesdrop on all channels bridged to a certain user
%package application-stress
Summary: FreeSWITCH mod_stress
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
%description application-stress
Provides FreeSWITCH mod_stress. mod_stress attempts to detect stress in a
person's voice and generates FreeSWITCH events based on that data.
%package application-translate %package application-translate
Summary: FreeSWITCH mod_translate Summary: FreeSWITCH mod_translate
Group: System/Libraries Group: System/Libraries
@ -706,21 +659,13 @@ BuildRequires: ilbc2-devel
%description codec-ilbc %description codec-ilbc
iLBC Codec support for FreeSWITCH open source telephony platform iLBC Codec support for FreeSWITCH open source telephony platform
%package codec-isac
Summary: iSAC Codec support for FreeSWITCH open source telephony platform
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
%description codec-isac
iSAC Codec support for FreeSWITCH open source telephony platform
%package codec-vpx %package codec-vpx
Summary: vp8 Codec support for FreeSWITCH open source telephony platform Summary: vp8 Codec support for FreeSWITCH open source telephony platform
Group: System/Libraries Group: System/Libraries
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
%description codec-vpx %description codec-vpx
iSAC Codec support for FreeSWITCH open source telephony platform VP8 Codec support for FreeSWITCH open source telephony platform
%package codec-opus %package codec-opus
Summary: Opus Codec support for FreeSWITCH open source telephony platform Summary: Opus Codec support for FreeSWITCH open source telephony platform
@ -1213,7 +1158,6 @@ The Python ESL module allows for native interaction with FreeSWITCH over the eve
Summary: Basic vanilla config set for the FreeSWITCH Open Source telephone platform. Summary: Basic vanilla config set for the FreeSWITCH Open Source telephone platform.
Group: System/Libraries Group: System/Libraries
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Requires: freeswitch-application-abstraction
Requires: freeswitch-application-avmd Requires: freeswitch-application-avmd
Requires: freeswitch-application-blacklist Requires: freeswitch-application-blacklist
Requires: freeswitch-application-callcenter Requires: freeswitch-application-callcenter
@ -1238,14 +1182,10 @@ Requires: freeswitch-application-limit
Requires: freeswitch-application-memcache Requires: freeswitch-application-memcache
Requires: freeswitch-application-nibblebill Requires: freeswitch-application-nibblebill
Requires: freeswitch-application-redis Requires: freeswitch-application-redis
Requires: freeswitch-application-rss
Requires: freeswitch-application-signalwire Requires: freeswitch-application-signalwire
Requires: freeswitch-application-sms Requires: freeswitch-application-sms
Requires: freeswitch-application-snapshot Requires: freeswitch-application-snapshot
Requires: freeswitch-application-snom
Requires: freeswitch-application-soundtouch
Requires: freeswitch-application-spy Requires: freeswitch-application-spy
Requires: freeswitch-application-stress
Requires: freeswitch-application-valet_parking Requires: freeswitch-application-valet_parking
Requires: freeswitch-application-video_filter Requires: freeswitch-application-video_filter
Requires: freeswitch-application-voicemail Requires: freeswitch-application-voicemail
@ -1307,7 +1247,7 @@ export QA_RPATHS=$[ 0x0001|0x0002 ]
# Application Modules # Application Modules
# #
###################################################################################################################### ######################################################################################################################
APPLICATION_MODULES_AC="applications/mod_abstraction applications/mod_avmd applications/mod_blacklist \ APPLICATION_MODULES_AC="applications/mod_avmd applications/mod_blacklist \
applications/mod_callcenter applications/mod_cidlookup \ applications/mod_callcenter applications/mod_cidlookup \
applications/mod_commands applications/mod_conference applications/mod_curl" applications/mod_commands applications/mod_conference applications/mod_curl"
APPLICATION_MODULES_DE="applications/mod_db applications/mod_directory applications/mod_distributor \ APPLICATION_MODULES_DE="applications/mod_db applications/mod_directory applications/mod_distributor \
@ -1321,10 +1261,10 @@ APPLICATION_MODULES_DE+="applications/mod_esl"
APPLICATION_MODULES_FR="applications/mod_fifo applications/mod_fsk applications/mod_fsv applications/mod_hash \ APPLICATION_MODULES_FR="applications/mod_fifo applications/mod_fsk applications/mod_fsv applications/mod_hash \
applications/mod_httapi applications/mod_http_cache applications/mod_lcr applications/mod_limit \ applications/mod_httapi applications/mod_http_cache applications/mod_lcr applications/mod_limit \
applications/mod_memcache applications/mod_mongo applications/mod_nibblebill applications/mod_rad_auth \ applications/mod_memcache applications/mod_mongo applications/mod_nibblebill applications/mod_rad_auth \
applications/mod_redis applications/mod_rss " applications/mod_redis "
APPLICATION_MODULES_SZ="applications/mod_signalwire applications/mod_sms applications/mod_snapshot applications/mod_snom applications/mod_soundtouch \ APPLICATION_MODULES_SZ="applications/mod_signalwire applications/mod_sms applications/mod_snapshot \
applications/mod_spandsp applications/mod_spy applications/mod_stress \ applications/mod_spandsp applications/mod_spy \
applications/mod_valet_parking applications/mod_translate applications/mod_voicemail \ applications/mod_valet_parking applications/mod_translate applications/mod_voicemail \
applications/mod_voicemail_ivr applications/mod_video_filter" applications/mod_voicemail_ivr applications/mod_video_filter"
@ -1343,7 +1283,7 @@ ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_comm
# #
###################################################################################################################### ######################################################################################################################
CODECS_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_bv codecs/mod_codec2 codecs/mod_g723_1 \ CODECS_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_bv codecs/mod_codec2 codecs/mod_g723_1 \
codecs/mod_g729 codecs/mod_h26x codecs/mod_ilbc codecs/mod_isac codecs/mod_opus codecs/mod_silk \ codecs/mod_g729 codecs/mod_h26x codecs/mod_ilbc codecs/mod_opus codecs/mod_silk \
codecs/mod_siren codecs/mod_theora" codecs/mod_siren codecs/mod_theora"
# #
@ -1766,7 +1706,6 @@ fi
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/*.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/extensions.conf %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/extensions.conf
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/mime.types %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/mime.types
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/abstraction.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/acl.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/acl.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/amr.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/amr.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/amrwb.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/amrwb.conf.xml
@ -1820,7 +1759,6 @@ fi
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/pre_load_modules.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/pre_load_modules.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/presence_map.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/presence_map.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/redis.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/redis.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/rss.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/rtmp.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/rtmp.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/shout.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/shout.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/signalwire.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/signalwire.conf.xml
@ -1834,7 +1772,6 @@ fi
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/timezones.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/timezones.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/translate.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/translate.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/tts_commandline.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/tts_commandline.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unicall.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/verto.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/verto.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail_ivr.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail_ivr.conf.xml
@ -1893,9 +1830,6 @@ fi
# Application Packages # Application Packages
# #
###################################################################################################################### ######################################################################################################################
%files application-abstraction
%{MODINSTDIR}/mod_abstraction.so*
%files application-avmd %files application-avmd
%{MODINSTDIR}/mod_avmd.so* %{MODINSTDIR}/mod_avmd.so*
@ -1980,9 +1914,6 @@ fi
%files application-redis %files application-redis
%{MODINSTDIR}/mod_redis.so* %{MODINSTDIR}/mod_redis.so*
%files application-rss
%{MODINSTDIR}/mod_rss.so*
%files application-signalwire %files application-signalwire
%{MODINSTDIR}/mod_signalwire.so* %{MODINSTDIR}/mod_signalwire.so*
@ -1992,18 +1923,9 @@ fi
%files application-snapshot %files application-snapshot
%{MODINSTDIR}/mod_snapshot.so* %{MODINSTDIR}/mod_snapshot.so*
%files application-snom
%{MODINSTDIR}/mod_snom.so*
%files application-soundtouch
%{MODINSTDIR}/mod_soundtouch.so*
%files application-spy %files application-spy
%{MODINSTDIR}/mod_spy.so* %{MODINSTDIR}/mod_spy.so*
%files application-stress
%{MODINSTDIR}/mod_stress.so*
%files application-translate %files application-translate
%{MODINSTDIR}/mod_translate.so* %{MODINSTDIR}/mod_translate.so*
@ -2064,9 +1986,6 @@ fi
%files codec-ilbc %files codec-ilbc
%{MODINSTDIR}/mod_ilbc.so* %{MODINSTDIR}/mod_ilbc.so*
%files codec-isac
%{MODINSTDIR}/mod_isac.so*
%files codec-opus %files codec-opus
%{MODINSTDIR}/mod_opus.so* %{MODINSTDIR}/mod_opus.so*
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/opus.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/opus.conf.xml

2
libs/.gitignore vendored
View File

@ -420,8 +420,6 @@ opal
/sofia-sip/win32/Makefile /sofia-sip/win32/Makefile
/sofia-sip/win32/Makefile.in /sofia-sip/win32/Makefile.in
/sounds/ /sounds/
/soundtouch/
/soundtouch-*/
/sphinxbase-*/ /sphinxbase-*/
/srtp/aes_tables /srtp/aes_tables
/srtp/config_in.h /srtp/config_in.h

View File

@ -6,7 +6,6 @@ wget -c http://svn.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
wget -c http://svn.freeswitch.org/downloads/libs/mpg123.tar.gz wget -c http://svn.freeswitch.org/downloads/libs/mpg123.tar.gz
wget -c http://svn.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz wget -c http://svn.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz
wget -c http://svn.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz wget -c http://svn.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz
wget -c http://svn.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz
wget -c http://svn.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz wget -c http://svn.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz
wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-8000-1.0.8.tar.gz wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-8000-1.0.8.tar.gz
wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-16000-1.0.8.tar.gz wget -c http://files.freeswitch.org/releases/sounds/freeswitch-sounds-music-16000-1.0.8.tar.gz

4
src/mod/.gitignore vendored
View File

@ -21,9 +21,6 @@
/applications/mod_spandsp/Makefile /applications/mod_spandsp/Makefile
/applications/mod_spandsp/Makefile.in /applications/mod_spandsp/Makefile.in
/applications/mod_spandsp/mod_spandsp.log /applications/mod_spandsp/mod_spandsp.log
/applications/mod_stress/Makefile
/applications/mod_stress/Makefile.in
/applications/mod_stress/mod_stress.log
/applications/mod_translate/Makefile /applications/mod_translate/Makefile
/applications/mod_valet_parking/Makefile /applications/mod_valet_parking/Makefile
/applications/mod_voicemail/Makefile /applications/mod_voicemail/Makefile
@ -60,7 +57,6 @@
/say/mod_say_ru/Makefile /say/mod_say_ru/Makefile
/timers/mod_posix_timer/Makefile /timers/mod_posix_timer/Makefile
/timers/mod_timerfd/Makefile /timers/mod_timerfd/Makefile
/endpoints/mod_unicall/Makefile
*/*/Makefile.in */*/Makefile.in
*/*/Makefile */*/Makefile
*/*/mod_*.log */*/mod_*.log

View File

@ -1,8 +0,0 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_abstraction
mod_LTLIBRARIES = mod_abstraction.la
mod_abstraction_la_SOURCES = mod_abstraction.c
mod_abstraction_la_CFLAGS = $(AM_CFLAGS)
mod_abstraction_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_abstraction_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View File

@ -1,5 +0,0 @@
<configuration name="abstraction.conf" description="Abstraction">
<apis>
<api name="user_name" description="Return Name for extension" syntax="<exten>" parse="(.*)" destination="user_data" argument="$1@default var effective_caller_id_name"/>
</apis>
</configuration>

View File

@ -1,135 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>mod_abstraction</ProjectName>
<ProjectGuid>{60C542EE-6882-4EA2-8C21-5AB6DB1BA73F}</ProjectGuid>
<RootNamespace>mod_abstraction</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mod_abstraction.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,165 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Marc Olivier Chouinard <mochouinard@moctel.com>
*
*
* mod_abstraction.c -- Abstraction
*
*/
#include <switch.h>
/* Prototypes */
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_abstraction_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_abstraction_runtime);
SWITCH_MODULE_LOAD_FUNCTION(mod_abstraction_load);
const char *global_cf = "abstraction.conf";
/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
* Defines a switch_loadable_module_function_table_t and a static const char[] modname
*/
SWITCH_MODULE_DEFINITION(mod_abstraction, mod_abstraction_load, mod_abstraction_shutdown, NULL);
SWITCH_STANDARD_API(api_abstraction_function)
{
const char *api_name = switch_event_get_header(stream->param_event, "API-Command");
switch_xml_t cfg, xml, x_apis, x_api;
if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf);
goto end;
}
if (!(x_apis = switch_xml_child(cfg, "apis"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No apis group\n");
goto end;
}
if ((x_api = switch_xml_find_child_multi(x_apis, "api", "name", api_name , NULL))) {
const char *parse = switch_xml_attr_soft(x_api, "parse");
const char *destination = switch_xml_attr_soft(x_api, "destination");
const char *arguments = switch_xml_attr_soft(x_api, "argument");
int proceed;
switch_regex_t *re = NULL;
int ovector[30];
if ((proceed = switch_regex_perform(cmd, parse, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
const char *api_args = NULL;
char *substituted = NULL;
if (cmd && strchr(parse, '(')) {
uint32_t len = (uint32_t) (strlen(cmd) + strlen(arguments) + 10) * proceed;
if (!(substituted = malloc(len))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Memory Error!\n");
goto end;
}
memset(substituted, 0, len);
switch_perform_substitution(re, proceed, arguments, cmd , substituted, len, ovector);
api_args = substituted;
} else {
api_args = arguments;
}
switch_api_execute(destination, api_args, session, stream);
switch_safe_free(substituted);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No match for API %s (%s != %s)\n", api_name, parse, cmd);
}
switch_regex_safe_free(re);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "API %s doesn't exist inside the xml structure. You might have forgot to reload the module after editing it\n", api_name);
}
end:
if (xml)
switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS;
}
/* Macro expands to: switch_status_t mod_abstraction_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
SWITCH_MODULE_LOAD_FUNCTION(mod_abstraction_load)
{
switch_status_t status = SWITCH_STATUS_TERM;
switch_api_interface_t *api_interface;
switch_xml_t cfg, xml, x_apis, x_api;
int count = 0;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf);
goto end;
}
if (!(x_apis = switch_xml_child(cfg, "apis"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No apis group\n");
goto end;
}
for (x_api = switch_xml_child(x_apis, "api"); x_api; x_api = x_api->next) {
const char *name = switch_xml_attr_soft(x_api, "name");
const char *description = switch_xml_attr_soft(x_api, "description");
const char *syntax = switch_xml_attr_soft(x_api, "syntax");
SWITCH_ADD_API(api_interface, name, description, api_abstraction_function, syntax);
count++;
}
if (count > 0) {
status = SWITCH_STATUS_SUCCESS;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No API abstraction defined\n");
}
end:
if (xml)
switch_xml_free(xml);
return status;
}
/*
Called when the system shuts down
Macro expands to: switch_status_t mod_abstraction_shutdown() */
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_abstraction_shutdown)
{
/* Cleanup dynamically allocated config settings */
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet
*/

View File

@ -1,8 +0,0 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_rss
mod_LTLIBRARIES = mod_rss.la
mod_rss_la_SOURCES = mod_rss.c
mod_rss_la_CFLAGS = $(AM_CFLAGS)
mod_rss_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_rss_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View File

@ -1,7 +0,0 @@
<configuration name="rss.conf" description="RSS Parser">
<feeds>
<!-- Just download the files to wherever and refer to them here -->
<!-- <feed name="Slash Dot">/home/rss/rss.rss</feed> -->
<!-- <feed name="News Forge">/home/rss/newsforge.rss</feed> -->
</feeds>
</configuration>

View File

@ -1,7 +0,0 @@
<include>
<extension name="rss">
<condition field="destination_number" expression="^rss$">
<action application="rss"/>
</condition>
</extension>
</include>

View File

@ -1,141 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>mod_rss</ProjectName>
<ProjectGuid>{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}</ProjectGuid>
<RootNamespace>mod_rss</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mod_rss.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\libs\win32\apr\libapr.2017.vcxproj">
<Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,649 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
* Bret McDanel <trixter AT 0xdecafbad.com>
*
*
* mod_rss.c -- RSS Browser
*
*/
#include <switch.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_rss_load);
SWITCH_MODULE_DEFINITION(mod_rss, mod_rss_load, NULL, NULL);
typedef enum {
SFLAG_INSTRUCT = (1 << 0),
SFLAG_INFO = (1 << 1),
SFLAG_MAIN = (1 << 2)
} SFLAGS;
/* helper object */
struct dtmf_buffer {
int32_t index;
uint32_t flags;
int32_t speed;
char voice[80];
switch_speech_handle_t *sh;
};
#define TTS_MEAN_SPEED 170
#define TTS_MAX_ENTRIES 99
#define TTS_DEFAULT_ENGINE "flite"
#define TTS_DEFAULT_VOICE "slt"
#define MATCH_COUNT
struct rss_entry {
uint8_t inuse;
char *title_txt;
char *description_txt;
char *subject_txt;
char *dept_txt;
};
#ifdef MATCH_COUNT
static uint32_t match_count(char *str, uint32_t max)
{
char tstr[80] = "";
uint32_t matches = 0, x = 0;
uint32_t len = (uint32_t) strlen(str);
for (x = 0; x < max; x++) {
switch_snprintf(tstr, sizeof(tstr), "%u", x);
if (!strncasecmp(str, tstr, len)) {
matches++;
}
}
return matches;
}
#endif
/*
dtmf handler function you can hook up to be executed when a digit is dialed during playback
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
*/
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
{
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:{
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
struct dtmf_buffer *dtb;
dtb = (struct dtmf_buffer *) buf;
switch (dtmf->digit) {
case '#':
switch_set_flag(dtb, SFLAG_MAIN);
return SWITCH_STATUS_BREAK;
case '6':
dtb->index++;
return SWITCH_STATUS_BREAK;
case '4':
dtb->index--;
return SWITCH_STATUS_BREAK;
case '*':
if (switch_test_flag(dtb->sh, SWITCH_SPEECH_FLAG_PAUSE)) {
switch_clear_flag(dtb->sh, SWITCH_SPEECH_FLAG_PAUSE);
} else {
switch_set_flag(dtb->sh, SWITCH_SPEECH_FLAG_PAUSE);
}
break;
case '5':
switch_core_speech_text_param_tts(dtb->sh, "voice", "next");
switch_set_flag(dtb, SFLAG_INFO);
return SWITCH_STATUS_BREAK;
case '9':
switch_core_speech_text_param_tts(dtb->sh, "voice", dtb->voice);
switch_set_flag(dtb, SFLAG_INFO);
return SWITCH_STATUS_BREAK;
case '2':
if (dtb->speed < 260) {
dtb->speed += 30;
switch_core_speech_numeric_param_tts(dtb->sh, "speech/rate", dtb->speed);
switch_set_flag(dtb, SFLAG_INFO);
return SWITCH_STATUS_BREAK;
}
break;
case '7':
dtb->speed = TTS_MEAN_SPEED;
switch_core_speech_numeric_param_tts(dtb->sh, "speech/rate", dtb->speed);
switch_set_flag(dtb, SFLAG_INFO);
return SWITCH_STATUS_BREAK;
case '8':
if (dtb->speed > 80) {
dtb->speed -= 30;
switch_core_speech_numeric_param_tts(dtb->sh, "speech/rate", dtb->speed);
switch_set_flag(dtb, SFLAG_INFO);
return SWITCH_STATUS_BREAK;
}
break;
case '0':
switch_set_flag(dtb, SFLAG_INSTRUCT);
return SWITCH_STATUS_BREAK;
}
}
break;
default:
break;
}
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_APP(rss_function)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status;
const char *err = NULL;
struct dtmf_buffer dtb = { 0 };
switch_xml_t xml = NULL, item, xchannel = NULL;
struct rss_entry entries[TTS_MAX_ENTRIES] = { {0} };
uint32_t i = 0;
char *title_txt = "", *description_txt = "", *rights_txt = "";
switch_codec_t speech_codec;
char *engine = TTS_DEFAULT_ENGINE;
char *voice = TTS_DEFAULT_VOICE;
char *timer_name = NULL;
switch_speech_handle_t sh;
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
switch_timer_t timer = { 0 }, *timerp = NULL;
uint32_t last;
char *mydata = NULL;
char *filename = NULL;
char *argv[3], *feed_list[TTS_MAX_ENTRIES] = { 0 }, *feed_names[TTS_MAX_ENTRIES] = {
0};
int feed_index = 0;
const char *cf = "rss.conf";
switch_xml_t cfg, cxml, feeds, feed;
char buf[1024] = "";
int32_t jumpto = -1;
uint32_t matches = 0;
switch_input_args_t args = { 0 };
const char *vcf = NULL;
char *chanvars = switch_channel_build_param_string(channel, NULL, NULL);
switch_codec_implementation_t read_impl = { 0 };
uint32_t rate, interval, channels;
switch_core_session_get_read_impl(session, &read_impl);
interval = read_impl.microseconds_per_packet / 1000;
if ((vcf = switch_channel_get_variable(channel, "rss_alt_config"))) {
cf = vcf;
}
if (!(cxml = switch_xml_open_cfg(cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
return;
}
switch_safe_free(chanvars);
if ((feeds = switch_xml_child(cfg, "feeds"))) {
for (feed = switch_xml_child(feeds, "feed"); feed; feed = feed->next) {
char *name = (char *) switch_xml_attr_soft(feed, "name");
char *expanded = NULL;
char *idx = feed->txt;
if ((expanded = switch_channel_expand_variables(channel, idx)) == idx) {
expanded = NULL;
} else {
idx = expanded;
}
if (!name) {
name = "Error No Name.";
}
feed_list[feed_index] = switch_core_session_strdup(session, idx);
switch_safe_free(expanded);
if ((expanded = switch_channel_expand_variables(channel, name)) == name) {
expanded = NULL;
} else {
name = expanded;
}
feed_names[feed_index] = switch_core_session_strdup(session, name);
switch_safe_free(expanded);
feed_index++;
}
}
switch_xml_free(cxml);
switch_channel_answer(channel);
if (!zstr(data)) {
if ((mydata = switch_core_session_strdup(session, data))) {
switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]));
if (argv[0]) {
engine = argv[0];
if (argv[1]) {
voice = argv[1];
if (argv[2]) {
jumpto = atoi(argv[2]);
}
}
}
}
}
if (!feed_index) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "No Feeds Specified!\n");
return;
}
if (switch_channel_media_ready(channel)) {
rate = read_impl.actual_samples_per_second;
channels = read_impl.number_of_channels;
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Codec Error!\n");
return;
}
memset(&sh, 0, sizeof(sh));
if (switch_core_speech_open(&sh, engine, voice, rate, interval, channels, &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid TTS module!\n");
return;
}
if (switch_core_codec_init(&speech_codec,
"L16",
NULL,
NULL,
(int) rate,
interval,
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n", rate, interval);
flags = 0;
switch_core_speech_close(&sh, &flags);
return;
}
if (timer_name) {
if (switch_core_timer_init(&timer, timer_name, interval, (int) (rate / 50), switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Setup timer failed!\n");
switch_core_codec_destroy(&speech_codec);
flags = 0;
switch_core_speech_close(&sh, &flags);
return;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setup timer success %u bytes per %d ms!\n", (rate / 50) * 2, interval);
/* start a thread to absorb incoming audio */
switch_core_service_session(session);
timerp = &timer;
}
while (switch_channel_ready(channel)) {
int32_t len = 0, idx = 0;
char cmd[3];
main_menu:
filename = NULL;
len = 0;
*cmd = '\0';
title_txt = description_txt = rights_txt = "";
if (jumpto > -1) {
switch_snprintf(cmd, sizeof(cmd), "%d", jumpto);
jumpto = -1;
} else {
switch_core_speech_flush_tts(&sh);
switch_ivr_sleep(session, 500, SWITCH_FALSE, NULL);
#ifdef MATCH_COUNT
switch_snprintf(buf + len, sizeof(buf) - len, "%s",
", Main Menu."
"Select one of the following news sources, or press 0 to exit. ");
#else
switch_snprintf(buf + len, sizeof(buf) - len, "%s",
",Main Menu. "
"Select one of the following news sources, followed by the pound key or press 0 to exit. ");
#endif
len = (int32_t) strlen(buf);
for (idx = 0; idx < feed_index; idx++) {
switch_snprintf(buf + len, sizeof(buf) - len, "%d: %s. />", idx + 1, feed_names[idx]);
len = (int32_t) strlen(buf);
}
args.input_callback = NULL;
args.buf = cmd;
args.buflen = sizeof(cmd);
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, buf, &args);
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
goto finished;
}
}
if (*cmd != '\0') {
int32_t x;
char *p;
if (strchr(cmd, '0')) {
break;
}
if ((p = strchr(cmd, '#'))) {
*p = '\0';
#ifdef MATCH_COUNT
/* Hmmm... I know there are no more matches so I don't *need* them to press pound but
I already told them to press it. Will this confuse people or not? Let's make em press
pound unless this define is enabled for now.
*/
} else if (match_count(cmd, feed_index) > 1) {
#else
} else {
#endif
char term;
char *cp;
switch_size_t blen = sizeof(cmd) - strlen(cmd);
cp = cmd + blen;
switch_ivr_collect_digits_count(session, cp, blen, blen, "#", &term, 5000, 0, 0);
}
x = atoi(cmd) - 1;
if (x > -1 && x < feed_index) {
filename = feed_list[x];
} else if (matches > 1) {
} else {
args.input_callback = NULL;
args.buf = NULL;
args.buflen = 0;
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, "I'm sorry. That is an Invalid Selection. ", &args);
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
goto finished;
}
}
}
if (!filename) {
continue;
}
if (!(xml = switch_xml_parse_file(filename))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Open of %s failed\n", filename);
goto finished;
}
err = switch_xml_error(xml);
if (!zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Error [%s]\n", err);
goto finished;
}
if ((xchannel = switch_xml_child(xml, "channel"))) {
switch_xml_t title, description, rights;
if ((title = switch_xml_child(xchannel, "title"))) {
title_txt = title->txt;
}
if ((description = switch_xml_child(xchannel, "description"))) {
description_txt = description->txt;
}
if ((rights = switch_xml_child(xchannel, "dc:rights"))) {
rights_txt = rights->txt;
}
}
if (!(item = switch_xml_child(xml, "item"))) {
if (xchannel) {
item = switch_xml_child(xchannel, "item");
}
}
memset(entries, 0, sizeof(entries));
for (i = 0; item; item = item->next) {
switch_xml_t title, description, subject, dept;
char *p;
entries[i].inuse = 1;
entries[i].title_txt = NULL;
entries[i].description_txt = NULL;
entries[i].subject_txt = NULL;
entries[i].dept_txt = NULL;
if ((title = switch_xml_child(item, "title"))) {
entries[i].title_txt = title->txt;
}
if ((description = switch_xml_child(item, "description"))) {
char *t, *e;
entries[i].description_txt = description->txt;
for (;;) {
if (!(t = strchr(entries[i].description_txt, '<'))) {
break;
}
if (!(e = strchr(t, '>'))) {
break;
}
memset(t, 32, ++e - t);
}
}
if ((subject = switch_xml_child(item, "dc:subject"))) {
entries[i].subject_txt = subject->txt;
}
if ((dept = switch_xml_child(item, "slash:department"))) {
entries[i].dept_txt = dept->txt;
}
if (entries[i].description_txt && (p = strchr(entries[i].description_txt, '<'))) {
*p = '\0';
}
#ifdef _STRIP_SOME_CHARS_
for (p = entries[i].description_txt; *p; p++) {
if (*p == '\'' || *p == '"' || *p == ':') {
*p = ' ';
}
}
#endif
i++;
}
if (switch_channel_ready(channel)) {
switch_time_exp_t tm;
char date[80] = "";
switch_size_t retsize;
char dtmf[5] = "";
switch_time_exp_lt(&tm, switch_micro_time_now());
switch_strftime_nocheck(date, &retsize, sizeof(date), "%I:%M %p", &tm);
switch_ivr_sleep(session, 500, SWITCH_FALSE, NULL);
switch_snprintf(buf, sizeof(buf),
",%s. %s. %s. local time: %s, Press 0 for options, 5 to change voice, or pound to return to the main menu. ",
title_txt, description_txt, rights_txt, date);
args.input_callback = NULL;
args.buf = dtmf;
args.buflen = sizeof(dtmf);
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, buf, &args);
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
goto finished;
}
if (*dtmf != '\0') {
switch (*dtmf) {
case '0':
switch_set_flag(&dtb, SFLAG_INSTRUCT);
break;
case '#':
goto main_menu;
}
}
}
for (last = 0; last < TTS_MAX_ENTRIES; last++) {
if (!entries[last].inuse) {
last--;
break;
}
}
dtb.index = 0;
dtb.sh = &sh;
dtb.speed = TTS_MEAN_SPEED;
//switch_set_flag(&dtb, SFLAG_INFO);
switch_copy_string(dtb.voice, voice, sizeof(dtb.voice));
while (entries[0].inuse && switch_channel_ready(channel)) {
while (switch_channel_ready(channel)) {
uint8_t cont = 0;
if (dtb.index >= TTS_MAX_ENTRIES) {
dtb.index = 0;
}
if (dtb.index < 0) {
dtb.index = last;
}
if (!entries[dtb.index].inuse) {
dtb.index = 0;
continue;
}
if (switch_channel_ready(channel)) {
char tmpbuf[1024] = "";
uint32_t tmplen = 0;
if (switch_test_flag(&dtb, SFLAG_MAIN)) {
switch_clear_flag(&dtb, SFLAG_MAIN);
goto main_menu;
}
if (switch_test_flag(&dtb, SFLAG_INFO)) {
switch_clear_flag(&dtb, SFLAG_INFO);
switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice,
dtb.speed);
tmplen = (uint32_t) strlen(tmpbuf);
}
if (switch_test_flag(&dtb, SFLAG_INSTRUCT)) {
switch_clear_flag(&dtb, SFLAG_INSTRUCT);
cont = 1;
switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "%s",
"Press star to pause or resume speech. "
"To go to the next item, press six. "
"To go back, press 4. "
"Press two to go faster, eight to slow down, or 7 to resume normal speed. "
"To change voices, press five. To restore the original voice press 9. "
"To hear these options again, press zero or press pound to return to the main menu. ");
} else {
switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "Story %d. ", dtb.index + 1);
tmplen = (uint32_t) strlen(tmpbuf);
if (entries[dtb.index].subject_txt) {
switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "Subject: %s. ", entries[dtb.index].subject_txt);
tmplen = (uint32_t) strlen(tmpbuf);
}
if (entries[dtb.index].dept_txt) {
switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "From the %s department. ", entries[dtb.index].dept_txt);
tmplen = (uint32_t) strlen(tmpbuf);
}
if (entries[dtb.index].title_txt) {
switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "%s", entries[dtb.index].title_txt);
}
}
switch_core_speech_flush_tts(&sh);
args.input_callback = on_dtmf;
args.buf = &dtb;
args.buflen = sizeof(dtb);
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, tmpbuf, &args);
if (status == SWITCH_STATUS_BREAK) {
continue;
} else if (status != SWITCH_STATUS_SUCCESS) {
goto finished;
}
if (cont) {
continue;
}
if (entries[dtb.index].description_txt) {
args.input_callback = on_dtmf;
args.buf = &dtb;
args.buflen = sizeof(dtb);
status = switch_ivr_speak_text_handle(session, &sh, &speech_codec, timerp, entries[dtb.index].description_txt, &args);
}
if (status == SWITCH_STATUS_BREAK) {
continue;
} else if (status != SWITCH_STATUS_SUCCESS) {
goto finished;
}
}
dtb.index++;
}
}
}
finished:
switch_core_speech_close(&sh, &flags);
switch_core_codec_destroy(&speech_codec);
if (timerp) {
/* End the audio absorbing thread */
switch_core_thread_session_end(session);
switch_core_timer_destroy(&timer);
}
switch_xml_free(xml);
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
}
SWITCH_MODULE_LOAD_FUNCTION(mod_rss_load)
{
switch_application_interface_t *app_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_APP(app_interface, "rss", NULL, NULL, rss_function, NULL, SAF_NONE);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,12 +0,0 @@
if (session.ready()) {
session.answer();
session.speak("cepstral","David","Please wait while we refresh the RSS feeds.")
fetchURLFile("http://weather.yahooapis.com/forecastrss?p=60610","rss/weather.rss");
fetchURLFile("http://rss.news.yahoo.com/rss/topstories","rss/yahootop.rss");
fetchURLFile("http://rss.news.yahoo.com/rss/science","rss/yahoosci.rss");
fetchURLFile("http://rss.news.yahoo.com/rss/business","rss/yahoobus.rss");
fetchURLFile("http://rss.news.yahoo.com/rss/entertainment","rss/yahooent.rss");
fetchURLFile("http://rss.slashdot.org/Slashdot/slashdot","rss/slashdot.rss");
fetchURLFile("http://www.freeswitch.org/xml.php","rss/freeswitch.rss");
}

View File

@ -1,9 +0,0 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_snom
mod_LTLIBRARIES = mod_snom.la
mod_snom_la_SOURCES = mod_snom.c
mod_snom_la_CFLAGS = $(AM_CFLAGS)
mod_snom_la_CPPFLAGS = $(CURL_CFLAGS) $(AM_CPPFLAGS)
mod_snom_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_snom_la_LDFLAGS = $(CURL_LIBS) -avoid-version -module -no-undefined -shared

View File

@ -1,16 +0,0 @@
<include>
<extension name="snom-demo-1">
<condition field="destination_number" expression="^9000$">
<!-- <key> <light> <label> <user> <host> <profile> <action_name> <action> -->
<action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/>
<action application="playback" data="$${hold_music}"/>
</condition>
</extension>
<extension name="snom-demo-2">
<condition field="destination_number" expression="^9001$">
<action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/>
<action application="transfer" data="3000"/>
</condition>
</extension>
</include>

View File

@ -1,146 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectName>mod_snom</ProjectName>
<ProjectGuid>{2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}</ProjectGuid>
<RootNamespace>mod_snom</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(SolutionDir)\w32\curl.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_release.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\w32\module_debug.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>6385;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>6385;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>6385;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Midl>
<TargetEnvironment>X64</TargetEnvironment>
</Midl>
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<DisableSpecificWarnings>6385;6340;6246;6011;6387;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(SolutionDir)\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="mod_snom.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2017.vcxproj">
<Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,276 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* mod_snom.c -- SNOM Specific Features
*
*/
#include <switch.h>
#include <switch_curl.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_snom_load);
SWITCH_MODULE_DEFINITION(mod_snom, mod_snom_load, NULL, NULL);
static switch_bool_t snom_bind_key(const char *key,
const char *light,
const char *label, const char *user, const char *host, const char *profile, const char *action_name, const char *action)
{
switch_event_t *event;
if (user && host && profile) {
if (switch_event_create(&event, SWITCH_EVENT_SEND_MESSAGE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user", user);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "host", host);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "profile", profile);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "content-type", "application/x-buttons");
if (action && action_name) {
switch_event_add_body(event, "k=%s\nc=%s\nl=%s\nn=%s\na=%s\n", key, light, label, action, action_name);
} else {
switch_event_add_body(event, "k=%s\nc=%s\nl=%s\n\n", key, light, label);
}
switch_event_fire(&event);
}
return SWITCH_TRUE;
}
return SWITCH_FALSE;
}
#define URL_SYNTAX ""
SWITCH_STANDARD_API(snom_url_api_function)
{
#if 0
char *tmp;
switch_event_serialize(stream->param_event, &tmp, SWITCH_TRUE);
printf("W00t\n%s\n", tmp);
free(tmp);
#endif
return SWITCH_STATUS_SUCCESS;
}
#define KEY_BIND_SYNTAX "<key> <light> <label> <user> <host> <profile> <action_name> <action>"
SWITCH_STANDARD_API(snom_bind_key_api_function)
{
int argc;
char *mydata = NULL, *argv[8];
mydata = strdup(cmd);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc < 6) {
goto err;
}
if (snom_bind_key(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7])) {
stream->write_function(stream, "+OK %s\n", cmd);
goto end;
}
err:
stream->write_function(stream, "-Error %s\n", KEY_BIND_SYNTAX);
end:
free(mydata);
return SWITCH_STATUS_SUCCESS;
}
static size_t curl_callback(void *ptr, size_t size, size_t nmemb, void *data)
{
register unsigned int realsize = (unsigned int) (size * nmemb);
return realsize;
}
#define COMMAND_SYNTAX "<ip|user> <command> <type> <username> <password>"
SWITCH_STANDARD_API(snom_command_api_function)
{
int argc;
long httpRes = 0;
char *key = NULL;
char *url = NULL;
char *argv[5] = { 0 };
char host[32];
char *argdata = NULL;
char *userpwd = NULL;
char *apiresp = NULL;
ip_t ip;
switch_CURL *curl_handle = NULL;
if (zstr(cmd) || !(argdata = strdup(cmd))) {
goto end;
}
argc = switch_separate_string(argdata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc < 3 || (argc > 3 && argc < 5)) {
stream->write_function(stream, "-ERR %s\n", COMMAND_SYNTAX);
goto end;
}
if (strcasecmp(argv[1],"key") && strcasecmp(argv[1],"action")) {
stream->write_function(stream, "-ERR only key or action commands allowed at the moment\n");
goto end;
}
if (switch_inet_pton(AF_INET, argv[0], &ip)) {
snprintf(host, sizeof(host), "%s", argv[0]);
} else {
char *sql = NULL;
char *ret = NULL;
switch_cache_db_handle_t *db = NULL;
switch_stream_handle_t apistream = { 0 };
SWITCH_STANDARD_STREAM(apistream);
if (switch_api_execute("sofia_contact", argv[0], NULL, &apistream) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR error executing sofia_contact\n");
goto end;
}
apiresp = (char*) apistream.data;
if (!zstr(apiresp)) {
if (!strcasecmp(apistream.data,"error/user_not_registered")) {
stream->write_function(stream, "-ERR user '%s' not registered\n",argv[0]);
goto end;
}
} else {
goto end;
}
if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "%s", "-ERR Database Error!\n");
goto end;
}
sql = switch_mprintf("select network_ip from registrations where url = '%q'", apiresp);
ret = switch_cache_db_execute_sql2str(db, sql, host, sizeof(host), NULL);
switch_safe_free(sql);
switch_cache_db_release_db_handle(&db);
if (!ret) {
stream->write_function(stream, "%s", "-ERR Query '%s' failed!\n", sql);
goto end;
}
}
curl_handle = curl_easy_init();
if (0 == strcasecmp(argv[1],"key")) {
key = curl_easy_escape(curl_handle, argv[2], 0);
url = switch_mprintf("http://%s/command.htm?key=%s", host, key);
curl_free(key);
}
if (0 == strcasecmp(argv[1],"action")) {
if (0 == strcasecmp(argv[2],"reboot")) {
url = switch_mprintf("http://%s/advanced_update.htm?reboot=Reboot", host);
} else if (0 == strcasecmp(argv[2],"reset")) {
url = switch_mprintf("http://%s/advanced_update.htm?reset=Reset", host);
} else if (0 == strcasecmp(argv[2],"dialeddel")) {
url = switch_mprintf("http://%s/index.htm?dialeddel=0", host);
} else if (0 == strcasecmp(argv[2],"misseddel")) {
url = switch_mprintf("http://%s/index.htm?misseddel=0", host);
} else if (0 == strcasecmp(argv[2],"receiveddel")) {
url = switch_mprintf("http://%s/index.htm?receiveddel=0", host);
} else {
stream->write_function(stream, "-ERR action '%s' not supported (supported actions are reboot, reset, dialeddel, misseddel, receiveddel)\n", argv[2]);
curl_easy_cleanup(curl_handle);
goto end;
}
}
curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1);
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, curl_callback);
curl_easy_setopt(curl_handle, CURLOPT_URL, url);
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-curl/1.0");
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 15);
curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
if (argc == 5) {
userpwd = switch_mprintf("%s:%s",argv[3],argv[4]);
curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, (long)CURLAUTH_ANY);
curl_easy_setopt(curl_handle, CURLOPT_USERPWD, userpwd);
}
curl_easy_perform(curl_handle);
curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
curl_easy_cleanup(curl_handle);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "curl url %s , result %ld\n", url,httpRes);
if (httpRes != 200)
stream->write_function(stream, "-ERR %s [HTTP:%ld]\n", cmd, httpRes);
else
stream->write_function(stream, "+OK %s\n", cmd);
end:
switch_safe_free(apiresp);
switch_safe_free(userpwd);
switch_safe_free(argdata);
switch_safe_free(url);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_snom_load)
{
switch_api_interface_t *commands_api_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_API(commands_api_interface, "snom_bind_key", "Bind a key", snom_bind_key_api_function, KEY_BIND_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "snom_url", "url", snom_url_api_function, URL_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "snom_command", "Sends Command over HTTP Request", snom_command_api_function, COMMAND_SYNTAX);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,8 +0,0 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_sonar
mod_LTLIBRARIES = mod_sonar.la
mod_sonar_la_SOURCES = mod_sonar.c
mod_sonar_la_CFLAGS = $(AM_CFLAGS)
mod_sonar_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_sonar_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View File

@ -1,257 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* William King <william.king@quentustech.com>
* Seven Du <dujinfang@gmail.com>
*
* mod_sonar.c -- Sonar ping timer
*
*
*/
/*
TODO:
1. Use libteltone directly
2. Use an energy detection to listen for first set of sound back. Use timestamp of detection of energy as the recv stamp if a tone is eventually detected.
3. Check for milliwatt pings. Listen for frequency changes, and audio loss
*/
#include <switch.h>
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#endif
/* Prototypes */
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sonar_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_sonar_runtime);
SWITCH_MODULE_LOAD_FUNCTION(mod_sonar_load);
/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime)
* Defines a switch_loadable_module_function_table_t and a static const char[] modname
*/
SWITCH_MODULE_DEFINITION(mod_sonar, mod_sonar_load, mod_sonar_shutdown, NULL);
struct sonar_ping_helper_s {
switch_time_t start, end, diff;
int samples[1024];
int received;
int sum, min, max;
};
typedef struct sonar_ping_helper_s sonar_ping_helper_t;
switch_bool_t sonar_ping_callback(switch_core_session_t *session, const char *app, const char *app_data){
switch_channel_t *channel = switch_core_session_get_channel(session);
sonar_ping_helper_t *ph = switch_channel_get_private(channel, "__sonar_ping__");
int diff;
if (!ph) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not locate private sonar helper data\n");
return SWITCH_TRUE;
}
if ( ph->end ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sonar not yet reset. Likely a repeat detection.\n");
return SWITCH_TRUE;
}
ph->end = switch_time_now();
diff = ph->end - ph->start;
ph->start = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Sonar ping took %ld milliseconds\n", (long)diff / 1000);
diff /= 1000;
ph->sum += diff;
ph->max = MAX(ph->max, diff);
ph->min = MIN(ph->min, diff);
ph->samples[ph->received++] = diff;
return SWITCH_TRUE;
}
SWITCH_STANDARD_APP(sonar_app)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
char *tone = "%(500,0,1004)";
const char *arg = (char *) data;
int loops;
int lost = 0;
int x;
int avg = 0, sdev = 0, mdev = 0;
int sum2;
switch_event_t *event;
sonar_ping_helper_t ph = { 0 };
if (zstr(arg)) {
loops = 5;
} else {
loops = atoi(data);
}
if (loops < 0) {
loops = 5;
} else if (loops > 1024) {
loops = 1024;
}
switch_channel_answer(channel);
switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL);
switch_channel_set_private(channel, "__sonar_ping__", &ph);
switch_ivr_tone_detect_session(session,
"soar_ping", "1004",
"r", 0,
1, NULL, NULL, sonar_ping_callback);
switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL);
ph.min = 999999;
for( x = 0; x < loops; x++ ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending sonar ping\n");
ph.end = 0;
ph.start = switch_time_now();
switch_ivr_gentones(session, tone, 1, NULL);
switch_ivr_sleep(session, 2000, SWITCH_FALSE, NULL);
if ( ph.start ) {
lost++;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Lost sonar ping\n");
}
}
switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL);
switch_ivr_stop_tone_detect_session(session);
if (loops == lost) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too bad, we lost all!\n");
return;
}
if (ph.received + lost != loops) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Race happend %d + %d != %d\n", ph.received, lost, loops);
}
if (ph.received > 0) avg = ph.sum / ph.received;
sum2 = 0;
for(x = 0; x < ph.received; x++) {
sum2 += abs(ph.samples[x] - avg);
}
if (ph.received > 0) {
mdev = sum2 / ph.received;
}
sum2 = 0;
for(x = 0; x < ph.received; x++) {
sum2 += (ph.samples[x] - avg) * (ph.samples[x] - avg);
}
if (ph.received > 1) {
sdev = sqrt(sum2 / (ph.received - 1));
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
"Sonar Ping (in ms): min:%d max:%d avg:%d sdev:%d mdev:%d sent:%d recv: %d lost:%d lost/send:%2.2f%%\n",
ph.min, ph.max, avg, sdev, mdev, loops, ph.received, lost, lost * 1.0 / loops);
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, "sonar::ping") == SWITCH_STATUS_SUCCESS) {
const char *verbose_event;
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_min", "%d", ph.min);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_max", "%d", ph.max);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_avg", "%d", avg);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_sdev", "%d", sdev);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_mdev", "%d", mdev);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_sent", "%d", loops);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_recv", "%d", ph.received);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "ping_lost", "%d", lost);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lost_rate", "%2.2f%%", lost * 1.0 / loops);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "destination_number",
switch_channel_get_variable(channel, "ping_destination_number"));
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sonar_ping_ref",
switch_channel_get_variable(channel, "sonar_ping_ref"));
verbose_event = switch_channel_get_variable(channel, "sonar_channel_event");
if (verbose_event && switch_true(verbose_event)) {
switch_channel_event_set_data(channel, event);
}
switch_event_fire(&event);
}
}
/* Macro expands to: switch_status_t mod_sonar_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */
SWITCH_MODULE_LOAD_FUNCTION(mod_sonar_load)
{
switch_application_interface_t *app_interface;
if (switch_event_reserve_subclass("sonar::ping") != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", "sonar::ping");
return SWITCH_STATUS_TERM;
}
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_APP(app_interface, "sonar", "sonar", "sonar", sonar_app, "", SAF_NONE);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
/*
Called when the system shuts down
Macro expands to: switch_status_t mod_sonar_shutdown() */
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sonar_shutdown)
{
switch_event_free_subclass("sonar::ping");
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet
*/

View File

@ -1,18 +0,0 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_soundtouch
if HAVE_SOUNDTOUCH
mod_LTLIBRARIES = mod_soundtouch.la
mod_soundtouch_la_SOURCES = mod_soundtouch.cpp
mod_soundtouch_la_CFLAGS = $(AM_CFLAGS) $(SOUNDTOUCH_CFLAGS) -DINTEGER_SAMPLES
mod_soundtouch_la_CXXFLAGS = $(SOUNDTOUCH_CFLAGS) -DINTEGER_SAMPLES
mod_soundtouch_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SOUNDTOUCH_LIBS)
mod_soundtouch_la_LDFLAGS = -avoid-version -module -no-undefined -shared
else
install: error
all: error
error:
$(error You must install libsoundtouch-dev to build mod_soundtouch)
endif

View File

@ -1,472 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* mod_soundtouch.cpp -- Example of writeable media bugs
*
*/
#include <stdexcept>
#include <stdio.h>
#include <SoundTouch.h>
using namespace soundtouch;
using namespace std;
#include <switch.h>
#define STSTART 1024 * 2
#define STBLOCK 1024
SWITCH_MODULE_LOAD_FUNCTION(mod_soundtouch_load);
SWITCH_MODULE_DEFINITION(mod_soundtouch, mod_soundtouch_load, NULL, NULL);
static const float ADJUST_AMOUNT = 0.05f;
struct soundtouch_helper {
SoundTouch *st;
switch_core_session_t *session;
bool send_not_recv;
bool hook_dtmf;
float pitch;
float rate;
float tempo;
bool literal;
};
/* type is p=>pitch,r=>rate,t=>tempo */
static float normalize_soundtouch_value(char type, float value)
{
float min,max;
switch(type)
{
case 'p':
min = 0.01f;
max = 1000.0f;
break;
case 'r':
min = 0.01f;
max = 1000.0f;
break;
case 't':
min = 0.01f;
max = 1000.0f;
break;
}
if (value < min)
value = min;
if (value > max)
value = max;
return value;
}
/*Computation taken from SoundTouch library for conversion*/
static float compute_pitch_from_octaves(float octaves)
{
return (float)exp(0.69314718056f * octaves);
}
static switch_status_t on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
{
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
struct soundtouch_helper *sth = (struct soundtouch_helper *) switch_core_media_bug_get_user_data(bug);
if (sth) {
if (sth->literal) {
sth->literal = false;
return SWITCH_STATUS_SUCCESS;
}
switch (dtmf->digit) {
case '*':
sth->literal=true;
break;
case '1':
sth->pitch = normalize_soundtouch_value('p',sth->pitch - ADJUST_AMOUNT);
sth->st->setPitch(sth->pitch);
break;
case '2':
sth->pitch = 1.0f;
sth->st->setPitch(sth->pitch);
break;
case '3':
sth->pitch = normalize_soundtouch_value('p',sth->pitch + ADJUST_AMOUNT);
sth->st->setPitch(sth->pitch);
break;
case '4':
sth->rate = normalize_soundtouch_value('r',sth->rate - ADJUST_AMOUNT);
sth->st->setRate(sth->rate);
break;
case '5':
sth->rate = 1.0f;
sth->st->setRate(sth->rate);
break;
case '6':
sth->rate = normalize_soundtouch_value('r',sth->rate + ADJUST_AMOUNT);
sth->st->setRate(sth->rate);
break;
case '7':
sth->tempo = normalize_soundtouch_value('t',sth->tempo - ADJUST_AMOUNT);
sth->st->setTempo(sth->tempo);
break;
case '8':
sth->tempo = 1.0f;
sth->st->setTempo(sth->tempo);
break;
case '9':
sth->tempo = normalize_soundtouch_value('t',sth->tempo + ADJUST_AMOUNT);
sth->st->setTempo(sth->tempo);
break;
case '0':
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "pitch: %f tempo: %f rate: %f\n",sth->pitch,sth->tempo,sth->rate);
}
}
return SWITCH_STATUS_FALSE;
}
return SWITCH_STATUS_SUCCESS;
}
static switch_bool_t soundtouch_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
{
struct soundtouch_helper *sth = (struct soundtouch_helper *) user_data;
switch (type) {
case SWITCH_ABC_TYPE_INIT:
{
switch_codec_t *read_codec = switch_core_session_get_read_codec(sth->session);
sth->st = new SoundTouch();
sth->st->setSampleRate(read_codec->implementation->samples_per_second);
sth->st->setChannels(read_codec->implementation->number_of_channels);
sth->st->setSetting(SETTING_USE_QUICKSEEK, 1);
sth->st->setSetting(SETTING_USE_AA_FILTER, 1);
if (sth->pitch) {
sth->st->setPitch(sth->pitch);
}
if (sth->rate) {
sth->st->setRate(sth->rate);
}
if (sth->tempo) {
sth->st->setTempo(sth->tempo);
}
if (sth->hook_dtmf)
{
if (sth->send_not_recv) {
switch_core_event_hook_add_send_dtmf(sth->session, on_dtmf);
} else {
switch_core_event_hook_add_recv_dtmf(sth->session, on_dtmf);
}
}
}
break;
case SWITCH_ABC_TYPE_CLOSE:
{
delete sth->st;
if (sth->send_not_recv) {
switch_core_event_hook_remove_send_dtmf(sth->session, on_dtmf);
} else {
switch_core_event_hook_remove_recv_dtmf(sth->session, on_dtmf);
}
}
break;
case SWITCH_ABC_TYPE_READ:
case SWITCH_ABC_TYPE_WRITE:
break;
case SWITCH_ABC_TYPE_READ_REPLACE:
case SWITCH_ABC_TYPE_WRITE_REPLACE:
{
switch_frame_t *frame;
assert(sth != NULL);
assert(sth->st != NULL);
if (! sth->send_not_recv) {
frame = switch_core_media_bug_get_read_replace_frame(bug);
} else {
frame = switch_core_media_bug_get_write_replace_frame(bug);
}
sth->st->putSamples((SAMPLETYPE *) frame->data, frame->samples);
if (sth->st->numSamples() >= frame->samples * 2) {
frame->samples = sth->st->receiveSamples((SAMPLETYPE *) frame->data, frame->samples);
frame->datalen = frame->samples * 2;
} else {
memset(frame->data, 0, frame->datalen);
}
if (! sth->send_not_recv) {
switch_core_media_bug_set_read_replace_frame(bug, frame);
} else {
switch_core_media_bug_set_write_replace_frame(bug, frame);
}
}
default:
break;
}
return SWITCH_TRUE;
}
SWITCH_STANDARD_APP(soundtouch_start_function)
{
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
struct soundtouch_helper *sth;
char *argv[6];
int argc;
char *lbuf = NULL;
int x;
int n=0;
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
if (!zstr(data) && !strcasecmp(data, "stop")) {
switch_channel_set_private(channel, "_soundtouch_", NULL);
switch_core_media_bug_remove(session, &bug);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
}
return;
}
sth = (struct soundtouch_helper *) switch_core_session_alloc(session, sizeof(*sth));
assert(sth != NULL);
if (data && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
sth->pitch = 1;
sth->rate = 1;
sth->tempo = 1;
sth->hook_dtmf = false;
sth->send_not_recv = false;
n = 0;
for (x = 0; x < argc; x++) {
if (!strncasecmp(argv[x], "send_leg", 8)) {
sth->send_not_recv = true;
} else if (!strncasecmp(argv[x], "hook_dtmf", 9)) {
sth->hook_dtmf = true;
n++;
} else if (strchr(argv[x], 'p')) {
sth->pitch = normalize_soundtouch_value('p', atof(argv[x]));
n++;
} else if (strchr(argv[x], 'r')) {
sth->rate = normalize_soundtouch_value('r', atof(argv[x]));
n++;
} else if (strchr(argv[x], 'o')) {
sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x])) );
n++;
} else if (strchr(argv[x], 's')) {
/*12.0f taken from soundtouch conversion to octaves*/
sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) );
n++;
} else if (strchr(argv[x], 't')) {
sth->tempo = normalize_soundtouch_value('t', atof(argv[x]));
n++;
}
}
}
if (n < 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run, no pitch set\n");
return;
}
sth->session = session;
if (switch_core_media_bug_add(session, "soundtouch", NULL, soundtouch_callback, sth, 0,
sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
return;
}
switch_channel_set_private(channel, "_soundtouch_", bug);
}
/* API Interface Function */
#define SOUNDTOUCH_API_SYNTAX "<uuid> [start|stop] [send_leg] [hook_dtmf] [-]<X>s [-]<X>o <X>p <X>r <X>t"
SWITCH_STANDARD_API(soundtouch_api_function)
{
switch_core_session_t *rsession = NULL;
switch_channel_t *channel = NULL;
switch_media_bug_t *bug;
struct soundtouch_helper *sth;
char *mycmd = NULL;
int argc = 0;
char *argv[10] = { 0 };
char *uuid = NULL;
char *action = NULL;
int x, n;
if (zstr(cmd)) {
goto usage;
}
if (!(mycmd = strdup(cmd))) {
goto usage;
}
if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
goto usage;
}
uuid = argv[0];
action = argv[1];
if (!(rsession = switch_core_session_locate(uuid))) {
stream->write_function(stream, "-ERR Cannot locate session!\n");
goto done;
}
channel = switch_core_session_get_channel(rsession);
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
if (!zstr(action) && !strcasecmp(action, "stop")) {
switch_channel_set_private(channel, "_soundtouch_", NULL);
switch_core_media_bug_remove(rsession, &bug);
stream->write_function(stream, "+OK Success\n");
} else {
stream->write_function(stream, "-ERR Cannot run 2 at once on the same channel!\n");
}
goto done;
}
if (!zstr(action) && strcasecmp(action, "start")) {
goto usage;
}
if (argc < 3) {
goto usage;
}
sth = (struct soundtouch_helper *) switch_core_session_alloc(rsession, sizeof(*sth));
assert(sth != NULL);
sth->pitch = 1;
sth->rate = 1;
sth->tempo = 1;
sth->hook_dtmf = false;
sth->send_not_recv = false;
n = 0;
for (x = 2; x < argc; x++) {
if (!strncasecmp(argv[x], "send_leg", 8)) {
sth->send_not_recv = true;
} else if (!strncasecmp(argv[x], "hook_dtmf", 9)) {
sth->hook_dtmf = true;
n++;
} else if (strchr(argv[x], 'p')) {
sth->pitch = normalize_soundtouch_value('p', atof(argv[x]));
n++;
} else if (strchr(argv[x], 'r')) {
sth->rate = normalize_soundtouch_value('r', atof(argv[x]));
n++;
} else if (strchr(argv[x], 'o')) {
sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x])) );
n++;
} else if (strchr(argv[x], 's')) {
/*12.0f taken from soundtouch conversion to octaves*/
sth->pitch = normalize_soundtouch_value('p', compute_pitch_from_octaves(atof(argv[x]) / 12.0f) );
n++;
} else if (strchr(argv[x], 't')) {
sth->tempo = normalize_soundtouch_value('t', atof(argv[x]));
n++;
}
}
if (n < 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rsession), SWITCH_LOG_WARNING, "Cannot run, no pitch set\n");
goto usage;
}
sth->session = rsession;
if (switch_core_media_bug_add(rsession, "soundtouch", NULL, soundtouch_callback, sth, 0,
sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Failure!\n");
goto done;
} else {
switch_channel_set_private(channel, "_soundtouch_", bug);
stream->write_function(stream, "+OK Success\n");
goto done;
}
usage:
stream->write_function(stream, "-USAGE: %s\n", SOUNDTOUCH_API_SYNTAX);
done:
if (rsession) {
switch_core_session_rwunlock(rsession);
}
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_soundtouch_load)
{
switch_application_interface_t *app_interface;
switch_api_interface_t *api_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_APP(app_interface, "soundtouch", "Alter the audio stream", "Alter the audio stream pitch/rate/tempo",
soundtouch_start_function, "[send_leg] [hook_dtmf] [-]<X>s [-]<X>o <X>p <X>r <X>t", SAF_NONE);
SWITCH_ADD_API(api_interface, "soundtouch", "soundtouch", soundtouch_api_function, SOUNDTOUCH_API_SYNTAX);
switch_console_set_complete("add soundtouch ::console::list_uuid ::[start:stop");
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,615 +0,0 @@
/*****************************************************************************
* *
* DIGITAL SIGNAL PROCESSING TOOLS *
* Version 1.03, 2001/06/15 *
* (c) 1999 - Laurent de Soras *
* *
* FFTReal.cpp *
* Fourier transformation of real number arrays. *
* Portable ISO C++ *
* *
* Tab = 3 *
*****************************************************************************/
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
#include "FFTReal.h"
#include <cassert>
#include <cmath>
#if defined (_MSC_VER)
#pragma pack (push, 8)
#endif // _MSC_VER
/*\\\ PUBLIC MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*==========================================================================*/
/* Name: Constructor */
/* Input parameters: */
/* - length: length of the array on which we want to do a FFT. */
/* Range: power of 2 only, > 0. */
/* Throws: std::bad_alloc, anything */
/*==========================================================================*/
FFTReal::FFTReal (const long length)
: _length (length)
, _nbr_bits (int (floor (log (length) / log (2) + 0.5)))
, _bit_rev_lut (int (floor (log (length) / log (2) + 0.5)))
, _trigo_lut (int (floor (log (length) / log (2) + 0.5)))
, _sqrt2_2 (flt_t (sqrt (2) * 0.5))
{
assert ((1L << _nbr_bits) == length);
_buffer_ptr = 0;
if (_nbr_bits > 2)
{
_buffer_ptr = new flt_t [_length];
}
}
/*==========================================================================*/
/* Name: Destructor */
/*==========================================================================*/
FFTReal::~FFTReal (void)
{
delete [] _buffer_ptr;
_buffer_ptr = 0;
}
/*==========================================================================*/
/* Name: do_fft */
/* Description: Compute the FFT of the array. */
/* Input parameters: */
/* - x: pointer on the source array (time). */
/* Output parameters: */
/* - f: pointer on the destination array (frequencies). */
/* f [0...length(x)/2] = real values, */
/* f [length(x)/2+1...length(x)-1] = imaginary values of */
/* coefficents 1...length(x)/2-1. */
/* Throws: Nothing */
/*==========================================================================*/
void FFTReal::do_fft (flt_t f [], const flt_t x []) const
{
/*______________________________________________
*
* General case
*______________________________________________
*/
if (_nbr_bits > 2)
{
flt_t * sf;
flt_t * df;
if (_nbr_bits & 1)
{
df = _buffer_ptr;
sf = f;
}
else
{
df = f;
sf = _buffer_ptr;
}
/* Do the transformation in several pass */
{
int pass;
long nbr_coef;
long h_nbr_coef;
long d_nbr_coef;
long coef_index;
/* First and second pass at once */
{
const long * const bit_rev_lut_ptr = _bit_rev_lut.get_ptr ();
coef_index = 0;
do
{
const long rev_index_0 = bit_rev_lut_ptr [coef_index];
const long rev_index_1 = bit_rev_lut_ptr [coef_index + 1];
const long rev_index_2 = bit_rev_lut_ptr [coef_index + 2];
const long rev_index_3 = bit_rev_lut_ptr [coef_index + 3];
flt_t * const df2 = df + coef_index;
df2 [1] = x [rev_index_0] - x [rev_index_1];
df2 [3] = x [rev_index_2] - x [rev_index_3];
const flt_t sf_0 = x [rev_index_0] + x [rev_index_1];
const flt_t sf_2 = x [rev_index_2] + x [rev_index_3];
df2 [0] = sf_0 + sf_2;
df2 [2] = sf_0 - sf_2;
coef_index += 4;
}
while (coef_index < _length);
}
/* Third pass */
{
coef_index = 0;
const flt_t sqrt2_2 = _sqrt2_2;
do
{
flt_t v;
sf [coef_index] = df [coef_index] + df [coef_index + 4];
sf [coef_index + 4] = df [coef_index] - df [coef_index + 4];
sf [coef_index + 2] = df [coef_index + 2];
sf [coef_index + 6] = df [coef_index + 6];
v = (df [coef_index + 5] - df [coef_index + 7]) * sqrt2_2;
sf [coef_index + 1] = df [coef_index + 1] + v;
sf [coef_index + 3] = df [coef_index + 1] - v;
v = (df [coef_index + 5] + df [coef_index + 7]) * sqrt2_2;
sf [coef_index + 5] = v + df [coef_index + 3];
sf [coef_index + 7] = v - df [coef_index + 3];
coef_index += 8;
}
while (coef_index < _length);
}
/* Next pass */
for (pass = 3; pass < _nbr_bits; ++pass)
{
coef_index = 0;
nbr_coef = 1 << pass;
h_nbr_coef = nbr_coef >> 1;
d_nbr_coef = nbr_coef << 1;
const flt_t * const cos_ptr = _trigo_lut.get_ptr (pass);
do
{
long i;
const flt_t * const sf1r = sf + coef_index;
const flt_t * const sf2r = sf1r + nbr_coef;
flt_t * const dfr = df + coef_index;
flt_t * const dfi = dfr + nbr_coef;
/* Extreme coefficients are always real */
dfr [0] = sf1r [0] + sf2r [0];
dfi [0] = sf1r [0] - sf2r [0]; // dfr [nbr_coef] =
dfr [h_nbr_coef] = sf1r [h_nbr_coef];
dfi [h_nbr_coef] = sf2r [h_nbr_coef];
/* Others are conjugate complex numbers */
const flt_t * const sf1i = sf1r + h_nbr_coef;
const flt_t * const sf2i = sf1i + nbr_coef;
for (i = 1; i < h_nbr_coef; ++ i)
{
const flt_t c = cos_ptr [i]; // cos (i*PI/nbr_coef);
const flt_t s = cos_ptr [h_nbr_coef - i]; // sin (i*PI/nbr_coef);
flt_t v;
v = sf2r [i] * c - sf2i [i] * s;
dfr [i] = sf1r [i] + v;
dfi [-i] = sf1r [i] - v; // dfr [nbr_coef - i] =
v = sf2r [i] * s + sf2i [i] * c;
dfi [i] = v + sf1i [i];
dfi [nbr_coef - i] = v - sf1i [i];
}
coef_index += d_nbr_coef;
}
while (coef_index < _length);
/* Prepare to the next pass */
{
flt_t * const temp_ptr = df;
df = sf;
sf = temp_ptr;
}
}
}
}
/*______________________________________________
*
* Special cases
*______________________________________________
*/
/* 4-point FFT */
else if (_nbr_bits == 2)
{
f [1] = x [0] - x [2];
f [3] = x [1] - x [3];
const flt_t b_0 = x [0] + x [2];
const flt_t b_2 = x [1] + x [3];
f [0] = b_0 + b_2;
f [2] = b_0 - b_2;
}
/* 2-point FFT */
else if (_nbr_bits == 1)
{
f [0] = x [0] + x [1];
f [1] = x [0] - x [1];
}
/* 1-point FFT */
else
{
f [0] = x [0];
}
}
/*==========================================================================*/
/* Name: do_ifft */
/* Description: Compute the inverse FFT of the array. Notice that */
/* IFFT (FFT (x)) = x * length (x). Data must be */
/* post-scaled. */
/* Input parameters: */
/* - f: pointer on the source array (frequencies). */
/* f [0...length(x)/2] = real values, */
/* f [length(x)/2+1...length(x)] = imaginary values of */
/* coefficents 1...length(x)-1. */
/* Output parameters: */
/* - x: pointer on the destination array (time). */
/* Throws: Nothing */
/*==========================================================================*/
void FFTReal::do_ifft (const flt_t f [], flt_t x []) const
{
/*______________________________________________
*
* General case
*______________________________________________
*/
if (_nbr_bits > 2)
{
flt_t * sf = const_cast <flt_t *> (f);
flt_t * df;
flt_t * df_temp;
if (_nbr_bits & 1)
{
df = _buffer_ptr;
df_temp = x;
}
else
{
df = x;
df_temp = _buffer_ptr;
}
/* Do the transformation in several pass */
{
int pass;
long nbr_coef;
long h_nbr_coef;
long d_nbr_coef;
long coef_index;
/* First pass */
for (pass = _nbr_bits - 1; pass >= 3; --pass)
{
coef_index = 0;
nbr_coef = 1 << pass;
h_nbr_coef = nbr_coef >> 1;
d_nbr_coef = nbr_coef << 1;
const flt_t *const cos_ptr = _trigo_lut.get_ptr (pass);
do
{
long i;
const flt_t * const sfr = sf + coef_index;
const flt_t * const sfi = sfr + nbr_coef;
flt_t * const df1r = df + coef_index;
flt_t * const df2r = df1r + nbr_coef;
/* Extreme coefficients are always real */
df1r [0] = sfr [0] + sfi [0]; // + sfr [nbr_coef]
df2r [0] = sfr [0] - sfi [0]; // - sfr [nbr_coef]
df1r [h_nbr_coef] = sfr [h_nbr_coef] * 2;
df2r [h_nbr_coef] = sfi [h_nbr_coef] * 2;
/* Others are conjugate complex numbers */
flt_t * const df1i = df1r + h_nbr_coef;
flt_t * const df2i = df1i + nbr_coef;
for (i = 1; i < h_nbr_coef; ++ i)
{
df1r [i] = sfr [i] + sfi [-i]; // + sfr [nbr_coef - i]
df1i [i] = sfi [i] - sfi [nbr_coef - i];
const flt_t c = cos_ptr [i]; // cos (i*PI/nbr_coef);
const flt_t s = cos_ptr [h_nbr_coef - i]; // sin (i*PI/nbr_coef);
const flt_t vr = sfr [i] - sfi [-i]; // - sfr [nbr_coef - i]
const flt_t vi = sfi [i] + sfi [nbr_coef - i];
df2r [i] = vr * c + vi * s;
df2i [i] = vi * c - vr * s;
}
coef_index += d_nbr_coef;
}
while (coef_index < _length);
/* Prepare to the next pass */
if (pass < _nbr_bits - 1)
{
flt_t * const temp_ptr = df;
df = sf;
sf = temp_ptr;
}
else
{
sf = df;
df = df_temp;
}
}
/* Antepenultimate pass */
{
const flt_t sqrt2_2 = _sqrt2_2;
coef_index = 0;
do
{
df [coef_index] = sf [coef_index] + sf [coef_index + 4];
df [coef_index + 4] = sf [coef_index] - sf [coef_index + 4];
df [coef_index + 2] = sf [coef_index + 2] * 2;
df [coef_index + 6] = sf [coef_index + 6] * 2;
df [coef_index + 1] = sf [coef_index + 1] + sf [coef_index + 3];
df [coef_index + 3] = sf [coef_index + 5] - sf [coef_index + 7];
const flt_t vr = sf [coef_index + 1] - sf [coef_index + 3];
const flt_t vi = sf [coef_index + 5] + sf [coef_index + 7];
df [coef_index + 5] = (vr + vi) * sqrt2_2;
df [coef_index + 7] = (vi - vr) * sqrt2_2;
coef_index += 8;
}
while (coef_index < _length);
}
/* Penultimate and last pass at once */
{
coef_index = 0;
const long * bit_rev_lut_ptr = _bit_rev_lut.get_ptr ();
const flt_t * sf2 = df;
do
{
{
const flt_t b_0 = sf2 [0] + sf2 [2];
const flt_t b_2 = sf2 [0] - sf2 [2];
const flt_t b_1 = sf2 [1] * 2;
const flt_t b_3 = sf2 [3] * 2;
x [bit_rev_lut_ptr [0]] = b_0 + b_1;
x [bit_rev_lut_ptr [1]] = b_0 - b_1;
x [bit_rev_lut_ptr [2]] = b_2 + b_3;
x [bit_rev_lut_ptr [3]] = b_2 - b_3;
}
{
const flt_t b_0 = sf2 [4] + sf2 [6];
const flt_t b_2 = sf2 [4] - sf2 [6];
const flt_t b_1 = sf2 [5] * 2;
const flt_t b_3 = sf2 [7] * 2;
x [bit_rev_lut_ptr [4]] = b_0 + b_1;
x [bit_rev_lut_ptr [5]] = b_0 - b_1;
x [bit_rev_lut_ptr [6]] = b_2 + b_3;
x [bit_rev_lut_ptr [7]] = b_2 - b_3;
}
sf2 += 8;
coef_index += 8;
bit_rev_lut_ptr += 8;
}
while (coef_index < _length);
}
}
}
/*______________________________________________
*
* Special cases
*______________________________________________
*/
/* 4-point IFFT */
else if (_nbr_bits == 2)
{
const flt_t b_0 = f [0] + f [2];
const flt_t b_2 = f [0] - f [2];
x [0] = b_0 + f [1] * 2;
x [2] = b_0 - f [1] * 2;
x [1] = b_2 + f [3] * 2;
x [3] = b_2 - f [3] * 2;
}
/* 2-point IFFT */
else if (_nbr_bits == 1)
{
x [0] = f [0] + f [1];
x [1] = f [0] - f [1];
}
/* 1-point IFFT */
else
{
x [0] = f [0];
}
}
/*==========================================================================*/
/* Name: rescale */
/* Description: Scale an array by divide each element by its length. */
/* This function should be called after FFT + IFFT. */
/* Input/Output parameters: */
/* - x: pointer on array to rescale (time or frequency). */
/* Throws: Nothing */
/*==========================================================================*/
void FFTReal::rescale (flt_t x []) const
{
const flt_t mul = flt_t (1.0 / _length);
long i = _length - 1;
do
{
x [i] *= mul;
--i;
}
while (i >= 0);
}
/*\\\ NESTED CLASS MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*==========================================================================*/
/* Name: Constructor */
/* Input parameters: */
/* - nbr_bits: number of bits of the array on which we want to do a */
/* FFT. Range: > 0 */
/* Throws: std::bad_alloc */
/*==========================================================================*/
FFTReal::BitReversedLUT::BitReversedLUT (const int nbr_bits)
{
long length;
long cnt;
long br_index;
long bit;
length = 1L << nbr_bits;
_ptr = new long [length];
br_index = 0;
_ptr [0] = 0;
for (cnt = 1; cnt < length; ++cnt)
{
/* ++br_index (bit reversed) */
bit = length >> 1;
while (((br_index ^= bit) & bit) == 0)
{
bit >>= 1;
}
_ptr [cnt] = br_index;
}
}
/*==========================================================================*/
/* Name: Destructor */
/*==========================================================================*/
FFTReal::BitReversedLUT::~BitReversedLUT (void)
{
delete [] _ptr;
_ptr = 0;
}
/*==========================================================================*/
/* Name: Constructor */
/* Input parameters: */
/* - nbr_bits: number of bits of the array on which we want to do a */
/* FFT. Range: > 0 */
/* Throws: std::bad_alloc, anything */
/*==========================================================================*/
FFTReal::TrigoLUT::TrigoLUT (const int nbr_bits)
{
long total_len;
_ptr = 0;
if (nbr_bits > 3)
{
total_len = (1L << (nbr_bits - 1)) - 4;
_ptr = new flt_t [total_len];
const double PI = atan (1) * 4;
for (int level = 3; level < nbr_bits; ++level)
{
const long level_len = 1L << (level - 1);
flt_t * const level_ptr = const_cast<flt_t *> (get_ptr (level));
const double mul = PI / (level_len << 1);
for (long i = 0; i < level_len; ++ i)
{
level_ptr [i] = (flt_t) cos (i * mul);
}
}
}
}
/*==========================================================================*/
/* Name: Destructor */
/*==========================================================================*/
FFTReal::TrigoLUT::~TrigoLUT (void)
{
delete [] _ptr;
_ptr = 0;
}
#if defined (_MSC_VER)
#pragma pack (pop)
#endif // _MSC_VER
/*****************************************************************************
LEGAL
Source code may be freely used for any purpose, including commercial
applications. Programs must display in their "About" dialog-box (or
documentation) a text telling they use these routines by Laurent de Soras.
Modified source code can be distributed, but modifications must be clearly
indicated.
CONTACT
Laurent de Soras
92 avenue Albert 1er
92500 Rueil-Malmaison
France
ldesoras@club-internet.fr
*****************************************************************************/
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

View File

@ -1,133 +0,0 @@
/*****************************************************************************
* *
* DIGITAL SIGNAL PROCESSING TOOLS *
* Version 1.03, 2001/06/15 *
* (c) 1999 - Laurent de Soras *
* *
* FFTReal.h *
* Fourier transformation of real number arrays. *
* Portable ISO C++ *
* *
* Tab = 3 *
*****************************************************************************/
#if defined (FFTReal_CURRENT_HEADER)
#error Recursive inclusion of FFTReal header file.
#endif
#define FFTReal_CURRENT_HEADER
#if ! defined (FFTReal_HEADER_INCLUDED)
#define FFTReal_HEADER_INCLUDED
#if defined (_MSC_VER)
#pragma pack (push, 8)
#endif // _MSC_VER
class FFTReal {
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
public:
/* Change this typedef to use a different floating point type in your FFTs
(i.e. float, double or long double). */
typedef float flt_t;
explicit FFTReal(const long length);
~FFTReal();
void do_fft(flt_t f[], const flt_t x[]) const;
void do_ifft(const flt_t f[], flt_t x[]) const;
void rescale(flt_t x[]) const;
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
/* Bit-reversed look-up table nested class */
class BitReversedLUT {
public:
explicit BitReversedLUT(const int nbr_bits);
~BitReversedLUT();
const long *get_ptr() const {
return (_ptr);
} private:
long *_ptr;
};
/* Trigonometric look-up table nested class */
class TrigoLUT {
public:
explicit TrigoLUT(const int nbr_bits);
~TrigoLUT();
const flt_t *get_ptr(const int level) const {
return (_ptr + (1L << (level - 1)) - 4);
};
private:
flt_t *_ptr;
};
const BitReversedLUT _bit_rev_lut;
const TrigoLUT _trigo_lut;
const flt_t _sqrt2_2;
const long _length;
const int _nbr_bits;
flt_t *_buffer_ptr;
/*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
private:
FFTReal(const FFTReal & other);
const FFTReal & operator =(const FFTReal & other);
int operator ==(const FFTReal & other);
int operator !=(const FFTReal & other);
};
#if defined (_MSC_VER)
#pragma pack (pop)
#endif // _MSC_VER
#endif // FFTReal_HEADER_INCLUDED
#undef FFTReal_CURRENT_HEADER
/*****************************************************************************
LEGAL
Source code may be freely used for any purpose, including commercial
applications. Programs must display in their "About" dialog-box (or
documentation) a text telling they use these routines by Laurent de Soras.
Modified source code can be distributed, but modifications must be clearly
indicated.
CONTACT
Laurent de Soras
92 avenue Albert 1er
92500 Rueil-Malmaison
France
ldesoras@club-internet.fr
*****************************************************************************/
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/

View File

@ -1,8 +0,0 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_stress
mod_LTLIBRARIES = mod_stress.la
mod_stress_la_SOURCES = mod_stress.cpp FFTReal.cpp
mod_stress_la_CFLAGS = $(AM_CFLAGS)
mod_stress_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_stress_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View File

@ -1,264 +0,0 @@
/*
* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is
* Anthony Minessale II <anthm@freeswitch.org>
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Anthony Minessale II <anthm@freeswitch.org>
*
* mod_stress.cpp -- Detect Voice Stress
*
*/
#include <stdexcept>
#include <stdio.h>
#include "FFTReal.h"
using namespace std;
#include <switch.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_stress_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_stress_shutdown);
SWITCH_MODULE_DEFINITION(mod_stress, mod_stress_load, mod_stress_shutdown, NULL);
struct stress_helper {
switch_core_session_t *session;
int read;
uint32_t frame_size;
FFTReal *fft;
float *data;
float *result;
float *pow_spectrum;
float bind;
int start;
int end;
float avg_tremor_pwr;
float avg_total_pwr;
float total_pwr;
float tremor_ratio;
float stress;
uint32_t rate;
switch_buffer_t *audio_buffer;
int16_t *audio;
};
static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
{
struct stress_helper *sth = (struct stress_helper *) user_data;
switch (type) {
case SWITCH_ABC_TYPE_INIT:
{
switch_codec_t *read_codec = switch_core_session_get_read_codec(sth->session);
sth->rate = read_codec->implementation->actual_samples_per_second;
if (sth->rate == 8000) {
sth->frame_size = 8192;
} else if (sth->rate == 16000) {
sth->frame_size = 16384;
} else if (sth->rate == 32000) {
sth->frame_size = 32768;
} else {
return SWITCH_FALSE;
}
sth->data = (float *) switch_core_session_alloc(sth->session, sizeof(*sth->data) * sth->frame_size);
sth->result = (float *) switch_core_session_alloc(sth->session, sizeof(*sth->result) * sth->frame_size);
sth->pow_spectrum = (float *) switch_core_session_alloc(sth->session, sizeof(*sth->pow_spectrum) * sth->frame_size);
sth->audio = (int16_t *) switch_core_session_alloc(sth->session, sizeof(*sth->audio) * sth->frame_size);
sth->fft = new FFTReal (sth->frame_size);
switch_buffer_create_dynamic(&sth->audio_buffer, sth->frame_size, sth->frame_size * 3, 0);
sth->bind = (float) sth->rate / sth->frame_size;
sth->start = (int) (8.0 / sth->bind);
sth->end = (int) (14.0 / sth->bind);
}
break;
case SWITCH_ABC_TYPE_CLOSE:
{
switch_buffer_destroy(&sth->audio_buffer);
delete sth->fft;
}
break;
case SWITCH_ABC_TYPE_READ:
case SWITCH_ABC_TYPE_WRITE:
break;
case SWITCH_ABC_TYPE_READ_REPLACE:
case SWITCH_ABC_TYPE_WRITE_REPLACE:
{
switch_frame_t *frame;
if (sth->read) {
frame = switch_core_media_bug_get_read_replace_frame(bug);
} else {
frame = switch_core_media_bug_get_write_replace_frame(bug);
}
if (!switch_test_flag(frame, SFF_CNG)) {
switch_buffer_write(sth->audio_buffer, frame->data, frame->datalen);
}
sth->stress = 0.0;
if (switch_buffer_inuse(sth->audio_buffer) >= sth->frame_size * sizeof(int16_t)) {
switch_size_t bytes;
uint32_t samples, i;
const float threshold = 1.5;
bytes = switch_buffer_read(sth->audio_buffer, sth->audio, sth->frame_size * sizeof(int16_t));
samples = bytes / sizeof(int16_t);
switch_short_to_float(sth->audio, sth->data, samples);
sth->fft->do_fft(sth->result, sth->data);
for (i = 0; i < samples; ++i) {
sth->pow_spectrum[i] = pow(fabs(sth->result[i]), 2) / (float) samples;
}
sth->avg_tremor_pwr = 0.0;
sth->avg_total_pwr = 0.0;
sth->total_pwr = 0.0;
for (i = sth->start; i <= sth->end; ++i) {
sth->avg_tremor_pwr += sth->pow_spectrum[i];
}
sth->avg_tremor_pwr /= ((sth->end - sth->start) + 1);
for (i = 0; i < samples; ++i) {
sth->total_pwr += sth->pow_spectrum[i];
}
sth->avg_total_pwr = sth->total_pwr / samples;
if (sth->total_pwr < threshold) {
sth->tremor_ratio = 0.0;
} else {
sth->tremor_ratio = sth->avg_tremor_pwr / sth->avg_total_pwr;
}
if (sth->total_pwr >= 1.0) {
float d = pow(sth->tremor_ratio, 4);
if (d > 0.0) {
sth->stress = (10.0 / d) / 10000;
if (sth->stress >= 20000.0) {
sth->stress = 20000.0;
}
}
}
}
if (sth->stress) {
switch_event_t *event, *dup;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "Stress %0.2f\n", sth->stress);
if (switch_event_create(&event, SWITCH_EVENT_DETECTED_SPEECH) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Speech-Type", "stress-level");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Stress-Level", "%0.2f", sth->stress);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(sth->session));
if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) {
switch_event_fire(&dup);
}
if (switch_core_session_queue_event(sth->session, &event) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, "Event queue failed!\n");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
switch_event_fire(&event);
}
}
}
}
default:
break;
}
return SWITCH_TRUE;
}
SWITCH_STANDARD_APP(stress_start_function)
{
switch_media_bug_t *bug;
switch_channel_t *channel = switch_core_session_get_channel(session);
struct stress_helper *sth;
char *argv[6];
char *lbuf = NULL;
int x = 0;
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_stress_"))) {
if (!zstr(data) && !strcasecmp(data, "stop")) {
switch_channel_set_private(channel, "_stress_", NULL);
switch_core_media_bug_remove(session, &bug);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
}
return;
}
sth = (struct stress_helper *) switch_core_session_alloc(session, sizeof(*sth));
assert(sth != NULL);
if (data && (lbuf = switch_core_session_strdup(session, data))
&& switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
if (!strncasecmp(argv[x], "read", 4)) {
sth->read = 1;
}
}
sth->session = session;
if (switch_core_media_bug_add(session, "stress", NULL, stress_callback, sth, 0, sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
return;
}
switch_channel_set_private(channel, "_stress_", bug);
}
SWITCH_MODULE_LOAD_FUNCTION(mod_stress_load)
{
switch_application_interface_t *app_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_APP(app_interface, "stress", "Analyze the stream for voice stress", "Analyze the stream for voice stress",
stress_start_function, "[read|write|stop]", SAF_NONE);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_stress_shutdown)
{
return SWITCH_STATUS_UNLOAD;
}
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
*/

View File

@ -1,29 +0,0 @@
Copyright (c) 2011, The WebRTC project authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name of Google nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -1,17 +0,0 @@
include $(top_srcdir)/build/modmake.rulesam
MODNAME=mod_isac
mod_LTLIBRARIES = mod_isac.la
mod_isac_la_SOURCES = mod_isac.c arith_routines.c arith_routines_hist.c arith_routines_logist.c auto_correlation.c auto_corr_to_refl_coef.c
mod_isac_la_SOURCES += bandwidth_estimator.c complex_bit_reverse.c complex_fft.c copy_set_operations.c crc.c cross_correlation.c decode_bwe.c
mod_isac_la_SOURCES += decode.c division_operations.c dot_product_with_scale.c downsample_fast.c encode.c encode_lpc_swb.c energy.c entropy_coding.c
mod_isac_la_SOURCES += fft.c filter_ar.c filter_ar_fast_q12.c filterbanks.c filterbank_tables.c filter_functions.c filter_ma_fast_q12.c
mod_isac_la_SOURCES += get_hanning_window.c get_scaling_square.c ilbc_specific_functions.c intialize.c isac.c lattice.c levinson_durbin.c
mod_isac_la_SOURCES += lpc_analysis.c lpc_gain_swb_tables.c lpc_shape_swb12_tables.c lpc_shape_swb16_tables.c lpc_tables.c
mod_isac_la_SOURCES += lpc_to_refl_coef.c min_max_operations.c min_max_operations_neon.c pitch_estimator.c pitch_filter.c pitch_gain_tables.c
mod_isac_la_SOURCES += pitch_lag_tables.c randomization_functions.c refl_coef_to_lpc.c resample_48khz.c resample_by_2.c resample_by_2_internal.c
mod_isac_la_SOURCES += resample.c resample_fractional.c spectrum_ar_model_tables.c splitting_filter.c spl_sqrt.c spl_sqrt_floor.c spl_version.c
mod_isac_la_SOURCES += sqrt_of_one_minus_x_squared.c transform.c vector_scaling_operations.c webrtc_fft_t_1024_8.c webrtc_fft_t_rad.c
mod_isac_la_CFLAGS = $(AM_CFLAGS) -w -I.
mod_isac_la_LIBADD = $(switch_builddir)/libfreeswitch.la
mod_isac_la_LDFLAGS = -avoid-version -module -no-undefined -shared

View File

@ -1,24 +0,0 @@
Additional IP Rights Grant (Patents)
"This implementation" means the copyrightable works distributed by
Google as part of the WebRTC code package.
Google hereby grants to you a perpetual, worldwide, non-exclusive,
no-charge, irrevocable (except as stated in this section) patent
license to make, have made, use, offer to sell, sell, import,
transfer, and otherwise run, modify and propagate the contents of this
implementation of the WebRTC code package, where such license applies
only to those patent claims, both currently owned by Google and
acquired in the future, licensable by Google that are necessarily
infringed by this implementation of the WebRTC code package. This
grant does not include claims that would be infringed only as a
consequence of further modification of this implementation. If you or
your agent or exclusive licensee institute or order or agree to the
institution of patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that this
implementation of the WebRTC code package or any code incorporated
within this implementation of the WebRTC code package constitutes
direct or contributory patent infringement, or inducement of patent
infringement, then any patent rights granted to you under this License
for this implementation of the WebRTC code package shall terminate as
of the date such litigation is filed.

View File

@ -1,60 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
#include "arith_routines.h"
#include "settings.h"
/*
* terminate and return byte stream;
* returns the number of bytes in the stream
*/
int WebRtcIsac_EncTerminate(Bitstr *streamdata) /* in-/output struct containing bitstream */
{
WebRtc_UWord8 *stream_ptr;
/* point to the right place in the stream buffer */
stream_ptr = streamdata->stream + streamdata->stream_index;
/* find minimum length (determined by current interval width) */
if ( streamdata->W_upper > 0x01FFFFFF )
{
streamdata->streamval += 0x01000000;
/* add carry to buffer */
if (streamdata->streamval < 0x01000000)
{
/* propagate carry */
while ( !(++(*--stream_ptr)) );
/* put pointer back to the old value */
stream_ptr = streamdata->stream + streamdata->stream_index;
}
/* write remaining data to bitstream */
*stream_ptr++ = (WebRtc_UWord8) (streamdata->streamval >> 24);
}
else
{
streamdata->streamval += 0x00010000;
/* add carry to buffer */
if (streamdata->streamval < 0x00010000)
{
/* propagate carry */
while ( !(++(*--stream_ptr)) );
/* put pointer back to the old value */
stream_ptr = streamdata->stream + streamdata->stream_index;
}
/* write remaining data to bitstream */
*stream_ptr++ = (WebRtc_UWord8) (streamdata->streamval >> 24);
*stream_ptr++ = (WebRtc_UWord8) ((streamdata->streamval >> 16) & 0x00FF);
}
/* calculate stream length */
return (int)(stream_ptr - streamdata->stream);
}

View File

@ -1,63 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* arith_routines.h
*
* Functions for arithmetic coding.
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_
#include "structs.h"
int WebRtcIsac_EncLogisticMulti2(
Bitstr *streamdata, /* in-/output struct containing bitstream */
WebRtc_Word16 *dataQ7, /* input: data vector */
const WebRtc_UWord16 *env, /* input: side info vector defining the width of the pdf */
const int N, /* input: data vector length */
const WebRtc_Word16 isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
/* returns the number of bytes in the stream */
int WebRtcIsac_EncTerminate(Bitstr *streamdata); /* in-/output struct containing bitstream */
/* returns the number of bytes in the stream so far */
int WebRtcIsac_DecLogisticMulti2(
WebRtc_Word16 *data, /* output: data vector */
Bitstr *streamdata, /* in-/output struct containing bitstream */
const WebRtc_UWord16 *env, /* input: side info vector defining the width of the pdf */
const WebRtc_Word16 *dither, /* input: dither vector */
const int N, /* input: data vector length */
const WebRtc_Word16 isSWB12kHz); /* if the codec is working in 12kHz bandwidth */
void WebRtcIsac_EncHistMulti(
Bitstr *streamdata, /* in-/output struct containing bitstream */
const int *data, /* input: data vector */
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
const int N); /* input: data vector length */
int WebRtcIsac_DecHistBisectMulti(
int *data, /* output: data vector */
Bitstr *streamdata, /* in-/output struct containing bitstream */
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
const WebRtc_UWord16 *cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
const int N); /* input: data vector length */
int WebRtcIsac_DecHistOneStepMulti(
int *data, /* output: data vector */
Bitstr *streamdata, /* in-/output struct containing bitstream */
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
const WebRtc_UWord16 *init_index,/* input: vector of initial cdf table search entries */
const int N); /* input: data vector length */
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ARITH_ROUTINES_H_ */

View File

@ -1,291 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
#include "settings.h"
#include "arith_routines.h"
/*
* code symbols into arithmetic bytestream
*/
void WebRtcIsac_EncHistMulti(Bitstr *streamdata, /* in-/output struct containing bitstream */
const int *data, /* input: data vector */
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
const int N) /* input: data vector length */
{
WebRtc_UWord32 W_lower, W_upper;
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
WebRtc_UWord8 *stream_ptr;
WebRtc_UWord8 *stream_ptr_carry;
WebRtc_UWord32 cdf_lo, cdf_hi;
int k;
/* point to beginning of stream buffer */
stream_ptr = streamdata->stream + streamdata->stream_index;
W_upper = streamdata->W_upper;
for (k=N; k>0; k--)
{
/* fetch cdf_lower and cdf_upper from cdf tables */
cdf_lo = (WebRtc_UWord32) *(*cdf + *data);
cdf_hi = (WebRtc_UWord32) *(*cdf++ + *data++ + 1);
/* update interval */
W_upper_LSB = W_upper & 0x0000FFFF;
W_upper_MSB = W_upper >> 16;
W_lower = W_upper_MSB * cdf_lo;
W_lower += (W_upper_LSB * cdf_lo) >> 16;
W_upper = W_upper_MSB * cdf_hi;
W_upper += (W_upper_LSB * cdf_hi) >> 16;
/* shift interval such that it begins at zero */
W_upper -= ++W_lower;
/* add integer to bitstream */
streamdata->streamval += W_lower;
/* handle carry */
if (streamdata->streamval < W_lower)
{
/* propagate carry */
stream_ptr_carry = stream_ptr;
while (!(++(*--stream_ptr_carry)));
}
/* renormalize interval, store most significant byte of streamval and update streamval */
while ( !(W_upper & 0xFF000000) ) /* W_upper < 2^24 */
{
W_upper <<= 8;
*stream_ptr++ = (WebRtc_UWord8) (streamdata->streamval >> 24);
streamdata->streamval <<= 8;
}
}
/* calculate new stream_index */
streamdata->stream_index = (int)(stream_ptr - streamdata->stream);
streamdata->W_upper = W_upper;
return;
}
/*
* function to decode more symbols from the arithmetic bytestream, using method of bisection
* cdf tables should be of size 2^k-1 (which corresponds to an alphabet size of 2^k-2)
*/
int WebRtcIsac_DecHistBisectMulti(int *data, /* output: data vector */
Bitstr *streamdata, /* in-/output struct containing bitstream */
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
const WebRtc_UWord16 *cdf_size, /* input: array of cdf table sizes+1 (power of two: 2^k) */
const int N) /* input: data vector length */
{
WebRtc_UWord32 W_lower, W_upper;
WebRtc_UWord32 W_tmp;
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
WebRtc_UWord32 streamval;
const WebRtc_UWord8 *stream_ptr;
const WebRtc_UWord16 *cdf_ptr;
int size_tmp;
int k;
W_lower = 0; //to remove warning -DH
stream_ptr = streamdata->stream + streamdata->stream_index;
W_upper = streamdata->W_upper;
if (W_upper == 0)
/* Should not be possible in normal operation */
return -2;
if (streamdata->stream_index == 0) /* first time decoder is called for this stream */
{
/* read first word from bytestream */
streamval = *stream_ptr << 24;
streamval |= *++stream_ptr << 16;
streamval |= *++stream_ptr << 8;
streamval |= *++stream_ptr;
} else {
streamval = streamdata->streamval;
}
for (k=N; k>0; k--)
{
/* find the integer *data for which streamval lies in [W_lower+1, W_upper] */
W_upper_LSB = W_upper & 0x0000FFFF;
W_upper_MSB = W_upper >> 16;
/* start halfway the cdf range */
size_tmp = *cdf_size++ >> 1;
cdf_ptr = *cdf + (size_tmp - 1);
/* method of bisection */
for ( ;; )
{
W_tmp = W_upper_MSB * *cdf_ptr;
W_tmp += (W_upper_LSB * *cdf_ptr) >> 16;
size_tmp >>= 1;
if (size_tmp == 0) break;
if (streamval > W_tmp)
{
W_lower = W_tmp;
cdf_ptr += size_tmp;
} else {
W_upper = W_tmp;
cdf_ptr -= size_tmp;
}
}
if (streamval > W_tmp)
{
W_lower = W_tmp;
*data++ = (int)(cdf_ptr - *cdf++);
} else {
W_upper = W_tmp;
*data++ = (int)(cdf_ptr - *cdf++ - 1);
}
/* shift interval to start at zero */
W_upper -= ++W_lower;
/* add integer to bitstream */
streamval -= W_lower;
/* renormalize interval and update streamval */
while ( !(W_upper & 0xFF000000) ) /* W_upper < 2^24 */
{
/* read next byte from stream */
streamval = (streamval << 8) | *++stream_ptr;
W_upper <<= 8;
}
if (W_upper == 0)
/* Should not be possible in normal operation */
return -2;
}
streamdata->stream_index = (int)(stream_ptr - streamdata->stream);
streamdata->W_upper = W_upper;
streamdata->streamval = streamval;
/* find number of bytes in original stream (determined by current interval width) */
if ( W_upper > 0x01FFFFFF )
return streamdata->stream_index - 2;
else
return streamdata->stream_index - 1;
}
/*
* function to decode more symbols from the arithmetic bytestream, taking single step up or
* down at a time
* cdf tables can be of arbitrary size, but large tables may take a lot of iterations
*/
int WebRtcIsac_DecHistOneStepMulti(int *data, /* output: data vector */
Bitstr *streamdata, /* in-/output struct containing bitstream */
const WebRtc_UWord16 **cdf, /* input: array of cdf arrays */
const WebRtc_UWord16 *init_index, /* input: vector of initial cdf table search entries */
const int N) /* input: data vector length */
{
WebRtc_UWord32 W_lower, W_upper;
WebRtc_UWord32 W_tmp;
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
WebRtc_UWord32 streamval;
const WebRtc_UWord8 *stream_ptr;
const WebRtc_UWord16 *cdf_ptr;
int k;
stream_ptr = streamdata->stream + streamdata->stream_index;
W_upper = streamdata->W_upper;
if (W_upper == 0)
/* Should not be possible in normal operation */
return -2;
if (streamdata->stream_index == 0) /* first time decoder is called for this stream */
{
/* read first word from bytestream */
streamval = *stream_ptr << 24;
streamval |= *++stream_ptr << 16;
streamval |= *++stream_ptr << 8;
streamval |= *++stream_ptr;
} else {
streamval = streamdata->streamval;
}
for (k=N; k>0; k--)
{
/* find the integer *data for which streamval lies in [W_lower+1, W_upper] */
W_upper_LSB = W_upper & 0x0000FFFF;
W_upper_MSB = W_upper >> 16;
/* start at the specified table entry */
cdf_ptr = *cdf + (*init_index++);
W_tmp = W_upper_MSB * *cdf_ptr;
W_tmp += (W_upper_LSB * *cdf_ptr) >> 16;
if (streamval > W_tmp)
{
for ( ;; )
{
W_lower = W_tmp;
if (cdf_ptr[0]==65535)
/* range check */
return -3;
W_tmp = W_upper_MSB * *++cdf_ptr;
W_tmp += (W_upper_LSB * *cdf_ptr) >> 16;
if (streamval <= W_tmp) break;
}
W_upper = W_tmp;
*data++ = (int)(cdf_ptr - *cdf++ - 1);
} else {
for ( ;; )
{
W_upper = W_tmp;
--cdf_ptr;
if (cdf_ptr<*cdf) {
/* range check */
return -3;
}
W_tmp = W_upper_MSB * *cdf_ptr;
W_tmp += (W_upper_LSB * *cdf_ptr) >> 16;
if (streamval > W_tmp) break;
}
W_lower = W_tmp;
*data++ = (int)(cdf_ptr - *cdf++);
}
/* shift interval to start at zero */
W_upper -= ++W_lower;
/* add integer to bitstream */
streamval -= W_lower;
/* renormalize interval and update streamval */
while ( !(W_upper & 0xFF000000) ) /* W_upper < 2^24 */
{
/* read next byte from stream */
streamval = (streamval << 8) | *++stream_ptr;
W_upper <<= 8;
}
}
streamdata->stream_index = (int)(stream_ptr - streamdata->stream);
streamdata->W_upper = W_upper;
streamdata->streamval = streamval;
/* find number of bytes in original stream (determined by current interval width) */
if ( W_upper > 0x01FFFFFF )
return streamdata->stream_index - 2;
else
return streamdata->stream_index - 1;
}

View File

@ -1,294 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* arith_routines.h
*
* This file contains functions for arithmatically encoding and
* decoding DFT coefficients.
*
*/
#include "arith_routines.h"
static const WebRtc_Word32 kHistEdgesQ15[51] = {
-327680, -314573, -301466, -288359, -275252, -262144, -249037, -235930, -222823, -209716,
-196608, -183501, -170394, -157287, -144180, -131072, -117965, -104858, -91751, -78644,
-65536, -52429, -39322, -26215, -13108, 0, 13107, 26214, 39321, 52428,
65536, 78643, 91750, 104857, 117964, 131072, 144179, 157286, 170393, 183500,
196608, 209715, 222822, 235929, 249036, 262144, 275251, 288358, 301465, 314572,
327680};
static const int kCdfSlopeQ0[51] = { /* Q0 */
5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 13, 23, 47, 87, 154, 315, 700, 1088,
2471, 6064, 14221, 21463, 36634, 36924, 19750, 13270, 5806, 2312,
1095, 660, 316, 145, 86, 41, 32, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 0};
static const int kCdfQ16[51] = { /* Q16 */
0, 2, 4, 6, 8, 10, 12, 14, 16, 18,
20, 22, 24, 29, 38, 57, 92, 153, 279, 559,
994, 1983, 4408, 10097, 18682, 33336, 48105, 56005, 61313, 63636,
64560, 64998, 65262, 65389, 65447, 65481, 65497, 65510, 65512, 65514,
65516, 65518, 65520, 65522, 65524, 65526, 65528, 65530, 65532, 65534,
65535};
/* function to be converted to fixed point */
static __inline WebRtc_UWord32 piecewise(WebRtc_Word32 xinQ15) {
WebRtc_Word32 ind, qtmp1, qtmp2, qtmp3;
WebRtc_UWord32 tmpUW32;
qtmp2 = xinQ15;
if (qtmp2 < kHistEdgesQ15[0]) {
qtmp2 = kHistEdgesQ15[0];
}
if (qtmp2 > kHistEdgesQ15[50]) {
qtmp2 = kHistEdgesQ15[50];
}
qtmp1 = qtmp2 - kHistEdgesQ15[0]; /* Q15 - Q15 = Q15 */
ind = (qtmp1 * 5) >> 16; /* 2^16 / 5 = 0.4 in Q15 */
/* Q15 -> Q0 */
qtmp1 = qtmp2 - kHistEdgesQ15[ind]; /* Q15 - Q15 = Q15 */
qtmp2 = kCdfSlopeQ0[ind] * qtmp1; /* Q0 * Q15 = Q15 */
qtmp3 = qtmp2>>15; /* Q15 -> Q0 */
tmpUW32 = kCdfQ16[ind] + qtmp3; /* Q0 + Q0 = Q0 */
return tmpUW32;
}
int WebRtcIsac_EncLogisticMulti2(
Bitstr *streamdata, /* in-/output struct containing bitstream */
WebRtc_Word16 *dataQ7, /* input: data vector */
const WebRtc_UWord16 *envQ8, /* input: side info vector defining the width of the pdf */
const int N, /* input: data vector length / 2 */
const WebRtc_Word16 isSWB12kHz)
{
WebRtc_UWord32 W_lower, W_upper;
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
WebRtc_UWord8 *stream_ptr;
WebRtc_UWord8 *maxStreamPtr;
WebRtc_UWord8 *stream_ptr_carry;
WebRtc_UWord32 cdf_lo, cdf_hi;
int k;
/* point to beginning of stream buffer */
stream_ptr = streamdata->stream + streamdata->stream_index;
W_upper = streamdata->W_upper;
maxStreamPtr = streamdata->stream + STREAM_SIZE_MAX_60 - 1;
for (k = 0; k < N; k++)
{
/* compute cdf_lower and cdf_upper by evaluating the piecewise linear cdf */
cdf_lo = piecewise((*dataQ7 - 64) * *envQ8);
cdf_hi = piecewise((*dataQ7 + 64) * *envQ8);
/* test and clip if probability gets too small */
while (cdf_lo+1 >= cdf_hi) {
/* clip */
if (*dataQ7 > 0) {
*dataQ7 -= 128;
cdf_hi = cdf_lo;
cdf_lo = piecewise((*dataQ7 - 64) * *envQ8);
} else {
*dataQ7 += 128;
cdf_lo = cdf_hi;
cdf_hi = piecewise((*dataQ7 + 64) * *envQ8);
}
}
dataQ7++;
// increment only once per 4 iterations for SWB-16kHz or WB
// increment only once per 2 iterations for SWB-12kHz
envQ8 += (isSWB12kHz)? (k & 1):((k & 1) & (k >> 1));
/* update interval */
W_upper_LSB = W_upper & 0x0000FFFF;
W_upper_MSB = W_upper >> 16;
W_lower = W_upper_MSB * cdf_lo;
W_lower += (W_upper_LSB * cdf_lo) >> 16;
W_upper = W_upper_MSB * cdf_hi;
W_upper += (W_upper_LSB * cdf_hi) >> 16;
/* shift interval such that it begins at zero */
W_upper -= ++W_lower;
/* add integer to bitstream */
streamdata->streamval += W_lower;
/* handle carry */
if (streamdata->streamval < W_lower)
{
/* propagate carry */
stream_ptr_carry = stream_ptr;
while (!(++(*--stream_ptr_carry)));
}
/* renormalize interval, store most significant byte of streamval and update streamval */
while ( !(W_upper & 0xFF000000) ) /* W_upper < 2^24 */
{
W_upper <<= 8;
*stream_ptr++ = (WebRtc_UWord8) (streamdata->streamval >> 24);
if(stream_ptr > maxStreamPtr)
{
return -ISAC_DISALLOWED_BITSTREAM_LENGTH;
}
streamdata->streamval <<= 8;
}
}
/* calculate new stream_index */
streamdata->stream_index = (int)(stream_ptr - streamdata->stream);
streamdata->W_upper = W_upper;
return 0;
}
int WebRtcIsac_DecLogisticMulti2(
WebRtc_Word16 *dataQ7, /* output: data vector */
Bitstr *streamdata, /* in-/output struct containing bitstream */
const WebRtc_UWord16 *envQ8, /* input: side info vector defining the width of the pdf */
const WebRtc_Word16 *ditherQ7,/* input: dither vector */
const int N, /* input: data vector length */
const WebRtc_Word16 isSWB12kHz)
{
WebRtc_UWord32 W_lower, W_upper;
WebRtc_UWord32 W_tmp;
WebRtc_UWord32 W_upper_LSB, W_upper_MSB;
WebRtc_UWord32 streamval;
const WebRtc_UWord8 *stream_ptr;
WebRtc_UWord32 cdf_tmp;
WebRtc_Word16 candQ7;
int k;
stream_ptr = streamdata->stream + streamdata->stream_index;
W_upper = streamdata->W_upper;
if (streamdata->stream_index == 0) /* first time decoder is called for this stream */
{
/* read first word from bytestream */
streamval = *stream_ptr << 24;
streamval |= *++stream_ptr << 16;
streamval |= *++stream_ptr << 8;
streamval |= *++stream_ptr;
} else {
streamval = streamdata->streamval;
}
for (k = 0; k < N; k++)
{
/* find the integer *data for which streamval lies in [W_lower+1, W_upper] */
W_upper_LSB = W_upper & 0x0000FFFF;
W_upper_MSB = W_upper >> 16;
/* find first candidate by inverting the logistic cdf */
candQ7 = - *ditherQ7 + 64;
cdf_tmp = piecewise(candQ7 * *envQ8);
W_tmp = W_upper_MSB * cdf_tmp;
W_tmp += (W_upper_LSB * cdf_tmp) >> 16;
if (streamval > W_tmp)
{
W_lower = W_tmp;
candQ7 += 128;
cdf_tmp = piecewise(candQ7 * *envQ8);
W_tmp = W_upper_MSB * cdf_tmp;
W_tmp += (W_upper_LSB * cdf_tmp) >> 16;
while (streamval > W_tmp)
{
W_lower = W_tmp;
candQ7 += 128;
cdf_tmp = piecewise(candQ7 * *envQ8);
W_tmp = W_upper_MSB * cdf_tmp;
W_tmp += (W_upper_LSB * cdf_tmp) >> 16;
/* error check */
if (W_lower == W_tmp) return -1;
}
W_upper = W_tmp;
/* another sample decoded */
*dataQ7 = candQ7 - 64;
}
else
{
W_upper = W_tmp;
candQ7 -= 128;
cdf_tmp = piecewise(candQ7 * *envQ8);
W_tmp = W_upper_MSB * cdf_tmp;
W_tmp += (W_upper_LSB * cdf_tmp) >> 16;
while ( !(streamval > W_tmp) )
{
W_upper = W_tmp;
candQ7 -= 128;
cdf_tmp = piecewise(candQ7 * *envQ8);
W_tmp = W_upper_MSB * cdf_tmp;
W_tmp += (W_upper_LSB * cdf_tmp) >> 16;
/* error check */
if (W_upper == W_tmp) return -1;
}
W_lower = W_tmp;
/* another sample decoded */
*dataQ7 = candQ7 + 64;
}
ditherQ7++;
dataQ7++;
// increment only once per 4 iterations for SWB-16kHz or WB
// increment only once per 2 iterations for SWB-12kHz
envQ8 += (isSWB12kHz)? (k & 1):((k & 1) & (k >> 1));
/* shift interval to start at zero */
W_upper -= ++W_lower;
/* add integer to bitstream */
streamval -= W_lower;
/* renormalize interval and update streamval */
while ( !(W_upper & 0xFF000000) ) /* W_upper < 2^24 */
{
/* read next byte from stream */
streamval = (streamval << 8) | *++stream_ptr;
W_upper <<= 8;
}
}
streamdata->stream_index = (int)(stream_ptr - streamdata->stream);
streamdata->W_upper = W_upper;
streamdata->streamval = streamval;
/* find number of bytes in original stream (determined by current interval width) */
if ( W_upper > 0x01FFFFFF )
return streamdata->stream_index - 2;
else
return streamdata->stream_index - 1;
}

View File

@ -1,103 +0,0 @@
/*
* 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.
*/
/*
* This file contains the function WebRtcSpl_AutoCorrToReflCoef().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_AutoCorrToReflCoef(G_CONST WebRtc_Word32 *R, int use_order, WebRtc_Word16 *K)
{
int i, n;
WebRtc_Word16 tmp;
G_CONST WebRtc_Word32 *rptr;
WebRtc_Word32 L_num, L_den;
WebRtc_Word16 *acfptr, *pptr, *wptr, *p1ptr, *w1ptr, ACF[WEBRTC_SPL_MAX_LPC_ORDER],
P[WEBRTC_SPL_MAX_LPC_ORDER], W[WEBRTC_SPL_MAX_LPC_ORDER];
// Initialize loop and pointers.
acfptr = ACF;
rptr = R;
pptr = P;
p1ptr = &P[1];
w1ptr = &W[1];
wptr = w1ptr;
// First loop; n=0. Determine shifting.
tmp = WebRtcSpl_NormW32(*R);
*acfptr = (WebRtc_Word16)((*rptr++ << tmp) >> 16);
*pptr++ = *acfptr++;
// Initialize ACF, P and W.
for (i = 1; i <= use_order; i++)
{
*acfptr = (WebRtc_Word16)((*rptr++ << tmp) >> 16);
*wptr++ = *acfptr;
*pptr++ = *acfptr++;
}
// Compute reflection coefficients.
for (n = 1; n <= use_order; n++, K++)
{
tmp = WEBRTC_SPL_ABS_W16(*p1ptr);
if (*P < tmp)
{
for (i = n; i <= use_order; i++)
*K++ = 0;
return;
}
// Division: WebRtcSpl_div(tmp, *P)
*K = 0;
if (tmp != 0)
{
L_num = tmp;
L_den = *P;
i = 15;
while (i--)
{
(*K) <<= 1;
L_num <<= 1;
if (L_num >= L_den)
{
L_num -= L_den;
(*K)++;
}
}
if (*p1ptr > 0)
*K = -*K;
}
// Last iteration; don't do Schur recursion.
if (n == use_order)
return;
// Schur recursion.
pptr = P;
wptr = w1ptr;
tmp = (WebRtc_Word16)(((WebRtc_Word32)*p1ptr * (WebRtc_Word32)*K + 16384) >> 15);
*pptr = WEBRTC_SPL_ADD_SAT_W16( *pptr, tmp );
pptr++;
for (i = 1; i <= use_order - n; i++)
{
tmp = (WebRtc_Word16)(((WebRtc_Word32)*wptr * (WebRtc_Word32)*K + 16384) >> 15);
*pptr = WEBRTC_SPL_ADD_SAT_W16( *(pptr+1), tmp );
pptr++;
tmp = (WebRtc_Word16)(((WebRtc_Word32)*pptr * (WebRtc_Word32)*K + 16384) >> 15);
*wptr = WEBRTC_SPL_ADD_SAT_W16( *wptr, tmp );
wptr++;
}
}
}

View File

@ -1,141 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_AutoCorrelation().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
int WebRtcSpl_AutoCorrelation(G_CONST WebRtc_Word16* in_vector,
int in_vector_length,
int order,
WebRtc_Word32* result,
int* scale)
{
WebRtc_Word32 sum;
int i, j;
WebRtc_Word16 smax; // Sample max
G_CONST WebRtc_Word16* xptr1;
G_CONST WebRtc_Word16* xptr2;
WebRtc_Word32* resultptr;
int scaling = 0;
#ifdef _ARM_OPT_
#pragma message("NOTE: _ARM_OPT_ optimizations are used")
WebRtc_Word16 loops4;
#endif
if (order < 0)
order = in_vector_length;
// Find the max. sample
smax = WebRtcSpl_MaxAbsValueW16(in_vector, in_vector_length);
// In order to avoid overflow when computing the sum we should scale the samples so that
// (in_vector_length * smax * smax) will not overflow.
if (smax == 0)
{
scaling = 0;
} else
{
int nbits = WebRtcSpl_GetSizeInBits(in_vector_length); // # of bits in the sum loop
int t = WebRtcSpl_NormW32(WEBRTC_SPL_MUL(smax, smax)); // # of bits to normalize smax
if (t > nbits)
{
scaling = 0;
} else
{
scaling = nbits - t;
}
}
resultptr = result;
// Perform the actual correlation calculation
for (i = 0; i < order + 1; i++)
{
int loops = (in_vector_length - i);
sum = 0;
xptr1 = in_vector;
xptr2 = &in_vector[i];
#ifndef _ARM_OPT_
for (j = loops; j > 0; j--)
{
sum += WEBRTC_SPL_MUL_16_16_RSFT(*xptr1++, *xptr2++, scaling);
}
#else
loops4 = (loops >> 2) << 2;
if (scaling == 0)
{
for (j = 0; j < loops4; j = j + 4)
{
sum += WEBRTC_SPL_MUL_16_16(*xptr1, *xptr2);
xptr1++;
xptr2++;
sum += WEBRTC_SPL_MUL_16_16(*xptr1, *xptr2);
xptr1++;
xptr2++;
sum += WEBRTC_SPL_MUL_16_16(*xptr1, *xptr2);
xptr1++;
xptr2++;
sum += WEBRTC_SPL_MUL_16_16(*xptr1, *xptr2);
xptr1++;
xptr2++;
}
for (j = loops4; j < loops; j++)
{
sum += WEBRTC_SPL_MUL_16_16(*xptr1, *xptr2);
xptr1++;
xptr2++;
}
}
else
{
for (j = 0; j < loops4; j = j + 4)
{
sum += WEBRTC_SPL_MUL_16_16_RSFT(*xptr1, *xptr2, scaling);
xptr1++;
xptr2++;
sum += WEBRTC_SPL_MUL_16_16_RSFT(*xptr1, *xptr2, scaling);
xptr1++;
xptr2++;
sum += WEBRTC_SPL_MUL_16_16_RSFT(*xptr1, *xptr2, scaling);
xptr1++;
xptr2++;
sum += WEBRTC_SPL_MUL_16_16_RSFT(*xptr1, *xptr2, scaling);
xptr1++;
xptr2++;
}
for (j = loops4; j < loops; j++)
{
sum += WEBRTC_SPL_MUL_16_16_RSFT(*xptr1, *xptr2, scaling);
xptr1++;
xptr2++;
}
}
#endif
*resultptr++ = sum;
}
*scale = scaling;
return order + 1;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,177 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* bandwidth_estimator.h
*
* This header file contains the API for the Bandwidth Estimator
* designed for iSAC.
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_
#include "structs.h"
#include "settings.h"
#define MIN_ISAC_BW 10000
#define MIN_ISAC_BW_LB 10000
#define MIN_ISAC_BW_UB 25000
#define MAX_ISAC_BW 56000
#define MAX_ISAC_BW_UB 32000
#define MAX_ISAC_BW_LB 32000
#define MIN_ISAC_MD 5
#define MAX_ISAC_MD 25
// assumed header size, in bytes; we don't know the exact number
// (header compression may be used)
#define HEADER_SIZE 35
// Initial Frame-Size, in ms, for Wideband & Super-Wideband Mode
#define INIT_FRAME_LEN_WB 60
#define INIT_FRAME_LEN_SWB 30
// Initial Bottleneck Estimate, in bits/sec, for
// Wideband & Super-wideband mode
#define INIT_BN_EST_WB 20e3f
#define INIT_BN_EST_SWB 56e3f
// Initial Header rate (header rate depends on frame-size),
// in bits/sec, for Wideband & Super-Wideband mode.
#define INIT_HDR_RATE_WB \
((float)HEADER_SIZE * 8.0f * 1000.0f / (float)INIT_FRAME_LEN_WB)
#define INIT_HDR_RATE_SWB \
((float)HEADER_SIZE * 8.0f * 1000.0f / (float)INIT_FRAME_LEN_SWB)
// number of packets in a row for a high rate burst
#define BURST_LEN 3
// ms, max time between two full bursts
#define BURST_INTERVAL 500
// number of packets in a row for initial high rate burst
#define INIT_BURST_LEN 5
// bits/s, rate for the first BURST_LEN packets
#define INIT_RATE_WB INIT_BN_EST_WB
#define INIT_RATE_SWB INIT_BN_EST_SWB
#if defined(__cplusplus)
extern "C" {
#endif
/* This function initializes the struct */
/* to be called before using the struct for anything else */
/* returns 0 if everything went fine, -1 otherwise */
WebRtc_Word32 WebRtcIsac_InitBandwidthEstimator(
BwEstimatorstr* bwest_str,
enum IsacSamplingRate encoderSampRate,
enum IsacSamplingRate decoderSampRate);
/* This function updates the receiving estimate */
/* Parameters: */
/* rtp_number - value from RTP packet, from NetEq */
/* frame length - length of signal frame in ms, from iSAC decoder */
/* send_ts - value in RTP header giving send time in samples */
/* arr_ts - value given by timeGetTime() time of arrival in samples of packet from NetEq */
/* pksize - size of packet in bytes, from NetEq */
/* Index - integer (range 0...23) indicating bottle neck & jitter as estimated by other side */
/* returns 0 if everything went fine, -1 otherwise */
WebRtc_Word16 WebRtcIsac_UpdateBandwidthEstimator(
BwEstimatorstr* bwest_str,
const WebRtc_UWord16 rtp_number,
const WebRtc_Word32 frame_length,
const WebRtc_UWord32 send_ts,
const WebRtc_UWord32 arr_ts,
const WebRtc_Word32 pksize);
/* Update receiving estimates. Used when we only receive BWE index, no iSAC data packet. */
WebRtc_Word16 WebRtcIsac_UpdateUplinkBwImpl(
BwEstimatorstr* bwest_str,
WebRtc_Word16 Index,
enum IsacSamplingRate encoderSamplingFreq);
/* Returns the bandwidth/jitter estimation code (integer 0...23) to put in the sending iSAC payload */
WebRtc_UWord16 WebRtcIsac_GetDownlinkBwJitIndexImpl(
BwEstimatorstr* bwest_str,
WebRtc_Word16* bottleneckIndex,
WebRtc_Word16* jitterInfo,
enum IsacSamplingRate decoderSamplingFreq);
/* Returns the bandwidth estimation (in bps) */
WebRtc_Word32 WebRtcIsac_GetDownlinkBandwidth(
const BwEstimatorstr *bwest_str);
/* Returns the max delay (in ms) */
WebRtc_Word32 WebRtcIsac_GetDownlinkMaxDelay(
const BwEstimatorstr *bwest_str);
/* Returns the bandwidth that iSAC should send with in bps */
void WebRtcIsac_GetUplinkBandwidth(
const BwEstimatorstr* bwest_str,
WebRtc_Word32* bitRate);
/* Returns the max delay value from the other side in ms */
WebRtc_Word32 WebRtcIsac_GetUplinkMaxDelay(
const BwEstimatorstr *bwest_str);
/*
* update amount of data in bottle neck buffer and burst handling
* returns minimum payload size (bytes)
*/
int WebRtcIsac_GetMinBytes(
RateModel* State,
int StreamSize, /* bytes in bitstream */
const int FrameLen, /* ms per frame */
const double BottleNeck, /* bottle neck rate; excl headers (bps) */
const double DelayBuildUp, /* max delay from bottleneck buffering (ms) */
enum ISACBandwidth bandwidth
/*,WebRtc_Word16 frequentLargePackets*/);
/*
* update long-term average bitrate and amount of data in buffer
*/
void WebRtcIsac_UpdateRateModel(
RateModel* State,
int StreamSize, /* bytes in bitstream */
const int FrameSamples, /* samples per frame */
const double BottleNeck); /* bottle neck rate; excl headers (bps) */
void WebRtcIsac_InitRateModel(
RateModel *State);
/* Returns the new framelength value (input argument: bottle_neck) */
int WebRtcIsac_GetNewFrameLength(
double bottle_neck,
int current_framelength);
/* Returns the new SNR value (input argument: bottle_neck) */
double WebRtcIsac_GetSnr(
double bottle_neck,
int new_framelength);
WebRtc_Word16 WebRtcIsac_UpdateUplinkJitter(
BwEstimatorstr* bwest_str,
WebRtc_Word32 index);
#if defined(__cplusplus)
}
#endif
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_BANDWIDTH_ESTIMATOR_H_ */

View File

@ -1,292 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* codec.h
*
* This header file contains the calls to the internal encoder
* and decoder functions.
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CODEC_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CODEC_H_
#include "structs.h"
int WebRtcIsac_EstimateBandwidth(
BwEstimatorstr* bwest_str,
Bitstr* streamdata,
WebRtc_Word32 packet_size,
WebRtc_UWord16 rtp_seq_number,
WebRtc_UWord32 send_ts,
WebRtc_UWord32 arr_ts,
enum IsacSamplingRate encoderSampRate,
enum IsacSamplingRate decoderSampRate);
int WebRtcIsac_DecodeLb(
float* signal_out,
ISACLBDecStruct* ISACdec_obj,
WebRtc_Word16* current_framesamples,
WebRtc_Word16 isRCUPayload);
int WebRtcIsac_DecodeRcuLb(
float* signal_out,
ISACLBDecStruct* ISACdec_obj,
WebRtc_Word16* current_framesamples);
int WebRtcIsac_EncodeLb(
float* in,
ISACLBEncStruct* ISACencLB_obj,
WebRtc_Word16 codingMode,
WebRtc_Word16 bottleneckIndex);
int WebRtcIsac_EncodeStoredDataLb(
const ISAC_SaveEncData_t* ISACSavedEnc_obj,
Bitstr* ISACBitStr_obj,
int BWnumber,
float scale);
int WebRtcIsac_EncodeStoredDataUb12(
const ISACUBSaveEncDataStruct* ISACSavedEnc_obj,
Bitstr* bitStream,
WebRtc_Word32 jitterInfo,
float scale);
int WebRtcIsac_EncodeStoredDataUb16(
const ISACUBSaveEncDataStruct* ISACSavedEnc_obj,
Bitstr* bitStream,
WebRtc_Word32 jitterInfo,
float scale);
WebRtc_Word16 WebRtcIsac_GetRedPayloadUb(
const ISACUBSaveEncDataStruct* ISACSavedEncObj,
Bitstr* bitStreamObj,
enum ISACBandwidth bandwidth);
/******************************************************************************
* WebRtcIsac_RateAllocation()
* Internal function to perform a rate-allocation for upper and lower-band,
* given a total rate.
*
* Input:
* - inRateBitPerSec : a total bit-rate in bits/sec.
*
* Output:
* - rateLBBitPerSec : a bit-rate allocated to the lower-band
* in bits/sec.
* - rateUBBitPerSec : a bit-rate allocated to the upper-band
* in bits/sec.
*
* Return value : 0 if rate allocation has been successful.
* -1 if failed to allocate rates.
*/
WebRtc_Word16
WebRtcIsac_RateAllocation(
WebRtc_Word32 inRateBitPerSec,
double* rateLBBitPerSec,
double* rateUBBitPerSec,
enum ISACBandwidth* bandwidthKHz);
/******************************************************************************
* WebRtcIsac_DecodeUb16()
*
* Decode the upper-band if the codec is in 0-16 kHz mode.
*
* Input/Output:
* -ISACdec_obj : pointer to the upper-band decoder object. The
* bit-stream is stored inside the decoder object.
*
* Output:
* -signal_out : decoded audio, 480 samples 30 ms.
*
* Return value : >0 number of decoded bytes.
* <0 if an error occurred.
*/
int WebRtcIsac_DecodeUb16(
float* signal_out,
ISACUBDecStruct* ISACdec_obj,
WebRtc_Word16 isRCUPayload);
/******************************************************************************
* WebRtcIsac_DecodeUb12()
*
* Decode the upper-band if the codec is in 0-12 kHz mode.
*
* Input/Output:
* -ISACdec_obj : pointer to the upper-band decoder object. The
* bit-stream is stored inside the decoder object.
*
* Output:
* -signal_out : decoded audio, 480 samples 30 ms.
*
* Return value : >0 number of decoded bytes.
* <0 if an error occurred.
*/
int WebRtcIsac_DecodeUb12(
float* signal_out,
ISACUBDecStruct* ISACdec_obj,
WebRtc_Word16 isRCUPayload);
/******************************************************************************
* WebRtcIsac_EncodeUb16()
*
* Encode the upper-band if the codec is in 0-16 kHz mode.
*
* Input:
* -in : upper-band audio, 160 samples (10 ms).
*
* Input/Output:
* -ISACdec_obj : pointer to the upper-band encoder object. The
* bit-stream is stored inside the encoder object.
*
* Return value : >0 number of encoded bytes.
* <0 if an error occurred.
*/
int WebRtcIsac_EncodeUb16(
float* in,
ISACUBEncStruct* ISACenc_obj,
WebRtc_Word32 jitterInfo);
/******************************************************************************
* WebRtcIsac_EncodeUb12()
*
* Encode the upper-band if the codec is in 0-12 kHz mode.
*
* Input:
* -in : upper-band audio, 160 samples (10 ms).
*
* Input/Output:
* -ISACdec_obj : pointer to the upper-band encoder object. The
* bit-stream is stored inside the encoder object.
*
* Return value : >0 number of encoded bytes.
* <0 if an error occurred.
*/
int WebRtcIsac_EncodeUb12(
float* in,
ISACUBEncStruct* ISACenc_obj,
WebRtc_Word32 jitterInfo);
/************************** initialization functions *************************/
void WebRtcIsac_InitMasking(MaskFiltstr *maskdata);
void WebRtcIsac_InitPreFilterbank(PreFiltBankstr *prefiltdata);
void WebRtcIsac_InitPostFilterbank(PostFiltBankstr *postfiltdata);
void WebRtcIsac_InitPitchFilter(PitchFiltstr *pitchfiltdata);
void WebRtcIsac_InitPitchAnalysis(PitchAnalysisStruct *State);
/**************************** transform functions ****************************/
void WebRtcIsac_InitTransform();
void WebRtcIsac_Time2Spec(double *inre1,
double *inre2,
WebRtc_Word16 *outre,
WebRtc_Word16 *outim,
FFTstr *fftstr_obj);
void WebRtcIsac_Spec2time(double *inre,
double *inim,
double *outre1,
double *outre2,
FFTstr *fftstr_obj);
/******************************* filter functions ****************************/
void WebRtcIsac_AllPoleFilter(double *InOut,
double *Coef,
int lengthInOut,
int orderCoef);
void WebRtcIsac_AllZeroFilter(double *In,
double *Coef,
int lengthInOut,
int orderCoef,
double *Out);
void WebRtcIsac_ZeroPoleFilter(double *In,
double *ZeroCoef,
double *PoleCoef,
int lengthInOut,
int orderCoef,
double *Out);
/***************************** filterbank functions **************************/
void WebRtcIsac_SplitAndFilter(double *in,
double *LP,
double *HP,
double *LP_la,
double *HP_la,
PreFiltBankstr *prefiltdata);
void WebRtcIsac_FilterAndCombine(double *InLP,
double *InHP,
double *Out,
PostFiltBankstr *postfiltdata);
void WebRtcIsac_SplitAndFilterFloat(float *in,
float *LP,
float *HP,
double *LP_la,
double *HP_la,
PreFiltBankstr *prefiltdata);
void WebRtcIsac_FilterAndCombineFloat(float *InLP,
float *InHP,
float *Out,
PostFiltBankstr *postfiltdata);
/************************* normalized lattice filters ************************/
void WebRtcIsac_NormLatticeFilterMa(int orderCoef,
float *stateF,
float *stateG,
float *lat_in,
double *filtcoeflo,
double *lat_out);
void WebRtcIsac_NormLatticeFilterAr(int orderCoef,
float *stateF,
float *stateG,
double *lat_in,
double *lo_filt_coef,
float *lat_out);
void WebRtcIsac_Dir2Lat(double *a,
int orderCoef,
float *sth,
float *cth);
void WebRtcIsac_AutoCorr(double *r,
const double *x,
int N,
int order);
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CODEC_H_ */

View File

@ -1,51 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_ComplexBitReverse().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ComplexBitReverse(WebRtc_Word16 frfi[], int stages)
{
int mr, nn, n, l, m;
WebRtc_Word16 tr, ti;
n = 1 << stages;
mr = 0;
nn = n - 1;
// decimation in time - re-order data
for (m = 1; m <= nn; ++m)
{
l = n;
do
{
l >>= 1;
} while (mr + l > nn);
mr = (mr & (l - 1)) + l;
if (mr <= m)
continue;
tr = frfi[2 * m];
frfi[2 * m] = frfi[2 * mr];
frfi[2 * mr] = tr;
ti = frfi[2 * m + 1];
frfi[2 * m + 1] = frfi[2 * mr + 1];
frfi[2 * mr + 1] = ti;
}
}

View File

@ -1,425 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_ComplexFFT().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#define CFFTSFT 14
#define CFFTRND 1
#define CFFTRND2 16384
#define CIFFTSFT 14
#define CIFFTRND 1
static const WebRtc_Word16 kSinTable1024[] = {
0, 201, 402, 603, 804, 1005, 1206, 1406,
1607, 1808, 2009, 2209, 2410, 2610, 2811, 3011,
3211, 3411, 3611, 3811, 4011, 4210, 4409, 4608,
4807, 5006, 5205, 5403, 5601, 5799, 5997, 6195,
6392, 6589, 6786, 6982, 7179, 7375, 7571, 7766,
7961, 8156, 8351, 8545, 8739, 8932, 9126, 9319,
9511, 9703, 9895, 10087, 10278, 10469, 10659, 10849,
11038, 11227, 11416, 11604, 11792, 11980, 12166, 12353,
12539, 12724, 12909, 13094, 13278, 13462, 13645, 13827,
14009, 14191, 14372, 14552, 14732, 14911, 15090, 15268,
15446, 15623, 15799, 15975, 16150, 16325, 16499, 16672,
16845, 17017, 17189, 17360, 17530, 17699, 17868, 18036,
18204, 18371, 18537, 18702, 18867, 19031, 19194, 19357,
19519, 19680, 19840, 20000, 20159, 20317, 20474, 20631,
20787, 20942, 21096, 21249, 21402, 21554, 21705, 21855,
22004, 22153, 22301, 22448, 22594, 22739, 22883, 23027,
23169, 23311, 23452, 23592, 23731, 23869, 24006, 24143,
24278, 24413, 24546, 24679, 24811, 24942, 25072, 25201,
25329, 25456, 25582, 25707, 25831, 25954, 26077, 26198,
26318, 26437, 26556, 26673, 26789, 26905, 27019, 27132,
27244, 27355, 27466, 27575, 27683, 27790, 27896, 28001,
28105, 28208, 28309, 28410, 28510, 28608, 28706, 28802,
28897, 28992, 29085, 29177, 29268, 29358, 29446, 29534,
29621, 29706, 29790, 29873, 29955, 30036, 30116, 30195,
30272, 30349, 30424, 30498, 30571, 30643, 30713, 30783,
30851, 30918, 30984, 31049,
31113, 31175, 31236, 31297,
31356, 31413, 31470, 31525, 31580, 31633, 31684, 31735,
31785, 31833, 31880, 31926, 31970, 32014, 32056, 32097,
32137, 32176, 32213, 32249, 32284, 32318, 32350, 32382,
32412, 32441, 32468, 32495, 32520, 32544, 32567, 32588,
32609, 32628, 32646, 32662, 32678, 32692, 32705, 32717,
32727, 32736, 32744, 32751, 32757, 32761, 32764, 32766,
32767, 32766, 32764, 32761, 32757, 32751, 32744, 32736,
32727, 32717, 32705, 32692, 32678, 32662, 32646, 32628,
32609, 32588, 32567, 32544, 32520, 32495, 32468, 32441,
32412, 32382, 32350, 32318, 32284, 32249, 32213, 32176,
32137, 32097, 32056, 32014, 31970, 31926, 31880, 31833,
31785, 31735, 31684, 31633, 31580, 31525, 31470, 31413,
31356, 31297, 31236, 31175, 31113, 31049, 30984, 30918,
30851, 30783, 30713, 30643, 30571, 30498, 30424, 30349,
30272, 30195, 30116, 30036, 29955, 29873, 29790, 29706,
29621, 29534, 29446, 29358, 29268, 29177, 29085, 28992,
28897, 28802, 28706, 28608, 28510, 28410, 28309, 28208,
28105, 28001, 27896, 27790, 27683, 27575, 27466, 27355,
27244, 27132, 27019, 26905, 26789, 26673, 26556, 26437,
26318, 26198, 26077, 25954, 25831, 25707, 25582, 25456,
25329, 25201, 25072, 24942, 24811, 24679, 24546, 24413,
24278, 24143, 24006, 23869, 23731, 23592, 23452, 23311,
23169, 23027, 22883, 22739, 22594, 22448, 22301, 22153,
22004, 21855, 21705, 21554, 21402, 21249, 21096, 20942,
20787, 20631, 20474, 20317, 20159, 20000, 19840, 19680,
19519, 19357, 19194, 19031, 18867, 18702, 18537, 18371,
18204, 18036, 17868, 17699, 17530, 17360, 17189, 17017,
16845, 16672, 16499, 16325, 16150, 15975, 15799, 15623,
15446, 15268, 15090, 14911, 14732, 14552, 14372, 14191,
14009, 13827, 13645, 13462, 13278, 13094, 12909, 12724,
12539, 12353, 12166, 11980, 11792, 11604, 11416, 11227,
11038, 10849, 10659, 10469, 10278, 10087, 9895, 9703,
9511, 9319, 9126, 8932, 8739, 8545, 8351, 8156,
7961, 7766, 7571, 7375, 7179, 6982, 6786, 6589,
6392, 6195, 5997, 5799, 5601, 5403, 5205, 5006,
4807, 4608, 4409, 4210, 4011, 3811, 3611, 3411,
3211, 3011, 2811, 2610, 2410, 2209, 2009, 1808,
1607, 1406, 1206, 1005, 804, 603, 402, 201,
0, -201, -402, -603, -804, -1005, -1206, -1406,
-1607, -1808, -2009, -2209, -2410, -2610, -2811, -3011,
-3211, -3411, -3611, -3811, -4011, -4210, -4409, -4608,
-4807, -5006, -5205, -5403, -5601, -5799, -5997, -6195,
-6392, -6589, -6786, -6982, -7179, -7375, -7571, -7766,
-7961, -8156, -8351, -8545, -8739, -8932, -9126, -9319,
-9511, -9703, -9895, -10087, -10278, -10469, -10659, -10849,
-11038, -11227, -11416, -11604, -11792, -11980, -12166, -12353,
-12539, -12724, -12909, -13094, -13278, -13462, -13645, -13827,
-14009, -14191, -14372, -14552, -14732, -14911, -15090, -15268,
-15446, -15623, -15799, -15975, -16150, -16325, -16499, -16672,
-16845, -17017, -17189, -17360, -17530, -17699, -17868, -18036,
-18204, -18371, -18537, -18702, -18867, -19031, -19194, -19357,
-19519, -19680, -19840, -20000, -20159, -20317, -20474, -20631,
-20787, -20942, -21096, -21249, -21402, -21554, -21705, -21855,
-22004, -22153, -22301, -22448, -22594, -22739, -22883, -23027,
-23169, -23311, -23452, -23592, -23731, -23869, -24006, -24143,
-24278, -24413, -24546, -24679, -24811, -24942, -25072, -25201,
-25329, -25456, -25582, -25707, -25831, -25954, -26077, -26198,
-26318, -26437, -26556, -26673, -26789, -26905, -27019, -27132,
-27244, -27355, -27466, -27575, -27683, -27790, -27896, -28001,
-28105, -28208, -28309, -28410, -28510, -28608, -28706, -28802,
-28897, -28992, -29085, -29177, -29268, -29358, -29446, -29534,
-29621, -29706, -29790, -29873, -29955, -30036, -30116, -30195,
-30272, -30349, -30424, -30498, -30571, -30643, -30713, -30783,
-30851, -30918, -30984, -31049, -31113, -31175, -31236, -31297,
-31356, -31413, -31470, -31525, -31580, -31633, -31684, -31735,
-31785, -31833, -31880, -31926, -31970, -32014, -32056, -32097,
-32137, -32176, -32213, -32249, -32284, -32318, -32350, -32382,
-32412, -32441, -32468, -32495, -32520, -32544, -32567, -32588,
-32609, -32628, -32646, -32662, -32678, -32692, -32705, -32717,
-32727, -32736, -32744, -32751, -32757, -32761, -32764, -32766,
-32767, -32766, -32764, -32761, -32757, -32751, -32744, -32736,
-32727, -32717, -32705, -32692, -32678, -32662, -32646, -32628,
-32609, -32588, -32567, -32544, -32520, -32495, -32468, -32441,
-32412, -32382, -32350, -32318, -32284, -32249, -32213, -32176,
-32137, -32097, -32056, -32014, -31970, -31926, -31880, -31833,
-31785, -31735, -31684, -31633, -31580, -31525, -31470, -31413,
-31356, -31297, -31236, -31175, -31113, -31049, -30984, -30918,
-30851, -30783, -30713, -30643, -30571, -30498, -30424, -30349,
-30272, -30195, -30116, -30036, -29955, -29873, -29790, -29706,
-29621, -29534, -29446, -29358, -29268, -29177, -29085, -28992,
-28897, -28802, -28706, -28608, -28510, -28410, -28309, -28208,
-28105, -28001, -27896, -27790, -27683, -27575, -27466, -27355,
-27244, -27132, -27019, -26905, -26789, -26673, -26556, -26437,
-26318, -26198, -26077, -25954, -25831, -25707, -25582, -25456,
-25329, -25201, -25072, -24942, -24811, -24679, -24546, -24413,
-24278, -24143, -24006, -23869, -23731, -23592, -23452, -23311,
-23169, -23027, -22883, -22739, -22594, -22448, -22301, -22153,
-22004, -21855, -21705, -21554, -21402, -21249, -21096, -20942,
-20787, -20631, -20474, -20317, -20159, -20000, -19840, -19680,
-19519, -19357, -19194, -19031, -18867, -18702, -18537, -18371,
-18204, -18036, -17868, -17699, -17530, -17360, -17189, -17017,
-16845, -16672, -16499, -16325, -16150, -15975, -15799, -15623,
-15446, -15268, -15090, -14911, -14732, -14552, -14372, -14191,
-14009, -13827, -13645, -13462, -13278, -13094, -12909, -12724,
-12539, -12353, -12166, -11980, -11792, -11604, -11416, -11227,
-11038, -10849, -10659, -10469, -10278, -10087, -9895, -9703,
-9511, -9319, -9126, -8932, -8739, -8545, -8351, -8156,
-7961, -7766, -7571, -7375, -7179, -6982, -6786, -6589,
-6392, -6195, -5997, -5799, -5601, -5403, -5205, -5006,
-4807, -4608, -4409, -4210, -4011, -3811, -3611, -3411,
-3211, -3011, -2811, -2610, -2410, -2209, -2009, -1808,
-1607, -1406, -1206, -1005, -804, -603, -402, -201
};
int WebRtcSpl_ComplexFFT(WebRtc_Word16 frfi[], int stages, int mode)
{
int i, j, l, k, istep, n, m;
WebRtc_Word16 wr, wi;
WebRtc_Word32 tr32, ti32, qr32, qi32;
/* The 1024-value is a constant given from the size of kSinTable1024[],
* and should not be changed depending on the input parameter 'stages'
*/
n = 1 << stages;
if (n > 1024)
return -1;
l = 1;
k = 10 - 1; /* Constant for given kSinTable1024[]. Do not change
depending on the input parameter 'stages' */
if (mode == 0)
{
// mode==0: Low-complexity and Low-accuracy mode
while (l < n)
{
istep = l << 1;
for (m = 0; m < l; ++m)
{
j = m << k;
/* The 256-value is a constant given as 1/4 of the size of
* kSinTable1024[], and should not be changed depending on the input
* parameter 'stages'. It will result in 0 <= j < N_SINE_WAVE/2
*/
wr = kSinTable1024[j + 256];
wi = -kSinTable1024[j];
for (i = m; i < n; i += istep)
{
j = i + l;
tr32 = WEBRTC_SPL_RSHIFT_W32((WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j])
- WEBRTC_SPL_MUL_16_16(wi, frfi[2 * j + 1])), 15);
ti32 = WEBRTC_SPL_RSHIFT_W32((WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j + 1])
+ WEBRTC_SPL_MUL_16_16(wi, frfi[2 * j])), 15);
qr32 = (WebRtc_Word32)frfi[2 * i];
qi32 = (WebRtc_Word32)frfi[2 * i + 1];
frfi[2 * j] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(qr32 - tr32, 1);
frfi[2 * j + 1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(qi32 - ti32, 1);
frfi[2 * i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(qr32 + tr32, 1);
frfi[2 * i + 1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(qi32 + ti32, 1);
}
}
--k;
l = istep;
}
} else
{
// mode==1: High-complexity and High-accuracy mode
while (l < n)
{
istep = l << 1;
for (m = 0; m < l; ++m)
{
j = m << k;
/* The 256-value is a constant given as 1/4 of the size of
* kSinTable1024[], and should not be changed depending on the input
* parameter 'stages'. It will result in 0 <= j < N_SINE_WAVE/2
*/
wr = kSinTable1024[j + 256];
wi = -kSinTable1024[j];
#ifdef WEBRTC_ARCH_ARM_V7A
WebRtc_Word32 wri;
WebRtc_Word32 frfi_r;
__asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) :
"r"((WebRtc_Word32)wr), "r"((WebRtc_Word32)wi));
#endif
for (i = m; i < n; i += istep)
{
j = i + l;
#ifdef WEBRTC_ARCH_ARM_V7A
__asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) :
"r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1]));
__asm__("smlsd %0, %1, %2, %3" : "=r"(tr32) :
"r"(wri), "r"(frfi_r), "r"(CFFTRND));
__asm__("smladx %0, %1, %2, %3" : "=r"(ti32) :
"r"(wri), "r"(frfi_r), "r"(CFFTRND));
#else
tr32 = WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j])
- WEBRTC_SPL_MUL_16_16(wi, frfi[2 * j + 1]) + CFFTRND;
ti32 = WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j + 1])
+ WEBRTC_SPL_MUL_16_16(wi, frfi[2 * j]) + CFFTRND;
#endif
tr32 = WEBRTC_SPL_RSHIFT_W32(tr32, 15 - CFFTSFT);
ti32 = WEBRTC_SPL_RSHIFT_W32(ti32, 15 - CFFTSFT);
qr32 = ((WebRtc_Word32)frfi[2 * i]) << CFFTSFT;
qi32 = ((WebRtc_Word32)frfi[2 * i + 1]) << CFFTSFT;
frfi[2 * j] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(
(qr32 - tr32 + CFFTRND2), 1 + CFFTSFT);
frfi[2 * j + 1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(
(qi32 - ti32 + CFFTRND2), 1 + CFFTSFT);
frfi[2 * i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(
(qr32 + tr32 + CFFTRND2), 1 + CFFTSFT);
frfi[2 * i + 1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(
(qi32 + ti32 + CFFTRND2), 1 + CFFTSFT);
}
}
--k;
l = istep;
}
}
return 0;
}
int WebRtcSpl_ComplexIFFT(WebRtc_Word16 frfi[], int stages, int mode)
{
int i, j, l, k, istep, n, m, scale, shift;
WebRtc_Word16 wr, wi;
WebRtc_Word32 tr32, ti32, qr32, qi32;
WebRtc_Word32 tmp32, round2;
/* The 1024-value is a constant given from the size of kSinTable1024[],
* and should not be changed depending on the input parameter 'stages'
*/
n = 1 << stages;
if (n > 1024)
return -1;
scale = 0;
l = 1;
k = 10 - 1; /* Constant for given kSinTable1024[]. Do not change
depending on the input parameter 'stages' */
while (l < n)
{
// variable scaling, depending upon data
shift = 0;
round2 = 8192;
tmp32 = (WebRtc_Word32)WebRtcSpl_MaxAbsValueW16(frfi, 2 * n);
if (tmp32 > 13573)
{
shift++;
scale++;
round2 <<= 1;
}
if (tmp32 > 27146)
{
shift++;
scale++;
round2 <<= 1;
}
istep = l << 1;
if (mode == 0)
{
// mode==0: Low-complexity and Low-accuracy mode
for (m = 0; m < l; ++m)
{
j = m << k;
/* The 256-value is a constant given as 1/4 of the size of
* kSinTable1024[], and should not be changed depending on the input
* parameter 'stages'. It will result in 0 <= j < N_SINE_WAVE/2
*/
wr = kSinTable1024[j + 256];
wi = kSinTable1024[j];
for (i = m; i < n; i += istep)
{
j = i + l;
tr32 = WEBRTC_SPL_RSHIFT_W32((WEBRTC_SPL_MUL_16_16_RSFT(wr, frfi[2 * j], 0)
- WEBRTC_SPL_MUL_16_16_RSFT(wi, frfi[2 * j + 1], 0)), 15);
ti32 = WEBRTC_SPL_RSHIFT_W32(
(WEBRTC_SPL_MUL_16_16_RSFT(wr, frfi[2 * j + 1], 0)
+ WEBRTC_SPL_MUL_16_16_RSFT(wi,frfi[2*j],0)), 15);
qr32 = (WebRtc_Word32)frfi[2 * i];
qi32 = (WebRtc_Word32)frfi[2 * i + 1];
frfi[2 * j] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(qr32 - tr32, shift);
frfi[2 * j + 1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(qi32 - ti32, shift);
frfi[2 * i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(qr32 + tr32, shift);
frfi[2 * i + 1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(qi32 + ti32, shift);
}
}
} else
{
// mode==1: High-complexity and High-accuracy mode
for (m = 0; m < l; ++m)
{
j = m << k;
/* The 256-value is a constant given as 1/4 of the size of
* kSinTable1024[], and should not be changed depending on the input
* parameter 'stages'. It will result in 0 <= j < N_SINE_WAVE/2
*/
wr = kSinTable1024[j + 256];
wi = kSinTable1024[j];
#ifdef WEBRTC_ARCH_ARM_V7A
WebRtc_Word32 wri;
WebRtc_Word32 frfi_r;
__asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(wri) :
"r"((WebRtc_Word32)wr), "r"((WebRtc_Word32)wi));
#endif
for (i = m; i < n; i += istep)
{
j = i + l;
#ifdef WEBRTC_ARCH_ARM_V7A
__asm__("pkhbt %0, %1, %2, lsl #16" : "=r"(frfi_r) :
"r"((WebRtc_Word32)frfi[2*j]), "r"((WebRtc_Word32)frfi[2*j +1]));
__asm__("smlsd %0, %1, %2, %3" : "=r"(tr32) :
"r"(wri), "r"(frfi_r), "r"(CIFFTRND));
__asm__("smladx %0, %1, %2, %3" : "=r"(ti32) :
"r"(wri), "r"(frfi_r), "r"(CIFFTRND));
#else
tr32 = WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j])
- WEBRTC_SPL_MUL_16_16(wi, frfi[2 * j + 1]) + CIFFTRND;
ti32 = WEBRTC_SPL_MUL_16_16(wr, frfi[2 * j + 1])
+ WEBRTC_SPL_MUL_16_16(wi, frfi[2 * j]) + CIFFTRND;
#endif
tr32 = WEBRTC_SPL_RSHIFT_W32(tr32, 15 - CIFFTSFT);
ti32 = WEBRTC_SPL_RSHIFT_W32(ti32, 15 - CIFFTSFT);
qr32 = ((WebRtc_Word32)frfi[2 * i]) << CIFFTSFT;
qi32 = ((WebRtc_Word32)frfi[2 * i + 1]) << CIFFTSFT;
frfi[2 * j] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((qr32 - tr32+round2),
shift+CIFFTSFT);
frfi[2 * j + 1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(
(qi32 - ti32 + round2), shift + CIFFTSFT);
frfi[2 * i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((qr32 + tr32 + round2),
shift + CIFFTSFT);
frfi[2 * i + 1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(
(qi32 + ti32 + round2), shift + CIFFTSFT);
}
}
}
--k;
l = istep;
}
return scale;
}

View File

@ -1,108 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the implementation of functions
* WebRtcSpl_MemSetW16()
* WebRtcSpl_MemSetW32()
* WebRtcSpl_MemCpyReversedOrder()
* WebRtcSpl_CopyFromEndW16()
* WebRtcSpl_ZerosArrayW16()
* WebRtcSpl_ZerosArrayW32()
* WebRtcSpl_OnesArrayW16()
* WebRtcSpl_OnesArrayW32()
*
* The description header can be found in signal_processing_library.h
*
*/
#include <string.h>
#include "signal_processing_library.h"
void WebRtcSpl_MemSetW16(WebRtc_Word16 *ptr, WebRtc_Word16 set_value, int length)
{
int j;
WebRtc_Word16 *arrptr = ptr;
for (j = length; j > 0; j--)
{
*arrptr++ = set_value;
}
}
void WebRtcSpl_MemSetW32(WebRtc_Word32 *ptr, WebRtc_Word32 set_value, int length)
{
int j;
WebRtc_Word32 *arrptr = ptr;
for (j = length; j > 0; j--)
{
*arrptr++ = set_value;
}
}
void WebRtcSpl_MemCpyReversedOrder(WebRtc_Word16* dest, WebRtc_Word16* source, int length)
{
int j;
WebRtc_Word16* destPtr = dest;
WebRtc_Word16* sourcePtr = source;
for (j = 0; j < length; j++)
{
*destPtr-- = *sourcePtr++;
}
}
WebRtc_Word16 WebRtcSpl_CopyFromEndW16(G_CONST WebRtc_Word16 *vector_in,
WebRtc_Word16 length,
WebRtc_Word16 samples,
WebRtc_Word16 *vector_out)
{
// Copy the last <samples> of the input vector to vector_out
WEBRTC_SPL_MEMCPY_W16(vector_out, &vector_in[length - samples], samples);
return samples;
}
WebRtc_Word16 WebRtcSpl_ZerosArrayW16(WebRtc_Word16 *vector, WebRtc_Word16 length)
{
WebRtcSpl_MemSetW16(vector, 0, length);
return length;
}
WebRtc_Word16 WebRtcSpl_ZerosArrayW32(WebRtc_Word32 *vector, WebRtc_Word16 length)
{
WebRtcSpl_MemSetW32(vector, 0, length);
return length;
}
WebRtc_Word16 WebRtcSpl_OnesArrayW16(WebRtc_Word16 *vector, WebRtc_Word16 length)
{
WebRtc_Word16 i;
WebRtc_Word16 *tmpvec = vector;
for (i = 0; i < length; i++)
{
*tmpvec++ = 1;
}
return length;
}
WebRtc_Word16 WebRtcSpl_OnesArrayW32(WebRtc_Word32 *vector, WebRtc_Word16 length)
{
WebRtc_Word16 i;
WebRtc_Word32 *tmpvec = vector;
for (i = 0; i < length; i++)
{
*tmpvec++ = 1;
}
return length;
}

View File

@ -1,110 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
#include "crc.h"
#include <stdlib.h>
#include "signal_processing_library.h"
#define POLYNOMIAL 0x04c11db7L
static const WebRtc_UWord32 kCrcTable[256] = {
0, 0x4c11db7, 0x9823b6e, 0xd4326d9, 0x130476dc, 0x17c56b6b,
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef,
0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d,
0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb,
0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1,
0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0,
0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072,
0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x18aeb13, 0x54bf6a4,
0x808d07d, 0xcc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde,
0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08,
0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba,
0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc,
0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6,
0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050,
0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2,
0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34,
0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637,
0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1,
0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53,
0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5,
0x3f9b762c, 0x3b5a6b9b, 0x315d626, 0x7d4cb91, 0xa97ed48, 0xe56f0ff,
0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9,
0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b,
0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd,
0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7,
0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71,
0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3,
0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2,
0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8,
0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e,
0x18197087, 0x1cd86d30, 0x29f3d35, 0x65e2082, 0xb1d065b, 0xfdc1bec,
0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a,
0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0,
0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676,
0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4,
0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662,
0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668,
0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
};
/****************************************************************************
* WebRtcIsac_GetCrc(...)
*
* This function returns a 32 bit CRC checksum of a bit stream
*
* Input:
* - bitstream : payload bitstream
* - len_bitstream_in_bytes : number of 8-bit words in the bit stream
*
* Output:
* - crc : checksum
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_GetCrc(const WebRtc_Word16* bitstream,
WebRtc_Word16 len_bitstream_in_bytes,
WebRtc_UWord32* crc)
{
WebRtc_UWord8* bitstream_ptr_uw8;
WebRtc_UWord32 crc_state;
int byte_cntr;
int crc_tbl_indx;
/* Sanity Check. */
if (bitstream == NULL) {
return -1;
}
/* cast to UWord8 pointer */
bitstream_ptr_uw8 = (WebRtc_UWord8 *)bitstream;
/* initialize */
crc_state = 0xFFFFFFFF;
for (byte_cntr = 0; byte_cntr < len_bitstream_in_bytes; byte_cntr++) {
crc_tbl_indx = (WEBRTC_SPL_RSHIFT_U32(crc_state, 24) ^
bitstream_ptr_uw8[byte_cntr]) & 0xFF;
crc_state = WEBRTC_SPL_LSHIFT_U32(crc_state, 8) ^ kCrcTable[crc_tbl_indx];
}
*crc = ~crc_state;
return 0;
}

View File

@ -1,46 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* crc.h
*
* Checksum functions
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CRC_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CRC_H_
#include "typedefs.h"
/****************************************************************************
* WebRtcIsac_GetCrc(...)
*
* This function returns a 32 bit CRC checksum of a bit stream
*
* Input:
* - encoded : payload bit stream
* - no_of_word8s : number of 8-bit words in the bit stream
*
* Output:
* - crc : checksum
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_GetCrc(
const WebRtc_Word16* encoded,
WebRtc_Word16 no_of_word8s,
WebRtc_UWord32* crc);
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_CRC_H_ */

View File

@ -1,271 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_CrossCorrelation().
* The description header can be found in signal_processing_library.h
*
*/
/* TODO(kma): Clean up the code in this file, and break it up for
* various platforms (Xscale, ARM/Neon etc.).
*/
#include "signal_processing_library.h"
void WebRtcSpl_CrossCorrelation(WebRtc_Word32* cross_correlation, WebRtc_Word16* seq1,
WebRtc_Word16* seq2, WebRtc_Word16 dim_seq,
WebRtc_Word16 dim_cross_correlation,
WebRtc_Word16 right_shifts,
WebRtc_Word16 step_seq2)
{
int i, j;
WebRtc_Word16* seq1Ptr;
WebRtc_Word16* seq2Ptr;
WebRtc_Word32* CrossCorrPtr;
#ifdef _XSCALE_OPT_
#ifdef _WIN32
#pragma message("NOTE: _XSCALE_OPT_ optimizations are used (overrides _ARM_OPT_ and requires /QRxscale compiler flag)")
#endif
__int64 macc40;
int iseq1[250];
int iseq2[250];
int iseq3[250];
int * iseq1Ptr;
int * iseq2Ptr;
int * iseq3Ptr;
int len, i_len;
seq1Ptr = seq1;
iseq1Ptr = iseq1;
for(i = 0; i < ((dim_seq + 1) >> 1); i++)
{
*iseq1Ptr = (unsigned short)*seq1Ptr++;
*iseq1Ptr++ |= (WebRtc_Word32)*seq1Ptr++ << 16;
}
if(dim_seq%2)
{
*(iseq1Ptr-1) &= 0x0000ffff;
}
*iseq1Ptr = 0;
iseq1Ptr++;
*iseq1Ptr = 0;
iseq1Ptr++;
*iseq1Ptr = 0;
if(step_seq2 < 0)
{
seq2Ptr = seq2 - dim_cross_correlation + 1;
CrossCorrPtr = &cross_correlation[dim_cross_correlation - 1];
}
else
{
seq2Ptr = seq2;
CrossCorrPtr = cross_correlation;
}
len = dim_seq + dim_cross_correlation - 1;
i_len = (len + 1) >> 1;
iseq2Ptr = iseq2;
iseq3Ptr = iseq3;
for(i = 0; i < i_len; i++)
{
*iseq2Ptr = (unsigned short)*seq2Ptr++;
*iseq3Ptr = (unsigned short)*seq2Ptr;
*iseq2Ptr++ |= (WebRtc_Word32)*seq2Ptr++ << 16;
*iseq3Ptr++ |= (WebRtc_Word32)*seq2Ptr << 16;
}
if(len % 2)
{
iseq2[i_len - 1] &= 0x0000ffff;
iseq3[i_len - 1] = 0;
}
else
iseq3[i_len - 1] &= 0x0000ffff;
iseq2[i_len] = 0;
iseq3[i_len] = 0;
iseq2[i_len + 1] = 0;
iseq3[i_len + 1] = 0;
iseq2[i_len + 2] = 0;
iseq3[i_len + 2] = 0;
// Set pointer to start value
iseq2Ptr = iseq2;
iseq3Ptr = iseq3;
i_len = (dim_seq + 7) >> 3;
for (i = 0; i < dim_cross_correlation; i++)
{
iseq1Ptr = iseq1;
macc40 = 0;
_WriteCoProcessor(macc40, 0);
if((i & 1))
{
iseq3Ptr = iseq3 + (i >> 1);
for (j = i_len; j > 0; j--)
{
_SmulAddPack_2SW_ACC(*iseq1Ptr++, *iseq3Ptr++);
_SmulAddPack_2SW_ACC(*iseq1Ptr++, *iseq3Ptr++);
_SmulAddPack_2SW_ACC(*iseq1Ptr++, *iseq3Ptr++);
_SmulAddPack_2SW_ACC(*iseq1Ptr++, *iseq3Ptr++);
}
}
else
{
iseq2Ptr = iseq2 + (i >> 1);
for (j = i_len; j > 0; j--)
{
_SmulAddPack_2SW_ACC(*iseq1Ptr++, *iseq2Ptr++);
_SmulAddPack_2SW_ACC(*iseq1Ptr++, *iseq2Ptr++);
_SmulAddPack_2SW_ACC(*iseq1Ptr++, *iseq2Ptr++);
_SmulAddPack_2SW_ACC(*iseq1Ptr++, *iseq2Ptr++);
}
}
macc40 = _ReadCoProcessor(0);
*CrossCorrPtr = (WebRtc_Word32)(macc40 >> right_shifts);
CrossCorrPtr += step_seq2;
}
#else // #ifdef _XSCALE_OPT_
#ifdef _ARM_OPT_
WebRtc_Word16 dim_seq8 = (dim_seq >> 3) << 3;
#endif
CrossCorrPtr = cross_correlation;
for (i = 0; i < dim_cross_correlation; i++)
{
// Set the pointer to the static vector, set the pointer to the sliding vector
// and initialize cross_correlation
seq1Ptr = seq1;
seq2Ptr = seq2 + (step_seq2 * i);
(*CrossCorrPtr) = 0;
#ifndef _ARM_OPT_
#ifdef _WIN32
#pragma message("NOTE: default implementation is used")
#endif
// Perform the cross correlation
for (j = 0; j < dim_seq; j++)
{
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr), right_shifts);
seq1Ptr++;
seq2Ptr++;
}
#else
#ifdef _WIN32
#pragma message("NOTE: _ARM_OPT_ optimizations are used")
#endif
if (right_shifts == 0)
{
// Perform the optimized cross correlation
for (j = 0; j < dim_seq8; j = j + 8)
{
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16((*seq1Ptr), (*seq2Ptr));
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16((*seq1Ptr), (*seq2Ptr));
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16((*seq1Ptr), (*seq2Ptr));
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16((*seq1Ptr), (*seq2Ptr));
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16((*seq1Ptr), (*seq2Ptr));
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16((*seq1Ptr), (*seq2Ptr));
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16((*seq1Ptr), (*seq2Ptr));
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16((*seq1Ptr), (*seq2Ptr));
seq1Ptr++;
seq2Ptr++;
}
for (j = dim_seq8; j < dim_seq; j++)
{
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16((*seq1Ptr), (*seq2Ptr));
seq1Ptr++;
seq2Ptr++;
}
}
else // right_shifts != 0
{
// Perform the optimized cross correlation
for (j = 0; j < dim_seq8; j = j + 8)
{
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr),
right_shifts);
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr),
right_shifts);
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr),
right_shifts);
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr),
right_shifts);
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr),
right_shifts);
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr),
right_shifts);
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr),
right_shifts);
seq1Ptr++;
seq2Ptr++;
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr),
right_shifts);
seq1Ptr++;
seq2Ptr++;
}
for (j = dim_seq8; j < dim_seq; j++)
{
(*CrossCorrPtr) += WEBRTC_SPL_MUL_16_16_RSFT((*seq1Ptr), (*seq2Ptr),
right_shifts);
seq1Ptr++;
seq2Ptr++;
}
}
#endif
CrossCorrPtr++;
}
#endif
}

View File

@ -1,330 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* decode_B.c
*
* This file contains definition of funtions for decoding.
* Decoding of lower-band, including normal-decoding and RCU decoding.
* Decoding of upper-band, including 8-12 kHz, when the bandwidth is
* 0-12 kHz, and 8-16 kHz, when the bandwidth is 0-16 kHz.
*
*/
#include "codec.h"
#include "entropy_coding.h"
#include "pitch_estimator.h"
#include "bandwidth_estimator.h"
#include "structs.h"
#include "settings.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
* function to decode the bitstream
* returns the total number of bytes in the stream
*/
int
WebRtcIsac_DecodeLb(
float* signal_out,
ISACLBDecStruct* ISACdecLB_obj,
WebRtc_Word16* current_framesamples,
WebRtc_Word16 isRCUPayload)
{
int k, model;
int len, err;
WebRtc_Word16 bandwidthInd;
float LP_dec_float[FRAMESAMPLES_HALF];
float HP_dec_float[FRAMESAMPLES_HALF];
double LPw[FRAMESAMPLES_HALF];
double HPw[FRAMESAMPLES_HALF];
double LPw_pf[FRAMESAMPLES_HALF];
double lo_filt_coef[(ORDERLO+1)*SUBFRAMES];
double hi_filt_coef[(ORDERHI+1)*SUBFRAMES];
double real_f[FRAMESAMPLES_HALF];
double imag_f[FRAMESAMPLES_HALF];
double PitchLags[4];
double PitchGains[4];
double AvgPitchGain;
WebRtc_Word16 PitchGains_Q12[4];
WebRtc_Word16 AvgPitchGain_Q12;
float gain;
int frame_nb; /* counter */
int frame_mode; /* 0 for 20ms and 30ms, 1 for 60ms */
int processed_samples;
(ISACdecLB_obj->bitstr_obj).W_upper = 0xFFFFFFFF;
(ISACdecLB_obj->bitstr_obj).streamval = 0;
(ISACdecLB_obj->bitstr_obj).stream_index = 0;
len = 0;
/* decode framelength and BW estimation - not used,
only for stream pointer*/
err = WebRtcIsac_DecodeFrameLen(&ISACdecLB_obj->bitstr_obj,
current_framesamples);
if (err < 0) { // error check
return err;
}
/* frame_mode: 0, or 1 */
frame_mode = *current_framesamples/MAX_FRAMESAMPLES;
/* processed_samples: either 320 (20ms) or 480 (30, 60 ms) */
processed_samples = *current_framesamples/(frame_mode+1);
err = WebRtcIsac_DecodeSendBW(&ISACdecLB_obj->bitstr_obj, &bandwidthInd);
if (err < 0) { // error check
return err;
}
/* one loop if it's one frame (20 or 30ms), 2 loops if 2 frames
bundled together (60ms) */
for (frame_nb = 0; frame_nb <= frame_mode; frame_nb++) {
/* decode & dequantize pitch parameters */
err = WebRtcIsac_DecodePitchGain(&(ISACdecLB_obj->bitstr_obj),
PitchGains_Q12);
if (err < 0) { // error check
return err;
}
err = WebRtcIsac_DecodePitchLag(&ISACdecLB_obj->bitstr_obj,
PitchGains_Q12, PitchLags);
if (err < 0) { // error check
return err;
}
AvgPitchGain_Q12 = (PitchGains_Q12[0] + PitchGains_Q12[1] +
PitchGains_Q12[2] + PitchGains_Q12[3])>>2;
/* decode & dequantize FiltCoef */
err = WebRtcIsac_DecodeLpc(&ISACdecLB_obj->bitstr_obj,
lo_filt_coef,hi_filt_coef, &model);
if (err < 0) { // error check
return err;
}
/* decode & dequantize spectrum */
len = WebRtcIsac_DecodeSpecLb(&ISACdecLB_obj->bitstr_obj,
real_f, imag_f, AvgPitchGain_Q12);
if (len < 0) { // error check
return len;
}
/* inverse transform */
WebRtcIsac_Spec2time(real_f, imag_f, LPw, HPw,
&ISACdecLB_obj->fftstr_obj);
/* convert PitchGains back to FLOAT for pitchfilter_post */
for (k = 0; k < 4; k++) {
PitchGains[k] = ((float)PitchGains_Q12[k])/4096;
}
if(isRCUPayload)
{
for (k = 0; k < 240; k++) {
LPw[k] *= RCU_TRANSCODING_SCALE_INVERSE;
HPw[k] *= RCU_TRANSCODING_SCALE_INVERSE;
}
}
/* inverse pitch filter */
WebRtcIsac_PitchfilterPost(LPw, LPw_pf,
&ISACdecLB_obj->pitchfiltstr_obj, PitchLags, PitchGains);
/* convert AvgPitchGain back to FLOAT for computation of gain */
AvgPitchGain = ((float)AvgPitchGain_Q12)/4096;
gain = 1.0f - 0.45f * (float)AvgPitchGain;
for (k = 0; k < FRAMESAMPLES_HALF; k++) {
/* reduce gain to compensate for pitch enhancer */
LPw_pf[ k ] *= gain;
}
if(isRCUPayload)
{
for (k = 0; k < FRAMESAMPLES_HALF; k++) {
/* compensation for transcoding gain changes*/
LPw_pf[k] *= RCU_TRANSCODING_SCALE;
HPw[k] *= RCU_TRANSCODING_SCALE;
}
}
/* perceptual post-filtering (using normalized lattice filter) */
WebRtcIsac_NormLatticeFilterAr(ORDERLO,
ISACdecLB_obj->maskfiltstr_obj.PostStateLoF,
(ISACdecLB_obj->maskfiltstr_obj).PostStateLoG,
LPw_pf, lo_filt_coef, LP_dec_float);
WebRtcIsac_NormLatticeFilterAr(ORDERHI,
ISACdecLB_obj->maskfiltstr_obj.PostStateHiF,
(ISACdecLB_obj->maskfiltstr_obj).PostStateHiG,
HPw, hi_filt_coef, HP_dec_float);
/* recombine the 2 bands */
WebRtcIsac_FilterAndCombineFloat( LP_dec_float, HP_dec_float,
signal_out + frame_nb * processed_samples,
&ISACdecLB_obj->postfiltbankstr_obj);
}
return len;
}
/*
* This decode function is called when the codec is operating in 16 kHz
* bandwidth to decode the upperband, i.e. 8-16 kHz.
*
* Contrary to lower-band, the upper-band (8-16 kHz) is not split in
* frequency, but split to 12 sub-frames, i.e. twice as lower-band.
*/
int
WebRtcIsac_DecodeUb16(
float* signal_out,
ISACUBDecStruct* ISACdecUB_obj,
WebRtc_Word16 isRCUPayload)
{
int len, err;
double halfFrameFirst[FRAMESAMPLES_HALF];
double halfFrameSecond[FRAMESAMPLES_HALF];
double percepFilterParam[(UB_LPC_ORDER+1) * (SUBFRAMES<<1) +
(UB_LPC_ORDER+1)];
double real_f[FRAMESAMPLES_HALF];
double imag_f[FRAMESAMPLES_HALF];
len = 0;
/* decode & dequantize FiltCoef */
memset(percepFilterParam, 0, sizeof(percepFilterParam));
err = WebRtcIsac_DecodeInterpolLpcUb(&ISACdecUB_obj->bitstr_obj,
percepFilterParam, isac16kHz);
if (err < 0) { // error check
return err;
}
/* decode & dequantize spectrum */
len = WebRtcIsac_DecodeSpecUB16(&ISACdecUB_obj->bitstr_obj, real_f,
imag_f);
if (len < 0) { // error check
return len;
}
if(isRCUPayload)
{
int n;
for(n = 0; n < 240; n++)
{
real_f[n] *= RCU_TRANSCODING_SCALE_UB_INVERSE;
imag_f[n] *= RCU_TRANSCODING_SCALE_UB_INVERSE;
}
}
/* inverse transform */
WebRtcIsac_Spec2time(real_f, imag_f, halfFrameFirst, halfFrameSecond,
&ISACdecUB_obj->fftstr_obj);
/* perceptual post-filtering (using normalized lattice filter) */
WebRtcIsac_NormLatticeFilterAr(UB_LPC_ORDER,
ISACdecUB_obj->maskfiltstr_obj.PostStateLoF,
(ISACdecUB_obj->maskfiltstr_obj).PostStateLoG, halfFrameFirst,
&percepFilterParam[(UB_LPC_ORDER+1)], signal_out);
WebRtcIsac_NormLatticeFilterAr(UB_LPC_ORDER,
ISACdecUB_obj->maskfiltstr_obj.PostStateLoF,
(ISACdecUB_obj->maskfiltstr_obj).PostStateLoG, halfFrameSecond,
&percepFilterParam[(UB_LPC_ORDER + 1) * SUBFRAMES + (UB_LPC_ORDER+1)],
&signal_out[FRAMESAMPLES_HALF]);
return len;
}
/*
* This decode function is called when the codec operates at 0-12 kHz
* bandwidth to decode the upperband, i.e. 8-12 kHz.
*
* At the encoder the upper-band is split into two band, 8-12 kHz & 12-16
* kHz, and only 8-12 kHz is encoded. At the decoder, 8-12 kHz band is
* reconstructed and 12-16 kHz replaced with zeros. Then two bands
* are combined, to reconstruct the upperband 8-16 kHz.
*/
int
WebRtcIsac_DecodeUb12(
float* signal_out,
ISACUBDecStruct* ISACdecUB_obj,
WebRtc_Word16 isRCUPayload)
{
int len, err;
float LP_dec_float[FRAMESAMPLES_HALF];
float HP_dec_float[FRAMESAMPLES_HALF];
double LPw[FRAMESAMPLES_HALF];
double HPw[FRAMESAMPLES_HALF];
double percepFilterParam[(UB_LPC_ORDER+1)*SUBFRAMES];
double real_f[FRAMESAMPLES_HALF];
double imag_f[FRAMESAMPLES_HALF];
len = 0;
/* decode & dequantize FiltCoef */
err = WebRtcIsac_DecodeInterpolLpcUb(&ISACdecUB_obj->bitstr_obj,
percepFilterParam, isac12kHz);
if(err < 0) { // error check
return err;
}
/* decode & dequantize spectrum */
len = WebRtcIsac_DecodeSpecUB12(&ISACdecUB_obj->bitstr_obj,
real_f, imag_f);
if(len < 0) { // error check
return len;
}
if(isRCUPayload)
{
int n;
for(n = 0; n < 240; n++)
{
real_f[n] *= RCU_TRANSCODING_SCALE_UB_INVERSE;
imag_f[n] *= RCU_TRANSCODING_SCALE_UB_INVERSE;
}
}
/* inverse transform */
WebRtcIsac_Spec2time(real_f, imag_f, LPw, HPw, &ISACdecUB_obj->fftstr_obj);
/* perceptual post-filtering (using normalized lattice filter) */
WebRtcIsac_NormLatticeFilterAr(UB_LPC_ORDER,
ISACdecUB_obj->maskfiltstr_obj.PostStateLoF,
(ISACdecUB_obj->maskfiltstr_obj).PostStateLoG, LPw,
percepFilterParam, LP_dec_float);
/* Zerro for upper-band */
memset(HP_dec_float, 0, sizeof(float) * (FRAMESAMPLES_HALF));
/* recombine the 2 bands */
WebRtcIsac_FilterAndCombineFloat(HP_dec_float, LP_dec_float, signal_out,
&ISACdecUB_obj->postfiltbankstr_obj);
return len;
}

View File

@ -1,88 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
#include "structs.h"
#include "bandwidth_estimator.h"
#include "entropy_coding.h"
#include "codec.h"
int
WebRtcIsac_EstimateBandwidth(
BwEstimatorstr* bwest_str,
Bitstr* streamdata,
WebRtc_Word32 packet_size,
WebRtc_UWord16 rtp_seq_number,
WebRtc_UWord32 send_ts,
WebRtc_UWord32 arr_ts,
enum IsacSamplingRate encoderSampRate,
enum IsacSamplingRate decoderSampRate)
{
WebRtc_Word16 index;
WebRtc_Word16 frame_samples;
WebRtc_UWord32 sendTimestampIn16kHz;
WebRtc_UWord32 arrivalTimestampIn16kHz;
WebRtc_UWord32 diffSendTime;
WebRtc_UWord32 diffArrivalTime;
int err;
/* decode framelength and BW estimation */
err = WebRtcIsac_DecodeFrameLen(streamdata, &frame_samples);
if(err < 0) // error check
{
return err;
}
err = WebRtcIsac_DecodeSendBW(streamdata, &index);
if(err < 0) // error check
{
return err;
}
/* UPDATE ESTIMATES FROM OTHER SIDE */
err = WebRtcIsac_UpdateUplinkBwImpl(bwest_str, index, encoderSampRate);
if(err < 0)
{
return err;
}
// We like BWE to work at 16 kHz sampling rate,
// therefore, we have to change the timestamps accordingly.
// translate the send timestamp if required
diffSendTime = (WebRtc_UWord32)((WebRtc_UWord32)send_ts -
(WebRtc_UWord32)bwest_str->senderTimestamp);
bwest_str->senderTimestamp = send_ts;
diffArrivalTime = (WebRtc_UWord32)((WebRtc_UWord32)arr_ts -
(WebRtc_UWord32)bwest_str->receiverTimestamp);
bwest_str->receiverTimestamp = arr_ts;
if(decoderSampRate == kIsacSuperWideband)
{
diffArrivalTime = (WebRtc_UWord32)diffArrivalTime >> 1;
diffSendTime = (WebRtc_UWord32)diffSendTime >> 1;
}
// arrival timestamp in 16 kHz
arrivalTimestampIn16kHz = (WebRtc_UWord32)((WebRtc_UWord32)
bwest_str->prev_rec_arr_ts + (WebRtc_UWord32)diffArrivalTime);
// send timestamp in 16 kHz
sendTimestampIn16kHz = (WebRtc_UWord32)((WebRtc_UWord32)
bwest_str->prev_rec_send_ts + (WebRtc_UWord32)diffSendTime);
err = WebRtcIsac_UpdateBandwidthEstimator(bwest_str, rtp_seq_number,
(frame_samples * 1000) / FS, sendTimestampIn16kHz,
arrivalTimestampIn16kHz, packet_size);
// error check
if(err < 0)
{
return err;
}
return 0;
}

View File

@ -1,144 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains implementations of the divisions
* WebRtcSpl_DivU32U16()
* WebRtcSpl_DivW32W16()
* WebRtcSpl_DivW32W16ResW16()
* WebRtcSpl_DivResultInQ31()
* WebRtcSpl_DivW32HiLow()
*
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_UWord32 WebRtcSpl_DivU32U16(WebRtc_UWord32 num, WebRtc_UWord16 den)
{
// Guard against division with 0
if (den != 0)
{
return (WebRtc_UWord32)(num / den);
} else
{
return (WebRtc_UWord32)0xFFFFFFFF;
}
}
WebRtc_Word32 WebRtcSpl_DivW32W16(WebRtc_Word32 num, WebRtc_Word16 den)
{
// Guard against division with 0
if (den != 0)
{
return (WebRtc_Word32)(num / den);
} else
{
return (WebRtc_Word32)0x7FFFFFFF;
}
}
WebRtc_Word16 WebRtcSpl_DivW32W16ResW16(WebRtc_Word32 num, WebRtc_Word16 den)
{
// Guard against division with 0
if (den != 0)
{
return (WebRtc_Word16)(num / den);
} else
{
return (WebRtc_Word16)0x7FFF;
}
}
WebRtc_Word32 WebRtcSpl_DivResultInQ31(WebRtc_Word32 num, WebRtc_Word32 den)
{
WebRtc_Word32 L_num = num;
WebRtc_Word32 L_den = den;
WebRtc_Word32 div = 0;
int k = 31;
int change_sign = 0;
if (num == 0)
return 0;
if (num < 0)
{
change_sign++;
L_num = -num;
}
if (den < 0)
{
change_sign++;
L_den = -den;
}
while (k--)
{
div <<= 1;
L_num <<= 1;
if (L_num >= L_den)
{
L_num -= L_den;
div++;
}
}
if (change_sign == 1)
{
div = -div;
}
return div;
}
WebRtc_Word32 WebRtcSpl_DivW32HiLow(WebRtc_Word32 num, WebRtc_Word16 den_hi,
WebRtc_Word16 den_low)
{
WebRtc_Word16 approx, tmp_hi, tmp_low, num_hi, num_low;
WebRtc_Word32 tmpW32;
approx = (WebRtc_Word16)WebRtcSpl_DivW32W16((WebRtc_Word32)0x1FFFFFFF, den_hi);
// result in Q14 (Note: 3FFFFFFF = 0.5 in Q30)
// tmpW32 = 1/den = approx * (2.0 - den * approx) (in Q30)
tmpW32 = (WEBRTC_SPL_MUL_16_16(den_hi, approx) << 1)
+ ((WEBRTC_SPL_MUL_16_16(den_low, approx) >> 15) << 1);
// tmpW32 = den * approx
tmpW32 = (WebRtc_Word32)0x7fffffffL - tmpW32; // result in Q30 (tmpW32 = 2.0-(den*approx))
// Store tmpW32 in hi and low format
tmp_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmpW32, 16);
tmp_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((tmpW32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)tmp_hi, 16)), 1);
// tmpW32 = 1/den in Q29
tmpW32 = ((WEBRTC_SPL_MUL_16_16(tmp_hi, approx) + (WEBRTC_SPL_MUL_16_16(tmp_low, approx)
>> 15)) << 1);
// 1/den in hi and low format
tmp_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(tmpW32, 16);
tmp_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((tmpW32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)tmp_hi, 16)), 1);
// Store num in hi and low format
num_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(num, 16);
num_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((num
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)num_hi, 16)), 1);
// num * (1/den) by 32 bit multiplication (result in Q28)
tmpW32 = (WEBRTC_SPL_MUL_16_16(num_hi, tmp_hi) + (WEBRTC_SPL_MUL_16_16(num_hi, tmp_low)
>> 15) + (WEBRTC_SPL_MUL_16_16(num_low, tmp_hi) >> 15));
// Put result in Q31 (convert from Q28)
tmpW32 = WEBRTC_SPL_LSHIFT_W32(tmpW32, 3);
return tmpW32;
}

View File

@ -1,91 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_DotProductWithScale().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word32 WebRtcSpl_DotProductWithScale(WebRtc_Word16 *vector1, WebRtc_Word16 *vector2,
int length, int scaling)
{
WebRtc_Word32 sum;
int i;
#ifdef _ARM_OPT_
#pragma message("NOTE: _ARM_OPT_ optimizations are used")
WebRtc_Word16 len4 = (length >> 2) << 2;
#endif
sum = 0;
#ifndef _ARM_OPT_
for (i = 0; i < length; i++)
{
sum += WEBRTC_SPL_MUL_16_16_RSFT(*vector1++, *vector2++, scaling);
}
#else
if (scaling == 0)
{
for (i = 0; i < len4; i = i + 4)
{
sum += WEBRTC_SPL_MUL_16_16(*vector1, *vector2);
vector1++;
vector2++;
sum += WEBRTC_SPL_MUL_16_16(*vector1, *vector2);
vector1++;
vector2++;
sum += WEBRTC_SPL_MUL_16_16(*vector1, *vector2);
vector1++;
vector2++;
sum += WEBRTC_SPL_MUL_16_16(*vector1, *vector2);
vector1++;
vector2++;
}
for (i = len4; i < length; i++)
{
sum += WEBRTC_SPL_MUL_16_16(*vector1, *vector2);
vector1++;
vector2++;
}
}
else
{
for (i = 0; i < len4; i = i + 4)
{
sum += WEBRTC_SPL_MUL_16_16_RSFT(*vector1, *vector2, scaling);
vector1++;
vector2++;
sum += WEBRTC_SPL_MUL_16_16_RSFT(*vector1, *vector2, scaling);
vector1++;
vector2++;
sum += WEBRTC_SPL_MUL_16_16_RSFT(*vector1, *vector2, scaling);
vector1++;
vector2++;
sum += WEBRTC_SPL_MUL_16_16_RSFT(*vector1, *vector2, scaling);
vector1++;
vector2++;
}
for (i = len4; i < length; i++)
{
sum += WEBRTC_SPL_MUL_16_16_RSFT(*vector1, *vector2, scaling);
vector1++;
vector2++;
}
}
#endif
return sum;
}

View File

@ -1,59 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_DownsampleFast().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
int WebRtcSpl_DownsampleFast(WebRtc_Word16 *in_ptr, WebRtc_Word16 in_length,
WebRtc_Word16 *out_ptr, WebRtc_Word16 out_length,
WebRtc_Word16 *B, WebRtc_Word16 B_length, WebRtc_Word16 factor,
WebRtc_Word16 delay)
{
WebRtc_Word32 o;
int i, j;
WebRtc_Word16 *downsampled_ptr = out_ptr;
WebRtc_Word16 *b_ptr;
WebRtc_Word16 *x_ptr;
WebRtc_Word16 endpos = delay
+ (WebRtc_Word16)WEBRTC_SPL_MUL_16_16(factor, (out_length - 1)) + 1;
if (in_length < endpos)
{
return -1;
}
for (i = delay; i < endpos; i += factor)
{
b_ptr = &B[0];
x_ptr = &in_ptr[i];
o = (WebRtc_Word32)2048; // Round val
for (j = 0; j < B_length; j++)
{
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
}
o = WEBRTC_SPL_RSHIFT_W32(o, 12);
// If output is higher than 32768, saturate it. Same with negative side
*downsampled_ptr++ = WebRtcSpl_SatW32ToW16(o);
}
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,708 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* code_LPC_UB.c
*
* This file contains definition of functions used to
* encode LPC parameters (Shape & gain) of the upper band.
*
*/
#include "encode_lpc_swb.h"
#include "typedefs.h"
#include "settings.h"
#include "lpc_shape_swb12_tables.h"
#include "lpc_shape_swb16_tables.h"
#include "lpc_gain_swb_tables.h"
#include <stdio.h>
#include <string.h>
#include <math.h>
/******************************************************************************
* WebRtcIsac_RemoveLarMean()
*
* Remove the means from LAR coefficients.
*
* Input:
* -lar : pointer to lar vectors. LAR vectors are
* concatenated.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -lar : pointer to mean-removed LAR:s.
*
*
*/
WebRtc_Word16
WebRtcIsac_RemoveLarMean(
double* lar,
WebRtc_Word16 bandwidth)
{
WebRtc_Word16 coeffCntr;
WebRtc_Word16 vecCntr;
WebRtc_Word16 numVec;
const double* meanLAR;
switch(bandwidth)
{
case isac12kHz:
{
numVec = UB_LPC_VEC_PER_FRAME;
meanLAR = WebRtcIsac_kMeanLarUb12;
break;
}
case isac16kHz:
{
numVec = UB16_LPC_VEC_PER_FRAME;
meanLAR = WebRtcIsac_kMeanLarUb16;
break;
}
default:
return -1;
}
for(vecCntr = 0; vecCntr < numVec; vecCntr++)
{
for(coeffCntr = 0; coeffCntr < UB_LPC_ORDER; coeffCntr++)
{
// REMOVE MEAN
*lar++ -= meanLAR[coeffCntr];
}
}
return 0;
}
/******************************************************************************
* WebRtcIsac_DecorrelateIntraVec()
*
* Remove the correlation amonge the components of LAR vectors. If LAR vectors
* of one frame are put in a matrix where each column is a LAR vector of a
* sub-frame, then this is equivalent to multiplying the LAR matrix with
* a decorrelting mtrix from left.
*
* Input:
* -inLar : pointer to mean-removed LAR vecrtors.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : decorrelated LAR vectors.
*/
WebRtc_Word16
WebRtcIsac_DecorrelateIntraVec(
const double* data,
double* out,
WebRtc_Word16 bandwidth)
{
const double* ptrData;
const double* ptrRow;
WebRtc_Word16 rowCntr;
WebRtc_Word16 colCntr;
WebRtc_Word16 larVecCntr;
WebRtc_Word16 numVec;
const double* decorrMat;
switch(bandwidth)
{
case isac12kHz:
{
decorrMat = &WebRtcIsac_kIntraVecDecorrMatUb12[0][0];
numVec = UB_LPC_VEC_PER_FRAME;
break;
}
case isac16kHz:
{
decorrMat = &WebRtcIsac_kIintraVecDecorrMatUb16[0][0];
numVec = UB16_LPC_VEC_PER_FRAME;
break;
}
default:
return -1;
}
//
// decorrMat * data
//
// data is assumed to contain 'numVec' of LAR
// vectors (mean removed) each of dimension 'UB_LPC_ORDER'
// concatenated one after the other.
//
ptrData = data;
for(larVecCntr = 0; larVecCntr < numVec; larVecCntr++)
{
for(rowCntr = 0; rowCntr < UB_LPC_ORDER; rowCntr++)
{
ptrRow = &decorrMat[rowCntr * UB_LPC_ORDER];
*out = 0;
for(colCntr = 0; colCntr < UB_LPC_ORDER; colCntr++)
{
*out += ptrData[colCntr] * ptrRow[colCntr];
}
out++;
}
ptrData += UB_LPC_ORDER;
}
return 0;
}
/******************************************************************************
* WebRtcIsac_DecorrelateInterVec()
*
* Remover the correlation among mean-removed LAR vectors. If LAR vectors
* of one frame are put in a matrix where each column is a LAR vector of a
* sub-frame, then this is equivalent to multiplying the LAR matrix with
* a decorrelting mtrix from right.
*
* Input:
* -data : pointer to matrix of LAR vectors. The matrix
* is stored column-wise.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : decorrelated LAR vectors.
*/
WebRtc_Word16
WebRtcIsac_DecorrelateInterVec(
const double* data,
double* out,
WebRtc_Word16 bandwidth)
{
WebRtc_Word16 coeffCntr;
WebRtc_Word16 rowCntr;
WebRtc_Word16 colCntr;
const double* decorrMat;
WebRtc_Word16 interVecDim;
switch(bandwidth)
{
case isac12kHz:
{
decorrMat = &WebRtcIsac_kInterVecDecorrMatUb12[0][0];
interVecDim = UB_LPC_VEC_PER_FRAME;
break;
}
case isac16kHz:
{
decorrMat = &WebRtcIsac_kInterVecDecorrMatUb16[0][0];
interVecDim = UB16_LPC_VEC_PER_FRAME;
break;
}
default:
return -1;
}
//
// data * decorrMat
//
// data is of size 'interVecDim' * 'UB_LPC_ORDER'
// That is 'interVecDim' of LAR vectors (mean removed)
// in columns each of dimension 'UB_LPC_ORDER'.
// matrix is stored column-wise.
//
for(coeffCntr = 0; coeffCntr < UB_LPC_ORDER; coeffCntr++)
{
for(colCntr = 0; colCntr < interVecDim; colCntr++)
{
out[coeffCntr + colCntr * UB_LPC_ORDER] = 0;
for(rowCntr = 0; rowCntr < interVecDim; rowCntr++)
{
out[coeffCntr + colCntr * UB_LPC_ORDER] +=
data[coeffCntr + rowCntr * UB_LPC_ORDER] *
decorrMat[rowCntr * interVecDim + colCntr];
}
}
}
return 0;
}
/******************************************************************************
* WebRtcIsac_QuantizeUncorrLar()
*
* Quantize the uncorrelated parameters.
*
* Input:
* -data : uncorrelated LAR vectors.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -data : quantized version of the input.
* -idx : pointer to quantization indices.
*/
double
WebRtcIsac_QuantizeUncorrLar(
double* data,
int* recIdx,
WebRtc_Word16 bandwidth)
{
WebRtc_Word16 cntr;
WebRtc_Word32 idx;
WebRtc_Word16 interVecDim;
const double* leftRecPoint;
double quantizationStepSize;
const WebRtc_Word16* numQuantCell;
switch(bandwidth)
{
case isac12kHz:
{
leftRecPoint = WebRtcIsac_kLpcShapeLeftRecPointUb12;
quantizationStepSize = WebRtcIsac_kLpcShapeQStepSizeUb12;
numQuantCell = WebRtcIsac_kLpcShapeNumRecPointUb12;
interVecDim = UB_LPC_VEC_PER_FRAME;
break;
}
case isac16kHz:
{
leftRecPoint = WebRtcIsac_kLpcShapeLeftRecPointUb16;
quantizationStepSize = WebRtcIsac_kLpcShapeQStepSizeUb16;
numQuantCell = WebRtcIsac_kLpcShapeNumRecPointUb16;
interVecDim = UB16_LPC_VEC_PER_FRAME;
break;
}
default:
return -1;
}
//
// Quantize the parametrs.
//
for(cntr = 0; cntr < UB_LPC_ORDER * interVecDim; cntr++)
{
idx = (WebRtc_Word32)floor((*data - leftRecPoint[cntr]) /
quantizationStepSize + 0.5);
if(idx < 0)
{
idx = 0;
}
else if(idx >= numQuantCell[cntr])
{
idx = numQuantCell[cntr] - 1;
}
*data++ = leftRecPoint[cntr] + idx * quantizationStepSize;
*recIdx++ = idx;
}
return 0;
}
/******************************************************************************
* WebRtcIsac_DequantizeLpcParam()
*
* Get the quantized value of uncorrelated LARs given the quantization indices.
*
* Input:
* -idx : pointer to quantiztion indices.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : pointer to quantized values.
*/
WebRtc_Word16
WebRtcIsac_DequantizeLpcParam(
const int* idx,
double* out,
WebRtc_Word16 bandwidth)
{
WebRtc_Word16 cntr;
WebRtc_Word16 interVecDim;
const double* leftRecPoint;
double quantizationStepSize;
switch(bandwidth)
{
case isac12kHz:
{
leftRecPoint = WebRtcIsac_kLpcShapeLeftRecPointUb12;
quantizationStepSize = WebRtcIsac_kLpcShapeQStepSizeUb12;
interVecDim = UB_LPC_VEC_PER_FRAME;
break;
}
case isac16kHz:
{
leftRecPoint = WebRtcIsac_kLpcShapeLeftRecPointUb16;
quantizationStepSize = WebRtcIsac_kLpcShapeQStepSizeUb16;
interVecDim = UB16_LPC_VEC_PER_FRAME;
break;
}
default:
return -1;
}
//
// Dequantize given the quantization indices
//
for(cntr = 0; cntr < UB_LPC_ORDER * interVecDim; cntr++)
{
*out++ = leftRecPoint[cntr] + *idx++ * quantizationStepSize;
}
return 0;
}
/******************************************************************************
* WebRtcIsac_CorrelateIntraVec()
*
* This is the inverse of WebRtcIsac_DecorrelateIntraVec().
*
* Input:
* -data : uncorrelated parameters.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : correlated parametrs.
*/
WebRtc_Word16
WebRtcIsac_CorrelateIntraVec(
const double* data,
double* out,
WebRtc_Word16 bandwidth)
{
WebRtc_Word16 vecCntr;
WebRtc_Word16 rowCntr;
WebRtc_Word16 colCntr;
WebRtc_Word16 numVec;
const double* ptrData;
const double* intraVecDecorrMat;
switch(bandwidth)
{
case isac12kHz:
{
numVec = UB_LPC_VEC_PER_FRAME;
intraVecDecorrMat = &WebRtcIsac_kIntraVecDecorrMatUb12[0][0];
break;
}
case isac16kHz:
{
numVec = UB16_LPC_VEC_PER_FRAME;
intraVecDecorrMat = &WebRtcIsac_kIintraVecDecorrMatUb16[0][0];
break;
}
default:
return -1;
}
ptrData = data;
for(vecCntr = 0; vecCntr < numVec; vecCntr++)
{
for(colCntr = 0; colCntr < UB_LPC_ORDER; colCntr++)
{
*out = 0;
for(rowCntr = 0; rowCntr < UB_LPC_ORDER; rowCntr++)
{
*out += ptrData[rowCntr] *
intraVecDecorrMat[rowCntr * UB_LPC_ORDER + colCntr];
}
out++;
}
ptrData += UB_LPC_ORDER;
}
return 0;
}
/******************************************************************************
* WebRtcIsac_CorrelateInterVec()
*
* This is the inverse of WebRtcIsac_DecorrelateInterVec().
*
* Input:
* -data
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : correlated parametrs.
*/
WebRtc_Word16
WebRtcIsac_CorrelateInterVec(
const double* data,
double* out,
WebRtc_Word16 bandwidth)
{
WebRtc_Word16 coeffCntr;
WebRtc_Word16 rowCntr;
WebRtc_Word16 colCntr;
WebRtc_Word16 interVecDim;
double myVec[UB16_LPC_VEC_PER_FRAME];
const double* interVecDecorrMat;
switch(bandwidth)
{
case isac12kHz:
{
interVecDim = UB_LPC_VEC_PER_FRAME;
interVecDecorrMat = &WebRtcIsac_kInterVecDecorrMatUb12[0][0];
break;
}
case isac16kHz:
{
interVecDim = UB16_LPC_VEC_PER_FRAME;
interVecDecorrMat = &WebRtcIsac_kInterVecDecorrMatUb16[0][0];
break;
}
default:
return -1;
}
for(coeffCntr = 0; coeffCntr < UB_LPC_ORDER; coeffCntr++)
{
for(rowCntr = 0; rowCntr < interVecDim; rowCntr++)
{
myVec[rowCntr] = 0;
for(colCntr = 0; colCntr < interVecDim; colCntr++)
{
myVec[rowCntr] += data[coeffCntr + colCntr * UB_LPC_ORDER] * //*ptrData *
interVecDecorrMat[rowCntr * interVecDim + colCntr];
//ptrData += UB_LPC_ORDER;
}
}
for(rowCntr = 0; rowCntr < interVecDim; rowCntr++)
{
out[coeffCntr + rowCntr * UB_LPC_ORDER] = myVec[rowCntr];
}
}
return 0;
}
/******************************************************************************
* WebRtcIsac_AddLarMean()
*
* This is the inverse of WebRtcIsac_RemoveLarMean()
*
* Input:
* -data : pointer to mean-removed LAR:s.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -data : pointer to LARs.
*/
WebRtc_Word16
WebRtcIsac_AddLarMean(
double* data,
WebRtc_Word16 bandwidth)
{
WebRtc_Word16 coeffCntr;
WebRtc_Word16 vecCntr;
WebRtc_Word16 numVec;
const double* meanLAR;
switch(bandwidth)
{
case isac12kHz:
{
numVec = UB_LPC_VEC_PER_FRAME;
meanLAR = WebRtcIsac_kMeanLarUb12;
break;
}
case isac16kHz:
{
numVec = UB16_LPC_VEC_PER_FRAME;
meanLAR = WebRtcIsac_kMeanLarUb16;
break;
}
default:
return -1;
}
for(vecCntr = 0; vecCntr < numVec; vecCntr++)
{
for(coeffCntr = 0; coeffCntr < UB_LPC_ORDER; coeffCntr++)
{
*data++ += meanLAR[coeffCntr];
}
}
return 0;
}
/******************************************************************************
* WebRtcIsac_ToLogDomainRemoveMean()
*
* Transform the LPC gain to log domain then remove the mean value.
*
* Input:
* -lpcGain : pointer to LPC Gain, expecting 6 LPC gains
*
* Output:
* -lpcGain : mean-removed in log domain.
*/
WebRtc_Word16
WebRtcIsac_ToLogDomainRemoveMean(
double* data)
{
WebRtc_Word16 coeffCntr;
for(coeffCntr = 0; coeffCntr < UB_LPC_GAIN_DIM; coeffCntr++)
{
data[coeffCntr] = log(data[coeffCntr]) - WebRtcIsac_kMeanLpcGain;
}
return 0;
}
/******************************************************************************
* WebRtcIsac_DecorrelateLPGain()
*
* Decorrelate LPC gains. There are 6 LPC Gains per frame. This is like
* multiplying gain vector with decorrelating matrix.
*
* Input:
* -data : LPC gain in log-domain with mean removed.
*
* Output:
* -out : decorrelated parameters.
*/
WebRtc_Word16 WebRtcIsac_DecorrelateLPGain(
const double* data,
double* out)
{
WebRtc_Word16 rowCntr;
WebRtc_Word16 colCntr;
for(colCntr = 0; colCntr < UB_LPC_GAIN_DIM; colCntr++)
{
*out = 0;
for(rowCntr = 0; rowCntr < UB_LPC_GAIN_DIM; rowCntr++)
{
*out += data[rowCntr] * WebRtcIsac_kLpcGainDecorrMat[rowCntr][colCntr];
}
out++;
}
return 0;
}
/******************************************************************************
* WebRtcIsac_QuantizeLpcGain()
*
* Quantize the decorrelated log-domain gains.
*
* Input:
* -lpcGain : uncorrelated LPC gains.
*
* Output:
* -idx : quantization indices
* -lpcGain : quantized value of the inpt.
*/
double WebRtcIsac_QuantizeLpcGain(
double* data,
int* idx)
{
WebRtc_Word16 coeffCntr;
for(coeffCntr = 0; coeffCntr < UB_LPC_GAIN_DIM; coeffCntr++)
{
*idx = (int)floor((*data - WebRtcIsac_kLeftRecPointLpcGain[coeffCntr]) /
WebRtcIsac_kQSizeLpcGain + 0.5);
if(*idx < 0)
{
*idx = 0;
}
else if(*idx >= WebRtcIsac_kNumQCellLpcGain[coeffCntr])
{
*idx = WebRtcIsac_kNumQCellLpcGain[coeffCntr] - 1;
}
*data = WebRtcIsac_kLeftRecPointLpcGain[coeffCntr] + *idx *
WebRtcIsac_kQSizeLpcGain;
data++;
idx++;
}
return 0;
}
/******************************************************************************
* WebRtcIsac_DequantizeLpcGain()
*
* Get the quantized values given the quantization indices.
*
* Input:
* -idx : pointer to quantization indices.
*
* Output:
* -lpcGains : quantized values of the given parametes.
*/
WebRtc_Word16 WebRtcIsac_DequantizeLpcGain(
const int* idx,
double* out)
{
WebRtc_Word16 coeffCntr;
for(coeffCntr = 0; coeffCntr < UB_LPC_GAIN_DIM; coeffCntr++)
{
*out = WebRtcIsac_kLeftRecPointLpcGain[coeffCntr] + *idx *
WebRtcIsac_kQSizeLpcGain;
out++;
idx++;
}
return 0;
}
/******************************************************************************
* WebRtcIsac_CorrelateLpcGain()
*
* This is the inverse of WebRtcIsac_DecorrelateLPGain().
*
* Input:
* -data : decorrelated parameters.
*
* Output:
* -out : correlated parameters.
*/
WebRtc_Word16 WebRtcIsac_CorrelateLpcGain(
const double* data,
double* out)
{
WebRtc_Word16 rowCntr;
WebRtc_Word16 colCntr;
for(rowCntr = 0; rowCntr < UB_LPC_GAIN_DIM; rowCntr++)
{
*out = 0;
for(colCntr = 0; colCntr < UB_LPC_GAIN_DIM; colCntr++)
{
*out += WebRtcIsac_kLpcGainDecorrMat[rowCntr][colCntr] * data[colCntr];
}
out++;
}
return 0;
}
/******************************************************************************
* WebRtcIsac_AddMeanToLinearDomain()
*
* This is the inverse of WebRtcIsac_ToLogDomainRemoveMean().
*
* Input:
* -lpcGain : LPC gain in log-domain & mean removed
*
* Output:
* -lpcGain : LPC gain in normal domain.
*/
WebRtc_Word16 WebRtcIsac_AddMeanToLinearDomain(
double* lpcGains)
{
WebRtc_Word16 coeffCntr;
for(coeffCntr = 0; coeffCntr < UB_LPC_GAIN_DIM; coeffCntr++)
{
lpcGains[coeffCntr] = exp(lpcGains[coeffCntr] + WebRtcIsac_kMeanLpcGain);
}
return 0;
}

View File

@ -1,283 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* encode_lpc_swb.h
*
* This file contains declaration of functions used to
* encode LPC parameters (Shape & gain) of the upper band.
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENCODE_LPC_SWB_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENCODE_LPC_SWB_H_
#include "typedefs.h"
#include "settings.h"
#include "structs.h"
/******************************************************************************
* WebRtcIsac_RemoveLarMean()
*
* Remove the means from LAR coefficients.
*
* Input:
* -lar : pointer to lar vectors. LAR vectors are
* concatenated.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -lar : pointer to mean-removed LAR:s.
*
*
*/
WebRtc_Word16 WebRtcIsac_RemoveLarMean(
double* lar,
WebRtc_Word16 bandwidth);
/******************************************************************************
* WebRtcIsac_DecorrelateIntraVec()
*
* Remove the correlation amonge the components of LAR vectors. If LAR vectors
* of one frame are put in a matrix where each column is a LAR vector of a
* sub-frame, then this is equivalent to multiplying the LAR matrix with
* a decorrelting mtrix from left.
*
* Input:
* -inLar : pointer to mean-removed LAR vecrtors.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : decorrelated LAR vectors.
*/
WebRtc_Word16 WebRtcIsac_DecorrelateIntraVec(
const double* inLAR,
double* out,
WebRtc_Word16 bandwidth);
/******************************************************************************
* WebRtcIsac_DecorrelateInterVec()
*
* Remover the correlation among mean-removed LAR vectors. If LAR vectors
* of one frame are put in a matrix where each column is a LAR vector of a
* sub-frame, then this is equivalent to multiplying the LAR matrix with
* a decorrelting mtrix from right.
*
* Input:
* -data : pointer to matrix of LAR vectors. The matrix
* is stored column-wise.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : decorrelated LAR vectors.
*/
WebRtc_Word16 WebRtcIsac_DecorrelateInterVec(
const double* data,
double* out,
WebRtc_Word16 bandwidth);
/******************************************************************************
* WebRtcIsac_QuantizeUncorrLar()
*
* Quantize the uncorrelated parameters.
*
* Input:
* -data : uncorrelated LAR vectors.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -data : quantized version of the input.
* -idx : pointer to quantization indices.
*/
double WebRtcIsac_QuantizeUncorrLar(
double* data,
int* idx,
WebRtc_Word16 bandwidth);
/******************************************************************************
* WebRtcIsac_CorrelateIntraVec()
*
* This is the inverse of WebRtcIsac_DecorrelateIntraVec().
*
* Input:
* -data : uncorrelated parameters.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : correlated parametrs.
*/
WebRtc_Word16 WebRtcIsac_CorrelateIntraVec(
const double* data,
double* out,
WebRtc_Word16 bandwidth);
/******************************************************************************
* WebRtcIsac_CorrelateInterVec()
*
* This is the inverse of WebRtcIsac_DecorrelateInterVec().
*
* Input:
* -data
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : correlated parametrs.
*/
WebRtc_Word16 WebRtcIsac_CorrelateInterVec(
const double* data,
double* out,
WebRtc_Word16 bandwidth);
/******************************************************************************
* WebRtcIsac_AddLarMean()
*
* This is the inverse of WebRtcIsac_RemoveLarMean()
*
* Input:
* -data : pointer to mean-removed LAR:s.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -data : pointer to LARs.
*/
WebRtc_Word16 WebRtcIsac_AddLarMean(
double* data,
WebRtc_Word16 bandwidth);
/******************************************************************************
* WebRtcIsac_DequantizeLpcParam()
*
* Get the quantized value of uncorrelated LARs given the quantization indices.
*
* Input:
* -idx : pointer to quantiztion indices.
* -bandwidth : indicates if the given LAR vectors belong
* to SWB-12kHz or SWB-16kHz.
*
* Output:
* -out : pointer to quantized values.
*/
WebRtc_Word16 WebRtcIsac_DequantizeLpcParam(
const int* idx,
double* out,
WebRtc_Word16 bandwidth);
/******************************************************************************
* WebRtcIsac_ToLogDomainRemoveMean()
*
* Transform the LPC gain to log domain then remove the mean value.
*
* Input:
* -lpcGain : pointer to LPC Gain, expecting 6 LPC gains
*
* Output:
* -lpcGain : mean-removed in log domain.
*/
WebRtc_Word16 WebRtcIsac_ToLogDomainRemoveMean(
double* lpGains);
/******************************************************************************
* WebRtcIsac_DecorrelateLPGain()
*
* Decorrelate LPC gains. There are 6 LPC Gains per frame. This is like
* multiplying gain vector with decorrelating matrix.
*
* Input:
* -data : LPC gain in log-domain with mean removed.
*
* Output:
* -out : decorrelated parameters.
*/
WebRtc_Word16 WebRtcIsac_DecorrelateLPGain(
const double* data,
double* out);
/******************************************************************************
* WebRtcIsac_QuantizeLpcGain()
*
* Quantize the decorrelated log-domain gains.
*
* Input:
* -lpcGain : uncorrelated LPC gains.
*
* Output:
* -idx : quantization indices
* -lpcGain : quantized value of the inpt.
*/
double WebRtcIsac_QuantizeLpcGain(
double* lpGains,
int* idx);
/******************************************************************************
* WebRtcIsac_DequantizeLpcGain()
*
* Get the quantized values given the quantization indices.
*
* Input:
* -idx : pointer to quantization indices.
*
* Output:
* -lpcGains : quantized values of the given parametes.
*/
WebRtc_Word16 WebRtcIsac_DequantizeLpcGain(
const int* idx,
double* lpGains);
/******************************************************************************
* WebRtcIsac_CorrelateLpcGain()
*
* This is the inverse of WebRtcIsac_DecorrelateLPGain().
*
* Input:
* -data : decorrelated parameters.
*
* Output:
* -out : correlated parameters.
*/
WebRtc_Word16 WebRtcIsac_CorrelateLpcGain(
const double* data,
double* out);
/******************************************************************************
* WebRtcIsac_AddMeanToLinearDomain()
*
* This is the inverse of WebRtcIsac_ToLogDomainRemoveMean().
*
* Input:
* -lpcGain : LPC gain in log-domain & mean removed
*
* Output:
* -lpcGain : LPC gain in normal domain.
*/
WebRtc_Word16 WebRtcIsac_AddMeanToLinearDomain(
double* lpcGains);
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENCODE_LPC_SWB_H_

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_Energy().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
WebRtc_Word32 WebRtcSpl_Energy(WebRtc_Word16* vector, int vector_length, int* scale_factor)
{
WebRtc_Word32 en = 0;
int i;
int scaling = WebRtcSpl_GetScalingSquare(vector, vector_length, vector_length);
int looptimes = vector_length;
WebRtc_Word16 *vectorptr = vector;
for (i = 0; i < looptimes; i++)
{
en += WEBRTC_SPL_MUL_16_16_RSFT(*vectorptr, *vectorptr, scaling);
vectorptr++;
}
*scale_factor = scaling;
return en;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,412 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* entropy_coding.h
*
* This header file declares all of the functions used to arithmetically
* encode the iSAC bistream
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENTROPY_CODING_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENTROPY_CODING_H_
#include "structs.h"
/* decode complex spectrum (return number of bytes in stream) */
int WebRtcIsac_DecodeSpecLb(Bitstr *streamdata,
double *fr,
double *fi,
WebRtc_Word16 AvgPitchGain_Q12);
/******************************************************************************
* WebRtcIsac_DecodeSpecUB16()
* Decode real and imaginary part of the DFT coefficients, given a bit-stream.
* This function is called when the codec is in 0-16 kHz bandwidth.
* The decoded DFT coefficient can be transformed to time domain by
* WebRtcIsac_Time2Spec().
*
* Input:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Output:
* -*fr : pointer to a buffer where the real part of DFT
* coefficients are written to.
* -*fi : pointer to a buffer where the imaginary part
* of DFT coefficients are written to.
*
* Return value : < 0 if an error occures
* 0 if succeeded.
*/
int WebRtcIsac_DecodeSpecUB16(
Bitstr* streamdata,
double* fr,
double* fi);
/******************************************************************************
* WebRtcIsac_DecodeSpecUB12()
* Decode real and imaginary part of the DFT coefficients, given a bit-stream.
* This function is called when the codec is in 0-12 kHz bandwidth.
* The decoded DFT coefficient can be transformed to time domain by
* WebRtcIsac_Time2Spec().
*
* Input:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Output:
* -*fr : pointer to a buffer where the real part of DFT
* coefficients are written to.
* -*fi : pointer to a buffer where the imaginary part
* of DFT coefficients are written to.
*
* Return value : < 0 if an error occures
* 0 if succeeded.
*/
int WebRtcIsac_DecodeSpecUB12(
Bitstr* streamdata,
double* fr,
double* fi);
/* encode complex spectrum */
int WebRtcIsac_EncodeSpecLb(const WebRtc_Word16* fr,
const WebRtc_Word16* fi,
Bitstr* streamdata,
WebRtc_Word16 AvgPitchGain_Q12);
/******************************************************************************
* WebRtcIsac_EncodeSpecUB16()
* Quantize and encode real and imaginary part of the DFT coefficients.
* This function is called when the codec is in 0-16 kHz bandwidth.
* The real and imaginary part are computed by calling WebRtcIsac_Time2Spec().
*
*
* Input:
* -*fr : pointer to a buffer where the real part of DFT
* coefficients are stored.
* -*fi : pointer to a buffer where the imaginary part
* of DFT coefficients are stored.
*
* Output:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Return value : < 0 if an error occures
* 0 if succeeded.
*/
int WebRtcIsac_EncodeSpecUB16(
const WebRtc_Word16* fr,
const WebRtc_Word16* fi,
Bitstr* streamdata);
/******************************************************************************
* WebRtcIsac_EncodeSpecUB12()
* Quantize and encode real and imaginary part of the DFT coefficients.
* This function is called when the codec is in 0-12 kHz bandwidth.
* The real and imaginary part are computed by calling WebRtcIsac_Time2Spec().
*
*
* Input:
* -*fr : pointer to a buffer where the real part of DFT
* coefficients are stored.
* -*fi : pointer to a buffer where the imaginary part
* of DFT coefficients are stored.
*
* Output:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Return value : < 0 if an error occures
* 0 if succeeded.
*/
int WebRtcIsac_EncodeSpecUB12(
const WebRtc_Word16* fr,
const WebRtc_Word16* fi,
Bitstr* streamdata);
/* decode & dequantize LPC Coef */
int WebRtcIsac_DecodeLpcCoef(Bitstr *streamdata, double *LPCCoef, int *outmodel);
int WebRtcIsac_DecodeLpcCoefUB(
Bitstr* streamdata,
double* lpcVecs,
double* percepFilterGains,
WebRtc_Word16 bandwidth);
int WebRtcIsac_DecodeLpc(Bitstr *streamdata, double *LPCCoef_lo, double *LPCCoef_hi, int *outmodel);
/* quantize & code LPC Coef */
void WebRtcIsac_EncodeLpcLb(double *LPCCoef_lo, double *LPCCoef_hi, int *model, double *size, Bitstr *streamdata, ISAC_SaveEncData_t* encData);
void WebRtcIsac_EncodeLpcGainLb(double *LPCCoef_lo, double *LPCCoef_hi, int model, Bitstr *streamdata, ISAC_SaveEncData_t* encData);
/******************************************************************************
* WebRtcIsac_EncodeLpcUB()
* Encode LPC parameters, given as A-polynomial, of upper-band. The encoding
* is performed in LAR domain.
* For the upper-band, we compute and encode LPC of some sub-frames, LPC of
* other sub-frames are computed by linear interpolation, in LAR domain. This
* function performs the interpolation and returns the LPC of all sub-frames.
*
* Inputs:
* - lpcCoef : a buffer containing A-polynomials of sub-frames
* (excluding first coefficient that is 1).
* - bandwidth : specifies if the codec is operating at 0-12 kHz
* or 0-16 kHz mode.
*
* Input/output:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Output:
* - interpolLPCCoeff : Decoded and interpolated LPC (A-polynomial)
* of all sub-frames.
* If LP analysis is of order K, and there are N
* sub-frames then this is a buffer of size
* (k + 1) * N, each vector starts with the LPC gain
* of the corresponding sub-frame. The LPC gains
* are encoded and inserted after this function is
* called. The first A-coefficient which is 1 is not
* included.
*
* Return value : 0 if encoding is successful,
* <0 if failed to encode.
*/
WebRtc_Word16 WebRtcIsac_EncodeLpcUB(
double* lpcCoeff,
Bitstr* streamdata,
double* interpolLPCCoeff,
WebRtc_Word16 bandwidth,
ISACUBSaveEncDataStruct* encData);
/******************************************************************************
* WebRtcIsac_DecodeInterpolLpcUb()
* Decode LPC coefficients and interpolate to get the coefficients fo all
* sub-frmaes.
*
* Inputs:
* - bandwidth : spepecifies if the codec is in 0-12 kHz or
* 0-16 kHz mode.
*
* Input/output:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Output:
* - percepFilterParam : Decoded and interpolated LPC (A-polynomial) of
* all sub-frames.
* If LP analysis is of order K, and there are N
* sub-frames then this is a buffer of size
* (k + 1) * N, each vector starts with the LPC gain
* of the corresponding sub-frame. The LPC gains
* are encoded and inserted after this function is
* called. The first A-coefficient which is 1 is not
* included.
*
* Return value : 0 if encoding is successful,
* <0 if failed to encode.
*/
WebRtc_Word16 WebRtcIsac_DecodeInterpolLpcUb(
Bitstr* streamdata,
double* percepFilterParam,
WebRtc_Word16 bandwidth);
/* decode & dequantize RC */
int WebRtcIsac_DecodeRc(Bitstr *streamdata, WebRtc_Word16 *RCQ15);
/* quantize & code RC */
void WebRtcIsac_EncodeRc(WebRtc_Word16 *RCQ15, Bitstr *streamdata);
/* decode & dequantize squared Gain */
int WebRtcIsac_DecodeGain2(Bitstr *streamdata, WebRtc_Word32 *Gain2);
/* quantize & code squared Gain (input is squared gain) */
int WebRtcIsac_EncodeGain2(WebRtc_Word32 *gain2, Bitstr *streamdata);
void WebRtcIsac_EncodePitchGain(WebRtc_Word16* PitchGains_Q12, Bitstr* streamdata, ISAC_SaveEncData_t* encData);
void WebRtcIsac_EncodePitchLag(double* PitchLags, WebRtc_Word16* PitchGain_Q12, Bitstr* streamdata, ISAC_SaveEncData_t* encData);
int WebRtcIsac_DecodePitchGain(Bitstr *streamdata, WebRtc_Word16 *PitchGain_Q12);
int WebRtcIsac_DecodePitchLag(Bitstr *streamdata, WebRtc_Word16 *PitchGain_Q12, double *PitchLag);
int WebRtcIsac_DecodeFrameLen(Bitstr *streamdata, WebRtc_Word16 *framelength);
int WebRtcIsac_EncodeFrameLen(WebRtc_Word16 framelength, Bitstr *streamdata);
int WebRtcIsac_DecodeSendBW(Bitstr *streamdata, WebRtc_Word16 *BWno);
void WebRtcIsac_EncodeReceiveBw(int *BWno, Bitstr *streamdata);
/* step-down */
void WebRtcIsac_Poly2Rc(double *a, int N, double *RC);
/* step-up */
void WebRtcIsac_Rc2Poly(double *RC, int N, double *a);
void WebRtcIsac_TranscodeLPCCoef(double *LPCCoef_lo, double *LPCCoef_hi, int model,
int *index_g);
/******************************************************************************
* WebRtcIsac_EncodeLpcGainUb()
* Encode LPC gains of sub-Frames.
*
* Input/outputs:
* - lpGains : a buffer which contains 'SUBFRAME' number of
* LP gains to be encoded. The input values are
* overwritten by the quantized values.
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Output:
* - lpcGainIndex : quantization indices for lpc gains, these will
* be stored to be used for FEC.
*/
void WebRtcIsac_EncodeLpcGainUb(
double* lpGains,
Bitstr* streamdata,
int* lpcGainIndex);
/******************************************************************************
* WebRtcIsac_EncodeLpcGainUb()
* Store LPC gains of sub-Frames in 'streamdata'.
*
* Input:
* - lpGains : a buffer which contains 'SUBFRAME' number of
* LP gains to be encoded.
* Input/outputs:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
*/
void WebRtcIsac_StoreLpcGainUb(
double* lpGains,
Bitstr* streamdata);
/******************************************************************************
* WebRtcIsac_DecodeLpcGainUb()
* Decode the LPC gain of sub-frames.
*
* Input/output:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Output:
* - lpGains : a buffer where decoded LPC gians will be stored.
*
* Return value : 0 if succeeded.
* <0 if failed.
*/
WebRtc_Word16 WebRtcIsac_DecodeLpcGainUb(
double* lpGains,
Bitstr* streamdata);
/******************************************************************************
* WebRtcIsac_EncodeBandwidth()
* Encode if the bandwidth of encoded audio is 0-12 kHz or 0-16 kHz.
*
* Input:
* - bandwidth : an enumerator specifying if the codec in is
* 0-12 kHz or 0-16 kHz mode.
*
* Input/output:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Return value : 0 if succeeded.
* <0 if failed.
*/
WebRtc_Word16 WebRtcIsac_EncodeBandwidth(
enum ISACBandwidth bandwidth,
Bitstr* streamData);
/******************************************************************************
* WebRtcIsac_DecodeBandwidth()
* Decode the bandwidth of the encoded audio, i.e. if the bandwidth is 0-12 kHz
* or 0-16 kHz.
*
* Input/output:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Output:
* - bandwidth : an enumerator specifying if the codec is in
* 0-12 kHz or 0-16 kHz mode.
*
* Return value : 0 if succeeded.
* <0 if failed.
*/
WebRtc_Word16 WebRtcIsac_DecodeBandwidth(
Bitstr* streamData,
enum ISACBandwidth* bandwidth);
/******************************************************************************
* WebRtcIsac_EncodeJitterInfo()
* Decode the jitter information.
*
* Input/output:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Input:
* - jitterInfo : one bit of info specifying if the channel is
* in high/low jitter. Zero indicates low jitter
* and one indicates high jitter.
*
* Return value : 0 if succeeded.
* <0 if failed.
*/
WebRtc_Word16 WebRtcIsac_EncodeJitterInfo(
WebRtc_Word32 jitterIndex,
Bitstr* streamData);
/******************************************************************************
* WebRtcIsac_DecodeJitterInfo()
* Decode the jitter information.
*
* Input/output:
* - streamdata : pointer to a stucture containg the encoded
* data and theparameters needed for entropy
* coding.
*
* Output:
* - jitterInfo : one bit of info specifying if the channel is
* in high/low jitter. Zero indicates low jitter
* and one indicates high jitter.
*
* Return value : 0 if succeeded.
* <0 if failed.
*/
WebRtc_Word16 WebRtcIsac_DecodeJitterInfo(
Bitstr* streamData,
WebRtc_Word32* jitterInfo);
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_ENTROPY_CODING_H_ */

View File

@ -1,947 +0,0 @@
/*
* Copyright(c)1995,97 Mark Olesen <olesen@me.QueensU.CA>
* Queen's Univ at Kingston (Canada)
*
* Permission to use, copy, modify, and distribute this software for
* any purpose without fee is hereby granted, provided that this
* entire notice is included in all copies of any software which is
* or includes a copy or modification of this software and in all
* copies of the supporting documentation for such software.
*
* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR QUEEN'S
* UNIVERSITY AT KINGSTON MAKES ANY REPRESENTATION OR WARRANTY OF ANY
* KIND CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE OR ITS
* FITNESS FOR ANY PARTICULAR PURPOSE.
*
* All of which is to say that you can do what you like with this
* source code provided you don't try to sell it as your own and you
* include an unaltered copy of this message (including the
* copyright).
*
* It is also implicitly understood that bug fixes and improvements
* should make their way back to the general Internet community so
* that everyone benefits.
*
* Changes:
* Trivial type modifications by the WebRTC authors.
*/
/*
* File:
* WebRtcIsac_Fftn.c
*
* Public:
* WebRtcIsac_Fftn / fftnf ();
*
* Private:
* WebRtcIsac_Fftradix / fftradixf ();
*
* Descript:
* multivariate complex Fourier transform, computed in place
* using mixed-radix Fast Fourier Transform algorithm.
*
* Fortran code by:
* RC Singleton, Stanford Research Institute, Sept. 1968
*
* translated by f2c (version 19950721).
*
* int WebRtcIsac_Fftn (int ndim, const int dims[], REAL Re[], REAL Im[],
* int iSign, double scaling);
*
* NDIM = the total number dimensions
* DIMS = a vector of array sizes
* if NDIM is zero then DIMS must be zero-terminated
*
* RE and IM hold the real and imaginary components of the data, and return
* the resulting real and imaginary Fourier coefficients. Multidimensional
* data *must* be allocated contiguously. There is no limit on the number
* of dimensions.
*
* ISIGN = the sign of the complex exponential (ie, forward or inverse FFT)
* the magnitude of ISIGN (normally 1) is used to determine the
* correct indexing increment (see below).
*
* SCALING = normalizing constant by which the final result is *divided*
* if SCALING == -1, normalize by total dimension of the transform
* if SCALING < -1, normalize by the square-root of the total dimension
*
* example:
* tri-variate transform with Re[n1][n2][n3], Im[n1][n2][n3]
*
* int dims[3] = {n1,n2,n3}
* WebRtcIsac_Fftn (3, dims, Re, Im, 1, scaling);
*
*-----------------------------------------------------------------------*
* int WebRtcIsac_Fftradix (REAL Re[], REAL Im[], size_t nTotal, size_t nPass,
* size_t nSpan, int iSign, size_t max_factors,
* size_t max_perm);
*
* RE, IM - see above documentation
*
* Although there is no limit on the number of dimensions, WebRtcIsac_Fftradix() must
* be called once for each dimension, but the calls may be in any order.
*
* NTOTAL = the total number of complex data values
* NPASS = the dimension of the current variable
* NSPAN/NPASS = the spacing of consecutive data values while indexing the
* current variable
* ISIGN - see above documentation
*
* example:
* tri-variate transform with Re[n1][n2][n3], Im[n1][n2][n3]
*
* WebRtcIsac_Fftradix (Re, Im, n1*n2*n3, n1, n1, 1, maxf, maxp);
* WebRtcIsac_Fftradix (Re, Im, n1*n2*n3, n2, n1*n2, 1, maxf, maxp);
* WebRtcIsac_Fftradix (Re, Im, n1*n2*n3, n3, n1*n2*n3, 1, maxf, maxp);
*
* single-variate transform,
* NTOTAL = N = NSPAN = (number of complex data values),
*
* WebRtcIsac_Fftradix (Re, Im, n, n, n, 1, maxf, maxp);
*
* The data can also be stored in a single array with alternating real and
* imaginary parts, the magnitude of ISIGN is changed to 2 to give correct
* indexing increment, and data [0] and data [1] used to pass the initial
* addresses for the sequences of real and imaginary values,
*
* example:
* REAL data [2*NTOTAL];
* WebRtcIsac_Fftradix ( &data[0], &data[1], NTOTAL, nPass, nSpan, 2, maxf, maxp);
*
* for temporary allocation:
*
* MAX_FACTORS >= the maximum prime factor of NPASS
* MAX_PERM >= the number of prime factors of NPASS. In addition,
* if the square-free portion K of NPASS has two or more prime
* factors, then MAX_PERM >= (K-1)
*
* storage in FACTOR for a maximum of 15 prime factors of NPASS. if NPASS
* has more than one square-free factor, the product of the square-free
* factors must be <= 210 array storage for maximum prime factor of 23 the
* following two constants should agree with the array dimensions.
*
*----------------------------------------------------------------------*/
#include "fft.h"
#include <stdlib.h>
#include <math.h>
/* double precision routine */
static int
WebRtcIsac_Fftradix (double Re[], double Im[],
size_t nTotal, size_t nPass, size_t nSpan, int isign,
int max_factors, unsigned int max_perm,
FFTstr *fftstate);
#ifndef M_PI
# define M_PI 3.14159265358979323846264338327950288
#endif
#ifndef SIN60
# define SIN60 0.86602540378443865 /* sin(60 deg) */
# define COS72 0.30901699437494742 /* cos(72 deg) */
# define SIN72 0.95105651629515357 /* sin(72 deg) */
#endif
# define REAL double
# define FFTN WebRtcIsac_Fftn
# define FFTNS "fftn"
# define FFTRADIX WebRtcIsac_Fftradix
# define FFTRADIXS "fftradix"
int WebRtcIsac_Fftns(unsigned int ndim, const int dims[],
double Re[],
double Im[],
int iSign,
double scaling,
FFTstr *fftstate)
{
size_t nSpan, nPass, nTotal;
unsigned int i;
int ret, max_factors, max_perm;
/*
* tally the number of elements in the data array
* and determine the number of dimensions
*/
nTotal = 1;
if (ndim && dims [0])
{
for (i = 0; i < ndim; i++)
{
if (dims [i] <= 0)
{
return -1;
}
nTotal *= dims [i];
}
}
else
{
ndim = 0;
for (i = 0; dims [i]; i++)
{
if (dims [i] <= 0)
{
return -1;
}
nTotal *= dims [i];
ndim++;
}
}
/* determine maximum number of factors and permuations */
#if 1
/*
* follow John Beale's example, just use the largest dimension and don't
* worry about excess allocation. May be someone else will do it?
*/
max_factors = max_perm = 1;
for (i = 0; i < ndim; i++)
{
nSpan = dims [i];
if ((int)nSpan > max_factors)
{
max_factors = (int)nSpan;
}
if ((int)nSpan > max_perm)
{
max_perm = (int)nSpan;
}
}
#else
/* use the constants used in the original Fortran code */
max_factors = 23;
max_perm = 209;
#endif
/* loop over the dimensions: */
nPass = 1;
for (i = 0; i < ndim; i++)
{
nSpan = dims [i];
nPass *= nSpan;
ret = FFTRADIX (Re, Im, nTotal, nSpan, nPass, iSign,
max_factors, max_perm, fftstate);
/* exit, clean-up already done */
if (ret)
return ret;
}
/* Divide through by the normalizing constant: */
if (scaling && scaling != 1.0)
{
if (iSign < 0) iSign = -iSign;
if (scaling < 0.0)
{
scaling = (double)nTotal;
if (scaling < -1.0)
scaling = sqrt (scaling);
}
scaling = 1.0 / scaling; /* multiply is often faster */
for (i = 0; i < nTotal; i += iSign)
{
Re [i] *= scaling;
Im [i] *= scaling;
}
}
return 0;
}
/*
* singleton's mixed radix routine
*
* could move allocation out to WebRtcIsac_Fftn(), but leave it here so that it's
* possible to make this a standalone function
*/
static int FFTRADIX (REAL Re[],
REAL Im[],
size_t nTotal,
size_t nPass,
size_t nSpan,
int iSign,
int max_factors,
unsigned int max_perm,
FFTstr *fftstate)
{
int ii, mfactor, kspan, ispan, inc;
int j, jc, jf, jj, k, k1, k2, k3, k4, kk, kt, nn, ns, nt;
REAL radf;
REAL c1, c2, c3, cd, aa, aj, ak, ajm, ajp, akm, akp;
REAL s1, s2, s3, sd, bb, bj, bk, bjm, bjp, bkm, bkp;
REAL *Rtmp = NULL; /* temp space for real part*/
REAL *Itmp = NULL; /* temp space for imaginary part */
REAL *Cos = NULL; /* Cosine values */
REAL *Sin = NULL; /* Sine values */
REAL s60 = SIN60; /* sin(60 deg) */
REAL c72 = COS72; /* cos(72 deg) */
REAL s72 = SIN72; /* sin(72 deg) */
REAL pi2 = M_PI; /* use PI first, 2 PI later */
fftstate->SpaceAlloced = 0;
fftstate->MaxPermAlloced = 0;
// initialize to avoid warnings
k3 = c2 = c3 = s2 = s3 = 0.0;
if (nPass < 2)
return 0;
/* allocate storage */
if (fftstate->SpaceAlloced < max_factors * sizeof (REAL))
{
#ifdef SUN_BROKEN_REALLOC
if (!fftstate->SpaceAlloced) /* first time */
{
fftstate->SpaceAlloced = max_factors * sizeof (REAL);
}
else
{
#endif
fftstate->SpaceAlloced = max_factors * sizeof (REAL);
#ifdef SUN_BROKEN_REALLOC
}
#endif
}
else
{
/* allow full use of alloc'd space */
max_factors = fftstate->SpaceAlloced / sizeof (REAL);
}
if (fftstate->MaxPermAlloced < max_perm)
{
#ifdef SUN_BROKEN_REALLOC
if (!fftstate->MaxPermAlloced) /* first time */
else
#endif
fftstate->MaxPermAlloced = max_perm;
}
else
{
/* allow full use of alloc'd space */
max_perm = fftstate->MaxPermAlloced;
}
if (fftstate->Tmp0 == NULL || fftstate->Tmp1 == NULL || fftstate->Tmp2 == NULL || fftstate->Tmp3 == NULL
|| fftstate->Perm == NULL) {
return -1;
}
/* assign pointers */
Rtmp = (REAL *) fftstate->Tmp0;
Itmp = (REAL *) fftstate->Tmp1;
Cos = (REAL *) fftstate->Tmp2;
Sin = (REAL *) fftstate->Tmp3;
/*
* Function Body
*/
inc = iSign;
if (iSign < 0) {
s72 = -s72;
s60 = -s60;
pi2 = -pi2;
inc = -inc; /* absolute value */
}
/* adjust for strange increments */
nt = inc * (int)nTotal;
ns = inc * (int)nSpan;
kspan = ns;
nn = nt - inc;
jc = ns / (int)nPass;
radf = pi2 * (double) jc;
pi2 *= 2.0; /* use 2 PI from here on */
ii = 0;
jf = 0;
/* determine the factors of n */
mfactor = 0;
k = (int)nPass;
while (k % 16 == 0) {
mfactor++;
fftstate->factor [mfactor - 1] = 4;
k /= 16;
}
j = 3;
jj = 9;
do {
while (k % jj == 0) {
mfactor++;
fftstate->factor [mfactor - 1] = j;
k /= jj;
}
j += 2;
jj = j * j;
} while (jj <= k);
if (k <= 4) {
kt = mfactor;
fftstate->factor [mfactor] = k;
if (k != 1)
mfactor++;
} else {
if (k - (k / 4 << 2) == 0) {
mfactor++;
fftstate->factor [mfactor - 1] = 2;
k /= 4;
}
kt = mfactor;
j = 2;
do {
if (k % j == 0) {
mfactor++;
fftstate->factor [mfactor - 1] = j;
k /= j;
}
j = ((j + 1) / 2 << 1) + 1;
} while (j <= k);
}
if (kt) {
j = kt;
do {
mfactor++;
fftstate->factor [mfactor - 1] = fftstate->factor [j - 1];
j--;
} while (j);
}
/* test that mfactors is in range */
if (mfactor > NFACTOR)
{
return -1;
}
/* compute fourier transform */
for (;;) {
sd = radf / (double) kspan;
cd = sin(sd);
cd = 2.0 * cd * cd;
sd = sin(sd + sd);
kk = 0;
ii++;
switch (fftstate->factor [ii - 1]) {
case 2:
/* transform for factor of 2 (including rotation factor) */
kspan /= 2;
k1 = kspan + 2;
do {
do {
k2 = kk + kspan;
ak = Re [k2];
bk = Im [k2];
Re [k2] = Re [kk] - ak;
Im [k2] = Im [kk] - bk;
Re [kk] += ak;
Im [kk] += bk;
kk = k2 + kspan;
} while (kk < nn);
kk -= nn;
} while (kk < jc);
if (kk >= kspan)
goto Permute_Results_Label; /* exit infinite loop */
do {
c1 = 1.0 - cd;
s1 = sd;
do {
do {
do {
k2 = kk + kspan;
ak = Re [kk] - Re [k2];
bk = Im [kk] - Im [k2];
Re [kk] += Re [k2];
Im [kk] += Im [k2];
Re [k2] = c1 * ak - s1 * bk;
Im [k2] = s1 * ak + c1 * bk;
kk = k2 + kspan;
} while (kk < (nt-1));
k2 = kk - nt;
c1 = -c1;
kk = k1 - k2;
} while (kk > k2);
ak = c1 - (cd * c1 + sd * s1);
s1 = sd * c1 - cd * s1 + s1;
c1 = 2.0 - (ak * ak + s1 * s1);
s1 *= c1;
c1 *= ak;
kk += jc;
} while (kk < k2);
k1 += inc + inc;
kk = (k1 - kspan + 1) / 2 + jc - 1;
} while (kk < (jc + jc));
break;
case 4: /* transform for factor of 4 */
ispan = kspan;
kspan /= 4;
do {
c1 = 1.0;
s1 = 0.0;
do {
do {
k1 = kk + kspan;
k2 = k1 + kspan;
k3 = k2 + kspan;
akp = Re [kk] + Re [k2];
akm = Re [kk] - Re [k2];
ajp = Re [k1] + Re [k3];
ajm = Re [k1] - Re [k3];
bkp = Im [kk] + Im [k2];
bkm = Im [kk] - Im [k2];
bjp = Im [k1] + Im [k3];
bjm = Im [k1] - Im [k3];
Re [kk] = akp + ajp;
Im [kk] = bkp + bjp;
ajp = akp - ajp;
bjp = bkp - bjp;
if (iSign < 0) {
akp = akm + bjm;
bkp = bkm - ajm;
akm -= bjm;
bkm += ajm;
} else {
akp = akm - bjm;
bkp = bkm + ajm;
akm += bjm;
bkm -= ajm;
}
/* avoid useless multiplies */
if (s1 == 0.0) {
Re [k1] = akp;
Re [k2] = ajp;
Re [k3] = akm;
Im [k1] = bkp;
Im [k2] = bjp;
Im [k3] = bkm;
} else {
Re [k1] = akp * c1 - bkp * s1;
Re [k2] = ajp * c2 - bjp * s2;
Re [k3] = akm * c3 - bkm * s3;
Im [k1] = akp * s1 + bkp * c1;
Im [k2] = ajp * s2 + bjp * c2;
Im [k3] = akm * s3 + bkm * c3;
}
kk = k3 + kspan;
} while (kk < nt);
c2 = c1 - (cd * c1 + sd * s1);
s1 = sd * c1 - cd * s1 + s1;
c1 = 2.0 - (c2 * c2 + s1 * s1);
s1 *= c1;
c1 *= c2;
/* values of c2, c3, s2, s3 that will get used next time */
c2 = c1 * c1 - s1 * s1;
s2 = 2.0 * c1 * s1;
c3 = c2 * c1 - s2 * s1;
s3 = c2 * s1 + s2 * c1;
kk = kk - nt + jc;
} while (kk < kspan);
kk = kk - kspan + inc;
} while (kk < jc);
if (kspan == jc)
goto Permute_Results_Label; /* exit infinite loop */
break;
default:
/* transform for odd factors */
#ifdef FFT_RADIX4
return -1;
break;
#else /* FFT_RADIX4 */
k = fftstate->factor [ii - 1];
ispan = kspan;
kspan /= k;
switch (k) {
case 3: /* transform for factor of 3 (optional code) */
do {
do {
k1 = kk + kspan;
k2 = k1 + kspan;
ak = Re [kk];
bk = Im [kk];
aj = Re [k1] + Re [k2];
bj = Im [k1] + Im [k2];
Re [kk] = ak + aj;
Im [kk] = bk + bj;
ak -= 0.5 * aj;
bk -= 0.5 * bj;
aj = (Re [k1] - Re [k2]) * s60;
bj = (Im [k1] - Im [k2]) * s60;
Re [k1] = ak - bj;
Re [k2] = ak + bj;
Im [k1] = bk + aj;
Im [k2] = bk - aj;
kk = k2 + kspan;
} while (kk < (nn - 1));
kk -= nn;
} while (kk < kspan);
break;
case 5: /* transform for factor of 5 (optional code) */
c2 = c72 * c72 - s72 * s72;
s2 = 2.0 * c72 * s72;
do {
do {
k1 = kk + kspan;
k2 = k1 + kspan;
k3 = k2 + kspan;
k4 = k3 + kspan;
akp = Re [k1] + Re [k4];
akm = Re [k1] - Re [k4];
bkp = Im [k1] + Im [k4];
bkm = Im [k1] - Im [k4];
ajp = Re [k2] + Re [k3];
ajm = Re [k2] - Re [k3];
bjp = Im [k2] + Im [k3];
bjm = Im [k2] - Im [k3];
aa = Re [kk];
bb = Im [kk];
Re [kk] = aa + akp + ajp;
Im [kk] = bb + bkp + bjp;
ak = akp * c72 + ajp * c2 + aa;
bk = bkp * c72 + bjp * c2 + bb;
aj = akm * s72 + ajm * s2;
bj = bkm * s72 + bjm * s2;
Re [k1] = ak - bj;
Re [k4] = ak + bj;
Im [k1] = bk + aj;
Im [k4] = bk - aj;
ak = akp * c2 + ajp * c72 + aa;
bk = bkp * c2 + bjp * c72 + bb;
aj = akm * s2 - ajm * s72;
bj = bkm * s2 - bjm * s72;
Re [k2] = ak - bj;
Re [k3] = ak + bj;
Im [k2] = bk + aj;
Im [k3] = bk - aj;
kk = k4 + kspan;
} while (kk < (nn-1));
kk -= nn;
} while (kk < kspan);
break;
default:
if (k != jf) {
jf = k;
s1 = pi2 / (double) k;
c1 = cos(s1);
s1 = sin(s1);
if (jf > max_factors){
return -1;
}
Cos [jf - 1] = 1.0;
Sin [jf - 1] = 0.0;
j = 1;
do {
Cos [j - 1] = Cos [k - 1] * c1 + Sin [k - 1] * s1;
Sin [j - 1] = Cos [k - 1] * s1 - Sin [k - 1] * c1;
k--;
Cos [k - 1] = Cos [j - 1];
Sin [k - 1] = -Sin [j - 1];
j++;
} while (j < k);
}
do {
do {
k1 = kk;
k2 = kk + ispan;
ak = aa = Re [kk];
bk = bb = Im [kk];
j = 1;
k1 += kspan;
do {
k2 -= kspan;
j++;
Rtmp [j - 1] = Re [k1] + Re [k2];
ak += Rtmp [j - 1];
Itmp [j - 1] = Im [k1] + Im [k2];
bk += Itmp [j - 1];
j++;
Rtmp [j - 1] = Re [k1] - Re [k2];
Itmp [j - 1] = Im [k1] - Im [k2];
k1 += kspan;
} while (k1 < k2);
Re [kk] = ak;
Im [kk] = bk;
k1 = kk;
k2 = kk + ispan;
j = 1;
do {
k1 += kspan;
k2 -= kspan;
jj = j;
ak = aa;
bk = bb;
aj = 0.0;
bj = 0.0;
k = 1;
do {
k++;
ak += Rtmp [k - 1] * Cos [jj - 1];
bk += Itmp [k - 1] * Cos [jj - 1];
k++;
aj += Rtmp [k - 1] * Sin [jj - 1];
bj += Itmp [k - 1] * Sin [jj - 1];
jj += j;
if (jj > jf) {
jj -= jf;
}
} while (k < jf);
k = jf - j;
Re [k1] = ak - bj;
Im [k1] = bk + aj;
Re [k2] = ak + bj;
Im [k2] = bk - aj;
j++;
} while (j < k);
kk += ispan;
} while (kk < nn);
kk -= nn;
} while (kk < kspan);
break;
}
/* multiply by rotation factor (except for factors of 2 and 4) */
if (ii == mfactor)
goto Permute_Results_Label; /* exit infinite loop */
kk = jc;
do {
c2 = 1.0 - cd;
s1 = sd;
do {
c1 = c2;
s2 = s1;
kk += kspan;
do {
do {
ak = Re [kk];
Re [kk] = c2 * ak - s2 * Im [kk];
Im [kk] = s2 * ak + c2 * Im [kk];
kk += ispan;
} while (kk < nt);
ak = s1 * s2;
s2 = s1 * c2 + c1 * s2;
c2 = c1 * c2 - ak;
kk = kk - nt + kspan;
} while (kk < ispan);
c2 = c1 - (cd * c1 + sd * s1);
s1 += sd * c1 - cd * s1;
c1 = 2.0 - (c2 * c2 + s1 * s1);
s1 *= c1;
c2 *= c1;
kk = kk - ispan + jc;
} while (kk < kspan);
kk = kk - kspan + jc + inc;
} while (kk < (jc + jc));
break;
#endif /* FFT_RADIX4 */
}
}
/* permute the results to normal order---done in two stages */
/* permutation for square factors of n */
Permute_Results_Label:
fftstate->Perm [0] = ns;
if (kt) {
k = kt + kt + 1;
if (mfactor < k)
k--;
j = 1;
fftstate->Perm [k] = jc;
do {
fftstate->Perm [j] = fftstate->Perm [j - 1] / fftstate->factor [j - 1];
fftstate->Perm [k - 1] = fftstate->Perm [k] * fftstate->factor [j - 1];
j++;
k--;
} while (j < k);
k3 = fftstate->Perm [k];
kspan = fftstate->Perm [1];
kk = jc;
k2 = kspan;
j = 1;
if (nPass != nTotal) {
/* permutation for multivariate transform */
Permute_Multi_Label:
do {
do {
k = kk + jc;
do {
/* swap Re [kk] <> Re [k2], Im [kk] <> Im [k2] */
ak = Re [kk]; Re [kk] = Re [k2]; Re [k2] = ak;
bk = Im [kk]; Im [kk] = Im [k2]; Im [k2] = bk;
kk += inc;
k2 += inc;
} while (kk < (k-1));
kk += ns - jc;
k2 += ns - jc;
} while (kk < (nt-1));
k2 = k2 - nt + kspan;
kk = kk - nt + jc;
} while (k2 < (ns-1));
do {
do {
k2 -= fftstate->Perm [j - 1];
j++;
k2 = fftstate->Perm [j] + k2;
} while (k2 > fftstate->Perm [j - 1]);
j = 1;
do {
if (kk < (k2-1))
goto Permute_Multi_Label;
kk += jc;
k2 += kspan;
} while (k2 < (ns-1));
} while (kk < (ns-1));
} else {
/* permutation for single-variate transform (optional code) */
Permute_Single_Label:
do {
/* swap Re [kk] <> Re [k2], Im [kk] <> Im [k2] */
ak = Re [kk]; Re [kk] = Re [k2]; Re [k2] = ak;
bk = Im [kk]; Im [kk] = Im [k2]; Im [k2] = bk;
kk += inc;
k2 += kspan;
} while (k2 < (ns-1));
do {
do {
k2 -= fftstate->Perm [j - 1];
j++;
k2 = fftstate->Perm [j] + k2;
} while (k2 >= fftstate->Perm [j - 1]);
j = 1;
do {
if (kk < k2)
goto Permute_Single_Label;
kk += inc;
k2 += kspan;
} while (k2 < (ns-1));
} while (kk < (ns-1));
}
jc = k3;
}
if ((kt << 1) + 1 >= mfactor)
return 0;
ispan = fftstate->Perm [kt];
/* permutation for square-free factors of n */
j = mfactor - kt;
fftstate->factor [j] = 1;
do {
fftstate->factor [j - 1] *= fftstate->factor [j];
j--;
} while (j != kt);
kt++;
nn = fftstate->factor [kt - 1] - 1;
if (nn > (int) max_perm) {
return -1;
}
j = jj = 0;
for (;;) {
k = kt + 1;
k2 = fftstate->factor [kt - 1];
kk = fftstate->factor [k - 1];
j++;
if (j > nn)
break; /* exit infinite loop */
jj += kk;
while (jj >= k2) {
jj -= k2;
k2 = kk;
k++;
kk = fftstate->factor [k - 1];
jj += kk;
}
fftstate->Perm [j - 1] = jj;
}
/* determine the permutation cycles of length greater than 1 */
j = 0;
for (;;) {
do {
j++;
kk = fftstate->Perm [j - 1];
} while (kk < 0);
if (kk != j) {
do {
k = kk;
kk = fftstate->Perm [k - 1];
fftstate->Perm [k - 1] = -kk;
} while (kk != j);
k3 = kk;
} else {
fftstate->Perm [j - 1] = -j;
if (j == nn)
break; /* exit infinite loop */
}
}
max_factors *= inc;
/* reorder a and b, following the permutation cycles */
for (;;) {
j = k3 + 1;
nt -= ispan;
ii = nt - inc + 1;
if (nt < 0)
break; /* exit infinite loop */
do {
do {
j--;
} while (fftstate->Perm [j - 1] < 0);
jj = jc;
do {
kspan = jj;
if (jj > max_factors) {
kspan = max_factors;
}
jj -= kspan;
k = fftstate->Perm [j - 1];
kk = jc * k + ii + jj;
k1 = kk + kspan - 1;
k2 = 0;
do {
k2++;
Rtmp [k2 - 1] = Re [k1];
Itmp [k2 - 1] = Im [k1];
k1 -= inc;
} while (k1 != (kk-1));
do {
k1 = kk + kspan - 1;
k2 = k1 - jc * (k + fftstate->Perm [k - 1]);
k = -fftstate->Perm [k - 1];
do {
Re [k1] = Re [k2];
Im [k1] = Im [k2];
k1 -= inc;
k2 -= inc;
} while (k1 != (kk-1));
kk = k2 + 1;
} while (k != j);
k1 = kk + kspan - 1;
k2 = 0;
do {
k2++;
Re [k1] = Rtmp [k2 - 1];
Im [k1] = Itmp [k2 - 1];
k1 -= inc;
} while (k1 != (kk-1));
} while (jj);
} while (j != 1);
}
return 0; /* exit point here */
}
/* ---------------------- end-of-file (c source) ---------------------- */

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*--------------------------------*-C-*---------------------------------*
* File:
* fftn.h
* ---------------------------------------------------------------------*
* Re[]: real value array
* Im[]: imaginary value array
* nTotal: total number of complex values
* nPass: number of elements involved in this pass of transform
* nSpan: nspan/nPass = number of bytes to increment pointer
* in Re[] and Im[]
* isign: exponent: +1 = forward -1 = reverse
* scaling: normalizing constant by which the final result is *divided*
* scaling == -1, normalize by total dimension of the transform
* scaling < -1, normalize by the square-root of the total dimension
*
* ----------------------------------------------------------------------
* See the comments in the code for correct usage!
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FFT_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FFT_H_
#include "structs.h"
/* double precision routine */
int WebRtcIsac_Fftns (unsigned int ndim, const int dims[], double Re[], double Im[],
int isign, double scaling, FFTstr *fftstate);
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FFT_H_ */

View File

@ -1,89 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_FilterAR().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
int WebRtcSpl_FilterAR(G_CONST WebRtc_Word16* a,
int a_length,
G_CONST WebRtc_Word16* x,
int x_length,
WebRtc_Word16* state,
int state_length,
WebRtc_Word16* state_low,
int state_low_length,
WebRtc_Word16* filtered,
WebRtc_Word16* filtered_low,
int filtered_low_length)
{
WebRtc_Word32 o;
WebRtc_Word32 oLOW;
int i, j, stop;
G_CONST WebRtc_Word16* x_ptr = &x[0];
WebRtc_Word16* filteredFINAL_ptr = filtered;
WebRtc_Word16* filteredFINAL_LOW_ptr = filtered_low;
for (i = 0; i < x_length; i++)
{
// Calculate filtered[i] and filtered_low[i]
G_CONST WebRtc_Word16* a_ptr = &a[1];
WebRtc_Word16* filtered_ptr = &filtered[i - 1];
WebRtc_Word16* filtered_low_ptr = &filtered_low[i - 1];
WebRtc_Word16* state_ptr = &state[state_length - 1];
WebRtc_Word16* state_low_ptr = &state_low[state_length - 1];
o = (WebRtc_Word32)(*x_ptr++) << 12;
oLOW = (WebRtc_Word32)0;
stop = (i < a_length) ? i + 1 : a_length;
for (j = 1; j < stop; j++)
{
o -= WEBRTC_SPL_MUL_16_16(*a_ptr, *filtered_ptr--);
oLOW -= WEBRTC_SPL_MUL_16_16(*a_ptr++, *filtered_low_ptr--);
}
for (j = i + 1; j < a_length; j++)
{
o -= WEBRTC_SPL_MUL_16_16(*a_ptr, *state_ptr--);
oLOW -= WEBRTC_SPL_MUL_16_16(*a_ptr++, *state_low_ptr--);
}
o += (oLOW >> 12);
*filteredFINAL_ptr = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12);
*filteredFINAL_LOW_ptr++ = (WebRtc_Word16)(o - ((WebRtc_Word32)(*filteredFINAL_ptr++)
<< 12));
}
// Save the filter state
if (x_length >= state_length)
{
WebRtcSpl_CopyFromEndW16(filtered, x_length, a_length - 1, state);
WebRtcSpl_CopyFromEndW16(filtered_low, x_length, a_length - 1, state_low);
} else
{
for (i = 0; i < state_length - x_length; i++)
{
state[i] = state[i + x_length];
state_low[i] = state_low[i + x_length];
}
for (i = 0; i < x_length; i++)
{
state[state_length - x_length + i] = filtered[i];
state[state_length - x_length + i] = filtered_low[i];
}
}
return x_length;
}

View File

@ -1,49 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_FilterARFastQ12().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_FilterARFastQ12(WebRtc_Word16 *in, WebRtc_Word16 *out, WebRtc_Word16 *A,
WebRtc_Word16 A_length, WebRtc_Word16 length)
{
WebRtc_Word32 o;
int i, j;
WebRtc_Word16 *x_ptr = &in[0];
WebRtc_Word16 *filtered_ptr = &out[0];
for (i = 0; i < length; i++)
{
// Calculate filtered[i]
G_CONST WebRtc_Word16 *a_ptr = &A[0];
WebRtc_Word16 *state_ptr = &out[i - 1];
o = WEBRTC_SPL_MUL_16_16(*x_ptr++, *a_ptr++);
for (j = 1; j < A_length; j++)
{
o -= WEBRTC_SPL_MUL_16_16(*a_ptr++,*state_ptr--);
}
// Saturate the output
o = WEBRTC_SPL_SAT((WebRtc_Word32)134215679, o, (WebRtc_Word32)-134217728);
*filtered_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12);
}
return;
}

View File

@ -1,271 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
#include <memory.h>
#ifdef WEBRTC_ANDROID
#include <stdlib.h>
#endif
#include "pitch_estimator.h"
#include "lpc_analysis.h"
#include "codec.h"
void WebRtcIsac_AllPoleFilter(double *InOut, double *Coef, int lengthInOut, int orderCoef){
/* the state of filter is assumed to be in InOut[-1] to InOut[-orderCoef] */
double scal;
double sum;
int n,k;
//if (fabs(Coef[0]-1.0)<0.001) {
if ( (Coef[0] > 0.9999) && (Coef[0] < 1.0001) )
{
for(n = 0; n < lengthInOut; n++)
{
sum = Coef[1] * InOut[-1];
for(k = 2; k <= orderCoef; k++){
sum += Coef[k] * InOut[-k];
}
*InOut++ -= sum;
}
}
else
{
scal = 1.0 / Coef[0];
for(n=0;n<lengthInOut;n++)
{
*InOut *= scal;
for(k=1;k<=orderCoef;k++){
*InOut -= scal*Coef[k]*InOut[-k];
}
InOut++;
}
}
}
void WebRtcIsac_AllZeroFilter(double *In, double *Coef, int lengthInOut, int orderCoef, double *Out){
/* the state of filter is assumed to be in In[-1] to In[-orderCoef] */
int n, k;
double tmp;
for(n = 0; n < lengthInOut; n++)
{
tmp = In[0] * Coef[0];
for(k = 1; k <= orderCoef; k++){
tmp += Coef[k] * In[-k];
}
*Out++ = tmp;
In++;
}
}
void WebRtcIsac_ZeroPoleFilter(double *In, double *ZeroCoef, double *PoleCoef, int lengthInOut, int orderCoef, double *Out){
/* the state of the zero section is assumed to be in In[-1] to In[-orderCoef] */
/* the state of the pole section is assumed to be in Out[-1] to Out[-orderCoef] */
WebRtcIsac_AllZeroFilter(In,ZeroCoef,lengthInOut,orderCoef,Out);
WebRtcIsac_AllPoleFilter(Out,PoleCoef,lengthInOut,orderCoef);
}
void WebRtcIsac_AutoCorr(
double *r,
const double *x,
int N,
int order
)
{
int lag, n;
double sum, prod;
const double *x_lag;
for (lag = 0; lag <= order; lag++)
{
sum = 0.0f;
x_lag = &x[lag];
prod = x[0] * x_lag[0];
for (n = 1; n < N - lag; n++) {
sum += prod;
prod = x[n] * x_lag[n];
}
sum += prod;
r[lag] = sum;
}
}
void WebRtcIsac_BwExpand(double *out, double *in, double coef, short length) {
int i;
double chirp;
chirp = coef;
out[0] = in[0];
for (i = 1; i < length; i++) {
out[i] = chirp * in[i];
chirp *= coef;
}
}
void WebRtcIsac_WeightingFilter(const double *in, double *weiout, double *whiout, WeightFiltstr *wfdata) {
double tmpbuffer[PITCH_FRAME_LEN + PITCH_WLPCBUFLEN];
double corr[PITCH_WLPCORDER+1], rc[PITCH_WLPCORDER+1];
double apol[PITCH_WLPCORDER+1], apolr[PITCH_WLPCORDER+1];
double rho=0.9, *inp, *dp, *dp2;
double whoutbuf[PITCH_WLPCBUFLEN + PITCH_WLPCORDER];
double weoutbuf[PITCH_WLPCBUFLEN + PITCH_WLPCORDER];
double *weo, *who, opol[PITCH_WLPCORDER+1], ext[PITCH_WLPCWINLEN];
int k, n, endpos, start;
/* Set up buffer and states */
memcpy(tmpbuffer, wfdata->buffer, sizeof(double) * PITCH_WLPCBUFLEN);
memcpy(tmpbuffer+PITCH_WLPCBUFLEN, in, sizeof(double) * PITCH_FRAME_LEN);
memcpy(wfdata->buffer, tmpbuffer+PITCH_FRAME_LEN, sizeof(double) * PITCH_WLPCBUFLEN);
dp=weoutbuf;
dp2=whoutbuf;
for (k=0;k<PITCH_WLPCORDER;k++) {
*dp++ = wfdata->weostate[k];
*dp2++ = wfdata->whostate[k];
opol[k]=0.0;
}
opol[0]=1.0;
opol[PITCH_WLPCORDER]=0.0;
weo=dp;
who=dp2;
endpos=PITCH_WLPCBUFLEN + PITCH_SUBFRAME_LEN;
inp=tmpbuffer + PITCH_WLPCBUFLEN;
for (n=0; n<PITCH_SUBFRAMES; n++) {
/* Windowing */
start=endpos-PITCH_WLPCWINLEN;
for (k=0; k<PITCH_WLPCWINLEN; k++) {
ext[k]=wfdata->window[k]*tmpbuffer[start+k];
}
/* Get LPC polynomial */
WebRtcIsac_AutoCorr(corr, ext, PITCH_WLPCWINLEN, PITCH_WLPCORDER);
corr[0]=1.01*corr[0]+1.0; /* White noise correction */
WebRtcIsac_LevDurb(apol, rc, corr, PITCH_WLPCORDER);
WebRtcIsac_BwExpand(apolr, apol, rho, PITCH_WLPCORDER+1);
/* Filtering */
WebRtcIsac_ZeroPoleFilter(inp, apol, apolr, PITCH_SUBFRAME_LEN, PITCH_WLPCORDER, weo);
WebRtcIsac_ZeroPoleFilter(inp, apolr, opol, PITCH_SUBFRAME_LEN, PITCH_WLPCORDER, who);
inp+=PITCH_SUBFRAME_LEN;
endpos+=PITCH_SUBFRAME_LEN;
weo+=PITCH_SUBFRAME_LEN;
who+=PITCH_SUBFRAME_LEN;
}
/* Export filter states */
for (k=0;k<PITCH_WLPCORDER;k++) {
wfdata->weostate[k]=weoutbuf[PITCH_FRAME_LEN+k];
wfdata->whostate[k]=whoutbuf[PITCH_FRAME_LEN+k];
}
/* Export output data */
memcpy(weiout, weoutbuf+PITCH_WLPCORDER, sizeof(double) * PITCH_FRAME_LEN);
memcpy(whiout, whoutbuf+PITCH_WLPCORDER, sizeof(double) * PITCH_FRAME_LEN);
}
static const double APupper[ALLPASSSECTIONS] = {0.0347, 0.3826};
static const double APlower[ALLPASSSECTIONS] = {0.1544, 0.744};
void WebRtcIsac_AllpassFilterForDec(double *InOut,
const double *APSectionFactors,
int lengthInOut,
double *FilterState)
{
//This performs all-pass filtering--a series of first order all-pass sections are used
//to filter the input in a cascade manner.
int n,j;
double temp;
for (j=0; j<ALLPASSSECTIONS; j++){
for (n=0;n<lengthInOut;n+=2){
temp = InOut[n]; //store input
InOut[n] = FilterState[j] + APSectionFactors[j]*temp;
FilterState[j] = -APSectionFactors[j]*InOut[n] + temp;
}
}
}
void WebRtcIsac_DecimateAllpass(const double *in,
double *state_in, /* array of size: 2*ALLPASSSECTIONS+1 */
int N, /* number of input samples */
double *out) /* array of size N/2 */
{
int n;
double data_vec[PITCH_FRAME_LEN];
/* copy input */
memcpy(data_vec+1, in, sizeof(double) * (N-1));
data_vec[0] = state_in[2*ALLPASSSECTIONS]; //the z^(-1) state
state_in[2*ALLPASSSECTIONS] = in[N-1];
WebRtcIsac_AllpassFilterForDec(data_vec+1, APupper, N, state_in);
WebRtcIsac_AllpassFilterForDec(data_vec, APlower, N, state_in+ALLPASSSECTIONS);
for (n=0;n<N/2;n++)
out[n] = data_vec[2*n] + data_vec[2*n+1];
}
/* create high-pass filter ocefficients
* z = 0.998 * exp(j*2*pi*35/8000);
* p = 0.94 * exp(j*2*pi*140/8000);
* HP_b = [1, -2*real(z), abs(z)^2];
* HP_a = [1, -2*real(p), abs(p)^2]; */
static const double a_coef[2] = { 1.86864659625574, -0.88360000000000};
static const double b_coef[2] = {-1.99524591718270, 0.99600400000000};
static const float a_coef_float[2] = { 1.86864659625574f, -0.88360000000000f};
static const float b_coef_float[2] = {-1.99524591718270f, 0.99600400000000f};
/* second order high-pass filter */
void WebRtcIsac_Highpass(const double *in, double *out, double *state, int N)
{
int k;
for (k=0; k<N; k++) {
*out = *in + state[1];
state[1] = state[0] + b_coef[0] * *in + a_coef[0] * *out;
state[0] = b_coef[1] * *in++ + a_coef[1] * *out++;
}
}
void WebRtcIsac_Highpass_float(const float *in, double *out, double *state, int N)
{
int k;
for (k=0; k<N; k++) {
*out = (double)*in + state[1];
state[1] = state[0] + b_coef_float[0] * *in + a_coef_float[0] * *out;
state[0] = b_coef_float[1] * (double)*in++ + a_coef_float[1] * *out++;
}
}

View File

@ -1,49 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_FilterMAFastQ12().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_FilterMAFastQ12(WebRtc_Word16* in_ptr,
WebRtc_Word16* out_ptr,
WebRtc_Word16* B,
WebRtc_Word16 B_length,
WebRtc_Word16 length)
{
WebRtc_Word32 o;
int i, j;
for (i = 0; i < length; i++)
{
G_CONST WebRtc_Word16* b_ptr = &B[0];
G_CONST WebRtc_Word16* x_ptr = &in_ptr[i];
o = (WebRtc_Word32)0;
for (j = 0; j < B_length; j++)
{
o += WEBRTC_SPL_MUL_16_16(*b_ptr++, *x_ptr--);
}
// If output is higher than 32768, saturate it. Same with negative side
// 2^27 = 134217728, which corresponds to 32768 in Q12
// Saturate the output
o = WEBRTC_SPL_SAT((WebRtc_Word32)134215679, o, (WebRtc_Word32)-134217728);
*out_ptr++ = (WebRtc_Word16)((o + (WebRtc_Word32)2048) >> 12);
}
return;
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/* filterbank_tables.c*/
/* This file contains variables that are used in filterbanks.c*/
#include "filterbank_tables.h"
#include "settings.h"
/* The composite all-pass filter factors */
const float WebRtcIsac_kCompositeApFactorsFloat[4] = {
0.03470000000000f, 0.15440000000000f, 0.38260000000000f, 0.74400000000000f};
/* The upper channel all-pass filter factors */
const float WebRtcIsac_kUpperApFactorsFloat[2] = {
0.03470000000000f, 0.38260000000000f};
/* The lower channel all-pass filter factors */
const float WebRtcIsac_kLowerApFactorsFloat[2] = {
0.15440000000000f, 0.74400000000000f};
/* The matrix for transforming the backward composite state to upper channel state */
const float WebRtcIsac_kTransform1Float[8] = {
-0.00158678506084f, 0.00127157815343f, -0.00104805672709f, 0.00084837248079f,
0.00134467983258f, -0.00107756549387f, 0.00088814793277f, -0.00071893072525f};
/* The matrix for transforming the backward composite state to lower channel state */
const float WebRtcIsac_kTransform2Float[8] = {
-0.00170686041697f, 0.00136780109829f, -0.00112736532350f, 0.00091257055385f,
0.00103094281812f, -0.00082615076557f, 0.00068092756088f, -0.00055119165484f};

View File

@ -1,46 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* filterbank_tables.h
*
* Header file for variables that are defined in
* filterbank_tables.c.
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTERBANK_TABLES_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTERBANK_TABLES_H_
#include "structs.h"
/********************* Coefficient Tables ************************/
/* The number of composite all-pass filter factors */
#define NUMBEROFCOMPOSITEAPSECTIONS 4
/* The number of all-pass filter factors in an upper or lower channel*/
#define NUMBEROFCHANNELAPSECTIONS 2
/* The composite all-pass filter factors */
extern const float WebRtcIsac_kCompositeApFactorsFloat[4];
/* The upper channel all-pass filter factors */
extern const float WebRtcIsac_kUpperApFactorsFloat[2];
/* The lower channel all-pass filter factors */
extern const float WebRtcIsac_kLowerApFactorsFloat[2];
/* The matrix for transforming the backward composite state to upper channel state */
extern const float WebRtcIsac_kTransform1Float[8];
/* The matrix for transforming the backward composite state to lower channel state */
extern const float WebRtcIsac_kTransform2Float[8];
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_FILTERBANK_TABLES_H_ */

View File

@ -1,346 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* filterbanks.c
*
* This file contains function WebRtcIsac_AllPassFilter2Float,
* WebRtcIsac_SplitAndFilter, and WebRtcIsac_FilterAndCombine
* which implement filterbanks that produce decimated lowpass and
* highpass versions of a signal, and performs reconstruction.
*
*/
#include "settings.h"
#include "filterbank_tables.h"
#include "codec.h"
/* This function performs all-pass filtering--a series of first order all-pass
* sections are used to filter the input in a cascade manner.
* The input is overwritten!!
*/
static void WebRtcIsac_AllPassFilter2Float(float *InOut, const float *APSectionFactors,
int lengthInOut, int NumberOfSections,
float *FilterState)
{
int n, j;
float temp;
for (j=0; j<NumberOfSections; j++){
for (n=0;n<lengthInOut;n++){
temp = FilterState[j] + APSectionFactors[j] * InOut[n];
FilterState[j] = -APSectionFactors[j] * temp + InOut[n];
InOut[n] = temp;
}
}
}
/* HPstcoeff_in = {a1, a2, b1 - b0 * a1, b2 - b0 * a2}; */
static const float kHpStCoefInFloat[4] =
{-1.94895953203325f, 0.94984516000000f, -0.05101826139794f, 0.05015484000000f};
/* Function WebRtcIsac_SplitAndFilter
* This function creates low-pass and high-pass decimated versions of part of
the input signal, and part of the signal in the input 'lookahead buffer'.
INPUTS:
in: a length FRAMESAMPLES array of input samples
prefiltdata: input data structure containing the filterbank states
and lookahead samples from the previous encoding
iteration.
OUTPUTS:
LP: a FRAMESAMPLES_HALF array of low-pass filtered samples that
have been phase equalized. The first QLOOKAHEAD samples are
based on the samples in the two prefiltdata->INLABUFx arrays
each of length QLOOKAHEAD.
The remaining FRAMESAMPLES_HALF-QLOOKAHEAD samples are based
on the first FRAMESAMPLES_HALF-QLOOKAHEAD samples of the input
array in[].
HP: a FRAMESAMPLES_HALF array of high-pass filtered samples that
have been phase equalized. The first QLOOKAHEAD samples are
based on the samples in the two prefiltdata->INLABUFx arrays
each of length QLOOKAHEAD.
The remaining FRAMESAMPLES_HALF-QLOOKAHEAD samples are based
on the first FRAMESAMPLES_HALF-QLOOKAHEAD samples of the input
array in[].
LP_la: a FRAMESAMPLES_HALF array of low-pass filtered samples.
These samples are not phase equalized. They are computed
from the samples in the in[] array.
HP_la: a FRAMESAMPLES_HALF array of high-pass filtered samples
that are not phase equalized. They are computed from
the in[] vector.
prefiltdata: this input data structure's filterbank state and
lookahead sample buffers are updated for the next
encoding iteration.
*/
void WebRtcIsac_SplitAndFilterFloat(float *pin, float *LP, float *HP,
double *LP_la, double *HP_la,
PreFiltBankstr *prefiltdata)
{
int k,n;
float CompositeAPFilterState[NUMBEROFCOMPOSITEAPSECTIONS];
float ForTransform_CompositeAPFilterState[NUMBEROFCOMPOSITEAPSECTIONS];
float ForTransform_CompositeAPFilterState2[NUMBEROFCOMPOSITEAPSECTIONS];
float tempinoutvec[FRAMESAMPLES+MAX_AR_MODEL_ORDER];
float tempin_ch1[FRAMESAMPLES+MAX_AR_MODEL_ORDER];
float tempin_ch2[FRAMESAMPLES+MAX_AR_MODEL_ORDER];
float in[FRAMESAMPLES];
float ftmp;
/* High pass filter */
for (k=0;k<FRAMESAMPLES;k++) {
in[k] = pin[k] + kHpStCoefInFloat[2] * prefiltdata->HPstates_float[0] +
kHpStCoefInFloat[3] * prefiltdata->HPstates_float[1];
ftmp = pin[k] - kHpStCoefInFloat[0] * prefiltdata->HPstates_float[0] -
kHpStCoefInFloat[1] * prefiltdata->HPstates_float[1];
prefiltdata->HPstates_float[1] = prefiltdata->HPstates_float[0];
prefiltdata->HPstates_float[0] = ftmp;
}
/*
% backwards all-pass filtering to obtain zero-phase
[tmp1(N2+LA:-1:LA+1, 1), state1] = filter(Q.coef, Q.coef(end:-1:1), in(N:-2:2));
tmp1(LA:-1:1) = filter(Q.coef, Q.coef(end:-1:1), Q.LookAheadBuf1, state1);
Q.LookAheadBuf1 = in(N:-2:N-2*LA+2);
*/
/*Backwards all-pass filter the odd samples of the input (upper channel)
to eventually obtain zero phase. The composite all-pass filter (comprised of both
the upper and lower channel all-pass filsters in series) is used for the
filtering. */
/* First Channel */
/*initial state of composite filter is zero */
for (k=0;k<NUMBEROFCOMPOSITEAPSECTIONS;k++){
CompositeAPFilterState[k] = 0.0;
}
/* put every other sample of input into a temporary vector in reverse (backward) order*/
for (k=0;k<FRAMESAMPLES_HALF;k++) {
tempinoutvec[k] = in[FRAMESAMPLES-1-2*k];
}
/* now all-pass filter the backwards vector. Output values overwrite the input vector. */
WebRtcIsac_AllPassFilter2Float(tempinoutvec, WebRtcIsac_kCompositeApFactorsFloat,
FRAMESAMPLES_HALF, NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
/* save the backwards filtered output for later forward filtering,
but write it in forward order*/
for (k=0;k<FRAMESAMPLES_HALF;k++) {
tempin_ch1[FRAMESAMPLES_HALF+QLOOKAHEAD-1-k] = tempinoutvec[k];
}
/* save the backwards filter state becaue it will be transformed
later into a forward state */
for (k=0; k<NUMBEROFCOMPOSITEAPSECTIONS; k++) {
ForTransform_CompositeAPFilterState[k] = CompositeAPFilterState[k];
}
/* now backwards filter the samples in the lookahead buffer. The samples were
placed there in the encoding of the previous frame. The output samples
overwrite the input samples */
WebRtcIsac_AllPassFilter2Float(prefiltdata->INLABUF1_float,
WebRtcIsac_kCompositeApFactorsFloat, QLOOKAHEAD,
NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
/* save the output, but write it in forward order */
/* write the lookahead samples for the next encoding iteration. Every other
sample at the end of the input frame is written in reverse order for the
lookahead length. Exported in the prefiltdata structure. */
for (k=0;k<QLOOKAHEAD;k++) {
tempin_ch1[QLOOKAHEAD-1-k]=prefiltdata->INLABUF1_float[k];
prefiltdata->INLABUF1_float[k]=in[FRAMESAMPLES-1-2*k];
}
/* Second Channel. This is exactly like the first channel, except that the
even samples are now filtered instead (lower channel). */
for (k=0;k<NUMBEROFCOMPOSITEAPSECTIONS;k++){
CompositeAPFilterState[k] = 0.0;
}
for (k=0;k<FRAMESAMPLES_HALF;k++) {
tempinoutvec[k] = in[FRAMESAMPLES-2-2*k];
}
WebRtcIsac_AllPassFilter2Float(tempinoutvec, WebRtcIsac_kCompositeApFactorsFloat,
FRAMESAMPLES_HALF, NUMBEROFCOMPOSITEAPSECTIONS, CompositeAPFilterState);
for (k=0;k<FRAMESAMPLES_HALF;k++) {
tempin_ch2[FRAMESAMPLES_HALF+QLOOKAHEAD-1-k] = tempinoutvec[k];
}
for (k=0; k<NUMBEROFCOMPOSITEAPSECTIONS; k++) {
ForTransform_CompositeAPFilterState2[k] = CompositeAPFilterState[k];
}
WebRtcIsac_AllPassFilter2Float(prefiltdata->INLABUF2_float,
WebRtcIsac_kCompositeApFactorsFloat, QLOOKAHEAD,NUMBEROFCOMPOSITEAPSECTIONS,
CompositeAPFilterState);
for (k=0;k<QLOOKAHEAD;k++) {
tempin_ch2[QLOOKAHEAD-1-k]=prefiltdata->INLABUF2_float[k];
prefiltdata->INLABUF2_float[k]=in[FRAMESAMPLES-2-2*k];
}
/* Transform filter states from backward to forward */
/*At this point, each of the states of the backwards composite filters for the
two channels are transformed into forward filtering states for the corresponding
forward channel filters. Each channel's forward filtering state from the previous
encoding iteration is added to the transformed state to get a proper forward state */
/* So the existing NUMBEROFCOMPOSITEAPSECTIONS x 1 (4x1) state vector is multiplied by a
NUMBEROFCHANNELAPSECTIONSxNUMBEROFCOMPOSITEAPSECTIONS (2x4) transform matrix to get the
new state that is added to the previous 2x1 input state */
for (k=0;k<NUMBEROFCHANNELAPSECTIONS;k++){ /* k is row variable */
for (n=0; n<NUMBEROFCOMPOSITEAPSECTIONS;n++){/* n is column variable */
prefiltdata->INSTAT1_float[k] += ForTransform_CompositeAPFilterState[n]*
WebRtcIsac_kTransform1Float[k*NUMBEROFCHANNELAPSECTIONS+n];
prefiltdata->INSTAT2_float[k] += ForTransform_CompositeAPFilterState2[n]*
WebRtcIsac_kTransform2Float[k*NUMBEROFCHANNELAPSECTIONS+n];
}
}
/*obtain polyphase components by forward all-pass filtering through each channel */
/* the backward filtered samples are now forward filtered with the corresponding channel filters */
/* The all pass filtering automatically updates the filter states which are exported in the
prefiltdata structure */
WebRtcIsac_AllPassFilter2Float(tempin_ch1,WebRtcIsac_kUpperApFactorsFloat,
FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS, prefiltdata->INSTAT1_float);
WebRtcIsac_AllPassFilter2Float(tempin_ch2,WebRtcIsac_kLowerApFactorsFloat,
FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS, prefiltdata->INSTAT2_float);
/* Now Construct low-pass and high-pass signals as combinations of polyphase components */
for (k=0; k<FRAMESAMPLES_HALF; k++) {
LP[k] = 0.5f*(tempin_ch1[k] + tempin_ch2[k]);/* low pass signal*/
HP[k] = 0.5f*(tempin_ch1[k] - tempin_ch2[k]);/* high pass signal*/
}
/* Lookahead LP and HP signals */
/* now create low pass and high pass signals of the input vector. However, no
backwards filtering is performed, and hence no phase equalization is involved.
Also, the input contains some samples that are lookahead samples. The high pass
and low pass signals that are created are used outside this function for analysis
(not encoding) purposes */
/* set up input */
for (k=0; k<FRAMESAMPLES_HALF; k++) {
tempin_ch1[k]=in[2*k+1];
tempin_ch2[k]=in[2*k];
}
/* the input filter states are passed in and updated by the all-pass filtering routine and
exported in the prefiltdata structure*/
WebRtcIsac_AllPassFilter2Float(tempin_ch1,WebRtcIsac_kUpperApFactorsFloat,
FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS, prefiltdata->INSTATLA1_float);
WebRtcIsac_AllPassFilter2Float(tempin_ch2,WebRtcIsac_kLowerApFactorsFloat,
FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS, prefiltdata->INSTATLA2_float);
for (k=0; k<FRAMESAMPLES_HALF; k++) {
LP_la[k] = (float)(0.5f*(tempin_ch1[k] + tempin_ch2[k])); /*low pass */
HP_la[k] = (double)(0.5f*(tempin_ch1[k] - tempin_ch2[k])); /* high pass */
}
}/*end of WebRtcIsac_SplitAndFilter */
/* Combining */
/* HPstcoeff_out_1 = {a1, a2, b1 - b0 * a1, b2 - b0 * a2}; */
static const float kHpStCoefOut1Float[4] =
{-1.99701049409000f, 0.99714204490000f, 0.01701049409000f, -0.01704204490000f};
/* HPstcoeff_out_2 = {a1, a2, b1 - b0 * a1, b2 - b0 * a2}; */
static const float kHpStCoefOut2Float[4] =
{-1.98645294509837f, 0.98672435560000f, 0.00645294509837f, -0.00662435560000f};
/* Function WebRtcIsac_FilterAndCombine */
/* This is a decoder function that takes the decimated
length FRAMESAMPLES_HALF input low-pass and
high-pass signals and creates a reconstructed fullband
output signal of length FRAMESAMPLES. WebRtcIsac_FilterAndCombine
is the sibling function of WebRtcIsac_SplitAndFilter */
/* INPUTS:
inLP: a length FRAMESAMPLES_HALF array of input low-pass
samples.
inHP: a length FRAMESAMPLES_HALF array of input high-pass
samples.
postfiltdata: input data structure containing the filterbank
states from the previous decoding iteration.
OUTPUTS:
Out: a length FRAMESAMPLES array of output reconstructed
samples (fullband) based on the input low-pass and
high-pass signals.
postfiltdata: the input data structure containing the filterbank
states is updated for the next decoding iteration */
void WebRtcIsac_FilterAndCombineFloat(float *InLP,
float *InHP,
float *Out,
PostFiltBankstr *postfiltdata)
{
int k;
float tempin_ch1[FRAMESAMPLES+MAX_AR_MODEL_ORDER];
float tempin_ch2[FRAMESAMPLES+MAX_AR_MODEL_ORDER];
float ftmp, ftmp2;
/* Form the polyphase signals*/
for (k=0;k<FRAMESAMPLES_HALF;k++) {
tempin_ch1[k]=InLP[k]+InHP[k]; /* Construct a new upper channel signal*/
tempin_ch2[k]=InLP[k]-InHP[k]; /* Construct a new lower channel signal*/
}
/* all-pass filter the new upper channel signal. HOWEVER, use the all-pass filter factors
that were used as a lower channel at the encoding side. So at the decoder, the
corresponding all-pass filter factors for each channel are swapped.*/
WebRtcIsac_AllPassFilter2Float(tempin_ch1, WebRtcIsac_kLowerApFactorsFloat,
FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS,postfiltdata->STATE_0_UPPER_float);
/* Now, all-pass filter the new lower channel signal. But since all-pass filter factors
at the decoder are swapped from the ones at the encoder, the 'upper' channel
all-pass filter factors (WebRtcIsac_kUpperApFactorsFloat) are used to filter this new
lower channel signal */
WebRtcIsac_AllPassFilter2Float(tempin_ch2, WebRtcIsac_kUpperApFactorsFloat,
FRAMESAMPLES_HALF, NUMBEROFCHANNELAPSECTIONS,postfiltdata->STATE_0_LOWER_float);
/* Merge outputs to form the full length output signal.*/
for (k=0;k<FRAMESAMPLES_HALF;k++) {
Out[2*k]=tempin_ch2[k];
Out[2*k+1]=tempin_ch1[k];
}
/* High pass filter */
for (k=0;k<FRAMESAMPLES;k++) {
ftmp2 = Out[k] + kHpStCoefOut1Float[2] * postfiltdata->HPstates1_float[0] +
kHpStCoefOut1Float[3] * postfiltdata->HPstates1_float[1];
ftmp = Out[k] - kHpStCoefOut1Float[0] * postfiltdata->HPstates1_float[0] -
kHpStCoefOut1Float[1] * postfiltdata->HPstates1_float[1];
postfiltdata->HPstates1_float[1] = postfiltdata->HPstates1_float[0];
postfiltdata->HPstates1_float[0] = ftmp;
Out[k] = ftmp2;
}
for (k=0;k<FRAMESAMPLES;k++) {
ftmp2 = Out[k] + kHpStCoefOut2Float[2] * postfiltdata->HPstates2_float[0] +
kHpStCoefOut2Float[3] * postfiltdata->HPstates2_float[1];
ftmp = Out[k] - kHpStCoefOut2Float[0] * postfiltdata->HPstates2_float[0] -
kHpStCoefOut2Float[1] * postfiltdata->HPstates2_float[1];
postfiltdata->HPstates2_float[1] = postfiltdata->HPstates2_float[0];
postfiltdata->HPstates2_float[0] = ftmp;
Out[k] = ftmp2;
}
}

View File

@ -1,77 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_GetHanningWindow().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
// Hanning table with 256 entries
static const WebRtc_Word16 kHanningTable[] = {
1, 2, 6, 10, 15, 22, 30, 39,
50, 62, 75, 89, 104, 121, 138, 157,
178, 199, 222, 246, 271, 297, 324, 353,
383, 413, 446, 479, 513, 549, 586, 624,
663, 703, 744, 787, 830, 875, 920, 967,
1015, 1064, 1114, 1165, 1218, 1271, 1325, 1381,
1437, 1494, 1553, 1612, 1673, 1734, 1796, 1859,
1924, 1989, 2055, 2122, 2190, 2259, 2329, 2399,
2471, 2543, 2617, 2691, 2765, 2841, 2918, 2995,
3073, 3152, 3232, 3312, 3393, 3475, 3558, 3641,
3725, 3809, 3895, 3980, 4067, 4154, 4242, 4330,
4419, 4509, 4599, 4689, 4781, 4872, 4964, 5057,
5150, 5244, 5338, 5432, 5527, 5622, 5718, 5814,
5910, 6007, 6104, 6202, 6299, 6397, 6495, 6594,
6693, 6791, 6891, 6990, 7090, 7189, 7289, 7389,
7489, 7589, 7690, 7790, 7890, 7991, 8091, 8192,
8293, 8393, 8494, 8594, 8694, 8795, 8895, 8995,
9095, 9195, 9294, 9394, 9493, 9593, 9691, 9790,
9889, 9987, 10085, 10182, 10280, 10377, 10474, 10570,
10666, 10762, 10857, 10952, 11046, 11140, 11234, 11327,
11420, 11512, 11603, 11695, 11785, 11875, 11965, 12054,
12142, 12230, 12317, 12404, 12489, 12575, 12659, 12743,
12826, 12909, 12991, 13072, 13152, 13232, 13311, 13389,
13466, 13543, 13619, 13693, 13767, 13841, 13913, 13985,
14055, 14125, 14194, 14262, 14329, 14395, 14460, 14525,
14588, 14650, 14711, 14772, 14831, 14890, 14947, 15003,
15059, 15113, 15166, 15219, 15270, 15320, 15369, 15417,
15464, 15509, 15554, 15597, 15640, 15681, 15721, 15760,
15798, 15835, 15871, 15905, 15938, 15971, 16001, 16031,
16060, 16087, 16113, 16138, 16162, 16185, 16206, 16227,
16246, 16263, 16280, 16295, 16309, 16322, 16334, 16345,
16354, 16362, 16369, 16374, 16378, 16382, 16383, 16384
};
void WebRtcSpl_GetHanningWindow(WebRtc_Word16 *v, WebRtc_Word16 size)
{
int jj;
WebRtc_Word16 *vptr1;
WebRtc_Word32 index;
WebRtc_Word32 factor = ((WebRtc_Word32)0x40000000);
factor = WebRtcSpl_DivW32W16(factor, size);
if (size < 513)
index = (WebRtc_Word32)-0x200000;
else
index = (WebRtc_Word32)-0x100000;
vptr1 = v;
for (jj = 0; jj < size; jj++)
{
index += factor;
(*vptr1++) = kHanningTable[index >> 22];
}
}

View File

@ -1,44 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_GetScalingSquare().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
int WebRtcSpl_GetScalingSquare(WebRtc_Word16 *in_vector, int in_vector_length, int times)
{
int nbits = WebRtcSpl_GetSizeInBits(times);
int i;
WebRtc_Word16 smax = -1;
WebRtc_Word16 sabs;
WebRtc_Word16 *sptr = in_vector;
int t;
int looptimes = in_vector_length;
for (i = looptimes; i > 0; i--)
{
sabs = (*sptr > 0 ? *sptr++ : -*sptr++);
smax = (sabs > smax ? sabs : smax);
}
t = WebRtcSpl_NormW32(WEBRTC_SPL_MUL(smax, smax));
if (smax == 0)
{
return 0; // Since norm(0) returns 0
} else
{
return (t > nbits) ? 0 : nbits - t;
}
}

View File

@ -1,120 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains implementations of the iLBC specific functions
* WebRtcSpl_ScaleAndAddVectorsWithRound()
* WebRtcSpl_ReverseOrderMultArrayElements()
* WebRtcSpl_ElementwiseVectorMult()
* WebRtcSpl_AddVectorsAndShift()
* WebRtcSpl_AddAffineVectorToVector()
* WebRtcSpl_AffineTransformVector()
*
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
void WebRtcSpl_ScaleAndAddVectorsWithRound(WebRtc_Word16 *vector1, WebRtc_Word16 scale1,
WebRtc_Word16 *vector2, WebRtc_Word16 scale2,
WebRtc_Word16 right_shifts, WebRtc_Word16 *out,
WebRtc_Word16 vector_length)
{
int i;
WebRtc_Word16 roundVal;
roundVal = 1 << right_shifts;
roundVal = roundVal >> 1;
for (i = 0; i < vector_length; i++)
{
out[i] = (WebRtc_Word16)((WEBRTC_SPL_MUL_16_16(vector1[i], scale1)
+ WEBRTC_SPL_MUL_16_16(vector2[i], scale2) + roundVal) >> right_shifts);
}
}
void WebRtcSpl_ReverseOrderMultArrayElements(WebRtc_Word16 *out, G_CONST WebRtc_Word16 *in,
G_CONST WebRtc_Word16 *win,
WebRtc_Word16 vector_length,
WebRtc_Word16 right_shifts)
{
int i;
WebRtc_Word16 *outptr = out;
G_CONST WebRtc_Word16 *inptr = in;
G_CONST WebRtc_Word16 *winptr = win;
for (i = 0; i < vector_length; i++)
{
(*outptr++) = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(*inptr++,
*winptr--, right_shifts);
}
}
void WebRtcSpl_ElementwiseVectorMult(WebRtc_Word16 *out, G_CONST WebRtc_Word16 *in,
G_CONST WebRtc_Word16 *win, WebRtc_Word16 vector_length,
WebRtc_Word16 right_shifts)
{
int i;
WebRtc_Word16 *outptr = out;
G_CONST WebRtc_Word16 *inptr = in;
G_CONST WebRtc_Word16 *winptr = win;
for (i = 0; i < vector_length; i++)
{
(*outptr++) = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16_RSFT(*inptr++,
*winptr++, right_shifts);
}
}
void WebRtcSpl_AddVectorsAndShift(WebRtc_Word16 *out, G_CONST WebRtc_Word16 *in1,
G_CONST WebRtc_Word16 *in2, WebRtc_Word16 vector_length,
WebRtc_Word16 right_shifts)
{
int i;
WebRtc_Word16 *outptr = out;
G_CONST WebRtc_Word16 *in1ptr = in1;
G_CONST WebRtc_Word16 *in2ptr = in2;
for (i = vector_length; i > 0; i--)
{
(*outptr++) = (WebRtc_Word16)(((*in1ptr++) + (*in2ptr++)) >> right_shifts);
}
}
void WebRtcSpl_AddAffineVectorToVector(WebRtc_Word16 *out, WebRtc_Word16 *in,
WebRtc_Word16 gain, WebRtc_Word32 add_constant,
WebRtc_Word16 right_shifts, int vector_length)
{
WebRtc_Word16 *inPtr;
WebRtc_Word16 *outPtr;
int i;
inPtr = in;
outPtr = out;
for (i = 0; i < vector_length; i++)
{
(*outPtr++) += (WebRtc_Word16)((WEBRTC_SPL_MUL_16_16((*inPtr++), gain)
+ (WebRtc_Word32)add_constant) >> right_shifts);
}
}
void WebRtcSpl_AffineTransformVector(WebRtc_Word16 *out, WebRtc_Word16 *in,
WebRtc_Word16 gain, WebRtc_Word32 add_constant,
WebRtc_Word16 right_shifts, int vector_length)
{
WebRtc_Word16 *inPtr;
WebRtc_Word16 *outPtr;
int i;
inPtr = in;
outPtr = out;
for (i = 0; i < vector_length; i++)
{
(*outPtr++) = (WebRtc_Word16)((WEBRTC_SPL_MUL_16_16((*inPtr++), gain)
+ (WebRtc_Word32)add_constant) >> right_shifts);
}
}

View File

@ -1,175 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/* encode.c - Encoding function for the iSAC coder */
#include "structs.h"
#include "codec.h"
#include "pitch_estimator.h"
#include <math.h>
void WebRtcIsac_InitMasking(MaskFiltstr *maskdata) {
int k;
for (k = 0; k < WINLEN; k++) {
maskdata->DataBufferLo[k] = 0.0;
maskdata->DataBufferHi[k] = 0.0;
}
for (k = 0; k < ORDERLO+1; k++) {
maskdata->CorrBufLo[k] = 0.0;
maskdata->PreStateLoF[k] = 0.0;
maskdata->PreStateLoG[k] = 0.0;
maskdata->PostStateLoF[k] = 0.0;
maskdata->PostStateLoG[k] = 0.0;
}
for (k = 0; k < ORDERHI+1; k++) {
maskdata->CorrBufHi[k] = 0.0;
maskdata->PreStateHiF[k] = 0.0;
maskdata->PreStateHiG[k] = 0.0;
maskdata->PostStateHiF[k] = 0.0;
maskdata->PostStateHiG[k] = 0.0;
}
maskdata->OldEnergy = 10.0;
/* fill tables for transforms */
WebRtcIsac_InitTransform();
return;
}
void WebRtcIsac_InitPreFilterbank(PreFiltBankstr *prefiltdata)
{
int k;
for (k = 0; k < QLOOKAHEAD; k++) {
prefiltdata->INLABUF1[k] = 0;
prefiltdata->INLABUF2[k] = 0;
prefiltdata->INLABUF1_float[k] = 0;
prefiltdata->INLABUF2_float[k] = 0;
}
for (k = 0; k < 2*(QORDER-1); k++) {
prefiltdata->INSTAT1[k] = 0;
prefiltdata->INSTAT2[k] = 0;
prefiltdata->INSTATLA1[k] = 0;
prefiltdata->INSTATLA2[k] = 0;
prefiltdata->INSTAT1_float[k] = 0;
prefiltdata->INSTAT2_float[k] = 0;
prefiltdata->INSTATLA1_float[k] = 0;
prefiltdata->INSTATLA2_float[k] = 0;
}
/* High pass filter states */
prefiltdata->HPstates[0] = 0.0;
prefiltdata->HPstates[1] = 0.0;
prefiltdata->HPstates_float[0] = 0.0f;
prefiltdata->HPstates_float[1] = 0.0f;
return;
}
void WebRtcIsac_InitPostFilterbank(PostFiltBankstr *postfiltdata)
{
int k;
for (k = 0; k < 2*POSTQORDER; k++) {
postfiltdata->STATE_0_LOWER[k] = 0;
postfiltdata->STATE_0_UPPER[k] = 0;
postfiltdata->STATE_0_LOWER_float[k] = 0;
postfiltdata->STATE_0_UPPER_float[k] = 0;
}
/* High pass filter states */
postfiltdata->HPstates1[0] = 0.0;
postfiltdata->HPstates1[1] = 0.0;
postfiltdata->HPstates2[0] = 0.0;
postfiltdata->HPstates2[1] = 0.0;
postfiltdata->HPstates1_float[0] = 0.0f;
postfiltdata->HPstates1_float[1] = 0.0f;
postfiltdata->HPstates2_float[0] = 0.0f;
postfiltdata->HPstates2_float[1] = 0.0f;
return;
}
void WebRtcIsac_InitPitchFilter(PitchFiltstr *pitchfiltdata)
{
int k;
for (k = 0; k < PITCH_BUFFSIZE; k++) {
pitchfiltdata->ubuf[k] = 0.0;
}
pitchfiltdata->ystate[0] = 0.0;
for (k = 1; k < (PITCH_DAMPORDER); k++) {
pitchfiltdata->ystate[k] = 0.0;
}
pitchfiltdata->oldlagp[0] = 50.0;
pitchfiltdata->oldgainp[0] = 0.0;
}
void WebRtcIsac_InitWeightingFilter(WeightFiltstr *wfdata)
{
int k;
double t, dtmp, dtmp2, denum, denum2;
for (k=0;k<PITCH_WLPCBUFLEN;k++)
wfdata->buffer[k]=0.0;
for (k=0;k<PITCH_WLPCORDER;k++) {
wfdata->istate[k]=0.0;
wfdata->weostate[k]=0.0;
wfdata->whostate[k]=0.0;
}
/* next part should be in Matlab, writing to a global table */
t = 0.5;
denum = 1.0 / ((double) PITCH_WLPCWINLEN);
denum2 = denum * denum;
for (k=0;k<PITCH_WLPCWINLEN;k++) {
dtmp = PITCH_WLPCASYM * t * denum + (1-PITCH_WLPCASYM) * t * t * denum2;
dtmp *= 3.14159265;
dtmp2 = sin(dtmp);
wfdata->window[k] = dtmp2 * dtmp2;
t++;
}
}
/* clear all buffers */
void WebRtcIsac_InitPitchAnalysis(PitchAnalysisStruct *State)
{
int k;
for (k = 0; k < PITCH_CORR_LEN2+PITCH_CORR_STEP2+PITCH_MAX_LAG/2-PITCH_FRAME_LEN/2+2; k++)
State->dec_buffer[k] = 0.0;
for (k = 0; k < 2*ALLPASSSECTIONS+1; k++)
State->decimator_state[k] = 0.0;
for (k = 0; k < 2; k++)
State->hp_state[k] = 0.0;
for (k = 0; k < QLOOKAHEAD; k++)
State->whitened_buf[k] = 0.0;
for (k = 0; k < QLOOKAHEAD; k++)
State->inbuf[k] = 0.0;
WebRtcIsac_InitPitchFilter(&(State->PFstr_wght));
WebRtcIsac_InitPitchFilter(&(State->PFstr));
WebRtcIsac_InitWeightingFilter(&(State->Wghtstr));
}

File diff suppressed because it is too large Load Diff

View File

@ -1,91 +0,0 @@
# Copyright (c) 2011 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.
{
'targets': [
{
'target_name': 'iSAC',
'type': '<(library)',
'dependencies': [
'<(webrtc_root)/common_audio/common_audio.gyp:signal_processing',
],
'include_dirs': [
'../interface',
],
'direct_dependent_settings': {
'include_dirs': [
'../interface',
],
},
'sources': [
'../interface/isac.h',
'arith_routines.c',
'arith_routines_hist.c',
'arith_routines_logist.c',
'bandwidth_estimator.c',
'crc.c',
'decode.c',
'decode_bwe.c',
'encode.c',
'encode_lpc_swb.c',
'entropy_coding.c',
'fft.c',
'filter_functions.c',
'filterbank_tables.c',
'intialize.c',
'isac.c',
'filterbanks.c',
'pitch_lag_tables.c',
'lattice.c',
'lpc_gain_swb_tables.c',
'lpc_analysis.c',
'lpc_shape_swb12_tables.c',
'lpc_shape_swb16_tables.c',
'lpc_tables.c',
'pitch_estimator.c',
'pitch_filter.c',
'pitch_gain_tables.c',
'spectrum_ar_model_tables.c',
'transform.c',
'arith_routines.h',
'bandwidth_estimator.h',
'codec.h',
'crc.h',
'encode_lpc_swb.h',
'entropy_coding.h',
'fft.h',
'filterbank_tables.h',
'lpc_gain_swb_tables.h',
'lpc_analysis.h',
'lpc_shape_swb12_tables.h',
'lpc_shape_swb16_tables.h',
'lpc_tables.h',
'pitch_estimator.h',
'pitch_gain_tables.h',
'pitch_lag_tables.h',
'settings.h',
'spectrum_ar_model_tables.h',
'structs.h',
'os_specific_inline.h',
],
'conditions': [
['OS!="win"', {
'defines': [
'WEBRTC_LINUX',
],
}],
],
},
],
}
# Local Variables:
# tab-width:2
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=2 shiftwidth=2:

View File

@ -1,729 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_
/*
* Define the fixed-point numeric formats
*/
#include "typedefs.h"
typedef struct WebRtcISACStruct ISACStruct;
enum IsacSamplingRate {kIsacWideband = 16, kIsacSuperWideband = 32};
#if defined(__cplusplus)
extern "C" {
#endif
/******************************************************************************
* WebRtcIsac_AssignSize(...)
*
* This function returns the size of the ISAC instance, so that the instance
* can be created outside iSAC.
*
* Input:
* - samplingRate : sampling rate of the input/output audio.
*
* Output:
* - sizeinbytes : number of bytes needed to allocate for the
* instance.
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_AssignSize(
int* sizeinbytes);
/******************************************************************************
* WebRtcIsac_Assign(...)
*
* This function assignes the memory already created to the ISAC instance.
*
* Input:
* - *ISAC_main_inst : a pointer to the coder instance.
* - samplingRate : sampling rate of the input/output audio.
* - ISAC_inst_Addr : the already allocated memory, where we put the
* iSAC structure.
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_Assign(
ISACStruct** ISAC_main_inst,
void* ISAC_inst_Addr);
/******************************************************************************
* WebRtcIsac_Create(...)
*
* This function creates an ISAC instance, which will contain the state
* information for one coding/decoding channel.
*
* Input:
* - *ISAC_main_inst : a pointer to the coder instance.
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_Create(
ISACStruct** ISAC_main_inst);
/******************************************************************************
* WebRtcIsac_Free(...)
*
* This function frees the ISAC instance created at the beginning.
*
* Input:
* - ISAC_main_inst : an ISAC instance.
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_Free(
ISACStruct* ISAC_main_inst);
/******************************************************************************
* WebRtcIsac_EncoderInit(...)
*
* This function initializes an ISAC instance prior to the encoder calls.
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - CodingMode : 0 -> Bit rate and frame length are
* automatically adjusted to available bandwidth
* on transmission channel, just valid if codec
* is created to work in wideband mode.
* 1 -> User sets a frame length and a target bit
* rate which is taken as the maximum
* short-term average bit rate.
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_EncoderInit(
ISACStruct* ISAC_main_inst,
WebRtc_Word16 CodingMode);
/******************************************************************************
* WebRtcIsac_Encode(...)
*
* This function encodes 10ms audio blocks and inserts it into a package.
* Input speech length has 160 samples if operating at 16 kHz sampling
* rate, or 320 if operating at 32 kHz sampling rate. The encoder buffers the
* input audio until the whole frame is buffered then proceeds with encoding.
*
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - speechIn : input speech vector.
*
* Output:
* - encoded : the encoded data vector
*
* Return value:
* : >0 - Length (in bytes) of coded data
* : 0 - The buffer didn't reach the chosen
* frame-size so it keeps buffering speech
* samples.
* : -1 - Error
*/
WebRtc_Word16 WebRtcIsac_Encode(
ISACStruct* ISAC_main_inst,
const WebRtc_Word16* speechIn,
WebRtc_Word16* encoded);
/******************************************************************************
* WebRtcIsac_DecoderInit(...)
*
* This function initializes an ISAC instance prior to the decoder calls.
*
* Input:
* - ISAC_main_inst : ISAC instance.
*
* Return value
* : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_DecoderInit(
ISACStruct* ISAC_main_inst);
/******************************************************************************
* WebRtcIsac_UpdateBwEstimate(...)
*
* This function updates the estimate of the bandwidth.
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - encoded : encoded ISAC frame(s).
* - packet_size : size of the packet.
* - rtp_seq_number : the RTP number of the packet.
* - send_ts : the RTP send timestamp, given in samples
* - arr_ts : the arrival time of the packet (from NetEq)
* in samples.
*
* Return value : 0 - Ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_UpdateBwEstimate(
ISACStruct* ISAC_main_inst,
const WebRtc_UWord16* encoded,
WebRtc_Word32 packet_size,
WebRtc_UWord16 rtp_seq_number,
WebRtc_UWord32 send_ts,
WebRtc_UWord32 arr_ts);
/******************************************************************************
* WebRtcIsac_Decode(...)
*
* This function decodes an ISAC frame. At 16 kHz sampling rate, the length
* of the output audio could be either 480 or 960 samples, equivalent to
* 30 or 60 ms respectively. At 32 kHz sampling rate, the length of the
* output audio is 960 samples, which is 30 ms.
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - encoded : encoded ISAC frame(s).
* - len : bytes in encoded vector.
*
* Output:
* - decoded : The decoded vector.
*
* Return value : >0 - number of samples in decoded vector.
* -1 - Error.
*/
WebRtc_Word16 WebRtcIsac_Decode(
ISACStruct* ISAC_main_inst,
const WebRtc_UWord16* encoded,
WebRtc_Word16 len,
WebRtc_Word16* decoded,
WebRtc_Word16* speechType);
/******************************************************************************
* WebRtcIsac_DecodePlc(...)
*
* This function conducts PLC for ISAC frame(s). Output speech length
* will be a multiple of frames, i.e. multiples of 30 ms audio. Therefore,
* the output is multiple of 480 samples if operating at 16 kHz and multiple
* of 960 if operating at 32 kHz.
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - noOfLostFrames : Number of PLC frames to produce.
*
* Output:
* - decoded : The decoded vector.
*
* Return value : >0 - number of samples in decoded PLC vector
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_DecodePlc(
ISACStruct* ISAC_main_inst,
WebRtc_Word16* decoded,
WebRtc_Word16 noOfLostFrames);
/******************************************************************************
* WebRtcIsac_Control(...)
*
* This function sets the limit on the short-term average bit-rate and the
* frame length. Should be used only in Instantaneous mode. At 16 kHz sampling
* rate, an average bit-rate between 10000 to 32000 bps is valid and a
* frame-size of 30 or 60 ms is acceptable. At 32 kHz, an average bit-rate
* between 10000 to 56000 is acceptable, and the valid frame-size is 30 ms.
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - rate : limit on the short-term average bit rate,
* in bits/second.
* - framesize : frame-size in millisecond.
*
* Return value : 0 - ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_Control(
ISACStruct* ISAC_main_inst,
WebRtc_Word32 rate,
WebRtc_Word16 framesize);
/******************************************************************************
* WebRtcIsac_ControlBwe(...)
*
* This function sets the initial values of bottleneck and frame-size if
* iSAC is used in channel-adaptive mode. Therefore, this API is not
* applicable if the codec is created to operate in super-wideband mode.
*
* Through this API, users can enforce a frame-size for all values of
* bottleneck. Then iSAC will not automatically change the frame-size.
*
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - rateBPS : initial value of bottleneck in bits/second
* 10000 <= rateBPS <= 56000 is accepted
* For default bottleneck set rateBPS = 0
* - frameSizeMs : number of milliseconds per frame (30 or 60)
* - enforceFrameSize : 1 to enforce the given frame-size through
* out the adaptation process, 0 to let iSAC
* change the frame-size if required.
*
* Return value : 0 - ok
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_ControlBwe(
ISACStruct* ISAC_main_inst,
WebRtc_Word32 rateBPS,
WebRtc_Word16 frameSizeMs,
WebRtc_Word16 enforceFrameSize);
/******************************************************************************
* WebRtcIsac_ReadFrameLen(...)
*
* This function returns the length of the frame represented in the packet.
*
* Input:
* - encoded : Encoded bit-stream
*
* Output:
* - frameLength : Length of frame in packet (in samples)
*
*/
WebRtc_Word16 WebRtcIsac_ReadFrameLen(
ISACStruct* ISAC_main_inst,
const WebRtc_Word16* encoded,
WebRtc_Word16* frameLength);
/******************************************************************************
* WebRtcIsac_version(...)
*
* This function returns the version number.
*
* Output:
* - version : Pointer to character string
*
*/
void WebRtcIsac_version(
char *version);
/******************************************************************************
* WebRtcIsac_GetErrorCode(...)
*
* This function can be used to check the error code of an iSAC instance. When
* a function returns -1 a error code will be set for that instance. The
* function below extract the code of the last error that occurred in the
* specified instance.
*
* Input:
* - ISAC_main_inst : ISAC instance
*
* Return value : Error code
*/
WebRtc_Word16 WebRtcIsac_GetErrorCode(
ISACStruct* ISAC_main_inst);
/****************************************************************************
* WebRtcIsac_GetUplinkBw(...)
*
* This function outputs the target bottleneck of the codec. In
* channel-adaptive mode, the target bottleneck is specified through in-band
* signalling retreived by bandwidth estimator.
* In channel-independent, also called instantaneous mode, the target
* bottleneck is provided to the encoder by calling xxx_control(...). If
* xxx_control is never called the default values is returned. The default
* value for bottleneck at 16 kHz encoder sampling rate is 32000 bits/sec,
* and it is 56000 bits/sec for 32 kHz sampling rate.
* Note that the output is the iSAC internal operating bottleneck which might
* differ slightly from the one provided through xxx_control().
*
* Input:
* - ISAC_main_inst : iSAC instance
*
* Output:
* - *bottleneck : bottleneck in bits/sec
*
* Return value : -1 if error happens
* 0 bit-rates computed correctly.
*/
WebRtc_Word16 WebRtcIsac_GetUplinkBw(
ISACStruct* ISAC_main_inst,
WebRtc_Word32* bottleneck);
/******************************************************************************
* WebRtcIsac_SetMaxPayloadSize(...)
*
* This function sets a limit for the maximum payload size of iSAC. The same
* value is used both for 30 and 60 ms packets. If the encoder sampling rate
* is 16 kHz the maximum payload size is between 120 and 400 bytes. If the
* encoder sampling rate is 32 kHz the maximum payload size is between 120
* and 600 bytes.
*
* If an out of range limit is used, the function returns -1, but the closest
* valid value will be applied.
*
* ---------------
* IMPORTANT NOTES
* ---------------
* The size of a packet is limited to the minimum of 'max-payload-size' and
* 'max-rate.' For instance, let's assume the max-payload-size is set to
* 170 bytes, and max-rate is set to 40 kbps. Note that a limit of 40 kbps
* translates to 150 bytes for 30ms frame-size & 300 bytes for 60ms
* frame-size. Then a packet with a frame-size of 30 ms is limited to 150,
* i.e. min(170, 150), and a packet with 60 ms frame-size is limited to
* 170 bytes, i.e. min(170, 300).
*
* Input:
* - ISAC_main_inst : iSAC instance
* - maxPayloadBytes : maximum size of the payload in bytes
* valid values are between 120 and 400 bytes
* if encoder sampling rate is 16 kHz. For
* 32 kHz encoder sampling rate valid values
* are between 120 and 600 bytes.
*
* Return value : 0 if successful
* -1 if error happens
*/
WebRtc_Word16 WebRtcIsac_SetMaxPayloadSize(
ISACStruct* ISAC_main_inst,
WebRtc_Word16 maxPayloadBytes);
/******************************************************************************
* WebRtcIsac_SetMaxRate(...)
*
* This function sets the maximum rate which the codec may not exceed for
* any signal packet. The maximum rate is defined and payload-size per
* frame-size in bits per second.
*
* The codec has a maximum rate of 53400 bits per second (200 bytes per 30
* ms) if the encoder sampling rate is 16kHz, and 160 kbps (600 bytes/30 ms)
* if the encoder sampling rate is 32 kHz.
*
* It is possible to set a maximum rate between 32000 and 53400 bits/sec
* in wideband mode, and 32000 to 160000 bits/sec in super-wideband mode.
*
* If an out of range limit is used, the function returns -1, but the closest
* valid value will be applied.
*
* ---------------
* IMPORTANT NOTES
* ---------------
* The size of a packet is limited to the minimum of 'max-payload-size' and
* 'max-rate.' For instance, let's assume the max-payload-size is set to
* 170 bytes, and max-rate is set to 40 kbps. Note that a limit of 40 kbps
* translates to 150 bytes for 30ms frame-size & 300 bytes for 60ms
* frame-size. Then a packet with a frame-size of 30 ms is limited to 150,
* i.e. min(170, 150), and a packet with 60 ms frame-size is limited to
* 170 bytes, min(170, 300).
*
* Input:
* - ISAC_main_inst : iSAC instance
* - maxRate : maximum rate in bits per second,
* valid values are 32000 to 53400 bits/sec in
* wideband mode, and 32000 to 160000 bits/sec in
* super-wideband mode.
*
* Return value : 0 if successful
* -1 if error happens
*/
WebRtc_Word16 WebRtcIsac_SetMaxRate(
ISACStruct* ISAC_main_inst,
WebRtc_Word32 maxRate);
/******************************************************************************
* WebRtcIsac_DecSampRate()
* Return the sampling rate of the decoded audio.
*
* Input:
* - ISAC_main_inst : iSAC instance
*
* Return value : enumerator representing sampling frequency
* associated with the decoder, i.e. the
* sampling rate of the decoded audio.
*
*/
enum IsacSamplingRate WebRtcIsac_DecSampRate(
ISACStruct* ISAC_main_inst);
/******************************************************************************
* WebRtcIsac_EncSampRate()
*
* Input:
* - ISAC_main_inst : iSAC instance
*
* Return value : enumerator representing sampling frequency
* associated with the encoder, the input audio
* is expected to be sampled at this rate.
*
*/
enum IsacSamplingRate WebRtcIsac_EncSampRate(
ISACStruct* ISAC_main_inst);
/******************************************************************************
* WebRtcIsac_SetDecSampRate()
* Set the sampling rate of the decoder. Initialization of the decoder WILL
* NOT overwrite the sampling rate of the encoder. The default value is 16 kHz
* which is set when the instance is created.
*
* Input:
* - ISAC_main_inst : iSAC instance
* - sampRate : enumerator specifying the sampling rate.
*
* Return value : 0 if successful
* -1 if failed.
*/
WebRtc_Word16 WebRtcIsac_SetDecSampRate(
ISACStruct* ISAC_main_inst,
enum IsacSamplingRate sampRate);
/******************************************************************************
* WebRtcIsac_SetEncSampRate()
* Set the sampling rate of the encoder. Initialization of the encoder WILL
* NOT overwrite the sampling rate of the encoder. The default value is 16 kHz
* which is set when the instance is created. The encoding-mode and the
* bottleneck remain unchanged by this call, however, the maximum rate and
* maximum payload-size will reset to their default value.
*
* Input:
* - ISAC_main_inst : iSAC instance
* - sampRate : enumerator specifying the sampling rate.
*
* Return value : 0 if successful
* -1 if failed.
*/
WebRtc_Word16 WebRtcIsac_SetEncSampRate(
ISACStruct* ISAC_main_inst,
enum IsacSamplingRate sampRate);
/******************************************************************************
* WebRtcIsac_GetNewBitStream(...)
*
* This function returns encoded data, with the recieved bwe-index in the
* stream. If the rate is set to a value less than bottleneck of codec
* the new bistream will be re-encoded with the given target rate.
* It should always return a complete packet, i.e. only called once
* even for 60 msec frames.
*
* NOTE 1! This function does not write in the ISACStruct, it is not allowed.
* NOTE 2! Currently not implemented for SWB mode.
* NOTE 3! Rates larger than the bottleneck of the codec will be limited
* to the current bottleneck.
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - bweIndex : Index of bandwidth estimate to put in new
* bitstream
* - rate : target rate of the transcoder is bits/sec.
* Valid values are the accepted rate in iSAC,
* i.e. 10000 to 56000.
* - isRCU : if the new bit-stream is an RCU stream.
* Note that the rate parameter always indicates
* the target rate of the main paylaod, regardless
* of 'isRCU' value.
*
* Output:
* - encoded : The encoded data vector
*
* Return value : >0 - Length (in bytes) of coded data
* -1 - Error or called in SWB mode
* NOTE! No error code is written to
* the struct since it is only allowed to read
* the struct.
*/
WebRtc_Word16 WebRtcIsac_GetNewBitStream(
ISACStruct* ISAC_main_inst,
WebRtc_Word16 bweIndex,
WebRtc_Word16 jitterInfo,
WebRtc_Word32 rate,
WebRtc_Word16* encoded,
WebRtc_Word16 isRCU);
/****************************************************************************
* WebRtcIsac_GetDownLinkBwIndex(...)
*
* This function returns index representing the Bandwidth estimate from
* other side to this side.
*
* Input:
* - ISAC_main_inst : iSAC struct
*
* Output:
* - bweIndex : Bandwidth estimate to transmit to other side.
*
*/
WebRtc_Word16 WebRtcIsac_GetDownLinkBwIndex(
ISACStruct* ISAC_main_inst,
WebRtc_Word16* bweIndex,
WebRtc_Word16* jitterInfo);
/****************************************************************************
* WebRtcIsac_UpdateUplinkBw(...)
*
* This function takes an index representing the Bandwidth estimate from
* this side to other side and updates BWE.
*
* Input:
* - ISAC_main_inst : iSAC struct
* - bweIndex : Bandwidth estimate from other side.
*
*/
WebRtc_Word16 WebRtcIsac_UpdateUplinkBw(
ISACStruct* ISAC_main_inst,
WebRtc_Word16 bweIndex);
/****************************************************************************
* WebRtcIsac_ReadBwIndex(...)
*
* This function returns the index of the Bandwidth estimate from the bitstream.
*
* Input:
* - encoded : Encoded bitstream
*
* Output:
* - frameLength : Length of frame in packet (in samples)
* - bweIndex : Bandwidth estimate in bitstream
*
*/
WebRtc_Word16 WebRtcIsac_ReadBwIndex(
const WebRtc_Word16* encoded,
WebRtc_Word16* bweIndex);
/*******************************************************************************
* WebRtcIsac_GetNewFrameLen(...)
*
* returns the frame lenght (in samples) of the next packet. In the case of channel-adaptive
* mode, iSAC decides on its frame lenght based on the estimated bottleneck
* this allows a user to prepare for the next packet (at the encoder)
*
* The primary usage is in CE to make the iSAC works in channel-adaptive mode
*
* Input:
* - ISAC_main_inst : iSAC struct
*
* Return Value : frame lenght in samples
*
*/
WebRtc_Word16 WebRtcIsac_GetNewFrameLen(
ISACStruct* ISAC_main_inst);
/****************************************************************************
* WebRtcIsac_GetRedPayload(...)
*
* Populates "encoded" with the redundant payload of the recently encoded
* frame. This function has to be called once that WebRtcIsac_Encode(...)
* returns a positive value. Regardless of the frame-size this function will
* be called only once after encoding is completed.
*
* Input:
* - ISAC_main_inst : iSAC struct
*
* Output:
* - encoded : the encoded data vector
*
*
* Return value:
* : >0 - Length (in bytes) of coded data
* : -1 - Error
*
*
*/
WebRtc_Word16 WebRtcIsac_GetRedPayload(
ISACStruct* ISAC_main_inst,
WebRtc_Word16* encoded);
/****************************************************************************
* WebRtcIsac_DecodeRcu(...)
*
* This function decodes a redundant (RCU) iSAC frame. Function is called in
* NetEq with a stored RCU payload i case of packet loss. Output speech length
* will be a multiple of 480 samples: 480 or 960 samples,
* depending on the framesize (30 or 60 ms).
*
* Input:
* - ISAC_main_inst : ISAC instance.
* - encoded : encoded ISAC RCU frame(s)
* - len : bytes in encoded vector
*
* Output:
* - decoded : The decoded vector
*
* Return value : >0 - number of samples in decoded vector
* -1 - Error
*/
WebRtc_Word16 WebRtcIsac_DecodeRcu(
ISACStruct* ISAC_main_inst,
const WebRtc_UWord16* encoded,
WebRtc_Word16 len,
WebRtc_Word16* decoded,
WebRtc_Word16* speechType);
#if defined(__cplusplus)
}
#endif
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_INTERFACE_ISAC_H_ */

View File

@ -1,217 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* lattice.c
*
* contains the normalized lattice filter routines (MA and AR) for iSAC codec
*
*/
#include "settings.h"
#include "codec.h"
#include <math.h>
#include <memory.h>
#ifdef WEBRTC_ANDROID
#include <stdlib.h>
#endif
/* filter the signal using normalized lattice filter */
/* MA filter */
void WebRtcIsac_NormLatticeFilterMa(int orderCoef,
float *stateF,
float *stateG,
float *lat_in,
double *filtcoeflo,
double *lat_out)
{
int n,k,i,u,temp1;
int ord_1 = orderCoef+1;
float sth[MAX_AR_MODEL_ORDER];
float cth[MAX_AR_MODEL_ORDER];
float inv_cth[MAX_AR_MODEL_ORDER];
double a[MAX_AR_MODEL_ORDER+1];
float f[MAX_AR_MODEL_ORDER+1][HALF_SUBFRAMELEN], g[MAX_AR_MODEL_ORDER+1][HALF_SUBFRAMELEN];
float gain1;
for (u=0;u<SUBFRAMES;u++)
{
/* set the Direct Form coefficients */
temp1 = u*ord_1;
a[0] = 1;
memcpy(a+1, filtcoeflo+temp1+1, sizeof(double) * (ord_1-1));
/* compute lattice filter coefficients */
WebRtcIsac_Dir2Lat(a,orderCoef,sth,cth);
/* compute the gain */
gain1 = (float)filtcoeflo[temp1];
for (k=0;k<orderCoef;k++)
{
gain1 *= cth[k];
inv_cth[k] = 1/cth[k];
}
/* normalized lattice filter */
/*****************************/
/* initial conditions */
for (i=0;i<HALF_SUBFRAMELEN;i++)
{
f[0][i] = lat_in[i + u * HALF_SUBFRAMELEN];
g[0][i] = lat_in[i + u * HALF_SUBFRAMELEN];
}
/* get the state of f&g for the first input, for all orders */
for (i=1;i<ord_1;i++)
{
f[i][0] = inv_cth[i-1]*(f[i-1][0] + sth[i-1]*stateG[i-1]);
g[i][0] = cth[i-1]*stateG[i-1] + sth[i-1]* f[i][0];
}
/* filtering */
for(k=0;k<orderCoef;k++)
{
for(n=0;n<(HALF_SUBFRAMELEN-1);n++)
{
f[k+1][n+1] = inv_cth[k]*(f[k][n+1] + sth[k]*g[k][n]);
g[k+1][n+1] = cth[k]*g[k][n] + sth[k]* f[k+1][n+1];
}
}
for(n=0;n<HALF_SUBFRAMELEN;n++)
{
lat_out[n + u * HALF_SUBFRAMELEN] = gain1 * f[orderCoef][n];
}
/* save the states */
for (i=0;i<ord_1;i++)
{
stateF[i] = f[i][HALF_SUBFRAMELEN-1];
stateG[i] = g[i][HALF_SUBFRAMELEN-1];
}
/* process next frame */
}
return;
}
/*///////////////////AR filter ///////////////////////////////*/
/* filter the signal using normalized lattice filter */
void WebRtcIsac_NormLatticeFilterAr(int orderCoef,
float *stateF,
float *stateG,
double *lat_in,
double *lo_filt_coef,
float *lat_out)
{
int n,k,i,u,temp1;
int ord_1 = orderCoef+1;
float sth[MAX_AR_MODEL_ORDER];
float cth[MAX_AR_MODEL_ORDER];
double a[MAX_AR_MODEL_ORDER+1];
float ARf[MAX_AR_MODEL_ORDER+1][HALF_SUBFRAMELEN], ARg[MAX_AR_MODEL_ORDER+1][HALF_SUBFRAMELEN];
float gain1,inv_gain1;
for (u=0;u<SUBFRAMES;u++)
{
/* set the denominator and numerator of the Direct Form */
temp1 = u*ord_1;
a[0] = 1;
memcpy(a+1, lo_filt_coef+temp1+1, sizeof(double) * (ord_1-1));
WebRtcIsac_Dir2Lat(a,orderCoef,sth,cth);
gain1 = (float)lo_filt_coef[temp1];
for (k=0;k<orderCoef;k++)
{
gain1 = cth[k]*gain1;
}
/* initial conditions */
inv_gain1 = 1/gain1;
for (i=0;i<HALF_SUBFRAMELEN;i++)
{
ARf[orderCoef][i] = (float)lat_in[i + u * HALF_SUBFRAMELEN]*inv_gain1;
}
for (i=orderCoef-1;i>=0;i--) //get the state of f&g for the first input, for all orders
{
ARf[i][0] = cth[i]*ARf[i+1][0] - sth[i]*stateG[i];
ARg[i+1][0] = sth[i]*ARf[i+1][0] + cth[i]* stateG[i];
}
ARg[0][0] = ARf[0][0];
for(n=0;n<(HALF_SUBFRAMELEN-1);n++)
{
for(k=orderCoef-1;k>=0;k--)
{
ARf[k][n+1] = cth[k]*ARf[k+1][n+1] - sth[k]*ARg[k][n];
ARg[k+1][n+1] = sth[k]*ARf[k+1][n+1] + cth[k]* ARg[k][n];
}
ARg[0][n+1] = ARf[0][n+1];
}
memcpy(lat_out+u * HALF_SUBFRAMELEN, &(ARf[0][0]), sizeof(float) * HALF_SUBFRAMELEN);
/* cannot use memcpy in the following */
for (i=0;i<ord_1;i++)
{
stateF[i] = ARf[i][HALF_SUBFRAMELEN-1];
stateG[i] = ARg[i][HALF_SUBFRAMELEN-1];
}
}
return;
}
/* compute the reflection coefficients using the step-down procedure*/
/* converts the direct form parameters to lattice form.*/
/* a and b are vectors which contain the direct form coefficients,
according to
A(z) = a(1) + a(2)*z + a(3)*z^2 + ... + a(M+1)*z^M
B(z) = b(1) + b(2)*z + b(3)*z^2 + ... + b(M+1)*z^M
*/
void WebRtcIsac_Dir2Lat(double *a,
int orderCoef,
float *sth,
float *cth)
{
int m, k;
float tmp[MAX_AR_MODEL_ORDER];
float tmp_inv, cth2;
sth[orderCoef-1] = (float)a[orderCoef];
cth2 = 1.0f - sth[orderCoef-1] * sth[orderCoef-1];
cth[orderCoef-1] = (float)sqrt(cth2);
for (m=orderCoef-1; m>0; m--)
{
tmp_inv = 1.0f / cth2;
for (k=1; k<=m; k++)
{
tmp[k] = ((float)a[k] - sth[m] * (float)a[m-k+1]) * tmp_inv;
}
for (k=1; k<m; k++)
{
a[k] = tmp[k];
}
sth[m-1] = tmp[m];
cth2 = 1 - sth[m-1] * sth[m-1];
cth[m-1] = (float)sqrt(cth2);
}
}

View File

@ -1,259 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* This file contains the function WebRtcSpl_LevinsonDurbin().
* The description header can be found in signal_processing_library.h
*
*/
#include "signal_processing_library.h"
#define SPL_LEVINSON_MAXORDER 20
WebRtc_Word16 WebRtcSpl_LevinsonDurbin(WebRtc_Word32 *R, WebRtc_Word16 *A, WebRtc_Word16 *K,
WebRtc_Word16 order)
{
WebRtc_Word16 i, j;
// Auto-correlation coefficients in high precision
WebRtc_Word16 R_hi[SPL_LEVINSON_MAXORDER + 1], R_low[SPL_LEVINSON_MAXORDER + 1];
// LPC coefficients in high precision
WebRtc_Word16 A_hi[SPL_LEVINSON_MAXORDER + 1], A_low[SPL_LEVINSON_MAXORDER + 1];
// LPC coefficients for next iteration
WebRtc_Word16 A_upd_hi[SPL_LEVINSON_MAXORDER + 1], A_upd_low[SPL_LEVINSON_MAXORDER + 1];
// Reflection coefficient in high precision
WebRtc_Word16 K_hi, K_low;
// Prediction gain Alpha in high precision and with scale factor
WebRtc_Word16 Alpha_hi, Alpha_low, Alpha_exp;
WebRtc_Word16 tmp_hi, tmp_low;
WebRtc_Word32 temp1W32, temp2W32, temp3W32;
WebRtc_Word16 norm;
// Normalize the autocorrelation R[0]...R[order+1]
norm = WebRtcSpl_NormW32(R[0]);
for (i = order; i >= 0; i--)
{
temp1W32 = WEBRTC_SPL_LSHIFT_W32(R[i], norm);
// Put R in hi and low format
R_hi[i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp1W32, 16);
R_low[i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp1W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)R_hi[i], 16)), 1);
}
// K = A[1] = -R[1] / R[0]
temp2W32 = WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)R_hi[1],16)
+ WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)R_low[1],1); // R[1] in Q31
temp3W32 = WEBRTC_SPL_ABS_W32(temp2W32); // abs R[1]
temp1W32 = WebRtcSpl_DivW32HiLow(temp3W32, R_hi[0], R_low[0]); // abs(R[1])/R[0] in Q31
// Put back the sign on R[1]
if (temp2W32 > 0)
{
temp1W32 = -temp1W32;
}
// Put K in hi and low format
K_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp1W32, 16);
K_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp1W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)K_hi, 16)), 1);
// Store first reflection coefficient
K[0] = K_hi;
temp1W32 = WEBRTC_SPL_RSHIFT_W32(temp1W32, 4); // A[1] in Q27
// Put A[1] in hi and low format
A_hi[1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp1W32, 16);
A_low[1] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp1W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)A_hi[1], 16)), 1);
// Alpha = R[0] * (1-K^2)
temp1W32 = (((WEBRTC_SPL_MUL_16_16(K_hi, K_low) >> 14) + WEBRTC_SPL_MUL_16_16(K_hi, K_hi))
<< 1); // temp1W32 = k^2 in Q31
temp1W32 = WEBRTC_SPL_ABS_W32(temp1W32); // Guard against <0
temp1W32 = (WebRtc_Word32)0x7fffffffL - temp1W32; // temp1W32 = (1 - K[0]*K[0]) in Q31
// Store temp1W32 = 1 - K[0]*K[0] on hi and low format
tmp_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp1W32, 16);
tmp_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp1W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)tmp_hi, 16)), 1);
// Calculate Alpha in Q31
temp1W32 = ((WEBRTC_SPL_MUL_16_16(R_hi[0], tmp_hi)
+ (WEBRTC_SPL_MUL_16_16(R_hi[0], tmp_low) >> 15)
+ (WEBRTC_SPL_MUL_16_16(R_low[0], tmp_hi) >> 15)) << 1);
// Normalize Alpha and put it in hi and low format
Alpha_exp = WebRtcSpl_NormW32(temp1W32);
temp1W32 = WEBRTC_SPL_LSHIFT_W32(temp1W32, Alpha_exp);
Alpha_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp1W32, 16);
Alpha_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp1W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)Alpha_hi, 16)), 1);
// Perform the iterative calculations in the Levinson-Durbin algorithm
for (i = 2; i <= order; i++)
{
/* ----
temp1W32 = R[i] + > R[j]*A[i-j]
/
----
j=1..i-1
*/
temp1W32 = 0;
for (j = 1; j < i; j++)
{
// temp1W32 is in Q31
temp1W32 += ((WEBRTC_SPL_MUL_16_16(R_hi[j], A_hi[i-j]) << 1)
+ (((WEBRTC_SPL_MUL_16_16(R_hi[j], A_low[i-j]) >> 15)
+ (WEBRTC_SPL_MUL_16_16(R_low[j], A_hi[i-j]) >> 15)) << 1));
}
temp1W32 = WEBRTC_SPL_LSHIFT_W32(temp1W32, 4);
temp1W32 += (WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)R_hi[i], 16)
+ WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)R_low[i], 1));
// K = -temp1W32 / Alpha
temp2W32 = WEBRTC_SPL_ABS_W32(temp1W32); // abs(temp1W32)
temp3W32 = WebRtcSpl_DivW32HiLow(temp2W32, Alpha_hi, Alpha_low); // abs(temp1W32)/Alpha
// Put the sign of temp1W32 back again
if (temp1W32 > 0)
{
temp3W32 = -temp3W32;
}
// Use the Alpha shifts from earlier to de-normalize
norm = WebRtcSpl_NormW32(temp3W32);
if ((Alpha_exp <= norm) || (temp3W32 == 0))
{
temp3W32 = WEBRTC_SPL_LSHIFT_W32(temp3W32, Alpha_exp);
} else
{
if (temp3W32 > 0)
{
temp3W32 = (WebRtc_Word32)0x7fffffffL;
} else
{
temp3W32 = (WebRtc_Word32)0x80000000L;
}
}
// Put K on hi and low format
K_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp3W32, 16);
K_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp3W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)K_hi, 16)), 1);
// Store Reflection coefficient in Q15
K[i - 1] = K_hi;
// Test for unstable filter.
// If unstable return 0 and let the user decide what to do in that case
if ((WebRtc_Word32)WEBRTC_SPL_ABS_W16(K_hi) > (WebRtc_Word32)32750)
{
return 0; // Unstable filter
}
/*
Compute updated LPC coefficient: Anew[i]
Anew[j]= A[j] + K*A[i-j] for j=1..i-1
Anew[i]= K
*/
for (j = 1; j < i; j++)
{
// temp1W32 = A[j] in Q27
temp1W32 = WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)A_hi[j],16)
+ WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)A_low[j],1);
// temp1W32 += K*A[i-j] in Q27
temp1W32 += ((WEBRTC_SPL_MUL_16_16(K_hi, A_hi[i-j])
+ (WEBRTC_SPL_MUL_16_16(K_hi, A_low[i-j]) >> 15)
+ (WEBRTC_SPL_MUL_16_16(K_low, A_hi[i-j]) >> 15)) << 1);
// Put Anew in hi and low format
A_upd_hi[j] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp1W32, 16);
A_upd_low[j] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp1W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)A_upd_hi[j], 16)), 1);
}
// temp3W32 = K in Q27 (Convert from Q31 to Q27)
temp3W32 = WEBRTC_SPL_RSHIFT_W32(temp3W32, 4);
// Store Anew in hi and low format
A_upd_hi[i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp3W32, 16);
A_upd_low[i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp3W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)A_upd_hi[i], 16)), 1);
// Alpha = Alpha * (1-K^2)
temp1W32 = (((WEBRTC_SPL_MUL_16_16(K_hi, K_low) >> 14)
+ WEBRTC_SPL_MUL_16_16(K_hi, K_hi)) << 1); // K*K in Q31
temp1W32 = WEBRTC_SPL_ABS_W32(temp1W32); // Guard against <0
temp1W32 = (WebRtc_Word32)0x7fffffffL - temp1W32; // 1 - K*K in Q31
// Convert 1- K^2 in hi and low format
tmp_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp1W32, 16);
tmp_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp1W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)tmp_hi, 16)), 1);
// Calculate Alpha = Alpha * (1-K^2) in Q31
temp1W32 = ((WEBRTC_SPL_MUL_16_16(Alpha_hi, tmp_hi)
+ (WEBRTC_SPL_MUL_16_16(Alpha_hi, tmp_low) >> 15)
+ (WEBRTC_SPL_MUL_16_16(Alpha_low, tmp_hi) >> 15)) << 1);
// Normalize Alpha and store it on hi and low format
norm = WebRtcSpl_NormW32(temp1W32);
temp1W32 = WEBRTC_SPL_LSHIFT_W32(temp1W32, norm);
Alpha_hi = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(temp1W32, 16);
Alpha_low = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp1W32
- WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)Alpha_hi, 16)), 1);
// Update the total normalization of Alpha
Alpha_exp = Alpha_exp + norm;
// Update A[]
for (j = 1; j <= i; j++)
{
A_hi[j] = A_upd_hi[j];
A_low[j] = A_upd_low[j];
}
}
/*
Set A[0] to 1.0 and store the A[i] i=1...order in Q12
(Convert from Q27 and use rounding)
*/
A[0] = 4096;
for (i = 1; i <= order; i++)
{
// temp1W32 in Q27
temp1W32 = WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)A_hi[i], 16)
+ WEBRTC_SPL_LSHIFT_W32((WebRtc_Word32)A_low[i], 1);
// Round and store upper word
A[i] = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32((temp1W32<<1)+(WebRtc_Word32)32768, 16);
}
return 1; // Stable filters
}

View File

@ -1,535 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
#include "lpc_analysis.h"
#include "settings.h"
#include "codec.h"
#include "entropy_coding.h"
#include <math.h>
#include <string.h>
#define LEVINSON_EPS 1.0e-10
/* window */
/* Matlab generation code:
* t = (1:256)/257; r = 1-(1-t).^.45; w = sin(r*pi).^3; w = w/sum(w); plot((1:256)/8, w); grid;
* for k=1:16, fprintf(1, '%.8f, ', w(k*16 + (-15:0))); fprintf(1, '\n'); end
*/
static const double kLpcCorrWindow[WINLEN] = {
0.00000000, 0.00000001, 0.00000004, 0.00000010, 0.00000020,
0.00000035, 0.00000055, 0.00000083, 0.00000118, 0.00000163,
0.00000218, 0.00000283, 0.00000361, 0.00000453, 0.00000558, 0.00000679,
0.00000817, 0.00000973, 0.00001147, 0.00001342, 0.00001558,
0.00001796, 0.00002058, 0.00002344, 0.00002657, 0.00002997,
0.00003365, 0.00003762, 0.00004190, 0.00004651, 0.00005144, 0.00005673,
0.00006236, 0.00006837, 0.00007476, 0.00008155, 0.00008875,
0.00009636, 0.00010441, 0.00011290, 0.00012186, 0.00013128,
0.00014119, 0.00015160, 0.00016252, 0.00017396, 0.00018594, 0.00019846,
0.00021155, 0.00022521, 0.00023946, 0.00025432, 0.00026978,
0.00028587, 0.00030260, 0.00031998, 0.00033802, 0.00035674,
0.00037615, 0.00039626, 0.00041708, 0.00043863, 0.00046092, 0.00048396,
0.00050775, 0.00053233, 0.00055768, 0.00058384, 0.00061080,
0.00063858, 0.00066720, 0.00069665, 0.00072696, 0.00075813,
0.00079017, 0.00082310, 0.00085692, 0.00089164, 0.00092728, 0.00096384,
0.00100133, 0.00103976, 0.00107914, 0.00111947, 0.00116077,
0.00120304, 0.00124630, 0.00129053, 0.00133577, 0.00138200,
0.00142924, 0.00147749, 0.00152676, 0.00157705, 0.00162836, 0.00168070,
0.00173408, 0.00178850, 0.00184395, 0.00190045, 0.00195799,
0.00201658, 0.00207621, 0.00213688, 0.00219860, 0.00226137,
0.00232518, 0.00239003, 0.00245591, 0.00252284, 0.00259079, 0.00265977,
0.00272977, 0.00280078, 0.00287280, 0.00294582, 0.00301984,
0.00309484, 0.00317081, 0.00324774, 0.00332563, 0.00340446,
0.00348421, 0.00356488, 0.00364644, 0.00372889, 0.00381220, 0.00389636,
0.00398135, 0.00406715, 0.00415374, 0.00424109, 0.00432920,
0.00441802, 0.00450754, 0.00459773, 0.00468857, 0.00478001,
0.00487205, 0.00496464, 0.00505775, 0.00515136, 0.00524542, 0.00533990,
0.00543476, 0.00552997, 0.00562548, 0.00572125, 0.00581725,
0.00591342, 0.00600973, 0.00610612, 0.00620254, 0.00629895,
0.00639530, 0.00649153, 0.00658758, 0.00668341, 0.00677894, 0.00687413,
0.00696891, 0.00706322, 0.00715699, 0.00725016, 0.00734266,
0.00743441, 0.00752535, 0.00761540, 0.00770449, 0.00779254,
0.00787947, 0.00796519, 0.00804963, 0.00813270, 0.00821431, 0.00829437,
0.00837280, 0.00844949, 0.00852436, 0.00859730, 0.00866822,
0.00873701, 0.00880358, 0.00886781, 0.00892960, 0.00898884,
0.00904542, 0.00909923, 0.00915014, 0.00919805, 0.00924283, 0.00928436,
0.00932252, 0.00935718, 0.00938821, 0.00941550, 0.00943890,
0.00945828, 0.00947351, 0.00948446, 0.00949098, 0.00949294,
0.00949020, 0.00948262, 0.00947005, 0.00945235, 0.00942938, 0.00940099,
0.00936704, 0.00932738, 0.00928186, 0.00923034, 0.00917268,
0.00910872, 0.00903832, 0.00896134, 0.00887763, 0.00878706,
0.00868949, 0.00858478, 0.00847280, 0.00835343, 0.00822653, 0.00809199,
0.00794970, 0.00779956, 0.00764145, 0.00747530, 0.00730103,
0.00711857, 0.00692787, 0.00672888, 0.00652158, 0.00630597,
0.00608208, 0.00584994, 0.00560962, 0.00536124, 0.00510493, 0.00484089,
0.00456935, 0.00429062, 0.00400505, 0.00371310, 0.00341532,
0.00311238, 0.00280511, 0.00249452, 0.00218184, 0.00186864,
0.00155690, 0.00124918, 0.00094895, 0.00066112, 0.00039320, 0.00015881
};
double WebRtcIsac_LevDurb(double *a, double *k, double *r, int order)
{
double sum, alpha;
int m, m_h, i;
alpha = 0; //warning -DH
a[0] = 1.0;
if (r[0] < LEVINSON_EPS) { /* if r[0] <= 0, set LPC coeff. to zero */
for (i = 0; i < order; i++) {
k[i] = 0;
a[i+1] = 0;
}
} else {
a[1] = k[0] = -r[1]/r[0];
alpha = r[0] + r[1] * k[0];
for (m = 1; m < order; m++){
sum = r[m + 1];
for (i = 0; i < m; i++){
sum += a[i+1] * r[m - i];
}
k[m] = -sum / alpha;
alpha += k[m] * sum;
m_h = (m + 1) >> 1;
for (i = 0; i < m_h; i++){
sum = a[i+1] + k[m] * a[m - i];
a[m - i] += k[m] * a[i+1];
a[i+1] = sum;
}
a[m+1] = k[m];
}
}
return alpha;
}
//was static before, but didn't work with MEX file
void WebRtcIsac_GetVars(const double *input, const WebRtc_Word16 *pitchGains_Q12,
double *oldEnergy, double *varscale)
{
double nrg[4], chng, pg;
int k;
double pitchGains[4]={0,0,0,0};;
/* Calculate energies of first and second frame halfs */
nrg[0] = 0.0001;
for (k = QLOOKAHEAD/2; k < (FRAMESAMPLES_QUARTER + QLOOKAHEAD) / 2; k++) {
nrg[0] += input[k]*input[k];
}
nrg[1] = 0.0001;
for ( ; k < (FRAMESAMPLES_HALF + QLOOKAHEAD) / 2; k++) {
nrg[1] += input[k]*input[k];
}
nrg[2] = 0.0001;
for ( ; k < (FRAMESAMPLES*3/4 + QLOOKAHEAD) / 2; k++) {
nrg[2] += input[k]*input[k];
}
nrg[3] = 0.0001;
for ( ; k < (FRAMESAMPLES + QLOOKAHEAD) / 2; k++) {
nrg[3] += input[k]*input[k];
}
/* Calculate average level change */
chng = 0.25 * (fabs(10.0 * log10(nrg[3] / nrg[2])) +
fabs(10.0 * log10(nrg[2] / nrg[1])) +
fabs(10.0 * log10(nrg[1] / nrg[0])) +
fabs(10.0 * log10(nrg[0] / *oldEnergy)));
/* Find average pitch gain */
pg = 0.0;
for (k=0; k<4; k++)
{
pitchGains[k] = ((float)pitchGains_Q12[k])/4096;
pg += pitchGains[k];
}
pg *= 0.25;
/* If pitch gain is low and energy constant - increase noise level*/
/* Matlab code:
pg = 0:.01:.45; plot(pg, 0.0 + 1.0 * exp( -1.0 * exp(-200.0 * pg.*pg.*pg) / (1.0 + 0.4 * 0) ))
*/
*varscale = 0.0 + 1.0 * exp( -1.4 * exp(-200.0 * pg*pg*pg) / (1.0 + 0.4 * chng) );
*oldEnergy = nrg[3];
}
void
WebRtcIsac_GetVarsUB(
const double* input,
double* oldEnergy,
double* varscale)
{
double nrg[4], chng;
int k;
/* Calculate energies of first and second frame halfs */
nrg[0] = 0.0001;
for (k = 0; k < (FRAMESAMPLES_QUARTER) / 2; k++) {
nrg[0] += input[k]*input[k];
}
nrg[1] = 0.0001;
for ( ; k < (FRAMESAMPLES_HALF) / 2; k++) {
nrg[1] += input[k]*input[k];
}
nrg[2] = 0.0001;
for ( ; k < (FRAMESAMPLES*3/4) / 2; k++) {
nrg[2] += input[k]*input[k];
}
nrg[3] = 0.0001;
for ( ; k < (FRAMESAMPLES) / 2; k++) {
nrg[3] += input[k]*input[k];
}
/* Calculate average level change */
chng = 0.25 * (fabs(10.0 * log10(nrg[3] / nrg[2])) +
fabs(10.0 * log10(nrg[2] / nrg[1])) +
fabs(10.0 * log10(nrg[1] / nrg[0])) +
fabs(10.0 * log10(nrg[0] / *oldEnergy)));
/* If pitch gain is low and energy constant - increase noise level*/
/* Matlab code:
pg = 0:.01:.45; plot(pg, 0.0 + 1.0 * exp( -1.0 * exp(-200.0 * pg.*pg.*pg) / (1.0 + 0.4 * 0) ))
*/
*varscale = exp( -1.4 / (1.0 + 0.4 * chng) );
*oldEnergy = nrg[3];
}
void WebRtcIsac_GetLpcCoefLb(double *inLo, double *inHi, MaskFiltstr *maskdata,
double signal_noise_ratio, const WebRtc_Word16 *pitchGains_Q12,
double *lo_coeff, double *hi_coeff)
{
int k, n, j, pos1, pos2;
double varscale;
double DataLo[WINLEN], DataHi[WINLEN];
double corrlo[ORDERLO+2], corrlo2[ORDERLO+1];
double corrhi[ORDERHI+1];
double k_veclo[ORDERLO], k_vechi[ORDERHI];
double a_LO[ORDERLO+1], a_HI[ORDERHI+1];
double tmp, res_nrg;
double FwdA, FwdB;
/* hearing threshold level in dB; higher value gives more noise */
const double HearThresOffset = -28.0;
/* bandwdith expansion factors for low- and high band */
const double gammaLo = 0.9;
const double gammaHi = 0.8;
/* less-noise-at-low-frequencies factor */
double aa;
/* convert from dB to signal level */
const double H_T_H = pow(10.0, 0.05 * HearThresOffset);
double S_N_R = pow(10.0, 0.05 * signal_noise_ratio) / 3.46; /* divide by sqrt(12) */
/* change quallevel depending on pitch gains and level fluctuations */
WebRtcIsac_GetVars(inLo, pitchGains_Q12, &(maskdata->OldEnergy), &varscale);
/* less-noise-at-low-frequencies factor */
aa = 0.35 * (0.5 + 0.5 * varscale);
/* replace data in buffer by new look-ahead data */
for (pos1 = 0; pos1 < QLOOKAHEAD; pos1++)
maskdata->DataBufferLo[pos1 + WINLEN - QLOOKAHEAD] = inLo[pos1];
for (k = 0; k < SUBFRAMES; k++) {
/* Update input buffer and multiply signal with window */
for (pos1 = 0; pos1 < WINLEN - UPDATE/2; pos1++) {
maskdata->DataBufferLo[pos1] = maskdata->DataBufferLo[pos1 + UPDATE/2];
maskdata->DataBufferHi[pos1] = maskdata->DataBufferHi[pos1 + UPDATE/2];
DataLo[pos1] = maskdata->DataBufferLo[pos1] * kLpcCorrWindow[pos1];
DataHi[pos1] = maskdata->DataBufferHi[pos1] * kLpcCorrWindow[pos1];
}
pos2 = k * UPDATE/2;
for (n = 0; n < UPDATE/2; n++, pos1++) {
maskdata->DataBufferLo[pos1] = inLo[QLOOKAHEAD + pos2];
maskdata->DataBufferHi[pos1] = inHi[pos2++];
DataLo[pos1] = maskdata->DataBufferLo[pos1] * kLpcCorrWindow[pos1];
DataHi[pos1] = maskdata->DataBufferHi[pos1] * kLpcCorrWindow[pos1];
}
/* Get correlation coefficients */
WebRtcIsac_AutoCorr(corrlo, DataLo, WINLEN, ORDERLO+1); /* computing autocorrelation */
WebRtcIsac_AutoCorr(corrhi, DataHi, WINLEN, ORDERHI);
/* less noise for lower frequencies, by filtering/scaling autocorrelation sequences */
corrlo2[0] = (1.0+aa*aa) * corrlo[0] - 2.0*aa * corrlo[1];
tmp = (1.0 + aa*aa);
for (n = 1; n <= ORDERLO; n++) {
corrlo2[n] = tmp * corrlo[n] - aa * (corrlo[n-1] + corrlo[n+1]);
}
tmp = (1.0+aa) * (1.0+aa);
for (n = 0; n <= ORDERHI; n++) {
corrhi[n] = tmp * corrhi[n];
}
/* add white noise floor */
corrlo2[0] += 1e-6;
corrhi[0] += 1e-6;
FwdA = 0.01;
FwdB = 0.01;
/* recursive filtering of correlation over subframes */
for (n = 0; n <= ORDERLO; n++) {
maskdata->CorrBufLo[n] = FwdA * maskdata->CorrBufLo[n] + corrlo2[n];
corrlo2[n] = ((1.0-FwdA)*FwdB) * maskdata->CorrBufLo[n] + (1.0-FwdB) * corrlo2[n];
}
for (n = 0; n <= ORDERHI; n++) {
maskdata->CorrBufHi[n] = FwdA * maskdata->CorrBufHi[n] + corrhi[n];
corrhi[n] = ((1.0-FwdA)*FwdB) * maskdata->CorrBufHi[n] + (1.0-FwdB) * corrhi[n];
}
/* compute prediction coefficients */
WebRtcIsac_LevDurb(a_LO, k_veclo, corrlo2, ORDERLO);
WebRtcIsac_LevDurb(a_HI, k_vechi, corrhi, ORDERHI);
/* bandwidth expansion */
tmp = gammaLo;
for (n = 1; n <= ORDERLO; n++) {
a_LO[n] *= tmp;
tmp *= gammaLo;
}
/* residual energy */
res_nrg = 0.0;
for (j = 0; j <= ORDERLO; j++) {
for (n = 0; n <= j; n++) {
res_nrg += a_LO[j] * corrlo2[j-n] * a_LO[n];
}
for (n = j+1; n <= ORDERLO; n++) {
res_nrg += a_LO[j] * corrlo2[n-j] * a_LO[n];
}
}
/* add hearing threshold and compute the gain */
*lo_coeff++ = S_N_R / (sqrt(res_nrg) / varscale + H_T_H);
/* copy coefficients to output array */
for (n = 1; n <= ORDERLO; n++) {
*lo_coeff++ = a_LO[n];
}
/* bandwidth expansion */
tmp = gammaHi;
for (n = 1; n <= ORDERHI; n++) {
a_HI[n] *= tmp;
tmp *= gammaHi;
}
/* residual energy */
res_nrg = 0.0;
for (j = 0; j <= ORDERHI; j++) {
for (n = 0; n <= j; n++) {
res_nrg += a_HI[j] * corrhi[j-n] * a_HI[n];
}
for (n = j+1; n <= ORDERHI; n++) {
res_nrg += a_HI[j] * corrhi[n-j] * a_HI[n];
}
}
/* add hearing threshold and compute of the gain */
*hi_coeff++ = S_N_R / (sqrt(res_nrg) / varscale + H_T_H);
/* copy coefficients to output array */
for (n = 1; n <= ORDERHI; n++) {
*hi_coeff++ = a_HI[n];
}
}
}
/******************************************************************************
* WebRtcIsac_GetLpcCoefUb()
*
* Compute LP coefficients and correlation coefficients. At 12 kHz LP
* coefficients of the first and the last sub-frame is computed. At 16 kHz
* LP coefficients of 4th, 8th and 12th sub-frames are computed. We always
* compute correlation coefficients of all sub-frames.
*
* Inputs:
* -inSignal : Input signal
* -maskdata : a structure keeping signal from previous frame.
* -bandwidth : specifies if the codec is in 0-16 kHz mode or
* 0-12 kHz mode.
*
* Outputs:
* -lpCoeff : pointer to a buffer where A-polynomials are
* written to (first coeff is 1 and it is not
* written)
* -corrMat : a matrix where correlation coefficients of each
* sub-frame are written to one row.
* -varscale : a scale used to compute LPC gains.
*/
void
WebRtcIsac_GetLpcCoefUb(
double* inSignal,
MaskFiltstr* maskdata,
double* lpCoeff,
double corrMat[][UB_LPC_ORDER + 1],
double* varscale,
WebRtc_Word16 bandwidth)
{
int frameCntr, activeFrameCntr, n, pos1, pos2;
WebRtc_Word16 criterion1;
WebRtc_Word16 criterion2;
WebRtc_Word16 numSubFrames = SUBFRAMES * (1 + (bandwidth == isac16kHz));
double data[WINLEN];
double corrSubFrame[UB_LPC_ORDER+2];
double reflecCoeff[UB_LPC_ORDER];
double aPolynom[UB_LPC_ORDER+1];
double tmp;
/* bandwdith expansion factors */
const double gamma = 0.9;
/* change quallevel depending on pitch gains and level fluctuations */
WebRtcIsac_GetVarsUB(inSignal, &(maskdata->OldEnergy), varscale);
/* replace data in buffer by new look-ahead data */
for(frameCntr = 0, activeFrameCntr = 0; frameCntr < numSubFrames;
frameCntr++)
{
if(frameCntr == SUBFRAMES)
{
// we are in 16 kHz
varscale++;
WebRtcIsac_GetVarsUB(&inSignal[FRAMESAMPLES_HALF],
&(maskdata->OldEnergy), varscale);
}
/* Update input buffer and multiply signal with window */
for(pos1 = 0; pos1 < WINLEN - UPDATE/2; pos1++)
{
maskdata->DataBufferLo[pos1] = maskdata->DataBufferLo[pos1 +
UPDATE/2];
data[pos1] = maskdata->DataBufferLo[pos1] * kLpcCorrWindow[pos1];
}
pos2 = frameCntr * UPDATE/2;
for(n = 0; n < UPDATE/2; n++, pos1++, pos2++)
{
maskdata->DataBufferLo[pos1] = inSignal[pos2];
data[pos1] = maskdata->DataBufferLo[pos1] * kLpcCorrWindow[pos1];
}
/* Get correlation coefficients */
/* computing autocorrelation */
WebRtcIsac_AutoCorr(corrSubFrame, data, WINLEN, UB_LPC_ORDER+1);
memcpy(corrMat[frameCntr], corrSubFrame,
(UB_LPC_ORDER+1)*sizeof(double));
criterion1 = ((frameCntr == 0) || (frameCntr == (SUBFRAMES - 1))) &&
(bandwidth == isac12kHz);
criterion2 = (((frameCntr+1) % 4) == 0) &&
(bandwidth == isac16kHz);
if(criterion1 || criterion2)
{
/* add noise */
corrSubFrame[0] += 1e-6;
/* compute prediction coefficients */
WebRtcIsac_LevDurb(aPolynom, reflecCoeff, corrSubFrame,
UB_LPC_ORDER);
/* bandwidth expansion */
tmp = gamma;
for (n = 1; n <= UB_LPC_ORDER; n++)
{
*lpCoeff++ = aPolynom[n] * tmp;
tmp *= gamma;
}
activeFrameCntr++;
}
}
}
/******************************************************************************
* WebRtcIsac_GetLpcGain()
*
* Compute the LPC gains for each sub-frame, given the LPC of each sub-frame
* and the corresponding correlation coefficients.
*
* Inputs:
* -signal_noise_ratio : the desired SNR in dB.
* -numVecs : number of sub-frames
* -corrMat : a matrix of correlation coefficients where
* each row is a set of correlation coefficients of
* one sub-frame.
* -varscale : a scale computed when WebRtcIsac_GetLpcCoefUb()
* is called.
*
* Outputs:
* -gain : pointer to a buffer where LP gains are written.
*
*/
void
WebRtcIsac_GetLpcGain(
double signal_noise_ratio,
const double* filtCoeffVecs,
int numVecs,
double* gain,
double corrMat[][UB_LPC_ORDER + 1],
const double* varscale)
{
WebRtc_Word16 j, n;
WebRtc_Word16 subFrameCntr;
double aPolynom[ORDERLO + 1];
double res_nrg;
const double HearThresOffset = -28.0;
const double H_T_H = pow(10.0, 0.05 * HearThresOffset);
/* divide by sqrt(12) = 3.46 */
const double S_N_R = pow(10.0, 0.05 * signal_noise_ratio) / 3.46;
aPolynom[0] = 1;
for(subFrameCntr = 0; subFrameCntr < numVecs; subFrameCntr++)
{
if(subFrameCntr == SUBFRAMES)
{
// we are in second half of a SWB frame. use new varscale
varscale++;
}
memcpy(&aPolynom[1], &filtCoeffVecs[(subFrameCntr * (UB_LPC_ORDER + 1)) +
1], sizeof(double) * UB_LPC_ORDER);
/* residual energy */
res_nrg = 0.0;
for(j = 0; j <= UB_LPC_ORDER; j++)
{
for(n = 0; n <= j; n++)
{
res_nrg += aPolynom[j] * corrMat[subFrameCntr][j-n] *
aPolynom[n];
}
for(n = j+1; n <= UB_LPC_ORDER; n++)
{
res_nrg += aPolynom[j] * corrMat[subFrameCntr][n-j] *
aPolynom[n];
}
}
/* add hearing threshold and compute the gain */
gain[subFrameCntr] = S_N_R / (sqrt(res_nrg) / *varscale + H_T_H);
}
}

View File

@ -1,50 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* lpc_analysis.h
*
* LPC functions
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_ANALYSIS_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_ANALYSIS_H_
#include "settings.h"
#include "structs.h"
double WebRtcIsac_LevDurb(double *a, double *k, double *r, int order);
void WebRtcIsac_GetVars(const double *input, const WebRtc_Word16 *pitchGains_Q12,
double *oldEnergy, double *varscale);
void WebRtcIsac_GetLpcCoefLb(double *inLo, double *inHi, MaskFiltstr *maskdata,
double signal_noise_ratio, const WebRtc_Word16 *pitchGains_Q12,
double *lo_coeff, double *hi_coeff);
void WebRtcIsac_GetLpcGain(
double signal_noise_ratio,
const double* filtCoeffVecs,
int numVecs,
double* gain,
double corrLo[][UB_LPC_ORDER + 1],
const double* varscale);
void WebRtcIsac_GetLpcCoefUb(
double* inSignal,
MaskFiltstr* maskdata,
double* lpCoeff,
double corr[][UB_LPC_ORDER + 1],
double* varscale,
WebRtc_Word16 bandwidth);
#endif /* WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_ANALYIS_H_ */

View File

@ -1,137 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* SWB_KLT_Tables_LPCGain.c
*
* This file defines tables used for entropy coding of LPC Gain
* of upper-band.
*
*/
#include "lpc_gain_swb_tables.h"
#include "settings.h"
#include "typedefs.h"
const double WebRtcIsac_kQSizeLpcGain = 0.100000;
const double WebRtcIsac_kMeanLpcGain = -3.3822;
/*
* The smallest reconstruction points for quantiztion of
* LPC gains.
*/
const double WebRtcIsac_kLeftRecPointLpcGain[SUBFRAMES] =
{
-0.800000, -1.000000, -1.200000, -2.200000, -3.000000, -12.700000
};
/*
* Number of reconstruction points of quantizers for LPC Gains.
*/
const WebRtc_Word16 WebRtcIsac_kNumQCellLpcGain[SUBFRAMES] =
{
17, 20, 25, 45, 77, 170
};
/*
* Starting index for entropy decoder to search for the right interval,
* one entry per LAR coefficient
*/
const WebRtc_UWord16 WebRtcIsac_kLpcGainEntropySearch[SUBFRAMES] =
{
8, 10, 12, 22, 38, 85
};
/*
* The following 6 vectors define CDF of 6 decorrelated LPC
* gains.
*/
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec0[18] =
{
0, 10, 27, 83, 234, 568, 1601, 4683, 16830, 57534, 63437,
64767, 65229, 65408, 65483, 65514, 65527, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec1[21] =
{
0, 15, 33, 84, 185, 385, 807, 1619, 3529, 7850, 19488,
51365, 62437, 64548, 65088, 65304, 65409, 65484, 65507, 65522, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec2[26] =
{
0, 15, 29, 54, 89, 145, 228, 380, 652, 1493, 4260,
12359, 34133, 50749, 57224, 60814, 62927, 64078, 64742, 65103, 65311, 65418,
65473, 65509, 65521, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec3[46] =
{
0, 8, 12, 16, 26, 42, 56, 76, 111, 164, 247,
366, 508, 693, 1000, 1442, 2155, 3188, 4854, 7387, 11249, 17617,
30079, 46711, 56291, 60127, 62140, 63258, 63954, 64384, 64690, 64891, 65031,
65139, 65227, 65293, 65351, 65399, 65438, 65467, 65492, 65504, 65510, 65518,
65523, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec4[78] =
{
0, 17, 29, 39, 51, 70, 104, 154, 234, 324, 443,
590, 760, 971, 1202, 1494, 1845, 2274, 2797, 3366, 4088, 4905,
5899, 7142, 8683, 10625, 12983, 16095, 20637, 28216, 38859, 47237, 51537,
54150, 56066, 57583, 58756, 59685, 60458, 61103, 61659, 62144, 62550, 62886,
63186, 63480, 63743, 63954, 64148, 64320, 64467, 64600, 64719, 64837, 64939,
65014, 65098, 65160, 65211, 65250, 65290, 65325, 65344, 65366, 65391, 65410,
65430, 65447, 65460, 65474, 65487, 65494, 65501, 65509, 65513, 65518, 65520,
65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec5[171] =
{
0, 10, 12, 14, 16, 18, 23, 29, 35, 42, 51,
58, 65, 72, 78, 87, 96, 103, 111, 122, 134, 150,
167, 184, 202, 223, 244, 265, 289, 315, 346, 379, 414,
450, 491, 532, 572, 613, 656, 700, 751, 802, 853, 905,
957, 1021, 1098, 1174, 1250, 1331, 1413, 1490, 1565, 1647, 1730,
1821, 1913, 2004, 2100, 2207, 2314, 2420, 2532, 2652, 2783, 2921,
3056, 3189, 3327, 3468, 3640, 3817, 3993, 4171, 4362, 4554, 4751,
4948, 5142, 5346, 5566, 5799, 6044, 6301, 6565, 6852, 7150, 7470,
7797, 8143, 8492, 8835, 9181, 9547, 9919, 10315, 10718, 11136, 11566,
12015, 12482, 12967, 13458, 13953, 14432, 14903, 15416, 15936, 16452, 16967,
17492, 18024, 18600, 19173, 19736, 20311, 20911, 21490, 22041, 22597, 23157,
23768, 24405, 25034, 25660, 26280, 26899, 27614, 28331, 29015, 29702, 30403,
31107, 31817, 32566, 33381, 34224, 35099, 36112, 37222, 38375, 39549, 40801,
42074, 43350, 44626, 45982, 47354, 48860, 50361, 51845, 53312, 54739, 56026,
57116, 58104, 58996, 59842, 60658, 61488, 62324, 63057, 63769, 64285, 64779,
65076, 65344, 65430, 65500, 65517, 65535
};
/*
* An array of pointers to CDFs of decorrelated LPC Gains
*/
const WebRtc_UWord16* WebRtcIsac_kLpcGainCdfMat[SUBFRAMES] =
{
WebRtcIsac_kLpcGainCdfVec0, WebRtcIsac_kLpcGainCdfVec1,
WebRtcIsac_kLpcGainCdfVec2, WebRtcIsac_kLpcGainCdfVec3,
WebRtcIsac_kLpcGainCdfVec4, WebRtcIsac_kLpcGainCdfVec5
};
/*
* A matrix to decorrellate LPC gains of subframes.
*/
const double WebRtcIsac_kLpcGainDecorrMat[SUBFRAMES][SUBFRAMES] =
{
{-0.150860, 0.327872, 0.367220, 0.504613, 0.559270, 0.409234},
{ 0.457128, -0.613591, -0.289283, -0.029734, 0.393760, 0.418240},
{-0.626043, 0.136489, -0.439118, -0.448323, 0.135987, 0.420869},
{ 0.526617, 0.480187, 0.242552, -0.488754, -0.158713, 0.411331},
{-0.302587, -0.494953, 0.588112, -0.063035, -0.404290, 0.387510},
{ 0.086378, 0.147714, -0.428875, 0.548300, -0.570121, 0.401391}
};

View File

@ -1,49 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* SWB_KLT_Tables_LPCGain.h
*
* This file declares tables used for entropy coding of LPC Gain
* of upper-band.
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_GAIN_SWB_TABLES_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_GAIN_SWB_TABLES_H_
#include "settings.h"
#include "typedefs.h"
extern const double WebRtcIsac_kQSizeLpcGain;
extern const double WebRtcIsac_kLeftRecPointLpcGain[SUBFRAMES];
extern const WebRtc_Word16 WebRtcIsac_kNumQCellLpcGain[SUBFRAMES];
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainEntropySearch[SUBFRAMES];
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec0[18];
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec1[21];
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec2[26];
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec3[46];
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec4[78];
extern const WebRtc_UWord16 WebRtcIsac_kLpcGainCdfVec5[171];
extern const WebRtc_UWord16* WebRtcIsac_kLpcGainCdfMat[SUBFRAMES];
extern const double WebRtcIsac_kLpcGainDecorrMat[SUBFRAMES][SUBFRAMES];
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_GAIN_SWB_TABLES_H_

View File

@ -1,159 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* SWB_KLT_Tables.c
*
* This file defines tables used for entropy coding of LPC shape of
* upper-band signal if the bandwidth is 12 kHz.
*
*/
#include "lpc_shape_swb12_tables.h"
#include "settings.h"
#include "typedefs.h"
/*
* Mean value of LAR
*/
const double WebRtcIsac_kMeanLarUb12[UB_LPC_ORDER] =
{
0.03748928306641, 0.09453441192543, -0.01112522344398, 0.03800237516842
};
/*
* A rotation matrix to decorrelate intra-vector correlation,
* i.e. correlation among components of LAR vector.
*/
const double WebRtcIsac_kIntraVecDecorrMatUb12[UB_LPC_ORDER][UB_LPC_ORDER] =
{
{-0.00075365493856, -0.05809964887743, -0.23397966154116, 0.97050367376411},
{ 0.00625021257734, -0.17299965610679, 0.95977735920651, 0.22104179375008},
{ 0.20543384258374, -0.96202143495696, -0.15301870801552, -0.09432375099565},
{-0.97865075648479, -0.20300322280841, -0.02581111653779, -0.01913568980258}
};
/*
* A rotation matrix to remove correlation among LAR coefficients
* of different LAR vectors. One might guess that decorrelation matrix
* for the first component should differ from the second component
* but we haven't observed a significant benefit of having different
* decorrelation matrices for different components.
*/
const double WebRtcIsac_kInterVecDecorrMatUb12
[UB_LPC_VEC_PER_FRAME][UB_LPC_VEC_PER_FRAME] =
{
{ 0.70650597970460, -0.70770707262373},
{-0.70770707262373, -0.70650597970460}
};
/*
* LAR quantization step-size.
*/
const double WebRtcIsac_kLpcShapeQStepSizeUb12 = 0.150000;
/*
* The smallest reconstruction points for quantiztion of LAR coefficients.
*/
const double WebRtcIsac_kLpcShapeLeftRecPointUb12
[UB_LPC_ORDER*UB_LPC_VEC_PER_FRAME] =
{
-0.900000, -1.050000, -1.350000, -1.800000, -1.350000, -1.650000,
-2.250000, -3.450000
};
/*
* Number of reconstruction points of quantizers for LAR coefficients.
*/
const WebRtc_Word16 WebRtcIsac_kLpcShapeNumRecPointUb12
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME] =
{
13, 15, 19, 27, 19, 24, 32, 48
};
/*
* Starting index for entropy decoder to search for the right interval,
* one entry per LAR coefficient
*/
const WebRtc_UWord16 WebRtcIsac_kLpcShapeEntropySearchUb12
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME] =
{
6, 7, 9, 13, 9, 12, 16, 24
};
/*
* The following 8 vectors define CDF of 8 decorrelated LAR
* coefficients.
*/
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec0Ub12[14] =
{
0, 13, 95, 418, 1687, 6498, 21317, 44200, 59029, 63849, 65147,
65449, 65525, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec1Ub12[16] =
{
0, 10, 59, 255, 858, 2667, 8200, 22609, 42988, 57202, 62947,
64743, 65308, 65476, 65522, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec2Ub12[20] =
{
0, 18, 40, 118, 332, 857, 2017, 4822, 11321, 24330, 41279,
54342, 60637, 63394, 64659, 65184, 65398, 65482, 65518, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec3Ub12[28] =
{
0, 21, 38, 90, 196, 398, 770, 1400, 2589, 4650, 8211,
14933, 26044, 39592, 50814, 57452, 60971, 62884, 63995, 64621, 65019, 65273,
65410, 65480, 65514, 65522, 65531, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec4Ub12[20] =
{
0, 7, 46, 141, 403, 969, 2132, 4649, 10633, 24902, 43254,
54665, 59928, 62674, 64173, 64938, 65293, 65464, 65523, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec5Ub12[25] =
{
0, 7, 22, 72, 174, 411, 854, 1737, 3545, 6774, 13165,
25221, 40980, 52821, 58714, 61706, 63472, 64437, 64989, 65287, 65430, 65503,
65525, 65529, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec6Ub12[33] =
{
0, 11, 21, 36, 65, 128, 228, 401, 707, 1241, 2126,
3589, 6060, 10517, 18853, 31114, 42477, 49770, 54271, 57467, 59838, 61569,
62831, 63772, 64433, 64833, 65123, 65306, 65419, 65466, 65499, 65519, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec7Ub12[49] =
{
0, 14, 34, 67, 107, 167, 245, 326, 449, 645, 861,
1155, 1508, 2003, 2669, 3544, 4592, 5961, 7583, 9887, 13256, 18765,
26519, 34077, 40034, 44349, 47795, 50663, 53262, 55473, 57458, 59122, 60592,
61742, 62690, 63391, 63997, 64463, 64794, 65045, 65207, 65309, 65394, 65443,
65478, 65504, 65514, 65523, 65535
};
/*
* An array of pointers to CDFs of decorrelated LARs
*/
const WebRtc_UWord16* WebRtcIsac_kLpcShapeCdfMatUb12
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME] =
{
WebRtcIsac_kLpcShapeCdfVec0Ub12, WebRtcIsac_kLpcShapeCdfVec1Ub12,
WebRtcIsac_kLpcShapeCdfVec2Ub12, WebRtcIsac_kLpcShapeCdfVec3Ub12,
WebRtcIsac_kLpcShapeCdfVec4Ub12, WebRtcIsac_kLpcShapeCdfVec5Ub12,
WebRtcIsac_kLpcShapeCdfVec6Ub12, WebRtcIsac_kLpcShapeCdfVec7Ub12
};

View File

@ -1,65 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* lpc_shape_swb12_tables.h
*
* This file declares tables used for entropy coding of LPC shape of
* upper-band signal if the bandwidth is 12 kHz.
*
*/
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB12_TABLES_H_
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB12_TABLES_H_
#include "settings.h"
#include "typedefs.h"
extern const double WebRtcIsac_kMeanLarUb12[UB_LPC_ORDER];
extern const double WebRtcIsac_kMeanLpcGain;
extern const double WebRtcIsac_kIntraVecDecorrMatUb12[UB_LPC_ORDER][UB_LPC_ORDER];
extern const double WebRtcIsac_kInterVecDecorrMatUb12
[UB_LPC_VEC_PER_FRAME][UB_LPC_VEC_PER_FRAME];
extern const double WebRtcIsac_kLpcShapeQStepSizeUb12;
extern const double WebRtcIsac_kLpcShapeLeftRecPointUb12
[UB_LPC_ORDER*UB_LPC_VEC_PER_FRAME];
extern const WebRtc_Word16 WebRtcIsac_kLpcShapeNumRecPointUb12
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeEntropySearchUb12
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec0Ub12[14];
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec1Ub12[16];
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec2Ub12[20];
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec3Ub12[28];
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec4Ub12[20];
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec5Ub12[25];
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec6Ub12[33];
extern const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec7Ub12[49];
extern const WebRtc_UWord16* WebRtcIsac_kLpcShapeCdfMatUb12
[UB_LPC_ORDER * UB_LPC_VEC_PER_FRAME];
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ISAC_MAIN_SOURCE_LPC_SHAPE_SWB12_TABLES_H_

View File

@ -1,248 +0,0 @@
/*
* Copyright (c) 2011 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.
*/
/*
* SWB16_KLT_Tables.c
*
* This file defines tables used for entropy coding of LPC shape of
* upper-band signal if the bandwidth is 16 kHz.
*
*/
#include "lpc_shape_swb16_tables.h"
#include "settings.h"
#include "typedefs.h"
/*
* Mean value of LAR
*/
const double WebRtcIsac_kMeanLarUb16[UB_LPC_ORDER] =
{
0.454978, 0.364747, 0.102999, 0.104523
};
/*
* A rotation matrix to decorrelate intra-vector correlation,
* i.e. correlation among components of LAR vector.
*/
const double WebRtcIsac_kIintraVecDecorrMatUb16[UB_LPC_ORDER][UB_LPC_ORDER] =
{
{-0.020528, -0.085858, -0.002431, 0.996093},
{-0.033155, 0.036102, 0.998786, 0.004866},
{ 0.202627, 0.974853, -0.028940, 0.088132},
{-0.978479, 0.202454, -0.039785, -0.002811}
};
/*
* A rotation matrix to remove correlation among LAR coefficients
* of different LAR vectors. One might guess that decorrelation matrix
* for the first component should differ from the second component
* but we haven't observed a significant benefit of having different
* decorrelation matrices for different components.
*/
const double WebRtcIsac_kInterVecDecorrMatUb16
[UB16_LPC_VEC_PER_FRAME][UB16_LPC_VEC_PER_FRAME] =
{
{ 0.291675, -0.515786, 0.644927, 0.482658},
{-0.647220, 0.479712, 0.289556, 0.516856},
{ 0.643084, 0.485489, -0.289307, 0.516763},
{-0.287185, -0.517823, -0.645389, 0.482553}
};
/*
* The following 16 vectors define CDF of 16 decorrelated LAR
* coefficients.
*/
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub16[14] =
{
0, 2, 20, 159, 1034, 5688, 20892, 44653,
59849, 64485, 65383, 65518, 65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec1Ub16[16] =
{
0, 1, 7, 43, 276, 1496, 6681, 21653,
43891, 58859, 64022, 65248, 65489, 65529, 65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec2Ub16[18] =
{
0, 1, 9, 54, 238, 933, 3192, 9461,
23226, 42146, 56138, 62413, 64623, 65300, 65473, 65521,
65533, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec3Ub16[30] =
{
0, 2, 4, 8, 17, 36, 75, 155,
329, 683, 1376, 2662, 5047, 9508, 17526, 29027,
40363, 48997, 55096, 59180, 61789, 63407, 64400, 64967,
65273, 65429, 65497, 65526, 65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec4Ub16[16] =
{
0, 1, 10, 63, 361, 1785, 7407, 22242,
43337, 58125, 63729, 65181, 65472, 65527, 65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec5Ub16[17] =
{
0, 1, 7, 29, 134, 599, 2443, 8590,
22962, 42635, 56911, 63060, 64940, 65408, 65513, 65531,
65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec6Ub16[21] =
{
0, 1, 5, 16, 57, 191, 611, 1808,
4847, 11755, 24612, 40910, 53789, 60698, 63729, 64924,
65346, 65486, 65523, 65532, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec7Ub16[36] =
{
0, 1, 4, 12, 25, 55, 104, 184,
314, 539, 926, 1550, 2479, 3861, 5892, 8845,
13281, 20018, 29019, 38029, 45581, 51557, 56057, 59284,
61517, 63047, 64030, 64648, 65031, 65261, 65402, 65480,
65518, 65530, 65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec8Ub16[21] =
{
0, 1, 2, 7, 26, 103, 351, 1149,
3583, 10204, 23846, 41711, 55361, 61917, 64382, 65186,
65433, 65506, 65528, 65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub160[21] =
{
0, 6, 19, 63, 205, 638, 1799, 4784,
11721, 24494, 40803, 53805, 60886, 63822, 64931, 65333,
65472, 65517, 65530, 65533, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub161[28] =
{
0, 1, 3, 11, 31, 86, 221, 506,
1101, 2296, 4486, 8477, 15356, 26079, 38941, 49952,
57165, 61257, 63426, 64549, 65097, 65351, 65463, 65510,
65526, 65532, 65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub162[55] =
{
0, 3, 12, 23, 42, 65, 89, 115,
150, 195, 248, 327, 430, 580, 784, 1099,
1586, 2358, 3651, 5899, 9568, 14312, 19158, 23776,
28267, 32663, 36991, 41153, 45098, 48680, 51870, 54729,
57141, 59158, 60772, 62029, 63000, 63761, 64322, 64728,
65000, 65192, 65321, 65411, 65463, 65496, 65514, 65523,
65527, 65529, 65531, 65532, 65533, 65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub163[26] =
{
0, 2, 4, 10, 21, 48, 114, 280,
701, 1765, 4555, 11270, 24267, 41213, 54285, 61003,
63767, 64840, 65254, 65421, 65489, 65514, 65526, 65532,
65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub164[28] =
{
0, 1, 3, 6, 15, 36, 82, 196,
453, 1087, 2557, 5923, 13016, 25366, 40449, 52582,
59539, 62896, 64389, 65033, 65316, 65442, 65494, 65519,
65529, 65533, 65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub165[34] =
{
0, 2, 4, 8, 18, 35, 73, 146,
279, 524, 980, 1789, 3235, 5784, 10040, 16998,
27070, 38543, 48499, 55421, 59712, 62257, 63748, 64591,
65041, 65278, 65410, 65474, 65508, 65522, 65530, 65533,
65534, 65535
};
const WebRtc_UWord16 WebRtcIsac_kLpcShapeCdfVec01Ub166[71] =
{
0, 1, 2, 6, 13, 26, 55, 92,
141, 191, 242, 296, 355, 429, 522, 636,
777, 947, 1162, 1428, 1753, 2137, 2605, 3140,
3743, 4409, 5164, 6016, 6982, 8118, 9451, 10993,
12754, 14810, 17130, 19780, 22864, 26424, 30547, 35222,
40140, 44716, 48698, 52056, 54850, 57162, 59068, 60643,
61877, 62827, 63561, 64113, 64519, 64807, 65019, 65167,
65272, 65343, 65399, 65440, 65471, 65487, 65500, 65509,
65518, 65524, 65527, 65531, 65533, 65534, 65535
};
/*
* An array of pointers to CDFs of decorrelated LARs
*/
const WebRtc_UWord16* WebRtcIsac_kLpcShapeCdfMatUb16
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] = {
WebRtcIsac_kLpcShapeCdfVec01Ub16,
WebRtcIsac_kLpcShapeCdfVec1Ub16,
WebRtcIsac_kLpcShapeCdfVec2Ub16,
WebRtcIsac_kLpcShapeCdfVec3Ub16,
WebRtcIsac_kLpcShapeCdfVec4Ub16,
WebRtcIsac_kLpcShapeCdfVec5Ub16,
WebRtcIsac_kLpcShapeCdfVec6Ub16,
WebRtcIsac_kLpcShapeCdfVec7Ub16,
WebRtcIsac_kLpcShapeCdfVec8Ub16,
WebRtcIsac_kLpcShapeCdfVec01Ub160,
WebRtcIsac_kLpcShapeCdfVec01Ub161,
WebRtcIsac_kLpcShapeCdfVec01Ub162,
WebRtcIsac_kLpcShapeCdfVec01Ub163,
WebRtcIsac_kLpcShapeCdfVec01Ub164,
WebRtcIsac_kLpcShapeCdfVec01Ub165,
WebRtcIsac_kLpcShapeCdfVec01Ub166
};
/*
* The smallest reconstruction points for quantiztion of LAR coefficients.
*/
const double WebRtcIsac_kLpcShapeLeftRecPointUb16
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] =
{
-0.8250, -0.9750, -1.1250, -2.1750, -0.9750, -1.1250, -1.4250,
-2.6250, -1.4250, -1.2750, -1.8750, -3.6750, -1.7250, -1.8750,
-2.3250, -5.4750
};
/*
* Number of reconstruction points of quantizers for LAR coefficients.
*/
const WebRtc_Word16 WebRtcIsac_kLpcShapeNumRecPointUb16
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] =
{
13, 15, 17, 29, 15, 16, 20, 35, 20,
20, 27, 54, 25, 27, 33, 70
};
/*
* Starting index for entropy decoder to search for the right interval,
* one entry per LAR coefficient
*/
const WebRtc_UWord16 WebRtcIsac_kLpcShapeEntropySearchUb16
[UB_LPC_ORDER * UB16_LPC_VEC_PER_FRAME] =
{
6, 7, 8, 14, 7, 8, 10, 17, 10,
10, 13, 27, 12, 13, 16, 35
};
/*
* LAR quantization step-size.
*/
const double WebRtcIsac_kLpcShapeQStepSizeUb16 = 0.150000;

Some files were not shown because too many files have changed in this diff Show More