Merge branch 'master' of git@git.sangoma.com:smg_freeswitch
This commit is contained in:
commit
7c3fd20104
|
@ -1642,6 +1642,7 @@ Global
|
||||||
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.Build.0 = Release|Win32
|
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.Build.0 = Release|Win32
|
||||||
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64.ActiveCfg = Release|Win32
|
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64.ActiveCfg = Release|Win32
|
||||||
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
|
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
|
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.ActiveCfg = Debug|Win32
|
||||||
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.Build.0 = Debug|Win32
|
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.Build.0 = Debug|Win32
|
||||||
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.ActiveCfg = Release|Win32
|
{D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
@ -2047,6 +2048,7 @@ Global
|
||||||
{B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|Win32.Build.0 = Debug|Win32
|
{B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x64.ActiveCfg = Debug|Win32
|
{B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x64.ActiveCfg = Debug|Win32
|
||||||
{B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|Win32.ActiveCfg = Release|Win32
|
{B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|Win32.Build.0 = Release|Win32
|
||||||
{B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x64.ActiveCfg = Release|Win32
|
{B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x64.ActiveCfg = Release|Win32
|
||||||
{9778F1C0-09BC-4698-8EBC-BD982247209A}.All|Win32.ActiveCfg = Release|Win32
|
{9778F1C0-09BC-4698-8EBC-BD982247209A}.All|Win32.ActiveCfg = Release|Win32
|
||||||
{9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x64.ActiveCfg = Release|x64
|
{9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x64.ActiveCfg = Release|x64
|
||||||
|
|
|
@ -73,6 +73,8 @@ endpoints/mod_loopback
|
||||||
#event_handlers/mod_event_multicast
|
#event_handlers/mod_event_multicast
|
||||||
event_handlers/mod_event_socket
|
event_handlers/mod_event_socket
|
||||||
event_handlers/mod_cdr_csv
|
event_handlers/mod_cdr_csv
|
||||||
|
event_handlers/mod_cdr_sqlite
|
||||||
|
#event_handlers/mod_cdr_pg_csv
|
||||||
#event_handlers/mod_radius_cdr
|
#event_handlers/mod_radius_cdr
|
||||||
#event_handlers/mod_erlang_event
|
#event_handlers/mod_erlang_event
|
||||||
formats/mod_native_file
|
formats/mod_native_file
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
<configuration name="cdr_pg_csv.conf" description="CDR PG CSV Format">
|
<configuration name="cdr_pg_csv.conf" description="CDR PG CSV Format">
|
||||||
<settings>
|
<settings>
|
||||||
|
<!-- Log a-leg (a), b-leg (b) or both (ab) -->
|
||||||
|
<param name="legs" value="a"/>
|
||||||
|
<!-- See parameters for PQconnectdb() at http://www.postgresql.org/docs/8.4/static/libpq-connect.html -->
|
||||||
|
<param name="db-info" value="host=localhost dbname=cdr connect_timeout=10" />
|
||||||
|
<!-- CDR table name -->
|
||||||
|
<!--<param name="db-table" value="cdr"/>-->
|
||||||
|
<param name="default-template" value="example"/>
|
||||||
<!-- 'cdr-pg-csv' will always be appended to log-base -->
|
<!-- 'cdr-pg-csv' will always be appended to log-base -->
|
||||||
<!--<param name="log-base" value="/var/log"/>-->
|
<!--<param name="log-base" value="/var/log"/>-->
|
||||||
<param name="default-template" value="example"/>
|
<!-- Disk spool format if DB connection/insert fails - csv (default) or sql -->
|
||||||
|
<param name="spool-format" value="csv"/>
|
||||||
|
<param name="rotate-on-hup" value="true"/>
|
||||||
<!-- This is like the info app but after the call is hung up -->
|
<!-- This is like the info app but after the call is hung up -->
|
||||||
<!--<param name="debug" value="true"/>-->
|
<!--<param name="debug" value="true"/>-->
|
||||||
<param name="rotate-on-hup" value="true"/>
|
|
||||||
<!-- may be a b or ab -->
|
|
||||||
<param name="legs" value="a"/>
|
|
||||||
<param name="debug" value="true"/>
|
|
||||||
<!-- The parameters for pqconnectdb(), see there -->
|
|
||||||
<param name="db-info" value="host=localhost dbname=cdr connect_timeout=10" />
|
|
||||||
</settings>
|
</settings>
|
||||||
<templates>
|
<templates>
|
||||||
<template name="sql">INSERT INTO cdr VALUES ("${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}");</template>
|
|
||||||
<template name="example">"${local_ip_v4}","${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}","${sip_hangup_disposition}","${ani}"</template>
|
<template name="example">"${local_ip_v4}","${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}","${sip_hangup_disposition}","${ani}"</template>
|
||||||
<template name="snom">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}","${read_codec}","${write_codec}","${sip_user_agent}","${call_clientcode}","${sip_rtp_rxstat}","${sip_rtp_txstat}","${sofia_record_file}"</template>
|
|
||||||
<template name="linksys">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}","${sip_user_agent}","${sip_p_rtp_stat}"</template>
|
|
||||||
<template name="asterisk">"${accountcode}","${caller_id_number}","${destination_number}","${context}","${caller_id}","${channel_name}","${bridge_channel}","${last_app}","${last_arg}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${amaflags}","${uuid}","${userfield}"</template>
|
|
||||||
</templates>
|
</templates>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<configuration name="cdr_sqlite.conf" description="SQLite CDR">
|
||||||
|
<settings>
|
||||||
|
<!-- SQLite database name (.db suffix will be automatically appended) -->
|
||||||
|
<!-- <param name="db-name" value="cdr"/> -->
|
||||||
|
<!-- CDR table name -->
|
||||||
|
<!-- <param name="db-table" value="cdr"/> -->
|
||||||
|
<!-- Log a-leg (a), b-leg (b) or both (ab) -->
|
||||||
|
<param name="legs" value="a"/>
|
||||||
|
<!-- Default template to use when inserting records -->
|
||||||
|
<param name="default-template" value="example"/>
|
||||||
|
<!-- This is like the info app but after the call is hung up -->
|
||||||
|
<!--<param name="debug" value="true"/>-->
|
||||||
|
</settings>
|
||||||
|
<templates>
|
||||||
|
<!-- Note that field order must match SQL table schema, otherwise insert will fail -->
|
||||||
|
<template name="example">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}",${duration},${billsec},"${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}"</template>
|
||||||
|
</templates>
|
||||||
|
</configuration>
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
<!-- Event Handlers -->
|
<!-- Event Handlers -->
|
||||||
<load module="mod_cdr_csv"/>
|
<load module="mod_cdr_csv"/>
|
||||||
|
<!-- <load module="mod_cdr_sqlite"/> -->
|
||||||
<!-- <load module="mod_event_multicast"/> -->
|
<!-- <load module="mod_event_multicast"/> -->
|
||||||
<load module="mod_event_socket"/>
|
<load module="mod_event_socket"/>
|
||||||
<!-- <load module="mod_zeroconf"/> -->
|
<!-- <load module="mod_zeroconf"/> -->
|
||||||
|
|
|
@ -23,7 +23,13 @@
|
||||||
<settings>
|
<settings>
|
||||||
<!--Colorize the Console -->
|
<!--Colorize the Console -->
|
||||||
<param name="colorize-console" value="true"/>
|
<param name="colorize-console" value="true"/>
|
||||||
<!--Most channels to allow at once -->
|
<!--
|
||||||
|
Max number of sessions to allow at any given time.
|
||||||
|
|
||||||
|
NOTICE: If you're driving 28 T1's in a single box you should set this to 644*2 or 1288
|
||||||
|
this will ensure you're able to use the entire DS3 without a problem. Otherwise you'll
|
||||||
|
be 144 channels short of always filling that DS3 up which can translate into waste.
|
||||||
|
-->
|
||||||
<param name="max-sessions" value="1000"/>
|
<param name="max-sessions" value="1000"/>
|
||||||
<!--Most channels to create per second -->
|
<!--Most channels to create per second -->
|
||||||
<param name="sessions-per-second" value="30"/>
|
<param name="sessions-per-second" value="30"/>
|
||||||
|
|
|
@ -37,6 +37,7 @@ Content-Transfer-Encoding: 7bit
|
||||||
Created: ${voicemail_time}<br>
|
Created: ${voicemail_time}<br>
|
||||||
Duration: ${voicemail_message_len}<br>
|
Duration: ${voicemail_message_len}<br>
|
||||||
Account: ${voicemail_account}@${voicemail_domain}<br>
|
Account: ${voicemail_account}@${voicemail_domain}<br>
|
||||||
|
</font>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -37,6 +37,7 @@ Content-Transfer-Encoding: 7bit
|
||||||
Created: ${voicemail_time}<br>
|
Created: ${voicemail_time}<br>
|
||||||
Duration: ${voicemail_message_len}<br>
|
Duration: ${voicemail_message_len}<br>
|
||||||
Account: ${voicemail_account}@${voicemail_domain}<br>
|
Account: ${voicemail_account}@${voicemail_domain}<br>
|
||||||
|
</font>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
freeswitch (1.0.head~git.master.20101222.1-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* cleaning work
|
||||||
|
|
||||||
|
-- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 22 Dec 2010 22:48:02 +0200
|
||||||
|
|
||||||
freeswitch (1.0.head~git.master.20101015.1-1) unstable; urgency=low
|
freeswitch (1.0.head~git.master.20101015.1-1) unstable; urgency=low
|
||||||
|
|
||||||
* reintroduced mod_flite
|
* reintroduced mod_flite
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
freeswitch-sounds-en-us-callie (1.0.head-git.master,20101014.1-1) unstable; urgency=low
|
freeswitch-sounds-en-us-callie (1.0.14~git.master.20101222.1-1) unstable; urgency=low
|
||||||
|
|
||||||
* Change upstream package version numbering scheme for unreleased versions:
|
* Bumped up to 1.0.14 version
|
||||||
new format is major.minor.micro~git.branch.date.commits-1
|
* Clean ups
|
||||||
|
|
||||||
|
-- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 22 Dec 2010 22:55:02 +0200
|
||||||
|
|
||||||
|
freeswitch-sounds-en-us-callie (1.0.head~git.master.20101014.1-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Change upstream package version numbering scheme for unreleased versions: new format is major.minor.micro~git.branch.date.commits-1
|
||||||
* Change source format to 3.0 (quilt).
|
* Change source format to 3.0 (quilt).
|
||||||
* Upgrade debhelper compatibility to version 7.
|
* Upgrade debhelper compatibility to version 7.
|
||||||
|
|
||||||
-- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 14 Oct 2010 05:05:02 +0200
|
-- Michal Bielicki <michal.bielicki@seventhsignal.de> Fri, 14 Oct 2010 05:05:02 +0200
|
||||||
|
|
||||||
freeswitch-sounds-en-us-callie (1.0.12-0ubuntu1) jaunty; urgency=low
|
freeswitch-sounds-en-us-callie (1.0.12-0ubuntu1) jaunty; urgency=low
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
freeswitch-sounds-en-us-callie-8000_1.0.12-0ubuntu1_all.deb net extra
|
|
||||||
freeswitch-sounds-en-us-callie-16000_1.0.12-0ubuntu1_all.deb net extra
|
|
||||||
freeswitch-sounds-en-us-callie-32000_1.0.12-0ubuntu1_all.deb net extra
|
|
||||||
freeswitch-sounds-en-us-callie-48000_1.0.12-0ubuntu1_all.deb net extra
|
|
||||||
freeswitch-sounds-en-us-callie_1.0.12-0ubuntu1_all.deb net extra
|
|
||||||
freeswitch-sounds-en-us-callie-omega_1.0.12-0ubuntu1_all.deb net extra
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
freeswitch-sounds-music (1.0.8~git.master.20101222.1-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Clean ups
|
||||||
|
|
||||||
|
-- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 22 Dec 2010 22:55:02 +0200
|
||||||
|
|
||||||
freeswitch-sounds-music (1.0.head-git.master,20101014.1-1) unstable; urgency=low
|
freeswitch-sounds-music (1.0.head-git.master,20101014.1-1) unstable; urgency=low
|
||||||
|
|
||||||
* Change upstream package version numbering scheme for unreleased versions:
|
* Change upstream package version numbering scheme for unreleased versions:
|
||||||
|
@ -5,7 +11,7 @@ freeswitch-sounds-music (1.0.head-git.master,20101014.1-1) unstable; urgency=low
|
||||||
* Change source format to 3.0 (quilt).
|
* Change source format to 3.0 (quilt).
|
||||||
* Upgrade debhelper compatibility to version 7.
|
* Upgrade debhelper compatibility to version 7.
|
||||||
|
|
||||||
-- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 14 Oct 2010 05:05:02 +0200
|
-- Michal Bielicki <michal.bielicki@seventhsignal.de> Fri, 14 Oct 2010 05:05:02 +0200
|
||||||
|
|
||||||
freeswitch-sounds-music (1.0.8-0ubuntu3) jaunty; urgency=low
|
freeswitch-sounds-music (1.0.8-0ubuntu3) jaunty; urgency=low
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
freeswitch-sounds-music-8000_1.0.8-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-music-16000_1.0.8-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-music-32000_1.0.8-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-music-48000_1.0.8-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-music_1.0.8-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-music-omega_1.0.8-0ubuntu3_all.deb net extra
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
freeswitch-sounds-ru-ru-elena (1.0.8~git.master.20101222.1-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Clean ups
|
||||||
|
|
||||||
|
-- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 22 Dec 2010 22:55:02 +0200
|
||||||
|
|
||||||
freeswitch-sounds-ru-ru-elena (1.0.head-git.master,20101014.1-1) unstable; urgency=low
|
freeswitch-sounds-ru-ru-elena (1.0.head-git.master,20101014.1-1) unstable; urgency=low
|
||||||
|
|
||||||
* Change upstream package version numbering scheme for unreleased versions:
|
* Change upstream package version numbering scheme for unreleased versions:
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
freeswitch-sounds-ru-ru-elena-8000_1.0.12-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-ru-ru-elena-16000_1.0.12-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-ru-ru-elena-32000_1.0.12-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-ru-ru-elena-48000_1.0.12-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-ru-ru-elena_1.0.12-0ubuntu3_all.deb net extra
|
|
||||||
freeswitch-sounds-ru-ru-elena-omega_1.0.12-0ubuntu3_all.deb net extra
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
sounds_en_us_callie="freeswitch-sounds-en-us-callie-48000-1.0.12.tar.gz"
|
sounds_en_us_callie="freeswitch-sounds-en-us-callie-48000-1.0.14.tar.gz"
|
||||||
sounds_music="freeswitch-sounds-music-48000-1.0.8.tar.gz"
|
sounds_music="freeswitch-sounds-music-48000-1.0.8.tar.gz"
|
||||||
sounds_ru_RU_elena="freeswitch-sounds-ru-RU-elena-48000-1.0.12.tar.gz"
|
sounds_ru_RU_elena="freeswitch-sounds-ru-RU-elena-48000-1.0.12.tar.gz"
|
||||||
|
|
||||||
|
@ -27,4 +27,4 @@ if [ ! -f $sounds_ru_RU_elena ]
|
||||||
wget http://files.freeswitch.org/$sounds_ru_RU_elena
|
wget http://files.freeswitch.org/$sounds_ru_RU_elena
|
||||||
fi
|
fi
|
||||||
tar zxvf $sounds_ru_RU_elena
|
tar zxvf $sounds_ru_RU_elena
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
@ -80,7 +80,6 @@ freeswitch (1.0.7)
|
||||||
core: change channel app_flags to be realm specific and default old version to use __FILE__ as the realm name to avoid cross fire between apps using app flags (r:09c1815c)
|
core: change channel app_flags to be realm specific and default old version to use __FILE__ as the realm name to avoid cross fire between apps using app flags (r:09c1815c)
|
||||||
core: preanswer before getting variables to avoid crash (r:25fe16df)
|
core: preanswer before getting variables to avoid crash (r:25fe16df)
|
||||||
core: Windows: Don't report "unknown command" on console when empty command has been given (r:c8f9fb56/FSCORE-641)
|
core: Windows: Don't report "unknown command" on console when empty command has been given (r:c8f9fb56/FSCORE-641)
|
||||||
embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612)
|
|
||||||
core: Windows: Add start parameter -monotonic-clock, replaces build flag WIN32_MONOTONIC (r:3515c7a0/FSCORE-643)
|
core: Windows: Add start parameter -monotonic-clock, replaces build flag WIN32_MONOTONIC (r:3515c7a0/FSCORE-643)
|
||||||
core: Improve RTP timing on playback of files (r:d6d7773c/FSCORE-639)
|
core: Improve RTP timing on playback of files (r:d6d7773c/FSCORE-639)
|
||||||
core: Allows bind_meta_app to use chars other than * (r:fd254766/FSCORE-630)
|
core: Allows bind_meta_app to use chars other than * (r:fd254766/FSCORE-630)
|
||||||
|
@ -156,7 +155,19 @@ freeswitch (1.0.7)
|
||||||
core: normalize tests for outbound channels to use switch_channel_direction instead of testing for CF_OUTBOUND (r:93cc3dc5)
|
core: normalize tests for outbound channels to use switch_channel_direction instead of testing for CF_OUTBOUND (r:93cc3dc5)
|
||||||
core: add CF_DIALPLAN (r:3ff07445)
|
core: add CF_DIALPLAN (r:3ff07445)
|
||||||
core: tweak on calle[re] id (r:9db4a826)
|
core: tweak on calle[re] id (r:9db4a826)
|
||||||
|
core: cid logic changes for calle[re] (r:8f452bc5)
|
||||||
|
core: change switch_strip_spaces to specify if you want it to dup the string or destroy the current buffer (r:4d7e4f1e)
|
||||||
|
core: fix secondary issue with min_digits = 0 and terminator key pressed to cancel (r:fe005bdd/FS-2789)
|
||||||
|
core: fix dtmf issue with jb on (r:90e58696)
|
||||||
|
core: fix ignore_early_media=ring_ready (r:5b752c54)
|
||||||
|
core: prevent race on execute_on_answer called from the B-leg of a call (r:751e0291)
|
||||||
|
core: drop rtp frame that was already replaced with a cng frame (r:34a0ca50)
|
||||||
|
core: fix partial match counting as exact match in dmachine (r:5eb951aa)
|
||||||
|
core: try to adjust the timer to be ok with the horrible 10000 microsecond kernel resolution on amazon ec3 but that doesn't mean it's not horribly wrong to run the kernel that slow (r:903b2901)
|
||||||
|
embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612)
|
||||||
|
embedded languages: add insertFile front end to switch_ivr_insert_file and reswig (r:c4e350ab)
|
||||||
lang: Improve French phrase files (FSCONFIG-23)
|
lang: Improve French phrase files (FSCONFIG-23)
|
||||||
|
lang: Update langs - Add pt_PT, update es to have es_ES and es_MX, update mod_say_es and add mod_say_pt (FS-2937) (r:c81a9448/FS-2937)
|
||||||
libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738)
|
libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738)
|
||||||
libdingaling: fix race on shutdown causing crash (FSMOD-47)
|
libdingaling: fix race on shutdown causing crash (FSMOD-47)
|
||||||
libdingaling: Fix crash in new GV interface when exceeding 24 calls (r:be00609a/FS-2171)
|
libdingaling: Fix crash in new GV interface when exceeding 24 calls (r:be00609a/FS-2171)
|
||||||
|
@ -176,9 +187,11 @@ freeswitch (1.0.7)
|
||||||
libesl: allow fs_cli -x to have args up to 1024 chars (was 256) (r:7039ba47)
|
libesl: allow fs_cli -x to have args up to 1024 chars (was 256) (r:7039ba47)
|
||||||
libesl: Make last_event pointer last longer (r:a15f51d5/ESL-37)
|
libesl: Make last_event pointer last longer (r:a15f51d5/ESL-37)
|
||||||
libesl: use a packet buffer for ESL (r:2081bf97)
|
libesl: use a packet buffer for ESL (r:2081bf97)
|
||||||
|
libesl: Noevent/Noevents disparity (r:d29d83d7/ESL-53)
|
||||||
libfreetdm: implemented freetdm config nodes and ss7 initial configuration
|
libfreetdm: implemented freetdm config nodes and ss7 initial configuration
|
||||||
libfreetdm: fix codec for CAS signaling (r:b76e7f18)
|
libfreetdm: fix codec for CAS signaling (r:b76e7f18)
|
||||||
libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c)
|
libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c)
|
||||||
|
libg7221: A bunch of tweaks to the G.722.1 codec (r:5d548570)
|
||||||
libgnutls: link to libgcrypt as well, please report any platforms this breaks, but it should be portable (r:c569fb0f/FS-1248)
|
libgnutls: link to libgcrypt as well, please report any platforms this breaks, but it should be portable (r:c569fb0f/FS-1248)
|
||||||
libopenzap: Add CLI tracing
|
libopenzap: Add CLI tracing
|
||||||
libs: Merged OpenZAP and FreeTDM into the FreeSWITCH tree.
|
libs: Merged OpenZAP and FreeTDM into the FreeSWITCH tree.
|
||||||
|
@ -216,6 +229,8 @@ freeswitch (1.0.7)
|
||||||
mod_callcenter: Fix bad return type so it compile on archlinux, thx bougyman (r:3a475986)
|
mod_callcenter: Fix bad return type so it compile on archlinux, thx bougyman (r:3a475986)
|
||||||
mod_callcenter: Make callcenter_config agent get return the value of the item requested. Also added queue param max-wait-time-with-no-agent-time-reached: If the max-wai-time-with-no-agent is already reached for the queue, then new caller can wait for x amount of second before it kicked out of the queue rather than get rejected automatically. (r:81a03869)
|
mod_callcenter: Make callcenter_config agent get return the value of the item requested. Also added queue param max-wait-time-with-no-agent-time-reached: If the max-wai-time-with-no-agent is already reached for the queue, then new caller can wait for x amount of second before it kicked out of the queue rather than get rejected automatically. (r:81a03869)
|
||||||
mod_callcenter: Add new event socket agent-offering. Plus some documentation and better handling of bad agent type -- FS-2869 (r:80174cf3/FS-2869)
|
mod_callcenter: Add new event socket agent-offering. Plus some documentation and better handling of bad agent type -- FS-2869 (r:80174cf3/FS-2869)
|
||||||
|
mod_cdr_sqlite: initial commit (r:f625fe3b)
|
||||||
|
mod_cdr_sqlite: config file for mod_cdr_sqlite (r:25bc8fe3)
|
||||||
mod_cidlookup: null xml is bad (r:095815f8)
|
mod_cidlookup: null xml is bad (r:095815f8)
|
||||||
mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53)
|
mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53)
|
||||||
mod_commands: make break uuid_break and add cascade flag
|
mod_commands: make break uuid_break and add cascade flag
|
||||||
|
@ -235,6 +250,8 @@ freeswitch (1.0.7)
|
||||||
mod_commands: FS-2210 Add support for auto completion for uuid_simplify (r:72bcc01b/FS-2210)
|
mod_commands: FS-2210 Add support for auto completion for uuid_simplify (r:72bcc01b/FS-2210)
|
||||||
mod_commands: allow epoch in strftime_tz (r:bbf1cd1f)
|
mod_commands: allow epoch in strftime_tz (r:bbf1cd1f)
|
||||||
mod_commands: Dramatic jitterbuffer changes (r:d5470961)
|
mod_commands: Dramatic jitterbuffer changes (r:d5470961)
|
||||||
|
mod_commands: add uuid_buglist to fetch the current media-bugs attached to a given session uuid (r:f6eab64c)
|
||||||
|
mod_commands: add recovery_refresh app and api and use it in mod_conference to send a message to the channel telling it to sync its recovery snapshot (r:650393fb)
|
||||||
mod_conference: Fix reporting of volume up/down (MODAPP-419)
|
mod_conference: Fix reporting of volume up/down (MODAPP-419)
|
||||||
mod_conference: add last talking time per member to conference xml list
|
mod_conference: add last talking time per member to conference xml list
|
||||||
mod_conference: add terminate-on-silence conference param
|
mod_conference: add terminate-on-silence conference param
|
||||||
|
@ -245,6 +262,9 @@ freeswitch (1.0.7)
|
||||||
mod_conference: refactor conference to use switch_ivr_dmachine for the digit parsing controls are now bound to each member separately based on conference_controls channel var, then the caller-controls param in the profile or a default to "default" (r:ac19f73c)
|
mod_conference: refactor conference to use switch_ivr_dmachine for the digit parsing controls are now bound to each member separately based on conference_controls channel var, then the caller-controls param in the profile or a default to "default" (r:ac19f73c)
|
||||||
mod_conference: Fix crash on dtmf action (r:4d5389bd/FS-2781)
|
mod_conference: Fix crash on dtmf action (r:4d5389bd/FS-2781)
|
||||||
mod_conference: revert to the last transfered conference on recover (r:d11c83b1)
|
mod_conference: revert to the last transfered conference on recover (r:d11c83b1)
|
||||||
|
mod_conference: Add a chan var conference_enter_sound to override conference enter-sound param on the profile (r:651acc62)
|
||||||
|
mod_conference: Add an unique id to the conference obj so that we can track conferences. (r:479f3de2)
|
||||||
|
mod_conference: Fix corrupted audio when playing "you are now (un)muted..." (r:10257c7d/FS-2768)
|
||||||
mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69)
|
mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69)
|
||||||
mod_db: fix stack corruption (MODAPP-407)
|
mod_db: fix stack corruption (MODAPP-407)
|
||||||
mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13)
|
mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13)
|
||||||
|
@ -280,6 +300,7 @@ freeswitch (1.0.7)
|
||||||
mod_fifo: fix fifo race in use count dec (r:402e383b)
|
mod_fifo: fix fifo race in use count dec (r:402e383b)
|
||||||
mod_fifo: add outbound_ring_timeout param to mod_fifo (r:3885eea7)
|
mod_fifo: add outbound_ring_timeout param to mod_fifo (r:3885eea7)
|
||||||
mod_fifo: add default_lag to fifo (r:dd4fb5be)
|
mod_fifo: add default_lag to fifo (r:dd4fb5be)
|
||||||
|
mod_fifo: Fix crash when using fifo_destroy_after_use (r:ee562c82/FS-2879)
|
||||||
mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls
|
mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls
|
||||||
mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900)
|
mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900)
|
||||||
mod_freetdm: export and import boost custom data (r:edb2d582)
|
mod_freetdm: export and import boost custom data (r:edb2d582)
|
||||||
|
@ -357,6 +378,7 @@ freeswitch (1.0.7)
|
||||||
mod_lua: Add switch_core_sqldb functionality from inside Lua script (r:26f2e095/FS-1384)
|
mod_lua: Add switch_core_sqldb functionality from inside Lua script (r:26f2e095/FS-1384)
|
||||||
mod_lua: Made 2nd arg to freeswitch.Dbh:query (cb func) optional (r:87db11af)
|
mod_lua: Made 2nd arg to freeswitch.Dbh:query (cb func) optional (r:87db11af)
|
||||||
mod_lua: Added SAF_ROUTING_EXEC flag to lua app, so it can be run inline (r:7d5ca1c0)
|
mod_lua: Added SAF_ROUTING_EXEC flag to lua app, so it can be run inline (r:7d5ca1c0)
|
||||||
|
mod_lua: spelling error in -ERR return code encounterd -> encountered (r:86e7cdc5/FS-2949)
|
||||||
mod_managed: Added wrapper for switch_event_bind for .net (r:a5f07a80/MODLANG-165)
|
mod_managed: Added wrapper for switch_event_bind for .net (r:a5f07a80/MODLANG-165)
|
||||||
mod_managed: add additional support (r:5be58aac)
|
mod_managed: add additional support (r:5be58aac)
|
||||||
mod_managed: add mono 2.8 patch file see FS-2774 (r:6a948bd9/FS-2774)
|
mod_managed: add mono 2.8 patch file see FS-2774 (r:6a948bd9/FS-2774)
|
||||||
|
@ -417,6 +439,7 @@ freeswitch (1.0.7)
|
||||||
mod_skypopen: making XEvents to works when EARLYMEDIA, and correctly manage threads death
|
mod_skypopen: making XEvents to works when EARLYMEDIA, and correctly manage threads death
|
||||||
mod_skypopen: now answer a call only when directed to do it (before was trying to answer any incoming call). Lot of changes to a messy part, so maybe some problem will come out... (r:45c6c4d3)
|
mod_skypopen: now answer a call only when directed to do it (before was trying to answer any incoming call). Lot of changes to a messy part, so maybe some problem will come out... (r:45c6c4d3)
|
||||||
mod_skypopen: ignore early media sent by channels to be bridged before our channel is answered (r:ef14b78a)
|
mod_skypopen: ignore early media sent by channels to be bridged before our channel is answered (r:ef14b78a)
|
||||||
|
mod_snapshot: fix bad codepaths in mod_snapshot (r:844ac220)
|
||||||
mod_sndfile: Add support for .alaw and .ulaw to mod_sndfile (r:facf09b8/MODFORM-41)
|
mod_sndfile: Add support for .alaw and .ulaw to mod_sndfile (r:facf09b8/MODFORM-41)
|
||||||
mod_sndfile: return break in mod_sndfile when seek returns failure (r:564dc7e4)
|
mod_sndfile: return break in mod_sndfile when seek returns failure (r:564dc7e4)
|
||||||
mod_sofia: Send SIP MESSAGE to unregistered users by prefixing sip: to user@domain
|
mod_sofia: Send SIP MESSAGE to unregistered users by prefixing sip: to user@domain
|
||||||
|
@ -521,6 +544,10 @@ freeswitch (1.0.7)
|
||||||
mod_sofia: remove check for va_list completely in sofia since i don't even think it happens ever (r:dfecc914)
|
mod_sofia: remove check for va_list completely in sofia since i don't even think it happens ever (r:dfecc914)
|
||||||
mod_sofia: have mod_sofia always elect to be the session refresher so we know it will work, also make the session-expires set to 0 imply 100% disabled session timers (r:321013ef)
|
mod_sofia: have mod_sofia always elect to be the session refresher so we know it will work, also make the session-expires set to 0 imply 100% disabled session timers (r:321013ef)
|
||||||
mod_sofia: Do not set nat mode when the device's network_ip is within the acl also so if your FS is behind nat and your phone is too then it will still make the right decisions (r:6c6eab8c)
|
mod_sofia: Do not set nat mode when the device's network_ip is within the acl also so if your FS is behind nat and your phone is too then it will still make the right decisions (r:6c6eab8c)
|
||||||
|
mod_sofia: prevent race on codec change mid-call (r:668763f4)
|
||||||
|
mod_sofia: improve fail2ban logging (r:f4d52d4c/FS-2943)
|
||||||
|
mod_sofia: refactor sofia_contact to try the profile_name first then the domain to resolve the profile then fall back to querying every profile to reduce confusion with multi-homers (d'oh) also special profile name * will force a search-all situation (r:81608da0)
|
||||||
|
mod_sofia: support allowing pidf-ful presence clients to share the same account and 'appear offline' without influencing each other =/ also refactor the contact generation string based on nat into a helper function (r:97a68c50)
|
||||||
mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8)
|
mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8)
|
||||||
mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642)
|
mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642)
|
||||||
mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45)
|
mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45)
|
||||||
|
|
|
@ -379,7 +379,7 @@ ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_loopback ../../libs/fre
|
||||||
# Event Handlers
|
# Event Handlers
|
||||||
#
|
#
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_event_socket event_handlers/mod_event_multicast"
|
EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_cdr_sqlite event_handlers/mod_event_socket event_handlers/mod_event_multicast"
|
||||||
######################################################################################################################
|
######################################################################################################################
|
||||||
#
|
#
|
||||||
# File and Audio Format Handlers
|
# File and Audio Format Handlers
|
||||||
|
@ -620,6 +620,7 @@ fi
|
||||||
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/callcenter.conf.xml
|
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/callcenter.conf.xml
|
||||||
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_csv.conf.xml
|
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_csv.conf.xml
|
||||||
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_pg_csv.conf.xml
|
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_pg_csv.conf.xml
|
||||||
|
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_sqlite.conf.xml
|
||||||
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cidlookup.conf.xml
|
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cidlookup.conf.xml
|
||||||
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/conference.conf.xml
|
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/conference.conf.xml
|
||||||
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/console.conf.xml
|
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/console.conf.xml
|
||||||
|
@ -746,6 +747,7 @@ fi
|
||||||
%{prefix}/mod/mod_bv.so*
|
%{prefix}/mod/mod_bv.so*
|
||||||
%{prefix}/mod/mod_callcenter.so*
|
%{prefix}/mod/mod_callcenter.so*
|
||||||
%{prefix}/mod/mod_cdr_csv.so*
|
%{prefix}/mod/mod_cdr_csv.so*
|
||||||
|
%{prefix}/mod/mod_cdr_sqlite.so*
|
||||||
%{prefix}/mod/mod_celt.so*
|
%{prefix}/mod/mod_celt.so*
|
||||||
%{prefix}/mod/mod_cidlookup.so*
|
%{prefix}/mod/mod_cidlookup.so*
|
||||||
%{prefix}/mod/mod_cluechoo.so*
|
%{prefix}/mod/mod_cluechoo.so*
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||||
|
# Visual Studio 2008
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ESL", "esl_lua.2008.vcproj", "{86B6AB99-A261-455A-9CD6-9142A5A1652E}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Win32 = Debug|Win32
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Release|Win32 = Release|Win32
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
{86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
|
{86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
|
{86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|Win32.Build.0 = Release|Win32
|
||||||
|
{86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|x64.Build.0 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
|
@ -0,0 +1,351 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<VisualStudioProject
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="9.00"
|
||||||
|
Name="ESL"
|
||||||
|
ProjectGUID="{86B6AB99-A261-455A-9CD6-9142A5A1652E}"
|
||||||
|
RootNamespace="esl_lua.2008"
|
||||||
|
Keyword="Win32Proj"
|
||||||
|
TargetFrameworkVersion="0"
|
||||||
|
>
|
||||||
|
<Platforms>
|
||||||
|
<Platform
|
||||||
|
Name="Win32"
|
||||||
|
/>
|
||||||
|
<Platform
|
||||||
|
Name="x64"
|
||||||
|
/>
|
||||||
|
</Platforms>
|
||||||
|
<ToolFiles>
|
||||||
|
</ToolFiles>
|
||||||
|
<Configurations>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|Win32"
|
||||||
|
OutputDirectory="Debug"
|
||||||
|
IntermediateDirectory="Debug"
|
||||||
|
ConfigurationType="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\";"$(ProjectDir)..\src\include""
|
||||||
|
PreprocessorDefinitions="ESL_DECLARE_STATIC;WIN32"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="4"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="esl.lib lua5.1.lib ws2_32.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
AdditionalLibraryDirectories=""$(ProjectDir)..\..\..\$(ConfigurationName)";"$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\$(ConfigurationName)""
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|Win32"
|
||||||
|
OutputDirectory="Release"
|
||||||
|
IntermediateDirectory="Release"
|
||||||
|
ConfigurationType="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\";"$(ProjectDir)..\src\include""
|
||||||
|
PreprocessorDefinitions="ESL_DECLARE_STATIC;WIN32"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="esl.lib lua5.1.lib ws2_32.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
AdditionalLibraryDirectories=""$(ProjectDir)..\..\..\$(ConfigurationName)";"$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\$(ConfigurationName)""
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Debug|x64"
|
||||||
|
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
TargetEnvironment="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="0"
|
||||||
|
AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\";"$(ProjectDir)..\src\include""
|
||||||
|
PreprocessorDefinitions="ESL_DECLARE_STATIC;WIN32"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
RuntimeLibrary="3"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="esl.lib lua5.1.lib ws2_32.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
AdditionalLibraryDirectories=""$(ProjectDir)..\..\..\$(PlatformName)\$(ConfigurationName)";"$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\$(PlatformName)\$(ConfigurationName)""
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
TargetMachine="17"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
<Configuration
|
||||||
|
Name="Release|x64"
|
||||||
|
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||||
|
ConfigurationType="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreBuildEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCustomBuildTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXMLDataGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCWebServiceProxyGeneratorTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
TargetEnvironment="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\";"$(ProjectDir)..\src\include""
|
||||||
|
PreprocessorDefinitions="ESL_DECLARE_STATIC;WIN32"
|
||||||
|
RuntimeLibrary="2"
|
||||||
|
UsePrecompiledHeader="0"
|
||||||
|
WarningLevel="3"
|
||||||
|
Detect64BitPortabilityProblems="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManagedResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPreLinkEventTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
AdditionalDependencies="esl.lib lua5.1.lib ws2_32.lib"
|
||||||
|
LinkIncremental="2"
|
||||||
|
AdditionalLibraryDirectories=""$(ProjectDir)..\..\..\$(PlatformName)\$(ConfigurationName)";"$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\$(PlatformName)\$(ConfigurationName)""
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
SubSystem="2"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
TargetMachine="17"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCALinkTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCFxCopTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCAppVerifierTool"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCPostBuildEventTool"
|
||||||
|
/>
|
||||||
|
</Configuration>
|
||||||
|
</Configurations>
|
||||||
|
<References>
|
||||||
|
</References>
|
||||||
|
<Files>
|
||||||
|
<Filter
|
||||||
|
Name="Header Files"
|
||||||
|
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||||
|
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Resource Files"
|
||||||
|
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||||
|
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||||
|
>
|
||||||
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Source Files"
|
||||||
|
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||||
|
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="..\src\esl_oop.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\esl_wrap.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
|
</Files>
|
||||||
|
<Globals>
|
||||||
|
</Globals>
|
||||||
|
</VisualStudioProject>
|
|
@ -40,7 +40,8 @@ sub set_callback($;$$) {
|
||||||
$self->{_callback}->{$event} = shift;
|
$self->{_callback}->{$event} = shift;
|
||||||
my $subclass = shift;
|
my $subclass = shift;
|
||||||
if($subclass) {
|
if($subclass) {
|
||||||
$self->{_custom_subclass} = split(/,/, $subclass);
|
my @subclasses = split(/,/, $subclass);
|
||||||
|
$self->{_custom_subclass} = \@subclasses;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ sub run($;) {
|
||||||
for(;;) {
|
for(;;) {
|
||||||
# Only register for events we have callbacks for.
|
# Only register for events we have callbacks for.
|
||||||
for my $key ( keys %{$self->{_callback}} ) {
|
for my $key ( keys %{$self->{_callback}} ) {
|
||||||
if ($key eq "CUSTOM") {
|
if ($key =~ m/custom/i) {
|
||||||
foreach $subclass (@{$self->{_custom_subclass}}) {
|
foreach $subclass (@{$self->{_custom_subclass}}) {
|
||||||
$self->{_esl}->events("plain", "$key $subclass");
|
$self->{_esl}->events("plain", "$key $subclass");
|
||||||
}
|
}
|
||||||
|
|
|
@ -733,11 +733,28 @@ static void ftdm_span_add(ftdm_span_t *span)
|
||||||
|
|
||||||
FT_DECLARE(ftdm_status_t) ftdm_span_stop(ftdm_span_t *span)
|
FT_DECLARE(ftdm_status_t) ftdm_span_stop(ftdm_span_t *span)
|
||||||
{
|
{
|
||||||
ftdm_status_t status = FTDM_FAIL;
|
ftdm_status_t status = FTDM_SUCCESS;
|
||||||
if (span->stop) {
|
|
||||||
status = span->stop(span);
|
ftdm_mutex_lock(span->mutex);
|
||||||
span->stop = NULL;
|
|
||||||
|
if (!ftdm_test_flag(span, FTDM_SPAN_STARTED)) {
|
||||||
|
status = FTDM_EINVAL;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!span->stop) {
|
||||||
|
status = FTDM_ENOSYS;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = span->stop(span);
|
||||||
|
if (FTDM_SUCCESS == status) {
|
||||||
|
ftdm_clear_flag(span, FTDM_SPAN_STARTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
ftdm_mutex_unlock(span->mutex);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5063,11 +5080,28 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const
|
||||||
|
|
||||||
FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span)
|
FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span)
|
||||||
{
|
{
|
||||||
if (span->start) {
|
ftdm_status_t status = FTDM_FAIL;
|
||||||
return span->start(span);
|
|
||||||
|
ftdm_mutex_lock(span->mutex);
|
||||||
|
|
||||||
|
if (ftdm_test_flag(span, FTDM_SPAN_STARTED)) {
|
||||||
|
status = FTDM_EINVAL;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FTDM_FAIL;
|
if (!span->start) {
|
||||||
|
status = FTDM_ENOSYS;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
status = span->start(span);
|
||||||
|
if (status == FTDM_SUCCESS) {
|
||||||
|
ftdm_set_flag_locked(span, FTDM_SPAN_STARTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
ftdm_mutex_unlock(span->mutex);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
FT_DECLARE(ftdm_status_t) ftdm_channel_add_to_group(const char* name, ftdm_channel_t* ftdmchan)
|
FT_DECLARE(ftdm_status_t) ftdm_channel_add_to_group(const char* name, ftdm_channel_t* ftdmchan)
|
||||||
|
|
|
@ -168,7 +168,7 @@ typedef enum {
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FTDM_SPAN_CONFIGURED = (1 << 0),
|
FTDM_SPAN_CONFIGURED = (1 << 0),
|
||||||
FTDM_SPAN_READY = (1 << 1),
|
FTDM_SPAN_STARTED = (1 << 1),
|
||||||
FTDM_SPAN_STATE_CHANGE = (1 << 2),
|
FTDM_SPAN_STATE_CHANGE = (1 << 2),
|
||||||
FTDM_SPAN_SUSPENDED = (1 << 3),
|
FTDM_SPAN_SUSPENDED = (1 << 3),
|
||||||
FTDM_SPAN_IN_THREAD = (1 << 4),
|
FTDM_SPAN_IN_THREAD = (1 << 4),
|
||||||
|
|
|
@ -84,7 +84,7 @@ AC_ARG_ENABLE(64,
|
||||||
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
|
if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
|
||||||
if test "${enable_64}" = "yes"; then
|
if test "${enable_64}" = "yes"; then
|
||||||
CFLAGS="$CFLAGS -m64"
|
CFLAGS="$CFLAGS -m64"
|
||||||
CXXFLAGS="$CXXFLAGS -m64"
|
CXXFLAGS="$CXXFLAGS -m64 -lgpg-error"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
##
|
|
||||||
## $Id: Makefile.am,v 1.6 2008/09/30 14:06:39 steveu Exp $
|
|
||||||
|
|
||||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||||
|
@ -26,6 +24,7 @@ noinst_SCRIPTS = g722_1.spec
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
EXTRA_DIST = autogen.sh \
|
EXTRA_DIST = autogen.sh \
|
||||||
|
g722_1.pc \
|
||||||
g722_1.spec \
|
g722_1.spec \
|
||||||
unpack_g722_1_data.sh \
|
unpack_g722_1_data.sh \
|
||||||
wrapper.xsl \
|
wrapper.xsl \
|
||||||
|
@ -50,6 +49,9 @@ SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTS)
|
||||||
|
|
||||||
DIST_SUBDIRS = src doc tests test-data
|
DIST_SUBDIRS = src doc tests test-data
|
||||||
|
|
||||||
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
pkgconfig_DATA = g722_1.pc
|
||||||
|
|
||||||
faq: faq.xml
|
faq: faq.xml
|
||||||
cd faq ; xsltproc ../wrapper.xsl ../faq.xml
|
cd faq ; xsltproc ../wrapper.xsl ../faq.xml
|
||||||
|
|
||||||
|
|
|
@ -16,11 +16,6 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
#
|
|
||||||
# $Id: autogen.sh,v 1.1.1.1 2008/09/20 09:47:17 steveu Exp $
|
|
||||||
#
|
|
||||||
|
|
||||||
UNAME=`uname`
|
|
||||||
|
|
||||||
if [ "x$UNAME" = "xFreeBSD" ]; then
|
if [ "x$UNAME" = "xFreeBSD" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
@ -15,17 +15,11 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
#
|
|
||||||
# $Id: configure.ac,v 1.9 2008/10/09 14:17:12 steveu Exp $
|
|
||||||
|
|
||||||
# @start 1
|
# @start 1
|
||||||
|
|
||||||
AC_INIT
|
AC_INIT
|
||||||
|
|
||||||
CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
|
|
||||||
CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
|
|
||||||
|
|
||||||
m4_include(config/ax_compiler_vendor.m4)
|
m4_include(config/ax_compiler_vendor.m4)
|
||||||
m4_include(config/ax_check_real_file.m4)
|
m4_include(config/ax_check_real_file.m4)
|
||||||
m4_include(config/ax_fixed_point_machine.m4)
|
m4_include(config/ax_fixed_point_machine.m4)
|
||||||
|
@ -111,6 +105,22 @@ else
|
||||||
CXXFLAGS=${CXXFLAGS-"-g -O2"}
|
CXXFLAGS=${CXXFLAGS-"-g -O2"}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_DEFUN([REMOVE_FROM_VAR],[
|
||||||
|
new_val=""
|
||||||
|
removed=0
|
||||||
|
for i in $$1; do
|
||||||
|
if test "x$i" != "x$2"; then
|
||||||
|
new_val="$new_val $i"
|
||||||
|
else
|
||||||
|
removed=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if test $removed = "1"; then
|
||||||
|
echo " removed \"$2\" from $1"
|
||||||
|
$1=$new_val
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_C_INLINE
|
AC_C_INLINE
|
||||||
AC_C_VOLATILE
|
AC_C_VOLATILE
|
||||||
|
@ -190,7 +200,7 @@ AC_CHECK_HEADERS([audiofile.h])
|
||||||
|
|
||||||
AC_LANG([C])
|
AC_LANG([C])
|
||||||
|
|
||||||
if test "${build}" = "${host}"
|
if test "${build}" == "${host}"
|
||||||
then
|
then
|
||||||
case "${host}" in
|
case "${host}" in
|
||||||
x86_64-*)
|
x86_64-*)
|
||||||
|
@ -270,6 +280,7 @@ sun)
|
||||||
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
|
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
|
||||||
fi
|
fi
|
||||||
COMP_VENDOR_LDFLAGS=
|
COMP_VENDOR_LDFLAGS=
|
||||||
|
REMOVE_FROM_VAR(CFLAGS, -Xc)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
|
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
|
||||||
|
@ -293,20 +304,14 @@ AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes])
|
||||||
if test "$enable_fixed_point" = "yes" ; then
|
if test "$enable_fixed_point" = "yes" ; then
|
||||||
AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
|
AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
|
||||||
G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1"
|
G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1"
|
||||||
fixed = "yes"
|
|
||||||
G722_1_VECTORS_FOR_TESTS="fixed"
|
G722_1_VECTORS_FOR_TESTS="fixed"
|
||||||
else
|
else
|
||||||
AX_FIXED_POINT_MACHINE([$host],
|
AX_FIXED_POINT_MACHINE([$host],
|
||||||
[
|
[AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
|
||||||
AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
|
G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1"],
|
||||||
G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1"
|
|
||||||
fixed = "yes"
|
|
||||||
],
|
|
||||||
[G722_1_USE_FIXED_POINT="#undef G722_1_USE_FIXED_POINT"])
|
[G722_1_USE_FIXED_POINT="#undef G722_1_USE_FIXED_POINT"])
|
||||||
G722_1_VECTORS_FOR_TESTS="floating"
|
G722_1_VECTORS_FOR_TESTS="floating"
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([COND_FIXED], [test "$fixed" = "yes"])
|
|
||||||
|
|
||||||
AX_MISALIGNED_ACCESS_FAILS([$host],
|
AX_MISALIGNED_ACCESS_FAILS([$host],
|
||||||
[AC_DEFINE([G722_1_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly])
|
[AC_DEFINE([G722_1_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly])
|
||||||
G722_1_MISALIGNED_ACCESS_FAILS="#define G722_1_MISALIGNED_ACCESS_FAILS 1"],
|
G722_1_MISALIGNED_ACCESS_FAILS="#define G722_1_MISALIGNED_ACCESS_FAILS 1"],
|
||||||
|
@ -363,6 +368,7 @@ AC_CONFIG_FILES([Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
src/g722_1.h
|
src/g722_1.h
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
|
g722_1.pc
|
||||||
g722_1.spec])
|
g722_1.spec])
|
||||||
|
|
||||||
AC_CONFIG_FILES([tests/regression_tests.sh], [chmod +x tests/regression_tests.sh])
|
AC_CONFIG_FILES([tests/regression_tests.sh], [chmod +x tests/regression_tests.sh])
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
##
|
|
||||||
## $Id: Makefile.am,v 1.1.1.1 2008/09/20 09:47:17 steveu Exp $
|
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
prefix=@prefix@
|
||||||
|
exec_prefix=@exec_prefix@
|
||||||
|
libdir=@libdir@
|
||||||
|
includedir=@includedir@
|
||||||
|
|
||||||
|
Name: spandsp
|
||||||
|
Description: A library for the ITU G.722.1 and G.722.1C audio codecs.
|
||||||
|
Requires:
|
||||||
|
Version: @VERSION@
|
||||||
|
Libs: -L${libdir} -lg722_1 -lm
|
||||||
|
Cflags: -I${includedir}
|
|
@ -47,14 +47,13 @@ rm -rf %{buildroot}
|
||||||
|
|
||||||
%{_libdir}/libg722_1.so.*
|
%{_libdir}/libg722_1.so.*
|
||||||
|
|
||||||
%{_datadir}/libg722_1
|
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%doc doc/api
|
%doc doc/api
|
||||||
%{_includedir}/g722_1.h
|
%{_includedir}/g722_1.h
|
||||||
%{_includedir}/g722_1
|
%{_includedir}/g722_1
|
||||||
%{_libdir}/libg722_1.so
|
%{_libdir}/libg722_1.so
|
||||||
|
%{_libdir}/pkgconfig/g722_1.pc
|
||||||
|
|
||||||
%post -p /sbin/ldconfig
|
%post -p /sbin/ldconfig
|
||||||
|
|
||||||
|
|
|
@ -15,18 +15,19 @@
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
##
|
|
||||||
## $Id: Makefile.am,v 1.10 2008/10/16 15:46:12 steveu Exp $
|
|
||||||
|
|
||||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = Makefile.in
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
EXTRA_DIST = g722_1/version.h.in \
|
EXTRA_DIST = make_tables.c \
|
||||||
|
g722_1/version.h.in \
|
||||||
libg722_1.dsp \
|
libg722_1.dsp \
|
||||||
libg722_1.sln \
|
libg722_1.2005.sln \
|
||||||
libg722_1.vcproj \
|
libg722_1.2008.sln \
|
||||||
|
libg722_1.2005.vcproj \
|
||||||
|
libg722_1.2008.vcproj \
|
||||||
msvc/gettimeofday.c \
|
msvc/gettimeofday.c \
|
||||||
msvc/inttypes.h \
|
msvc/inttypes.h \
|
||||||
msvc/tgmath.h \
|
msvc/tgmath.h \
|
||||||
|
@ -36,13 +37,16 @@ EXTRA_DIST = g722_1/version.h.in \
|
||||||
msvc/msvcproj.head \
|
msvc/msvcproj.head \
|
||||||
msvc/msvcproj.foot \
|
msvc/msvcproj.foot \
|
||||||
msvc/vc8proj.head \
|
msvc/vc8proj.head \
|
||||||
msvc/vc8proj.foot
|
msvc/vc8proj.foot \
|
||||||
|
msvc/vc9proj.head \
|
||||||
|
msvc/vc9proj.foot
|
||||||
|
|
||||||
INCLUDES = -I$(top_builddir)
|
INCLUDES = -I$(top_builddir)
|
||||||
|
|
||||||
lib_LTLIBRARIES = libg722_1.la
|
lib_LTLIBRARIES = libg722_1.la
|
||||||
|
|
||||||
libg722_1_la_SOURCES = bitstream.c \
|
libg722_1_la_SOURCES = basop32.c \
|
||||||
|
bitstream.c \
|
||||||
coef2sam.c \
|
coef2sam.c \
|
||||||
common.c \
|
common.c \
|
||||||
commonf.c \
|
commonf.c \
|
||||||
|
@ -55,11 +59,9 @@ libg722_1_la_SOURCES = bitstream.c \
|
||||||
encoderf.c \
|
encoderf.c \
|
||||||
huff_tab.c \
|
huff_tab.c \
|
||||||
sam2coef.c \
|
sam2coef.c \
|
||||||
tables.c
|
tables.c \
|
||||||
|
utilities.c
|
||||||
|
|
||||||
if COND_FIXED
|
|
||||||
libg722_1_la_SOURCES += basop32.c
|
|
||||||
endif
|
|
||||||
libg722_1_la_LDFLAGS = -version-info @G722_1_LT_CURRENT@:@G722_1_LT_REVISION@:@G722_1_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
|
libg722_1_la_LDFLAGS = -version-info @G722_1_LT_CURRENT@:@G722_1_LT_REVISION@:@G722_1_LT_AGE@ $(COMP_VENDOR_LDFLAGS)
|
||||||
|
|
||||||
nobase_include_HEADERS = g722_1/g722_1.h \
|
nobase_include_HEADERS = g722_1/g722_1.h \
|
||||||
|
@ -76,10 +78,10 @@ noinst_HEADERS = basop32.h \
|
||||||
defs.h \
|
defs.h \
|
||||||
huff_tab.h \
|
huff_tab.h \
|
||||||
sam2coef.h \
|
sam2coef.h \
|
||||||
tables.h
|
tables.h \
|
||||||
|
utilities.h
|
||||||
|
|
||||||
noinst_PROGRAMS = make_dct4_tables \
|
noinst_PROGRAMS = make_dct4_tables
|
||||||
make_tables
|
|
||||||
|
|
||||||
dct4.$(OBJEXT): dct4.h
|
dct4.$(OBJEXT): dct4.h
|
||||||
|
|
||||||
|
@ -88,6 +90,9 @@ dct4.lo: dct4.h
|
||||||
dct4.h: make_dct4_tables$(EXEEXT)
|
dct4.h: make_dct4_tables$(EXEEXT)
|
||||||
./make_dct4_tables$(EXEEXT) >dct4.h
|
./make_dct4_tables$(EXEEXT) >dct4.h
|
||||||
|
|
||||||
|
make_dct4_tables$(EXEEXT): $(top_srcdir)/src/make_dct4_tables.c
|
||||||
|
$(CC_FOR_BUILD) -o make_dct4_tables$(EXEEXT) $(top_srcdir)/src/make_dct4_tables.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm
|
||||||
|
|
||||||
#coef2sam.h: make_tables$(EXEEXT)
|
#coef2sam.h: make_tables$(EXEEXT)
|
||||||
# ./make_tables$(EXEEXT) coef2sam >coef2samx.h
|
# ./make_tables$(EXEEXT) coef2sam >coef2samx.h
|
||||||
|
|
||||||
|
@ -95,13 +100,15 @@ dct4.h: make_dct4_tables$(EXEEXT)
|
||||||
# ./make_tables$(EXEEXT) sam2coef >sam2coefx.h
|
# ./make_tables$(EXEEXT) sam2coef >sam2coefx.h
|
||||||
|
|
||||||
DSP = libg722_1.dsp
|
DSP = libg722_1.dsp
|
||||||
VCPROJ = libg722_1.vcproj
|
VCPROJ8 = libg722_1.2005.vcproj
|
||||||
|
VCPROJ9 = libg722_1.2008.vcproj
|
||||||
|
|
||||||
WIN32SOURCES = $(libg722_1_la_SOURCES) msvc/gettimeofday.c
|
WIN32SOURCES = $(libg722_1_la_SOURCES) msvc/gettimeofday.c
|
||||||
WIN32HEADERS = $(nobase_include_HEADERS) g722_1.h
|
WIN32HEADERS = $(nobase_include_HEADERS) g722_1.h
|
||||||
|
|
||||||
DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP)
|
DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP)
|
||||||
VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ)
|
VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8)
|
||||||
|
VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9)
|
||||||
|
|
||||||
$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
|
$(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
|
||||||
echo "creating $(DSP)"
|
echo "creating $(DSP)"
|
||||||
|
@ -124,26 +131,38 @@ $(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am
|
||||||
echo "# End Group" $(DSPOUT); \
|
echo "# End Group" $(DSPOUT); \
|
||||||
cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) )
|
cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) )
|
||||||
|
|
||||||
$(VCPROJ): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
|
$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am
|
||||||
echo "creating $(VCPROJ)"
|
echo "creating $(VCPROJ8)"
|
||||||
@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ); \
|
@(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \
|
||||||
for file in $(WIN32SOURCES); do \
|
for file in $(WIN32SOURCES); do \
|
||||||
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
|
myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \
|
||||||
|
echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT8); \
|
||||||
done; \
|
done; \
|
||||||
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT); \
|
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT8); \
|
||||||
for file in $(WIN32HEADERS); do \
|
for file in $(WIN32HEADERS); do \
|
||||||
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
|
myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \
|
||||||
|
echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT8); \
|
||||||
done; \
|
done; \
|
||||||
cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT) )
|
cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) )
|
||||||
|
|
||||||
|
$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am
|
||||||
|
echo "creating $(VCPROJ9)"
|
||||||
|
@(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \
|
||||||
|
for file in $(WIN32SOURCES); do \
|
||||||
|
myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \
|
||||||
|
echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT9); \
|
||||||
|
done; \
|
||||||
|
echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT9); \
|
||||||
|
for file in $(WIN32HEADERS); do \
|
||||||
|
myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \
|
||||||
|
echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT9); \
|
||||||
|
done; \
|
||||||
|
cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) )
|
||||||
|
|
||||||
|
dist-hook: g722_1/version.h
|
||||||
|
|
||||||
g722_1/version.h:
|
g722_1/version.h:
|
||||||
NOWDATE=`date --utc +"%Y%m%d"` ; \
|
NOWDATE=`date --utc +"%Y%m%d"` ; \
|
||||||
NOWTIME=`date --utc +"%H%M%S"` ; \
|
NOWTIME=`date --utc +"%H%M%S"` ; \
|
||||||
sed 's/$$G722_1_RELEASE_DATE/'$$NOWDATE'/;s/$$G722_1_RELEASE_TIME/'$$NOWTIME'/' \
|
sed 's/$$G722_1_RELEASE_DATE/'$$NOWDATE'/;s/$$G722_1_RELEASE_TIME/'$$NOWTIME'/' \
|
||||||
<g722_1/version.h.in >g722_1/version.h
|
<$(srcdir)/g722_1/version.h.in >$@
|
||||||
|
|
||||||
dist-hook:
|
|
||||||
NOWDATE=`date --utc +"%Y%m%d"` ; \
|
|
||||||
NOWTIME=`date --utc +"%H%M%S"` ; \
|
|
||||||
sed 's/$$G722_1_RELEASE_DATE/'$$NOWDATE'/;s/$$G722_1_RELEASE_TIME/'$$NOWTIME'/' \
|
|
||||||
<g722_1/version.h.in >g722_1/version.h
|
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: basop32.c,v 1.5 2008/09/22 13:08:31 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -19,9 +17,10 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#if defined(G722_1_USE_FIXED_POINT)
|
#if defined(G722_1_USE_FIXED_POINT)
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: basop32.h,v 1.3 2008/09/22 13:08:31 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(BASOP32_H_DEFINED)
|
#if !defined(BASOP32_H_DEFINED)
|
||||||
|
@ -104,14 +102,14 @@ static __inline__ int32_t L_mac(int32_t L_var3, int16_t var1, int16_t var2)
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
int16_t shl(int16_t var1, int16_t var2); /* Short shift left, 1 */
|
int16_t shl(int16_t var1, int16_t var2); /* Short shift left, 1 */
|
||||||
int16_t shr(int16_t var1, int16_t var2); /* Short shift right, 1 */
|
int16_t shr(int16_t var1, int16_t var2); /* Short shift right, 1 */
|
||||||
int32_t L_sub(int32_t L_var1, int32_t L_var2); /* Long sub, 2 */
|
int32_t L_sub(int32_t L_var1, int32_t L_var2); /* Long sub, 2 */
|
||||||
int32_t L_shl(int32_t L_var1, int16_t var2); /* Long shift left, 2 */
|
int32_t L_shl(int32_t L_var1, int16_t var2); /* Long shift left, 2 */
|
||||||
int32_t L_shr(int32_t L_var1, int16_t var2); /* Long shift right, 2*/
|
int32_t L_shr(int32_t L_var1, int16_t var2); /* Long shift right, 2 */
|
||||||
int16_t norm_s(int16_t var1); /* Short norm, 15 */
|
int16_t norm_s(int16_t var1); /* Short norm, 15 */
|
||||||
int16_t div_s(int16_t var1, int16_t var2); /* Short division, 18 */
|
int16_t div_s(int16_t var1, int16_t var2); /* Short division, 18 */
|
||||||
int16_t norm_l(int32_t L_var1); /* Long norm, 30 */
|
int16_t norm_l(int32_t L_var1); /* Long norm, 30 */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: bitstream.c,v 1.2 2008/10/17 13:18:21 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: bitstream.h,v 1.2 2008/10/17 13:18:21 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: coef2sam.c,v 1.10 2008/10/02 11:43:54 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -29,18 +27,16 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "coef2sam.h"
|
#include "coef2sam.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
/*************************************************************************************
|
/* Convert Reversed MLT (Modulated Lapped Transform) Coefficients to Samples
|
||||||
|
|
||||||
Purpose: Convert Reversed MLT (Modulated Lapped Transform) Coefficients to Samples
|
The "Reversed MLT" is an overlapped block transform which uses even symmetry
|
||||||
|
on the left, odd symmetry on the right and a Type IV DCT as the block transform.
|
||||||
The "Reversed MLT" is an overlapped block transform which uses even symmetry
|
It is thus similar to a MLT which uses odd symmetry on the left, even symmetry
|
||||||
on the left, odd symmetry on the right and a Type IV DCT as the block transform.
|
on the right and a Type IV DST as the block transform. In fact, it is equivalent
|
||||||
It is thus similar to a MLT which uses odd symmetry on the left, even symmetry
|
to reversing the order of the samples, performing an MLT and then negating all
|
||||||
on the right and a Type IV DST as the block transform. In fact, it is equivalent
|
the even-numbered coefficients. */
|
||||||
to reversing the order of the samples, performing an MLT and then negating all
|
|
||||||
the even-numbered coefficients.
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#if defined(G722_1_USE_FIXED_POINT)
|
#if defined(G722_1_USE_FIXED_POINT)
|
||||||
void rmlt_coefs_to_samples(int16_t coefs[],
|
void rmlt_coefs_to_samples(int16_t coefs[],
|
||||||
|
@ -73,29 +69,23 @@ void rmlt_coefs_to_samples(int16_t coefs[],
|
||||||
new_samples[i] = shl(new_samples[i], mag_shift);
|
new_samples[i] = shl(new_samples[i], mag_shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dct_length == DCT_LENGTH)
|
win = (dct_length == DCT_LENGTH) ? rmlt_to_samples_window : max_rmlt_to_samples_window;
|
||||||
win = rmlt_to_samples_window;
|
|
||||||
else
|
|
||||||
win = max_rmlt_to_samples_window;
|
|
||||||
last = half_dct_length - 1;
|
last = half_dct_length - 1;
|
||||||
for (i = 0; i < half_dct_length; i++)
|
for (i = 0; i < half_dct_length; i++)
|
||||||
{
|
{
|
||||||
/* Get the first half of the windowed samples */
|
/* Get the first half of the windowed samples */
|
||||||
sum = 0L;
|
sum = L_mult(win[i], new_samples[last - i]);
|
||||||
sum = L_mac(sum, win[i], new_samples[last - i]);
|
|
||||||
sum = L_mac(sum, win[dct_length - i - 1], old_samples[i]);
|
sum = L_mac(sum, win[dct_length - i - 1], old_samples[i]);
|
||||||
out_samples[i] = xround(L_shl(sum, 2));
|
out_samples[i] = xround(L_shl(sum, 2));
|
||||||
/* Get the second half of the windowed samples */
|
/* Get the second half of the windowed samples */
|
||||||
sum = 0L;
|
sum = L_mult(win[half_dct_length + i], new_samples[i]);
|
||||||
sum = L_mac(sum, win[half_dct_length + i], new_samples[i]);
|
|
||||||
sum = L_mac(sum, negate(win[last - i]), old_samples[last - i]);
|
sum = L_mac(sum, negate(win[last - i]), old_samples[last - i]);
|
||||||
out_samples[half_dct_length + i] = xround(L_shl(sum, 2));
|
out_samples[half_dct_length + i] = xround(L_shl(sum, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the second half of the new samples for
|
/* Save the second half of the new samples for
|
||||||
next time, when they will be the old samples. */
|
next time, when they will be the old samples. */
|
||||||
for (i = 0; i < half_dct_length; i++)
|
vec_copyi16(old_samples, &new_samples[half_dct_length], half_dct_length);
|
||||||
old_samples[i] = new_samples[half_dct_length + i];
|
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
#else
|
#else
|
||||||
|
@ -116,10 +106,7 @@ void rmlt_coefs_to_samples(float coefs[],
|
||||||
/* Perform a Type IV (inverse) DCT on the coefficients */
|
/* Perform a Type IV (inverse) DCT on the coefficients */
|
||||||
dct_type_iv(coefs, new_samples, dct_length);
|
dct_type_iv(coefs, new_samples, dct_length);
|
||||||
|
|
||||||
if (dct_length == DCT_LENGTH)
|
win = (dct_length == DCT_LENGTH) ? rmlt_to_samples_window : max_rmlt_to_samples_window;
|
||||||
win = rmlt_to_samples_window;
|
|
||||||
else
|
|
||||||
win = max_rmlt_to_samples_window;
|
|
||||||
last = half_dct_length - 1;
|
last = half_dct_length - 1;
|
||||||
for (i = 0; i < half_dct_length; i++)
|
for (i = 0; i < half_dct_length; i++)
|
||||||
{
|
{
|
||||||
|
@ -135,8 +122,7 @@ void rmlt_coefs_to_samples(float coefs[],
|
||||||
|
|
||||||
/* Save the second half of the new samples for next time, when they will
|
/* Save the second half of the new samples for next time, when they will
|
||||||
be the old samples. */
|
be the old samples. */
|
||||||
for (i = 0; i < half_dct_length; i++)
|
vec_copyf(old_samples, &new_samples[half_dct_length], half_dct_length);
|
||||||
old_samples[i] = new_samples[half_dct_length + i];
|
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: coef2sam.h,v 1.2 2008/10/02 11:43:54 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(G722_1_USE_FIXED_POINT)
|
#if defined(G722_1_USE_FIXED_POINT)
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: common.c,v 1.6 2008/09/30 14:06:39 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -38,41 +36,7 @@ static void compute_raw_pow_categories(int16_t *power_categories,
|
||||||
int16_t number_of_regions,
|
int16_t number_of_regions,
|
||||||
int16_t offset);
|
int16_t offset);
|
||||||
|
|
||||||
/****************************************************************************************
|
/* Compute a series of categorizations */
|
||||||
Function: categorize
|
|
||||||
|
|
||||||
Syntax: void categorize(int16_t number_of_available_bits,
|
|
||||||
int16_t number_of_regions,
|
|
||||||
int16_t num_categorization_control_possibilities,
|
|
||||||
int16_t rms_index,
|
|
||||||
int16_t power_categories,
|
|
||||||
int16_t category_balances)
|
|
||||||
|
|
||||||
inputs: number_of_regions
|
|
||||||
num_categorization_control_possibilities
|
|
||||||
number_of_available_bits
|
|
||||||
rms_index[MAX_NUMBER_OF_REGIONS]
|
|
||||||
|
|
||||||
outputs: power_categories[MAX_NUMBER_OF_REGIONS]
|
|
||||||
category_balances[MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES-1]
|
|
||||||
|
|
||||||
Description: Computes a series of categorizations
|
|
||||||
|
|
||||||
WMOPS: 7kHz | 24kbit | 32kbit
|
|
||||||
-------|--------------|----------------
|
|
||||||
AVG | 0.14 | 0.14
|
|
||||||
-------|--------------|----------------
|
|
||||||
MAX | 0.15 | 0.15
|
|
||||||
-------|--------------|----------------
|
|
||||||
|
|
||||||
14kHz | 24kbit | 32kbit | 48kbit
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
AVG | 0.42 | 0.45 | 0.48
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
MAX | 0.47 | 0.52 | 0.52
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
|
|
||||||
****************************************************************************************/
|
|
||||||
void categorize(int16_t number_of_available_bits,
|
void categorize(int16_t number_of_available_bits,
|
||||||
int16_t number_of_regions,
|
int16_t number_of_regions,
|
||||||
int16_t num_categorization_control_possibilities,
|
int16_t num_categorization_control_possibilities,
|
||||||
|
@ -88,10 +52,7 @@ void categorize(int16_t number_of_available_bits,
|
||||||
/* At higher bit rates, there is an increase for most categories in average bit
|
/* At higher bit rates, there is an increase for most categories in average bit
|
||||||
consumption per region. We compensate for this by pretending we have fewer
|
consumption per region. We compensate for this by pretending we have fewer
|
||||||
available bits. */
|
available bits. */
|
||||||
if (number_of_regions == NUMBER_OF_REGIONS)
|
frame_size = (number_of_regions == NUMBER_OF_REGIONS) ? DCT_LENGTH : MAX_DCT_LENGTH;
|
||||||
frame_size = DCT_LENGTH;
|
|
||||||
else
|
|
||||||
frame_size = MAX_DCT_LENGTH;
|
|
||||||
|
|
||||||
temp = sub(number_of_available_bits, frame_size);
|
temp = sub(number_of_available_bits, frame_size);
|
||||||
if (temp > 0)
|
if (temp > 0)
|
||||||
|
@ -114,45 +75,7 @@ void categorize(int16_t number_of_available_bits,
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
/***************************************************************************
|
/* Compute the power_categories and the category balances */
|
||||||
Function: comp_powercat_and_catbalance
|
|
||||||
|
|
||||||
Syntax: void comp_powercat_and_catbalance(int16_t *power_categories,
|
|
||||||
int16_t *category_balances,
|
|
||||||
int16_t *rms_index,
|
|
||||||
int16_t number_of_available_bits,
|
|
||||||
int16_t number_of_regions,
|
|
||||||
int16_t num_categorization_control_possibilities,
|
|
||||||
int16_t offset)
|
|
||||||
|
|
||||||
|
|
||||||
inputs: *rms_index
|
|
||||||
number_of_available_bits
|
|
||||||
number_of_regions
|
|
||||||
num_categorization_control_possibilities
|
|
||||||
offset
|
|
||||||
|
|
||||||
outputs: *power_categories
|
|
||||||
*category_balances
|
|
||||||
|
|
||||||
|
|
||||||
Description: Computes the power_categories and the category balances
|
|
||||||
|
|
||||||
WMOPS: 7kHz | 24kbit | 32kbit
|
|
||||||
-------|--------------|----------------
|
|
||||||
AVG | 0.10 | 0.10
|
|
||||||
-------|--------------|----------------
|
|
||||||
MAX | 0.11 | 0.11
|
|
||||||
-------|--------------|----------------
|
|
||||||
|
|
||||||
14kHz | 24kbit | 32kbit | 48kbit
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
AVG | 0.32 | 0.35 | 0.38
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
MAX | 0.38 | 0.42 | 0.43
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
|
|
||||||
***************************************************************************/
|
|
||||||
void comp_powercat_and_catbalance(int16_t *power_categories,
|
void comp_powercat_and_catbalance(int16_t *power_categories,
|
||||||
int16_t *category_balances,
|
int16_t *category_balances,
|
||||||
int16_t *rms_index,
|
int16_t *rms_index,
|
||||||
|
@ -161,7 +84,6 @@ void comp_powercat_and_catbalance(int16_t *power_categories,
|
||||||
int16_t num_categorization_control_possibilities,
|
int16_t num_categorization_control_possibilities,
|
||||||
int16_t offset)
|
int16_t offset)
|
||||||
{
|
{
|
||||||
|
|
||||||
int16_t expected_number_of_code_bits;
|
int16_t expected_number_of_code_bits;
|
||||||
int16_t region;
|
int16_t region;
|
||||||
int16_t max_region;
|
int16_t max_region;
|
||||||
|
@ -190,7 +112,6 @@ void comp_powercat_and_catbalance(int16_t *power_categories,
|
||||||
for (region = 0; region < number_of_regions; region++)
|
for (region = 0; region < number_of_regions; region++)
|
||||||
expected_number_of_code_bits = add(expected_number_of_code_bits, expected_bits_table[power_categories[region]]);
|
expected_number_of_code_bits = add(expected_number_of_code_bits, expected_bits_table[power_categories[region]]);
|
||||||
|
|
||||||
|
|
||||||
for (region = 0; region < number_of_regions; region++)
|
for (region = 0; region < number_of_regions; region++)
|
||||||
{
|
{
|
||||||
max_rate_categories[region] = power_categories[region];
|
max_rate_categories[region] = power_categories[region];
|
||||||
|
@ -277,42 +198,16 @@ void comp_powercat_and_catbalance(int16_t *power_categories,
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
/***************************************************************************
|
/* Calculate the the category offset. This is the shift required
|
||||||
Function: calc_offset
|
To get the most out of the number of available bits. A binary
|
||||||
|
type search is used to find the offset. */
|
||||||
Syntax: offset=calc_offset(int16_t *rms_index,int16_t number_of_regions,int16_t available_bits)
|
int16_t calc_offset(int16_t *rms_index, int16_t number_of_regions, int16_t available_bits)
|
||||||
|
|
||||||
input: int16_t *rms_index
|
|
||||||
int16_t number_of_regions
|
|
||||||
int16_t available_bits
|
|
||||||
|
|
||||||
output: int16_t offset
|
|
||||||
|
|
||||||
Description: Calculates the the category offset. This is the shift required
|
|
||||||
To get the most out of the number of available bits. A binary
|
|
||||||
type search is used to find the offset.
|
|
||||||
|
|
||||||
WMOPS: 7kHz | 24kbit | 32kbit
|
|
||||||
-------|--------------|----------------
|
|
||||||
AVG | 0.04 | 0.04
|
|
||||||
-------|--------------|----------------
|
|
||||||
MAX | 0.04 | 0.04
|
|
||||||
-------|--------------|----------------
|
|
||||||
|
|
||||||
14kHz | 24kbit | 32kbit | 48kbit
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
AVG | 0.08 | 0.08 | 0.08
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
MAX | 0.09 | 0.09 | 0.09
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
|
|
||||||
***************************************************************************/
|
|
||||||
int16_t calc_offset(int16_t *rms_index,int16_t number_of_regions,int16_t available_bits)
|
|
||||||
{
|
{
|
||||||
int16_t answer;
|
int16_t answer;
|
||||||
int16_t delta;
|
int16_t delta;
|
||||||
int16_t test_offset;
|
int16_t test_offset;
|
||||||
int16_t region,j;
|
int16_t region;
|
||||||
|
int16_t j;
|
||||||
int16_t power_cats[MAX_NUMBER_OF_REGIONS];
|
int16_t power_cats[MAX_NUMBER_OF_REGIONS];
|
||||||
int16_t bits;
|
int16_t bits;
|
||||||
int16_t offset;
|
int16_t offset;
|
||||||
|
@ -360,40 +255,9 @@ int16_t calc_offset(int16_t *rms_index,int16_t number_of_regions,int16_t availab
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
/***************************************************************************
|
/* Compute the power categories given the offset
|
||||||
Function: compute_raw_pow_categories
|
This is kind of redundant since they were already computed
|
||||||
|
in calc_offset to determine the offset. */
|
||||||
Syntax: void compute_raw_pow_categories(int16_t *power_categories,
|
|
||||||
int16_t *rms_index,
|
|
||||||
int16_t number_of_regions,
|
|
||||||
int16_t offset)
|
|
||||||
inputs: *rms_index
|
|
||||||
number_of_regions
|
|
||||||
offset
|
|
||||||
|
|
||||||
outputs: *power_categories
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Description: This function computes the power categories given the offset
|
|
||||||
This is kind of redundant since they were already computed
|
|
||||||
in calc_offset to determine the offset.
|
|
||||||
|
|
||||||
WMOPS: | 24kbit | 32kbit
|
|
||||||
-------|--------------|----------------
|
|
||||||
AVG | 0.01 | 0.01
|
|
||||||
-------|--------------|----------------
|
|
||||||
MAX | 0.01 | 0.01
|
|
||||||
-------|--------------|----------------
|
|
||||||
|
|
||||||
14kHz | 24kbit | 32kbit | 48kbit
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
AVG | 0.01 | 0.01 | 0.01
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
MAX | 0.01 | 0.01 | 0.01
|
|
||||||
-------|--------------|----------------|----------------
|
|
||||||
|
|
||||||
***************************************************************************/
|
|
||||||
static void compute_raw_pow_categories(int16_t *power_categories, int16_t *rms_index, int16_t number_of_regions, int16_t offset)
|
static void compute_raw_pow_categories(int16_t *power_categories, int16_t *rms_index, int16_t number_of_regions, int16_t offset)
|
||||||
{
|
{
|
||||||
int16_t region;
|
int16_t region;
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: commonf.c,v 1.11 2008/09/30 14:06:39 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -34,9 +32,7 @@
|
||||||
|
|
||||||
#if !defined(G722_1_USE_FIXED_POINT)
|
#if !defined(G722_1_USE_FIXED_POINT)
|
||||||
|
|
||||||
/****************************************************************************************
|
/* Compute a series of categorizations */
|
||||||
Description: Computes a series of categorizations
|
|
||||||
****************************************************************************************/
|
|
||||||
void categorize(int number_of_regions,
|
void categorize(int number_of_regions,
|
||||||
int number_of_available_bits,
|
int number_of_available_bits,
|
||||||
int rms_index[MAX_NUMBER_OF_REGIONS],
|
int rms_index[MAX_NUMBER_OF_REGIONS],
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C)2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: dct4.c,v 1.8 2008/09/29 16:09:26 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
#if defined(HAVE_CONFIG_H)
|
||||||
|
@ -29,6 +27,7 @@
|
||||||
#include "g722_1/g722_1.h"
|
#include "g722_1/g722_1.h"
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
#if !defined(G722_1_USE_FIXED_POINT)
|
#if !defined(G722_1_USE_FIXED_POINT)
|
||||||
|
|
||||||
|
@ -52,9 +51,7 @@ static const cos_msin_t *cos_msin_table[] =
|
||||||
cos_msin_640
|
cos_msin_640
|
||||||
};
|
};
|
||||||
|
|
||||||
/*********************************************************************************
|
/* Discrete Cosine Transform, Type IV */
|
||||||
Description: Discrete Cosine Transform, Type IV
|
|
||||||
*********************************************************************************/
|
|
||||||
void dct_type_iv(float input[], float output[], int dct_length)
|
void dct_type_iv(float input[], float output[], int dct_length)
|
||||||
{
|
{
|
||||||
float buffer_a[MAX_DCT_LENGTH];
|
float buffer_a[MAX_DCT_LENGTH];
|
||||||
|
@ -64,22 +61,20 @@ void dct_type_iv(float input[], float output[], int dct_length)
|
||||||
float *in_ptr_low;
|
float *in_ptr_low;
|
||||||
float *in_ptr_high;
|
float *in_ptr_high;
|
||||||
float *next_in_base;
|
float *next_in_base;
|
||||||
float *out_ptr_low;
|
float *out_ptr;
|
||||||
float *out_ptr_high;
|
|
||||||
float *next_out_base;
|
float *next_out_base;
|
||||||
float *out_buffer;
|
float *out_buffer;
|
||||||
float *in_buffer;
|
float *in_buffer;
|
||||||
float *buffer_swap;
|
float *buffer_swap;
|
||||||
float *fptr0;
|
float *fptr0;
|
||||||
const float *fptr2;
|
|
||||||
const float *core_a;
|
|
||||||
float in_val_low;
|
float in_val_low;
|
||||||
float in_val_high;
|
float in_val_high;
|
||||||
float cos_even;
|
float cos_even;
|
||||||
float cos_odd;
|
float cos_odd;
|
||||||
float msin_even;
|
float msin_even;
|
||||||
float msin_odd;
|
float msin_odd;
|
||||||
float sum;
|
const float *fptr2;
|
||||||
|
const float *core_a;
|
||||||
const cos_msin_t **table_ptr_ptr;
|
const cos_msin_t **table_ptr_ptr;
|
||||||
const cos_msin_t *cos_msin_ptr;
|
const cos_msin_t *cos_msin_ptr;
|
||||||
int set_span;
|
int set_span;
|
||||||
|
@ -120,29 +115,24 @@ void dct_type_iv(float input[], float output[], int dct_length)
|
||||||
for (sets_left = set_count; sets_left > 0; sets_left--)
|
for (sets_left = set_count; sets_left > 0; sets_left--)
|
||||||
{
|
{
|
||||||
/* Set up output pointers for the current set */
|
/* Set up output pointers for the current set */
|
||||||
out_ptr_low = next_out_base;
|
out_ptr = next_out_base;
|
||||||
next_out_base += set_span;
|
next_out_base += set_span;
|
||||||
out_ptr_high = next_out_base;
|
|
||||||
|
|
||||||
/* Loop over all the butterflies in the current set */
|
/* Loop over all the butterflies in the current set */
|
||||||
do
|
for (i = 0; i < (set_span >> 1); i++)
|
||||||
{
|
{
|
||||||
in_val_low = *in_ptr++;
|
in_val_low = *in_ptr++;
|
||||||
in_val_high = *in_ptr++;
|
in_val_high = *in_ptr++;
|
||||||
*out_ptr_low++ = in_val_low + in_val_high;
|
out_ptr[i] = in_val_low + in_val_high;
|
||||||
*--out_ptr_high = in_val_low - in_val_high;
|
out_ptr[set_span - 1 - i] = in_val_low - in_val_high;
|
||||||
}
|
}
|
||||||
while (out_ptr_low < out_ptr_high);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decide which buffers to use as input and output next time.
|
/* Decide which buffers to use as input and output next time.
|
||||||
Except for the first time (when the input buffer is the
|
Except for the first time (when the input buffer is the
|
||||||
subroutine input) we just alternate the local buffers. */
|
subroutine input) we just alternate the local buffers. */
|
||||||
in_buffer = out_buffer;
|
in_buffer = out_buffer;
|
||||||
if (out_buffer == buffer_a)
|
out_buffer = (out_buffer == buffer_a) ? buffer_b : buffer_a;
|
||||||
out_buffer = buffer_b;
|
|
||||||
else
|
|
||||||
out_buffer = buffer_a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do dct_size/10 ten-point transforms */
|
/* Do dct_size/10 ten-point transforms */
|
||||||
|
@ -153,11 +143,8 @@ void dct_type_iv(float input[], float output[], int dct_length)
|
||||||
fptr2 = core_a;
|
fptr2 = core_a;
|
||||||
for (k = 0; k < CORE_SIZE; k++)
|
for (k = 0; k < CORE_SIZE; k++)
|
||||||
{
|
{
|
||||||
sum = 0;
|
buffer_swap[k] = vec_dot_prodf(fptr0, fptr2, CORE_SIZE);
|
||||||
for (i = 0; i < CORE_SIZE; i++)
|
|
||||||
sum += fptr0[i]*fptr2[i];
|
|
||||||
fptr2 += CORE_SIZE;
|
fptr2 += CORE_SIZE;
|
||||||
buffer_swap[k] = sum;
|
|
||||||
}
|
}
|
||||||
fptr0 += CORE_SIZE;
|
fptr0 += CORE_SIZE;
|
||||||
buffer_swap += CORE_SIZE;
|
buffer_swap += CORE_SIZE;
|
||||||
|
@ -172,14 +159,10 @@ void dct_type_iv(float input[], float output[], int dct_length)
|
||||||
{
|
{
|
||||||
/* Initialization for the loop over sets at the current size */
|
/* Initialization for the loop over sets at the current size */
|
||||||
set_span = dct_length >> set_count_log;
|
set_span = dct_length >> set_count_log;
|
||||||
|
|
||||||
set_count = 1 << set_count_log;
|
set_count = 1 << set_count_log;
|
||||||
next_in_base = in_buffer;
|
next_in_base = in_buffer;
|
||||||
if (set_count_log == 0)
|
next_out_base = (set_count_log == 0) ? output : out_buffer;
|
||||||
next_out_base = output;
|
table_ptr_ptr++;
|
||||||
else
|
|
||||||
next_out_base = out_buffer;
|
|
||||||
++table_ptr_ptr;
|
|
||||||
|
|
||||||
/* Loop over all the sets of this size */
|
/* Loop over all the sets of this size */
|
||||||
for (sets_left = set_count; sets_left > 0; sets_left--)
|
for (sets_left = set_count; sets_left > 0; sets_left--)
|
||||||
|
@ -187,26 +170,23 @@ void dct_type_iv(float input[], float output[], int dct_length)
|
||||||
/* Set up the pointers for the current set */
|
/* Set up the pointers for the current set */
|
||||||
in_ptr_low = next_in_base;
|
in_ptr_low = next_in_base;
|
||||||
in_ptr_high = in_ptr_low + (set_span >> 1);
|
in_ptr_high = in_ptr_low + (set_span >> 1);
|
||||||
next_in_base += set_span;
|
out_ptr = next_out_base;
|
||||||
out_ptr_low = next_out_base;
|
|
||||||
next_out_base += set_span;
|
|
||||||
out_ptr_high = next_out_base;
|
|
||||||
cos_msin_ptr = *table_ptr_ptr;
|
cos_msin_ptr = *table_ptr_ptr;
|
||||||
|
|
||||||
/* Loop over all the butterfly pairs in the current set */
|
/* Loop over all the butterfly pairs in the current set */
|
||||||
do
|
for (i = 0; i < (set_span >> 1); i += 2)
|
||||||
{
|
{
|
||||||
cos_even = (*cos_msin_ptr).cosine;
|
cos_even = cos_msin_ptr[i].cosine;
|
||||||
msin_even = (*cos_msin_ptr++).minus_sine;
|
msin_even = cos_msin_ptr[i].minus_sine;
|
||||||
*out_ptr_low++ = cos_even * *in_ptr_low - msin_even * *in_ptr_high;
|
cos_odd = cos_msin_ptr[i + 1].cosine;
|
||||||
*--out_ptr_high = msin_even * *in_ptr_low++ + cos_even * *in_ptr_high++;
|
msin_odd = cos_msin_ptr[i + 1].minus_sine;
|
||||||
|
out_ptr[i] = cos_even*in_ptr_low[i] - msin_even*in_ptr_high[i];
|
||||||
cos_odd = (*cos_msin_ptr).cosine;
|
out_ptr[set_span - 1 - i] = msin_even*in_ptr_low[i] + cos_even*in_ptr_high[i];
|
||||||
msin_odd = (*cos_msin_ptr++).minus_sine;
|
out_ptr[i + 1] = cos_odd*in_ptr_low[i + 1] + msin_odd*in_ptr_high[i + 1];
|
||||||
*out_ptr_low++ = cos_odd * *in_ptr_low + msin_odd * *in_ptr_high;
|
out_ptr[set_span - 2 - i] = msin_odd*in_ptr_low[i + 1] - cos_odd*in_ptr_high[i + 1];
|
||||||
*--out_ptr_high = msin_odd * *in_ptr_low++ - cos_odd * *in_ptr_high++;
|
|
||||||
}
|
}
|
||||||
while (out_ptr_low < out_ptr_high);
|
next_in_base += set_span;
|
||||||
|
next_out_base += set_span;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Swap input and output buffers for next time */
|
/* Swap input and output buffers for next time */
|
||||||
|
|
|
@ -6,29 +6,23 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: dct4_a.c,v 1.8 2008/09/30 14:06:39 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*********************************************************************************
|
/* Discrete Cosine Transform, Type IV used for MLT
|
||||||
* Filename: dct_type_iv_a.c
|
|
||||||
*
|
The basis functions are
|
||||||
* Purpose: Discrete Cosine Transform, Type IV used for MLT
|
|
||||||
*
|
cos(PI*(t+0.5)*(k+0.5)/block_length)
|
||||||
* The basis functions are
|
|
||||||
*
|
for time t and basis function number k. Due to the symmetry of the
|
||||||
* cos(PI*(t+0.5)*(k+0.5)/block_length)
|
expression in t and k, it is clear that the forward and inverse transforms
|
||||||
*
|
are the same. */
|
||||||
* for time t and basis function number k. Due to the symmetry of the expression
|
|
||||||
* in t and k, it is clear that the forward and inverse transforms are the same.
|
|
||||||
*
|
|
||||||
*********************************************************************************/
|
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
|
@ -47,51 +41,31 @@
|
||||||
|
|
||||||
#include "dct4_a.h"
|
#include "dct4_a.h"
|
||||||
|
|
||||||
/*********************************************************************************
|
/* Discrete Cosine Transform, Type IV used for MLT */
|
||||||
Function: dct_type_iv_a
|
|
||||||
|
|
||||||
Syntax: void dct_type_iv_a (input, output, dct_length)
|
|
||||||
int16_t input[], output[], dct_length;
|
|
||||||
|
|
||||||
Description: Discrete Cosine Transform, Type IV used for MLT
|
|
||||||
*********************************************************************************/
|
|
||||||
|
|
||||||
void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length)
|
void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length)
|
||||||
{
|
{
|
||||||
int16_t buffer_a[MAX_DCT_LENGTH];
|
int16_t buffer_a[MAX_DCT_LENGTH];
|
||||||
int16_t buffer_b[MAX_DCT_LENGTH];
|
int16_t buffer_b[MAX_DCT_LENGTH];
|
||||||
int16_t buffer_c[MAX_DCT_LENGTH];
|
int16_t buffer_c[MAX_DCT_LENGTH];
|
||||||
int16_t *in_ptr;
|
int16_t *in_ptr;
|
||||||
int16_t *in_ptr_low;
|
int16_t *out_ptr;
|
||||||
int16_t *in_ptr_high;
|
|
||||||
int16_t *next_in_base;
|
|
||||||
int16_t *out_ptr_low;
|
|
||||||
int16_t *out_ptr_high;
|
|
||||||
int16_t *next_out_base;
|
|
||||||
int16_t *out_buffer;
|
|
||||||
int16_t *in_buffer;
|
int16_t *in_buffer;
|
||||||
|
int16_t *out_buffer;
|
||||||
int16_t *buffer_swap;
|
int16_t *buffer_swap;
|
||||||
int16_t in_val_low;
|
int16_t in_val_low;
|
||||||
int16_t in_val_high;
|
int16_t in_val_high;
|
||||||
int16_t out_val_low;
|
|
||||||
int16_t out_val_high;
|
|
||||||
int16_t in_low_even;
|
int16_t in_low_even;
|
||||||
int16_t in_low_odd;
|
int16_t in_low_odd;
|
||||||
int16_t in_high_even;
|
int16_t in_high_even;
|
||||||
int16_t in_high_odd;
|
int16_t in_high_odd;
|
||||||
int16_t out_low_even;
|
|
||||||
int16_t out_low_odd;
|
|
||||||
int16_t out_high_even;
|
|
||||||
int16_t out_high_odd;
|
|
||||||
int16_t *pair_ptr;
|
int16_t *pair_ptr;
|
||||||
int16_t cos_even;
|
int16_t cos_even;
|
||||||
int16_t cos_odd;
|
int16_t cos_odd;
|
||||||
int16_t msin_even;
|
int16_t msin_even;
|
||||||
int16_t msin_odd;
|
int16_t msin_odd;
|
||||||
int16_t neg_cos_odd;
|
|
||||||
int16_t neg_msin_even;
|
|
||||||
int32_t sum;
|
int32_t sum;
|
||||||
int16_t set_span;
|
int16_t set_span;
|
||||||
|
int16_t half_span;
|
||||||
int16_t set_count;
|
int16_t set_count;
|
||||||
int16_t set_count_log;
|
int16_t set_count_log;
|
||||||
int16_t pairs_left;
|
int16_t pairs_left;
|
||||||
|
@ -99,15 +73,15 @@ void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length)
|
||||||
int16_t i;
|
int16_t i;
|
||||||
int16_t k;
|
int16_t k;
|
||||||
int16_t index;
|
int16_t index;
|
||||||
const cos_msin_t **table_ptr_ptr;
|
|
||||||
const cos_msin_t *cos_msin_ptr;
|
|
||||||
int16_t temp;
|
int16_t temp;
|
||||||
int32_t acca;
|
int32_t acca;
|
||||||
int16_t dct_length_log;
|
int16_t dct_length_log;
|
||||||
|
const cos_msin_t **table_ptr_ptr;
|
||||||
|
const cos_msin_t *cos_msin_ptr;
|
||||||
|
|
||||||
/* Do the sum/difference butterflies, the first part of */
|
/* Do the sum/difference butterflies, the first part of
|
||||||
/* converting one N-point transform into N/2 two-point */
|
converting one N-point transform into N/2 two-point
|
||||||
/* transforms, where N = 1 << DCT_LENGTH_LOG. = 64/128 */
|
transforms, where N = 1 << DCT_LENGTH_LOG. = 64/128 */
|
||||||
if (dct_length == DCT_LENGTH)
|
if (dct_length == DCT_LENGTH)
|
||||||
{
|
{
|
||||||
dct_length_log = DCT_LENGTH_LOG;
|
dct_length_log = DCT_LENGTH_LOG;
|
||||||
|
@ -123,62 +97,45 @@ void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length)
|
||||||
index = 0L;
|
index = 0L;
|
||||||
in_buffer = input;
|
in_buffer = input;
|
||||||
out_buffer = buffer_a;
|
out_buffer = buffer_a;
|
||||||
temp = sub(dct_length_log, 2);
|
temp = dct_length_log - 2;
|
||||||
for (set_count_log = 0; set_count_log <= temp; set_count_log++)
|
for (set_count_log = 0; set_count_log <= temp; set_count_log++)
|
||||||
{
|
{
|
||||||
/* Initialization for the loop over sets at the current size */
|
/* Loop over all the sets at the current size */
|
||||||
/* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */
|
set_span = dct_length >> set_count_log;
|
||||||
set_span = shr(dct_length, set_count_log);
|
set_count = 1 << set_count_log;
|
||||||
|
half_span = set_span >> 1;
|
||||||
set_count = shl(1, set_count_log);
|
|
||||||
in_ptr = in_buffer;
|
in_ptr = in_buffer;
|
||||||
next_out_base = out_buffer;
|
out_ptr = out_buffer;
|
||||||
|
|
||||||
/* Loop over all the sets of this size */
|
|
||||||
for (sets_left = set_count; sets_left > 0; sets_left--)
|
for (sets_left = set_count; sets_left > 0; sets_left--)
|
||||||
{
|
{
|
||||||
/* Set up output pointers for the current set */
|
|
||||||
out_ptr_low = next_out_base;
|
|
||||||
next_out_base = next_out_base + set_span;
|
|
||||||
out_ptr_high = next_out_base;
|
|
||||||
|
|
||||||
/* Loop over all the butterflies in the current set */
|
/* Loop over all the butterflies in the current set */
|
||||||
do
|
for (i = 0; i < half_span; i++)
|
||||||
{
|
{
|
||||||
in_val_low = *in_ptr++;
|
in_val_low = *in_ptr++;
|
||||||
in_val_high = *in_ptr++;
|
in_val_high = *in_ptr++;
|
||||||
acca = L_add(in_val_low, in_val_high);
|
|
||||||
acca = L_shr(acca, 1);
|
|
||||||
out_val_low = (int16_t) acca;
|
|
||||||
|
|
||||||
acca = L_sub(in_val_low, in_val_high);
|
acca = L_add(in_val_low, in_val_high);
|
||||||
acca = L_shr(acca, 1);
|
out_ptr[i] = (int16_t) L_shr(acca, 1);
|
||||||
out_val_high = (int16_t) acca;
|
|
||||||
|
|
||||||
*out_ptr_low++ = out_val_low;
|
acca = L_sub(in_val_low, in_val_high);
|
||||||
*--out_ptr_high = out_val_high;
|
out_ptr[set_span - 1 - i] = (int16_t) L_shr(acca, 1);
|
||||||
}
|
}
|
||||||
while (out_ptr_low < out_ptr_high);
|
out_ptr += set_span;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decide which buffers to use as input and output next time. */
|
/* Decide which buffers to use as input and output next time.
|
||||||
/* Except for the first time (when the input buffer is the */
|
Except for the first time (when the input buffer is the
|
||||||
/* subroutine input) we just alternate the local buffers. */
|
subroutine input) we just alternate the local buffers. */
|
||||||
in_buffer = out_buffer;
|
in_buffer = out_buffer;
|
||||||
if (out_buffer == buffer_a)
|
out_buffer = (out_buffer == buffer_a) ? buffer_b : buffer_a;
|
||||||
out_buffer = buffer_b;
|
|
||||||
else
|
|
||||||
out_buffer = buffer_a;
|
|
||||||
index = add(index, 1);
|
index = add(index, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do N/2 two-point transforms, */
|
/* Do N/2 two-point transforms, where N = 1 << DCT_LENGTH_LOG */
|
||||||
/* where N = 1 << DCT_LENGTH_LOG */
|
|
||||||
pair_ptr = in_buffer;
|
pair_ptr = in_buffer;
|
||||||
buffer_swap = buffer_c;
|
buffer_swap = buffer_c;
|
||||||
temp = sub(dct_length_log, 1);
|
temp = 1 << (dct_length_log - 1);
|
||||||
temp = shl(1, temp);
|
|
||||||
|
|
||||||
for (pairs_left = temp; pairs_left > 0; pairs_left--)
|
for (pairs_left = temp; pairs_left > 0; pairs_left--)
|
||||||
{
|
{
|
||||||
for (k = 0; k < CORE_SIZE; k++)
|
for (k = 0; k < CORE_SIZE; k++)
|
||||||
|
@ -188,7 +145,6 @@ void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length)
|
||||||
sum = L_mac(sum, pair_ptr[i], dct_core_a[i][k]);
|
sum = L_mac(sum, pair_ptr[i], dct_core_a[i][k]);
|
||||||
buffer_swap[k] = xround(sum);
|
buffer_swap[k] = xround(sum);
|
||||||
}
|
}
|
||||||
/* Address arithmetic */
|
|
||||||
pair_ptr += CORE_SIZE;
|
pair_ptr += CORE_SIZE;
|
||||||
buffer_swap += CORE_SIZE;
|
buffer_swap += CORE_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -202,77 +158,53 @@ void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length)
|
||||||
temp = sub(dct_length_log, 2);
|
temp = sub(dct_length_log, 2);
|
||||||
for (set_count_log = temp; set_count_log >= 0; set_count_log--)
|
for (set_count_log = temp; set_count_log >= 0; set_count_log--)
|
||||||
{
|
{
|
||||||
/* Initialization for the loop over sets at the current size */
|
/* Loop over all the sets at the current size */
|
||||||
/* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */
|
set_span = dct_length >> set_count_log;
|
||||||
set_span = shr(dct_length, set_count_log);
|
set_count = 1 << set_count_log;
|
||||||
set_count = shl(1, set_count_log);
|
half_span = set_span >> 1;
|
||||||
next_in_base = in_buffer;
|
in_ptr = in_buffer;
|
||||||
next_out_base = (set_count_log == 0) ? output : out_buffer;
|
out_ptr = (set_count_log == 0) ? output : out_buffer;
|
||||||
|
cos_msin_ptr = *table_ptr_ptr++;
|
||||||
|
|
||||||
/* Loop over all the sets of this size */
|
|
||||||
for (sets_left = set_count; sets_left > 0; sets_left--)
|
for (sets_left = set_count; sets_left > 0; sets_left--)
|
||||||
{
|
{
|
||||||
/* Set up the pointers for the current set */
|
|
||||||
in_ptr_low = next_in_base;
|
|
||||||
temp = shr(set_span, 1);
|
|
||||||
|
|
||||||
/* Address arithmetic */
|
|
||||||
in_ptr_high = in_ptr_low + temp;
|
|
||||||
next_in_base += set_span;
|
|
||||||
out_ptr_low = next_out_base;
|
|
||||||
next_out_base += set_span;
|
|
||||||
out_ptr_high = next_out_base;
|
|
||||||
cos_msin_ptr = *table_ptr_ptr;
|
|
||||||
|
|
||||||
/* Loop over all the butterfly pairs in the current set */
|
/* Loop over all the butterfly pairs in the current set */
|
||||||
do
|
for (i = 0; i < half_span; i += 2)
|
||||||
{
|
{
|
||||||
/* Address arithmetic */
|
in_low_even = in_ptr[i];
|
||||||
in_low_even = *in_ptr_low++;
|
in_low_odd = in_ptr[i + 1];
|
||||||
in_low_odd = *in_ptr_low++;
|
in_high_even = in_ptr[half_span + i];
|
||||||
in_high_even = *in_ptr_high++;
|
in_high_odd = in_ptr[half_span + i + 1];
|
||||||
in_high_odd = *in_ptr_high++;
|
|
||||||
cos_even = cos_msin_ptr[0].cosine;
|
|
||||||
msin_even = cos_msin_ptr[0].minus_sine;
|
|
||||||
cos_odd = cos_msin_ptr[1].cosine;
|
|
||||||
msin_odd = cos_msin_ptr[1].minus_sine;
|
|
||||||
cos_msin_ptr += 2;
|
|
||||||
|
|
||||||
sum = 0L;
|
cos_even = cos_msin_ptr[i].cosine;
|
||||||
sum = L_mac(sum, cos_even, in_low_even);
|
msin_even = cos_msin_ptr[i].minus_sine;
|
||||||
neg_msin_even = negate(msin_even);
|
cos_odd = cos_msin_ptr[i + 1].cosine;
|
||||||
sum = L_mac(sum, neg_msin_even, in_high_even);
|
msin_odd = cos_msin_ptr[i + 1].minus_sine;
|
||||||
out_low_even = xround(sum);
|
|
||||||
|
|
||||||
sum = 0L;
|
sum = L_mult(cos_even, in_low_even);
|
||||||
sum = L_mac(sum, msin_even,in_low_even);
|
sum = L_mac(sum, -msin_even, in_high_even);
|
||||||
|
out_ptr[i] = xround(sum);
|
||||||
|
|
||||||
|
sum = L_mult(msin_even,in_low_even);
|
||||||
sum = L_mac(sum, cos_even, in_high_even);
|
sum = L_mac(sum, cos_even, in_high_even);
|
||||||
out_high_even = xround(sum);
|
out_ptr[set_span - 1 - i] = xround(sum);
|
||||||
|
|
||||||
sum = 0L;
|
sum = L_mult(cos_odd, in_low_odd);
|
||||||
sum = L_mac(sum, cos_odd, in_low_odd);
|
|
||||||
sum = L_mac(sum, msin_odd, in_high_odd);
|
sum = L_mac(sum, msin_odd, in_high_odd);
|
||||||
out_low_odd = xround(sum);
|
out_ptr[i + 1] = xround(sum);
|
||||||
|
|
||||||
sum = 0L;
|
sum = L_mult(msin_odd, in_low_odd);
|
||||||
sum = L_mac(sum, msin_odd, in_low_odd);
|
sum = L_mac(sum, -cos_odd, in_high_odd);
|
||||||
neg_cos_odd = negate(cos_odd);
|
out_ptr[set_span - 2 - i] = xround(sum);
|
||||||
sum = L_mac(sum, neg_cos_odd, in_high_odd);
|
|
||||||
out_high_odd = xround(sum);
|
|
||||||
|
|
||||||
*out_ptr_low++ = out_low_even;
|
|
||||||
*--out_ptr_high = out_high_even;
|
|
||||||
*out_ptr_low++ = out_low_odd;
|
|
||||||
*--out_ptr_high = out_high_odd;
|
|
||||||
}
|
}
|
||||||
while (out_ptr_low < out_ptr_high);
|
in_ptr += set_span;
|
||||||
|
out_ptr += set_span;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Swap input and output buffers for next time */
|
/* Swap input and output buffers for next time */
|
||||||
buffer_swap = in_buffer;
|
buffer_swap = in_buffer;
|
||||||
in_buffer = out_buffer;
|
in_buffer = out_buffer;
|
||||||
out_buffer = buffer_swap;
|
out_buffer = buffer_swap;
|
||||||
table_ptr_ptr++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: dct4_a.h,v 1.4 2008/09/25 15:56:31 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -6,29 +6,23 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: dct4_s.c,v 1.8 2008/09/30 14:06:39 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/********************************************************************************
|
/* Discrete Cosine Transform, Type IV used for inverse MLT
|
||||||
* Filename: dct_type_iv_s.c
|
|
||||||
*
|
The basis functions are
|
||||||
* Purpose: Discrete Cosine Transform, Type IV used for inverse MLT
|
|
||||||
*
|
cos(PI*(t+0.5)*(k+0.5)/block_length)
|
||||||
* The basis functions are
|
|
||||||
*
|
for time t and basis function number k. Due to the symmetry of the
|
||||||
* cos(PI*(t+0.5)*(k+0.5)/block_length)
|
expression in t and k, it is clear that the forward and inverse transforms
|
||||||
*
|
are the same. */
|
||||||
* for time t and basis function number k. Due to the symmetry of the expression
|
|
||||||
* in t and k, it is clear that the forward and inverse transforms are the same.
|
|
||||||
*
|
|
||||||
*********************************************************************************/
|
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
||||||
|
@ -45,67 +39,51 @@
|
||||||
#if defined(G722_1_USE_FIXED_POINT)
|
#if defined(G722_1_USE_FIXED_POINT)
|
||||||
|
|
||||||
#include "dct4_s.h"
|
#include "dct4_s.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
/********************************************************************************
|
/* Discrete Cosine Transform, Type IV used for inverse MLT */
|
||||||
Function: dct_type_iv_s
|
|
||||||
|
|
||||||
Syntax: void dct_type_iv_s (int16_t *input,int16_t *output,int16_t dct_length)
|
|
||||||
|
|
||||||
|
|
||||||
Description: Discrete Cosine Transform, Type IV used for inverse MLT
|
|
||||||
********************************************************************************/
|
|
||||||
void dct_type_iv_s(int16_t input[], int16_t output[], int dct_length)
|
void dct_type_iv_s(int16_t input[], int16_t output[], int dct_length)
|
||||||
{
|
{
|
||||||
int16_t buffer_a[MAX_DCT_LENGTH];
|
int16_t buffer_a[MAX_DCT_LENGTH];
|
||||||
int16_t buffer_b[MAX_DCT_LENGTH];
|
int16_t buffer_b[MAX_DCT_LENGTH];
|
||||||
int16_t buffer_c[MAX_DCT_LENGTH];
|
int16_t buffer_c[MAX_DCT_LENGTH];
|
||||||
int16_t *in_ptr;
|
int16_t *in_ptr;
|
||||||
int16_t *in_ptr_low;
|
int16_t *out_ptr;
|
||||||
int16_t *in_ptr_high;
|
|
||||||
int16_t *next_in_base;
|
|
||||||
int16_t *out_ptr_low;
|
|
||||||
int16_t *out_ptr_high;
|
|
||||||
int16_t *next_out_base;
|
|
||||||
int16_t *out_buffer;
|
|
||||||
int16_t *in_buffer;
|
int16_t *in_buffer;
|
||||||
|
int16_t *out_buffer;
|
||||||
int16_t *buffer_swap;
|
int16_t *buffer_swap;
|
||||||
int16_t in_val_low;
|
int16_t in_val_low;
|
||||||
int16_t in_val_high;
|
int16_t in_val_high;
|
||||||
int16_t out_val_low;
|
|
||||||
int16_t out_val_high;
|
|
||||||
int16_t in_low_even;
|
int16_t in_low_even;
|
||||||
int16_t in_low_odd;
|
int16_t in_low_odd;
|
||||||
int16_t in_high_even;
|
int16_t in_high_even;
|
||||||
int16_t in_high_odd;
|
int16_t in_high_odd;
|
||||||
int16_t out_low_even;
|
|
||||||
int16_t out_low_odd;
|
|
||||||
int16_t out_high_even;
|
|
||||||
int16_t out_high_odd;
|
|
||||||
int16_t *pair_ptr;
|
int16_t *pair_ptr;
|
||||||
int16_t cos_even;
|
int16_t cos_even;
|
||||||
int16_t cos_odd;
|
int16_t cos_odd;
|
||||||
int16_t msin_even;
|
int16_t msin_even;
|
||||||
int16_t msin_odd;
|
int16_t msin_odd;
|
||||||
int16_t set_span;
|
int16_t set_span;
|
||||||
|
int16_t half_span;
|
||||||
int16_t set_count;
|
int16_t set_count;
|
||||||
int16_t set_count_log;
|
int16_t set_count_log;
|
||||||
int16_t pairs_left;
|
int16_t pairs_left;
|
||||||
int16_t sets_left;
|
int16_t sets_left;
|
||||||
int16_t i;
|
int16_t i;
|
||||||
|
int16_t j;
|
||||||
int16_t k;
|
int16_t k;
|
||||||
int16_t index;
|
int16_t index;
|
||||||
int16_t dummy;
|
int16_t dummy;
|
||||||
|
int16_t dct_length_log;
|
||||||
int32_t sum;
|
int32_t sum;
|
||||||
|
int32_t acca;
|
||||||
const cos_msin_t **table_ptr_ptr;
|
const cos_msin_t **table_ptr_ptr;
|
||||||
const cos_msin_t *cos_msin_ptr;
|
const cos_msin_t *cos_msin_ptr;
|
||||||
int32_t acca;
|
|
||||||
int16_t temp;
|
|
||||||
int16_t dct_length_log;
|
|
||||||
const int16_t *dither_ptr;
|
const int16_t *dither_ptr;
|
||||||
|
|
||||||
/* Do the sum/difference butterflies, the first part of */
|
/* Do the sum/difference butterflies, the first part of
|
||||||
/* converting one N-point transform into 32 - 10 point transforms */
|
converting one N-point transform into 32 - 10 point transforms
|
||||||
/* transforms, where N = 1 << DCT_LENGTH_LOG. */
|
transforms, where N = 1 << DCT_LENGTH_LOG. */
|
||||||
if (dct_length == DCT_LENGTH)
|
if (dct_length == DCT_LENGTH)
|
||||||
{
|
{
|
||||||
dct_length_log = DCT_LENGTH_LOG;
|
dct_length_log = DCT_LENGTH_LOG;
|
||||||
|
@ -122,92 +100,61 @@ void dct_type_iv_s(int16_t input[], int16_t output[], int dct_length)
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
j = 0;
|
||||||
|
|
||||||
for (set_count_log = 0; set_count_log <= dct_length_log - 2; set_count_log++)
|
for (set_count_log = 0; set_count_log <= dct_length_log - 2; set_count_log++)
|
||||||
{
|
{
|
||||||
/* Initialization for the loop over sets at the current size */
|
/* Loop over all the sets at the current size */
|
||||||
/* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */
|
set_span = dct_length >> set_count_log;
|
||||||
set_span = shr(dct_length, set_count_log);
|
set_count = 1 << set_count_log;
|
||||||
|
half_span = set_span >> 1;
|
||||||
set_count = shl(1, set_count_log);
|
|
||||||
in_ptr = in_buffer;
|
in_ptr = in_buffer;
|
||||||
next_out_base = out_buffer;
|
out_ptr = out_buffer;
|
||||||
|
|
||||||
/* Loop over all the sets of this size */
|
if (index < 1)
|
||||||
temp = sub(index, 1);
|
|
||||||
if (temp < 0)
|
|
||||||
{
|
{
|
||||||
for (sets_left = set_count; sets_left > 0; sets_left--)
|
for (sets_left = set_count; sets_left > 0; sets_left--)
|
||||||
{
|
{
|
||||||
/* Set up output pointers for the current set */
|
|
||||||
/* pointer arithmetic */
|
|
||||||
out_ptr_low = next_out_base;
|
|
||||||
next_out_base += set_span;
|
|
||||||
out_ptr_high = next_out_base;
|
|
||||||
|
|
||||||
/* Loop over all the butterflies in the current set */
|
/* Loop over all the butterflies in the current set */
|
||||||
do
|
for (i = 0; i < half_span; i++)
|
||||||
{
|
{
|
||||||
in_val_low = *in_ptr++;
|
in_val_low = *in_ptr++;
|
||||||
in_val_high = *in_ptr++;
|
in_val_high = *in_ptr++;
|
||||||
|
|
||||||
/* BEST METHOD OF GETTING RID OF BIAS, BUT COMPUTATIONALLY UNPLEASANT */
|
dummy = add(in_val_low, dither_ptr[j++]);
|
||||||
/* ALTERNATIVE METHOD, SMEARS BIAS OVER THE ENTIRE FRAME, COMPUTATIONALLY SIMPLEST. */
|
|
||||||
/* IF THIS WORKS, IT'S PREFERABLE */
|
|
||||||
|
|
||||||
dummy = add(in_val_low, dither_ptr[i++]);
|
|
||||||
acca = L_add(dummy, in_val_high);
|
acca = L_add(dummy, in_val_high);
|
||||||
out_val_low = (int16_t) L_shr(acca, 1);
|
out_ptr[i] = (int16_t) L_shr(acca, 1);
|
||||||
|
|
||||||
dummy = add(in_val_low, dither_ptr[i++]);
|
dummy = add(in_val_low, dither_ptr[j++]);
|
||||||
acca = L_add(dummy, -in_val_high);
|
acca = L_sub(dummy, in_val_high);
|
||||||
out_val_high = (int16_t) L_shr(acca, 1);
|
out_ptr[set_span - 1 - i] = (int16_t) L_shr(acca, 1);
|
||||||
|
|
||||||
*out_ptr_low++ = out_val_low;
|
|
||||||
*--out_ptr_high = out_val_high;
|
|
||||||
|
|
||||||
/* this involves comparison of pointers */
|
|
||||||
/* pointer arithmetic */
|
|
||||||
}
|
}
|
||||||
while (out_ptr_low < out_ptr_high);
|
out_ptr += set_span;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (sets_left = set_count; sets_left > 0; sets_left--)
|
for (sets_left = set_count; sets_left > 0; sets_left--)
|
||||||
{
|
{
|
||||||
/* Set up output pointers for the current set */
|
|
||||||
out_ptr_low = next_out_base;
|
|
||||||
next_out_base += set_span;
|
|
||||||
out_ptr_high = next_out_base;
|
|
||||||
|
|
||||||
/* Loop over all the butterflies in the current set */
|
/* Loop over all the butterflies in the current set */
|
||||||
do
|
for (i = 0; i < half_span; i++)
|
||||||
{
|
{
|
||||||
in_val_low = *in_ptr++;
|
in_val_low = *in_ptr++;
|
||||||
in_val_high = *in_ptr++;
|
in_val_high = *in_ptr++;
|
||||||
|
|
||||||
out_val_low = add(in_val_low, in_val_high);
|
out_ptr[i] = add(in_val_low, in_val_high);
|
||||||
out_val_high = add(in_val_low, negate(in_val_high));
|
out_ptr[set_span - 1 - i] = sub(in_val_low, in_val_high);
|
||||||
|
|
||||||
*out_ptr_low++ = out_val_low;
|
|
||||||
*--out_ptr_high = out_val_high;
|
|
||||||
}
|
}
|
||||||
while (out_ptr_low < out_ptr_high);
|
out_ptr += set_span;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decide which buffers to use as input and output next time. */
|
/* Decide which buffers to use as input and output next time.
|
||||||
/* Except for the first time (when the input buffer is the */
|
Except for the first time (when the input buffer is the
|
||||||
/* subroutine input) we just alternate the local buffers. */
|
subroutine input) we just alternate the local buffers. */
|
||||||
in_buffer = out_buffer;
|
in_buffer = out_buffer;
|
||||||
|
out_buffer = (out_buffer == buffer_a) ? buffer_b : buffer_a;
|
||||||
if (out_buffer == buffer_a)
|
index++;
|
||||||
out_buffer = buffer_b;
|
|
||||||
else
|
|
||||||
out_buffer = buffer_a;
|
|
||||||
|
|
||||||
index = add(index, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do 32 - 10 point transforms */
|
/* Do 32 - 10 point transforms */
|
||||||
|
@ -228,8 +175,7 @@ void dct_type_iv_s(int16_t input[], int16_t output[], int dct_length)
|
||||||
buffer_swap += CORE_SIZE;
|
buffer_swap += CORE_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < dct_length; i++)
|
vec_copyi16(in_buffer, buffer_c, dct_length);
|
||||||
in_buffer[i] = buffer_c[i];
|
|
||||||
|
|
||||||
table_ptr_ptr = s_cos_msin_table;
|
table_ptr_ptr = s_cos_msin_table;
|
||||||
|
|
||||||
|
@ -238,90 +184,61 @@ void dct_type_iv_s(int16_t input[], int16_t output[], int dct_length)
|
||||||
for (set_count_log = dct_length_log - 2; set_count_log >= 0; set_count_log--)
|
for (set_count_log = dct_length_log - 2; set_count_log >= 0; set_count_log--)
|
||||||
{
|
{
|
||||||
/* Initialization for the loop over sets at the current size */
|
/* Initialization for the loop over sets at the current size */
|
||||||
/* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */
|
set_span = dct_length >> set_count_log;
|
||||||
set_span = shr(dct_length, set_count_log);
|
set_count = 1 << set_count_log;
|
||||||
|
half_span = set_span >> 1;
|
||||||
set_count = shl(1, set_count_log);
|
in_ptr = in_buffer;
|
||||||
next_in_base = in_buffer;
|
out_ptr = (set_count_log == 0) ? output : out_buffer;
|
||||||
if (set_count_log == 0)
|
cos_msin_ptr = *table_ptr_ptr++;
|
||||||
next_out_base = output;
|
|
||||||
else
|
|
||||||
next_out_base = out_buffer;
|
|
||||||
|
|
||||||
/* Loop over all the sets of this size */
|
/* Loop over all the sets of this size */
|
||||||
for (sets_left = set_count; sets_left > 0; sets_left--)
|
for (sets_left = set_count; sets_left > 0; sets_left--)
|
||||||
{
|
{
|
||||||
/* Set up the pointers for the current set */
|
|
||||||
in_ptr_low = next_in_base;
|
|
||||||
temp = shr(set_span, 1);
|
|
||||||
in_ptr_high = in_ptr_low + temp;
|
|
||||||
next_in_base += set_span;
|
|
||||||
out_ptr_low = next_out_base;
|
|
||||||
next_out_base += set_span;
|
|
||||||
out_ptr_high = next_out_base;
|
|
||||||
cos_msin_ptr = *table_ptr_ptr;
|
|
||||||
|
|
||||||
/* Loop over all the butterfly pairs in the current set */
|
/* Loop over all the butterfly pairs in the current set */
|
||||||
do
|
for (i = 0; i < half_span; i += 2)
|
||||||
{
|
{
|
||||||
in_low_even = *in_ptr_low++;
|
in_low_even = in_ptr[i];
|
||||||
in_low_odd = *in_ptr_low++;
|
in_low_odd = in_ptr[i + 1];
|
||||||
in_high_even = *in_ptr_high++;
|
in_high_even = in_ptr[half_span + i];
|
||||||
in_high_odd = *in_ptr_high++;
|
in_high_odd = in_ptr[half_span + i + 1];
|
||||||
cos_even = cos_msin_ptr[0].cosine;
|
|
||||||
msin_even = cos_msin_ptr[0].minus_sine;
|
|
||||||
cos_odd = cos_msin_ptr[1].cosine;
|
|
||||||
msin_odd = cos_msin_ptr[1].minus_sine;
|
|
||||||
cos_msin_ptr += 2;
|
|
||||||
|
|
||||||
sum = 0L;
|
cos_even = cos_msin_ptr[i].cosine;
|
||||||
sum = L_mac(sum, cos_even, in_low_even);
|
msin_even = cos_msin_ptr[i].minus_sine;
|
||||||
sum = L_mac(sum, negate(msin_even), in_high_even);
|
cos_odd = cos_msin_ptr[i + 1].cosine;
|
||||||
out_low_even = xround(L_shl(sum, 1));
|
msin_odd = cos_msin_ptr[i + 1].minus_sine;
|
||||||
|
|
||||||
sum = 0L;
|
sum = L_mult(cos_even, in_low_even);
|
||||||
sum = L_mac(sum, msin_even, in_low_even);
|
sum = L_mac(sum, -msin_even, in_high_even);
|
||||||
|
out_ptr[i] = xround(L_shl(sum, 1));
|
||||||
|
|
||||||
|
sum = L_mult(msin_even, in_low_even);
|
||||||
sum = L_mac(sum, cos_even, in_high_even);
|
sum = L_mac(sum, cos_even, in_high_even);
|
||||||
out_high_even = xround(L_shl(sum, 1));
|
out_ptr[set_span - 1 - i] = xround(L_shl(sum, 1));
|
||||||
|
|
||||||
sum = 0L;
|
sum = L_mult(cos_odd, in_low_odd);
|
||||||
sum = L_mac(sum, cos_odd, in_low_odd);
|
|
||||||
sum = L_mac(sum, msin_odd, in_high_odd);
|
sum = L_mac(sum, msin_odd, in_high_odd);
|
||||||
out_low_odd = xround(L_shl(sum, 1));
|
out_ptr[i + 1] = xround(L_shl(sum, 1));
|
||||||
|
|
||||||
sum = 0L;
|
sum = L_mult(msin_odd, in_low_odd);
|
||||||
sum = L_mac(sum, msin_odd, in_low_odd);
|
sum = L_mac(sum, -cos_odd, in_high_odd);
|
||||||
sum = L_mac(sum, negate(cos_odd), in_high_odd);
|
out_ptr[set_span - 2 - i] = xround(L_shl(sum, 1));
|
||||||
out_high_odd = xround(L_shl(sum, 1));
|
|
||||||
|
|
||||||
*out_ptr_low++ = out_low_even;
|
|
||||||
*--out_ptr_high = out_high_even;
|
|
||||||
*out_ptr_low++ = out_low_odd;
|
|
||||||
*--out_ptr_high = out_high_odd;
|
|
||||||
}
|
}
|
||||||
while (out_ptr_low < out_ptr_high);
|
in_ptr += set_span;
|
||||||
|
out_ptr += set_span;
|
||||||
}
|
}
|
||||||
/* Swap input and output buffers for next time */
|
/* Swap input and output buffers for next time */
|
||||||
buffer_swap = in_buffer;
|
buffer_swap = in_buffer;
|
||||||
in_buffer = out_buffer;
|
in_buffer = out_buffer;
|
||||||
out_buffer = buffer_swap;
|
out_buffer = buffer_swap;
|
||||||
|
index++;
|
||||||
index = add(index, 1);
|
|
||||||
table_ptr_ptr++;
|
|
||||||
}
|
}
|
||||||
/* ADD IN BIAS FOR OUTPUT */
|
/* Add in bias for output */
|
||||||
if (dct_length == DCT_LENGTH)
|
if (dct_length == DCT_LENGTH)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 320; i++)
|
for (i = 0; i < DCT_LENGTH; i++)
|
||||||
{
|
{
|
||||||
sum = L_add(output[i], syn_bias_7khz[i]);
|
sum = L_add(output[i], syn_bias_7khz[i]);
|
||||||
acca = L_sub(sum, 32767);
|
output[i] = saturate(sum);
|
||||||
if (acca > 0)
|
|
||||||
sum = 32767L;
|
|
||||||
acca = L_add(sum, 32768L);
|
|
||||||
if (acca < 0)
|
|
||||||
sum = -32768L;
|
|
||||||
output[i] = (int16_t) sum;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: dct4_s.h,v 1.4 2008/09/25 15:56:31 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -196,11 +194,9 @@ static const int16_t max_dither[MAX_DCT_LENGTH] =
|
||||||
for (index = 0;index < length;index++)
|
for (index = 0;index < length;index++)
|
||||||
{
|
{
|
||||||
angle = scale * ((double)index + 0.5);
|
angle = scale * ((double)index + 0.5);
|
||||||
table[index].cosine = (short) (FTOI((18427)* cos(angle)));
|
table[index].cosine = (int16_t) (FTOI((18427)* cos(angle)));
|
||||||
table[index].minus_sine = (short) (FTOI((18427)*(-sin(angle))));
|
table[index].minus_sine = (int16_t) (FTOI((18427)*(-sin(angle))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
static const cos_msin_t s_cos_msin_2[DCT_LENGTH_DIV_32] =
|
static const cos_msin_t s_cos_msin_2[DCT_LENGTH_DIV_32] =
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C)2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: decoder.c,v 1.21 2008/11/21 15:30:22 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -94,9 +92,7 @@ static void decoder(g722_1_decode_state_t *s,
|
||||||
int16_t old_decoder_mlt_coefs[],
|
int16_t old_decoder_mlt_coefs[],
|
||||||
int frame_error_flag);
|
int frame_error_flag);
|
||||||
|
|
||||||
/***************************************************************************
|
/* Decodes the out_words into MLT coefs using G.722.1 Annex C */
|
||||||
Description: Decodes the out_words into mlt coefs using G.722.1 Annex C
|
|
||||||
***************************************************************************/
|
|
||||||
void decoder(g722_1_decode_state_t *s,
|
void decoder(g722_1_decode_state_t *s,
|
||||||
int16_t number_of_regions,
|
int16_t number_of_regions,
|
||||||
int16_t decoder_mlt_coefs[],
|
int16_t decoder_mlt_coefs[],
|
||||||
|
@ -109,11 +105,11 @@ void decoder(g722_1_decode_state_t *s,
|
||||||
int16_t absolute_region_power_index[MAX_NUMBER_OF_REGIONS];
|
int16_t absolute_region_power_index[MAX_NUMBER_OF_REGIONS];
|
||||||
int16_t decoder_power_categories[MAX_NUMBER_OF_REGIONS];
|
int16_t decoder_power_categories[MAX_NUMBER_OF_REGIONS];
|
||||||
int16_t decoder_category_balances[MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES - 1];
|
int16_t decoder_category_balances[MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES - 1];
|
||||||
uint16_t categorization_control;
|
|
||||||
int16_t num_categorization_control_bits;
|
int16_t num_categorization_control_bits;
|
||||||
int16_t num_categorization_control_possibilities;
|
int16_t num_categorization_control_possibilities;
|
||||||
int16_t number_of_coefs;
|
int16_t number_of_coefs;
|
||||||
int16_t number_of_valid_coefs;
|
int16_t number_of_valid_coefs;
|
||||||
|
uint16_t categorization_control;
|
||||||
|
|
||||||
number_of_valid_coefs = number_of_regions*REGION_SIZE;
|
number_of_valid_coefs = number_of_regions*REGION_SIZE;
|
||||||
|
|
||||||
|
@ -184,9 +180,7 @@ void decoder(g722_1_decode_state_t *s,
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
/***************************************************************************
|
/* Recover differential_region_power_index from code bits */
|
||||||
Description: Recover differential_region_power_index from code bits
|
|
||||||
***************************************************************************/
|
|
||||||
static void decode_envelope(g722_1_decode_state_t *s,
|
static void decode_envelope(g722_1_decode_state_t *s,
|
||||||
int16_t number_of_regions,
|
int16_t number_of_regions,
|
||||||
int16_t *decoder_region_standard_deviation,
|
int16_t *decoder_region_standard_deviation,
|
||||||
|
@ -262,7 +256,7 @@ static void decode_envelope(g722_1_decode_state_t *s,
|
||||||
while ((i >= 0) && ((temp1 >= 0) || (temp2 > 0)))
|
while ((i >= 0) && ((temp1 >= 0) || (temp2 > 0)))
|
||||||
{
|
{
|
||||||
i = sub(i, 1);
|
i = sub(i, 1);
|
||||||
temp = shr(temp, 1);
|
temp >>= 1;
|
||||||
max_index = sub(max_index, 2);
|
max_index = sub(max_index, 2);
|
||||||
temp1 = sub(temp, 8);
|
temp1 = sub(temp, 8);
|
||||||
temp2 = sub(max_index, 28);
|
temp2 = sub(max_index, 28);
|
||||||
|
@ -365,12 +359,12 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s,
|
||||||
if (g722_1_bitstream_get(&s->bitstream, &(s->code_ptr), 1) == 0)
|
if (g722_1_bitstream_get(&s->bitstream, &(s->code_ptr), 1) == 0)
|
||||||
{
|
{
|
||||||
temp = shl(index, 1);
|
temp = shl(index, 1);
|
||||||
index = (int16_t) *(decoder_table_ptr + temp);
|
index = decoder_table_ptr[temp];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
temp = shl(index, 1);
|
temp = shl(index, 1);
|
||||||
index = (int16_t) *(decoder_table_ptr + temp + 1);
|
index = decoder_table_ptr[temp + 1];
|
||||||
}
|
}
|
||||||
s->number_of_bits_left--;
|
s->number_of_bits_left--;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +400,7 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s,
|
||||||
{
|
{
|
||||||
if ((signs_index & bit) == 0)
|
if ((signs_index & bit) == 0)
|
||||||
decoder_mlt_value = negate(decoder_mlt_value);
|
decoder_mlt_value = negate(decoder_mlt_value);
|
||||||
bit = shr(bit, 1);
|
bit >>= 1;
|
||||||
}
|
}
|
||||||
*decoder_mlt_ptr++ = decoder_mlt_value;
|
*decoder_mlt_ptr++ = decoder_mlt_value;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +434,7 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s,
|
||||||
if (*decoder_mlt_ptr == 0)
|
if (*decoder_mlt_ptr == 0)
|
||||||
{
|
{
|
||||||
*decoder_mlt_ptr = ((random_word & 1) == 0) ? noifillneg : noifillpos;
|
*decoder_mlt_ptr = ((random_word & 1) == 0) ? noifillneg : noifillpos;
|
||||||
random_word = shr(random_word, 1);
|
random_word >>= 1;
|
||||||
}
|
}
|
||||||
/* pointer arithmetic */
|
/* pointer arithmetic */
|
||||||
decoder_mlt_ptr++;
|
decoder_mlt_ptr++;
|
||||||
|
@ -451,7 +445,7 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s,
|
||||||
if (*decoder_mlt_ptr == 0)
|
if (*decoder_mlt_ptr == 0)
|
||||||
{
|
{
|
||||||
*decoder_mlt_ptr = ((random_word & 1) == 0) ? noifillneg : noifillpos;
|
*decoder_mlt_ptr = ((random_word & 1) == 0) ? noifillneg : noifillpos;
|
||||||
random_word = shr(random_word,1);
|
random_word >>= 1;
|
||||||
}
|
}
|
||||||
/* pointer arithmetic */
|
/* pointer arithmetic */
|
||||||
decoder_mlt_ptr++;
|
decoder_mlt_ptr++;
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: decoderf.c,v 1.22 2008/11/21 15:30:22 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -33,6 +31,7 @@
|
||||||
#include "huff_tab.h"
|
#include "huff_tab.h"
|
||||||
#include "tables.h"
|
#include "tables.h"
|
||||||
#include "bitstream.h"
|
#include "bitstream.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
#if !defined(G722_1_USE_FIXED_POINT)
|
#if !defined(G722_1_USE_FIXED_POINT)
|
||||||
|
|
||||||
|
@ -84,12 +83,12 @@ static void decoder(g722_1_decode_state_t *s,
|
||||||
int absolute_region_power_index[MAX_NUMBER_OF_REGIONS];
|
int absolute_region_power_index[MAX_NUMBER_OF_REGIONS];
|
||||||
int decoder_power_categories[MAX_NUMBER_OF_REGIONS];
|
int decoder_power_categories[MAX_NUMBER_OF_REGIONS];
|
||||||
int decoder_category_balances[MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES - 1];
|
int decoder_category_balances[MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES - 1];
|
||||||
int rate_control;
|
|
||||||
int num_categorization_control_bits;
|
int num_categorization_control_bits;
|
||||||
int num_categorization_control_possibilities;
|
int num_categorization_control_possibilities;
|
||||||
int number_of_coefs;
|
int number_of_coefs;
|
||||||
int number_of_valid_coefs;
|
int number_of_valid_coefs;
|
||||||
int rmlt_scale_factor;
|
int rmlt_scale_factor;
|
||||||
|
int rate_control;
|
||||||
|
|
||||||
number_of_valid_coefs = s->number_of_regions*REGION_SIZE;
|
number_of_valid_coefs = s->number_of_regions*REGION_SIZE;
|
||||||
|
|
||||||
|
@ -451,7 +450,7 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s,
|
||||||
|
|
||||||
if (category == NUM_CATEGORIES - 1)
|
if (category == NUM_CATEGORIES - 1)
|
||||||
{
|
{
|
||||||
noifillpos = standard_deviation*0.70711f;
|
noifillpos = standard_deviation*0.70711;
|
||||||
noifillneg = -noifillpos;
|
noifillneg = -noifillpos;
|
||||||
|
|
||||||
/* This assumes region_size = 20 */
|
/* This assumes region_size = 20 */
|
||||||
|
@ -555,27 +554,21 @@ static void error_handling(int number_of_coefs,
|
||||||
float *decoder_mlt_coefs,
|
float *decoder_mlt_coefs,
|
||||||
float *old_decoder_mlt_coefs)
|
float *old_decoder_mlt_coefs)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
/* If both the current and previous frames are errored,
|
/* If both the current and previous frames are errored,
|
||||||
set the mlt coefficients to 0. If only the current frame
|
set the mlt coefficients to 0. If only the current frame
|
||||||
is errored, repeat the previous frame's MLT coefficients. */
|
is errored, repeat the previous frame's MLT coefficients. */
|
||||||
if (*frame_error_flag)
|
if (*frame_error_flag)
|
||||||
{
|
{
|
||||||
for (i = 0; i < number_of_valid_coefs; i++)
|
vec_copyf(decoder_mlt_coefs, old_decoder_mlt_coefs, number_of_valid_coefs);
|
||||||
decoder_mlt_coefs[i] = old_decoder_mlt_coefs[i];
|
vec_zerof(old_decoder_mlt_coefs, number_of_valid_coefs);
|
||||||
for (i = 0; i < number_of_valid_coefs; i++)
|
|
||||||
old_decoder_mlt_coefs[i] = 0.0f;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Store in case the next frame has errors. */
|
/* Store in case the next frame has errors. */
|
||||||
for (i = 0; i < number_of_valid_coefs; i++)
|
vec_copyf(old_decoder_mlt_coefs, decoder_mlt_coefs, number_of_valid_coefs);
|
||||||
old_decoder_mlt_coefs[i] = decoder_mlt_coefs[i];
|
|
||||||
}
|
}
|
||||||
/* Zero out the upper 1/8 of the spectrum. */
|
/* Zero out the upper 1/8 of the spectrum. */
|
||||||
for (i = number_of_valid_coefs; i < number_of_coefs; i++)
|
vec_zerof(&decoder_mlt_coefs[number_of_valid_coefs], number_of_coefs - number_of_valid_coefs);
|
||||||
decoder_mlt_coefs[i] = 0.0f;
|
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: defs.h,v 1.16 2008/10/01 15:31:10 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MAX(a,b) (a > b ? a : b)
|
#define MAX(a,b) (a > b ? a : b)
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: encoder.c,v 1.26 2008/11/21 15:30:22 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -32,6 +30,7 @@
|
||||||
#include "huff_tab.h"
|
#include "huff_tab.h"
|
||||||
#include "tables.h"
|
#include "tables.h"
|
||||||
#include "bitstream.h"
|
#include "bitstream.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
#if defined(G722_1_USE_FIXED_POINT)
|
#if defined(G722_1_USE_FIXED_POINT)
|
||||||
|
|
||||||
|
@ -99,9 +98,8 @@ static void bits_to_words(g722_1_encode_state_t *s,
|
||||||
drp_num_bits[number_of_regions] = num_categorization_control_bits;
|
drp_num_bits[number_of_regions] = num_categorization_control_bits;
|
||||||
drp_code_bits[number_of_regions] = categorization_control;
|
drp_code_bits[number_of_regions] = categorization_control;
|
||||||
|
|
||||||
bit_count = 0;
|
|
||||||
/* These code bits are right justified. */
|
/* These code bits are right justified. */
|
||||||
for (region = 0; region <= number_of_regions; region++)
|
for (bit_count = 0, region = 0; region <= number_of_regions; region++)
|
||||||
{
|
{
|
||||||
g722_1_bitstream_put(&s->bitstream, &out_code, drp_code_bits[region], drp_num_bits[region]);
|
g722_1_bitstream_put(&s->bitstream, &out_code, drp_code_bits[region], drp_num_bits[region]);
|
||||||
bit_count += drp_num_bits[region];
|
bit_count += drp_num_bits[region];
|
||||||
|
@ -247,14 +245,11 @@ void adjust_abs_region_power_index(int16_t *absolute_region_power_index,
|
||||||
|
|
||||||
for (region = 0; region < number_of_regions; region++)
|
for (region = 0; region < number_of_regions; region++)
|
||||||
{
|
{
|
||||||
n = sub(absolute_region_power_index[region], 39);
|
n = sub(absolute_region_power_index[region], 39) >> 1;
|
||||||
n = shr(n, 1);
|
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
{
|
{
|
||||||
temp = (int16_t) L_mult0(region, REGION_SIZE);
|
temp = (int16_t) L_mult0(region, REGION_SIZE);
|
||||||
|
|
||||||
raw_mlt_ptr = &mlt_coefs[temp];
|
raw_mlt_ptr = &mlt_coefs[temp];
|
||||||
|
|
||||||
for (i = 0; i < REGION_SIZE; i++)
|
for (i = 0; i < REGION_SIZE; i++)
|
||||||
{
|
{
|
||||||
acca = L_shl(*raw_mlt_ptr, 16);
|
acca = L_shl(*raw_mlt_ptr, 16);
|
||||||
|
@ -264,8 +259,7 @@ void adjust_abs_region_power_index(int16_t *absolute_region_power_index,
|
||||||
*raw_mlt_ptr++ = (int16_t) acca;
|
*raw_mlt_ptr++ = (int16_t) acca;
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = sub(absolute_region_power_index[region], shl(n, 1));
|
absolute_region_power_index[region] = sub(absolute_region_power_index[region], shl(n, 1));
|
||||||
absolute_region_power_index[region] = temp;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,7 +275,6 @@ static int16_t compute_region_powers(int16_t *mlt_coefs,
|
||||||
{
|
{
|
||||||
int16_t *input_ptr;
|
int16_t *input_ptr;
|
||||||
int32_t long_accumulator;
|
int32_t long_accumulator;
|
||||||
int16_t itemp1;
|
|
||||||
int16_t power_shift;
|
int16_t power_shift;
|
||||||
int16_t region;
|
int16_t region;
|
||||||
int16_t j;
|
int16_t j;
|
||||||
|
@ -295,12 +288,8 @@ static int16_t compute_region_powers(int16_t *mlt_coefs,
|
||||||
input_ptr = mlt_coefs;
|
input_ptr = mlt_coefs;
|
||||||
for (region = 0; region < number_of_regions; region++)
|
for (region = 0; region < number_of_regions; region++)
|
||||||
{
|
{
|
||||||
long_accumulator = 0;
|
long_accumulator = vec_dot_prodi16(input_ptr, input_ptr, REGION_SIZE);
|
||||||
for (j = 0; j < REGION_SIZE; j++)
|
input_ptr += REGION_SIZE;
|
||||||
{
|
|
||||||
itemp1 = *input_ptr++;
|
|
||||||
long_accumulator = L_mac0(long_accumulator, itemp1, itemp1);
|
|
||||||
}
|
|
||||||
|
|
||||||
power_shift = 0;
|
power_shift = 0;
|
||||||
acca = long_accumulator & 0x7FFF0000L;
|
acca = long_accumulator & 0x7FFF0000L;
|
||||||
|
@ -348,7 +337,7 @@ static int16_t compute_region_powers(int16_t *mlt_coefs,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The MLT is currently scaled too low by the factor
|
/* The MLT is currently scaled too low by the factor
|
||||||
ENCODER_SCALE_FACTOR(=18318)/32768 * (1./sqrt(160).
|
ENCODER_SCALE_FACTOR(=18318)/32768 * (1.0/sqrt(160).
|
||||||
This is the ninth power of 1 over the square root of 2.
|
This is the ninth power of 1 over the square root of 2.
|
||||||
So later we will add ESF_ADJUSTMENT_TO_RMS_INDEX (now 9)
|
So later we will add ESF_ADJUSTMENT_TO_RMS_INDEX (now 9)
|
||||||
to drp_code_bits[0]. */
|
to drp_code_bits[0]. */
|
||||||
|
@ -520,7 +509,8 @@ static int16_t vector_huffman(int16_t category,
|
||||||
int16_t num_vecs;
|
int16_t num_vecs;
|
||||||
int16_t kmax;
|
int16_t kmax;
|
||||||
int16_t kmax_plus_one;
|
int16_t kmax_plus_one;
|
||||||
int16_t index,signs_index;
|
int16_t index;
|
||||||
|
int16_t signs_index;
|
||||||
const int16_t *bitcount_table_ptr;
|
const int16_t *bitcount_table_ptr;
|
||||||
const uint16_t *code_table_ptr;
|
const uint16_t *code_table_ptr;
|
||||||
int32_t code_bits;
|
int32_t code_bits;
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: encoderf.c,v 1.22 2008/11/21 15:30:22 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -33,6 +31,7 @@
|
||||||
#include "huff_tab.h"
|
#include "huff_tab.h"
|
||||||
#include "tables.h"
|
#include "tables.h"
|
||||||
#include "bitstream.h"
|
#include "bitstream.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
#if !defined(G722_1_USE_FIXED_POINT)
|
#if !defined(G722_1_USE_FIXED_POINT)
|
||||||
|
|
||||||
|
@ -218,7 +217,6 @@ static int compute_region_powers(int number_of_regions,
|
||||||
float *input_ptr;
|
float *input_ptr;
|
||||||
int iterations;
|
int iterations;
|
||||||
float ftemp0;
|
float ftemp0;
|
||||||
float ftemp1;
|
|
||||||
int index;
|
int index;
|
||||||
int index_min;
|
int index_min;
|
||||||
int index_max;
|
int index_max;
|
||||||
|
@ -230,13 +228,9 @@ static int compute_region_powers(int number_of_regions,
|
||||||
input_ptr = mlt_coefs;
|
input_ptr = mlt_coefs;
|
||||||
for (region = 0; region < number_of_regions; region++)
|
for (region = 0; region < number_of_regions; region++)
|
||||||
{
|
{
|
||||||
ftemp0 = 0.0f;
|
ftemp0 = vec_dot_prodf(input_ptr, input_ptr, REGION_SIZE);
|
||||||
for (j = 0; j < REGION_SIZE; j++)
|
|
||||||
{
|
|
||||||
ftemp1 = *input_ptr++;
|
|
||||||
ftemp0 += ftemp1*ftemp1;
|
|
||||||
}
|
|
||||||
ftemp0 *= REGION_SIZE_INVERSE;
|
ftemp0 *= REGION_SIZE_INVERSE;
|
||||||
|
input_ptr += REGION_SIZE;
|
||||||
|
|
||||||
index_min = 0;
|
index_min = 0;
|
||||||
index_max = REGION_POWER_TABLE_SIZE;
|
index_max = REGION_POWER_TABLE_SIZE;
|
||||||
|
@ -260,7 +254,7 @@ static int compute_region_powers(int number_of_regions,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The MLT is currently scaled too low by the factor
|
/* The MLT is currently scaled too low by the factor
|
||||||
ENCODER_SCALE_FACTOR(=18318)/32768 * (1./sqrt(160).
|
ENCODER_SCALE_FACTOR(=18318)/32768 * (1.0/sqrt(160).
|
||||||
This is the ninth power of 1 over the square root of 2.
|
This is the ninth power of 1 over the square root of 2.
|
||||||
So later we will add ESF_ADJUSTMENT_TO_RMS_INDEX (now 9)
|
So later we will add ESF_ADJUSTMENT_TO_RMS_INDEX (now 9)
|
||||||
to drp_code_bits[0]. */
|
to drp_code_bits[0]. */
|
||||||
|
@ -448,7 +442,7 @@ static int vector_huffman(int category,
|
||||||
number_of_non_zero = 0;
|
number_of_non_zero = 0;
|
||||||
for (j = 0; j < vec_dim; j++)
|
for (j = 0; j < vec_dim; j++)
|
||||||
{
|
{
|
||||||
k = (int) (fabs(*raw_mlt_ptr) * inv_of_step_size_times_std_dev + dead_zone[category]);
|
k = (int) (fabs(*raw_mlt_ptr)*inv_of_step_size_times_std_dev + dead_zone[category]);
|
||||||
if (k != 0)
|
if (k != 0)
|
||||||
{
|
{
|
||||||
number_of_non_zero++;
|
number_of_non_zero++;
|
||||||
|
@ -458,12 +452,12 @@ static int vector_huffman(int category,
|
||||||
if (k > kmax)
|
if (k > kmax)
|
||||||
k = kmax;
|
k = kmax;
|
||||||
}
|
}
|
||||||
index = index*(kmax_plus_one) + k;
|
index = index*kmax_plus_one + k;
|
||||||
raw_mlt_ptr++;
|
raw_mlt_ptr++;
|
||||||
}
|
}
|
||||||
|
|
||||||
code_bits = *(code_table_ptr + index);
|
code_bits = code_table_ptr[index];
|
||||||
number_of_code_bits = *(bitcount_table_ptr + index) + number_of_non_zero;
|
number_of_code_bits = bitcount_table_ptr[index] + number_of_non_zero;
|
||||||
number_of_region_bits += number_of_code_bits;
|
number_of_region_bits += number_of_code_bits;
|
||||||
|
|
||||||
code_bits = (code_bits << number_of_non_zero) + signs_index;
|
code_bits = (code_bits << number_of_non_zero) + signs_index;
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
|
||||||
* $Id: g722_1.h.in,v 1.1.1.1 2008/09/20 09:47:17 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: g722_1.h,v 1.14 2008/10/17 13:18:21 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_G722_1_G722_1_H_)
|
#if !defined(_G722_1_G722_1_H_)
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: version.h.in,v 1.2 2008/09/20 16:52:51 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_G722_1_VERSION_H_)
|
#if !defined(_G722_1_VERSION_H_)
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: huff_tab.c,v 1.7 2008/09/30 14:06:40 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: huff_tab.h,v 1.4 2008/09/30 14:06:40 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define REGION_POWER_STEPSIZE_DB 3.010299957
|
#define REGION_POWER_STEPSIZE_DB 3.010299957
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: make_dct4_tables.c,v 1.2 2008/10/02 11:43:54 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -29,7 +27,11 @@
|
||||||
|
|
||||||
#include "g722_1/g722_1.h"
|
#include "g722_1/g722_1.h"
|
||||||
|
|
||||||
|
#if defined(PI)
|
||||||
|
#undef PI
|
||||||
|
#endif
|
||||||
#define PI 3.141592653589793238462
|
#define PI 3.141592653589793238462
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
||||||
static void set_up_one_table(int length)
|
static void set_up_one_table(int length)
|
||||||
|
@ -99,6 +101,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
for (i = 0; i <= length_log; i++)
|
for (i = 0; i <= length_log; i++)
|
||||||
set_up_one_table(dct_size << i);
|
set_up_one_table(dct_size << i);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
/*- End of file ------------------------------------------------------------*/
|
/*- End of file ------------------------------------------------------------*/
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: make_tables.c,v 1.5 2008/11/21 15:30:22 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -37,6 +35,7 @@
|
||||||
#undef PI
|
#undef PI
|
||||||
#endif
|
#endif
|
||||||
#define PI 3.141592653589793238462
|
#define PI 3.141592653589793238462
|
||||||
|
|
||||||
/* These may have been defined in the main header for the codec, so we clear out
|
/* These may have been defined in the main header for the codec, so we clear out
|
||||||
any pre-existing definitions here. */
|
any pre-existing definitions here. */
|
||||||
#if defined(ENCODER_SCALE_FACTOR)
|
#if defined(ENCODER_SCALE_FACTOR)
|
||||||
|
@ -124,7 +123,7 @@ static void generate_sam2coef_tables(void)
|
||||||
for (i = 0; i < DCT_LENGTH; i++)
|
for (i = 0; i < DCT_LENGTH; i++)
|
||||||
{
|
{
|
||||||
angle = (PI/2.0)*((double) i + 0.5)/(double) DCT_LENGTH;
|
angle = (PI/2.0)*((double) i + 0.5)/(double) DCT_LENGTH;
|
||||||
printf(" %.15e,\n", sin(angle));
|
printf(" %.15ef,\n", sin(angle));
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
|
||||||
|
@ -132,7 +131,7 @@ static void generate_sam2coef_tables(void)
|
||||||
for (i = 0; i < MAX_DCT_LENGTH; i++)
|
for (i = 0; i < MAX_DCT_LENGTH; i++)
|
||||||
{
|
{
|
||||||
angle = (PI/2.0)*((double) i + 0.5)/(double) MAX_DCT_LENGTH;
|
angle = (PI/2.0)*((double) i + 0.5)/(double) MAX_DCT_LENGTH;
|
||||||
printf(" %.15le,\n", sin(angle));
|
printf(" %.15ef,\n", sin(angle));
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
|
||||||
|
@ -180,7 +179,7 @@ static void generate_coef2sam_tables(void)
|
||||||
for (i = 0; i < DCT_LENGTH; i++)
|
for (i = 0; i < DCT_LENGTH; i++)
|
||||||
{
|
{
|
||||||
angle = (PI/2.0)*((double) i + 0.5)/(double) DCT_LENGTH;
|
angle = (PI/2.0)*((double) i + 0.5)/(double) DCT_LENGTH;
|
||||||
printf(" %.15e,\n", sin(angle));
|
printf(" %.15ef,\n", sin(angle));
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
|
||||||
|
@ -188,7 +187,7 @@ static void generate_coef2sam_tables(void)
|
||||||
for (i = 0; i < MAX_DCT_LENGTH; i++)
|
for (i = 0; i < MAX_DCT_LENGTH; i++)
|
||||||
{
|
{
|
||||||
angle = (PI/2.0)*((double) i + 0.5)/(double) MAX_DCT_LENGTH;
|
angle = (PI/2.0)*((double) i + 0.5)/(double) MAX_DCT_LENGTH;
|
||||||
printf(" %.15e,\n", sin(angle));
|
printf(" %.15ef,\n", sin(angle));
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
|
||||||
|
@ -218,7 +217,7 @@ int main(int argc, char *argv[])
|
||||||
for (i = 0; i < REGION_POWER_TABLE_SIZE; i++)
|
for (i = 0; i < REGION_POWER_TABLE_SIZE; i++)
|
||||||
{
|
{
|
||||||
value = pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(i - REGION_POWER_TABLE_NUM_NEGATIVES));
|
value = pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(i - REGION_POWER_TABLE_NUM_NEGATIVES));
|
||||||
printf(" %.15e,\n", sqrt(value));
|
printf(" %.15ef,\n", sqrt(value));
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
|
||||||
|
@ -226,7 +225,7 @@ int main(int argc, char *argv[])
|
||||||
for (i = 0; i < REGION_POWER_TABLE_SIZE; i++)
|
for (i = 0; i < REGION_POWER_TABLE_SIZE; i++)
|
||||||
{
|
{
|
||||||
value = pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(i - REGION_POWER_TABLE_NUM_NEGATIVES));
|
value = pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(i - REGION_POWER_TABLE_NUM_NEGATIVES));
|
||||||
printf(" %.15e,\n", 1.0/sqrt(value));
|
printf(" %.15ef,\n", 1.0/sqrt(value));
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
|
||||||
|
@ -259,14 +258,14 @@ int main(int argc, char *argv[])
|
||||||
printf("const float step_size[NUM_CATEGORIES] =\n{\n");
|
printf("const float step_size[NUM_CATEGORIES] =\n{\n");
|
||||||
for (i = 0; i < NUM_CATEGORIES; i++)
|
for (i = 0; i < NUM_CATEGORIES; i++)
|
||||||
{
|
{
|
||||||
printf(" %.15e,\n", step_size[i]);
|
printf(" %.15ef,\n", step_size[i]);
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
|
||||||
printf("const float step_size_inverse_table[NUM_CATEGORIES] =\n{\n");
|
printf("const float step_size_inverse_table[NUM_CATEGORIES] =\n{\n");
|
||||||
for (i = 0; i < NUM_CATEGORIES; i++)
|
for (i = 0; i < NUM_CATEGORIES; i++)
|
||||||
{
|
{
|
||||||
printf(" %.15e,\n", 1.0/step_size[i]);
|
printf(" %.15ef,\n", 1.0/step_size[i]);
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
|
||||||
|
@ -275,7 +274,7 @@ int main(int argc, char *argv[])
|
||||||
for (i = 0; i < REGION_POWER_TABLE_SIZE; i++)
|
for (i = 0; i < REGION_POWER_TABLE_SIZE; i++)
|
||||||
{
|
{
|
||||||
value = pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(i - REGION_POWER_TABLE_NUM_NEGATIVES));
|
value = pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(i - REGION_POWER_TABLE_NUM_NEGATIVES));
|
||||||
printf(" %.15e,\n", value);
|
printf(" %.15ef,\n", value);
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
|
||||||
|
@ -283,9 +282,10 @@ int main(int argc, char *argv[])
|
||||||
for (i = 0; i < REGION_POWER_TABLE_SIZE - 1; i++)
|
for (i = 0; i < REGION_POWER_TABLE_SIZE - 1; i++)
|
||||||
{
|
{
|
||||||
value = (float) pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(0.5 + (i - REGION_POWER_TABLE_NUM_NEGATIVES)));
|
value = (float) pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(0.5 + (i - REGION_POWER_TABLE_NUM_NEGATIVES)));
|
||||||
printf(" %.15e,\n", value);
|
printf(" %.15ef,\n", value);
|
||||||
}
|
}
|
||||||
printf("};\n\n");
|
printf("};\n\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
/*- End of function --------------------------------------------------------*/
|
/*- End of function --------------------------------------------------------*/
|
||||||
/*- End of file ------------------------------------------------------------*/
|
/*- End of file ------------------------------------------------------------*/
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: sam2coef.c,v 1.12 2008/10/02 11:43:54 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -29,17 +27,16 @@
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "sam2coef.h"
|
#include "sam2coef.h"
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
/************************************************************************************
|
/* Convert Samples to Reversed MLT (Modulated Lapped Transform) Coefficients
|
||||||
Purpose: Convert Samples to Reversed MLT (Modulated Lapped Transform) Coefficients
|
|
||||||
|
|
||||||
The "Reversed MLT" is an overlapped block transform which uses even symmetry
|
The "Reversed MLT" is an overlapped block transform which uses even symmetry
|
||||||
on the left, odd symmetry on the right and a Type IV DCT as the block transform.
|
on the left, odd symmetry on the right and a Type IV DCT as the block transform.
|
||||||
It is thus similar to a MLT which uses odd symmetry on the left, even symmetry
|
It is thus similar to a MLT which uses odd symmetry on the left, even symmetry
|
||||||
on the right and a Type IV DST as the block transform. In fact, it is equivalent
|
on the right and a Type IV DST as the block transform. In fact, it is equivalent
|
||||||
to reversing the order of the samples, performing an MLT and then negating all
|
to reversing the order of the samples, performing an MLT and then negating all
|
||||||
the even-numbered coefficients.
|
the even-numbered coefficients. */
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#if defined(G722_1_USE_FIXED_POINT)
|
#if defined(G722_1_USE_FIXED_POINT)
|
||||||
int16_t samples_to_rmlt_coefs(const int16_t new_samples[],
|
int16_t samples_to_rmlt_coefs(const int16_t new_samples[],
|
||||||
|
@ -62,34 +59,26 @@ int16_t samples_to_rmlt_coefs(const int16_t new_samples[],
|
||||||
|
|
||||||
half_dct_length = dct_length >> 1;
|
half_dct_length = dct_length >> 1;
|
||||||
|
|
||||||
if (dct_length == DCT_LENGTH)
|
win = (dct_length == DCT_LENGTH) ? samples_to_rmlt_window : max_samples_to_rmlt_window;
|
||||||
win = samples_to_rmlt_window;
|
|
||||||
else
|
|
||||||
win = max_samples_to_rmlt_window;
|
|
||||||
/* Get the first half of the windowed samples */
|
/* Get the first half of the windowed samples */
|
||||||
last = half_dct_length - 1;
|
last = half_dct_length - 1;
|
||||||
for (i = 0; i < half_dct_length; i++)
|
for (i = 0; i < half_dct_length; i++)
|
||||||
{
|
{
|
||||||
acca = 0L;
|
acca = L_mult(win[last - i], old_samples[last - i]);
|
||||||
acca = L_mac(acca, win[last - i], old_samples[last - i]);
|
|
||||||
acca = L_mac(acca, win[half_dct_length + i], old_samples[half_dct_length + i]);
|
acca = L_mac(acca, win[half_dct_length + i], old_samples[half_dct_length + i]);
|
||||||
temp = xround(acca);
|
windowed_data[i] = xround(acca);
|
||||||
windowed_data[i] = temp;
|
|
||||||
}
|
}
|
||||||
/* Get the second half of the windowed samples */
|
/* Get the second half of the windowed samples */
|
||||||
last = dct_length - 1;
|
last = dct_length - 1;
|
||||||
for (i = 0; i < half_dct_length; i++)
|
for (i = 0; i < half_dct_length; i++)
|
||||||
{
|
{
|
||||||
acca = 0L;
|
acca = L_mult(win[last - i], new_samples[i]);
|
||||||
acca = L_mac(acca, win[last - i], new_samples[i]);
|
|
||||||
acca = L_mac(acca, negate(win[i]), new_samples[last - i]);
|
acca = L_mac(acca, negate(win[i]), new_samples[last - i]);
|
||||||
temp = xround(acca);
|
windowed_data[half_dct_length + i] = xround(acca);
|
||||||
windowed_data[half_dct_length + i] = temp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the new samples for next time, when they will be the old samples. */
|
/* Save the new samples for next time, when they will be the old samples. */
|
||||||
for (i = 0; i < dct_length; i++)
|
vec_copyi16(old_samples, new_samples, dct_length);
|
||||||
old_samples[i] = new_samples[i];
|
|
||||||
|
|
||||||
/* Calculate how many bits to shift up the input to the DCT. */
|
/* Calculate how many bits to shift up the input to the DCT. */
|
||||||
temp1 = 0;
|
temp1 = 0;
|
||||||
|
@ -156,10 +145,7 @@ void samples_to_rmlt_coefs(const float new_samples[],
|
||||||
|
|
||||||
half_dct_length = dct_length >> 1;
|
half_dct_length = dct_length >> 1;
|
||||||
|
|
||||||
if (dct_length == DCT_LENGTH)
|
win = (dct_length == DCT_LENGTH) ? samples_to_rmlt_window : max_samples_to_rmlt_window;
|
||||||
win = samples_to_rmlt_window;
|
|
||||||
else
|
|
||||||
win = max_samples_to_rmlt_window;
|
|
||||||
/* Get the first half of the windowed samples. */
|
/* Get the first half of the windowed samples. */
|
||||||
last = half_dct_length - 1;
|
last = half_dct_length - 1;
|
||||||
for (i = 0; i < half_dct_length; i++)
|
for (i = 0; i < half_dct_length; i++)
|
||||||
|
@ -177,8 +163,7 @@ void samples_to_rmlt_coefs(const float new_samples[],
|
||||||
windowed_data[half_dct_length + i] = sum;
|
windowed_data[half_dct_length + i] = sum;
|
||||||
}
|
}
|
||||||
/* Save the new samples for next time, when they will be the old samples. */
|
/* Save the new samples for next time, when they will be the old samples. */
|
||||||
for (i = 0; i < dct_length; i++)
|
vec_copyf(old_samples, new_samples, dct_length);
|
||||||
old_samples[i] = new_samples[i];
|
|
||||||
|
|
||||||
/* Perform a Type IV DCT on the windowed data to get the coefficients. */
|
/* Perform a Type IV DCT on the windowed data to get the coefficients. */
|
||||||
dct_type_iv(windowed_data, coefs, dct_length);
|
dct_type_iv(windowed_data, coefs, dct_length);
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: sam2coef.h,v 1.2 2008/10/02 11:43:54 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(G722_1_USE_FIXED_POINT)
|
#if defined(G722_1_USE_FIXED_POINT)
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: tables.c,v 1.11 2008/09/30 14:06:40 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -65,70 +63,70 @@ const int16_t int_region_standard_deviation_table[REGION_POWER_TABLE_SIZE] =
|
||||||
#else
|
#else
|
||||||
const float region_standard_deviation_table[REGION_POWER_TABLE_SIZE] =
|
const float region_standard_deviation_table[REGION_POWER_TABLE_SIZE] =
|
||||||
{
|
{
|
||||||
2.441406247570224e-04f,
|
2.441406247570224e-04,
|
||||||
3.452669826719395e-04f,
|
3.452669826719395e-04,
|
||||||
4.882812495545411e-04f,
|
4.882812495545411e-04,
|
||||||
6.905339654011486e-04f,
|
6.905339654011486e-04,
|
||||||
9.765624991900746e-04f,
|
9.765624991900746e-04,
|
||||||
1.381067930916839e-03f,
|
1.381067930916839e-03,
|
||||||
1.953124998542134e-03f,
|
1.953124998542134e-03,
|
||||||
2.762135862062757e-03f,
|
2.762135862062757e-03,
|
||||||
3.906249997408239e-03f,
|
3.906249997408239e-03,
|
||||||
5.524271724583683e-03f,
|
5.524271724583683e-03,
|
||||||
7.812499995464418e-03f,
|
7.812499995464418e-03,
|
||||||
1.104854345008369e-02f,
|
1.104854345008369e-02,
|
||||||
1.562499999222472e-02f,
|
1.562499999222472e-02,
|
||||||
2.209708690200003e-02f,
|
2.209708690200003e-02,
|
||||||
3.124999998704119e-02f,
|
3.124999998704119e-02,
|
||||||
4.419417380766535e-02f,
|
4.419417380766535e-02,
|
||||||
6.249999997926591e-02f,
|
6.249999997926591e-02,
|
||||||
8.838834762266132e-02f,
|
8.838834762266132e-02,
|
||||||
1.249999999688989e-01f,
|
1.249999999688989e-01,
|
||||||
1.767766952599839e-01f,
|
1.767766952599839e-01,
|
||||||
2.499999999585318e-01f,
|
2.499999999585318e-01,
|
||||||
3.535533905492901e-01f,
|
3.535533905492901e-01,
|
||||||
4.999999999585318e-01f,
|
4.999999999585318e-01,
|
||||||
7.071067811572251e-01f,
|
7.071067811572251e-01,
|
||||||
1.000000000000000e+00f,
|
1.000000000000000e+00,
|
||||||
1.414213562431740e+00f,
|
1.414213562431740e+00,
|
||||||
2.000000000165873e+00f,
|
2.000000000165873e+00,
|
||||||
2.828427125098059e+00f,
|
2.828427125098059e+00,
|
||||||
4.000000000663491e+00f,
|
4.000000000663491e+00,
|
||||||
5.656854250665278e+00f,
|
5.656854250665278e+00,
|
||||||
8.000000001990472e+00f,
|
8.000000001990472e+00,
|
||||||
1.131370850226887e+01f,
|
1.131370850226887e+01,
|
||||||
1.600000000530792e+01f,
|
1.600000000530792e+01,
|
||||||
2.262741700641438e+01f,
|
2.262741700641438e+01,
|
||||||
3.200000001326981e+01f,
|
3.200000001326981e+01,
|
||||||
4.525483401658204e+01f,
|
4.525483401658204e+01,
|
||||||
6.400000003184756e+01f,
|
6.400000003184756e+01,
|
||||||
9.050966804067060e+01f,
|
9.050966804067060e+01,
|
||||||
1.280000000743110e+02f,
|
1.280000000743110e+02,
|
||||||
1.810193360963542e+02f,
|
1.810193360963542e+02,
|
||||||
2.560000001698536e+02f,
|
2.560000001698536e+02,
|
||||||
3.620386722227349e+02f,
|
3.620386722227349e+02,
|
||||||
5.120000003821707e+02f,
|
5.120000003821707e+02,
|
||||||
7.240773445055215e+02f,
|
7.240773445055215e+02,
|
||||||
1.024000000849268e+03f,
|
1.024000000849268e+03,
|
||||||
1.448154689131149e+03f,
|
1.448154689131149e+03,
|
||||||
2.048000001868390e+03f,
|
2.048000001868390e+03,
|
||||||
2.896309378502505e+03f,
|
2.896309378502505e+03,
|
||||||
4.096000004076487e+03f,
|
4.096000004076487e+03,
|
||||||
5.792618757485434e+03f,
|
5.792618757485434e+03,
|
||||||
8.192000008832390e+03f,
|
8.192000008832390e+03,
|
||||||
1.158523751593169e+04f,
|
1.158523751593169e+04,
|
||||||
1.638400001902361e+04f,
|
1.638400001902361e+04,
|
||||||
2.317047503378509e+04f,
|
2.317047503378509e+04,
|
||||||
3.276800004076484e+04f,
|
3.276800004076484e+04,
|
||||||
4.634095007141347e+04f,
|
4.634095007141347e+04,
|
||||||
6.553600008696507e+04f,
|
6.553600008696507e+04,
|
||||||
9.268190015051374e+04f,
|
9.268190015051374e+04,
|
||||||
1.310720001848009e+05f,
|
1.310720001848009e+05,
|
||||||
1.853638003164007e+05f,
|
1.853638003164007e+05,
|
||||||
2.621440003913428e+05f,
|
2.621440003913428e+05,
|
||||||
3.707276006635486e+05f,
|
3.707276006635486e+05,
|
||||||
5.242880008261676e+05f,
|
5.242880008261676e+05,
|
||||||
7.414552013885899e+05f
|
7.414552013885899e+05
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -146,70 +144,70 @@ const int16_t standard_deviation_inverse_table[REGION_POWER_TABLE_SIZE] =
|
||||||
#else
|
#else
|
||||||
const float standard_deviation_inverse_table[REGION_POWER_TABLE_SIZE] =
|
const float standard_deviation_inverse_table[REGION_POWER_TABLE_SIZE] =
|
||||||
{
|
{
|
||||||
4.096000004076488e+03f,
|
4.096000004076488e+03,
|
||||||
2.896309378502504e+03f,
|
2.896309378502504e+03,
|
||||||
2.048000001868390e+03f,
|
2.048000001868390e+03,
|
||||||
1.448154689131149e+03f,
|
1.448154689131149e+03,
|
||||||
1.024000000849268e+03f,
|
1.024000000849268e+03,
|
||||||
7.240773445055215e+02f,
|
7.240773445055215e+02,
|
||||||
5.120000003821708e+02f,
|
5.120000003821708e+02,
|
||||||
3.620386722227349e+02f,
|
3.620386722227349e+02,
|
||||||
2.560000001698537e+02f,
|
2.560000001698537e+02,
|
||||||
1.810193360963542e+02f,
|
1.810193360963542e+02,
|
||||||
1.280000000743110e+02f,
|
1.280000000743110e+02,
|
||||||
9.050966804067060e+01f,
|
9.050966804067060e+01,
|
||||||
6.400000003184756e+01f,
|
6.400000003184756e+01,
|
||||||
4.525483401658203e+01f,
|
4.525483401658203e+01,
|
||||||
3.200000001326982e+01f,
|
3.200000001326982e+01,
|
||||||
2.262741700641438e+01f,
|
2.262741700641438e+01,
|
||||||
1.600000000530793e+01f,
|
1.600000000530793e+01,
|
||||||
1.131370850226887e+01f,
|
1.131370850226887e+01,
|
||||||
8.000000001990474e+00f,
|
8.000000001990474e+00,
|
||||||
5.656854250665277e+00f,
|
5.656854250665277e+00,
|
||||||
4.000000000663491e+00f,
|
4.000000000663491e+00,
|
||||||
2.828427125098059e+00f,
|
2.828427125098059e+00,
|
||||||
2.000000000165873e+00f,
|
2.000000000165873e+00,
|
||||||
1.414213562431740e+00f,
|
1.414213562431740e+00,
|
||||||
1.000000000000000e+00f,
|
1.000000000000000e+00,
|
||||||
7.071067811572251e-01f,
|
7.071067811572251e-01,
|
||||||
4.999999999585318e-01f,
|
4.999999999585318e-01,
|
||||||
3.535533905492901e-01f,
|
3.535533905492901e-01,
|
||||||
2.499999999585318e-01f,
|
2.499999999585318e-01,
|
||||||
1.767766952599838e-01f,
|
1.767766952599838e-01,
|
||||||
1.249999999688989e-01f,
|
1.249999999688989e-01,
|
||||||
8.838834762266132e-02f,
|
8.838834762266132e-02,
|
||||||
6.249999997926592e-02f,
|
6.249999997926592e-02,
|
||||||
4.419417380766535e-02f,
|
4.419417380766535e-02,
|
||||||
3.124999998704120e-02f,
|
3.124999998704120e-02,
|
||||||
2.209708690200002e-02f,
|
2.209708690200002e-02,
|
||||||
1.562499999222472e-02f,
|
1.562499999222472e-02,
|
||||||
1.104854345008369e-02f,
|
1.104854345008369e-02,
|
||||||
7.812499995464418e-03f,
|
7.812499995464418e-03,
|
||||||
5.524271724583683e-03f,
|
5.524271724583683e-03,
|
||||||
3.906249997408239e-03f,
|
3.906249997408239e-03,
|
||||||
2.762135862062757e-03f,
|
2.762135862062757e-03,
|
||||||
1.953124998542134e-03f,
|
1.953124998542134e-03,
|
||||||
1.381067930916839e-03f,
|
1.381067930916839e-03,
|
||||||
9.765624991900747e-04f,
|
9.765624991900747e-04,
|
||||||
6.905339654011486e-04f,
|
6.905339654011486e-04,
|
||||||
4.882812495545411e-04f,
|
4.882812495545411e-04,
|
||||||
3.452669826719394e-04f,
|
3.452669826719394e-04,
|
||||||
2.441406247570224e-04f,
|
2.441406247570224e-04,
|
||||||
1.726334913216520e-04f,
|
1.726334913216520e-04,
|
||||||
1.220703123683871e-04f,
|
1.220703123683871e-04,
|
||||||
8.631674565366727e-05f,
|
8.631674565366727e-05,
|
||||||
6.103515617913153e-05f,
|
6.103515617913153e-05,
|
||||||
4.315837282325419e-05f,
|
4.315837282325419e-05,
|
||||||
3.051757808703478e-05f,
|
3.051757808703478e-05,
|
||||||
2.157918640983742e-05f,
|
2.157918640983742e-05,
|
||||||
1.525878904225187e-05f,
|
1.525878904225187e-05,
|
||||||
1.078959320402385e-05f,
|
1.078959320402385e-05,
|
||||||
7.629394520493171e-06f,
|
7.629394520493171e-06,
|
||||||
5.394796601564505e-06f,
|
5.394796601564505e-06,
|
||||||
3.814697259930213e-06f,
|
3.814697259930213e-06,
|
||||||
2.697398300558537e-06f,
|
2.697398300558537e-06,
|
||||||
1.907348629806920e-06f,
|
1.907348629806920e-06,
|
||||||
1.348699150167414e-06f
|
1.348699150167414e-06
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -241,14 +239,14 @@ const float step_size[NUM_CATEGORIES] =
|
||||||
|
|
||||||
const float step_size_inverse_table[NUM_CATEGORIES] =
|
const float step_size_inverse_table[NUM_CATEGORIES] =
|
||||||
{
|
{
|
||||||
2.82805443e+00f,
|
2.82805443e+00,
|
||||||
2.00000000e+00f,
|
2.00000000e+00,
|
||||||
1.41422713e+00f,
|
1.41422713e+00,
|
||||||
1.00000000e+00f,
|
1.00000000e+00,
|
||||||
7.07113564e-01f,
|
7.07113564e-01,
|
||||||
5.00000000e-01f,
|
5.00000000e-01,
|
||||||
3.53556782e-01f,
|
3.53556782e-01,
|
||||||
3.53556782e-01f
|
3.53556782e-01
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -279,137 +277,137 @@ const float dead_zone[NUM_CATEGORIES] =
|
||||||
#if !defined(G722_1_USE_FIXED_POINT)
|
#if !defined(G722_1_USE_FIXED_POINT)
|
||||||
const float region_power_table[REGION_POWER_TABLE_SIZE] =
|
const float region_power_table[REGION_POWER_TABLE_SIZE] =
|
||||||
{
|
{
|
||||||
5.96046448e-08f,
|
5.96046448e-08,
|
||||||
1.19209290e-07f,
|
1.19209290e-07,
|
||||||
2.38418579e-07f,
|
2.38418579e-07,
|
||||||
4.76837158e-07f,
|
4.76837158e-07,
|
||||||
9.53674316e-07f,
|
9.53674316e-07,
|
||||||
1.90734863e-06f,
|
1.90734863e-06,
|
||||||
3.81469727e-06f,
|
3.81469727e-06,
|
||||||
7.62939453e-06f,
|
7.62939453e-06,
|
||||||
1.52587891e-05f,
|
1.52587891e-05,
|
||||||
3.05175781e-05f,
|
3.05175781e-05,
|
||||||
6.10351562e-05f,
|
6.10351562e-05,
|
||||||
1.22070312e-04f,
|
1.22070312e-04,
|
||||||
2.44140625e-04f,
|
2.44140625e-04,
|
||||||
4.88281250e-04f,
|
4.88281250e-04,
|
||||||
9.76562500e-04f,
|
9.76562500e-04,
|
||||||
1.95312500e-03f,
|
1.95312500e-03,
|
||||||
3.90625000e-03f,
|
3.90625000e-03,
|
||||||
7.81250000e-03f,
|
7.81250000e-03,
|
||||||
1.56250000e-02f,
|
1.56250000e-02,
|
||||||
3.12500000e-02f,
|
3.12500000e-02,
|
||||||
6.25000000e-02f,
|
6.25000000e-02,
|
||||||
1.25000000e-01f,
|
1.25000000e-01,
|
||||||
2.50000000e-01f,
|
2.50000000e-01,
|
||||||
5.00000000e-01f,
|
5.00000000e-01,
|
||||||
1.00000000e+00f,
|
1.00000000e+00,
|
||||||
2.00000000e+00f,
|
2.00000000e+00,
|
||||||
4.00000000e+00f,
|
4.00000000e+00,
|
||||||
8.00000000e+00f,
|
8.00000000e+00,
|
||||||
1.60000000e+01f,
|
1.60000000e+01,
|
||||||
3.20000000e+01f,
|
3.20000000e+01,
|
||||||
6.40000000e+01f,
|
6.40000000e+01,
|
||||||
1.28000000e+02f,
|
1.28000000e+02,
|
||||||
2.56000000e+02f,
|
2.56000000e+02,
|
||||||
5.12000000e+02f,
|
5.12000000e+02,
|
||||||
1.02400000e+03f,
|
1.02400000e+03,
|
||||||
2.04800000e+03f,
|
2.04800000e+03,
|
||||||
4.09600000e+03f,
|
4.09600000e+03,
|
||||||
8.19200000e+03f,
|
8.19200000e+03,
|
||||||
1.63840000e+04f,
|
1.63840000e+04,
|
||||||
3.27680000e+04f,
|
3.27680000e+04,
|
||||||
6.55360000e+04f,
|
6.55360000e+04,
|
||||||
1.31072000e+05f,
|
1.31072000e+05,
|
||||||
2.62144000e+05f,
|
2.62144000e+05,
|
||||||
5.24288000e+05f,
|
5.24288000e+05,
|
||||||
1.04857600e+06f,
|
1.04857600e+06,
|
||||||
2.09715200e+06f,
|
2.09715200e+06,
|
||||||
4.19430400e+06f,
|
4.19430400e+06,
|
||||||
8.38860800e+06f,
|
8.38860800e+06,
|
||||||
1.67772160e+07f,
|
1.67772160e+07,
|
||||||
3.35544320e+07f,
|
3.35544320e+07,
|
||||||
6.71088640e+07f,
|
6.71088640e+07,
|
||||||
1.34217728e+08f,
|
1.34217728e+08,
|
||||||
2.68435456e+08f,
|
2.68435456e+08,
|
||||||
5.36870912e+08f,
|
5.36870912e+08,
|
||||||
1.07374182e+09f,
|
1.07374182e+09,
|
||||||
2.14748365e+09f,
|
2.14748365e+09,
|
||||||
4.29496730e+09f,
|
4.29496730e+09,
|
||||||
8.58993459e+09f,
|
8.58993459e+09,
|
||||||
1.71798692e+10f,
|
1.71798692e+10,
|
||||||
3.43597384e+10f,
|
3.43597384e+10,
|
||||||
6.87194767e+10f,
|
6.87194767e+10,
|
||||||
1.37438953e+11f,
|
1.37438953e+11,
|
||||||
2.74877907e+11f,
|
2.74877907e+11,
|
||||||
5.49755814e+11f
|
5.49755814e+11
|
||||||
};
|
};
|
||||||
|
|
||||||
const float region_power_table_boundary[REGION_POWER_TABLE_SIZE - 1] =
|
const float region_power_table_boundary[REGION_POWER_TABLE_SIZE - 1] =
|
||||||
{
|
{
|
||||||
8.42936956e-08f,
|
8.42936956e-08,
|
||||||
1.68587391e-07f,
|
1.68587391e-07,
|
||||||
3.37174782e-07f,
|
3.37174782e-07,
|
||||||
6.74349565e-07f,
|
6.74349565e-07,
|
||||||
1.34869913e-06f,
|
1.34869913e-06,
|
||||||
2.69739826e-06f,
|
2.69739826e-06,
|
||||||
5.39479652e-06f,
|
5.39479652e-06,
|
||||||
1.07895930e-05f,
|
1.07895930e-05,
|
||||||
2.15791861e-05f,
|
2.15791861e-05,
|
||||||
4.31583721e-05f,
|
4.31583721e-05,
|
||||||
8.63167443e-05f,
|
8.63167443e-05,
|
||||||
1.72633489e-04f,
|
1.72633489e-04,
|
||||||
3.45266977e-04f,
|
3.45266977e-04,
|
||||||
6.90533954e-04f,
|
6.90533954e-04,
|
||||||
1.38106791e-03f,
|
1.38106791e-03,
|
||||||
2.76213582e-03f,
|
2.76213582e-03,
|
||||||
5.52427163e-03f,
|
5.52427163e-03,
|
||||||
1.10485433e-02f,
|
1.10485433e-02,
|
||||||
2.20970865e-02f,
|
2.20970865e-02,
|
||||||
4.41941731e-02f,
|
4.41941731e-02,
|
||||||
8.83883461e-02f,
|
8.83883461e-02,
|
||||||
1.76776692e-01f,
|
1.76776692e-01,
|
||||||
3.53553385e-01f,
|
3.53553385e-01,
|
||||||
7.07106769e-01f,
|
7.07106769e-01,
|
||||||
1.41421354e+00f,
|
1.41421354e+00,
|
||||||
2.82842708e+00f,
|
2.82842708e+00,
|
||||||
5.65685415e+00f,
|
5.65685415e+00,
|
||||||
1.13137083e+01f,
|
1.13137083e+01,
|
||||||
2.26274166e+01f,
|
2.26274166e+01,
|
||||||
4.52548332e+01f,
|
4.52548332e+01,
|
||||||
9.05096664e+01f,
|
9.05096664e+01,
|
||||||
1.81019333e+02f,
|
1.81019333e+02,
|
||||||
3.62038666e+02f,
|
3.62038666e+02,
|
||||||
7.24077332e+02f,
|
7.24077332e+02,
|
||||||
1.44815466e+03f,
|
1.44815466e+03,
|
||||||
2.89630933e+03f,
|
2.89630933e+03,
|
||||||
5.79261865e+03f,
|
5.79261865e+03,
|
||||||
1.15852373e+04f,
|
1.15852373e+04,
|
||||||
2.31704746e+04f,
|
2.31704746e+04,
|
||||||
4.63409492e+04f,
|
4.63409492e+04,
|
||||||
9.26818984e+04f,
|
9.26818984e+04,
|
||||||
1.85363797e+05f,
|
1.85363797e+05,
|
||||||
3.70727594e+05f,
|
3.70727594e+05,
|
||||||
7.41455188e+05f,
|
7.41455188e+05,
|
||||||
1.48291038e+06f,
|
1.48291038e+06,
|
||||||
2.96582075e+06f,
|
2.96582075e+06,
|
||||||
5.93164150e+06f,
|
5.93164150e+06,
|
||||||
1.18632830e+07f,
|
1.18632830e+07,
|
||||||
2.37265660e+07f,
|
2.37265660e+07,
|
||||||
4.74531320e+07f,
|
4.74531320e+07,
|
||||||
9.49062640e+07f,
|
9.49062640e+07,
|
||||||
1.89812528e+08f,
|
1.89812528e+08,
|
||||||
3.79625056e+08f,
|
3.79625056e+08,
|
||||||
7.59250112e+08f,
|
7.59250112e+08,
|
||||||
1.51850022e+09f,
|
1.51850022e+09,
|
||||||
3.03700045e+09f,
|
3.03700045e+09,
|
||||||
6.07400090e+09f,
|
6.07400090e+09,
|
||||||
1.21480018e+10f,
|
1.21480018e+10,
|
||||||
2.42960036e+10f,
|
2.42960036e+10,
|
||||||
4.85920072e+10f,
|
4.85920072e+10,
|
||||||
9.71840143e+10f,
|
9.71840143e+10,
|
||||||
1.94368029e+11f,
|
1.94368029e+11,
|
||||||
3.88736057e+11f
|
3.88736057e+11
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: tables.h,v 1.7 2008/09/26 17:37:31 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define REGION_POWER_TABLE_SIZE 64
|
#define REGION_POWER_TABLE_SIZE 64
|
||||||
|
|
|
@ -0,0 +1,467 @@
|
||||||
|
/*
|
||||||
|
* g722_1 - a library for the G.722.1 and Annex C codecs
|
||||||
|
*
|
||||||
|
* utilities.c
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006 Steve Underwood
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(HAVE_CONFIG_H)
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
|
#if defined(G722_1_USE_MMX)
|
||||||
|
#include <mmintrin.h>
|
||||||
|
#endif
|
||||||
|
#if defined(G722_1_USE_SSE)
|
||||||
|
#include <xmmintrin.h>
|
||||||
|
#endif
|
||||||
|
#if defined(G722_1_USE_SSE2)
|
||||||
|
#include <emmintrin.h>
|
||||||
|
#endif
|
||||||
|
#if defined(G722_1_USE_SSE3)
|
||||||
|
#include <pmmintrin.h>
|
||||||
|
#include <tmmintrin.h>
|
||||||
|
#endif
|
||||||
|
#if defined(G722_1_USE_SSE4_1)
|
||||||
|
#include <smmintrin.h>
|
||||||
|
#endif
|
||||||
|
#if defined(G722_1_USE_SSE4_2)
|
||||||
|
#include <nmmintrin.h>
|
||||||
|
#endif
|
||||||
|
#if defined(G722_1_USE_SSE4A)
|
||||||
|
#include <ammintrin.h>
|
||||||
|
#endif
|
||||||
|
#if defined(G722_1_USE_SSE5)
|
||||||
|
#include <bmmintrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
|
#if defined(G722_1_USE_FIXED_POINT)
|
||||||
|
void vec_copyi16(int16_t z[], const int16_t x[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z[i] = x[i];
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
int32_t vec_dot_prodi16(const int16_t x[], const int16_t y[], int n)
|
||||||
|
{
|
||||||
|
int32_t z;
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && defined(G722_1_USE_MMX)
|
||||||
|
#if defined(__x86_64__)
|
||||||
|
__asm__ __volatile__(
|
||||||
|
" emms;\n"
|
||||||
|
" pxor %%mm0,%%mm0;\n"
|
||||||
|
" leal -32(%%rsi,%%eax,2),%%edx;\n" /* edx = top - 32 */
|
||||||
|
|
||||||
|
" cmpl %%rdx,%%rsi;\n"
|
||||||
|
" ja 1f;\n"
|
||||||
|
|
||||||
|
/* Work in blocks of 16 int16_t's until we are near the end */
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"2:\n"
|
||||||
|
" movq (%%rdi),%%mm1;\n"
|
||||||
|
" movq (%%rsi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
" movq 8(%%rdi),%%mm1;\n"
|
||||||
|
" movq 8(%%rsi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
" movq 16(%%rdi),%%mm1;\n"
|
||||||
|
" movq 16(%%rsi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
" movq 24(%%rdi),%%mm1;\n"
|
||||||
|
" movq 24(%%rsi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
|
||||||
|
" addl $32,%%rsi;\n"
|
||||||
|
" addl $32,%%rdi;\n"
|
||||||
|
" cmpl %%rdx,%%rsi;\n"
|
||||||
|
" jbe 2b;\n"
|
||||||
|
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"1:\n"
|
||||||
|
" addl $24,%%rdx;\n" /* Now edx = top - 8 */
|
||||||
|
" cmpl %%rdx,%%rsi;\n"
|
||||||
|
" ja 3f;\n"
|
||||||
|
|
||||||
|
/* Work in blocks of 4 int16_t's until we are near the end */
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"4:\n"
|
||||||
|
" movq (%%rdi),%%mm1;\n"
|
||||||
|
" movq (%%rsi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
|
||||||
|
" addl $8,%%rsi;\n"
|
||||||
|
" addl $8,%%rdi;\n"
|
||||||
|
" cmpl %%rdx,%%rsi;"
|
||||||
|
" jbe 4b;\n"
|
||||||
|
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"3:\n"
|
||||||
|
" addl $4,%%rdx;\n" /* Now edx = top - 4 */
|
||||||
|
" cmpl %%rdx,%%rsi;\n"
|
||||||
|
" ja 5f;\n"
|
||||||
|
|
||||||
|
/* Work in a block of 2 int16_t's */
|
||||||
|
" movd (%%rdi),%%mm1;\n"
|
||||||
|
" movd (%%rsi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
|
||||||
|
" addl $4,%%rsi;\n"
|
||||||
|
" addl $4,%%rdi;\n"
|
||||||
|
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"5:\n"
|
||||||
|
" addl $2,%%rdx;\n" /* Now edx = top - 2 */
|
||||||
|
" cmpl %%rdx,%%rsi;\n"
|
||||||
|
" ja 6f;\n"
|
||||||
|
|
||||||
|
/* Deal with the very last int16_t, when n is odd */
|
||||||
|
" movswl (%%rdi),%%eax;\n"
|
||||||
|
" andl $65535,%%eax;\n"
|
||||||
|
" movd %%eax,%%mm1;\n"
|
||||||
|
" movswl (%%rsi),%%eax;\n"
|
||||||
|
" andl $65535,%%eax;\n"
|
||||||
|
" movd %%eax,%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"6:\n"
|
||||||
|
/* Merge the pieces of the answer */
|
||||||
|
" movq %%mm0,%%mm1;\n"
|
||||||
|
" punpckhdq %%mm0,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
/* Et voila, eax has the final result */
|
||||||
|
" movd %%mm0,%%eax;\n"
|
||||||
|
|
||||||
|
" emms;\n"
|
||||||
|
: "=a" (z)
|
||||||
|
: "S" (x), "D" (y), "a" (n)
|
||||||
|
: "cc"
|
||||||
|
);
|
||||||
|
#else
|
||||||
|
__asm__ __volatile__(
|
||||||
|
" emms;\n"
|
||||||
|
" pxor %%mm0,%%mm0;\n"
|
||||||
|
" leal -32(%%esi,%%eax,2),%%edx;\n" /* edx = top - 32 */
|
||||||
|
|
||||||
|
" cmpl %%edx,%%esi;\n"
|
||||||
|
" ja 1f;\n"
|
||||||
|
|
||||||
|
/* Work in blocks of 16 int16_t's until we are near the end */
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"2:\n"
|
||||||
|
" movq (%%edi),%%mm1;\n"
|
||||||
|
" movq (%%esi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
" movq 8(%%edi),%%mm1;\n"
|
||||||
|
" movq 8(%%esi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
" movq 16(%%edi),%%mm1;\n"
|
||||||
|
" movq 16(%%esi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
" movq 24(%%edi),%%mm1;\n"
|
||||||
|
" movq 24(%%esi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
|
||||||
|
" addl $32,%%esi;\n"
|
||||||
|
" addl $32,%%edi;\n"
|
||||||
|
" cmpl %%edx,%%esi;\n"
|
||||||
|
" jbe 2b;\n"
|
||||||
|
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"1:\n"
|
||||||
|
" addl $24,%%edx;\n" /* Now edx = top - 8 */
|
||||||
|
" cmpl %%edx,%%esi;\n"
|
||||||
|
" ja 3f;\n"
|
||||||
|
|
||||||
|
/* Work in blocks of 4 int16_t's until we are near the end */
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"4:\n"
|
||||||
|
" movq (%%edi),%%mm1;\n"
|
||||||
|
" movq (%%esi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
|
||||||
|
" addl $8,%%esi;\n"
|
||||||
|
" addl $8,%%edi;\n"
|
||||||
|
" cmpl %%edx,%%esi;"
|
||||||
|
" jbe 4b;\n"
|
||||||
|
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"3:\n"
|
||||||
|
" addl $4,%%edx;\n" /* Now edx = top - 4 */
|
||||||
|
" cmpl %%edx,%%esi;\n"
|
||||||
|
" ja 5f;\n"
|
||||||
|
|
||||||
|
/* Work in a block of 2 int16_t's */
|
||||||
|
" movd (%%edi),%%mm1;\n"
|
||||||
|
" movd (%%esi),%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
|
||||||
|
" addl $4,%%esi;\n"
|
||||||
|
" addl $4,%%edi;\n"
|
||||||
|
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"5:\n"
|
||||||
|
" addl $2,%%edx;\n" /* Now edx = top - 2 */
|
||||||
|
" cmpl %%edx,%%esi;\n"
|
||||||
|
" ja 6f;\n"
|
||||||
|
|
||||||
|
/* Deal with the very last int16_t, when n is odd */
|
||||||
|
" movswl (%%edi),%%eax;\n"
|
||||||
|
" andl $65535,%%eax;\n"
|
||||||
|
" movd %%eax,%%mm1;\n"
|
||||||
|
" movswl (%%esi),%%eax;\n"
|
||||||
|
" andl $65535,%%eax;\n"
|
||||||
|
" movd %%eax,%%mm2;\n"
|
||||||
|
" pmaddwd %%mm2,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
|
||||||
|
" .p2align 2;\n"
|
||||||
|
"6:\n"
|
||||||
|
/* Merge the pieces of the answer */
|
||||||
|
" movq %%mm0,%%mm1;\n"
|
||||||
|
" punpckhdq %%mm0,%%mm1;\n"
|
||||||
|
" paddd %%mm1,%%mm0;\n"
|
||||||
|
/* Et voila, eax has the final result */
|
||||||
|
" movd %%mm0,%%eax;\n"
|
||||||
|
|
||||||
|
" emms;\n"
|
||||||
|
: "=a" (z)
|
||||||
|
: "S" (x), "D" (y), "a" (n)
|
||||||
|
: "cc"
|
||||||
|
);
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
int i;
|
||||||
|
|
||||||
|
z = 0;
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z += (int32_t) x[i]*(int32_t) y[i];
|
||||||
|
#endif
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
#else
|
||||||
|
#if defined(__GNUC__) && defined(G722_1_USE_SSE2)
|
||||||
|
void vec_copyf(float z[], const float x[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
__m128 n1;
|
||||||
|
|
||||||
|
if ((i = n & ~3))
|
||||||
|
{
|
||||||
|
for (i -= 4; i >= 0; i -= 4)
|
||||||
|
{
|
||||||
|
n1 = _mm_loadu_ps(x + i);
|
||||||
|
_mm_storeu_ps(z + i, n1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
|
||||||
|
switch (n & 3)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
z[n - 3] = x[n - 3];
|
||||||
|
case 2:
|
||||||
|
z[n - 2] = x[n - 2];
|
||||||
|
case 1:
|
||||||
|
z[n - 1] = x[n - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void vec_copyf(float z[], const float x[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z[i] = x[i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && defined(G722_1_USE_SSE2)
|
||||||
|
void vec_zerof(float z[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
__m128 n1;
|
||||||
|
|
||||||
|
if ((i = n & ~3))
|
||||||
|
{
|
||||||
|
n1 = _mm_setzero_ps();
|
||||||
|
for (i -= 4; i >= 0; i -= 4)
|
||||||
|
_mm_storeu_ps(z + i, n1);
|
||||||
|
}
|
||||||
|
/* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
|
||||||
|
switch (n & 3)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
z[n - 3] = 0;
|
||||||
|
case 2:
|
||||||
|
z[n - 2] = 0;
|
||||||
|
case 1:
|
||||||
|
z[n - 1] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void vec_zerof(float z[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z[i] = 0.0f;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vec_subf(float z[], const float x[], const float y[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z[i] = x[i] - y[i];
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && defined(G722_1_USE_SSE2)
|
||||||
|
void vec_mulf(float z[], const float x[], const float y[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
__m128 n1;
|
||||||
|
__m128 n2;
|
||||||
|
__m128 n3;
|
||||||
|
|
||||||
|
if ((i = n & ~3))
|
||||||
|
{
|
||||||
|
for (i -= 4; i >= 0; i -= 4)
|
||||||
|
{
|
||||||
|
n1 = _mm_loadu_ps(x + i);
|
||||||
|
n2 = _mm_loadu_ps(y + i);
|
||||||
|
n3 = _mm_mul_ps(n1, n2);
|
||||||
|
_mm_storeu_ps(z + i, n3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
|
||||||
|
switch (n & 3)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
z[n - 3] = x[n - 3]*y[n - 3];
|
||||||
|
case 2:
|
||||||
|
z[n - 2] = x[n - 2]*y[n - 2];
|
||||||
|
case 1:
|
||||||
|
z[n - 1] = x[n - 1]*y[n - 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void vec_mulf(float z[], const float x[], const float y[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z[i] = x[i]*y[i];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && defined(G722_1_USE_SSE2)
|
||||||
|
float vec_dot_prodf(const float x[], const float y[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
float z;
|
||||||
|
__m128 n1;
|
||||||
|
__m128 n2;
|
||||||
|
__m128 n3;
|
||||||
|
__m128 n4;
|
||||||
|
|
||||||
|
z = 0.0f;
|
||||||
|
if ((i = n & ~3))
|
||||||
|
{
|
||||||
|
n4 = _mm_setzero_ps(); //sets sum to zero
|
||||||
|
for (i -= 4; i >= 0; i -= 4)
|
||||||
|
{
|
||||||
|
n1 = _mm_loadu_ps(x + i);
|
||||||
|
n2 = _mm_loadu_ps(y + i);
|
||||||
|
n3 = _mm_mul_ps(n1, n2);
|
||||||
|
n4 = _mm_add_ps(n4, n3);
|
||||||
|
}
|
||||||
|
n4 = _mm_add_ps(_mm_movehl_ps(n4, n4), n4);
|
||||||
|
n4 = _mm_add_ss(_mm_shuffle_ps(n4, n4, 1), n4);
|
||||||
|
_mm_store_ss(&z, n4);
|
||||||
|
}
|
||||||
|
/* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */
|
||||||
|
switch (n & 3)
|
||||||
|
{
|
||||||
|
case 3:
|
||||||
|
z += x[n - 3]*y[n - 3];
|
||||||
|
case 2:
|
||||||
|
z += x[n - 2]*y[n - 2];
|
||||||
|
case 1:
|
||||||
|
z += x[n - 1]*y[n - 1];
|
||||||
|
}
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
float vec_dot_prodf(const float x[], const float y[], int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
float z;
|
||||||
|
|
||||||
|
z = 0.0f;
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z += x[i]*y[i];
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void vec_scalar_mulf(float z[], const float x[], float y, int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z[i] = x[i]*y;
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vec_scaled_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z[i] = x[i]*x_scale + y[i]*y_scale;
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
void vec_scaled_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < n; i++)
|
||||||
|
z[i] = x[i]*x_scale - y[i]*y_scale;
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
#endif
|
||||||
|
/*- End of file ------------------------------------------------------------*/
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* g722_1 - a library for the G.722.1 and Annex C codecs
|
||||||
|
*
|
||||||
|
* utilities.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006 Steve Underwood
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(__UTILITIES_H__)
|
||||||
|
#define __UTILITIES_H__
|
||||||
|
|
||||||
|
/* Prototypes for some general purpose signal and vector functions */
|
||||||
|
#if defined(G722_1_USE_FIXED_POINT)
|
||||||
|
void vec_copyi16(int16_t z[], const int16_t x[], int n);
|
||||||
|
int32_t vec_dot_prodi16(const int16_t x[], const int16_t y[], int n);
|
||||||
|
#else
|
||||||
|
void vec_copyf(float z[], const float x[], int n);
|
||||||
|
void vec_zerof(float z[], int n);
|
||||||
|
void vec_subf(float z[], const float x[], const float y[], int n);
|
||||||
|
void vec_scalar_mulf(float z[], const float x[], float y, int n);
|
||||||
|
void vec_mulf(float z[], const float x[], const float y[], int n);
|
||||||
|
float vec_dot_prodf(const float x[], const float y[], int n);
|
||||||
|
void vec_scaled_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n);
|
||||||
|
void vec_scaled_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/*- End of file ------------------------------------------------------------*/
|
|
@ -15,8 +15,6 @@
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
##
|
|
||||||
## $Id: Makefile.am,v 1.2 2008/09/20 16:31:19 steveu Exp $
|
|
||||||
|
|
||||||
SUBDIRS = itu local
|
SUBDIRS = itu local
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
##
|
|
||||||
## $Id: Makefile.am,v 1.3 2008/09/23 16:03:04 steveu Exp $
|
|
||||||
|
|
||||||
SUBDIRS =
|
SUBDIRS =
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
##
|
|
||||||
## $Id: Makefile.am,v 1.3 2008/09/24 16:12:52 steveu Exp $
|
|
||||||
|
|
||||||
SUBDIRS =
|
SUBDIRS =
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
## You should have received a copy of the GNU General Public License
|
## You should have received a copy of the GNU General Public License
|
||||||
## along with this program; if not, write to the Free Software
|
## along with this program; if not, write to the Free Software
|
||||||
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
##
|
|
||||||
## $Id: Makefile.am,v 1.4 2008/10/19 04:05:02 steveu Exp $
|
|
||||||
|
|
||||||
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
|
||||||
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
|
||||||
|
@ -33,8 +31,8 @@ LIBDIR = -L$(top_builddir)/src
|
||||||
|
|
||||||
noinst_PROGRAMS = g722_1_tests
|
noinst_PROGRAMS = g722_1_tests
|
||||||
|
|
||||||
noinst_HEADERS = itu_bit_stream.c \
|
noinst_HEADERS = g192_bit_stream.h \
|
||||||
timing.h
|
timing.h
|
||||||
|
|
||||||
g722_1_tests_SOURCES = g722_1_tests.c itu_bit_stream.c
|
g722_1_tests_SOURCES = g722_1_tests.c g192_bit_stream.c
|
||||||
g722_1_tests_LDADD = $(LIBDIR) -lg722_1
|
g722_1_tests_LDADD = $(LIBDIR) -lg722_1
|
||||||
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
/*
|
||||||
|
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||||
|
*
|
||||||
|
* g192_bit_stream.c
|
||||||
|
*
|
||||||
|
* Copyright 2008-2009 Steve Underwood <steveu@coppice.org>
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||||
|
* as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file */
|
||||||
|
|
||||||
|
#if defined(HAVE_CONFIG_H)
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <audiofile.h>
|
||||||
|
|
||||||
|
#include "g192_bit_stream.h"
|
||||||
|
|
||||||
|
#if !defined(FALSE)
|
||||||
|
#define FALSE 0
|
||||||
|
#endif
|
||||||
|
#if !defined(TRUE)
|
||||||
|
#define TRUE (!FALSE)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
G192_FRAME_ERASURE = 0x6B20,
|
||||||
|
G192_FRAME_SYNC_1 = 0x6B21,
|
||||||
|
G192_FRAME_SYNC_2 = 0x6B22,
|
||||||
|
G192_FRAME_SYNC_3 = 0x6B23,
|
||||||
|
G192_FRAME_SYNC_4 = 0x6B24,
|
||||||
|
G192_FRAME_SYNC_5 = 0x6B25,
|
||||||
|
G192_FRAME_SYNC_6 = 0x6B26,
|
||||||
|
G192_FRAME_SYNC_7 = 0x6B27,
|
||||||
|
G192_FRAME_SYNC_8 = 0x6B28,
|
||||||
|
G192_FRAME_SYNC_9 = 0x6B29,
|
||||||
|
G192_FRAME_SYNC_10 = 0x6B2A,
|
||||||
|
G192_FRAME_SYNC_11 = 0x6B2B,
|
||||||
|
G192_FRAME_SYNC_12 = 0x6B2C,
|
||||||
|
G192_FRAME_SYNC_13 = 0x6B2D,
|
||||||
|
G192_FRAME_SYNC_14 = 0x6B2E,
|
||||||
|
G192_FRAME_SYNC_15 = 0x6B2F,
|
||||||
|
G192_HARD_ZERO = 0x7F,
|
||||||
|
G192_INDETERMINATE = 0x00,
|
||||||
|
G192_HARD_ONE = 0x81
|
||||||
|
};
|
||||||
|
|
||||||
|
int itu_codec_bitstream_write(const uint8_t out_data[],
|
||||||
|
int number_of_bits,
|
||||||
|
int mode,
|
||||||
|
FILE *fp_bitstream)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int bit_count;
|
||||||
|
int number_of_bytes;
|
||||||
|
uint8_t packed_word;
|
||||||
|
int16_t out_array[2 + number_of_bits + 7];
|
||||||
|
|
||||||
|
number_of_bytes = (number_of_bits + 7)/8;
|
||||||
|
if (mode == ITU_CODEC_BITSTREAM_PACKED)
|
||||||
|
{
|
||||||
|
return fwrite(out_data, 1, number_of_bytes, fp_bitstream);
|
||||||
|
}
|
||||||
|
j = 0;
|
||||||
|
out_array[j++] = G192_FRAME_SYNC_1;
|
||||||
|
out_array[j++] = number_of_bits;
|
||||||
|
for (i = 0; i < number_of_bytes; i++)
|
||||||
|
{
|
||||||
|
packed_word = out_data[i];
|
||||||
|
for (bit_count = 7; bit_count >= 0; bit_count--)
|
||||||
|
out_array[j++] = ((packed_word >> bit_count) & 1) ? G192_HARD_ONE : G192_HARD_ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fwrite(out_array, sizeof(int16_t), number_of_bits + 2, fp_bitstream);
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
|
||||||
|
int itu_codec_bitstream_read(uint8_t in_data[],
|
||||||
|
int16_t *erasure,
|
||||||
|
int number_of_bits,
|
||||||
|
int mode,
|
||||||
|
FILE *fp_bitstream)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int bit_pos;
|
||||||
|
int nsamp;
|
||||||
|
int limit;
|
||||||
|
int rem;
|
||||||
|
int len;
|
||||||
|
int erased_frame;
|
||||||
|
int16_t packed_word;
|
||||||
|
int16_t bit;
|
||||||
|
int16_t in_array[2 + number_of_bits];
|
||||||
|
|
||||||
|
*erasure = FALSE;
|
||||||
|
if (mode == ITU_CODEC_BITSTREAM_PACKED)
|
||||||
|
{
|
||||||
|
nsamp = fread(in_data, 1, number_of_bits/8, fp_bitstream);
|
||||||
|
if (nsamp <= 0)
|
||||||
|
return -1;
|
||||||
|
return nsamp*8;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsamp = fread(in_array, sizeof(int16_t), 2, fp_bitstream);
|
||||||
|
if (nsamp < 2)
|
||||||
|
return -1;
|
||||||
|
if (in_array[0] < G192_FRAME_ERASURE || in_array[0] > G192_FRAME_SYNC_15)
|
||||||
|
{
|
||||||
|
*erasure = TRUE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
erased_frame = (in_array[0] == G192_FRAME_ERASURE);
|
||||||
|
len = in_array[1];
|
||||||
|
if (len > number_of_bits)
|
||||||
|
{
|
||||||
|
*erasure = TRUE;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
nsamp = fread(in_array, sizeof(int16_t), len, fp_bitstream);
|
||||||
|
if (nsamp != len)
|
||||||
|
{
|
||||||
|
*erasure = TRUE;
|
||||||
|
return nsamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
limit = (nsamp + 7)/8;
|
||||||
|
for (i = 0, j = 0; i < limit; i++)
|
||||||
|
{
|
||||||
|
packed_word = 0;
|
||||||
|
rem = (i == (limit - 1)) ? (limit*8 - nsamp) : 0;
|
||||||
|
for (bit_pos = 7; bit_pos >= rem; bit_pos--)
|
||||||
|
{
|
||||||
|
bit = in_array[j++];
|
||||||
|
if (bit >= 0x0001 && bit <= G192_HARD_ZERO)
|
||||||
|
{
|
||||||
|
/* Its a zero */
|
||||||
|
}
|
||||||
|
else if (bit >= G192_HARD_ONE && bit <= 0x00FF)
|
||||||
|
{
|
||||||
|
/* Its a one */
|
||||||
|
packed_word |= (1 << bit_pos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Bad bit */
|
||||||
|
*erasure = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
in_data[i] = packed_word;
|
||||||
|
}
|
||||||
|
if (erased_frame)
|
||||||
|
*erasure = TRUE;
|
||||||
|
return nsamp;
|
||||||
|
}
|
||||||
|
/*- End of function --------------------------------------------------------*/
|
||||||
|
/*- End of file ------------------------------------------------------------*/
|
|
@ -0,0 +1,75 @@
|
||||||
|
/*
|
||||||
|
* broadvoice - a library for the BroadVoice 16 and 32 codecs
|
||||||
|
*
|
||||||
|
* g192_bit_stream.h
|
||||||
|
*
|
||||||
|
* Copyright 2008-2009 Steve Underwood <steveu@coppice.org>
|
||||||
|
*
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License version 2.1,
|
||||||
|
* as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*! \file */
|
||||||
|
|
||||||
|
#if !defined(_G192_BIT_STREAM_H_)
|
||||||
|
#define _G192_BIT_STREAM_H_
|
||||||
|
|
||||||
|
/*! \page g192_bit_stream_page ITU G.192 codec bit stream handling
|
||||||
|
\section g192_bit_stream_page_sec_1 What does it do?
|
||||||
|
|
||||||
|
\section g192_bit_stream_page_sec_2 How does it work?
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
ITU_CODEC_BITSTREAM_PACKED = 0,
|
||||||
|
ITU_CODEC_BITSTREAM_G192 = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*! \brief Write a frame of data to an output file.
|
||||||
|
\param out_data The buffer for the data to be written.
|
||||||
|
\param number_of_bits The number of bits to be written.
|
||||||
|
\param mode 0 = continuous, 1 = ITU G.192 codec bitstream format.
|
||||||
|
\param fp_bitstream The file context to be written to.
|
||||||
|
\return The number of words written. */
|
||||||
|
int itu_codec_bitstream_write(const uint8_t out_data[],
|
||||||
|
int number_of_bits,
|
||||||
|
int mode,
|
||||||
|
FILE *fp_bitstream);
|
||||||
|
|
||||||
|
/*! \brief Read a frame of data from an input file.
|
||||||
|
\param in_data The buffer for the data to be read.
|
||||||
|
\param p_erasure Set to TRUE if there is a frame erasure, else set to FALSE.
|
||||||
|
\param number_of_bits The number of bits to be read.
|
||||||
|
\param mode 0 = continuous, 1 = ITU G.192 codec bitstream format.
|
||||||
|
\param fp_bitstream The file context to be read from.
|
||||||
|
\return The number of words read. */
|
||||||
|
int itu_codec_bitstream_read(uint8_t in_data[],
|
||||||
|
int16_t *p_erasure,
|
||||||
|
int number_of_bits,
|
||||||
|
int mode,
|
||||||
|
FILE *fp_bitstream);
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/*- End of file ------------------------------------------------------------*/
|
|
@ -6,14 +6,12 @@
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
||||||
* code supplied with ITU G.722.1, which is:
|
* code supplied with ITU G.722.1, which is:
|
||||||
*
|
*
|
||||||
* © 2004 Polycom, Inc.
|
* (C) 2004 Polycom, Inc.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
*
|
|
||||||
* $Id: g722_1_tests.c,v 1.14 2008/11/21 15:30:22 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \file */
|
/*! \file */
|
||||||
|
@ -36,7 +34,7 @@
|
||||||
#include <g722_1.h>
|
#include <g722_1.h>
|
||||||
|
|
||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
#include "itu_bit_stream.h"
|
#include "g192_bit_stream.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -227,7 +225,7 @@ static void parse_command_line(char *argv[], coder_control_t *control)
|
||||||
}
|
}
|
||||||
else if (strcasecmp(*argv, "i") == 0)
|
else if (strcasecmp(*argv, "i") == 0)
|
||||||
{
|
{
|
||||||
control->encoded_format = ITU_CODEC_BITSTREAM_ITU;
|
control->encoded_format = ITU_CODEC_BITSTREAM_G192;
|
||||||
printf("Encoding format = ITU-format bitstream\n");
|
printf("Encoding format = ITU-format bitstream\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,139 +0,0 @@
|
||||||
/*
|
|
||||||
* g722_1 - a library for the G.722.1 and Annex C codecs
|
|
||||||
*
|
|
||||||
* itu_bit_stream.c
|
|
||||||
*
|
|
||||||
* Adapted by Steve Underwood <steveu@coppice.org> from the reference
|
|
||||||
* code supplied with ITU G.722.1, which is:
|
|
||||||
*
|
|
||||||
* © 2004 Polycom, Inc.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*
|
|
||||||
* $Id: itu_bit_stream.c,v 1.6 2008/11/21 15:30:22 steveu Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*! \file */
|
|
||||||
|
|
||||||
#if defined(HAVE_CONFIG_H)
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <inttypes.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <audiofile.h>
|
|
||||||
|
|
||||||
#include "itu_bit_stream.h"
|
|
||||||
|
|
||||||
static const int16_t frame_start = 0x6B21;
|
|
||||||
static const int16_t erased_frame_start = 0x6B20;
|
|
||||||
static const int16_t one = 0x0081;
|
|
||||||
static const int16_t zero = 0x007F;
|
|
||||||
|
|
||||||
void itu_codec_bitstream_write(const uint8_t out_data[],
|
|
||||||
int number_of_bits,
|
|
||||||
int mode,
|
|
||||||
FILE *fp_bitstream)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int j;
|
|
||||||
int bit_count;
|
|
||||||
int number_of_bytes;
|
|
||||||
uint8_t packed_word;
|
|
||||||
int16_t out_array[2 + number_of_bits + 7];
|
|
||||||
|
|
||||||
number_of_bytes = (number_of_bits + 7)/8;
|
|
||||||
if (mode == ITU_CODEC_BITSTREAM_PACKED)
|
|
||||||
{
|
|
||||||
fwrite(out_data, 1, number_of_bytes, fp_bitstream);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
j = 0;
|
|
||||||
out_array[j++] = frame_start;
|
|
||||||
out_array[j++] = number_of_bits;
|
|
||||||
for (i = 0; i < number_of_bytes; i++)
|
|
||||||
{
|
|
||||||
packed_word = out_data[i];
|
|
||||||
for (bit_count = 7; bit_count >= 0; bit_count--)
|
|
||||||
out_array[j++] = ((packed_word >> bit_count) & 1) ? one : zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
fwrite(out_array, sizeof(int16_t), number_of_bits + 2, fp_bitstream);
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
|
|
||||||
int itu_codec_bitstream_read(uint8_t in_data[],
|
|
||||||
int16_t *p_frame_error_flag,
|
|
||||||
int number_of_bits,
|
|
||||||
int mode,
|
|
||||||
FILE *fp_bitstream)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
int j;
|
|
||||||
int bit_count;
|
|
||||||
int nsamp;
|
|
||||||
int len;
|
|
||||||
int erased_frame;
|
|
||||||
int16_t packed_word;
|
|
||||||
int16_t bit;
|
|
||||||
int16_t in_array[2 + number_of_bits];
|
|
||||||
|
|
||||||
if (mode == ITU_CODEC_BITSTREAM_PACKED)
|
|
||||||
return fread(in_data, 1, number_of_bits/8, fp_bitstream)*8;
|
|
||||||
|
|
||||||
nsamp = fread(in_array, sizeof(int16_t), 2, fp_bitstream);
|
|
||||||
if (nsamp < 2)
|
|
||||||
return -1;
|
|
||||||
if (in_array[0] != frame_start && in_array[0] != erased_frame_start)
|
|
||||||
{
|
|
||||||
*p_frame_error_flag = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
erased_frame = (in_array[0] == erased_frame_start);
|
|
||||||
len = in_array[1];
|
|
||||||
if (len > number_of_bits)
|
|
||||||
{
|
|
||||||
*p_frame_error_flag = 1;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
nsamp = fread(in_array, sizeof(int16_t), len, fp_bitstream);
|
|
||||||
if (nsamp != len)
|
|
||||||
{
|
|
||||||
*p_frame_error_flag = 1;
|
|
||||||
return nsamp;
|
|
||||||
}
|
|
||||||
*p_frame_error_flag = 0;
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < nsamp/8; i++)
|
|
||||||
{
|
|
||||||
packed_word = 0;
|
|
||||||
bit_count = 7;
|
|
||||||
while (bit_count >= 0)
|
|
||||||
{
|
|
||||||
bit = in_array[j++];
|
|
||||||
if (bit == zero)
|
|
||||||
bit = 0;
|
|
||||||
else if (bit == one)
|
|
||||||
bit = 1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Bad bit */
|
|
||||||
bit = 1;
|
|
||||||
*p_frame_error_flag = 1;
|
|
||||||
/* printf("read_ITU_format: bit not zero or one: %4x\n", bit); */
|
|
||||||
}
|
|
||||||
packed_word = (packed_word << 1) | bit;
|
|
||||||
bit_count--;
|
|
||||||
}
|
|
||||||
in_data[i] = packed_word;
|
|
||||||
}
|
|
||||||
if (erased_frame)
|
|
||||||
*p_frame_error_flag = 1;
|
|
||||||
return nsamp;
|
|
||||||
}
|
|
||||||
/*- End of function --------------------------------------------------------*/
|
|
||||||
/*- End of file ------------------------------------------------------------*/
|
|
|
@ -16,9 +16,6 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
#
|
|
||||||
# $Id: regression_tests.sh.in,v 1.4 2008/11/21 15:30:22 steveu Exp $
|
|
||||||
#
|
|
||||||
|
|
||||||
STDOUT_DEST=xyzzy
|
STDOUT_DEST=xyzzy
|
||||||
STDERR_DEST=xyzzy2
|
STDERR_DEST=xyzzy2
|
||||||
|
@ -33,7 +30,7 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_32000.itu
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
echo g722_1_tests E failed!
|
echo g722_1_tests encode failed!
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
fi
|
fi
|
||||||
./g722_1_tests E I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_in.pcm $TMP_FILE
|
./g722_1_tests E I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_in.pcm $TMP_FILE
|
||||||
|
@ -41,17 +38,17 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_24000.itu
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
echo g722_1_tests E failed!
|
echo g722_1_tests encode failed!
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
fi
|
fi
|
||||||
echo g722_1_tests E completed OK
|
echo g722_1_tests encode completed OK
|
||||||
|
|
||||||
./g722_1_tests D I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_24000.itu $TMP_FILE
|
./g722_1_tests D I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_24000.itu $TMP_FILE
|
||||||
diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_24000.pcm
|
diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_24000.pcm
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
echo g722_1_tests D failed!
|
echo g722_1_tests decode failed!
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
fi
|
fi
|
||||||
./g722_1_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_32000.itu $TMP_FILE
|
./g722_1_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_32000.itu $TMP_FILE
|
||||||
|
@ -59,7 +56,7 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_32000.pcm
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
echo g722_1_tests D failed!
|
echo g722_1_tests decode failed!
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -68,7 +65,7 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_24000_fe.pcm
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
echo g722_1_tests D failed!
|
echo g722_1_tests decode failed!
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
fi
|
fi
|
||||||
./g722_1_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_in_32000_fe.itu $TMP_FILE
|
./g722_1_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_in_32000_fe.itu $TMP_FILE
|
||||||
|
@ -76,28 +73,28 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_32000_fe.pcm
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
echo g722_1_tests D failed!
|
echo g722_1_tests decode failed!
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
fi
|
fi
|
||||||
echo g722_1_tests D completed OK
|
echo g722_1_tests decode completed OK
|
||||||
|
|
||||||
./g722_1_tests E I 32000 16000 ../test-data/local/short_wb_voice.wav $TMP_FILE
|
./g722_1_tests E I 32000 16000 ../test-data/local/short_wb_voice.wav $TMP_FILE
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
echo g722_1_tests E failed!
|
echo g722_1_tests encode failed!
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
fi
|
fi
|
||||||
echo g722_1_tests E completed OK
|
echo g722_1_tests encode completed OK
|
||||||
|
|
||||||
./g722_1_tests D I 32000 16000 $TMP_FILE test.au
|
./g722_1_tests D I 32000 16000 $TMP_FILE test.au
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL != 0 ]
|
if [ $RETVAL != 0 ]
|
||||||
then
|
then
|
||||||
echo g722_1_tests D failed!
|
echo g722_1_tests decode failed!
|
||||||
exit $RETVAL
|
exit $RETVAL
|
||||||
fi
|
fi
|
||||||
echo g722_1_tests D completed OK
|
echo g722_1_tests decode completed OK
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo All regression tests successfully completed
|
echo All regression tests successfully completed
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* SpanDSP - a series of DSP components for telephony
|
* g722_1 - a library for the G.722.1 and Annex C codecs
|
||||||
*
|
*
|
||||||
* timing.h - Provide access to the Pentium/Athlon TSC timer register
|
* timing.h - Provide access to the Pentium/Athlon TSC timer register
|
||||||
*
|
*
|
||||||
|
@ -21,8 +21,6 @@
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* License along with this program; if not, write to the Free Software
|
* License along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
|
||||||
* $Id: timing.h,v 1.1 2008/10/17 15:17:39 steveu Exp $
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_TIMING_H_)
|
#if !defined(_TIMING_H_)
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
# License along with this program; if not, write to the Free Software
|
# License along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
#
|
|
||||||
# $Id: unpack_g722_1_data.sh,v 1.2 2008/09/26 12:09:29 steveu Exp $
|
|
||||||
#
|
|
||||||
|
|
||||||
ITUDATA="../../../T-REC-G.722.1-200505-I!!SOFT-ZST-E.zip"
|
ITUDATA="../../../T-REC-G.722.1-200505-I!!SOFT-ZST-E.zip"
|
||||||
|
|
||||||
|
|
|
@ -4275,6 +4275,7 @@ static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len)
|
||||||
break;
|
break;
|
||||||
case T30_ERR:
|
case T30_ERR:
|
||||||
/* TODO: Continue with the next message if MPS or EOM? */
|
/* TODO: Continue with the next message if MPS or EOM? */
|
||||||
|
s->current_status = T30_ERR_RETRYDCN;
|
||||||
s->timer_t5 = 0;
|
s->timer_t5 = 0;
|
||||||
send_dcn(s);
|
send_dcn(s);
|
||||||
break;
|
break;
|
||||||
|
@ -4319,6 +4320,7 @@ static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len
|
||||||
break;
|
break;
|
||||||
case T30_ERR:
|
case T30_ERR:
|
||||||
/* TODO: Continue with the next message if MPS or EOM? */
|
/* TODO: Continue with the next message if MPS or EOM? */
|
||||||
|
s->current_status = T30_ERR_RETRYDCN;
|
||||||
s->timer_t5 = 0;
|
s->timer_t5 = 0;
|
||||||
send_dcn(s);
|
send_dcn(s);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -342,6 +342,10 @@
|
||||||
RelativePath="..\..\libg722_1\src\tables.c"
|
RelativePath="..\..\libg722_1\src\tables.c"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\libg722_1\src\utilities.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
|
@ -388,6 +392,10 @@
|
||||||
RelativePath="..\..\libg722_1\src\tables.h"
|
RelativePath="..\..\libg722_1\src\tables.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\libg722_1\src\utilities.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Resource Files"
|
Name="Resource Files"
|
||||||
|
|
|
@ -131,6 +131,7 @@
|
||||||
<ClCompile Include="..\..\libg722_1\src\huff_tab.c" />
|
<ClCompile Include="..\..\libg722_1\src\huff_tab.c" />
|
||||||
<ClCompile Include="..\..\libg722_1\src\sam2coef.c" />
|
<ClCompile Include="..\..\libg722_1\src\sam2coef.c" />
|
||||||
<ClCompile Include="..\..\libg722_1\src\tables.c" />
|
<ClCompile Include="..\..\libg722_1\src\tables.c" />
|
||||||
|
<ClCompile Include="..\..\libg722_1\src\utilities.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\libg722_1\src\basop32.h" />
|
<ClInclude Include="..\..\libg722_1\src\basop32.h" />
|
||||||
|
@ -143,6 +144,7 @@
|
||||||
<ClInclude Include="..\..\libg722_1\src\huff_tab.h" />
|
<ClInclude Include="..\..\libg722_1\src\huff_tab.h" />
|
||||||
<ClInclude Include="..\..\libg722_1\src\sam2coef.h" />
|
<ClInclude Include="..\..\libg722_1\src\sam2coef.h" />
|
||||||
<ClInclude Include="..\..\libg722_1\src\tables.h" />
|
<ClInclude Include="..\..\libg722_1\src\tables.h" />
|
||||||
|
<ClInclude Include="..\..\libg722_1\src\utilities.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|
|
@ -60,6 +60,9 @@
|
||||||
<ClCompile Include="..\..\libg722_1\src\tables.c">
|
<ClCompile Include="..\..\libg722_1\src\tables.c">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\libg722_1\src\utilities.c">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\libg722_1\src\basop32.h">
|
<ClInclude Include="..\..\libg722_1\src\basop32.h">
|
||||||
|
@ -92,5 +95,8 @@
|
||||||
<ClInclude Include="..\..\libg722_1\src\tables.h">
|
<ClInclude Include="..\..\libg722_1\src\tables.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\libg722_1\src\utilities.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -246,6 +246,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(_Inout_ switch_media
|
||||||
*/
|
*/
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(_In_ switch_core_session_t *session);
|
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(_In_ switch_core_session_t *session);
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_session_t *session, switch_stream_handle_t *stream);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Read a frame from the bug
|
\brief Read a frame from the bug
|
||||||
\param bug the bug to read from
|
\param bug the bug to read from
|
||||||
|
|
|
@ -216,6 +216,7 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg);
|
||||||
char *tts_name;
|
char *tts_name;
|
||||||
char *voice_name;
|
char *voice_name;
|
||||||
|
|
||||||
|
SWITCH_DECLARE(int) insertFile(const char *file, const char *insert_file, int sample_point);
|
||||||
SWITCH_DECLARE(int) answer();
|
SWITCH_DECLARE(int) answer();
|
||||||
SWITCH_DECLARE(int) preAnswer();
|
SWITCH_DECLARE(int) preAnswer();
|
||||||
SWITCH_DECLARE(void) hangup(const char *cause = "normal_clearing");
|
SWITCH_DECLARE(void) hangup(const char *cause = "normal_clearing");
|
||||||
|
|
|
@ -791,6 +791,7 @@ typedef enum {
|
||||||
SWITCH_MESSAGE_INDICATE_UDPTL_MODE,
|
SWITCH_MESSAGE_INDICATE_UDPTL_MODE,
|
||||||
SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS,
|
SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS,
|
||||||
SWITCH_MESSAGE_INDICATE_JITTER_BUFFER,
|
SWITCH_MESSAGE_INDICATE_JITTER_BUFFER,
|
||||||
|
SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH,
|
||||||
SWITCH_MESSAGE_INVALID
|
SWITCH_MESSAGE_INVALID
|
||||||
} switch_core_session_message_types_t;
|
} switch_core_session_message_types_t;
|
||||||
|
|
||||||
|
@ -1096,6 +1097,8 @@ typedef enum {
|
||||||
CF_RECOVERED,
|
CF_RECOVERED,
|
||||||
CF_JITTERBUFFER,
|
CF_JITTERBUFFER,
|
||||||
CF_DIALPLAN,
|
CF_DIALPLAN,
|
||||||
|
CF_BLOCK_BROADCAST_UNTIL_MEDIA,
|
||||||
|
CF_CNG_PLC,
|
||||||
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
|
/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
|
||||||
CF_FLAG_MAX
|
CF_FLAG_MAX
|
||||||
} switch_channel_flag_t;
|
} switch_channel_flag_t;
|
||||||
|
|
|
@ -2226,6 +2226,40 @@ SWITCH_STANDARD_API(uuid_deflect)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define UUID_RECOVERY_REFRESH_SYNTAX "<uuid> <uri>"
|
||||||
|
SWITCH_STANDARD_API(uuid_recovery_refresh)
|
||||||
|
{
|
||||||
|
switch_core_session_t *tsession = NULL;
|
||||||
|
char *uuid = NULL, *text = NULL;
|
||||||
|
|
||||||
|
if (!zstr(cmd) && (uuid = strdup(cmd))) {
|
||||||
|
if ((text = strchr(uuid, ' '))) {
|
||||||
|
*text++ = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zstr(uuid) || zstr(text)) {
|
||||||
|
stream->write_function(stream, "-USAGE: %s\n", UUID_RECOVERY_REFRESH_SYNTAX);
|
||||||
|
} else {
|
||||||
|
if ((tsession = switch_core_session_locate(uuid))) {
|
||||||
|
switch_core_session_message_t msg = { 0 };
|
||||||
|
|
||||||
|
/* Tell the channel to recovery_refresh the call */
|
||||||
|
msg.from = __FILE__;
|
||||||
|
msg.string_arg = text;
|
||||||
|
msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH;
|
||||||
|
switch_core_session_receive_message(tsession, &msg);
|
||||||
|
stream->write_function(stream, "+OK:%s\n", msg.string_reply);
|
||||||
|
switch_core_session_rwunlock(tsession);
|
||||||
|
} else {
|
||||||
|
stream->write_function(stream, "-ERR No Such Channel %s!\n", uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_safe_free(uuid);
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
#define SCHED_TRANSFER_SYNTAX "[+]<time> <uuid> <extension> [<dialplan>] [<context>]"
|
#define SCHED_TRANSFER_SYNTAX "[+]<time> <uuid> <extension> [<dialplan>] [<context>]"
|
||||||
SWITCH_STANDARD_API(sched_transfer_function)
|
SWITCH_STANDARD_API(sched_transfer_function)
|
||||||
{
|
{
|
||||||
|
@ -2488,6 +2522,48 @@ SWITCH_STANDARD_API(uuid_display_function)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define BUGLIST_SYNTAX "<uuid>"
|
||||||
|
SWITCH_STANDARD_API(uuid_buglist_function)
|
||||||
|
{
|
||||||
|
char *mydata = NULL, *argv[2] = { 0 };
|
||||||
|
int argc = 0;
|
||||||
|
|
||||||
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
|
if (zstr(cmd)) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
mydata = strdup(cmd);
|
||||||
|
switch_assert(mydata);
|
||||||
|
|
||||||
|
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||||
|
|
||||||
|
if (argc < 1) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (argv[0]) {
|
||||||
|
switch_core_session_t *lsession = NULL;
|
||||||
|
|
||||||
|
if ((lsession = switch_core_session_locate(argv[0]))) {
|
||||||
|
status = switch_core_media_bug_enumerate(lsession, stream);
|
||||||
|
switch_core_session_rwunlock(lsession);
|
||||||
|
}
|
||||||
|
goto ok;
|
||||||
|
} else {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
error:
|
||||||
|
stream->write_function(stream, "-USAGE: %s\n", BUGLIST_SYNTAX);
|
||||||
|
switch_safe_free(mydata);
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
ok:
|
||||||
|
switch_safe_free(mydata);
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
#define SIMPLIFY_SYNTAX "<uuid>"
|
#define SIMPLIFY_SYNTAX "<uuid>"
|
||||||
SWITCH_STANDARD_API(uuid_simplify_function)
|
SWITCH_STANDARD_API(uuid_simplify_function)
|
||||||
{
|
{
|
||||||
|
@ -2541,7 +2617,6 @@ SWITCH_STANDARD_API(uuid_simplify_function)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define JITTERBUFFER_SYNTAX "<uuid> [0|<min_msec>[:<max_msec>]]"
|
#define JITTERBUFFER_SYNTAX "<uuid> [0|<min_msec>[:<max_msec>]]"
|
||||||
SWITCH_STANDARD_API(uuid_jitterbuffer_function)
|
SWITCH_STANDARD_API(uuid_jitterbuffer_function)
|
||||||
{
|
{
|
||||||
|
@ -4797,6 +4872,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_break", "Break", break_function, BREAK_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_break", "Break", break_function, BREAK_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_bridge", "uuid_bridge", uuid_bridge_function, "");
|
SWITCH_ADD_API(commands_api_interface, "uuid_bridge", "uuid_bridge", uuid_bridge_function, "");
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
|
||||||
|
SWITCH_ADD_API(commands_api_interface, "uuid_buglist", "List media bugs on a session", uuid_buglist_function, BUGLIST_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_debug_audio", "debug audio", uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_debug_audio", "debug audio", uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX);
|
||||||
|
@ -4816,6 +4892,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_phone_event", "Send and event to the phone", uuid_phone_event_function, PHONE_EVENT_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_phone_event", "Send and event to the phone", uuid_phone_event_function, PHONE_EVENT_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_preprocess", "Pre-process Channel", preprocess_function, PREPROCESS_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_preprocess", "Pre-process Channel", preprocess_function, PREPROCESS_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
|
||||||
|
SWITCH_ADD_API(commands_api_interface, "uuid_recovery_refresh", "Send a recovery_refresh", uuid_recovery_refresh, UUID_RECOVERY_REFRESH_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_recv_dtmf", "receive dtmf digits", uuid_recv_dtmf_function, UUID_RECV_DTMF_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_recv_dtmf", "receive dtmf digits", uuid_recv_dtmf_function, UUID_RECV_DTMF_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
|
||||||
SWITCH_ADD_API(commands_api_interface, "uuid_session_heartbeat", "uuid_session_heartbeat", uuid_session_heartbeat_function, HEARTBEAT_SYNTAX);
|
SWITCH_ADD_API(commands_api_interface, "uuid_session_heartbeat", "uuid_session_heartbeat", uuid_session_heartbeat_function, HEARTBEAT_SYNTAX);
|
||||||
|
@ -4911,6 +4988,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||||
switch_console_set_complete("add uuid_break ::console::list_uuid both");
|
switch_console_set_complete("add uuid_break ::console::list_uuid both");
|
||||||
switch_console_set_complete("add uuid_bridge ::console::list_uuid ::console::list_uuid");
|
switch_console_set_complete("add uuid_bridge ::console::list_uuid ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_broadcast ::console::list_uuid");
|
switch_console_set_complete("add uuid_broadcast ::console::list_uuid");
|
||||||
|
switch_console_set_complete("add uuid_buglist ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_chat ::console::list_uuid");
|
switch_console_set_complete("add uuid_chat ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_debug_audio ::console::list_uuid");
|
switch_console_set_complete("add uuid_debug_audio ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_deflect ::console::list_uuid");
|
switch_console_set_complete("add uuid_deflect ::console::list_uuid");
|
||||||
|
@ -4939,7 +5017,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||||
switch_console_set_complete("add uuid_phone_event ::console::list_uuid talk");
|
switch_console_set_complete("add uuid_phone_event ::console::list_uuid talk");
|
||||||
switch_console_set_complete("add uuid_phone_event ::console::list_uuid hold");
|
switch_console_set_complete("add uuid_phone_event ::console::list_uuid hold");
|
||||||
switch_console_set_complete("add uuid_preprocess ::console::list_uuid");
|
switch_console_set_complete("add uuid_preprocess ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_record ::console::list_uuid");
|
switch_console_set_complete("add uuid_record ::console::list_uuid ::[start:stop");
|
||||||
|
switch_console_set_complete("add uuid_recovery_refresh ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_recv_dtmf ::console::list_uuid");
|
switch_console_set_complete("add uuid_recv_dtmf ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_send_dtmf ::console::list_uuid");
|
switch_console_set_complete("add uuid_send_dtmf ::console::list_uuid");
|
||||||
switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid");
|
switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid");
|
||||||
|
|
|
@ -287,6 +287,7 @@ typedef struct conference_obj {
|
||||||
uint32_t avg_itt;
|
uint32_t avg_itt;
|
||||||
uint32_t avg_tally;
|
uint32_t avg_tally;
|
||||||
switch_time_t run_time;
|
switch_time_t run_time;
|
||||||
|
char *uuid_str;
|
||||||
} conference_obj_t;
|
} conference_obj_t;
|
||||||
|
|
||||||
/* Relationship with another member */
|
/* Relationship with another member */
|
||||||
|
@ -408,7 +409,7 @@ static switch_status_t conference_local_play_file(conference_obj_t *conference,
|
||||||
static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin);
|
static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin);
|
||||||
static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
|
static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
|
||||||
static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
|
static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
|
||||||
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool);
|
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_core_session_t *session, switch_memory_pool_t *pool);
|
||||||
static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject,
|
static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject,
|
||||||
const char *body, const char *type, const char *hint);
|
const char *body, const char *type, const char *hint);
|
||||||
|
|
||||||
|
@ -440,6 +441,7 @@ static switch_status_t conference_add_event_data(conference_obj_t *conference, s
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name);
|
||||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Size", "%u", conference->count);
|
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Size", "%u", conference->count);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Profile-Name", conference->profile_name);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Profile-Name", conference->profile_name);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Unique-ID", conference->uuid_str);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -2499,7 +2501,9 @@ static void conference_loop_output(conference_member_t *member)
|
||||||
|
|
||||||
use_buffer = NULL;
|
use_buffer = NULL;
|
||||||
mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
|
mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
|
||||||
|
|
||||||
|
use_timer = 1;
|
||||||
|
|
||||||
if (mux_used) {
|
if (mux_used) {
|
||||||
if (mux_used < bytes) {
|
if (mux_used < bytes) {
|
||||||
if (++low_count >= 5) {
|
if (++low_count >= 5) {
|
||||||
|
@ -2512,10 +2516,7 @@ static void conference_loop_output(conference_member_t *member)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mux_used >= bytes) {
|
||||||
use_timer = 1;
|
|
||||||
|
|
||||||
if (mux_used) {
|
|
||||||
/* Flush the output buffer and write all the data (presumably muxed) back to the channel */
|
/* Flush the output buffer and write all the data (presumably muxed) back to the channel */
|
||||||
switch_mutex_lock(member->audio_out_mutex);
|
switch_mutex_lock(member->audio_out_mutex);
|
||||||
write_frame.data = data;
|
write_frame.data = data;
|
||||||
|
@ -2523,7 +2524,7 @@ static void conference_loop_output(conference_member_t *member)
|
||||||
low_count = 0;
|
low_count = 0;
|
||||||
if ((write_frame.datalen = (uint32_t) switch_buffer_read(use_buffer, write_frame.data, bytes))) {
|
if ((write_frame.datalen = (uint32_t) switch_buffer_read(use_buffer, write_frame.data, bytes))) {
|
||||||
if (write_frame.datalen) {
|
if (write_frame.datalen) {
|
||||||
write_frame.samples = write_frame.datalen / 2;
|
write_frame.samples = write_frame.datalen / 2;
|
||||||
|
|
||||||
if( !switch_test_flag(member, MFLAG_CAN_HEAR)) {
|
if( !switch_test_flag(member, MFLAG_CAN_HEAR)) {
|
||||||
memset(write_frame.data, 255, write_frame.datalen);
|
memset(write_frame.data, 255, write_frame.datalen);
|
||||||
|
@ -2551,6 +2552,7 @@ static void conference_loop_output(conference_member_t *member)
|
||||||
write_frame.datalen = bytes;
|
write_frame.datalen = bytes;
|
||||||
write_frame.samples = samples;
|
write_frame.samples = samples;
|
||||||
memset(write_frame.data, 255, write_frame.datalen);
|
memset(write_frame.data, 255, write_frame.datalen);
|
||||||
|
write_frame.timestamp = timer.samplecount;
|
||||||
member_add_file_data(member, write_frame.data, write_frame.datalen);
|
member_add_file_data(member, write_frame.data, write_frame.datalen);
|
||||||
if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||||
|
@ -2779,6 +2781,12 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th
|
||||||
switch_core_file_close(&fh);
|
switch_core_file_close(&fh);
|
||||||
}
|
}
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording of %s Stopped\n", rec->path);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording of %s Stopped\n", rec->path);
|
||||||
|
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
conference_add_event_data(conference, event);
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "stop-recording");
|
||||||
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", rec->path);
|
||||||
|
switch_event_fire(&event);
|
||||||
|
}
|
||||||
|
|
||||||
if (rec->pool) {
|
if (rec->pool) {
|
||||||
switch_memory_pool_t *pool = rec->pool;
|
switch_memory_pool_t *pool = rec->pool;
|
||||||
|
@ -4277,6 +4285,7 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc
|
||||||
switch_event_t *params = NULL;
|
switch_event_t *params = NULL;
|
||||||
conference_obj_t *new_conference = NULL;
|
conference_obj_t *new_conference = NULL;
|
||||||
int locked = 0;
|
int locked = 0;
|
||||||
|
switch_core_session_message_t msg = { 0 };
|
||||||
|
|
||||||
switch_assert(conference != NULL);
|
switch_assert(conference != NULL);
|
||||||
switch_assert(stream != NULL);
|
switch_assert(stream != NULL);
|
||||||
|
@ -4347,7 +4356,7 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the conference object. */
|
/* Create the conference object. */
|
||||||
new_conference = conference_new(conf_name, xml_cfg, pool);
|
new_conference = conference_new(conf_name, xml_cfg, member->session, pool);
|
||||||
|
|
||||||
/* Release the config registry handle */
|
/* Release the config registry handle */
|
||||||
if (cxml) {
|
if (cxml) {
|
||||||
|
@ -4402,6 +4411,11 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc
|
||||||
|
|
||||||
switch_channel_set_variable(channel, "last_transfered_conference", argv[2]);
|
switch_channel_set_variable(channel, "last_transfered_conference", argv[2]);
|
||||||
|
|
||||||
|
/* Sync the recovery data */
|
||||||
|
msg.from = __FILE__;
|
||||||
|
msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH;
|
||||||
|
switch_core_session_receive_message(member->session, &msg);
|
||||||
|
|
||||||
unlock_member(member);
|
unlock_member(member);
|
||||||
|
|
||||||
stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]);
|
stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]);
|
||||||
|
@ -5472,7 +5486,7 @@ SWITCH_STANDARD_APP(conference_function)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the conference object. */
|
/* Create the conference object. */
|
||||||
conference = conference_new(conf_name, xml_cfg, NULL);
|
conference = conference_new(conf_name, xml_cfg, session, NULL);
|
||||||
|
|
||||||
if (!conference) {
|
if (!conference) {
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -5517,7 +5531,7 @@ SWITCH_STANDARD_APP(conference_function)
|
||||||
const char *max_members_str;
|
const char *max_members_str;
|
||||||
|
|
||||||
/* couldn't find the conference, create one */
|
/* couldn't find the conference, create one */
|
||||||
conference = conference_new(conf_name, xml_cfg, NULL);
|
conference = conference_new(conf_name, xml_cfg, session, NULL);
|
||||||
|
|
||||||
if (!conference) {
|
if (!conference) {
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -5799,22 +5813,29 @@ SWITCH_STANDARD_APP(conference_function)
|
||||||
if (conference && switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
|
if (conference && switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) {
|
||||||
char *toplay = NULL;
|
char *toplay = NULL;
|
||||||
char *dfile = NULL;
|
char *dfile = NULL;
|
||||||
|
char *expanded = NULL;
|
||||||
|
|
||||||
if (!strncasecmp(conference->kicked_sound, "say:", 4)) {
|
if (!strncasecmp(conference->kicked_sound, "say:", 4)) {
|
||||||
if (conference->tts_engine && conference->tts_voice) {
|
if (conference->tts_engine && conference->tts_voice) {
|
||||||
switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, conference->kicked_sound + 4, NULL);
|
switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, conference->kicked_sound + 4, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(session), conference->kicked_sound)) != conference->kicked_sound) {
|
||||||
|
toplay = expanded;
|
||||||
|
} else {
|
||||||
|
expanded = NULL;
|
||||||
|
toplay = conference->kicked_sound;
|
||||||
|
}
|
||||||
|
|
||||||
if (conference->sound_prefix) {
|
if (conference->sound_prefix) {
|
||||||
dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, conference->kicked_sound);
|
dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, toplay);
|
||||||
switch_assert(dfile);
|
switch_assert(dfile);
|
||||||
toplay = dfile;
|
toplay = dfile;
|
||||||
} else {
|
|
||||||
toplay = conference->kicked_sound;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_ivr_play_file(session, NULL, toplay, NULL);
|
switch_ivr_play_file(session, NULL, toplay, NULL);
|
||||||
switch_safe_free(dfile);
|
switch_safe_free(dfile);
|
||||||
|
switch_safe_free(expanded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5942,7 +5963,7 @@ static conference_obj_t *conference_find(char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new conferene with a specific profile */
|
/* create a new conferene with a specific profile */
|
||||||
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool)
|
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_core_session_t *session, switch_memory_pool_t *pool)
|
||||||
{
|
{
|
||||||
conference_obj_t *conference;
|
conference_obj_t *conference;
|
||||||
switch_xml_t xml_kvp;
|
switch_xml_t xml_kvp;
|
||||||
|
@ -5985,13 +6006,50 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
|
||||||
char *verbose_events = NULL;
|
char *verbose_events = NULL;
|
||||||
char *auto_record = NULL;
|
char *auto_record = NULL;
|
||||||
char *terminate_on_silence = NULL;
|
char *terminate_on_silence = NULL;
|
||||||
|
char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
|
||||||
|
switch_uuid_t uuid;
|
||||||
|
switch_codec_implementation_t read_impl = { 0 };
|
||||||
|
switch_channel_t *channel = NULL;
|
||||||
|
const char *force_rate = NULL, *force_interval = NULL;
|
||||||
|
uint32_t force_rate_i = 0, force_interval_i = 0;
|
||||||
|
|
||||||
/* Validate the conference name */
|
/* Validate the conference name */
|
||||||
if (zstr(name)) {
|
if (zstr(name)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (session) {
|
||||||
|
uint32_t tmp;
|
||||||
|
|
||||||
|
switch_core_session_get_read_impl(session, &read_impl);
|
||||||
|
channel = switch_core_session_get_channel(session);
|
||||||
|
|
||||||
|
if ((force_rate = switch_channel_get_variable(channel, "conference_force_rate"))) {
|
||||||
|
if (!strcasecmp(force_rate, "auto")) {
|
||||||
|
force_rate_i = read_impl.actual_samples_per_second;
|
||||||
|
} else {
|
||||||
|
tmp = atoi(force_rate);
|
||||||
|
|
||||||
|
if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
|
||||||
|
force_rate_i = rate = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((force_interval = switch_channel_get_variable(channel, "conference_force_interval"))) {
|
||||||
|
if (!strcasecmp(force_interval, "auto")) {
|
||||||
|
force_interval_i = read_impl.microseconds_per_packet / 1000;
|
||||||
|
} else {
|
||||||
|
tmp = atoi(force_interval);
|
||||||
|
|
||||||
|
if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
|
||||||
|
force_interval_i = interval = tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch_mutex_lock(globals.hash_mutex);
|
switch_mutex_lock(globals.hash_mutex);
|
||||||
|
|
||||||
/* parse the profile tree for param values */
|
/* parse the profile tree for param values */
|
||||||
|
@ -6012,20 +6070,33 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
|
||||||
var = buf;
|
var = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(var, "rate") && !zstr(val)) {
|
if (!force_rate_i && !strcasecmp(var, "rate") && !zstr(val)) {
|
||||||
uint32_t tmp = atoi(val);
|
uint32_t tmp = atoi(val);
|
||||||
if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
|
if (session && tmp == 0) {
|
||||||
rate = tmp;
|
if (!strcasecmp(val, "auto")) {
|
||||||
|
rate = read_impl.actual_samples_per_second;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
|
||||||
|
rate = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(var, "domain") && !zstr(val)) {
|
} else if (!strcasecmp(var, "domain") && !zstr(val)) {
|
||||||
domain = val;
|
domain = val;
|
||||||
} else if (!strcasecmp(var, "interval") && !zstr(val)) {
|
} else if (!force_interval_i && !strcasecmp(var, "interval") && !zstr(val)) {
|
||||||
uint32_t tmp = atoi(val);
|
uint32_t tmp = atoi(val);
|
||||||
if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
|
|
||||||
interval = tmp;
|
if (session && tmp == 0) {
|
||||||
|
if (!strcasecmp(val, "auto")) {
|
||||||
|
interval = read_impl.microseconds_per_packet / 1000;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
|
||||||
"Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
|
interval = tmp;
|
||||||
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
|
||||||
|
"Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(var, "timer-name") && !zstr(val)) {
|
} else if (!strcasecmp(var, "timer-name") && !zstr(val)) {
|
||||||
timer_name = val;
|
timer_name = val;
|
||||||
|
@ -6296,6 +6367,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
|
||||||
} else {
|
} else {
|
||||||
conference->domain = "cluecon.com";
|
conference->domain = "cluecon.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
conference->rate = rate;
|
conference->rate = rate;
|
||||||
conference->interval = interval;
|
conference->interval = interval;
|
||||||
|
|
||||||
|
@ -6315,6 +6387,12 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
|
||||||
conference->verbose_events = 1;
|
conference->verbose_events = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Create the conference unique identifier */
|
||||||
|
switch_uuid_get(&uuid);
|
||||||
|
switch_uuid_format(uuid_str, &uuid);
|
||||||
|
conference->uuid_str = switch_core_strdup(conference->pool, uuid_str);
|
||||||
|
|
||||||
|
|
||||||
/* Activate the conference mutex for exclusivity */
|
/* Activate the conference mutex for exclusivity */
|
||||||
switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
|
switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool);
|
||||||
switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
|
switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
|
||||||
|
|
|
@ -1001,6 +1001,17 @@ SWITCH_STANDARD_APP(deflect_function)
|
||||||
switch_core_session_receive_message(session, &msg);
|
switch_core_session_receive_message(session, &msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_STANDARD_APP(recovery_refresh_function)
|
||||||
|
{
|
||||||
|
switch_core_session_message_t msg = { 0 };
|
||||||
|
|
||||||
|
/* Tell the channel to recovery_refresh the call */
|
||||||
|
msg.from = __FILE__;
|
||||||
|
msg.string_arg = data;
|
||||||
|
msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH;
|
||||||
|
switch_core_session_receive_message(session, &msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_STANDARD_APP(sched_cancel_function)
|
SWITCH_STANDARD_APP(sched_cancel_function)
|
||||||
{
|
{
|
||||||
|
@ -3112,6 +3123,11 @@ SWITCH_STANDARD_APP(verbose_events_function)
|
||||||
switch_channel_set_flag(switch_core_session_get_channel(session), CF_VERBOSE_EVENTS);
|
switch_channel_set_flag(switch_core_session_get_channel(session), CF_VERBOSE_EVENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_STANDARD_APP(cng_plc_function)
|
||||||
|
{
|
||||||
|
switch_channel_set_flag(switch_core_session_get_channel(session), CF_CNG_PLC);
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_STANDARD_APP(early_hangup_function)
|
SWITCH_STANDARD_APP(early_hangup_function)
|
||||||
{
|
{
|
||||||
switch_channel_set_flag(switch_core_session_get_channel(session), CF_EARLY_HANGUP);
|
switch_channel_set_flag(switch_core_session_get_channel(session), CF_EARLY_HANGUP);
|
||||||
|
@ -3497,6 +3513,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
|
||||||
"<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
"<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||||
SWITCH_ADD_APP(app_interface, "verbose_events", "Make ALL Events verbose.", "Make ALL Events verbose.", verbose_events_function, "",
|
SWITCH_ADD_APP(app_interface, "verbose_events", "Make ALL Events verbose.", "Make ALL Events verbose.", verbose_events_function, "",
|
||||||
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||||
|
SWITCH_ADD_APP(app_interface, "cng_plc", "Do PLC on CNG frames", "", cng_plc_function, "",
|
||||||
|
SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||||
SWITCH_ADD_APP(app_interface, "early_hangup", "Enable early hangup", "", early_hangup_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
SWITCH_ADD_APP(app_interface, "early_hangup", "Enable early hangup", "", early_hangup_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
|
||||||
SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_SUPPORT_NOMEDIA);
|
SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "delay_echo", "echo audio at a specified delay", "Delay n ms", delay_function, "<delay ms>", SAF_NONE);
|
SWITCH_ADD_APP(app_interface, "delay_echo", "echo audio at a specified delay", "Delay n ms", delay_function, "<delay ms>", SAF_NONE);
|
||||||
|
@ -3540,6 +3558,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
|
||||||
SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>",
|
SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>",
|
||||||
SAF_SUPPORT_NOMEDIA);
|
SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
|
SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
|
||||||
|
SWITCH_ADD_APP(app_interface, "recovery_refresh", "Send call recovery_refresh", "Send a call recovery_refresh.", recovery_refresh_function, "", SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>",
|
SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>",
|
||||||
SAF_SUPPORT_NOMEDIA);
|
SAF_SUPPORT_NOMEDIA);
|
||||||
SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>",
|
SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>",
|
||||||
|
|
|
@ -188,10 +188,12 @@ static switch_status_t do_snap(switch_core_session_t *session)
|
||||||
switch_core_file_close(&fh);
|
switch_core_file_close(&fh);
|
||||||
switch_core_set_variable("file", file);
|
switch_core_set_variable("file", file);
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Wrote %s\n", file);
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Wrote %s\n", file);
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Bug is not attached.\n", switch_channel_get_name(channel));
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SNAP_SYNTAX "start <sec> <read|write>"
|
#define SNAP_SYNTAX "start <sec> <read|write>"
|
||||||
|
@ -249,7 +251,7 @@ SWITCH_STANDARD_APP(snapshot_app_function)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define SNAP_API_SYNTAX "<uuid> <warning>"
|
#define SNAP_API_SYNTAX "<uuid> snap|start [<sec> read|write <base>]"
|
||||||
SWITCH_STANDARD_API(snapshot_function)
|
SWITCH_STANDARD_API(snapshot_function)
|
||||||
{
|
{
|
||||||
char *mycmd = NULL, *argv[5] = { 0 };
|
char *mycmd = NULL, *argv[5] = { 0 };
|
||||||
|
@ -260,7 +262,7 @@ SWITCH_STANDARD_API(snapshot_function)
|
||||||
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zstr(cmd) || argc < 1 || zstr(argv[0])) {
|
if (zstr(cmd) || argc < 2 || zstr(argv[0])) {
|
||||||
stream->write_function(stream, "-USAGE: %s\n", SNAP_API_SYNTAX);
|
stream->write_function(stream, "-USAGE: %s\n", SNAP_API_SYNTAX);
|
||||||
goto done;
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
|
@ -270,9 +272,9 @@ SWITCH_STANDARD_API(snapshot_function)
|
||||||
if (!strcasecmp(argv[1], "snap")) {
|
if (!strcasecmp(argv[1], "snap")) {
|
||||||
status = do_snap(lsession);
|
status = do_snap(lsession);
|
||||||
} else if (!strcasecmp(argv[1], "start")) {
|
} else if (!strcasecmp(argv[1], "start")) {
|
||||||
char *sec = argv[1];
|
char *sec = argv[2];
|
||||||
char *fl = argv[2];
|
char *fl = argv[3];
|
||||||
const char *base = argv[3];
|
const char *base = argv[4];
|
||||||
int seconds = 5;
|
int seconds = 5;
|
||||||
switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING;
|
switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING;
|
||||||
|
|
||||||
|
@ -325,10 +327,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snapshot_load)
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
/* connect my internal structure to the blank pointer passed to me */
|
||||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
|
|
||||||
|
|
||||||
SWITCH_ADD_API(api_interface, "uuid_snapshot", "Snapshot API", snapshot_function, SNAP_API_SYNTAX);
|
SWITCH_ADD_API(api_interface, "uuid_snapshot", "Snapshot API", snapshot_function, SNAP_API_SYNTAX);
|
||||||
SWITCH_ADD_APP(app_interface, "snapshot", "", "", snapshot_app_function, SNAP_SYNTAX, SAF_SUPPORT_NOMEDIA);
|
SWITCH_ADD_APP(app_interface, "snapshot", "", "", snapshot_app_function, SNAP_SYNTAX, SAF_SUPPORT_NOMEDIA);
|
||||||
|
switch_console_set_complete("add uuid_snapshot ::console::list_uuid");
|
||||||
|
|
||||||
/* indicate that the module should continue to be loaded */
|
/* indicate that the module should continue to be loaded */
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
|
@ -589,7 +589,7 @@ FSH323EndPoint::FSH323EndPoint()
|
||||||
,m_fax_old_asn(false)
|
,m_fax_old_asn(false)
|
||||||
{
|
{
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323EndPoint::FSH323EndPoint [%p]\n",this);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323EndPoint::FSH323EndPoint [%p]\n",this);
|
||||||
terminalType = e_GatewayOnly;
|
terminalType = e_GatewayAndMC;
|
||||||
}
|
}
|
||||||
|
|
||||||
FSH323EndPoint::~FSH323EndPoint()
|
FSH323EndPoint::~FSH323EndPoint()
|
||||||
|
|
|
@ -249,6 +249,7 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count,
|
||||||
loff_t *f_pos)
|
loff_t *f_pos)
|
||||||
{
|
{
|
||||||
DEFINE_WAIT(wait);
|
DEFINE_WAIT(wait);
|
||||||
|
size_t written;
|
||||||
struct skypopen_dev *dev = filp->private_data;
|
struct skypopen_dev *dev = filp->private_data;
|
||||||
|
|
||||||
if(unload)
|
if(unload)
|
||||||
|
@ -273,8 +274,31 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count,
|
||||||
prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE);
|
prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE);
|
||||||
schedule();
|
schedule();
|
||||||
finish_wait(&dev->inq, &wait);
|
finish_wait(&dev->inq, &wait);
|
||||||
return count;
|
|
||||||
|
|
||||||
|
if (!count)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!access_ok(VERIFY_WRITE, buf, count))
|
||||||
|
return -EFAULT;
|
||||||
|
|
||||||
|
written = 0;
|
||||||
|
while (count) {
|
||||||
|
unsigned long unwritten;
|
||||||
|
size_t chunk = count;
|
||||||
|
|
||||||
|
if (chunk > PAGE_SIZE)
|
||||||
|
chunk = PAGE_SIZE; /* Just for latency reasons */
|
||||||
|
unwritten = __clear_user(buf, chunk);
|
||||||
|
written += chunk - unwritten;
|
||||||
|
if (unwritten)
|
||||||
|
break;
|
||||||
|
if (signal_pending(current))
|
||||||
|
return written ? written : -ERESTARTSYS;
|
||||||
|
buf += chunk;
|
||||||
|
count -= chunk;
|
||||||
|
cond_resched();
|
||||||
|
}
|
||||||
|
return written ? written : -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count,
|
static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count,
|
||||||
|
|
|
@ -1319,6 +1319,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||||
|
|
||||||
/* ones that do not need to lock sofia mutex */
|
/* ones that do not need to lock sofia mutex */
|
||||||
switch (msg->message_id) {
|
switch (msg->message_id) {
|
||||||
|
case SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH:
|
||||||
case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC:
|
case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC:
|
||||||
{
|
{
|
||||||
sofia_glue_tech_track(tech_pvt->profile, session);
|
sofia_glue_tech_track(tech_pvt->profile, session);
|
||||||
|
@ -1335,6 +1336,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
|
case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER:
|
||||||
{
|
{
|
||||||
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
if (switch_rtp_ready(tech_pvt->rtp_session)) {
|
||||||
|
@ -3395,6 +3397,36 @@ SWITCH_STANDARD_API(sofia_count_reg_function)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void select_from_profile(sofia_profile_t *profile,
|
||||||
|
const char *user,
|
||||||
|
const char *domain,
|
||||||
|
const char *concat,
|
||||||
|
const char *exclude_contact,
|
||||||
|
switch_stream_handle_t *stream)
|
||||||
|
{
|
||||||
|
struct cb_helper cb;
|
||||||
|
char *sql;
|
||||||
|
|
||||||
|
cb.row_process = 0;
|
||||||
|
|
||||||
|
cb.profile = profile;
|
||||||
|
cb.stream = stream;
|
||||||
|
|
||||||
|
if (exclude_contact) {
|
||||||
|
sql = switch_mprintf("select contact, profile_name, '%q' "
|
||||||
|
"from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%') "
|
||||||
|
"and contact not like '%%%s%%'", (concat != NULL) ? concat : "", user, domain, domain, exclude_contact);
|
||||||
|
} else {
|
||||||
|
sql = switch_mprintf("select contact, profile_name, '%q' "
|
||||||
|
"from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
|
||||||
|
(concat != NULL) ? concat : "", user, domain, domain);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_assert(sql);
|
||||||
|
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, contact_callback, &cb);
|
||||||
|
switch_safe_free(sql);
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_STANDARD_API(sofia_contact_function)
|
SWITCH_STANDARD_API(sofia_contact_function)
|
||||||
{
|
{
|
||||||
char *data;
|
char *data;
|
||||||
|
@ -3406,6 +3438,7 @@ SWITCH_STANDARD_API(sofia_contact_function)
|
||||||
sofia_profile_t *profile = NULL;
|
sofia_profile_t *profile = NULL;
|
||||||
const char *exclude_contact = NULL;
|
const char *exclude_contact = NULL;
|
||||||
char *reply = "error/facility_not_subscribed";
|
char *reply = "error/facility_not_subscribed";
|
||||||
|
switch_stream_handle_t mystream = { 0 };
|
||||||
|
|
||||||
if (!cmd) {
|
if (!cmd) {
|
||||||
stream->write_function(stream, "%s", "");
|
stream->write_function(stream, "%s", "");
|
||||||
|
@ -3440,76 +3473,74 @@ SWITCH_STANDARD_API(sofia_contact_function)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile_name && domain) {
|
if (zstr(domain)) {
|
||||||
profile_name = domain;
|
domain = switch_core_get_variable("domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user && profile_name) {
|
if (!user) goto end;
|
||||||
char *sql;
|
|
||||||
|
|
||||||
if (!(profile = sofia_glue_find_profile(profile_name))) {
|
if (zstr(profile_name) || strcmp(profile_name, "*") || zstr(domain)) {
|
||||||
profile_name = domain;
|
if (!zstr(profile_name)) {
|
||||||
domain = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!profile && profile_name) {
|
|
||||||
profile = sofia_glue_find_profile(profile_name);
|
profile = sofia_glue_find_profile(profile_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile) {
|
if (!profile) {
|
||||||
struct cb_helper cb;
|
profile = sofia_glue_find_profile(domain);
|
||||||
switch_stream_handle_t mystream = { 0 };
|
|
||||||
|
|
||||||
cb.row_process = 0;
|
|
||||||
|
|
||||||
if (!domain || (!strchr(domain, '.') && strcmp(profile_name, domain))) {
|
|
||||||
domain = profile->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
SWITCH_STANDARD_STREAM(mystream);
|
|
||||||
switch_assert(mystream.data);
|
|
||||||
cb.profile = profile;
|
|
||||||
cb.stream = &mystream;
|
|
||||||
|
|
||||||
if (exclude_contact) {
|
|
||||||
sql = switch_mprintf("select contact, profile_name, '%q' "
|
|
||||||
"from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%') "
|
|
||||||
"and contact not like '%%%s%%'", (concat != NULL) ? concat : "", user, domain, domain, exclude_contact);
|
|
||||||
} else {
|
|
||||||
sql = switch_mprintf("select contact, profile_name, '%q' "
|
|
||||||
"from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
|
|
||||||
(concat != NULL) ? concat : "", user, domain, domain);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_assert(sql);
|
|
||||||
sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, contact_callback, &cb);
|
|
||||||
switch_safe_free(sql);
|
|
||||||
reply = (char *) mystream.data;
|
|
||||||
if (!zstr(reply) && end_of(reply) == ',') {
|
|
||||||
end_of(reply) = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zstr(reply)) {
|
|
||||||
reply = "error/user_not_registered";
|
|
||||||
}
|
|
||||||
|
|
||||||
stream->write_function(stream, "%s", reply);
|
|
||||||
reply = NULL;
|
|
||||||
|
|
||||||
switch_safe_free(mystream.data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reply) {
|
if (profile || !zstr(domain)) {
|
||||||
stream->write_function(stream, "%s", reply);
|
SWITCH_STANDARD_STREAM(mystream);
|
||||||
|
switch_assert(mystream.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_safe_free(data);
|
|
||||||
|
|
||||||
if (profile) {
|
if (profile) {
|
||||||
|
if (zstr(domain)) {
|
||||||
|
domain = profile->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!zstr(profile->domain_name) && !zstr(profile_name) && !strcmp(profile_name, profile->name)) {
|
||||||
|
domain = profile->domain_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
select_from_profile(profile, user, domain, concat, exclude_contact, &mystream);
|
||||||
sofia_glue_release_profile(profile);
|
sofia_glue_release_profile(profile);
|
||||||
|
|
||||||
|
} else if (!zstr(domain)) {
|
||||||
|
switch_mutex_lock(mod_sofia_globals.hash_mutex);
|
||||||
|
if (mod_sofia_globals.profile_hash) {
|
||||||
|
switch_hash_index_t *hi;
|
||||||
|
const void *var;
|
||||||
|
void *val;
|
||||||
|
|
||||||
|
for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
|
||||||
|
switch_hash_this(hi, &var, NULL, &val);
|
||||||
|
if ((profile = (sofia_profile_t *) val) && !strcmp((char *)var, profile->name)) {
|
||||||
|
select_from_profile(profile, user, domain, concat, exclude_contact, &mystream);
|
||||||
|
profile = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
reply = (char *) mystream.data;
|
||||||
|
|
||||||
|
end:
|
||||||
|
|
||||||
|
if (zstr(reply)) {
|
||||||
|
reply = "error/user_not_registered";
|
||||||
|
} else if (end_of(reply) == ',') {
|
||||||
|
end_of(reply) = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stream->write_function(stream, "%s", reply);
|
||||||
|
reply = NULL;
|
||||||
|
|
||||||
|
switch_safe_free(mystream.data);
|
||||||
|
|
||||||
|
switch_safe_free(data);
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3910,7 +3941,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile->domain_name && profile->domain_name != profile->name) {
|
if (profile->domain_name && strcmp(profile->domain_name, profile->name)) {
|
||||||
profile_name = profile->domain_name;
|
profile_name = profile->domain_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -745,6 +745,14 @@ typedef struct {
|
||||||
char *route_uri;
|
char *route_uri;
|
||||||
} sofia_destination_t;
|
} sofia_destination_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char network_ip[80];
|
||||||
|
int network_port;
|
||||||
|
const char *is_nat;
|
||||||
|
int is_auto_nat;
|
||||||
|
} sofia_nat_parse_t;
|
||||||
|
|
||||||
|
|
||||||
#define sofia_test_pflag(obj, flag) ((obj)->pflags[flag] ? 1 : 0)
|
#define sofia_test_pflag(obj, flag) ((obj)->pflags[flag] ? 1 : 0)
|
||||||
#define sofia_set_pflag(obj, flag) (obj)->pflags[flag] = 1
|
#define sofia_set_pflag(obj, flag) (obj)->pflags[flag] = 1
|
||||||
#define sofia_set_pflag_locked(obj, flag) assert(obj->flag_mutex != NULL);\
|
#define sofia_set_pflag_locked(obj, flag) assert(obj->flag_mutex != NULL);\
|
||||||
|
@ -1027,6 +1035,7 @@ void sofia_profile_destroy(sofia_profile_t *profile);
|
||||||
switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream);
|
switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream);
|
||||||
const char *sofia_gateway_status_name(sofia_gateway_status_t status);
|
const char *sofia_gateway_status_name(sofia_gateway_status_t status);
|
||||||
void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway, int status, const char *phrase);
|
void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway, int status, const char *phrase);
|
||||||
|
uint32_t sofia_reg_reg_count(sofia_profile_t *profile, const char *user, const char *host);
|
||||||
void sofia_glue_copy_t38_options(switch_t38_options_t *t38_options, switch_core_session_t *session);
|
void sofia_glue_copy_t38_options(switch_t38_options_t *t38_options, switch_core_session_t *session);
|
||||||
switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *session, const char *r_sdp);
|
switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *session, const char *r_sdp);
|
||||||
char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type);
|
char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type);
|
||||||
|
@ -1040,3 +1049,4 @@ switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, swi
|
||||||
void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl);
|
void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl);
|
||||||
void sofia_glue_check_dtmf_type(private_object_t *tech_pvt);
|
void sofia_glue_check_dtmf_type(private_object_t *tech_pvt);
|
||||||
void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str);
|
void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str);
|
||||||
|
char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_nat_parse_t *np);
|
||||||
|
|
|
@ -6844,11 +6844,19 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||||
|
|
||||||
|
|
||||||
if (sip->sip_request->rq_url->url_params) {
|
if (sip->sip_request->rq_url->url_params) {
|
||||||
gw_name = sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "gw=");
|
gw_name = sofia_glue_find_parameter_value(session, sip->sip_request->rq_url->url_params, "gw=");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(destination_number, "gw+")) {
|
if (strstr(destination_number, "gw+")) {
|
||||||
gw_name = destination_number + 3;
|
if (sofia_test_pflag(profile, PFLAG_FULL_ID)) {
|
||||||
|
char *tmp;
|
||||||
|
gw_name = switch_core_session_strdup(session, destination_number + 3);
|
||||||
|
if ((tmp = strchr(gw_name, '@'))) {
|
||||||
|
*tmp = '\0';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
gw_name = destination_number + 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gw_name) {
|
if (gw_name) {
|
||||||
|
|
|
@ -6136,6 +6136,129 @@ void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_nat_parse_t *np)
|
||||||
|
{
|
||||||
|
char *contact_str = NULL;
|
||||||
|
const char *contact_host, *contact_user;
|
||||||
|
sip_contact_t const *contact;
|
||||||
|
char *port;
|
||||||
|
const char *display = "\"user\"";
|
||||||
|
char new_port[25] = "";
|
||||||
|
sofia_nat_parse_t lnp = { { 0 } };
|
||||||
|
const char *ipv6;
|
||||||
|
sip_from_t const *from;
|
||||||
|
|
||||||
|
if (!sip || !sip->sip_contact || !sip->sip_contact->m_url) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
from = sip->sip_from;
|
||||||
|
contact = sip->sip_contact;
|
||||||
|
|
||||||
|
if (!np) {
|
||||||
|
np = &lnp;
|
||||||
|
}
|
||||||
|
|
||||||
|
sofia_glue_get_addr(nua_current_request(profile->nua), np->network_ip, sizeof(np->network_ip), &np->network_port);
|
||||||
|
|
||||||
|
if (sofia_glue_check_nat(profile, np->network_ip)) {
|
||||||
|
np->is_auto_nat = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
port = (char *) contact->m_url->url_port;
|
||||||
|
contact_host = sip->sip_contact->m_url->url_host;
|
||||||
|
contact_user = sip->sip_contact->m_url->url_user;
|
||||||
|
|
||||||
|
display = contact->m_display;
|
||||||
|
|
||||||
|
|
||||||
|
if (zstr(display)) {
|
||||||
|
if (from) {
|
||||||
|
display = from->a_display;
|
||||||
|
if (zstr(display)) {
|
||||||
|
display = "\"user\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
display = "\"user\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) {
|
||||||
|
if (sip->sip_via) {
|
||||||
|
const char *v_port = sip->sip_via->v_port;
|
||||||
|
const char *v_host = sip->sip_via->v_host;
|
||||||
|
|
||||||
|
if (v_host && sip->sip_via->v_received) {
|
||||||
|
np->is_nat = "via received";
|
||||||
|
} else if (v_host && strcmp(np->network_ip, v_host)) {
|
||||||
|
np->is_nat = "via host";
|
||||||
|
} else if (v_port && atoi(v_port) != np->network_port) {
|
||||||
|
np->is_nat = "via port";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!np->is_nat && sip && sip->sip_via && sip->sip_via->v_port &&
|
||||||
|
atoi(sip->sip_via->v_port) == 5060 && np->network_port != 5060 ) {
|
||||||
|
np->is_nat = "via port";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!np->is_nat && profile->nat_acl_count) {
|
||||||
|
uint32_t x = 0;
|
||||||
|
int ok = 1;
|
||||||
|
char *last_acl = NULL;
|
||||||
|
|
||||||
|
if (!zstr(contact_host)) {
|
||||||
|
for (x = 0; x < profile->nat_acl_count; x++) {
|
||||||
|
last_acl = profile->nat_acl[x];
|
||||||
|
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ok) {
|
||||||
|
np->is_nat = last_acl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (np->is_nat && profile->local_network && switch_check_network_list_ip(np->network_ip, profile->local_network)) {
|
||||||
|
if (profile->debug) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s is on local network, not seting NAT mode.\n", np->network_ip);
|
||||||
|
}
|
||||||
|
np->is_nat = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zstr(contact_host)) {
|
||||||
|
np->is_nat = "No contact host";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (np->is_nat) {
|
||||||
|
contact_host = np->network_ip;
|
||||||
|
switch_snprintf(new_port, sizeof(new_port), ":%d", np->network_port);
|
||||||
|
port = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (port) {
|
||||||
|
switch_snprintf(new_port, sizeof(new_port), ":%s", port);
|
||||||
|
}
|
||||||
|
|
||||||
|
ipv6 = strchr(contact_host, ':');
|
||||||
|
if (contact->m_url->url_params) {
|
||||||
|
contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s;%s>%s",
|
||||||
|
display, contact->m_url->url_user,
|
||||||
|
ipv6 ? "[" : "",
|
||||||
|
contact_host, ipv6 ? "]" : "", new_port, contact->m_url->url_params, np->is_nat ? ";fs_nat=yes" : "");
|
||||||
|
} else {
|
||||||
|
contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s>%s",
|
||||||
|
display,
|
||||||
|
contact->m_url->url_user, ipv6 ? "[" : "", contact_host, ipv6 ? "]" : "", new_port, np->is_nat ? ";fs_nat=yes" : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return contact_str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -817,6 +817,19 @@ void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||||
switch_safe_free(auth_str);
|
switch_safe_free(auth_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t sofia_reg_reg_count(sofia_profile_t *profile, const char *user, const char *host)
|
||||||
|
{
|
||||||
|
char buf[32] = "";
|
||||||
|
char *sql;
|
||||||
|
|
||||||
|
sql = switch_mprintf("select count(*) from sip_registrations where profile_name='%q' and "
|
||||||
|
"sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", profile->name, user, host, host);
|
||||||
|
|
||||||
|
sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf));
|
||||||
|
switch_safe_free(sql);
|
||||||
|
return atoi(buf);
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, sofia_regtype_t regtype, char *key,
|
uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, sofia_regtype_t regtype, char *key,
|
||||||
uint32_t keylen, switch_event_t **v_event, const char *is_nat)
|
uint32_t keylen, switch_event_t **v_event, const char *is_nat)
|
||||||
{
|
{
|
||||||
|
@ -1298,6 +1311,12 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||||
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sofia_reg_reg_count(profile, to_user, reg_host) == 1) {
|
||||||
|
sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' and profile_name='%q' and open_closed='closed'",
|
||||||
|
to_user, reg_host, profile->name);
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DELETE PRESENCE SQL: %s\n", sql);
|
||||||
|
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
switch_mutex_unlock(profile->ireg_mutex);
|
switch_mutex_unlock(profile->ireg_mutex);
|
||||||
|
|
||||||
|
@ -1361,8 +1380,16 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
int send = 1;
|
||||||
|
|
||||||
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
|
if (multi_reg) {
|
||||||
|
if (sofia_reg_reg_count(profile, to_user, sub_host) > 0) {
|
||||||
|
send = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (send && switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid);
|
||||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url);
|
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url);
|
||||||
|
|
|
@ -346,8 +346,8 @@ static switch_status_t load_config(switch_memory_pool_t *pool)
|
||||||
} else if (!strcasecmp(var, "default-template")) {
|
} else if (!strcasecmp(var, "default-template")) {
|
||||||
globals.default_template = switch_core_strdup(pool, val);
|
globals.default_template = switch_core_strdup(pool, val);
|
||||||
} else if (!strcasecmp(var, "master-file-only")) {
|
} else if (!strcasecmp(var, "master-file-only")) {
|
||||||
globals.masterfileonly = switch_true(val);
|
globals.masterfileonly = switch_true(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,8 +405,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_csv_load)
|
||||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ else
|
||||||
LOCAL_LDFLAGS=-L/usr/postgres/8.3/lib -R/usr/postgres/8.3/lib -lpq -static
|
LOCAL_LDFLAGS=-L/usr/postgres/8.3/lib -R/usr/postgres/8.3/lib -lpq -static
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
|
LOCAL_CFLAGS=-I/usr/include/postgresql
|
||||||
LOCAL_LDFLAGS=-lpq -static
|
LOCAL_LDFLAGS=-lpq -static
|
||||||
endif
|
endif
|
||||||
include ../../../../build/modmake.rules
|
include ../../../../build/modmake.rules
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
-- Sample CDR table schema
|
||||||
|
|
||||||
create table a (
|
create table cdr (
|
||||||
id serial primary key,
|
id serial primary key,
|
||||||
local_ip_v4 inet not null,
|
local_ip_v4 inet not null,
|
||||||
caller_id_name varchar,
|
caller_id_name varchar,
|
||||||
|
@ -20,26 +21,3 @@ create table a (
|
||||||
sip_hangup_disposition varchar,
|
sip_hangup_disposition varchar,
|
||||||
ani varchar
|
ani varchar
|
||||||
);
|
);
|
||||||
|
|
||||||
create table g (
|
|
||||||
id serial primary key,
|
|
||||||
local_ip_v4 inet not null,
|
|
||||||
caller_id_name varchar,
|
|
||||||
caller_id_number varchar,
|
|
||||||
destination_number varchar not null,
|
|
||||||
context varchar not null,
|
|
||||||
start_stamp timestamp with time zone not null,
|
|
||||||
answer_stamp timestamp with time zone,
|
|
||||||
end_stamp timestamp with time zone not null,
|
|
||||||
duration int not null,
|
|
||||||
billsec int not null,
|
|
||||||
hangup_cause varchar not null,
|
|
||||||
uuid uuid not null,
|
|
||||||
bleg_uuid uuid,
|
|
||||||
accountcode varchar,
|
|
||||||
read_codec varchar,
|
|
||||||
write_codec varchar,
|
|
||||||
sip_hangup_disposition varchar,
|
|
||||||
ani varchar
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,8 @@ typedef struct cdr_fd cdr_fd_t;
|
||||||
|
|
||||||
const char *default_template =
|
const char *default_template =
|
||||||
"\"${local_ip_v4}\",\"${caller_id_name}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${start_stamp}\","
|
"\"${local_ip_v4}\",\"${caller_id_name}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${start_stamp}\","
|
||||||
"\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${uuid}\",\"${bleg_uuid}\", \"${accountcode}\","
|
"\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${uuid}\",\"${bleg_uuid}\",\"${accountcode}\","
|
||||||
"\"${read_codec}\", \"${write_codec}\"\n";
|
"\"${read_codec}\",\"${write_codec}\"";
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
switch_memory_pool_t *pool;
|
switch_memory_pool_t *pool;
|
||||||
|
@ -65,9 +65,9 @@ static struct {
|
||||||
int rotate;
|
int rotate;
|
||||||
int debug;
|
int debug;
|
||||||
cdr_leg_t legs;
|
cdr_leg_t legs;
|
||||||
char *a_table;
|
|
||||||
char *g_table;
|
|
||||||
char *db_info;
|
char *db_info;
|
||||||
|
char *db_table;
|
||||||
|
char *spool_format;
|
||||||
PGconn *db_connection;
|
PGconn *db_connection;
|
||||||
int db_online;
|
int db_online;
|
||||||
switch_mutex_t *db_mutex;
|
switch_mutex_t *db_mutex;
|
||||||
|
@ -115,13 +115,13 @@ static void do_rotate(cdr_fd_t *fd)
|
||||||
|
|
||||||
if (globals.rotate) {
|
if (globals.rotate) {
|
||||||
switch_time_exp_lt(&tm, switch_micro_time_now());
|
switch_time_exp_lt(&tm, switch_micro_time_now());
|
||||||
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
|
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
|
||||||
|
|
||||||
len = strlen(fd->path) + strlen(date) + 2;
|
len = strlen(fd->path) + strlen(date) + 2;
|
||||||
p = switch_mprintf("%s.%s", fd->path, date);
|
p = switch_mprintf("%s.%s", fd->path, date);
|
||||||
assert(p);
|
assert(p);
|
||||||
switch_file_rename(fd->path, p, globals.pool);
|
switch_file_rename(fd->path, p, globals.pool);
|
||||||
free(p);
|
switch_safe_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
do_reopen(fd);
|
do_reopen(fd);
|
||||||
|
@ -139,10 +139,12 @@ static void do_rotate(cdr_fd_t *fd)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_cdr(const char *path, const char *log_line)
|
static void spool_cdr(const char *path, const char *log_line)
|
||||||
{
|
{
|
||||||
cdr_fd_t *fd = NULL;
|
cdr_fd_t *fd = NULL;
|
||||||
|
char *log_line_lf = NULL;
|
||||||
unsigned int bytes_in, bytes_out;
|
unsigned int bytes_in, bytes_out;
|
||||||
|
int loops = 0;
|
||||||
|
|
||||||
if (!(fd = switch_core_hash_find(globals.fd_hash, path))) {
|
if (!(fd = switch_core_hash_find(globals.fd_hash, path))) {
|
||||||
fd = switch_core_alloc(globals.pool, sizeof(*fd));
|
fd = switch_core_alloc(globals.pool, sizeof(*fd));
|
||||||
|
@ -154,8 +156,15 @@ static void write_cdr(const char *path, const char *log_line)
|
||||||
switch_core_hash_insert(globals.fd_hash, path, fd);
|
switch_core_hash_insert(globals.fd_hash, path, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (end_of(log_line) != '\n') {
|
||||||
|
log_line_lf = switch_mprintf("%s\n", log_line);
|
||||||
|
} else {
|
||||||
|
switch_strdup(log_line_lf, log_line);
|
||||||
|
}
|
||||||
|
assert(log_line_lf);
|
||||||
|
|
||||||
switch_mutex_lock(fd->mutex);
|
switch_mutex_lock(fd->mutex);
|
||||||
bytes_out = (unsigned) strlen(log_line);
|
bytes_out = (unsigned) strlen(log_line_lf);
|
||||||
|
|
||||||
if (fd->fd < 0) {
|
if (fd->fd < 0) {
|
||||||
do_reopen(fd);
|
do_reopen(fd);
|
||||||
|
@ -169,167 +178,154 @@ static void write_cdr(const char *path, const char *log_line)
|
||||||
do_rotate(fd);
|
do_rotate(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((bytes_in = write(fd->fd, log_line, bytes_out)) != bytes_out) {
|
while ((bytes_in = write(fd->fd, log_line_lf, bytes_out)) != bytes_out && ++loops < 10) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write error to file %s %d/%d\n", path, (int) bytes_in, (int) bytes_out);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write error to file %s %d/%d\n", path, (int) bytes_in, (int) bytes_out);
|
||||||
|
do_rotate(fd);
|
||||||
|
switch_yield(250000);
|
||||||
}
|
}
|
||||||
|
|
||||||
fd->bytes += bytes_in;
|
if (bytes_in > 0) {
|
||||||
|
fd->bytes += bytes_in;
|
||||||
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
switch_mutex_unlock(fd->mutex);
|
switch_mutex_unlock(fd->mutex);
|
||||||
|
switch_safe_free(log_line_lf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int save_cdr(const char* const table, const char* const template, const char* const cdr)
|
static switch_status_t insert_cdr(const char * const template, const char * const cdr)
|
||||||
{
|
{
|
||||||
char* columns;
|
char *columns, *values;
|
||||||
char* values;
|
char *p, *q;
|
||||||
char* p;
|
unsigned vlen;
|
||||||
unsigned clen;
|
char *nullValues, *temp, *tp;
|
||||||
unsigned vlen;
|
int nullCounter = 0, charCounter = 0;
|
||||||
char* query;
|
char *sql = NULL, *path = NULL;
|
||||||
const char* const query_template = "INSERT INTO %s (%s) VALUES (%s);";
|
PGresult *res;
|
||||||
PGresult* res;
|
|
||||||
|
|
||||||
if (!table || !*table || !template || !*template || !cdr || !*cdr) {
|
if (!template || !*template || !cdr || !*cdr) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Bad parameter\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Bad parameter\n");
|
||||||
return 0;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
columns = strdup(template);
|
/* Build comma-separated list of field names by dropping $ { } ; chars */
|
||||||
for (p = columns; *p; ++p) {
|
switch_strdup(columns, template);
|
||||||
|
for (p = columns, q = columns; *p; ++p) {
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case '$': case '"': case '{': case '}': case ';':
|
case '$': case '"': case '{': case '}': case ';':
|
||||||
*p = ' ';
|
break;
|
||||||
break;
|
default:
|
||||||
|
*q++ = *p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
clen = p - columns;
|
*q = '\0';
|
||||||
|
|
||||||
values = strdup(cdr);
|
/*
|
||||||
|
* In the expanded vars, replace double quotes (") with single quotes (')
|
||||||
|
* for correct PostgreSQL syntax, and replace semi-colon with space to
|
||||||
|
* prevent SQL injection attacks
|
||||||
|
*/
|
||||||
|
switch_strdup(values, cdr);
|
||||||
for (p = values; *p; ++p) {
|
for (p = values; *p; ++p) {
|
||||||
switch(*p) {
|
switch(*p) {
|
||||||
case '"':
|
case '"':
|
||||||
*p = '\'';
|
*p = '\'';
|
||||||
break;
|
break;
|
||||||
case ';':
|
case ';':
|
||||||
*p = ' ';
|
*p = ' ';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vlen = p - values;
|
vlen = p - values;
|
||||||
/*
|
|
||||||
Patch for changing spaces (; ;) in the template paterns to NULL (ex.) ; ; --PACH--> null
|
/*
|
||||||
- added new functionality - space removing
|
* Patch for changing empty strings ('') in the expanded variables to
|
||||||
*/
|
* PostgreSQL null
|
||||||
char *spaceColumns;
|
*/
|
||||||
int spaceCounter=0;
|
for (p = values; *p; ++p) {
|
||||||
for (p=columns; *p; ++p)
|
if (*p == ',') {
|
||||||
{
|
if (charCounter == 0) {
|
||||||
if (*p==' ')
|
|
||||||
{
|
|
||||||
spaceCounter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
spaceColumns = (char*)malloc(clen-spaceCounter+1);
|
|
||||||
char *pt=spaceColumns;
|
|
||||||
for (p=columns; *p; ++p)
|
|
||||||
{
|
|
||||||
if (*p!=' ')
|
|
||||||
{
|
|
||||||
*pt=*p;
|
|
||||||
pt++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*pt=0;
|
|
||||||
pt=columns;
|
|
||||||
columns=spaceColumns;
|
|
||||||
free(pt);
|
|
||||||
char *nullValues;
|
|
||||||
int nullCounter=0;
|
|
||||||
int charCounter=0;
|
|
||||||
for (p=values; *p; ++p)
|
|
||||||
{
|
|
||||||
if (*p==',')
|
|
||||||
{
|
|
||||||
if (charCounter==0)
|
|
||||||
{
|
|
||||||
nullCounter++;
|
nullCounter++;
|
||||||
}
|
}
|
||||||
charCounter=0;
|
charCounter = 0;
|
||||||
}
|
} else if (*p != ' ' && *p != '\'') {
|
||||||
else if (*p!=' ' && *p!='\'')
|
|
||||||
{
|
|
||||||
charCounter++;
|
charCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (charCounter==0)
|
|
||||||
{
|
if (charCounter == 0) {
|
||||||
nullCounter++;
|
nullCounter++;
|
||||||
}
|
}
|
||||||
charCounter=0;
|
|
||||||
nullCounter*=4;
|
nullCounter *= 4;
|
||||||
vlen+=nullCounter;
|
vlen += nullCounter;
|
||||||
nullValues=(char*)malloc(strlen(values)+nullCounter+1);
|
switch_zmalloc(nullValues, strlen(values) + nullCounter + 1);
|
||||||
charCounter=0;
|
charCounter = 0;
|
||||||
char *temp=nullValues;
|
temp = nullValues;
|
||||||
char *tp=nullValues;
|
tp = nullValues;
|
||||||
for (p=values; *p; ++tp,++p)
|
|
||||||
{
|
for (p = values; *p; ++tp, ++p) {
|
||||||
if (*p==',')
|
if (*p == ',') {
|
||||||
{
|
if (charCounter == 0) {
|
||||||
if (charCounter==0)
|
|
||||||
{
|
|
||||||
temp++;
|
temp++;
|
||||||
*temp='n';temp++;
|
*temp = 'n';
|
||||||
if (temp==tp) tp++;
|
temp++;
|
||||||
*temp='u';temp++;
|
if (temp == tp) tp++;
|
||||||
if (temp==tp) tp++;
|
*temp = 'u';
|
||||||
*temp='l';temp++;
|
temp++;
|
||||||
if (temp==tp) tp++;
|
if (temp == tp) tp++;
|
||||||
*temp='l';temp++;
|
*temp = 'l';
|
||||||
while (temp!=tp)
|
temp++;
|
||||||
{
|
if (temp == tp) tp++;
|
||||||
*temp=' ';temp++;
|
*temp = 'l';
|
||||||
|
temp++;
|
||||||
|
while (temp != tp) {
|
||||||
|
*temp = ' ';
|
||||||
|
temp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
charCounter=0;
|
charCounter = 0;
|
||||||
temp=tp;
|
temp = tp;
|
||||||
}
|
} else if (*p != ' ' && *p != '\'') {
|
||||||
else if (*p!=' ' && *p!='\'')
|
|
||||||
{
|
|
||||||
charCounter++;
|
charCounter++;
|
||||||
}
|
}
|
||||||
*tp=*p;
|
*tp = *p;
|
||||||
}
|
}
|
||||||
if (charCounter==0)
|
|
||||||
{
|
if (charCounter == 0) {
|
||||||
temp++;
|
temp++;
|
||||||
*temp='n';temp++;
|
*temp = 'n';
|
||||||
if (temp==tp) tp++;
|
temp++;
|
||||||
*temp='u';temp++;
|
if (temp == tp) tp++;
|
||||||
if (temp==tp) tp++;
|
*temp = 'u';
|
||||||
*temp='l';temp++;
|
temp++;
|
||||||
if (temp==tp) tp++;
|
if (temp == tp) tp++;
|
||||||
*temp='l';temp++;
|
*temp = 'l';
|
||||||
while (temp!=tp)
|
temp++;
|
||||||
{
|
if (temp == tp) tp++;
|
||||||
*temp=' ';temp++;
|
*temp = 'l';
|
||||||
|
temp++;
|
||||||
|
while (temp != tp) {
|
||||||
|
*temp = ' ';
|
||||||
|
temp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
charCounter=0;
|
|
||||||
temp=tp;
|
charCounter = 0;
|
||||||
*tp=0;
|
temp = tp;
|
||||||
tp=values;
|
*tp = 0;
|
||||||
values=nullValues;
|
tp = values;
|
||||||
free(tp);
|
values = nullValues;
|
||||||
//-----------------------------END_OF_PATCH----------------------------------------------------------------
|
switch_safe_free(tp);
|
||||||
query = malloc(strlen(query_template) - 6 + strlen(table) + clen + vlen + 1);
|
|
||||||
sprintf(query, query_template, table, columns, values);
|
sql = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);", globals.db_table, columns, values);
|
||||||
free(columns);
|
assert(sql);
|
||||||
free(values);
|
switch_safe_free(columns);
|
||||||
|
switch_safe_free(values);
|
||||||
|
|
||||||
if (globals.debug) {
|
if (globals.debug) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Query: \"%s\"\n", query);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Query: \"%s\"\n", sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_mutex_lock(globals.db_mutex);
|
switch_mutex_lock(globals.db_mutex);
|
||||||
|
@ -337,66 +333,58 @@ static int save_cdr(const char* const table, const char* const template, const c
|
||||||
if (!globals.db_online || PQstatus(globals.db_connection) != CONNECTION_OK) {
|
if (!globals.db_online || PQstatus(globals.db_connection) != CONNECTION_OK) {
|
||||||
globals.db_connection = PQconnectdb(globals.db_info);
|
globals.db_connection = PQconnectdb(globals.db_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PQstatus(globals.db_connection) == CONNECTION_OK) {
|
if (PQstatus(globals.db_connection) == CONNECTION_OK) {
|
||||||
globals.db_online = 1;
|
globals.db_online = 1;
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Connection to database failed: %s", PQerrorMessage(globals.db_connection));
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Connection to database failed: %s", PQerrorMessage(globals.db_connection));
|
||||||
PQfinish(globals.db_connection);
|
goto error;
|
||||||
globals.db_online = 0;
|
|
||||||
switch_mutex_unlock(globals.db_mutex);
|
|
||||||
free(query);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
res = PQexec(globals.db_connection, "BEGIN");
|
res = PQexec(globals.db_connection, sql);
|
||||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "BEGIN command failed: %s", PQerrorMessage(globals.db_connection));
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "INSERT command failed: %s", PQresultErrorMessage(res));
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
PQfinish(globals.db_connection);
|
goto error;
|
||||||
globals.db_online = 0;
|
|
||||||
switch_mutex_unlock(globals.db_mutex);
|
|
||||||
free(query);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
PQclear(res);
|
|
||||||
|
|
||||||
res = PQexec(globals.db_connection, query);
|
|
||||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "INSERT command failed: %s", PQerrorMessage(globals.db_connection));
|
|
||||||
PQclear(res);
|
|
||||||
PQfinish(globals.db_connection);
|
|
||||||
globals.db_online = 0;
|
|
||||||
switch_mutex_unlock(globals.db_mutex);
|
|
||||||
free(query);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
PQclear(res);
|
|
||||||
|
|
||||||
free(query);
|
|
||||||
|
|
||||||
res = PQexec(globals.db_connection, "END");
|
|
||||||
if (PQresultStatus(res) != PGRES_COMMAND_OK) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "END command failed: %s", PQerrorMessage(globals.db_connection));
|
|
||||||
PQclear(res);
|
|
||||||
PQfinish(globals.db_connection);
|
|
||||||
globals.db_online = 0;
|
|
||||||
switch_mutex_unlock(globals.db_mutex);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
switch_safe_free(sql);
|
||||||
|
|
||||||
switch_mutex_unlock(globals.db_mutex);
|
switch_mutex_unlock(globals.db_mutex);
|
||||||
|
|
||||||
return 1;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
|
||||||
|
error:
|
||||||
|
|
||||||
|
PQfinish(globals.db_connection);
|
||||||
|
globals.db_online = 0;
|
||||||
|
switch_mutex_unlock(globals.db_mutex);
|
||||||
|
|
||||||
|
/* SQL INSERT failed for whatever reason. Spool the attempted query to disk */
|
||||||
|
if (!strcasecmp(globals.spool_format, "sql")) {
|
||||||
|
path = switch_mprintf("%s%scdr-spool.sql", globals.log_dir, SWITCH_PATH_SEPARATOR);
|
||||||
|
assert(path);
|
||||||
|
spool_cdr(path, sql);
|
||||||
|
} else {
|
||||||
|
path = switch_mprintf("%s%scdr-spool.csv", globals.log_dir, SWITCH_PATH_SEPARATOR);
|
||||||
|
assert(path);
|
||||||
|
spool_cdr(path, cdr);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_safe_free(path);
|
||||||
|
switch_safe_free(sql);
|
||||||
|
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static switch_status_t my_on_hangup(switch_core_session_t *session)
|
static switch_status_t my_on_reporting(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
const char *log_dir = NULL, *accountcode = NULL, *a_template_str = NULL, *g_template_str = NULL;
|
const char *template_str = NULL;
|
||||||
char *log_line, *path = NULL;
|
char *expanded_vars = NULL;
|
||||||
int saved = 0;
|
|
||||||
|
|
||||||
if (globals.shutdown) {
|
if (globals.shutdown) {
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
@ -414,12 +402,8 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(log_dir = switch_channel_get_variable(channel, "cdr_pg_csv_base"))) {
|
if (switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||||
log_dir = globals.log_dir;
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);
|
||||||
}
|
|
||||||
|
|
||||||
if (switch_dir_make_recursive(log_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", log_dir);
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -432,58 +416,27 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
|
||||||
switch_assert(buf);
|
switch_assert(buf);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf);
|
||||||
switch_event_destroy(&event);
|
switch_event_destroy(&event);
|
||||||
free(buf);
|
switch_safe_free(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template);
|
template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template);
|
||||||
|
|
||||||
if ((accountcode = switch_channel_get_variable(channel, "ACCOUNTCODE"))) {
|
if (!template_str) {
|
||||||
a_template_str = (const char *) switch_core_hash_find(globals.template_hash, accountcode);
|
template_str = default_template;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!g_template_str) {
|
expanded_vars = switch_channel_expand_variables(channel, template_str);
|
||||||
g_template_str = "\"${accountcode}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${caller_id}\",\"${channel_name}\",\"${bridge_channel}\",\"${last_app}\",\"${last_arg}\",\"${start_stamp}\",\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${amaflags}\",\"${uuid}\",\"${userfield}\";";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!a_template_str) {
|
if (!expanded_vars) {
|
||||||
a_template_str = g_template_str;
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error expanding CDR variables.\n");
|
||||||
}
|
|
||||||
|
|
||||||
log_line = switch_channel_expand_variables(channel, a_template_str);
|
|
||||||
|
|
||||||
saved = 1; // save_cdr(globals.a_table, a_template_str, log_line);
|
|
||||||
|
|
||||||
if (!saved && accountcode) {
|
|
||||||
path = switch_mprintf("%s%s%s.csv", log_dir, SWITCH_PATH_SEPARATOR, accountcode);
|
|
||||||
assert(path);
|
|
||||||
write_cdr(path, log_line);
|
|
||||||
free(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_template_str != a_template_str) {
|
|
||||||
if (log_line != a_template_str) {
|
|
||||||
switch_safe_free(log_line);
|
|
||||||
}
|
|
||||||
log_line = switch_channel_expand_variables(channel, g_template_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!log_line) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating cdr\n");
|
|
||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
saved = save_cdr(globals.g_table, g_template_str, log_line);
|
insert_cdr(template_str, expanded_vars);
|
||||||
|
|
||||||
if (!saved) {
|
if (expanded_vars != template_str) {
|
||||||
path = switch_mprintf("%s%sMaster.csv", log_dir, SWITCH_PATH_SEPARATOR);
|
switch_safe_free(expanded_vars);
|
||||||
assert(path);
|
|
||||||
write_cdr(path, log_line);
|
|
||||||
free(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (log_line != g_template_str) {
|
|
||||||
free(log_line);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -513,7 +466,6 @@ static void event_handler(switch_event_t *event)
|
||||||
PQfinish(globals.db_connection);
|
PQfinish(globals.db_connection);
|
||||||
globals.db_online = 0;
|
globals.db_online = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,9 +474,14 @@ static switch_state_handler_table_t state_handlers = {
|
||||||
/*.on_init */ NULL,
|
/*.on_init */ NULL,
|
||||||
/*.on_routing */ NULL,
|
/*.on_routing */ NULL,
|
||||||
/*.on_execute */ NULL,
|
/*.on_execute */ NULL,
|
||||||
/*.on_hangup */ my_on_hangup,
|
/*.on_hangup */ NULL,
|
||||||
/*.on_exchange_media */ NULL,
|
/*.on_exchange_media */ NULL,
|
||||||
/*.on_soft_execute */ NULL
|
/*.on_soft_execute */ NULL,
|
||||||
|
/*.on_consume_media */ NULL,
|
||||||
|
/*.on_hibernate */ NULL,
|
||||||
|
/*.on_reset */ NULL,
|
||||||
|
/*.on_park */ NULL,
|
||||||
|
/*.on_reporting */ my_on_reporting
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -574,14 +531,14 @@ static switch_status_t load_config(switch_memory_pool_t *pool)
|
||||||
globals.log_dir = switch_core_sprintf(pool, "%s%scdr-pg-csv", val, SWITCH_PATH_SEPARATOR);
|
globals.log_dir = switch_core_sprintf(pool, "%s%scdr-pg-csv", val, SWITCH_PATH_SEPARATOR);
|
||||||
} else if (!strcasecmp(var, "rotate-on-hup")) {
|
} else if (!strcasecmp(var, "rotate-on-hup")) {
|
||||||
globals.rotate = switch_true(val);
|
globals.rotate = switch_true(val);
|
||||||
} else if (!strcasecmp(var, "default-template")) {
|
|
||||||
globals.default_template = switch_core_strdup(pool, val);
|
|
||||||
} else if (!strcasecmp(var, "a-table")) {
|
|
||||||
globals.a_table = switch_core_strdup(pool, val);
|
|
||||||
} else if (!strcasecmp(var, "g-table")) {
|
|
||||||
globals.g_table = switch_core_strdup(pool, val);
|
|
||||||
} else if (!strcasecmp(var, "db-info")) {
|
} else if (!strcasecmp(var, "db-info")) {
|
||||||
globals.db_info = switch_core_strdup(pool, val);
|
globals.db_info = switch_core_strdup(pool, val);
|
||||||
|
} else if (!strcasecmp(var, "db-table") || !strcasecmp(var, "g-table")) {
|
||||||
|
globals.db_table = switch_core_strdup(pool, val);
|
||||||
|
} else if (!strcasecmp(var, "default-template")) {
|
||||||
|
globals.default_template = switch_core_strdup(pool, val);
|
||||||
|
} else if (!strcasecmp(var, "spool-format")) {
|
||||||
|
globals.spool_format = switch_core_strdup(pool, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -591,13 +548,7 @@ static switch_status_t load_config(switch_memory_pool_t *pool)
|
||||||
char *var = (char *) switch_xml_attr(param, "name");
|
char *var = (char *) switch_xml_attr(param, "name");
|
||||||
if (var) {
|
if (var) {
|
||||||
char *tpl;
|
char *tpl;
|
||||||
size_t len = strlen(param->txt) + 2;
|
tpl = switch_core_strdup(pool, param->txt);
|
||||||
if (end_of(param->txt) != '\n') {
|
|
||||||
tpl = switch_core_alloc(pool, len);
|
|
||||||
switch_snprintf(tpl, len, "%s\n", param->txt);
|
|
||||||
} else {
|
|
||||||
tpl = switch_core_strdup(pool, param->txt);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch_core_hash_insert(globals.template_hash, var, tpl);
|
switch_core_hash_insert(globals.template_hash, var, tpl);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding template %s.\n", var);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding template %s.\n", var);
|
||||||
|
@ -607,25 +558,24 @@ static switch_status_t load_config(switch_memory_pool_t *pool)
|
||||||
switch_xml_free(xml);
|
switch_xml_free(xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!globals.log_dir) {
|
||||||
|
globals.log_dir = switch_core_sprintf(pool, "%s%scdr-pg-csv", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zstr(globals.db_info)) {
|
||||||
|
globals.db_info = switch_core_strdup(pool, "dbname=cdr");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zstr(globals.db_table)) {
|
||||||
|
globals.db_table = switch_core_strdup(pool, "cdr");
|
||||||
|
}
|
||||||
|
|
||||||
if (zstr(globals.default_template)) {
|
if (zstr(globals.default_template)) {
|
||||||
globals.default_template = switch_core_strdup(pool, "default");
|
globals.default_template = switch_core_strdup(pool, "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!globals.log_dir) {
|
if (zstr(globals.spool_format)) {
|
||||||
globals.log_dir = switch_core_sprintf(pool, "%s%scdr-pg-csv", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
|
globals.spool_format = switch_core_strdup(pool, "csv");
|
||||||
}
|
|
||||||
|
|
||||||
if (zstr(globals.a_table)) {
|
|
||||||
globals.a_table = switch_core_strdup(pool, "a");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zstr(globals.g_table)) {
|
|
||||||
globals.g_table = switch_core_strdup(pool, "g");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zstr(globals.db_info)) {
|
|
||||||
globals.db_info = switch_core_strdup(pool, "dbname = cdr");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -636,19 +586,21 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_pg_csv_load)
|
||||||
{
|
{
|
||||||
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
switch_status_t status = SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
|
load_config(pool);
|
||||||
|
|
||||||
|
if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((status = switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL)) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||||
return SWITCH_STATUS_GENERR;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_core_add_state_handler(&state_handlers);
|
switch_core_add_state_handler(&state_handlers);
|
||||||
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||||
|
|
||||||
load_config(pool);
|
|
||||||
|
|
||||||
if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
include ../../../../build/modmake.rules
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue