- Initial source of G.722.1/Annex C integration.
 - Disabled some "odd" modes of L16 codec (11kHz & 22kHz mono & stereo) while releasing some payload types.



git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2563 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Nanang Izzuddin 2009-04-01 12:05:34 +00:00
parent 56aaca9ec5
commit 57b8857010
33 changed files with 12336 additions and 480 deletions

View File

@ -42,7 +42,7 @@ RSC=rc.exe
# PROP Target_Dir ""
F90=df.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /MD /W4 /Zi /O2 /I "../include" /I "../../pjlib/include" /I "../src/pjmedia-codec" /I "../../third_party/speex/include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "HAVE_CONFIG_H" /FR /FD /c
# ADD CPP /nologo /MD /W4 /Zi /O2 /I "../include" /I "../../pjlib/include" /I "../src/pjmedia-codec" /I "../../third_party" /I "../../third_party/speex/include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "HAVE_CONFIG_H" /FR /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@ -67,7 +67,7 @@ LIB32=link.exe -lib
# PROP Target_Dir ""
F90=df.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /ZI /Od /I "../include" /I "../../pjlib/include" /I "../src/pjmedia-codec" /I "../../third_party/speex/include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "HAVE_CONFIG_H" /FR /FD /GZ /c
# ADD CPP /nologo /MTd /W4 /Gm /ZI /Od /I "../include" /I "../../pjlib/include" /I "../src/pjmedia-codec" /I "../../third_party" /I "../../third_party/speex/include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D PJ_WIN32=1 /D PJ_M_I386=1 /D "HAVE_CONFIG_H" /FR /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
@ -113,6 +113,10 @@ SOURCE="..\src\pjmedia-codec\g722.c"
# End Source File
# Begin Source File
SOURCE="..\src\pjmedia-codec\g7221.c"
# End Source File
# Begin Source File
SOURCE="..\src\pjmedia-codec\gsm.c"
!IF "$(CFG)" == "pjmedia_codec - Win32 Release"
@ -180,6 +184,10 @@ SOURCE="..\include\pjmedia-codec\g722.h"
# End Source File
# Begin Source File
SOURCE="..\include\pjmedia-codec\g7221.h"
# End Source File
# Begin Source File
SOURCE="..\include\pjmedia-codec\gsm.h"
# End Source File
# Begin Source File

View File

@ -45,7 +45,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party;../../third_party/speex/include;../../third_party"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
@ -93,6 +93,389 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\output\pjmedia-codec-i386-win32-vc8-release"
IntermediateDirectory=".\output\pjmedia-codec-i386-win32-vc8-release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include;../../third_party"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-release/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-release/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-release/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-release.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug-Static|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include;../../third_party"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-debug/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-debug/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-debug/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-debug/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-debug.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-debug/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release-Dynamic|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include;../../third_party"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-release/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-release/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-release/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-release.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug-Dynamic|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include;../../third_party"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-debug/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-debug/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-debug/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-debug/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-debug.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-debug/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release-Static|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include;../../third_party"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-release/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-release/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-release/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-release.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Windows Mobile 6 Standard SDK (ARMV4I)"
OutputDirectory="output\$(ProjectName)-$(PlatformName)-$(ConfigurationName)"
@ -166,83 +549,6 @@
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\output\pjmedia-codec-i386-win32-vc8-release"
IntermediateDirectory=".\output\pjmedia-codec-i386-win32-vc8-release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include;&quot;../../../ipp-samples/speech-codecs/core/usc/include&quot;"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-release/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-release/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-release/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-release.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Windows Mobile 6 Standard SDK (ARMV4I)"
OutputDirectory="output\$(ProjectName)-$(PlatformName)-$(ConfigurationName)"
@ -315,82 +621,6 @@
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Debug-Static|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-debug/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-debug/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-debug/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-debug/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-debug.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-debug/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug-Static|Windows Mobile 6 Standard SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
@ -465,83 +695,6 @@
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release-Dynamic|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include;&quot;../../../ipp-samples/speech-codecs/core/usc/include&quot;"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-release/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-release/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-release/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-release.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
@ -615,82 +768,6 @@
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Debug-Dynamic|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include"
PreprocessorDefinitions="_DEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-debug/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-debug/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-debug/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-debug/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-debug.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-debug/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
@ -765,83 +842,6 @@
<DebuggerTool
/>
</Configuration>
<Configuration
Name="Release-Static|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../include;../../pjlib/include;../../third_party/speex/include;&quot;../../../ipp-samples/speech-codecs/core/usc/include&quot;"
PreprocessorDefinitions="NDEBUG;WIN32;_LIB;PJ_WIN32=1;PJ_M_I386=1;HAVE_CONFIG_H"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.pch"
AssemblerListingLocation=".\output\pjmedia-codec-i386-win32-vc8-release/"
ObjectFile=".\output\pjmedia-codec-i386-win32-vc8-release/"
ProgramDataBaseFileName=".\output\pjmedia-codec-i386-win32-vc8-release/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\lib\pjmedia-codec-i386-win32-vc8-release.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\pjmedia-codec-i386-win32-vc8-release/pjmedia_codec.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release-Static|Windows Mobile 6 Standard SDK (ARMV4I)"
OutputDirectory="Windows Mobile 6 Standard SDK (ARMV4I)\$(ConfigurationName)"
@ -927,6 +927,10 @@
RelativePath="..\src\pjmedia-codec\g722.c"
>
</File>
<File
RelativePath="..\src\pjmedia-codec\g7221.c"
>
</File>
<File
RelativePath="..\src\pjmedia-codec\gsm.c"
>
@ -1204,6 +1208,10 @@
RelativePath="..\include\pjmedia-codec\g722.h"
>
</File>
<File
RelativePath="..\include\pjmedia-codec\g7221.h"
>
</File>
<File
RelativePath="..\include\pjmedia-codec\gsm.h"
>

View File

@ -30,6 +30,7 @@
#include <pjmedia-codec/speex.h>
#include <pjmedia-codec/ilbc.h>
#include <pjmedia-codec/g722.h>
#include <pjmedia-codec/g7221.h>
#include <pjmedia-codec/ipp_codecs.h>
#include <pjmedia-codec/passthrough.h>

View File

@ -233,4 +233,12 @@
#endif
/**
* G.722.1 codec is disabled by default, it's currently under development.
*/
#ifndef PJMEDIA_HAS_G7221_CODEC
# define PJMEDIA_HAS_G7221_CODEC 0
#endif
#endif /* __PJMEDIA_CODEC_CONFIG_H__ */

View File

@ -0,0 +1,113 @@
/* $Id$ */
/*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PJMEDIA_CODECS_G7221_H__
#define __PJMEDIA_CODECS_G7221_H__
/**
* @file pjmedia-codec/g7221.h
* @brief G722.1 codec.
*/
#include <pjmedia-codec/types.h>
/**
* @defgroup PJMED_G7221_CODEC G722.1 Codec
* @ingroup PJMEDIA_CODEC
* @brief Implementation of G722.1 codec
* @{
*
* <b>G722.1 licensed from Polycom®</b>
* <b>G722.1 Annex C licensed from Polycom®</b>
*
* This section describes functions to register and register G722.1 codec
* factory to the codec manager. After the codec factory has been registered,
* application can use @ref PJMEDIA_CODEC API to manipulate the codec.
*
* PJMEDIA G722.1 codec implementation is based on ITU-T Recommendation
* G.722.1 (05/2005) C fixed point implementation including its Annex C.
*
* G722.1 is a low complexity codec that supports for 7kHz and 14kHz bandwidth
* audio signals working at bitrates ranging from 16kbps to 48kbps. It may be
* used with speech or music inputs.
*
* The codec implementation supports for standard and non-standard bitrates.
* By default, the standard bitrates are enabled upon initialization, i.e.:
* - 24kbps and 32kbps for audio bandwidth 7 kHz (16kHz sampling rate),
* - 24kbps, 32kbps, and 48kbps for audio bandwidth 14 kHz (32kHz sampling
* rate).
* The usage of non-standard bitrates must follow this requirements:
* - for sampling rate 16kHz: 16000 to 32000 bps, it must be a multiple of 400
* - for sampling rate 32kHz: 24000 to 48000 bps, it must be a multiple of 400
* Note that currently it is only up to two non-standard modes can be enabled
* at one time.
*/
PJ_BEGIN_DECL
/**
* Initialize and register G722.1 codec factory to pjmedia endpoint.
*
* @param endpt The pjmedia endpoint.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_codec_g7221_init( pjmedia_endpt *endpt );
/**
* Enable and disable G722.1 mode. By default, the standard modes are
* enabled upon initialization, i.e.:
* - sampling rate 16kHz, bitrate 24kbps and 32kbps.
* - sampling rate 32kHz, bitrate 24kbps, 32kbps, and 48kbps.
* This function can also be used for enabling non-standard modes.
* Note that currently it is only up to two non-standard modes can be
* enabled at one time.
*
* @param sample_rate PCM sampling rate, in Hz, valid values are only
* 16000 and 32000.
* @param bitrate G722.1 bitrate, in bps, the valid values are
* standard and non-standard bitrates as described
* above.
* @param enabled PJ_TRUE for enabling specified mode.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_codec_g7221_set_mode(unsigned sample_rate,
unsigned bitrate,
pj_bool_t enabled);
/**
* Unregister G722.1 codecs factory from pjmedia endpoint.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_codec_g7221_deinit(void);
PJ_END_DECL
/**
* @}
*/
#endif /* __PJMEDIA_CODECS_G7221_H__ */

View File

@ -22,7 +22,6 @@
#include <pjmedia-codec/config.h>
/**
* These are the dynamic payload types that are used by codecs in
* this library. Also see the header file <pjmedia/codec.h> for list
@ -44,12 +43,12 @@ enum
PJMEDIA_RTP_PT_SPEEX_UWB, /**< Speex 32KHz */
PJMEDIA_RTP_PT_L16_8KHZ_MONO, /**< L16 @ 8KHz, mono */
PJMEDIA_RTP_PT_L16_8KHZ_STEREO, /**< L16 @ 8KHz, stereo */
PJMEDIA_RTP_PT_L16_11KHZ_MONO, /**< L16 @ 11KHz, mono */
PJMEDIA_RTP_PT_L16_11KHZ_STEREO, /**< L16 @ 11KHz, stereo */
//PJMEDIA_RTP_PT_L16_11KHZ_MONO, /**< L16 @ 11KHz, mono */
//PJMEDIA_RTP_PT_L16_11KHZ_STEREO, /**< L16 @ 11KHz, stereo */
PJMEDIA_RTP_PT_L16_16KHZ_MONO, /**< L16 @ 16KHz, mono */
PJMEDIA_RTP_PT_L16_16KHZ_STEREO, /**< L16 @ 16KHz, stereo */
PJMEDIA_RTP_PT_L16_22KHZ_MONO, /**< L16 @ 22KHz, mono */
PJMEDIA_RTP_PT_L16_22KHZ_STEREO, /**< L16 @ 22KHz, stereo */
//PJMEDIA_RTP_PT_L16_22KHZ_MONO, /**< L16 @ 22KHz, mono */
//PJMEDIA_RTP_PT_L16_22KHZ_STEREO, /**< L16 @ 22KHz, stereo */
PJMEDIA_RTP_PT_L16_32KHZ_MONO, /**< L16 @ 32KHz, mono */
PJMEDIA_RTP_PT_L16_32KHZ_STEREO, /**< L16 @ 32KHz, stereo */
PJMEDIA_RTP_PT_L16_48KHZ_MONO, /**< L16 @ 48KHz, mono */
@ -65,6 +64,11 @@ enum
PJMEDIA_RTP_PT_G722_1_16, /**< G722.1 (16Kbps) */
PJMEDIA_RTP_PT_G722_1_24, /**< G722.1 (24Kbps) */
PJMEDIA_RTP_PT_G722_1_32, /**< G722.1 (32Kbps) */
PJMEDIA_RTP_PT_G7221C_24, /**< G722.1 Annex C (24Kbps)*/
PJMEDIA_RTP_PT_G7221C_32, /**< G722.1 Annex C (32Kbps)*/
PJMEDIA_RTP_PT_G7221C_48, /**< G722.1 Annex C (48Kbps)*/
PJMEDIA_RTP_PT_G7221_RSV1, /**< G722.1 reserve */
PJMEDIA_RTP_PT_G7221_RSV2, /**< G722.1 reserve */
};

View File

@ -0,0 +1,854 @@
/* $Id$ */
/*
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <pjmedia-codec/g7221.h>
#include <pjmedia/codec.h>
#include <pjmedia/errno.h>
#include <pjmedia/endpoint.h>
#include <pjmedia/port.h>
#include <pjmedia/silencedet.h>
#include <pj/assert.h>
#include <pj/log.h>
#include <pj/math.h>
#include <pj/pool.h>
#include <pj/string.h>
#include <pj/os.h>
/*
* Only build this file if PJMEDIA_HAS_G7221_CODEC != 0
*/
#if defined(PJMEDIA_HAS_G7221_CODEC) && PJMEDIA_HAS_G7221_CODEC!=0
#include "../../third_party/g7221/common/defs.h"
#define THIS_FILE "g7221.c"
/* Codec tag, it is the SDP encoding name and also MIME subtype name */
#define CODEC_TAG "G7221"
/* Sampling rates definition */
#define WB_SAMPLE_RATE 16000
#define UWB_SAMPLE_RATE 32000
/* Maximum number of samples per frame. */
#define MAX_SAMPLES_PER_FRAME (UWB_SAMPLE_RATE * 20 / 1000)
/* Maximum number of codec params. */
#define MAX_CODEC_MODES 8
#define START_RSV_MODES_IDX 6
/* Prototypes for G722.1 codec factory */
static pj_status_t test_alloc( pjmedia_codec_factory *factory,
const pjmedia_codec_info *id );
static pj_status_t default_attr( pjmedia_codec_factory *factory,
const pjmedia_codec_info *id,
pjmedia_codec_param *attr );
static pj_status_t enum_codecs( pjmedia_codec_factory *factory,
unsigned *count,
pjmedia_codec_info codecs[]);
static pj_status_t alloc_codec( pjmedia_codec_factory *factory,
const pjmedia_codec_info *id,
pjmedia_codec **p_codec);
static pj_status_t dealloc_codec( pjmedia_codec_factory *factory,
pjmedia_codec *codec );
/* Prototypes for G722.1 codec implementation. */
static pj_status_t codec_init( pjmedia_codec *codec,
pj_pool_t *pool );
static pj_status_t codec_open( pjmedia_codec *codec,
pjmedia_codec_param *attr );
static pj_status_t codec_close( pjmedia_codec *codec );
static pj_status_t codec_modify(pjmedia_codec *codec,
const pjmedia_codec_param *attr );
static pj_status_t codec_parse( pjmedia_codec *codec,
void *pkt,
pj_size_t pkt_size,
const pj_timestamp *ts,
unsigned *frame_cnt,
pjmedia_frame frames[]);
static pj_status_t codec_encode( pjmedia_codec *codec,
const struct pjmedia_frame *input,
unsigned output_buf_len,
struct pjmedia_frame *output);
static pj_status_t codec_decode( pjmedia_codec *codec,
const struct pjmedia_frame *input,
unsigned output_buf_len,
struct pjmedia_frame *output);
static pj_status_t codec_recover( pjmedia_codec *codec,
unsigned output_buf_len,
struct pjmedia_frame *output);
/* Definition for G722.1 codec operations. */
static pjmedia_codec_op codec_op =
{
&codec_init,
&codec_open,
&codec_close,
&codec_modify,
&codec_parse,
&codec_encode,
&codec_decode,
&codec_recover
};
/* Definition for G722.1 codec factory operations. */
static pjmedia_codec_factory_op codec_factory_op =
{
&test_alloc,
&default_attr,
&enum_codecs,
&alloc_codec,
&dealloc_codec
};
/* Structure of G722.1 mode */
typedef struct codec_mode
{
pj_bool_t enabled; /* Is this mode enabled? */
pj_uint8_t pt; /* Payload type. */
unsigned sample_rate; /* Default sampling rate to be used.*/
unsigned bitrate; /* Bitrate. */
char bitrate_str[8]; /* Bitrate in string. */
} codec_mode;
/* G722.1 codec factory */
static struct codec_factory {
pjmedia_codec_factory base; /**< Base class. */
pjmedia_endpt *endpt; /**< PJMEDIA endpoint instance. */
pj_pool_t *pool; /**< Codec factory pool. */
pj_mutex_t *mutex; /**< Codec factory mutex. */
unsigned mode_count; /**< Number of G722.1 modes. */
codec_mode modes[MAX_CODEC_MODES]; /**< The G722.1 modes. */
unsigned mode_rsv_start;/**< Start index of G722.1 non-
standard modes, currently
there can only be up to two
non-standard modes enabled
at the same time. */
} codec_factory;
/* G722.1 codec private data. */
typedef struct codec_private {
pj_pool_t *pool; /**< Pool for each instance. */
pj_bool_t plc_enabled; /**< PLC enabled? */
pj_bool_t vad_enabled; /**< VAD enabled? */
pjmedia_silence_det *vad; /**< PJMEDIA VAD instance. */
pj_timestamp last_tx; /**< Timestamp of last transmit.*/
/* ITU ref implementation seems to leave the codec engine states to be
* managed by the application, so here we go.
*/
/* Common engine state */
pj_uint16_t samples_per_frame; /**< Samples per frame. */
pj_uint16_t bitrate; /**< Coded stream bitrate. */
pj_uint16_t frame_size; /**< Coded frame size. */
pj_uint16_t frame_size_bits; /**< Coded frame size in bits. */
pj_uint16_t number_of_regions; /**< Number of regions. */
/* Encoder specific state */
Word16 *enc_old_frame;
/* Decoder specific state */
Word16 *dec_old_frame;
Rand_Obj dec_randobj;
Word16 dec_old_mag_shift;
Word16 *dec_old_mlt_coefs;
} codec_private_t;
/*
* Helper function for looking up mode based on payload type.
*/
static codec_mode* lookup_mode(unsigned pt)
{
codec_mode* mode = NULL;
unsigned i;
for (i = 0; i < codec_factory.mode_count; ++i) {
mode = &codec_factory.modes[i];
if (mode->pt == pt)
break;
}
return mode;
}
/*
* Helper function to validate G722.1 mode. Valid modes are defined as:
* 1. sample rate must be 16kHz or 32kHz,
* 2. bitrate:
* - for sampling rate 16kHz: 16000 to 32000 bps, it must be a multiple
* of 400 (to keep RTP payload octed-aligned)
* - for sampling rate 32kHz: 24000 to 48000 bps, it must be a multiple
* of 400 (to keep RTP payload octed-aligned)
*/
static pj_bool_t validate_mode(unsigned sample_rate, unsigned bitrate)
{
if (sample_rate == WB_SAMPLE_RATE) {
if (bitrate < 16000 || bitrate > 32000 ||
((bitrate-16000) % 400 != 0))
{
return PJ_FALSE;
}
} else if (sample_rate == UWB_SAMPLE_RATE) {
if (bitrate < 24000 || bitrate > 48000 ||
((bitrate-24000) % 400 != 0))
{
return PJ_FALSE;
}
} else {
return PJ_FALSE;
}
return PJ_TRUE;
}
/*
* Initialize and register G722.1 codec factory to pjmedia endpoint.
*/
PJ_DEF(pj_status_t) pjmedia_codec_g7221_init( pjmedia_endpt *endpt )
{
pjmedia_codec_mgr *codec_mgr;
codec_mode *mode;
pj_status_t status;
if (codec_factory.pool != NULL) {
/* Already initialized. */
return PJ_SUCCESS;
}
/* Initialize codec modes, by default all standard bitrates are enabled */
mode = &codec_factory.modes[codec_factory.mode_count++];
mode->enabled = PJ_TRUE;
mode->pt = PJMEDIA_RTP_PT_G722_1_24;
mode->sample_rate = WB_SAMPLE_RATE;
mode->bitrate = 24000;
pj_utoa(mode->bitrate, mode->bitrate_str);
mode = &codec_factory.modes[codec_factory.mode_count++];
mode->enabled = PJ_TRUE;
mode->pt = PJMEDIA_RTP_PT_G722_1_32;
mode->sample_rate = WB_SAMPLE_RATE;
mode->bitrate = 32000;
pj_utoa(mode->bitrate, mode->bitrate_str);
mode = &codec_factory.modes[codec_factory.mode_count++];
mode->enabled = PJ_TRUE;
mode->pt = PJMEDIA_RTP_PT_G7221C_24;
mode->sample_rate = UWB_SAMPLE_RATE;
mode->bitrate = 24000;
pj_utoa(mode->bitrate, mode->bitrate_str);
mode = &codec_factory.modes[codec_factory.mode_count++];
mode->enabled = PJ_TRUE;
mode->pt = PJMEDIA_RTP_PT_G7221C_32;
mode->sample_rate = UWB_SAMPLE_RATE;
mode->bitrate = 32000;
pj_utoa(mode->bitrate, mode->bitrate_str);
mode = &codec_factory.modes[codec_factory.mode_count++];
mode->enabled = PJ_TRUE;
mode->pt = PJMEDIA_RTP_PT_G7221C_48;
mode->sample_rate = UWB_SAMPLE_RATE;
mode->bitrate = 48000;
pj_utoa(mode->bitrate, mode->bitrate_str);
/* Non-standard bitrates */
/* Bitrate 16kbps is non-standard but rather commonly used. */
mode = &codec_factory.modes[codec_factory.mode_count++];
mode->enabled = PJ_FALSE;
mode->pt = PJMEDIA_RTP_PT_G722_1_16;
mode->sample_rate = WB_SAMPLE_RATE;
mode->bitrate = 16000;
pj_utoa(mode->bitrate, mode->bitrate_str);
/* Reserved two modes for non-standard bitrates */
codec_factory.mode_rsv_start = codec_factory.mode_count;
mode = &codec_factory.modes[codec_factory.mode_count++];
mode->enabled = PJ_FALSE;
mode->pt = PJMEDIA_RTP_PT_G7221_RSV1;
mode = &codec_factory.modes[codec_factory.mode_count++];
mode->enabled = PJ_FALSE;
mode->pt = PJMEDIA_RTP_PT_G7221_RSV2;
pj_assert(codec_factory.mode_count <= MAX_CODEC_MODES);
/* Create G722.1 codec factory. */
codec_factory.base.op = &codec_factory_op;
codec_factory.base.factory_data = NULL;
codec_factory.endpt = endpt;
codec_factory.pool = pjmedia_endpt_create_pool(endpt, "G722.1 codec",
4000, 4000);
if (!codec_factory.pool)
return PJ_ENOMEM;
/* Create mutex. */
status = pj_mutex_create_simple(codec_factory.pool, "G722.1 codec",
&codec_factory.mutex);
if (status != PJ_SUCCESS)
goto on_error;
/* Get the codec manager. */
codec_mgr = pjmedia_endpt_get_codec_mgr(endpt);
if (!codec_mgr) {
status = PJ_EINVALIDOP;
goto on_error;
}
/* Register codec factory to endpoint. */
status = pjmedia_codec_mgr_register_factory(codec_mgr,
&codec_factory.base);
if (status != PJ_SUCCESS)
goto on_error;
/* Done. */
return PJ_SUCCESS;
on_error:
if (codec_factory.mutex) {
pj_mutex_destroy(codec_factory.mutex);
codec_factory.mutex = NULL;
}
pj_pool_release(codec_factory.pool);
codec_factory.pool = NULL;
return status;
}
/**
* Enable and disable G722.1 modes, including non-standard modes.
*/
PJ_DEF(pj_status_t) pjmedia_codec_g7221_set_mode(unsigned sample_rate,
unsigned bitrate,
pj_bool_t enabled)
{
unsigned i;
/* Validate mode */
if (!validate_mode(sample_rate, bitrate))
return PJMEDIA_CODEC_EINMODE;
/* Look up in factory modes table */
for (i = 0; i < codec_factory.mode_count; ++i) {
if (codec_factory.modes[i].sample_rate == sample_rate &&
codec_factory.modes[i].bitrate == bitrate)
{
codec_factory.modes[i].enabled = enabled;
return PJ_SUCCESS;
}
}
/* Mode not found in modes table, this may be a request to enable
* a non-standard G722.1 mode.
*/
/* Non-standard mode need to be initialized first before user
* can disable it.
*/
if (!enabled)
return PJ_ENOTFOUND;
/* Initialize a non-standard mode, look for available space. */
for (i = codec_factory.mode_rsv_start;
i < codec_factory.mode_count; ++i)
{
if (!codec_factory.modes[i].enabled)
{
codec_mode *mode = &codec_factory.modes[i];
mode->enabled = PJ_TRUE;
mode->sample_rate = sample_rate;
mode->bitrate = bitrate;
pj_utoa(mode->bitrate, mode->bitrate_str);
return PJ_SUCCESS;
}
}
/* No space for non-standard mode. */
return PJ_ETOOMANY;
}
/*
* Unregister G722.1 codec factory from pjmedia endpoint.
*/
PJ_DEF(pj_status_t) pjmedia_codec_g7221_deinit(void)
{
pjmedia_codec_mgr *codec_mgr;
pj_status_t status;
if (codec_factory.pool == NULL) {
/* Already deinitialized */
return PJ_SUCCESS;
}
pj_mutex_lock(codec_factory.mutex);
/* Get the codec manager. */
codec_mgr = pjmedia_endpt_get_codec_mgr(codec_factory.endpt);
if (!codec_mgr) {
pj_pool_release(codec_factory.pool);
codec_factory.pool = NULL;
return PJ_EINVALIDOP;
}
/* Unregister G722.1 codec factory. */
status = pjmedia_codec_mgr_unregister_factory(codec_mgr,
&codec_factory.base);
/* Destroy mutex. */
pj_mutex_destroy(codec_factory.mutex);
/* Destroy pool. */
pj_pool_release(codec_factory.pool);
codec_factory.pool = NULL;
return status;
}
/*
* Check if factory can allocate the specified codec.
*/
static pj_status_t test_alloc( pjmedia_codec_factory *factory,
const pjmedia_codec_info *info )
{
PJ_UNUSED_ARG(factory);
/* Type MUST be audio. */
if (info->type != PJMEDIA_TYPE_AUDIO)
return PJMEDIA_CODEC_EUNSUP;
/* Check encoding name. */
if (pj_stricmp2(&info->encoding_name, CODEC_TAG) != 0)
return PJMEDIA_CODEC_EUNSUP;
/* Check clock-rate */
if (info->clock_rate != WB_SAMPLE_RATE &&
info->clock_rate != UWB_SAMPLE_RATE)
{
return PJMEDIA_CODEC_EUNSUP;
}
return PJ_SUCCESS;
}
/*
* Generate default attribute.
*/
static pj_status_t default_attr ( pjmedia_codec_factory *factory,
const pjmedia_codec_info *id,
pjmedia_codec_param *attr )
{
codec_mode *mode;
PJ_ASSERT_RETURN(factory==&codec_factory.base, PJ_EINVAL);
pj_bzero(attr, sizeof(pjmedia_codec_param));
mode = lookup_mode(id->pt);
if (mode == NULL || !mode->enabled)
return PJMEDIA_CODEC_EUNSUP;
attr->info.pt = (pj_uint8_t)id->pt;
attr->info.channel_cnt = 1;
attr->info.clock_rate = mode->sample_rate;
attr->info.max_bps = mode->bitrate;
attr->info.avg_bps = mode->bitrate;
attr->info.pcm_bits_per_sample = 16;
attr->info.frm_ptime = 20;
/* Default flags. */
attr->setting.plc = 1;
attr->setting.vad = 0;
attr->setting.frm_per_pkt = 1;
/* Default FMTP setting */
attr->setting.dec_fmtp.cnt = 1;
attr->setting.dec_fmtp.param[0].name = pj_str("bitrate");
attr->setting.dec_fmtp.param[0].val = pj_str(mode->bitrate_str);
return PJ_SUCCESS;
}
/*
* Enum codecs supported by this factory.
*/
static pj_status_t enum_codecs( pjmedia_codec_factory *factory,
unsigned *count,
pjmedia_codec_info codecs[])
{
unsigned i;
PJ_ASSERT_RETURN(factory==&codec_factory.base, PJ_EINVAL);
PJ_ASSERT_RETURN(codecs && *count > 0, PJ_EINVAL);
*count = PJ_MIN(*count, codec_factory.mode_count);
for (i=0; i<*count; ++i) {
if (!codec_factory.modes[i].enabled)
continue;
pj_bzero(&codecs[i], sizeof(pjmedia_codec_info));
codecs[i].encoding_name = pj_str((char*)CODEC_TAG);
codecs[i].pt = codec_factory.modes[i].pt;
codecs[i].type = PJMEDIA_TYPE_AUDIO;
codecs[i].clock_rate = codec_factory.modes[i].sample_rate;
codecs[i].channel_cnt = 1;
}
return PJ_SUCCESS;
}
/*
* Allocate a new codec instance.
*/
static pj_status_t alloc_codec( pjmedia_codec_factory *factory,
const pjmedia_codec_info *id,
pjmedia_codec **p_codec)
{
codec_private_t *codec_data;
pjmedia_codec *codec;
pj_pool_t *pool;
pj_status_t status;
PJ_ASSERT_RETURN(factory && id && p_codec, PJ_EINVAL);
PJ_ASSERT_RETURN(factory == &codec_factory.base, PJ_EINVAL);
pj_mutex_lock(codec_factory.mutex);
/* Create pool for codec instance */
pool = pjmedia_endpt_create_pool(codec_factory.endpt, "G7221", 512, 512);
codec = PJ_POOL_ZALLOC_T(pool, pjmedia_codec);
codec->op = &codec_op;
codec->factory = factory;
codec->codec_data = PJ_POOL_ZALLOC_T(pool, codec_private_t);
codec_data = (codec_private_t*) codec->codec_data;
codec_data->pool = pool;
/* Create silence detector */
status = pjmedia_silence_det_create(pool, id->clock_rate,
id->clock_rate * 20 / 1000,
&codec_data->vad);
if (status != PJ_SUCCESS) {
pj_mutex_unlock(codec_factory.mutex);
return status;
}
pj_mutex_unlock(codec_factory.mutex);
*p_codec = codec;
return PJ_SUCCESS;
}
/*
* Free codec.
*/
static pj_status_t dealloc_codec( pjmedia_codec_factory *factory,
pjmedia_codec *codec )
{
codec_private_t *codec_data;
pj_pool_t *pool;
PJ_ASSERT_RETURN(factory && codec, PJ_EINVAL);
PJ_ASSERT_RETURN(factory == &codec_factory.base, PJ_EINVAL);
/* Close codec, if it's not closed. */
codec_data = (codec_private_t*) codec->codec_data;
pool = codec_data->pool;
codec_close(codec);
/* Release codec pool */
pj_pool_release(pool);
return PJ_SUCCESS;
}
/*
* Init codec.
*/
static pj_status_t codec_init( pjmedia_codec *codec,
pj_pool_t *pool )
{
PJ_UNUSED_ARG(codec);
PJ_UNUSED_ARG(pool);
return PJ_SUCCESS;
}
/*
* Open codec.
*/
static pj_status_t codec_open( pjmedia_codec *codec,
pjmedia_codec_param *attr )
{
codec_private_t *codec_data = (codec_private_t*) codec->codec_data;
pj_pool_t *pool;
unsigned tmp;
/* Validation mode first! */
if (!validate_mode(attr->info.clock_rate, attr->info.avg_bps))
return PJMEDIA_CODEC_EINMODE;
pool = codec_data->pool;
/* Initialize common state */
codec_data->vad_enabled = (attr->setting.vad != 0);
codec_data->plc_enabled = (attr->setting.plc != 0);
codec_data->bitrate = (pj_uint16_t)attr->info.avg_bps;
codec_data->frame_size_bits = (pj_uint16_t)(attr->info.avg_bps*20/1000);
codec_data->frame_size = (pj_uint16_t)(codec_data->frame_size_bits>>3);
codec_data->samples_per_frame = (pj_uint16_t)
(attr->info.clock_rate*20/1000);
codec_data->number_of_regions = (pj_uint16_t)
(attr->info.clock_rate <= WB_SAMPLE_RATE?
NUMBER_OF_REGIONS:MAX_NUMBER_OF_REGIONS);
/* Initialize encoder state */
tmp = codec_data->samples_per_frame << 1;
codec_data->enc_old_frame = (Word16*)pj_pool_zalloc(pool, tmp);
/* Initialize decoder state */
tmp = codec_data->samples_per_frame;
codec_data->dec_old_frame = (Word16*)pj_pool_zalloc(pool, tmp);
tmp = codec_data->samples_per_frame << 1;
codec_data->dec_old_mlt_coefs = (Word16*)pj_pool_zalloc(pool, tmp);
codec_data->dec_randobj.seed0 = 1;
codec_data->dec_randobj.seed1 = 1;
codec_data->dec_randobj.seed2 = 1;
codec_data->dec_randobj.seed3 = 1;
return PJ_SUCCESS;
}
/*
* Close codec.
*/
static pj_status_t codec_close( pjmedia_codec *codec )
{
PJ_UNUSED_ARG(codec);
return PJ_SUCCESS;
}
/*
* Modify codec settings.
*/
static pj_status_t codec_modify( pjmedia_codec *codec,
const pjmedia_codec_param *attr )
{
codec_private_t *codec_data = (codec_private_t*) codec->codec_data;
codec_data->vad_enabled = (attr->setting.vad != 0);
codec_data->plc_enabled = (attr->setting.plc != 0);
return PJ_SUCCESS;
}
/*
* Get frames in the packet.
*/
static pj_status_t codec_parse( pjmedia_codec *codec,
void *pkt,
pj_size_t pkt_size,
const pj_timestamp *ts,
unsigned *frame_cnt,
pjmedia_frame frames[])
{
codec_private_t *codec_data = (codec_private_t*) codec->codec_data;
unsigned count = 0;
PJ_ASSERT_RETURN(frame_cnt, PJ_EINVAL);
/* Parse based on fixed frame size. */
while (pkt_size >= codec_data->frame_size && count < *frame_cnt) {
frames[count].type = PJMEDIA_FRAME_TYPE_AUDIO;
frames[count].buf = pkt;
frames[count].size = codec_data->frame_size;
frames[count].timestamp.u64 = ts->u64 +
count * codec_data->samples_per_frame;
pkt = (pj_uint8_t*)pkt + codec_data->frame_size;
pkt_size -= codec_data->frame_size;
++count;
}
pj_assert(pkt_size == 0);
*frame_cnt = count;
return PJ_SUCCESS;
}
/*
* Encode frames.
*/
static pj_status_t codec_encode( pjmedia_codec *codec,
const struct pjmedia_frame *input,
unsigned output_buf_len,
struct pjmedia_frame *output)
{
codec_private_t *codec_data = (codec_private_t*) codec->codec_data;
Word16 mlt_coefs[MAX_SAMPLES_PER_FRAME];
Word16 mag_shift;
/* Check frame in & out size */
PJ_ASSERT_RETURN((pj_uint16_t)input->size ==
(codec_data->samples_per_frame<<1),
PJMEDIA_CODEC_EPCMTOOSHORT);
PJ_ASSERT_RETURN(output_buf_len >= codec_data->frame_size,
PJMEDIA_CODEC_EFRMTOOSHORT);
/* Apply silence detection if VAD is enabled */
if (codec_data->vad_enabled) {
pj_bool_t is_silence;
pj_int32_t silence_duration;
pj_assert(codec_data->vad);
silence_duration = pj_timestamp_diff32(&codec_data->last_tx,
&input->timestamp);
is_silence = pjmedia_silence_det_detect(codec_data->vad,
(const pj_int16_t*) input->buf,
(input->size >> 1),
NULL);
if (is_silence &&
PJMEDIA_CODEC_MAX_SILENCE_PERIOD != -1 &&
silence_duration < (PJMEDIA_CODEC_MAX_SILENCE_PERIOD *
(int)codec_data->samples_per_frame / 20))
{
output->type = PJMEDIA_FRAME_TYPE_NONE;
output->buf = NULL;
output->size = 0;
output->timestamp = input->timestamp;
return PJ_SUCCESS;
} else {
codec_data->last_tx = input->timestamp;
}
}
/* Convert input samples to rmlt coefs */
mag_shift = samples_to_rmlt_coefs((Word16*)input->buf,
codec_data->enc_old_frame,
mlt_coefs,
codec_data->samples_per_frame);
/* Encode the mlt coefs */
encoder(codec_data->frame_size_bits,
codec_data->number_of_regions,
mlt_coefs,
mag_shift,
output->buf);
output->type = PJMEDIA_FRAME_TYPE_AUDIO;
output->size = codec_data->frame_size;
return PJ_SUCCESS;
}
/*
* Decode frame.
*/
static pj_status_t codec_decode( pjmedia_codec *codec,
const struct pjmedia_frame *input,
unsigned output_buf_len,
struct pjmedia_frame *output)
{
codec_private_t *codec_data = (codec_private_t*) codec->codec_data;
Word16 mlt_coefs[MAX_SAMPLES_PER_FRAME];
Word16 mag_shift;
Bit_Obj bitobj;
Word16 frame_error_flag = 0;
/* Check frame out length size */
PJ_ASSERT_RETURN(output_buf_len >=
(unsigned)(codec_data->samples_per_frame<<1),
PJMEDIA_CODEC_EPCMTOOSHORT);
/* If input is NULL, perform PLC by settting frame_error_flag to 1 */
if (input) {
/* Check frame in length size */
PJ_ASSERT_RETURN((pj_uint16_t)input->size == codec_data->frame_size,
PJMEDIA_CODEC_EFRMINLEN);
bitobj.code_word_ptr = (Word16*)input->buf;
bitobj.current_word = *bitobj.code_word_ptr;
bitobj.code_bit_count = 0;
bitobj.number_of_bits_left = codec_data->frame_size_bits;
} else {
pj_bzero(&bitobj, sizeof(bitobj));
frame_error_flag = 1;
}
/* Process the input frame to get mlt coefs */
decoder(&bitobj,
&codec_data->dec_randobj,
codec_data->number_of_regions,
mlt_coefs,
&mag_shift,
&codec_data->dec_old_mag_shift,
codec_data->dec_old_mlt_coefs,
frame_error_flag);
/* Convert the mlt_coefs to PCM samples */
rmlt_coefs_to_samples(mlt_coefs,
codec_data->dec_old_frame,
(Word16*)output->buf,
codec_data->samples_per_frame,
mag_shift);
output->type = PJMEDIA_FRAME_TYPE_AUDIO;
output->size = codec_data->samples_per_frame << 1;
return PJ_SUCCESS;
}
/*
* Recover lost frame.
*/
static pj_status_t codec_recover( pjmedia_codec *codec,
unsigned output_buf_len,
struct pjmedia_frame *output)
{
codec_private_t *codec_data = (codec_private_t*) codec->codec_data;
/* Use native PLC when PLC is enabled. */
if (codec_data->plc_enabled)
return codec_decode(codec, NULL, output_buf_len, output);
/* Otherwise just return zero-fill frame. */
output->type = PJMEDIA_FRAME_TYPE_AUDIO;
output->size = codec_data->samples_per_frame << 1;
pjmedia_zero_samples((pj_int16_t*)output->buf,
codec_data->samples_per_frame);
return PJ_SUCCESS;
}
#endif /* PJMEDIA_HAS_G7221_CODEC */

View File

@ -330,6 +330,8 @@ static pj_status_t l16_enum_codecs( pjmedia_codec_factory *factory,
++count;
}
// disable some L16 modes
#if 0
if (count < *max_count) {
/* 11025 Hz mono */
codecs[count].type = PJMEDIA_TYPE_AUDIO;
@ -349,6 +351,7 @@ static pj_status_t l16_enum_codecs( pjmedia_codec_factory *factory,
codecs[count].channel_cnt = 2;
++count;
}
#endif
if (count < *max_count) {
/* 16000 Hz mono */
@ -371,6 +374,8 @@ static pj_status_t l16_enum_codecs( pjmedia_codec_factory *factory,
++count;
}
// disable some L16 modes
#if 0
if (count < *max_count) {
/* 22050 Hz mono */
codecs[count].type = PJMEDIA_TYPE_AUDIO;
@ -391,6 +396,7 @@ static pj_status_t l16_enum_codecs( pjmedia_codec_factory *factory,
codecs[count].channel_cnt = 2;
++count;
}
#endif
if (count < *max_count) {
/* 32000 Hz mono */

View File

@ -12,8 +12,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjlib_util", "pjlib-util\bu
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjlib_util_test", "pjlib-util\build\pjlib_util_test.vcproj", "{ED02BE13-8297-4770-8097-27DC2CCABF9A}"
ProjectSection(ProjectDependencies) = postProject
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjmedia", "pjmedia\build\pjmedia.vcproj", "{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}"
@ -29,76 +29,77 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua", "pjsip-apps\build\pjsua.vcproj", "{8310649E-A25E-4AF0-91E8-9E3CC659BB89}"
ProjectSection(ProjectDependencies) = postProject
{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}
{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
{4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D}
{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
{4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
{2A3F241E-682C-47E1-9543-DC28708B406A} = {2A3F241E-682C-47E1-9543-DC28708B406A}
{E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D}
{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA}
{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
{4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D}
{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjsua_lib", "pjsip\build\pjsua_lib.vcproj", "{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample_debug", "pjsip-apps\build\sample_debug.vcproj", "{A0F1AA62-0F6F-420D-B09A-AC04B6862821}"
ProjectSection(ProjectDependencies) = postProject
{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}
{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
{4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
{E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D}
{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA}
{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "samples", "pjsip-apps\build\samples.vcproj", "{E378A1FC-0C9C-4462-860F-7E60BC1BF84E}"
ProjectSection(ProjectDependencies) = postProject
{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}
{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
{4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D}
{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
{E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D}
{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
{4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D}
{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_pjsip", "pjsip\build\test_pjsip.vcproj", "{B3F7D4E9-702F-4EB4-ADA8-098D0A83D770}"
ProjectSection(ProjectDependencies) = postProject
{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37} = {9CA0FDFB-2172-41FC-B7F1-5CE915EDCB37}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{B8719FD5-E8A6-4A36-943C-891D07F5DD21} = {B8719FD5-E8A6-4A36-943C-891D07F5DD21}
{4B5945CD-0CB3-49AA-A7FF-7612D93F82C0} = {4B5945CD-0CB3-49AA-A7FF-7612D93F82C0}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{2BB84911-C1B4-4747-B93D-36AA82CC5031} = {2BB84911-C1B4-4747-B93D-36AA82CC5031}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjnath", "pjnath\build\pjnath.vcproj", "{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}"
@ -121,29 +122,31 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "third_party\buil
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjnath_test", "pjnath\build\pjnath_test.vcproj", "{553C094C-F581-4A80-9540-D5D7B398A2C6}"
ProjectSection(ProjectDependencies) = postProject
{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4} = {A5D9AA24-08ED-48B9-BD65-F0A25E96BFC4}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjmedia_test", "pjmedia\build\pjmedia_test.vcproj", "{21C0CECF-69DD-4F70-BC2B-9B4DE7F15277}"
ProjectSection(ProjectDependencies) = postProject
{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}
{4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D}
{4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
{E53AA5FF-B737-40AA-BD13-387EFA99023D} = {E53AA5FF-B737-40AA-BD13-387EFA99023D}
{B5FE16F8-3EDB-4110-BD80-B4238CC01E8D} = {B5FE16F8-3EDB-4110-BD80-B4238CC01E8D}
{DA0E03ED-53A7-4050-8A85-90541C5509F8} = {DA0E03ED-53A7-4050-8A85-90541C5509F8}
{855DC8C0-D3E9-4A2E-AE47-116605A7BC9B} = {855DC8C0-D3E9-4A2E-AE47-116605A7BC9B}
{4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9} = {4B059DBA-CD9C-4D0F-BE8C-FFB4EFD498E9}
{3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA} = {3CF9FFA9-8387-4635-9D1B-E7944CBEFEAA}
{7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65} = {7FDE3880-A4AB-49E3-B439-EBEF0A0C7A65}
{6794B975-4E84-4F49-B2DC-C31F2224E03E} = {6794B975-4E84-4F49-B2DC-C31F2224E03E}
{FE07F272-AE7F-4549-9E9F-EF9B80CB1693} = {FE07F272-AE7F-4549-9E9F-EF9B80CB1693}
{4281CA5E-1D48-45D4-A991-2718A454B4BA} = {4281CA5E-1D48-45D4-A991-2718A454B4BA}
{4BF51C21-5A30-423B-82FE-1ED410E5769D} = {4BF51C21-5A30-423B-82FE-1ED410E5769D}
{F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858} = {F0DBAA03-1BA3-4E3B-A2CA-727E3D3AB858}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pjmedia_audiodev", "pjmedia\build\pjmedia_audiodev.vcproj", "{4281CA5E-1D48-45D4-A991-2718A454B4BA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libg7221", "third_party\build\g7221\libg7221.vcproj", "{2A3F241E-682C-47E1-9543-DC28708B406A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -816,6 +819,24 @@ Global
{4281CA5E-1D48-45D4-A991-2718A454B4BA}.Release-Static|Win32.ActiveCfg = Release-Static|Win32
{4281CA5E-1D48-45D4-A991-2718A454B4BA}.Release-Static|Win32.Build.0 = Release-Static|Win32
{4281CA5E-1D48-45D4-A991-2718A454B4BA}.Release-Static|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release-Static|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Debug|Win32.ActiveCfg = Debug|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Debug|Win32.Build.0 = Debug|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Debug-Dynamic|Win32.ActiveCfg = Debug|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Debug-Dynamic|Win32.Build.0 = Debug|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Debug-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Debug-Static|Win32.ActiveCfg = Debug|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Debug-Static|Win32.Build.0 = Debug|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Debug-Static|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Release|Win32.ActiveCfg = Release|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Release|Win32.Build.0 = Release|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Release-Dynamic|Win32.ActiveCfg = Release|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Release-Dynamic|Win32.Build.0 = Release|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Release-Dynamic|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Release-Static|Win32.ActiveCfg = Release|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Release-Static|Win32.Build.0 = Release|Win32
{2A3F241E-682C-47E1-9543-DC28708B406A}.Release-Static|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
Project: "libgsmcodec"=".\THIRD_PARTY\BUILD\GSM\libgsmcodec.dsp" - Package Owner=<4>
Project: "libg7221"=.\third_party\build\g7221\libg7221.dsp - Package Owner=<4>
Package=<5>
{{{
@ -15,7 +15,7 @@ Package=<4>
###############################################################################
Project: "libilbccodec"=".\THIRD_PARTY\BUILD\ILBC\libilbccodec.dsp" - Package Owner=<4>
Project: "libgsmcodec"=.\THIRD_PARTY\BUILD\GSM\libgsmcodec.dsp - Package Owner=<4>
Package=<5>
{{{
@ -27,7 +27,7 @@ Package=<4>
###############################################################################
Project: "libmilenage"=".\third_party\build\milenage\libmilenage.dsp" - Package Owner=<4>
Project: "libilbccodec"=.\THIRD_PARTY\BUILD\ILBC\libilbccodec.dsp - Package Owner=<4>
Package=<5>
{{{
@ -39,7 +39,7 @@ Package=<4>
###############################################################################
Project: "libportaudio"=".\THIRD_PARTY\BUILD\PORTAUDIO\libportaudio.dsp" - Package Owner=<4>
Project: "libmilenage"=.\third_party\build\milenage\libmilenage.dsp - Package Owner=<4>
Package=<5>
{{{
@ -51,7 +51,7 @@ Package=<4>
###############################################################################
Project: "libresample"=".\THIRD_PARTY\BUILD\RESAMPLE\libresample.dsp" - Package Owner=<4>
Project: "libportaudio"=.\THIRD_PARTY\BUILD\PORTAUDIO\libportaudio.dsp - Package Owner=<4>
Package=<5>
{{{
@ -63,7 +63,7 @@ Package=<4>
###############################################################################
Project: "libresample_dll"=".\THIRD_PARTY\BUILD\RESAMPLE\libresample_dll.dsp" - Package Owner=<4>
Project: "libresample"=.\THIRD_PARTY\BUILD\RESAMPLE\libresample.dsp - Package Owner=<4>
Package=<5>
{{{
@ -75,7 +75,7 @@ Package=<4>
###############################################################################
Project: "libspeex"=".\third_party\build\speex\libspeex.dsp" - Package Owner=<4>
Project: "libresample_dll"=.\THIRD_PARTY\BUILD\RESAMPLE\libresample_dll.dsp - Package Owner=<4>
Package=<5>
{{{
@ -87,7 +87,7 @@ Package=<4>
###############################################################################
Project: "libsrtp"=".\third_party\build\srtp\libsrtp.dsp" - Package Owner=<4>
Project: "libspeex"=.\third_party\build\speex\libspeex.dsp - Package Owner=<4>
Package=<5>
{{{
@ -99,7 +99,7 @@ Package=<4>
###############################################################################
Project: "pjlib"=".\pjlib\build\pjlib.dsp" - Package Owner=<4>
Project: "libsrtp"=.\third_party\build\srtp\libsrtp.dsp - Package Owner=<4>
Package=<5>
{{{
@ -111,7 +111,19 @@ Package=<4>
###############################################################################
Project: "pjlib_test"=".\pjlib\build\pjlib_test.dsp" - Package Owner=<4>
Project: "pjlib"=.\pjlib\build\pjlib.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "pjlib_test"=.\pjlib\build\pjlib_test.dsp - Package Owner=<4>
Package=<5>
{{{
@ -156,7 +168,7 @@ Package=<4>
###############################################################################
Project: "pjmedia"=".\pjmedia\build\pjmedia.dsp" - Package Owner=<4>
Project: "pjmedia"=.\pjmedia\build\pjmedia.dsp - Package Owner=<4>
Package=<5>
{{{
@ -168,7 +180,7 @@ Package=<4>
###############################################################################
Project: "pjmedia_audiodev"=".\pjmedia\build\pjmedia_audiodev.dsp" - Package Owner=<4>
Project: "pjmedia_audiodev"=.\pjmedia\build\pjmedia_audiodev.dsp - Package Owner=<4>
Package=<5>
{{{
@ -180,7 +192,7 @@ Package=<4>
###############################################################################
Project: "pjmedia_codec"=".\pjmedia\build\pjmedia_codec.dsp" - Package Owner=<4>
Project: "pjmedia_codec"=.\pjmedia\build\pjmedia_codec.dsp - Package Owner=<4>
Package=<5>
{{{
@ -192,7 +204,7 @@ Package=<4>
###############################################################################
Project: "pjmedia_test"=".\pjmedia\build\pjmedia_test.dsp" - Package Owner=<4>
Project: "pjmedia_test"=.\pjmedia\build\pjmedia_test.dsp - Package Owner=<4>
Package=<5>
{{{
@ -240,7 +252,7 @@ Package=<4>
###############################################################################
Project: "pjnath"=".\pjnath\build\pjnath.dsp" - Package Owner=<4>
Project: "pjnath"=.\pjnath\build\pjnath.dsp - Package Owner=<4>
Package=<5>
{{{
@ -252,7 +264,7 @@ Package=<4>
###############################################################################
Project: "pjnath_test"=".\pjnath\build\pjnath_test.dsp" - Package Owner=<4>
Project: "pjnath_test"=.\pjnath\build\pjnath_test.dsp - Package Owner=<4>
Package=<5>
{{{
@ -273,7 +285,7 @@ Package=<4>
###############################################################################
Project: "pjsip_core"=".\pjsip\build\pjsip_core.dsp" - Package Owner=<4>
Project: "pjsip_core"=.\pjsip\build\pjsip_core.dsp - Package Owner=<4>
Package=<5>
{{{
@ -285,7 +297,7 @@ Package=<4>
###############################################################################
Project: "pjsip_simple"=".\pjsip\build\pjsip_simple.dsp" - Package Owner=<4>
Project: "pjsip_simple"=.\pjsip\build\pjsip_simple.dsp - Package Owner=<4>
Package=<5>
{{{
@ -297,7 +309,7 @@ Package=<4>
###############################################################################
Project: "pjsip_ua"=".\pjsip\build\pjsip_ua.dsp" - Package Owner=<4>
Project: "pjsip_ua"=.\pjsip\build\pjsip_ua.dsp - Package Owner=<4>
Package=<5>
{{{
@ -368,11 +380,14 @@ Package=<4>
Begin Project Dependency
Project_Dep_Name pjmedia_audiodev
End Project Dependency
Begin Project Dependency
Project_Dep_Name libg7221
End Project Dependency
}}}
###############################################################################
Project: "pjsua_lib"=".\pjsip\build\pjsua_lib.dsp" - Package Owner=<4>
Project: "pjsua_lib"=.\pjsip\build\pjsua_lib.dsp - Package Owner=<4>
Package=<5>
{{{
@ -384,7 +399,7 @@ Package=<4>
###############################################################################
Project: "pjturn_client"=".\pjnath\build\pjturn_client.dsp" - Package Owner=<4>
Project: "pjturn_client"=.\pjnath\build\pjturn_client.dsp - Package Owner=<4>
Package=<5>
{{{
@ -405,7 +420,7 @@ Package=<4>
###############################################################################
Project: "pjturn_srv"=".\pjnath\build\pjturn_srv.dsp" - Package Owner=<4>
Project: "pjturn_srv"=.\pjnath\build\pjturn_srv.dsp - Package Owner=<4>
Package=<5>
{{{
@ -543,7 +558,7 @@ Package=<4>
###############################################################################
Project: "test_pjsip"=".\pjsip\build\test_pjsip.dsp" - Package Owner=<4>
Project: "test_pjsip"=.\pjsip\build\test_pjsip.dsp - Package Owner=<4>
Package=<5>
{{{

View File

@ -202,6 +202,16 @@ pj_status_t pjsua_media_subsys_init(const pjsua_media_config *cfg)
}
#endif /* PJMEDIA_HAS_PASSTHROUGH_CODECS */
#if PJMEDIA_HAS_G7221_CODEC
/* Register G722.1 codecs */
status = pjmedia_codec_g7221_init(pjsua_var.med_endpt);
if (status != PJ_SUCCESS) {
pjsua_perror(THIS_FILE, "Error initializing G722.1 codec",
status);
return status;
}
#endif /* PJMEDIA_HAS_G7221_CODEC */
#if PJMEDIA_HAS_L16_CODEC
/* Register L16 family codecs, but disable all */
status = pjmedia_codec_l16_init(pjsua_var.med_endpt, 0);
@ -612,6 +622,10 @@ pj_status_t pjsua_media_subsys_destroy(void)
pjmedia_codec_passthrough_deinit();
# endif /* PJMEDIA_HAS_PASSTHROUGH_CODECS */
# if PJMEDIA_HAS_G7221_CODEC
pjmedia_codec_g7221_deinit();
# endif /* PJMEDIA_HAS_G7221_CODEC */
# if PJMEDIA_HAS_L16_CODEC
pjmedia_codec_l16_deinit();
# endif /* PJMEDIA_HAS_L16_CODEC */

190
third_party/build/g7221/libg7221.dsp vendored Normal file
View File

@ -0,0 +1,190 @@
# Microsoft Developer Studio Project File - Name="libg7221" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=libg7221 - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "libg7221.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "libg7221.mak" CFG="libg7221 - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "libg7221 - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "libg7221 - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "libg7221 - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "output\libg7221-i386-win32-vc6-release"
# PROP Intermediate_Dir "output\libg7221-i386-win32-vc6-release"
# PROP Target_Dir ""
F90=df.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "../.." /I "../../g7221/common" /I "../../g7221/common/stl-files" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\libg7221-i386-win32-vc6-release.lib"
!ELSEIF "$(CFG)" == "libg7221 - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "output\libg7221-i386-win32-vc6-debug"
# PROP Intermediate_Dir "output\libg7221-i386-win32-vc6-debug"
# PROP Target_Dir ""
F90=df.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../.." /I "../../g7221/common" /I "../../g7221/common/stl-files" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\libg7221-i386-win32-vc6-debug.lib"
!ENDIF
# Begin Target
# Name "libg7221 - Win32 Release"
# Name "libg7221 - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Group "common"
# PROP Default_Filter ""
# Begin Group "stl-files"
# PROP Default_Filter ""
# Begin Source File
SOURCE="..\..\g7221\common\stl-files\basop32.c"
# End Source File
# Begin Source File
SOURCE="..\..\g7221\common\stl-files\basop32.h"
# End Source File
# Begin Source File
SOURCE="..\..\g7221\common\stl-files\count.c"
# End Source File
# Begin Source File
SOURCE="..\..\g7221\common\stl-files\count.h"
# End Source File
# Begin Source File
SOURCE="..\..\g7221\common\stl-files\typedef.h"
# End Source File
# End Group
# Begin Source File
SOURCE=..\..\g7221\common\common.c
# End Source File
# Begin Source File
SOURCE=..\..\g7221\common\huff_def.h
# End Source File
# Begin Source File
SOURCE=..\..\g7221\common\huff_tab.c
# End Source File
# Begin Source File
SOURCE=..\..\g7221\common\huff_tab.h
# End Source File
# Begin Source File
SOURCE=..\..\g7221\common\tables.c
# End Source File
# Begin Source File
SOURCE=..\..\g7221\common\tables.h
# End Source File
# End Group
# Begin Group "decode"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\g7221\decode\coef2sam.c
# End Source File
# Begin Source File
SOURCE=..\..\g7221\decode\dct4_s.c
# End Source File
# Begin Source File
SOURCE=..\..\g7221\decode\dct4_s.h
# End Source File
# Begin Source File
SOURCE=..\..\g7221\decode\decoder.c
# End Source File
# End Group
# Begin Group "encode"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\g7221\encode\dct4_a.c
# End Source File
# Begin Source File
SOURCE=..\..\g7221\encode\dct4_a.h
# End Source File
# Begin Source File
SOURCE=..\..\g7221\encode\encoder.c
# End Source File
# Begin Source File
SOURCE=..\..\g7221\encode\sam2coef.c
# End Source File
# End Group
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=..\..\g7221\common\defs.h
# End Source File
# End Group
# End Target
# End Project

477
third_party/build/g7221/libg7221.vcproj vendored Normal file
View File

@ -0,0 +1,477 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="libg7221"
ProjectGUID="{2A3F241E-682C-47E1-9543-DC28708B406A}"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\output\libg7221-i386-win32-vc6-release"
IntermediateDirectory=".\output\libg7221-i386-win32-vc6-release"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../..,../../g7221/common,../../g7221/common/stl-files"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
PrecompiledHeaderFile=".\output\libg7221-i386-win32-vc6-release/libg7221.pch"
AssemblerListingLocation=".\output\libg7221-i386-win32-vc6-release/"
ObjectFile=".\output\libg7221-i386-win32-vc6-release/"
ProgramDataBaseFileName=".\output\libg7221-i386-win32-vc6-release/"
WarningLevel="3"
SuppressStartupBanner="true"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\lib\libg7221-i386-win32-vc6-release.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\libg7221-i386-win32-vc6-release/libg7221.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\output\libg7221-i386-win32-vc6-debug"
IntermediateDirectory=".\output\libg7221-i386-win32-vc6-debug"
ConfigurationType="4"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../..,../../g7221/common,../../g7221/common/stl-files"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
PrecompiledHeaderFile=".\output\libg7221-i386-win32-vc6-debug/libg7221.pch"
AssemblerListingLocation=".\output\libg7221-i386-win32-vc6-debug/"
ObjectFile=".\output\libg7221-i386-win32-vc6-debug/"
ProgramDataBaseFileName=".\output\libg7221-i386-win32-vc6-debug/"
WarningLevel="3"
SuppressStartupBanner="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile="..\..\lib\libg7221-i386-win32-vc6-debug.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
SuppressStartupBanner="true"
OutputFile=".\output\libg7221-i386-win32-vc6-debug/libg7221.bsc"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
>
<Filter
Name="common"
>
<File
RelativePath="..\..\g7221\common\common.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\g7221\common\huff_def.h"
>
</File>
<File
RelativePath="..\..\g7221\common\huff_tab.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\g7221\common\huff_tab.h"
>
</File>
<File
RelativePath="..\..\g7221\common\tables.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\g7221\common\tables.h"
>
</File>
<Filter
Name="stl-files"
>
<File
RelativePath="..\..\g7221\common\stl-files\basop32.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\g7221\common\stl-files\basop32.h"
>
</File>
<File
RelativePath="..\..\g7221\common\stl-files\count.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\g7221\common\stl-files\count.h"
>
</File>
<File
RelativePath="..\..\g7221\common\stl-files\typedef.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="decode"
>
<File
RelativePath="..\..\g7221\decode\coef2sam.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\g7221\decode\dct4_s.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\g7221\decode\dct4_s.h"
>
</File>
<File
RelativePath="..\..\g7221\decode\decoder.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="encode"
>
<File
RelativePath="..\..\g7221\encode\dct4_a.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\g7221\encode\dct4_a.h"
>
</File>
<File
RelativePath="..\..\g7221\encode\encoder.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\g7221\encode\sam2coef.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl"
>
<File
RelativePath="..\..\g7221\common\defs.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

461
third_party/g7221/common/common.c vendored Normal file
View File

@ -0,0 +1,461 @@
/****************************************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
****************************************************************************************/
/****************************************************************************************
Filename: common.c
Purpose: Contains the functions used for both G.722.1 Annex C encoder and decoder
Design Notes:
****************************************************************************************/
/****************************************************************************************
Include files
****************************************************************************************/
#include "defs.h"
#include "huff_def.h"
#include "huff_tab.h"
#include "tables.h"
#include "count.h"
/****************************************************************************************
Function: categorize
Syntax: void categorize(Word16 number_of_available_bits,
Word16 number_of_regions,
Word16 num_categorization_control_possibilities,
Word16 rms_index,
Word16 power_categories,
Word16 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(Word16 number_of_available_bits,
Word16 number_of_regions,
Word16 num_categorization_control_possibilities,
Word16 *rms_index,
Word16 *power_categories,
Word16 *category_balances)
{
Word16 offset;
Word16 temp;
Word16 frame_size;
/* 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
available bits. */
test();
if (number_of_regions == NUMBER_OF_REGIONS)
{
frame_size = DCT_LENGTH;
}
else
{
frame_size = MAX_DCT_LENGTH;
}
temp = sub(number_of_available_bits,frame_size);
test();
if (temp > 0)
{
number_of_available_bits = sub(number_of_available_bits,frame_size);
number_of_available_bits = extract_l(L_mult0(number_of_available_bits,5));
number_of_available_bits = shr(number_of_available_bits,3);
number_of_available_bits = add(number_of_available_bits,frame_size);
}
/* calculate the offset using the original category assignments */
offset = calc_offset(rms_index,number_of_regions,number_of_available_bits);
/* compute the power categories based on the uniform offset */
compute_raw_pow_categories(power_categories,rms_index,number_of_regions,offset);
/* adjust the category assignments */
/* compute the new power categories and category balances */
comp_powercat_and_catbalance(power_categories,category_balances,rms_index,number_of_available_bits,number_of_regions,num_categorization_control_possibilities,offset);
}
/***************************************************************************
Function: comp_powercat_and_catbalance
Syntax: void comp_powercat_and_catbalance(Word16 *power_categories,
Word16 *category_balances,
Word16 *rms_index,
Word16 number_of_available_bits,
Word16 number_of_regions,
Word16 num_categorization_control_possibilities,
Word16 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(Word16 *power_categories,
Word16 *category_balances,
Word16 *rms_index,
Word16 number_of_available_bits,
Word16 number_of_regions,
Word16 num_categorization_control_possibilities,
Word16 offset)
{
Word16 expected_number_of_code_bits;
Word16 region;
Word16 max_region;
Word16 j;
Word16 max_rate_categories[MAX_NUMBER_OF_REGIONS];
Word16 min_rate_categories[MAX_NUMBER_OF_REGIONS];
Word16 temp_category_balances[2*MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES];
Word16 raw_max, raw_min;
Word16 raw_max_index, raw_min_index;
Word16 max_rate_pointer, min_rate_pointer;
Word16 max, min;
Word16 itemp0;
Word16 itemp1;
Word16 min_plus_max;
Word16 two_x_number_of_available_bits;
Word16 temp;
expected_number_of_code_bits = 0;
move16();
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]]);
for (region=0; region<number_of_regions; region++)
{
max_rate_categories[region] = power_categories[region];
move16();
min_rate_categories[region] = power_categories[region];
move16();
}
max = expected_number_of_code_bits;
move16();
min = expected_number_of_code_bits;
move16();
max_rate_pointer = num_categorization_control_possibilities;
move16();
min_rate_pointer = num_categorization_control_possibilities;
move16();
for (j=0; j<num_categorization_control_possibilities-1; j++)
{
min_plus_max = add(max,min);
two_x_number_of_available_bits = shl(number_of_available_bits,1);
temp = sub(min_plus_max,two_x_number_of_available_bits);
test();
if (temp <= 0)
{
raw_min = 99;
move16();
/* Search from lowest freq regions to highest for best */
/* region to reassign to a higher bit rate category. */
for (region=0; region<number_of_regions; region++)
{
test();
if (max_rate_categories[region] > 0)
{
itemp0 = shl(max_rate_categories[region],1);
itemp1 = sub(offset,rms_index[region]);
itemp0 = sub(itemp1,itemp0);
temp = sub(itemp0,raw_min);
test();
if (temp < 0)
{
raw_min = itemp0;
raw_min_index = region;
}
}
}
max_rate_pointer = sub(max_rate_pointer,1);
temp_category_balances[max_rate_pointer] = raw_min_index;
move16();
max = sub(max,expected_bits_table[max_rate_categories[raw_min_index]]);
max_rate_categories[raw_min_index] = sub(max_rate_categories[raw_min_index],1);
move16();
max = add(max,expected_bits_table[max_rate_categories[raw_min_index]]);
}
else
{
raw_max = -99;
move16();
/* Search from highest freq regions to lowest for best region to reassign to
a lower bit rate category. */
max_region = sub(number_of_regions,1);
for (region= max_region; region >= 0; region--)
{
temp = sub(min_rate_categories[region],(NUM_CATEGORIES-1));
test();
if (temp < 0)
{
itemp0 = shl(min_rate_categories[region],1);
itemp1 = sub(offset,rms_index[region]);
itemp0 = sub(itemp1,itemp0);
temp = sub(itemp0,raw_max);
test();
if (temp > 0)
{
raw_max = itemp0;
move16();
raw_max_index = region;
move16();
}
}
}
temp_category_balances[min_rate_pointer] = raw_max_index;
move16();
min_rate_pointer = add(min_rate_pointer,1);
min = sub(min,expected_bits_table[min_rate_categories[raw_max_index]]);
min_rate_categories[raw_max_index] = add(min_rate_categories[raw_max_index],1);
move16();
min = add(min,expected_bits_table[min_rate_categories[raw_max_index]]);
}
}
for (region=0; region<number_of_regions; region++)
{
power_categories[region] = max_rate_categories[region];
move16();
}
for (j=0; j<num_categorization_control_possibilities-1; j++)
{
category_balances[j] = temp_category_balances[max_rate_pointer++];
move16();
}
}
/***************************************************************************
Function: calc_offset
Syntax: offset=calc_offset(Word16 *rms_index,Word16 number_of_regions,Word16 available_bits)
input: Word16 *rms_index
Word16 number_of_regions
Word16 available_bits
output: Word16 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
-------|--------------|----------------|----------------
***************************************************************************/
Word16 calc_offset(Word16 *rms_index,Word16 number_of_regions,Word16 available_bits)
{
Word16 answer;
Word16 delta;
Word16 test_offset;
Word16 region,j;
Word16 power_cats[MAX_NUMBER_OF_REGIONS];
Word16 bits;
Word16 offset;
Word16 temp;
/* initialize vars */
answer = -32;
move16();
delta = 32;
move16();
do
{
test_offset = add(answer,delta);
/* obtain a category for each region */
/* using the test offset */
for (region=0; region<number_of_regions; region++)
{
j = sub(test_offset,rms_index[region]);
j = shr(j,1);
/* Ensure j is between 0 and NUM_CAT-1 */
test();
if (j < 0)
{
j = 0;
move16();
}
temp = sub(j,NUM_CATEGORIES-1);
test();
if (temp > 0)
{
j = sub(NUM_CATEGORIES,1);
move16();
}
power_cats[region] = j;
move16();
}
bits = 0;
move16();
/* compute the number of bits that will be used given the cat assignments */
for (region=0; region<number_of_regions; region++)
bits = add(bits,expected_bits_table[power_cats[region]]);
/* if (bits > available_bits - 32) then divide the offset region for the bin search */
offset = sub(available_bits,32);
temp = sub(bits,offset);
test();
if (temp >= 0)
{
answer = test_offset;
move16();
}
delta = shr(delta,1);
test(); /* for the while loop */
} while (delta > 0);
return(answer);
}
/***************************************************************************
Function: compute_raw_pow_categories
Syntax: void compute_raw_pow_categories(Word16 *power_categories,
Word16 *rms_index,
Word16 number_of_regions,
Word16 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
-------|--------------|----------------|----------------
***************************************************************************/
void compute_raw_pow_categories(Word16 *power_categories,Word16 *rms_index,Word16 number_of_regions,Word16 offset)
{
Word16 region;
Word16 j;
Word16 temp;
for (region=0; region<number_of_regions; region++)
{
j = sub(offset,rms_index[region]);
j = shr(j,1);
/* make sure j is between 0 and NUM_CAT-1 */
test();
if (j < 0)
{
j = 0;
move16();
}
temp = sub(j,(NUM_CATEGORIES-1));
test();
if (temp > 0)
j = sub(NUM_CATEGORIES,1);
power_categories[region] = j;
move16();
}
}

205
third_party/g7221/common/defs.h vendored Normal file
View File

@ -0,0 +1,205 @@
/***********************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
***********************************************************************/
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include "g7221/common/stl-files/typedef.h"
#include "g7221/common/stl-files/basop32.h"
#define PI 3.141592653589793238462
#define MAX_DCT_LENGTH 640
#define DCT_LENGTH 320
#define DCT_LENGTH_DIV_2 160
#define DCT_LENGTH_DIV_4 80
#define DCT_LENGTH_DIV_8 40
#define DCT_LENGTH_DIV_16 20
#define DCT_LENGTH_DIV_32 10
#define DCT_LENGTH_DIV_64 5
#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
#define NUM_CATEGORIES 8
#define NUM_CATEGORIZATION_CONTROL_BITS 4
#define NUM_CATEGORIZATION_CONTROL_POSSIBILITIES 16
#define CORE_SIZE 10
#define DCT_LENGTH_LOG 6
#define MAX_DCT_LENGTH_LOG 7
/* region_size = (BLOCK_SIZE * 0.875)/NUM_REGIONS; */
#define NUMBER_OF_REGIONS 14
#define MAX_NUMBER_OF_REGIONS 28
#define REGION_SIZE 20
#define NUMBER_OF_VALID_COEFS (NUMBER_OF_REGIONS * REGION_SIZE)
#define MAX_NUMBER_OF_VALID_COEFS (MAX_NUMBER_OF_REGIONS * REGION_SIZE)
#define REGION_POWER_TABLE_SIZE 64
#define REGION_POWER_TABLE_NUM_NEGATIVES 24
#define MAX_NUM_CATEGORIZATION_CONTROL_BITS 5
#define MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES 32
#define ENCODER_SCALE_FACTOR 18318.0
/* The MLT output is incorrectly scaled by the factor
product of ENCODER_SCALE_FACTOR and sqrt(160.)
This is now (9/30/96) 1.0/2^(4.5) or 1/22.627.
In the current implementation this
must be an integer power of sqrt(2). The
integer power is ESF_ADJUSTMENT_TO_RMS_INDEX.
The -2 is to conform with the range defined in the spec. */
#define ESF_ADJUSTMENT_TO_RMS_INDEX (9-2)
#define INTERMEDIATE_FILES_FLAG 0
/* Max bit rate is 48000 bits/sec. */
#define MAX_BITS_PER_FRAME 960
/***************************************************************************/
/* Type definitions */
/***************************************************************************/
typedef struct
{
Word16 code_bit_count; /* bit count of the current word */
Word16 current_word; /* current word in the bitstream being processed */
Word16 *code_word_ptr; /* pointer to the bitstream */
Word16 number_of_bits_left; /* number of bits left in the current word */
Word16 next_bit; /* next bit in the current word */
}Bit_Obj;
typedef struct
{
Word16 seed0;
Word16 seed1;
Word16 seed2;
Word16 seed3;
}Rand_Obj;
/***************************************************************************/
/* Function definitions */
/***************************************************************************/
extern Word16 compute_region_powers(Word16 *mlt_coefs,
Word16 mag_shift,
Word16 *drp_num_bits,
UWord16 *drp_code_bits,
Word16 *absolute_region_power_index,
Word16 number_of_regions);
void vector_quantize_mlts(Word16 number_of_available_bits,
Word16 number_of_regions,
Word16 num_categorization_control_possibilities,
Word16 *mlt_coefs,
Word16 *absolute_region_power_index,
Word16 *power_categories,
Word16 *category_balances,
Word16 *p_categorization_control,
Word16 *region_mlt_bit_counts,
UWord32 *region_mlt_bits);
Word16 vector_huffman(Word16 category,
Word16 power_index,
Word16 *raw_mlt_ptr,
UWord32 *word_ptr);
void adjust_abs_region_power_index(Word16 *absolute_region_power_index,Word16 *mlt_coefs,Word16 number_of_regions);
void bits_to_words(UWord32 *region_mlt_bits,Word16 *region_mlt_bit_counts,
Word16 *drp_num_bits,UWord16 *drp_code_bits,Word16 *out_words,
Word16 categorization_control, Word16 number_of_regions,
Word16 num_categorization_control_bits, Word16 number_of_bits_per_frame);
void encoder(Word16 number_of_available_bits,
Word16 number_of_regions,
Word16 *mlt_coefs,
Word16 mag_shift,
Word16 *out_words);
void decoder(Bit_Obj *bitobj,
Rand_Obj *randobj,
Word16 number_of_regions,
Word16 *decoder_mlt_coefs,
Word16 *p_mag_shift,
Word16 *p_old_mag_shift,
Word16 *old_decoder_mlt_coefs,
Word16 frame_error_flag);
Word16 samples_to_rmlt_coefs(Word16 *new_samples,Word16 *history,Word16 *coefs,Word16 dct_length);
void rmlt_coefs_to_samples(Word16 *coefs,
Word16 *old_samples,
Word16 *out_samples,
Word16 dct_length,
Word16 mag_shift);
Word16 index_to_array(Word16 index,Word16 *array,Word16 category);
void categorize(Word16 number_of_available_bits,
Word16 number_of_regions,
Word16 num_categorization_control_possibilities,
Word16 *rms_index,
Word16 *power_categories,
Word16 *category_balances);
Word16 calc_offset(Word16 *rms_index,Word16 number_of_regions,Word16 available_bits);
void compute_raw_pow_categories(Word16 *power_categories,Word16 *rms_index,Word16 number_of_regions,Word16 offset);
void comp_powercat_and_catbalance(Word16 *power_categories,
Word16 *category_balances,
Word16 *rms_index,
Word16 number_of_available_bits,
Word16 number_of_regions,
Word16 num_categorization_control_possibilities,
Word16 offset);
void dct_type_iv_a (Word16 *input,Word16 *output,Word16 dct_length);
void dct_type_iv_s(Word16 *input,Word16 *output,Word16 dct_length);
void decode_envelope(Bit_Obj *bitobj,
Word16 number_of_regions,
Word16 *decoder_region_standard_deviation,
Word16 *absolute_region_power_index,
Word16 *p_mag_shift);
void decode_vector_quantized_mlt_indices(Bit_Obj *bitobj,
Rand_Obj *randobj,
Word16 number_of_regions,
Word16 *decoder_region_standard_deviation,
Word16 *dedecoder_power_categories,
Word16 *dedecoder_mlt_coefs);
void rate_adjust_categories(Word16 categorization_control,
Word16 *decoder_power_categories,
Word16 *decoder_category_balances);
void get_next_bit(Bit_Obj *bitobj);
Word16 get_rand(Rand_Obj *randobj);
void test_4_frame_errors(Bit_Obj *bitobj,
Word16 number_of_regions,
Word16 num_categorization_control_possibilities,
Word16 *frame_error_flag,
Word16 categorization_control,
Word16 *absolute_region_power_index);
void error_handling(Word16 number_of_coefs,
Word16 number_of_valid_coefs,
Word16 *frame_error_flag,
Word16 *decoder_mlt_coefs,
Word16 *old_decoder_mlt_coefs,
Word16 *p_mag_shift,
Word16 *p_old_mag_shift);

53
third_party/g7221/common/huff_def.h vendored Normal file
View File

@ -0,0 +1,53 @@
/***********************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
***********************************************************************/
#define REGION_POWER_STEPSIZE_DB 3.010299957
#define ABS_REGION_POWER_LEVELS 32
#define DIFF_REGION_POWER_LEVELS 24
#define DRP_DIFF_MIN -12
#define DRP_DIFF_MAX 11
#define MAX_NUM_BINS 16
#define MAX_VECTOR_INDICES 625
#define MAX_VECTOR_DIMENSION 5
extern Word16 differential_region_power_bits[MAX_NUMBER_OF_REGIONS][DIFF_REGION_POWER_LEVELS];
extern UWord16 differential_region_power_codes[MAX_NUMBER_OF_REGIONS][DIFF_REGION_POWER_LEVELS];
extern Word16 differential_region_power_decoder_tree[MAX_NUMBER_OF_REGIONS][DIFF_REGION_POWER_LEVELS-1][2];
extern Word16 mlt_quant_centroid[NUM_CATEGORIES][MAX_NUM_BINS];
extern Word16 expected_bits_table[NUM_CATEGORIES];
extern Word16 mlt_sqvh_bitcount_category_0[196];
extern UWord16 mlt_sqvh_code_category_0[196];
extern Word16 mlt_sqvh_bitcount_category_1[100];
extern UWord16 mlt_sqvh_code_category_1[100];
extern Word16 mlt_sqvh_bitcount_category_2[49];
extern UWord16 mlt_sqvh_code_category_2[49];
extern Word16 mlt_sqvh_bitcount_category_3[625];
extern UWord16 mlt_sqvh_code_category_3[625];
extern Word16 mlt_sqvh_bitcount_category_4[256];
extern UWord16 mlt_sqvh_code_category_4[256];
extern Word16 mlt_sqvh_bitcount_category_5[243];
extern UWord16 mlt_sqvh_code_category_5[243];
extern Word16 mlt_sqvh_bitcount_category_6[32];
extern UWord16 mlt_sqvh_code_category_6[32];
extern Word16 *table_of_bitcount_tables[NUM_CATEGORIES-1];
extern UWord16 *table_of_code_tables[NUM_CATEGORIES-1];
extern Word16 mlt_decoder_tree_category_0[180][2];
extern Word16 mlt_decoder_tree_category_1[93][2];
extern Word16 mlt_decoder_tree_category_2[47][2];
extern Word16 mlt_decoder_tree_category_3[519][2];
extern Word16 mlt_decoder_tree_category_4[208][2];
extern Word16 mlt_decoder_tree_category_5[191][2];
extern Word16 mlt_decoder_tree_category_6[31][2];
extern Word16 *table_of_decoder_tables[NUM_CATEGORIES-1];

528
third_party/g7221/common/huff_tab.c vendored Normal file
View File

@ -0,0 +1,528 @@
/***********************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
***********************************************************************/
#include "defs.h"
#include "huff_def.h"
Word16 differential_region_power_bits[MAX_NUMBER_OF_REGIONS][DIFF_REGION_POWER_LEVELS] = {
{99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99},
{ 4, 6, 5, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 4, 5, 7, 8, 9,11,11,12,12,12,12},
{10, 8, 6, 5, 5, 4, 3, 3, 3, 3, 3, 3, 4, 5, 7, 9,11,12,13,15,15,15,16,16},
{12,10, 8, 6, 5, 4, 4, 4, 4, 4, 4, 3, 3, 3, 4, 4, 5, 5, 7, 9,11,13,14,14},
{13,10, 9, 9, 7, 7, 5, 5, 4, 3, 3, 3, 3, 3, 4, 4, 4, 5, 7, 9,11,13,13,13},
{12,13,10, 8, 6, 6, 5, 5, 4, 4, 3, 3, 3, 3, 3, 4, 5, 5, 6, 7, 9,11,14,14},
{12,11, 9, 8, 8, 7, 5, 4, 4, 3, 3, 3, 3, 3, 4, 4, 5, 5, 7, 8,10,13,14,14},
{15,16,15,12,10, 8, 6, 5, 4, 3, 3, 3, 2, 3, 4, 5, 5, 7, 9,11,13,16,16,16},
{14,14,11,10, 9, 7, 7, 5, 5, 4, 3, 3, 2, 3, 3, 4, 5, 7, 9, 9,12,14,15,15},
{ 9, 9, 9, 8, 7, 6, 5, 4, 3, 3, 3, 3, 3, 3, 4, 5, 6, 7, 8,10,11,12,13,13},
{14,12,10, 8, 6, 6, 5, 4, 3, 3, 3, 3, 3, 3, 4, 5, 6, 8, 8, 9,11,14,14,14},
{13,10, 9, 8, 6, 6, 5, 4, 4, 4, 3, 3, 2, 3, 4, 5, 6, 8, 9, 9,11,12,14,14},
{16,13,12,11, 9, 6, 5, 5, 4, 4, 4, 3, 2, 3, 3, 4, 5, 7, 8,10,14,16,16,16},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14},
{13,14,14,14,10, 8, 7, 7, 5, 4, 3, 3, 2, 3, 3, 4, 5, 5, 7, 9,11,14,14,14}};
UWord16 differential_region_power_codes[MAX_NUMBER_OF_REGIONS][DIFF_REGION_POWER_LEVELS] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 8,38,18,10, 7, 6, 3, 2, 0, 1, 7, 6, 5, 4,11,78,158,318,1278,1279,2552,2553,2554,2555},
{36, 8, 3, 5, 0, 1, 7, 6, 4, 3, 2, 5, 3, 4, 5,19,74,150,302,1213,1214,1215,2424,2425},
{2582,644,160,41, 5,11, 7, 5, 4, 1, 0, 6, 4, 7, 3, 6, 4,21,81,323,1290,5167,10332,10333},
{2940,366,181,180,47,46,27,10, 8, 5, 1, 0, 3, 7, 4, 9,12,26,44,182,734,2941,2942,2943},
{3982,7967,994,249,63,26,19,18,14, 8, 6, 1, 0, 2, 5, 7,12,30,27,125,496,1990,15932,15933},
{3254,1626,407,206,202,100,30,14, 3, 5, 3, 0, 2, 4, 2,13,24,31,102,207,812,6511,13020,13021},
{1110,2216,1111,139,35, 9, 3,20,11, 4, 2, 1, 3, 3, 1, 0,21, 5,16,68,276,2217,2218,2219},
{1013,1014,127,62,29, 6, 4,16, 0, 1, 3, 2, 3, 1, 5, 9,17, 5,28,30,252,1015,2024,2025},
{381,380,372,191,94,44,16,10, 7, 3, 1, 0, 2, 6, 9,17,45,92,187,746,1494,2991,5980,5981},
{3036,758,188,45,43,10, 4, 3, 6, 4, 2, 0, 3, 7,11,20,42,44,46,95,378,3037,3038,3039},
{751,92,45,20,26, 4,12, 7, 4, 0, 4, 1, 3, 5, 5, 3,27,21,44,47,186,374,1500,1501},
{45572U,5697,2849,1425,357,45,23, 6,10, 7, 2, 2, 3, 0, 4, 6, 7,88,179,713,11392,45573U,45574U,45575U},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021},
{2511,5016,5018,5017,312,79,38,36,30,14, 6, 0, 2, 1, 3, 5, 8,31,37,157,626,5019,5020,5021}};
Word16 differential_region_power_decoder_tree[MAX_NUMBER_OF_REGIONS][DIFF_REGION_POWER_LEVELS-1][2] = {
{{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0},{ 0, 0}},
{{ 1, 2},{ 3, 4},{ 5, 6},{ 7, 8},{ 9, 10},{ 11,-12},{-11,-10},{ -8, -9},{ -7, -6},{-13, 12},{ -5, -4},{ 0, 13},{ -3,-14},{ -2, 14},{ -1, 15},{-15, 16},{-16, 17},{-17, 18},{ 19, 20},{ 21, 22},{-18,-19},{-20,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5, 6},{ 7, 8},{-10, -9},{ -8,-11},{ -7, -6},{ 9, -5},{ 10,-12},{ -4, 11},{-13, -3},{ 12, -2},{ 13,-14},{ -1, 14},{ 15,-15},{ 0, 16},{-16, 17},{-17, 18},{-18, 19},{ 20, 21},{ 22,-19},{-20,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5, 6},{ 7, 8},{ 9, 10},{-12, 11},{-11,-13},{-10, -9},{ 12,-14},{ -8, -7},{-15, -6},{ 13, -5},{-16, -4},{ 14,-17},{ 15, -3},{ 16,-18},{ -2, 17},{ 18,-19},{ -1, 19},{-20, 20},{ 0, 21},{ 22,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5, 6},{-11,-10},{ 7,-12},{ 8, -9},{ 9,-13},{-14, 10},{ -8,-15},{-16, 11},{ -7, 12},{-17, -6},{ 13, 14},{-18, 15},{ -5, -4},{ 16, 17},{ -3, -2},{-19, 18},{ -1, 19},{-20, 20},{ 21, 22},{ 0,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5, 6},{-12,-11},{-13, 7},{ 8,-14},{-10, 9},{ 10,-15},{ -9, 11},{ -8, 12},{-16, 13},{ -7, -6},{-17, 14},{ -5,-18},{ 15, -4},{ 16,-19},{ 17, -3},{-20, 18},{ -2, 19},{-21, 20},{ 0, 21},{ 22, -1},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5, 6},{-11, 7},{-12,-10},{-13, -9},{ 8, 9},{-14, -8},{ 10,-15},{ -7, 11},{-16, 12},{ -6,-17},{ 13, 14},{ -5, 15},{-18, 16},{ -4, 17},{ -3,-19},{ 18, -2},{-20, 19},{ -1, 20},{ 0, 21},{ 22,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5,-12},{ 6,-11},{-10,-13},{ -9, 7},{ 8,-14},{ 9, -8},{-15, 10},{ -7,-16},{ 11, -6},{ 12,-17},{ 13, -5},{-18, 14},{ 15, -4},{-19, 16},{ 17, -3},{-20, 18},{ 19, 20},{ 21, 22},{ 0, -2},{ -1,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5,-12},{ 6,-13},{-11,-10},{ 7,-14},{ 8, -9},{ 9,-15},{ -8, 10},{ -7,-16},{ 11, 12},{ -6,-17},{ -5, 13},{ 14, 15},{-18, -4},{-19, 16},{ -3, 17},{ 18, -2},{-20, 19},{ 20, 21},{ 22, 0},{ -1,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5, 6},{-11,-10},{-12, -9},{ 7, 8},{-13, -8},{ 9,-14},{ -7, 10},{ -6,-15},{ 11, 12},{ -5,-16},{ 13, 14},{-17, 15},{ -4, 16},{ 17,-18},{ 18, -3},{ -2, 19},{ -1, 0},{-19, 20},{-20, 21},{ 22,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5, 6},{-11, 7},{-10,-12},{ -9, 8},{ -8,-13},{ 9, -7},{ 10,-14},{ -6, 11},{-15, 12},{ -5, 13},{-16, -4},{ 14, 15},{-17, -3},{-18, 16},{ 17,-19},{ -2, 18},{-20, 19},{ -1, 20},{ 21, 22},{ 0,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5,-12},{ 6,-11},{ 7, 8},{-10,-13},{ -9, 9},{ -8,-14},{ 10, -7},{ 11,-15},{ -6, 12},{ -5, 13},{ -4,-16},{ 14, 15},{ -3,-17},{ 16, 17},{-18, -2},{ 18,-19},{ -1, 19},{-20, 20},{-21, 21},{ 22, 0},{-22,-23}},
{{ 1, 2},{ 3, 4},{ 5,-12},{-13, 6},{-11, 7},{-14, 8},{-10, 9},{-15, -9},{ -8, 10},{ -7,-16},{ 11, -6},{ 12, -5},{-17, 13},{ 14,-18},{ 15, -4},{ 16,-19},{ 17, -3},{ 18, -2},{ 19, -1},{-20, 20},{ 21, 22},{ 0,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}},
{{ 1, 2},{ 3, 4},{-12, 5},{-11,-13},{ 6,-14},{-10, 7},{ 8,-15},{ -9, 9},{-16, 10},{ -8,-17},{ 11, 12},{ -7,-18},{ -6, 13},{ 14, -5},{ 15,-19},{ -4, 16},{-20, 17},{ 18, 19},{ 20, 21},{ 22, 0},{ -1, -3},{ -2,-21},{-22,-23}}};
Word16 mlt_quant_centroid[NUM_CATEGORIES][MAX_NUM_BINS] = {
{ 0, 1606, 3119, 4586, 6049, 7502, 8941,10406,11851,13292,14736,16146,17566,19351, 0, 0},
{ 0, 2229, 4341, 6401, 8471,10531,12583,14588,16673,18924, 0, 0, 0, 0, 0, 0},
{ 0, 3055, 5998, 8929,11806,14680,17680, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 4121, 8192,12259,16322, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 5413,11071,16315, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 6785,14300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 8044, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{ 0, 8019, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
Word16 expected_bits_table[NUM_CATEGORIES] = {52, 47, 43, 37, 29, 22, 16, 0};
Word16 mlt_sqvh_bitcount_category_0[196] = {
1, 4, 6, 6, 7, 7, 8, 8, 8, 9, 9,10,11,11, 4, 5,
6, 7, 7, 8, 8, 9, 9, 9, 9,10,11,11, 5, 6, 7, 8,
8, 9, 9, 9, 9,10,10,10,11,12, 6, 7, 8, 9, 9, 9,
9,10,10,10,10,11,12,13, 7, 7, 8, 9, 9, 9,10,10,
10,10,11,11,12,13, 8, 8, 9, 9, 9,10,10,10,10,11,
11,12,13,14, 8, 8, 9, 9,10,10,11,11,11,12,12,13,
13,15, 8, 8, 9, 9,10,10,11,11,11,12,12,13,14,15,
9, 9, 9,10,10,10,11,11,12,13,12,14,15,16, 9, 9,
10,10,10,10,11,12,12,14,14,16,16,16, 9, 9,10,10,
11,11,12,13,13,14,14,15,15,16,10,10,10,11,11,12,
12,13,15,15,16,14,15,15,11,11,11,12,13,13,13,15,
16,16,16,16,14,15,11,11,12,13,13,14,15,16,16,16,
16,16,16,14};
UWord16 mlt_sqvh_code_category_0[196] = {
1, 2, 1, 24, 14, 51, 9, 68, 110, 26, 218, 54, 154, 761, 3, 10,
22, 8, 58, 22, 71, 16, 30, 50, 213, 75, 94, 632, 15, 18, 52, 23,
107, 5, 54, 63, 239, 46, 276, 271, 851, 252, 28, 10, 12, 1, 22, 133,
191, 55, 105, 278, 317, 554, 310, 276, 32, 50, 94, 20, 187, 219, 13, 268,
473, 445, 145, 849, 1277, 623, 1, 14, 0, 55, 238, 121, 120, 269, 318, 530,
639, 1117, 509, 556, 24, 78, 51, 153, 62, 308, 16, 25, 68, 1058, 428, 277,
2233, 1114, 92, 108, 141, 223, 270, 381, 24, 212, 760, 35, 1063, 279, 1717, 3439,
7, 21, 152, 73, 309, 310, 95, 944, 1890, 2232, 1891, 5107,10213, 4981, 61, 62,
9, 79, 474, 475, 848, 1059, 1056, 1716, 139, 4978, 4983, 4983, 140, 186, 76, 444,
144, 633, 1057, 838, 2237, 4472, 4473,10212,10212, 4983, 74, 78, 311, 213, 850, 1062,
1119, 508, 276, 277, 4982, 4473,10212,10212, 208, 70, 555, 418, 68, 510, 2552, 1115,
4980, 4979, 4982, 4982, 4473,10212, 215, 71, 253, 511, 839, 1718, 2488, 6876, 6877, 4979,
4979, 4982, 4982, 4473};
Word16 mlt_sqvh_bitcount_category_1[100] = {
1, 4, 5, 6, 7, 8, 8, 9,10,10, 4, 5, 6, 7, 7, 8,
8, 9, 9,11, 5, 5, 6, 7, 8, 8, 9, 9,10,11, 6, 6,
7, 8, 8, 9, 9,10,11,12, 7, 7, 8, 8, 9, 9,10,11,
11,13, 8, 8, 8, 9, 9,10,10,11,12,14, 8, 8, 8, 9,
10,11,11,12,13,15, 9, 9, 9,10,11,12,12,14,14,14,
9, 9, 9,10,11,12,14,16,14,14,10,10,11,12,13,14,
16,16,16,14};
UWord16 mlt_sqvh_code_category_1[100] = {
1, 2, 11, 27, 31, 9, 120, 31, 275, 310, 1, 0, 12, 5, 33, 54,
102, 111, 246, 448, 10, 14, 31, 39, 59, 100, 114, 202, 485, 969, 24, 26,
36, 52, 103, 30, 120, 242, 69, 1244, 35, 32, 14, 61, 113, 117, 233, 486,
487, 2491, 13, 12, 69, 110, 149, 35, 495, 449, 1978, 7751, 76, 75, 122, 136,
213, 68, 623, 930, 3959, 9961, 115, 16, 107, 225, 424, 850, 1936, 7916, 4981, 4981,
148, 154, 243, 407, 988, 851, 7750,19920, 7916, 4981, 406, 274, 464, 931, 3874, 7917,
19921,19920,19920, 7916};
Word16 mlt_sqvh_bitcount_category_2[49] = {
1, 4, 5, 7, 8, 9,10, 3, 4, 5, 7, 8, 9,10, 5, 5,
6, 7, 8,10,10, 7, 6, 7, 8, 9,10,12, 8, 8, 8, 9,
10,12,14, 8, 9, 9,10,11,15,16, 9,10,11,12,13,16,
15};
UWord16 mlt_sqvh_code_category_2[49] = {
1, 0, 10, 11, 28, 62, 363, 3, 2, 9, 8, 24, 53, 352, 7, 8,
13, 25, 89, 74, 355, 10, 23, 24, 29, 55, 354, 1449, 25, 19, 30, 52,
108, 438, 5793, 91, 36, 63, 353, 725,11584,23170, 180, 75, 218, 439, 2897,23171,
11584};
Word16 mlt_sqvh_bitcount_category_3[625] = {
2, 4, 6, 8,10, 5, 5, 6, 8,10, 7, 8, 8,10,12, 9,
9,10,12,15,10,11,13,16,16, 5, 6, 8,10,11, 5, 6,
8,10,12, 7, 7, 8,10,13, 9, 9,10,12,15,12,11,13,
16,16, 7, 9,10,12,15, 7, 8,10,12,13, 9, 9,11,13,
16,11,11,12,14,16,12,12,14,16,14, 9,11,12,16,16,
9,10,13,15,16,10,11,12,16,16,13,13,16,16,16,16,
16,15,16,16,11,13,16,16,15,11,13,15,16,16,13,13,
16,16,16,14,16,16,16,16,16,16,16,16,16, 4, 6, 8,
10,13, 6, 6, 8,10,13, 9, 8,10,12,16,10,10,11,15,
16,13,12,14,16,16, 5, 6, 8,11,13, 6, 6, 8,10,13,
8, 8, 9,11,14,10,10,12,12,16,13,12,13,15,16, 7,
8, 9,12,16, 7, 8,10,12,14, 9, 9,10,13,16,11,10,
12,15,16,13,13,16,16,15, 9,11,13,16,16, 9,10,12,
15,16,10,11,13,16,16,13,12,16,16,16,16,16,16,16,
16,11,13,16,16,16,11,13,16,16,16,12,13,15,16,16,
16,16,16,16,16,16,16,16,16,16, 6, 8,11,13,16, 8,
8,10,12,16,11,10,11,13,16,12,13,13,15,16,16,16,
14,16,15, 6, 8,10,13,16, 8, 8,10,12,16,10,10,11,
13,16,13,12,13,16,16,14,14,14,16,16, 8, 9,11,13,
16, 8, 9,11,16,14,10,10,12,15,16,12,12,13,16,16,
15,16,16,16,16,10,12,15,16,16,10,12,12,14,16,12,
12,13,16,16,14,15,16,16,16,16,16,16,16,16,12,15,
15,16,16,13,13,16,16,14,14,16,16,16,16,16,16,16,
16,16,14,15,16,16,16, 8,10,13,15,16,10,11,13,16,
16,13,13,14,16,16,16,16,16,16,16,16,16,16,16,16,
8,10,11,15,16, 9,10,12,16,16,12,12,15,16,16,16,
14,16,16,16,16,16,16,16,16, 9,11,14,16,16,10,11,
13,16,16,14,13,14,16,16,16,15,15,16,16,16,16,16,
16,16,11,13,16,16,16,11,13,15,16,16,13,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,15,16,16,16,16,
14,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16, 9,13,16,16,16,11,13,16,16,16,14,15,
16,16,16,15,16,16,16,16,16,16,16,16,16, 9,13,15,
15,16,12,13,14,16,16,16,15,16,16,16,16,16,16,16,
16,16,16,16,16,16,11,13,15,16,16,12,14,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,15,15,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,
16,16,13,16,16,16,16,16,16,16,16,16,16,16,16,16,
16};
UWord16 mlt_sqvh_code_category_3[625] = {
3, 8, 46, 145, 228, 4, 8, 47, 28, 455, 89, 2, 180, 5, 1335, 250,
12, 644, 1311, 139, 729, 251, 870, 2172, 2211, 5, 23, 112, 334, 1469, 21, 3,
5, 111, 2014, 88, 79, 152, 124, 2685, 297, 48, 110, 1310, 149, 501, 1231, 153,
2267, 2569, 57, 13, 653, 2587, 143, 75, 124, 118, 2611, 5242, 61, 50, 253, 3633,
2216, 476, 39, 57, 1926, 2236, 2586, 1329, 1920, 2566, 1926, 296, 233, 2590, 2240, 2217,
253, 613, 867, 144, 318, 614, 252, 2589, 2242, 2218, 872, 866, 2187, 2296, 2155, 2568,
2227, 150, 2567, 2296, 199, 2686, 2160, 2290,19145, 232, 2680, 128, 2192, 2212, 2684, 793,
2281, 2223, 2242, 1934, 2165, 2146, 2291, 2296, 2222, 2189, 2187, 2296, 2296, 6, 4, 82,
725, 3632, 15, 21, 56, 599, 148, 3, 162, 42, 411, 2301, 735, 654, 930, 137,
2586, 869, 1334, 1931, 2300, 2213, 9, 22, 146, 1290, 5240, 5, 12, 53, 630, 875,
80, 9, 8, 86, 2002, 210, 117, 56, 2019, 2162, 146, 397, 868, 131, 2151, 77,
160, 365, 2610, 2252, 59, 54, 41, 2591, 1928, 226, 14, 121, 5792, 2295, 1197, 728,
408, 130, 2157, 3635, 155, 2573, 2587, 130, 314, 64, 144, 2173, 2176, 115, 30, 409,
153, 2590, 631, 26, 4787, 2221, 2174, 2683, 1863, 2572, 319, 2150, 2177, 2194, 2571, 2257,
319, 65, 145, 2251, 2156, 2161, 909, 864, 2193, 2197, 2246, 2588, 5797, 156, 2258, 2221,
2158, 2199, 2214, 2152, 319, 2188, 2264, 2572, 319, 319, 30, 117, 219, 865, 2263, 147,
127, 239, 410, 2247, 27, 324, 1468, 2681, 2180, 1328, 5241, 147, 142, 2237, 2241, 2245,
1921, 2262, 142, 41, 11, 505, 2682, 2591, 0, 26, 229, 2015, 2577, 464, 98, 87,
5243, 2166, 149, 2016, 5244, 2190, 2198, 9573,11598,11599, 2235, 2190, 144, 298, 1004, 5245,
2277, 156, 104, 254, 2560, 1922, 612, 325, 2017, 129, 2588, 2608, 1330, 871, 2144, 2145,
132, 2147, 2148, 2149, 2144, 119, 1331, 133, 2153, 2154, 211, 58, 2609, 1923, 2159, 510,
163, 5246, 2163, 2164, 1924, 134, 2167, 2168, 2168, 2169, 2170, 2171, 2168, 2168, 1332, 135,
136, 2175, 2153, 150, 873, 2178, 2179, 1923, 1925, 2181, 2182, 2183, 2163, 2184, 2185, 2186,
2168, 2168, 1924, 134, 2167, 2168, 2168, 58, 326, 2687, 138, 2191, 31, 66, 874, 2195,
2196, 151, 152, 1927, 2200, 2201, 2202, 2203, 2204, 2205, 2206, 2207, 2208, 2209, 2210, 2205,
55, 103, 1230, 140, 2215, 118, 15, 1333, 2219, 2220, 2018, 511, 141, 2224, 2225, 2226,
1929, 2228, 2229, 2230, 2231, 2232, 2233, 2234, 2229, 366, 1005, 1930, 2238, 2239, 12, 1006,
5247, 2243, 2244, 1932, 3634, 1933, 2248, 2249, 2250, 145, 146, 2253, 2253, 2254, 2255, 2256,
2253, 2253, 1291, 5793, 2259, 2260, 2261, 477, 5794, 147, 2265, 2266, 5795, 2268, 2269, 2270,
2270, 2271, 2272, 2273, 2274, 2274, 2275, 2276, 2273, 2274, 2274, 148, 2278, 2279, 2280, 2260,
1935, 2282, 2283, 2284, 2265, 2285, 2286, 2287, 2270, 2270, 2288, 2289, 2273, 2274, 2274, 2271,
2272, 2273, 2274, 2274, 233, 5796, 2292, 2293, 2294, 1292, 3724, 2297, 2298, 2299, 2000, 151,
2302, 2303, 2200, 152, 2561, 2562, 2563, 2205, 2564, 2565, 2204, 2205, 2205, 363, 154, 154,
155, 2570, 59, 3725, 2001, 2574, 2575, 2576, 157, 2578, 2579, 2224, 2580, 2581, 2582, 2583,
2229, 2584, 2585, 2228, 2229, 2229, 654, 5798, 158, 2589, 2238, 2392, 2003, 2592, 2593, 2243,
2594, 2595, 2596, 2597, 2248, 2598, 2599, 2600, 2253, 2253, 2250, 145, 146, 2253, 2253, 2601,
2602, 2603, 2604, 2260, 2605, 2606, 2607, 6336, 2265, 6337, 6338, 6339, 2270, 2270, 6340, 6341,
2273, 2274, 2274, 2271, 2272, 2273, 2274, 2274, 6342, 6343, 2259, 2260, 2260,38288U,38289U, 147,
2265, 2265, 5795, 2268, 2269, 2270, 2270, 2271, 2272, 2273, 2274, 2274, 2271, 2272, 2273, 2274,
2274};
Word16 mlt_sqvh_bitcount_category_4[256] = {
2, 4, 7,10, 4, 5, 7,10, 7, 8,10,14,11,11,15,15,
4, 5, 9,12, 5, 5, 8,12, 8, 7,10,15,11,11,15,15,
7, 9,12,15, 8, 8,12,15,10,10,13,15,14,14,15,13,
11,13,15,15,11,13,15,15,14,15,15,13,15,15,13,13,
4, 5, 9,13, 5, 6, 9,13, 9, 9,11,15,14,13,15,15,
4, 6, 9,12, 5, 6, 9,13, 9, 8,11,15,13,12,15,15,
7, 9,12,15, 7, 8,11,15,10,10,14,15,14,15,15,14,
10,12,15,15,11,13,15,15,15,15,15,14,15,15,14,14,
6, 9,13,14, 8, 9,12,15,12,12,15,15,15,15,15,15,
7, 9,13,15, 8, 9,12,15,11,12,15,15,15,15,15,15,
9,11,15,15, 9,11,15,15,14,14,15,15,15,15,15,15,
14,15,15,15,14,15,15,15,15,15,15,15,14,14,15,15,
9,12,15,15,12,13,15,15,15,15,15,15,15,15,15,15,
10,12,15,15,12,14,15,15,15,15,15,15,15,15,15,15,
14,15,15,15,15,15,15,15,15,15,15,15,14,14,15,15,
15,15,15,15,15,15,15,15,14,14,15,15,14,14,15,15};
UWord16 mlt_sqvh_code_category_4[256] = {
1, 2, 4, 572, 10, 0, 69, 712, 91, 10, 46, 9182, 1426, 1430,30172,30194,
9, 28, 22, 2258, 16, 25, 142, 2179, 15, 111, 719, 1521, 1131, 1437, 1520,30196,
88, 283, 3803,30193, 13, 236, 2856,30166, 545, 951, 5709, 1522, 3241, 9180,30179, 5709,
1088, 4356,30410,30175, 1146, 377,30162,30163, 8715,30176,30165, 5709,30197,30184, 5709, 5709,
1, 23, 28, 5710, 26, 14, 29, 7538, 102, 103, 1429, 1524, 3237, 7060,30401,30201,
15, 13, 470, 3768, 24, 15, 281, 5747, 24, 181, 1128,30206, 5711, 3531,30156,30158,
116, 100, 2260,30187, 119, 234, 1764,30171, 716, 883, 9183,30164, 3236, 1528,30180, 9183,
885, 2870, 1532,30160, 1431, 5708,30192,30205,30402,30168,30173, 9183,30157,30161, 9183, 9183,
54, 25, 1621,15211, 180, 287, 2261,30198, 808, 811,30411,30413,30414,22986,22987,30411,
24, 273, 376,30159, 137, 280, 2871, 1523, 1768, 2259, 1525,30167, 1526,30169,30170, 1525,
443, 1434, 1527,30174, 474, 1769,30177,30178, 3238, 3239,30181,30181,30182,30183,30181,30181,
3240,30185,30186, 1527, 9181,30188,30189,30177,30190,30191,30181,30181, 3238, 3239,30181,30181,
440, 2857, 1529,30195, 2294, 7061, 1530,30199,30200, 1531,30202,30411,30203,30204,30411,30411,
203, 2872,30207,30400, 189,11492,30403,30404,30405,30406,30407, 1525,30408,30409, 1525, 1525,
8714, 1533,30412, 1527, 1534, 1535,30415,30177,30416,30417,30181,30181, 3238, 3239,30181,30181,
30418,30419, 1527, 1527,30420,30421,30177,30177, 3238, 3239,30181,30181, 3238, 3239,30181,30181};
Word16 mlt_sqvh_bitcount_category_5[243] = {
2, 4, 8, 4, 5, 9, 9,10,14, 4, 6,11, 5, 6,12,10,
11,15, 9,11,15,10,13,15,14,15, 6, 4, 6,12, 6, 7,
12,12,12,15, 5, 7,13, 6, 7,13,12,13,15,10,12,15,
11,13,15,15,15, 7, 8,13,15,11,12,15,15,15, 7,10,
13,15,12,15,15,15,15, 7,15,15, 7,15,15, 7, 6, 7,
7, 4, 5,11, 5, 7,12,11,12,15, 6, 7,13, 7, 8,14,
12,14,15,11,13,15,12,13,15,15,15, 8, 5, 6,13, 7,
8,15,12,14,15, 6, 8,14, 7, 8,15,14,15,15,12,12,
15,12,13,15,15,15, 8, 9,13,15,12,13,15,15,15, 8,
11,13,15,13,13,15,15,15, 8,14,15, 8,15,15, 8, 7,
8, 8, 8,10,15,11,12,15,15,15, 7,10,12,15,12,13,
15,15,15, 8,14,15, 7,15,15, 8, 7, 8, 8, 8,12,15,
12,13,15,15,15, 8,11,13,15,13,15,15,15,15, 8,15,
15, 8,15,15, 8, 7, 8, 8,14,15, 6,15,15, 8, 7, 8,
8,15,15, 8,15,15, 8, 7, 8, 8, 6, 8, 8, 7, 8, 8,
7, 8, 8};
UWord16 mlt_sqvh_code_category_5[243] = {
0, 5, 220, 10, 16, 443, 390, 391,14333, 11, 26, 1566, 26, 54, 3135, 508,
1558,28581, 255, 1782,28599, 885, 6208,28578,14335,28579, 54, 9, 35, 3129, 27, 68,
3537, 1562, 3568,28610, 25, 62, 4078, 58, 118, 7763, 3107, 7758,28563, 778, 3131,28598,
780, 7123,28630,28593,28586, 118, 243, 6210,28614, 1018, 3567,28601,28611,28570, 68, 388,
6256,28619, 1559,28562,28606,28565,28591, 118,28594,28571, 62,28618,28590, 118, 58, 118,
118, 4, 28, 1781, 31, 60, 3134, 1938, 3882,28574, 25, 96, 7757, 49, 126,14244,
3883,14334,28613, 1769, 4077,28602, 3106, 7756,28582,28621,28566, 126, 14, 61, 4079, 61,
138,28491, 3536, 8153,28573, 49, 96,12442, 119, 240,28490,12443,28560,28561, 3111, 3580,
28564, 3130, 7759,28567,28568,28569, 240, 444, 6209,28572, 3569, 6211,28575,28576,28577, 138,
778, 7760,28580, 7761, 7762,28583,28584,28585, 240,14319,28587, 96,28588,28589, 240, 119,
240, 240, 139, 968,28592, 1554, 3581,28595,28596,28597, 60, 971, 3560,28600, 3582, 7132,
28603,28604,28605, 126,14332,28607, 96,28608,28609, 126, 49, 126, 126, 241, 1558,28612,
1563, 6257,28615,28616,28617, 138, 1559, 7133,28620, 6220,28622,28623,28624,28625, 240,28626,
28627, 96,28628,28629, 240, 119, 240, 240, 8152,28631, 61,28632,28633, 138, 61, 138,
138,28634,28635, 96,28636,28637, 240, 119, 240, 240, 49, 96, 96, 119, 240, 240,
119, 240, 240};
Word16 mlt_sqvh_bitcount_category_6[32] = {
1, 4, 4, 6, 4, 6, 6, 8, 4, 6, 6, 8, 6, 9, 8,10,
4, 6, 7, 8, 6, 9, 8,11, 6, 9, 8,10, 8,10, 9,11};
UWord16 mlt_sqvh_code_category_6[32] = {
1, 2, 4, 2, 5, 29, 24, 101, 3, 31, 28, 105, 3, 5, 102, 424,
1, 30, 0, 107, 27, 200, 103, 806, 1, 4, 104, 402, 3, 425, 213, 807};
Word16 *table_of_bitcount_tables[NUM_CATEGORIES-1] = {
mlt_sqvh_bitcount_category_0,
mlt_sqvh_bitcount_category_1,
mlt_sqvh_bitcount_category_2,
mlt_sqvh_bitcount_category_3,
mlt_sqvh_bitcount_category_4,
mlt_sqvh_bitcount_category_5,
mlt_sqvh_bitcount_category_6
};
UWord16 *table_of_code_tables[NUM_CATEGORIES-1] = {
(UWord16 *)mlt_sqvh_code_category_0,
(UWord16 *)mlt_sqvh_code_category_1,
(UWord16 *)mlt_sqvh_code_category_2,
(UWord16 *)mlt_sqvh_code_category_3,
(UWord16 *)mlt_sqvh_code_category_4,
(UWord16 *)mlt_sqvh_code_category_5,
(UWord16 *)mlt_sqvh_code_category_6
};
Word16 mlt_decoder_tree_category_0[180][2] = {
{ 1, 0},{ 2, 3},{ 4, 5},{ 6, 7},{ 8, 9},{ -1, -14},{ 10, 11},{ 12, 13},
{ 14, 15},{ 16, 17},{ 18, 19},{ -15, 20},{ 21, 22},{ 23, -28},{ 24, -2},{ 25, 26},
{ 27, 28},{ 29, 30},{ 31, 32},{ -29, 33},{ -16, 34},{ -3, 35},{ 36, 37},{ -42, 38},
{ 39, 40},{ 41, 42},{ 43, 44},{ -17, 45},{ -43, 46},{ 47, 48},{ -4, 49},{ -56, 50},
{ 51, 52},{ 53, 54},{ 55, 56},{ -57, -5},{ -30, 57},{ 58, 59},{ -18, 60},{ 61, -70},
{ 62, 63},{ 64, -6},{ 65, 66},{ -44, 67},{ -71, 68},{ 69, 70},{ -19, -31},{ -84, 71},
{ 72, 73},{ 74, 75},{ 76, 77},{ -7, 78},{ 79, -20},{ 80, 81},{ -85, 82},{ -98, 83},
{ -58, 84},{ 85, -32},{ -99, 86},{ -8, 87},{ 88, 89},{ -72, -45},{ 90, -33},{ 91,-112},
{ -21, 92},{ -59,-113},{ -46, 93},{ -9, 94},{ -22, 95},{ 96, 97},{ 98, 99},{ -23, -86},
{ 100, 101},{ -34, -73},{ 102,-126},{-127, -35},{ 103, -47},{ 104, 105},{ 106, 107},{-140,-100},
{-114, -87},{ 108, 109},{ 110, 111},{-141, -60},{ 112, -48},{ 113, -24},{ -10, -61},{ 114,-101},
{ 115, 116},{ -74, -36},{ 117,-128},{ 118, -62},{ 119, 120},{ -37, 121},{ -11, -49},{ -88, 122},
{ 123,-115},{-154, -25},{-142, 124},{-155,-129},{ 125, -50},{ 126, 127},{ -76, -75},{ 128, 129},
{ -63, -77},{-102, -39},{ -38, 130},{ -51, 131},{ -89,-116},{-117,-156},{ 132, -52},{ -78, 133},
{ 134,-103},{ 135, 136},{-143, -65},{ 137, -64},{-130,-131},{ -90, 138},{-104, -91},{ -92, 139},
{-169,-183},{ -26,-118},{ 140, 141},{-144, -66},{ -12, 142},{-168, 143},{-105,-157},{ 144,-182},
{ 145, 146},{ -79, 147},{ -53,-170},{ 148, 149},{ -27,-145},{ 150, -80},{-106, -13},{-132, -67},
{-158, -40},{-119, 151},{ 152,-107},{ 153, 154},{ -41,-184},{ 155, 156},{ -54, 157},{-171, 158},
{ -94, 159},{-134,-146},{ -93,-133},{-159,-108},{ 160, -81},{ 161,-160},{ 162, -68},{-120,-122},
{-172, 163},{ -55, -95},{ 164,-109},{-161, -82},{-173,-185},{ 165, -69},{-147,-186},{ 166, 167},
{-121, -96},{ 168,-148},{-174, 169},{ 170,-136},{ -83, 171},{ 172, 173},{-135,-110},{-187, 174},
{-149,-150},{ 175,-123},{-162,-163},{ -97,-175},{-188, 176},{ 177, 178},{ 179,-111},{-151,-124},
{-137,-177},{-176,-125},{-164,-138},{-189,-190},};
Word16 mlt_decoder_tree_category_1[93][2] = {
{ 1, 0},{ 2, 3},{ 4, 5},{ 6, 7},{ 8, -10},{ -1, 9},{ 10, 11},{ 12, 13},
{ -11, 14},{ 15, 16},{ 17, 18},{ -20, -2},{ 19, 20},{ -21, 21},{ 22, 23},{ -12, 24},
{ 25, 26},{ 27, 28},{ 29, 30},{ -30, 31},{ -31, -3},{ 32, -22},{ 33, -13},{ 34, 35},
{ 36, 37},{ 38, 39},{ 40, -4},{ -41, -14},{ 41, -40},{ -32, 42},{ 43, -23},{ 44, 45},
{ 46, 47},{ 48, -5},{ -51, -50},{ -42, 49},{ -33, 50},{ -15, 51},{ 52, 53},{ 54, -24},
{ 55, -43},{ 56, -52},{ 57, -61},{ -60, 58},{ -25, 59},{ -16, -34},{ -6, 60},{ -62, 61},
{ -71, 62},{ -35, -7},{ 63, -72},{ -53, -17},{ 64, -44},{ -26, -70},{ 65, -45},{ -36, 66},
{ -63, 67},{ -80, -54},{ -81, 68},{ -27, 69},{ 70, -82},{ -18, 71},{ 72, -55},{ 73, -64},
{ 74, -73},{ 75, -46},{ -37, 76},{ -91, -8},{ -9, 77},{ -90, -83},{ 78, -28},{ 79, -56},
{ -65, -38},{ -74, 80},{ -19, -57},{ -92, 81},{ -47, -48},{ 82, -66},{ 83, -29},{ -84, 84},
{ -75, -85},{ -67, -93},{ -39, 85},{ -76, 86},{ -58, 87},{ 88, -49},{ -94, 89},{ 90, -68},
{ 91, -78},{ -86, -59},{ -77, -95},{ 92, -69},{ -87, -96},};
Word16 mlt_decoder_tree_category_2[47][2] = {
{ 1, 0},{ 2, 3},{ 4, 5},{ 6, -7},{ -1, 7},{ -8, 8},{ 9, 10},{ 11, 12},
{ 13, -14},{ -15, -9},{ -2, 14},{ 15, 16},{ 17, 18},{ 19, -16},{ 20, -22},{ -10, 21},
{ -21, -3},{ 22, 23},{ 24, 25},{ -23, -17},{ 26, 27},{ 28, -29},{ -11, -28},{ 29, 30},
{ -4, -24},{ -30, 31},{ 32, -18},{ 33, -35},{ -36, 34},{ -31, -12},{ 35, -25},{ -5, -37},
{ 36, 37},{ -42, 38},{ -19, -43},{ -32, 39},{ -13, -38},{ -26, -20},{ 40, -6},{ -44, 41},
{ 42, -39},{ -33, -45},{ 43, -27},{ 44, -46},{ 45, -34},{ -40, 46},{ -41, -47},};
Word16 mlt_decoder_tree_category_3[519][2] = {
{ 1, 2},{ 3, 4},{ 5, 0},{ 6, 7},{ 8, 9},{ 10, 11},{ 12, 13},{ 14, 15},
{ 16, 17},{-125, 18},{ -1, 19},{ 20, 21},{ 22, 23},{ 24, 25},{ -5, -25},{ 26, 27},
{ -6,-150},{ 28, 29},{ 30, 31},{ 32, 33},{ 34, -30},{ 35, 36},{ 37, 38},{ 39, -31},
{-126,-155},{ 40, 41},{-156, 42},{ 43,-130},{ 44,-131},{-151, -26},{ 45, 46},{-250, 47},
{ 48, 49},{ 50, 51},{ 52,-275},{ 53, 54},{ -2, -7},{ 55, 56},{ 57, 58},{ 59, 60},
{ 61, 62},{ 63, 64},{ 65, 66},{ 67, 68},{ 69, 70},{ 71, -50},{ 72,-180},{ 73, 74},
{ 75, 76},{ 77, -55},{ 78,-175},{ 79, -36},{ 80, 81},{ -35, -10},{ 82, 83},{-280, 84},
{ -11, 85},{ 86, -32},{ 87, 88},{ 89,-161},{ 90,-276},{ 91, 92},{-281, 93},{ -8, 94},
{ 95, 96},{ 97,-157},{-181,-400},{-132, 98},{-375, 99},{-160, 100},{-127, 101},{ -27, 102},
{ 103,-251},{ -56, 104},{ 105,-256},{-300, -3},{-152,-255},{ 106, 107},{ -37, 108},{-305, 109},
{-176, 110},{-136, 111},{ -12, 112},{ 113, 114},{ 115,-135},{ 116, 117},{-162, 118},{ -16, -51},
{-186, 119},{ 120, 121},{ 122, 123},{ -41, 124},{ -61, 125},{ 126, 127},{ 128, 129},{ 130, -60},
{ 131, 132},{-306, 133},{ 134,-205},{-405, 135},{ 136, 137},{ 138, 139},{-185, 140},{ 141,-500},
{ -15, 142},{ 143, -80},{ -75, -40},{-301, 144},{ 145, 146},{-200, 147},{ 148, 149},{ 150, 151},
{ 152,-525},{ 153,-177},{-425, 154},{ 155, -13},{-430, 156},{ 157,-406},{ 158, 159},{-206,-380},
{ 160, 161},{ 162, 163},{ 164,-182},{-137, 165},{-286, 166},{ 167,-401},{ 168, 169},{ -42, -33},
{ 170,-166},{ -57,-325},{ 171,-187},{ -38, 172},{ 173, 174},{-165,-330},{ -4,-282},{ 175,-257},
{-261,-311},{-376, 176},{ 177, 178},{ -28, 179},{ 180, -9},{-285, 181},{ 182, 183},{ 184,-277},
{ 185,-133},{-310, -81},{ -85, 186},{-158,-210},{ -17, 187},{ 188, 189},{ 190, -52},{-141, 191},
{ 192,-128},{-191, -20},{ 193,-140},{ 194, 195},{-211,-260},{ 196, 197},{ 198, 199},{ 200, -66},
{-201,-225},{-381, 201},{ 202, 203},{ 204, 205},{ 206, 207},{-163,-287},{ 208,-100},{ 209, 210},
{ 211, 212},{ 213,-252},{-105, -76},{ 214, 215},{ 216, -21},{ -86, -62},{-307, 217},{ -65,-455},
{-550, 218},{ 219, 220},{ 221, 222},{ 223, 224},{ 225,-230},{-142, 226},{-302,-426},{-431, 227},
{ 228, 229},{ 230,-190},{-402, -46},{-153,-450},{-505, 231},{ 232, 233},{ 234, 235},{ 236, 237},
{ 238, 239},{-262, -29},{ 240, 241},{ 242, 243},{-167, -67},{-331,-530},{ 244, 245},{ 246, 247},
{ 248, 249},{ 250, 251},{ 252, 253},{ 254, 255},{ 256, 257},{ 258, 259},{ 260, 261},{ 262,-336},
{ 263,-171},{-192,-207},{-258,-138},{ 264, 265},{ 266, 267},{ 268, 269},{ 270, 271},{ 272, 273},
{ 274, -45},{-335,-411},{ -43, -18},{-265, -71},{-316,-326},{-350,-407},{-146, -14},{ 275, 276},
{ 277, 278},{ 279, 280},{ 281,-216},{ -34,-283},{-291,-312},{-410,-168},{-555, 282},{ -70, -53},
{-235, -87},{ -77,-183},{-315,-332},{-178, -58},{ 283, 284},{ 285, 286},{ 287, 288},{ 289, 290},
{ 291, 292},{ 293, 294},{ 295, 296},{ 297, 298},{-202,-226},{-170,-267},{-134,-290},{-355,-385},
{-386, -47},{-526,-196},{ 299, 300},{ 301, 302},{ 303, 304},{ 305, 306},{ 307, 308},{ 309, 310},
{ 311, 312},{ 313, 314},{ 315, 316},{ 317, 318},{ 319, 320},{ 321, 322},{ 323, 324},{ 325,-111},
{-231,-253},{ -91, -82},{-172,-145},{ -22,-317},{ -90,-356},{-382,-159},{ 326, 327},{ 328, 329},
{ 330, 331},{ 332, 333},{ 334, 335},{-106,-263},{-278,-215},{-110, -39},{-101,-377},{-129, -63},
{-436,-195},{-506,-531},{ 336,-212},{-154,-266},{ -59,-288},{-292,-303},{-337,-432},{-188,-451},
{-456,-460},{-501,-236},{-551, 337},{ 338, 339},{ 340, 341},{ 342, 343},{ 344, 345},{ 346, 347},
{ 348, 349},{ 350, 351},{ 352, 353},{ 354, 355},{ 356, 357},{ 358, 359},{ 360, 361},{ 362, 363},
{ 364, 365},{ 366, 367},{ 368, 369},{ 370, 371},{ 372, 373},{ 374, 375},{ 376, 377},{ 378, 379},
{ 380, 381},{ 382, 383},{ 384, 385},{ 386, 387},{ 388, 389},{ 390, 391},{ 392, 393},{ 394, 395},
{ 396, 397},{ 398, 399},{ 400, 401},{ 402, 403},{ 404, 405},{ 406, 407},{ -72,-272},{-309,-333},
{-340,-360},{ -68,-387},{-184,-416},{-427,-147},{-435,-437},{-115,-480},{-510,-532},{-164,-556},
{ 408,-295},{-296,-297},{-107,-313},{-193,-173},{-320,-327},{-341,-351},{-352,-143},{-378, -19},
{-403,-412},{-268, -54},{ -83,-441},{-442,-457},{-475, -44},{ -97,-511},{-515,-208},{-527,-528},
{-237,-536},{-552, 409},{ 410, 411},{ 412, 413},{ 414, 415},{ 416, 417},{ 418, 419},{ 420, 421},
{ 422, 423},{ 424, 425},{ 426, 427},{ 428, 429},{ 430, 431},{ 432, 433},{ 434, 435},{ 436, 437},
{ 438, 439},{ 440, 441},{ 442, 443},{ 444, 445},{ 446, 447},{ 448, 449},{ 450, 451},{ 452, 453},
{ 454, 455},{ 456, 457},{ 458, 459},{ 460, 461},{ 462, 463},{ 464, 465},{ 466, 467},{ 468, 469},
{ 470, 471},{ 472, 473},{ 474, 475},{ 476, 477},{ 478, 479},{ 480, 481},{ 482, 483},{ 484, 485},
{ 486, 487},{ 488, 489},{ 490, 491},{ 492, 493},{ 494, 495},{ 496, 497},{ 498, 499},{ 500, 501},
{ 502, 503},{ 504, 505},{ 506, 507},{ 508, 509},{ 510, 511},{ 512, 513},{ 514, 515},{ 516, 517},
{ 518,-104},{ -84,-218},{-318,-319},{-117,-321},{-322,-323},{-219,-174},{-243,-328},{-329, -94},
{-228,-194},{-240,-334},{-102,-229},{-169,-338},{-339,-116},{-289,-342},{-343,-345},{-346,-347},
{ -23,-203},{-214,-353},{-204,-220},{-357,-358},{-264,-361},{-362,-363},{-365,-366},{-367, -92},
{-245,-121},{-293,-379},{-108,-232},{-221,-383},{-384,-233},{-294,-241},{-388,-389},{-390,-391},
{-392,-393},{-394,-395},{-396,-397},{-398, -24},{-109,-149},{-242,-404},{ -64, -79},{ -89,-408},
{-409,-213},{-120,-113},{-413,-414},{-415, -96},{-417,-418},{-419,-420},{-421,-422},{-423,-298},
{ -69,-269},{-428,-429},{ -78,-270},{ -88,-433},{-434,-271},{-234,-259},{-438,-439},{-440,-227},
{-179,-443},{-445,-446},{-447,-223},{-238,-452},{-453,-454},{-273,-254},{-246,-458},{-459, -48},
{-461,-462},{-463,-465},{-466,-467},{-468,-470},{-471,-304},{-476,-477},{-478,-112},{-481,-482},
{-483,-485},{-486,-487},{-490,-491},{-103,-118},{-502,-503},{-504,-189},{ -93,-507},{-508,-509},
{-148,-139},{-512,-513},{-308,-516},{-517,-518},{-520,-521},{ -73, -98},{ -95, -49},{-529,-222},
{-217,-197},{-533,-534},{-535,-284},{-537,-538},{-540,-541},{-542,-543},{-545,-546},{-144,-198},
{-314,-553},{-209,-279},{-557,-558},{-560,-561},{-562,-563},{-565,-566},{-567,-575},{-576,-577},
{-578,-580},{-581,-582},{-583,-585},{-586,-587},{-590,-591},{-600,-601},{-605,-606},};
Word16 mlt_decoder_tree_category_4[208][2] = {
{ 1, 2},{ 3, 0},{ 4, 5},{ 6, 7},{ 8, 9},{ 10, 11},{ 12, -64},{ -1, 13},
{ 14, -16},{ -4, 15},{ 16, 17},{ 18, -80},{ -5, 19},{ 20, 21},{ -20, 22},{ 23, -65},
{ -84, -21},{ -68, 24},{ -17, 25},{ 26, 27},{ 28, -81},{ -69, -85},{ 29, 30},{ 31, 32},
{-128, 33},{ 34, 35},{ -2, 36},{ 37, 38},{-144, 39},{ 40, -6},{ 41, 42},{ -32, 43},
{ 44, -8},{ 45, -25},{ -96, 46},{ 47,-100},{ -9, 48},{ 49, -36},{ 50, -24},{ 51, 52},
{ 53,-148},{ 54, 55},{ -22, 56},{ 57, 58},{-132, -89},{ 59, 60},{-101, 61},{ -37, 62},
{ -18, 63},{ -88,-129},{ -66, -70},{ -97, 64},{ -72, -73},{ 65,-145},{-149, -86},{ 66, -33},
{ 67,-133},{ 68, 69},{ 70, 71},{-192, 72},{ 73,-160},{ -82, 74},{-164, 75},{ -10, 76},
{ 77,-208},{ 78, -40},{ 79, 80},{ -3, 81},{ -7, 82},{ 83, 84},{-104, 85},{ 86, -26},
{ 87,-105},{ 88,-112},{ 89, 90},{ 91, -41},{ 92, 93},{ 94, 95},{ -48, 96},{ -90, 97},
{ 98, -28},{ -52, 99},{ -12, 100},{ 101, -74},{ -13,-116},{-161, 102},{ 103, -29},{-102, 104},
{-152,-165},{ 105, 106},{ 107, 108},{ 109, 110},{ 111,-212},{ 112, 113},{-136, 114},{ 115,-137},
{ 116, -23},{ -19,-153},{ -98,-134},{-196, 117},{ 118, 119},{ -38,-193},{-113,-150},{-209, 120},
{ 121, -93},{ -83, 122},{ 123, 124},{ 125, 126},{ 127, 128},{ 129, 130},{ 131, -34},{-146, -53},
{ 132, 133},{ 134, 135},{ 136, 137},{ 138,-130},{ -49, 139},{ 140, 141},{-117, -42},{ -67, -92},
{ 142, -87},{ -77,-197},{ -71, 143},{ 144, 145},{ 146, 147},{ 148, 149},{ 150, 151},{ 152, 153},
{ 154, 155},{ 156, 157},{ 158, 159},{ 160, 161},{ 162, 163},{ 164, 165},{ 166, 167},{ 168, 169},
{-108, -76},{-168,-169},{-176, -44},{-224, -56},{ -45,-180},{ -11,-106},{-213, 170},{ 171, 172},
{ 173, 174},{ 175, 176},{ 177, 178},{ 179, 180},{ 181, 182},{ 183, 184},{ 185, 186},{ 187, 188},
{ 189, 190},{ 191, 192},{ 193, 194},{ 195, 196},{ 197, 198},{ 199, 200},{ 201, 202},{ 203, 204},
{ 205, 206},{ 207,-131},{ -30, -27},{ -43,-151},{ -75,-154},{-156,-162},{-109,-194},{-198,-201},
{-114,-225},{-228,-229},{-141,-142},{ -94,-124},{ -95,-147},{-115,-125},{ -54, -55},{-107, -58},
{ -39,-155},{-121,-157},{-158,-103},{ -14,-122},{-163, -51},{ -57,-166},{-167, -46},{-110,-170},
{-172,-173},{ -61,-177},{-178, -99},{-181,-182},{-184,-185},{-118, -35},{ -15,-195},{ -31, -60},
{-135,-199},{-200, -79},{-202,-204},{-205,-119},{ -91,-210},{-211, -78},{-120,-214},{-215,-216},
{-217,-218},{-220,-221},{ -50,-138},{-226,-139},{-140,-230},{-232,-233},{-240,-241},{-244,-245},
};
Word16 mlt_decoder_tree_category_5[191][2] = {
{ 1, 2},{ 0, 3},{ 4, 5},{ 6, 7},{ 8, 9},{ 10, 11},{ -81, -1},{ 12, 13},
{ 14, -27},{ -3, -9},{ 15, 16},{ 17, 18},{ 19, 20},{-108, 21},{ -4, 22},{ 23, -36},
{ -12, 24},{ -82, 25},{ 26, -84},{ 27, -90},{ -10, -30},{ 28, 29},{ 30, -28},{ 31,-117},
{ -13, 32},{ -39, 33},{ 34,-109},{ 35, -93},{ -85,-111},{ -37, 36},{ -31, 37},{ -91, 38},
{ 39, 40},{ -40,-120},{ 41, 42},{-118, 43},{ -94, 44},{-112,-162},{ 45, 46},{ -2, 47},
{ 48, 49},{-121,-189},{ 50, -54},{ 51, 52},{ 53, -18},{ 54, 55},{ -6, 56},{ 57, -5},
{-135, 58},{ 59, 60},{ 61, 62},{ -63, 63},{ 64, -7},{ -15, 65},{ 66, 67},{ -45, 68},
{ 69, 70},{ 71, -21},{ 72, 73},{ 74, 75},{ 76, 77},{-163, 78},{ 79,-171},{-144, 80},
{ -48, 81},{ -57, 82},{ 83, 84},{-165, 85},{ -16,-198},{ 86, 87},{ -11, 88},{ 89, -99},
{ 90, -83},{ -19, 91},{ 92, 93},{ 94, 95},{ 96, 97},{ 98, 99},{ -87, 100},{ 101, 102},
{-190, -66},{ -33,-192},{ 103, 104},{ 105, 106},{-102, -42},{ 107,-126},{ 108, -29},{-129, -46},
{ -86, -14},{-114, -32},{-172, 109},{ 110, -58},{ -34,-138},{ 111, 112},{ 113, 114},{ 115, 116},
{ 117, 118},{ 119, 120},{-127,-166},{-174, 121},{ 122, 123},{ 124, 125},{ -88, -96},{ 126,-100},
{ -38,-110},{ -22,-136},{ -55,-139},{-201, 127},{ -64,-193},{ 128, -49},{-175,-199},{ 129, 130},
{ 131, 132},{ 133, 134},{ 135, 136},{ 137, 138},{ 139, 140},{ 141, 142},{ 143, 144},{ 145, 146},
{ 147, 148},{ 149, 150},{-103, -92},{ -43,-130},{-145,-147},{-148, -41},{-216,-115},{-119,-123},
{ -95, 151},{ 152, 153},{ 154, 155},{ 156, 157},{ 158, 159},{ 160, 161},{ 162, 163},{ 164, 165},
{ 166, 167},{ 168, 169},{ 170, 171},{ 172, 173},{ 174, 175},{ 176, 177},{ 178, 179},{ 180, 181},
{ 182, 183},{ 184, 185},{ 186, 187},{ 188, 189},{ 190,-153},{-180, -8},{ -97, -24},{-122,-113},
{-124,-125},{ -67, -44},{-128, -69},{-106,-131},{-132,-133},{ -61, -73},{-137,-116},{ -89,-140},
{-141,-142},{ -23, -25},{-146, -17},{-104,-149},{-150,-151},{ -52,-154},{-156,-157},{ -76, -70},
{-164, -51},{ -72,-167},{-168,-169},{ -47, -20},{-173, -59},{-101,-176},{-177,-178},{ -68,-181},
{-183,-184},{ -35, -60},{-191, -98},{ -56,-194},{-195,-196},{ -75, -65},{-200,-105},{-202,-203},
{-204,-205},{-207,-208},{-210,-211},{ -50,-217},{-219,-220},{-225,-226},{-228,-229},};
Word16 mlt_decoder_tree_category_6[31][2] = {
{ 1, 0},{ 2, 3},{ 4, 5},{ 6, 7},{ 8, -16},{ -1, -8},{ -2, -4},{ 9, 10},
{ 11, 12},{ 13, 14},{ 15, 16},{ 17, -24},{ -3, -12},{ -6, 18},{ 19, -20},{ -10, -5},
{ -17, -9},{ -18, 20},{ 21, 22},{ 23, 24},{ 25, -28},{ 26, -7},{ -14, -22},{ -26, -11},
{ 27, -19},{ -25, -13},{ -21, 28},{ 29, -30},{ -27, 30},{ -15, -29},{ -23, -31},};
Word16 *table_of_decoder_tables[NUM_CATEGORIES-1] = {
(Word16 *)mlt_decoder_tree_category_0,
(Word16 *)mlt_decoder_tree_category_1,
(Word16 *)mlt_decoder_tree_category_2,
(Word16 *)mlt_decoder_tree_category_3,
(Word16 *)mlt_decoder_tree_category_4,
(Word16 *)mlt_decoder_tree_category_5,
(Word16 *)mlt_decoder_tree_category_6,
};

42
third_party/g7221/common/huff_tab.h vendored Normal file
View File

@ -0,0 +1,42 @@
/***********************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
***********************************************************************/
extern Word16 differential_region_power_bits[MAX_NUMBER_OF_REGIONS][DIFF_REGION_POWER_LEVELS];
extern UWord16 differential_region_power_codes[MAX_NUMBER_OF_REGIONS][DIFF_REGION_POWER_LEVELS];
extern Word16 differential_region_power_decoder_tree[MAX_NUMBER_OF_REGIONS][DIFF_REGION_POWER_LEVELS-1][2];
extern Word16 mlt_quant_centroid[NUM_CATEGORIES][MAX_NUM_BINS];
extern Word16 expected_bits_table[NUM_CATEGORIES];
extern Word16 mlt_sqvh_bitcount_category_0[196];
extern UWord16 mlt_sqvh_code_category_0[196];
extern Word16 mlt_sqvh_bitcount_category_1[100];
extern UWord16 mlt_sqvh_code_category_1[100];
extern Word16 mlt_sqvh_bitcount_category_2[49];
extern UWord16 mlt_sqvh_code_category_2[49];
extern Word16 mlt_sqvh_bitcount_category_3[625];
extern UWord16 mlt_sqvh_code_category_3[625];
extern Word16 mlt_sqvh_bitcount_category_4[256];
extern UWord16 mlt_sqvh_code_category_4[256];
extern Word16 mlt_sqvh_bitcount_category_5[243];
extern UWord16 mlt_sqvh_code_category_5[243];
extern Word16 mlt_sqvh_bitcount_category_6[32];
extern UWord16 mlt_sqvh_code_category_6[32];
extern Word16 *table_of_bitcount_tables[NUM_CATEGORIES-1];
extern UWord16 *table_of_code_tables[NUM_CATEGORIES-1];
extern Word16 mlt_decoder_tree_category_0[180][2];
extern Word16 mlt_decoder_tree_category_1[93][2];
extern Word16 mlt_decoder_tree_category_2[47][2];
extern Word16 mlt_decoder_tree_category_3[519][2];
extern Word16 mlt_decoder_tree_category_4[208][2];
extern Word16 mlt_decoder_tree_category_5[191][2];
extern Word16 mlt_decoder_tree_category_6[31][2];
extern Word16 *table_of_decoder_tables[NUM_CATEGORIES-1];

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,111 @@
/*
===========================================================================
File: BASOP.H v.1.1 - 05.Jul.2000
===========================================================================
ITU-T STL BASIC OPERATORS
GLOBAL FUNCTION PROTOTYPES
History:
26.Jan.00 v1.0 Incorporated to the STL from updated G.723.1/G.729
basic operator library (based on basic_op.h) and
G.723.1's basop.h.
05.Jul.00 v1.1 Added 32-bit shiftless mult/mac/msub operators
============================================================================
*/
#ifndef BASOP_H_DEFINED
#define BASOP_H_DEFINED 110
/*___________________________________________________________________________
| |
| Constants and Globals |
| |
| $Id $
|___________________________________________________________________________|
*/
extern Flag Overflow;
extern Flag Carry;
#define MAX_32 (Word32)0x7fffffffL
#define MIN_32 (Word32)0x80000000L
#define MAX_16 (Word16)0x7fff
#define MIN_16 (Word16)0x8000
#define UMAX_32 (Word32)0xffffffffL
#define UMIN_32 (Word32)0x00000000L
/*___________________________________________________________________________
| |
| Prototypes for basic arithmetic operators |
|___________________________________________________________________________|
*/
Word16 add (Word16 var1, Word16 var2); /* Short add, 1 */
Word16 sub (Word16 var1, Word16 var2); /* Short sub, 1 */
Word16 abs_s (Word16 var1); /* Short abs, 1 */
Word16 shl (Word16 var1, Word16 var2); /* Short shift left, 1 */
Word16 shr (Word16 var1, Word16 var2); /* Short shift right, 1 */
Word16 mult (Word16 var1, Word16 var2); /* Short mult, 1 */
Word32 L_mult (Word16 var1, Word16 var2); /* Long mult, 1 */
Word16 negate (Word16 var1); /* Short negate, 1 */
Word16 extract_h (Word32 L_var1); /* Extract high, 1 */
Word16 extract_l (Word32 L_var1); /* Extract low, 1 */
Word16 round (Word32 L_var1); /* Round, 1 */
Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2); /* Mac, 1 */
Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2); /* Msu, 1 */
Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2); /* Mac without
sat, 1 */
Word32 L_msuNs (Word32 L_var3, Word16 var1, Word16 var2); /* Msu without
sat, 1 */
Word32 L_add (Word32 L_var1, Word32 L_var2); /* Long add, 2 */
Word32 L_sub (Word32 L_var1, Word32 L_var2); /* Long sub, 2 */
Word32 L_add_c (Word32 L_var1, Word32 L_var2); /* Long add with c, 2 */
Word32 L_sub_c (Word32 L_var1, Word32 L_var2); /* Long sub with c, 2 */
Word32 L_negate (Word32 L_var1); /* Long negate, 2 */
Word16 mult_r (Word16 var1, Word16 var2); /* Mult with round, 2 */
Word32 L_shl (Word32 L_var1, Word16 var2); /* Long shift left, 2 */
Word32 L_shr (Word32 L_var1, Word16 var2); /* Long shift right, 2*/
Word16 shr_r (Word16 var1, Word16 var2); /* Shift right with
round, 2 */
Word16 mac_r (Word32 L_var3, Word16 var1, Word16 var2); /* Mac with
rounding,2 */
Word16 msu_r (Word32 L_var3, Word16 var1, Word16 var2); /* Msu with
rounding,2 */
Word32 L_deposit_h (Word16 var1); /* 16 bit var1 -> MSB, 2 */
Word32 L_deposit_l (Word16 var1); /* 16 bit var1 -> LSB, 2 */
Word32 L_shr_r (Word32 L_var1, Word16 var2); /* Long shift right with
round, 3 */
Word32 L_abs (Word32 L_var1); /* Long abs, 3 */
Word32 L_sat (Word32 L_var1); /* Long saturation, 4 */
Word16 norm_s (Word16 var1); /* Short norm, 15 */
Word16 div_s (Word16 var1, Word16 var2); /* Short division, 18 */
Word16 norm_l (Word32 L_var1); /* Long norm, 30 */
/*
Additional G.723.1 operators
*/
Word32 L_mls( Word32, Word16 ) ; /* Weight FFS; currently assigned 1 */
Word16 div_l( Word32, Word16 ) ; /* Weight FFS; currently assigned 1 */
Word16 i_mult(Word16 a, Word16 b); /* Weight FFS; currently assigned 1 */
/*
New shiftless operators, not used in G.729/G.723.1
*/
Word32 L_mult0(Word16 v1, Word16 v2); /* 32-bit Multiply w/o shift 1 */
Word32 L_mac0(Word32 L_v3, Word16 v1, Word16 v2); /* 32-bit Mac w/o shift 1 */
Word32 L_msu0(Word32 L_v3, Word16 v1, Word16 v2); /* 32-bit Msu w/o shift 1 */
/*
Additional G.722.1 operators
*/
UWord32 LU_shl (UWord32 L_var1, Word16 var2);
UWord32 LU_shr (UWord32 L_var1, Word16 var2);
#endif /* BASOP_H_DEFINED */
/* ************************* END OF BASIC_OP.H ************************* */

View File

@ -0,0 +1,303 @@
/*
***************************************************************************
*
* This file contains functions for the automatic complexity calculation
* $Id $
***************************************************************************
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "typedef.h"
#include "count.h"
/* Global counter variable for calculation of complexity weight */
BASIC_OP multiCounter[MAXCOUNTERS];
int currCounter=0; /* Zero equals global counter */
/*BASIC_OP counter;*/
const BASIC_OP op_weight =
{
/* G.729 & G.723.1 common operators */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 4, 15, 18, 30, 1, 2, 1, 2, 2,
/* G.723.1 exclusives */
6, 1, 1,
/* shiftless 32-bit operators */
1, 1, 1,
/* G.722.1 exclusives */
1, 1
};
/* function prototypes */
Word32 TotalWeightedOperation (void);
Word32 DeltaWeightedOperation (void);
/* local variable */
#if WMOPS
/* Counters for separating counting for different objects */
static int maxCounter=0;
static char* objectName[MAXCOUNTERS+1];
static Word16 fwc_corr[MAXCOUNTERS+1];
#define NbFuncMax 1024
static Word16 funcid[MAXCOUNTERS], nbframe[MAXCOUNTERS];
static Word32 glob_wc[MAXCOUNTERS], wc[MAXCOUNTERS][NbFuncMax];
static float total_wmops[MAXCOUNTERS];
static Word32 LastWOper[MAXCOUNTERS];
static char* my_strdup(const char *s)
/*
* duplicates UNIX function strdup() which is not ANSI standard:
* -- malloc() memory area big enough to hold the string s
* -- copy string into new area
* -- return pointer to new area
*
* returns NULL if either s==NULL or malloc() fails
*/
{
char *dup;
if (s == NULL)
return NULL;
/* allocate memory for copy of ID string (including string terminator) */
/* NOTE: the ID strings will never be deallocated because there is no
way to "destroy" a counter that is not longer needed */
if ((dup = (char *) malloc(strlen(s)+1)) == NULL)
return NULL;
return strcpy(dup, s);
}
#endif
int getCounterId(char *objectNameArg)
{
#if WMOPS
if(maxCounter>=MAXCOUNTERS-1) return 0;
objectName[++maxCounter]=my_strdup(objectNameArg);
return maxCounter;
#else
return 0; /* Dummy */
#endif
}
void setCounter(int counterId)
{
#if WMOPS
if(counterId>maxCounter || counterId<0)
{
currCounter=0;
return;
}
currCounter=counterId;
#endif
}
#if WMOPS
static Word32 WMOPS_frameStat()
/* calculate the WMOPS seen so far and update the global
per-frame maximum (glob_wc)
*/
{
Word32 tot;
tot = TotalWeightedOperation ();
if (tot > glob_wc[currCounter])
glob_wc[currCounter] = tot;
/* check if fwc() was forgotten at end of last frame */
if (tot > LastWOper[currCounter]) {
if (!fwc_corr[currCounter]) {
fprintf(stderr,
"count: operations counted after last fwc() for '%s'; "
"-> fwc() called\n",
objectName[currCounter]?objectName[currCounter]:"");
}
fwc();
}
return tot;
}
static void WMOPS_clearMultiCounter()
{
Word16 i;
Word32 *ptr = (Word32 *) &multiCounter[currCounter];
for (i = 0; i < (sizeof (multiCounter[currCounter])/ sizeof (Word32)); i++)
{
*ptr++ = 0;
}
}
#endif
Word32 TotalWeightedOperation ()
{
#if WMOPS
Word16 i;
Word32 tot, *ptr, *ptr2;
tot = 0;
ptr = (Word32 *) &multiCounter[currCounter];
ptr2 = (Word32 *) &op_weight;
for (i = 0; i < (sizeof (multiCounter[currCounter])/ sizeof (Word32)); i++)
{
tot += ((*ptr++) * (*ptr2++));
}
return ((Word32) tot);
#else
return 0; /* Dummy */
#endif
}
Word32 DeltaWeightedOperation ()
{
#if WMOPS
Word32 NewWOper, delta;
NewWOper = TotalWeightedOperation ();
delta = NewWOper - LastWOper[currCounter];
LastWOper[currCounter] = NewWOper;
return (delta);
#else
return 0; /* Dummy */
#endif
}
void move16 (void)
{
#if WMOPS
multiCounter[currCounter].DataMove16++;
#endif
}
void move32 (void)
{
#if WMOPS
multiCounter[currCounter].DataMove32++;
#endif
}
void test (void)
{
#if WMOPS
multiCounter[currCounter].Test++;
#endif
}
void logic16 (void)
{
#if WMOPS
multiCounter[currCounter].Logic16++;
#endif
}
void logic32 (void)
{
#if WMOPS
multiCounter[currCounter].Logic32++;
#endif
}
void Init_WMOPS_counter (void)
{
#if WMOPS
Word16 i;
/* reset function weight operation counter variable */
for (i = 0; i < NbFuncMax; i++)
wc[currCounter][i] = (Word32) 0;
glob_wc[currCounter] = 0;
nbframe[currCounter] = 0;
total_wmops[currCounter] = 0.0;
/* initially clear all counters */
WMOPS_clearMultiCounter();
LastWOper[currCounter] = 0;
funcid[currCounter] = 0;
#endif
}
void Reset_WMOPS_counter (void)
{
#if WMOPS
Word32 tot = WMOPS_frameStat();
/* increase the frame counter --> a frame is counted WHEN IT BEGINS */
nbframe[currCounter]++;
/* add wmops used in last frame to count, then reset counter */
/* (in first frame, this is a no-op */
total_wmops[currCounter] += ((float) tot) * 0.00005;
/* clear counter before new frame starts */
WMOPS_clearMultiCounter();
LastWOper[currCounter] = 0;
funcid[currCounter] = 0; /* new frame, set function id to zero */
#endif
}
Word32 fwc (void) /* function worst case */
{
#if WMOPS
Word32 tot;
tot = DeltaWeightedOperation ();
if (tot > wc[currCounter][funcid[currCounter]])
wc[currCounter][funcid[currCounter]] = tot;
funcid[currCounter]++;
return (tot);
#else
return 0; /* Dummy */
#endif
}
void WMOPS_output (Word16 dtx_mode)
{
#if WMOPS
Word16 i;
Word32 tot, tot_wm, tot_wc;
/* get operations since last reset (or init),
but do not update the counters (except the glob_wc[] maximum)
so output CAN be called in each frame without problems.
The frame counter is NOT updated!
*/
tot = WMOPS_frameStat();
tot_wm = total_wmops[currCounter] + ((float) tot) * 0.00005;
fprintf (stdout, "%10s:WMOPS=%.3f",
objectName[currCounter]?objectName[currCounter]:"",
((float) tot) * 0.00005);
if (nbframe[currCounter] != 0)
fprintf (stdout, " Average=%.3f",
tot_wm / (float) nbframe[currCounter]);
fprintf (stdout, " WorstCase=%.3f",
((float) glob_wc[currCounter]) * 0.00005);
/* Worst worst case printed only when not in DTX mode */
if (dtx_mode == 0)
{
tot_wc = 0L;
for (i = 0; i < funcid[currCounter]; i++)
tot_wc += wc[currCounter][i];
fprintf (stdout, " WorstWC=%.3f", ((float) tot_wc) * 0.00005);
}
fprintf (stdout, " (%d frames)\n", nbframe[currCounter]);
#endif
}

View File

@ -0,0 +1,207 @@
/*
===========================================================================
COUNT.H
~~~~~~~
Prototypes and definitions for counting operations
These functions, and the ones in basop32.h, makes it possible to
measure the wMOPS of a codec.
All functions in this file, and in basop32.h, updates a structure
so that it will be possible the see how many calls to add, mul mulAdd
... that the code made, and estimate the wMOPS (and MIPS) for a
sertain part of code
It is also possible to measure the wMOPS separatly for different
parts of the codec.
This is done by creating a counter group (getCounterId) for each part
of the code that one wants a separte measure for. Before a part of
the code is executed a call to the "setCounter" function is needed to
identify which counter group to use.
Currently there is a limit of 255 different counter groups.
In the end of this file there is a pice of code illustration how the
functions can be used.
History
~~~~~~~
09.Aug.1999 V1.0.0 Input to UGST from ETSI AMR (count.h);
26.Jan.2000 V1.1.0 Added counter entries for G.723.1's
L_mls(), div_l(), i_mult() [from basop32.c]
05.Jul.2000 V1.2.0 Added counter entries for 32bit shiftless
operators L_mult0(), L_mac0(), L_msu0()
===========================================================================
*/
#ifndef COUNT_H
#define COUNT_H "$Id $"
#define MAXCOUNTERS 256
int getCounterId(char *objectName);
/*
* Create a counter group, the "objectname" will be used when printing
* statistics for this counter group.
*
* Returns 0 if no more counter groups are available.
*/
void setCounter(int counterId);
/*
* Defines which counter group to use, default is zero.
*/
void Init_WMOPS_counter (void);
/*
* Initiates the current counter group.
*/
void Reset_WMOPS_counter (void);
/*
* Resets the current counter group.
*/
void WMOPS_output (Word16 notPrintWorstWorstCase);
/*
* Prints the statistics to the screen, if the argument if non zero
* the statistics for worst worst case will not be printed. This is typically
* done for dtx frames.
*
*/
Word32 fwc (void);
/*
* worst worst case counter.
*
* This function calculates the worst possible case that can be reached.
*
* This is done by calling this function for each subpart of the calculations
* for a frame. This function then stores the maximum wMOPS for each part.
*
* The WMOPS_output function add together all parts and presents the sum.
*/
void move16 (void);
void move32 (void);
void logic16 (void);
void logic32 (void);
void test (void);
/*
* The functions above increases the corresponding operation counter for
* the current counter group.
*/
typedef struct
{
Word32 add; /* Complexity Weight of 1 */
Word32 sub;
Word32 abs_s;
Word32 shl;
Word32 shr;
Word32 extract_h;
Word32 extract_l;
Word32 mult;
Word32 L_mult;
Word32 negate;
Word32 round;
Word32 L_mac;
Word32 L_msu;
Word32 L_macNs;
Word32 L_msuNs;
Word32 L_add; /* Complexity Weight of 2 */
Word32 L_sub;
Word32 L_add_c;
Word32 L_sub_c;
Word32 L_negate;
Word32 L_shl;
Word32 L_shr;
Word32 mult_r;
Word32 shr_r;
Word32 shift_r;
Word32 mac_r;
Word32 msu_r;
Word32 L_deposit_h;
Word32 L_deposit_l;
Word32 L_shr_r; /* Complexity Weight of 3 */
Word32 L_shift_r;
Word32 L_abs;
Word32 L_sat; /* Complexity Weight of 4 */
Word32 norm_s; /* Complexity Weight of 15 */
Word32 div_s; /* Complexity Weight of 18 */
Word32 norm_l; /* Complexity Weight of 30 */
Word32 DataMove16; /* Complexity Weight of 1 */
Word32 DataMove32; /* Complexity Weight of 2 */
Word32 Logic16; /* Complexity Weight of 1 */
Word32 Logic32; /* Complexity Weight of 2 */
Word32 Test; /* Complexity Weight of 2 */
/* Counters for G.723.1 basic operators*/
Word32 L_mls; /* Complexity Weight of 1 */
Word32 div_l; /* Complexity Weight of 1 */
Word32 i_mult; /* Complexity Weight of 1 */
Word32 L_mult0; /* Complexity Weight of 1 */
Word32 L_mac0; /* Complexity Weight of 1 */
Word32 L_msu0; /* Complexity Weight of 1 */
/* Counters for G.722.1 basic operators*/
Word32 LU_shl; /* Complexity Weight of 1 */
Word32 LU_shr; /* Complexity Weight of 1 */
}
BASIC_OP;
#ifdef THISISANEXAMPLE_0123456789
/*
-----------------------------------------------------------------------
Example of how count.h could be used.
In the example below it is assumed that the init_OBJECT functions
does not use any calls to counter.h or basic_op.h. If this is the
case a call to the function Reset_WMOPS_counter() must be done after
each call to init_OBJECT if these operations is not to be included
in the statistics.
-----------------------------------------------------------------------
*/
int main()
{
int spe1Id,spe2Id,cheId;
/* initiate counters and objects */
spe1Id=getCounterId("Spe 5k8");
setCounter(spe1Id);
Init_WMOPS_counter ();
init_spe1(...);
spe2Id=getCounterId("Spe 12k2");
setCounter(spe2Id);
Init_WMOPS_counter ();
init_spe2(...);
cheId=getCounterId("Channel encoder");
setCounter(cheId);
Init_WMOPS_counter ();
init_che(...);
...
while(data)
{
test(); /* Note this call to test(); */
if(useSpe1)
setCounter(spe1Id);
else
setCounter(spe2Id);
Reset_WMOPS_counter();
speEncode(...);
WMOPS_output(0); /* Normal routine for displaying WMOPS info */
setCounter(cheId);
Reset_WMOPS_counter();
preChannelInter(...); fwc(); /* Note the call to fwc() for each part */
convolve(...); fwc(); /* of the channel encoder. */
interleave(...); fwc();
WMOPS_output(0); /* Normal routine for displaying WMOPS info */
}
}
#endif /* Example */
#endif /* COUNT_H */

View File

@ -0,0 +1,55 @@
/*
===========================================================================
File: TYPEDEF.H v.1.0 - 26.Jan.2000
===========================================================================
ITU-T STL BASIC OPERATORS
TYPE DEFINITION PROTOTYPES
History:
26.Jan.00 v1.0 Incorporated to the STL from updated G.723.1/G.729
basic operator library (based on basic_op.h)
============================================================================
*/
#ifndef TYPEDEF_H
#define TYPEDEF_H "$Id $"
#include <limits.h>
#if defined(__BORLANDC__) || defined(__WATCOMC__) || defined(_MSC_VER) || defined(__ZTC__) || defined(__CYGWIN__)
typedef signed char Word8;
typedef short Word16;
typedef long Word32;
typedef int Flag;
#elif defined(__sun)
typedef signed char Word8;
typedef short Word16;
typedef long Word32;
typedef int Flag;
#elif defined(__unix__) || defined(__unix)
typedef signed char Word8;
typedef short Word16;
typedef int Word32;
typedef int Flag;
#endif
/* define 16 bit unsigned types for G.722.1 */
#if INT_MAX == 32767
typedef unsigned int UWord16;
#elif SHRT_MAX == 32767
typedef unsigned short UWord16;
#endif
/* define 32 bit unsigned types for G.722.1 */
#if INT_MAX == 2147483647L
typedef unsigned int UWord32;
#elif LONG_MAX == 2147483647L
typedef unsigned long UWord32;
#endif
#endif /* TYPEDEF_H */

298
third_party/g7221/common/tables.c vendored Normal file
View File

@ -0,0 +1,298 @@
/****************************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
****************************************************************************/
/****************************************************************************
Filename: tables.c
Purpose: Contains tables used by G.722.1 Annex C
Design Notes:
****************************************************************************/
/***************************************************************************
Include files
***************************************************************************/
#include "defs.h"
Word16 int_region_standard_deviation_table[REGION_POWER_TABLE_SIZE] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 2, 3, 4, 6,
8, 11, 16, 23, 32, 45, 64, 91, 128, 181,
256, 362, 512, 724, 1024, 1448, 2048, 2896, 4096, 5793,
8192, 11585, 16384, 23170, 0,0,0,0,0,0,
0,0,0,0};
Word16 standard_deviation_inverse_table[REGION_POWER_TABLE_SIZE] = {
32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767, 32767,
32767, 32767, 32767, 32767, 32767, 23170, 16384, 11585, 8192, 5793,
4096, 2896, 2048, 1448, 1024, 724, 512, 362, 256, 181,
128, 91, 64, 45, 32, 23, 16, 11, 8, 6,
4, 3, 2, 1, 1, 1, 1, 0, 0, 0,
0, 0, 0, 0};
Word16 step_size_inverse_table[NUM_CATEGORIES]={
23167,16384,11585,8192,5793,4096,2896,2896
};
Word16 vector_dimension[NUM_CATEGORIES] = { 2, 2, 2, 4, 4, 5, 5, 1};
Word16 number_of_vectors[NUM_CATEGORIES] = {10,10,10, 5, 5, 4, 4,20};
/* The last category isn't really coded with scalar quantization. */
Word16 max_bin[NUM_CATEGORIES] = {13, 9, 6, 4, 3, 2, 1, 1};
Word16 max_bin_plus_one_inverse[NUM_CATEGORIES] =
{
2341,3277,4682,6554,8193,10923,16385,16385
};
/*
* Release 1.2.
* Add new version of int_dead_zone[] to go with
* changes to vector_huffman() in encoder.c.
*
*/
/************** See new version of table below
Word16 int_dead_zone[NUM_CATEGORIES]=
{
9830,10813,11796,12780,13763,14746,16384,16384
};
***************/
/******** New version of table added in Release 1.2 ********/
Word16 int_dead_zone[NUM_CATEGORIES]=
{
2457, 2703, 2949, 3195, 3440, 3686, 4096, 4096
};
/*
* Release 1.2.
* Added this new table to go with
* changes to vector_huffman() in encoder.c,
* accompanies the new table for int_dead_zone[].
*/
Word16 int_dead_zone_low_bits[NUM_CATEGORIES]=
{
2, 1, 0, 0, 3, 2, 0, 0
};
Word16 samples_to_rmlt_window[DCT_LENGTH]=
{ 44, 134, 224, 314, 404, 494, 584, 674, 764, 853,
943, 1033, 1123, 1213, 1302, 1392, 1482, 1571, 1661, 1750,
1840, 1929, 2019, 2108, 2197, 2286, 2376, 2465, 2554, 2643,
2732, 2821, 2909, 2998, 3087, 3175, 3264, 3352, 3441, 3529,
3617, 3705, 3793, 3881, 3969, 4057, 4144, 4232, 4319, 4407,
4494, 4581, 4668, 4755, 4842, 4928, 5015, 5101, 5188, 5274,
5360, 5446, 5532, 5617, 5703, 5788, 5873, 5959, 6043, 6128,
6213, 6297, 6382, 6466, 6550, 6634, 6718, 6801, 6885, 6968,
7051, 7134, 7217, 7299, 7382, 7464, 7546, 7628, 7709, 7791,
7872, 7953, 8034, 8115, 8195, 8276, 8356, 8436, 8515, 8595,
8674, 8753, 8832, 8911, 8989, 9068, 9146, 9223, 9301, 9378,
9455, 9532, 9609, 9685, 9762, 9838, 9913, 9989, 10064, 10139,
10214, 10288, 10363, 10437, 10510, 10584, 10657, 10730, 10803, 10875,
10948, 11020, 11091, 11163, 11234, 11305, 11375, 11446, 11516, 11586,
11655, 11724, 11793, 11862, 11930, 11998, 12066, 12134, 12201, 12268,
12334, 12401, 12467, 12532, 12598, 12663, 12728, 12792, 12857, 12920,
12984, 13047, 13110, 13173, 13235, 13297, 13359, 13420, 13481, 13542,
13602, 13662, 13722, 13782, 13841, 13899, 13958, 14016, 14074, 14131,
14188, 14245, 14301, 14357, 14413, 14468, 14523, 14578, 14632, 14686,
14739, 14793, 14845, 14898, 14950, 15002, 15053, 15104, 15155, 15205,
15255, 15305, 15354, 15403, 15451, 15500, 15547, 15595, 15642, 15688,
15734, 15780, 15826, 15871, 15916, 15960, 16004, 16047, 16091, 16133,
16176, 16218, 16259, 16300, 16341, 16382, 16422, 16461, 16501, 16540,
16578, 16616, 16654, 16691, 16728, 16764, 16800, 16836, 16871, 16906,
16940, 16974, 17008, 17041, 17074, 17106, 17138, 17170, 17201, 17232,
17262, 17292, 17321, 17350, 17379, 17407, 17435, 17462, 17489, 17516,
17542, 17567, 17593, 17617, 17642, 17666, 17689, 17713, 17735, 17758,
17779, 17801, 17822, 17842, 17863, 17882, 17901, 17920, 17939, 17957,
17974, 17991, 18008, 18024, 18040, 18055, 18070, 18085, 18099, 18113,
18126, 18139, 18151, 18163, 18174, 18185, 18196, 18206, 18216, 18225,
18234, 18242, 18250, 18257, 18265, 18271, 18277, 18283, 18288, 18293,
18298, 18302, 18305, 18308, 18311, 18313, 18315, 18316, 18317, 18317,
};
Word16 rmlt_to_samples_window[DCT_LENGTH]=
{ 44, 133, 222, 310, 399, 488, 577, 666, 754, 843,
932, 1020, 1109, 1198, 1286, 1375, 1464, 1552, 1641, 1729,
1817, 1906, 1994, 2082, 2171, 2259, 2347, 2435, 2523, 2611,
2699, 2786, 2874, 2962, 3049, 3137, 3224, 3312, 3399, 3486,
3573, 3660, 3747, 3834, 3921, 4008, 4094, 4181, 4267, 4353,
4439, 4526, 4611, 4697, 4783, 4869, 4954, 5040, 5125, 5210,
5295, 5380, 5465, 5549, 5634, 5718, 5802, 5886, 5970, 6054,
6138, 6221, 6304, 6388, 6471, 6553, 6636, 6719, 6801, 6883,
6965, 7047, 7129, 7211, 7292, 7373, 7454, 7535, 7616, 7696,
7777, 7857, 7937, 8016, 8096, 8175, 8254, 8333, 8412, 8491,
8569, 8647, 8725, 8803, 8880, 8957, 9035, 9111, 9188, 9264,
9341, 9417, 9492, 9568, 9643, 9718, 9793, 9868, 9942, 10016,
10090, 10163, 10237, 10310, 10383, 10455, 10528, 10600, 10672, 10743,
10815, 10886, 10957, 11027, 11098, 11168, 11237, 11307, 11376, 11445,
11514, 11582, 11650, 11718, 11785, 11853, 11920, 11986, 12053, 12119,
12185, 12250, 12315, 12380, 12445, 12509, 12573, 12637, 12701, 12764,
12826, 12889, 12951, 13013, 13075, 13136, 13197, 13257, 13318, 13378,
13437, 13497, 13556, 13614, 13673, 13731, 13788, 13846, 13903, 13959,
14016, 14072, 14128, 14183, 14238, 14292, 14347, 14401, 14454, 14508,
14561, 14613, 14665, 14717, 14769, 14820, 14871, 14921, 14971, 15021,
15070, 15119, 15168, 15216, 15264, 15311, 15359, 15405, 15452, 15498,
15544, 15589, 15634, 15678, 15722, 15766, 15810, 15853, 15895, 15938,
15979, 16021, 16062, 16103, 16143, 16183, 16223, 16262, 16300, 16339,
16377, 16414, 16452, 16488, 16525, 16561, 16596, 16632, 16666, 16701,
16735, 16768, 16801, 16834, 16867, 16899, 16930, 16961, 16992, 17022,
17052, 17082, 17111, 17140, 17168, 17196, 17223, 17250, 17277, 17303,
17329, 17354, 17379, 17404, 17428, 17452, 17475, 17498, 17520, 17542,
17564, 17585, 17606, 17626, 17646, 17665, 17684, 17703, 17721, 17739,
17756, 17773, 17790, 17806, 17821, 17836, 17851, 17865, 17879, 17893,
17906, 17918, 17931, 17942, 17954, 17965, 17975, 17985, 17995, 18004,
18012, 18021, 18028, 18036, 18043, 18049, 18055, 18061, 18066, 18071,
18076, 18079, 18083, 18086, 18089, 18091, 18093, 18094, 18095, 18095,
};
Word16 max_samples_to_rmlt_window[MAX_DCT_LENGTH]={
0, 43, 89, 133, 178, 222, 268, 314, 357, 403,
447, 493, 538, 582, 628, 671, 717, 763, 807, 853,
896, 942, 987, 1031, 1077, 1121, 1166, 1212, 1256, 1301,
1345, 1390, 1436, 1480, 1526, 1569, 1615, 1660, 1704, 1749,
1793, 1838, 1884, 1928, 1973, 2016, 2062, 2107, 2151, 2196,
2239, 2285, 2331, 2374, 2419, 2463, 2508, 2553, 2597, 2642,
2685, 2730, 2776, 2819, 2864, 2908, 2952, 2998, 3041, 3086,
3129, 3174, 3219, 3263, 3307, 3350, 3396, 3440, 3483, 3528,
3571, 3616, 3661, 3704, 3748, 3791, 3836, 3881, 3923, 3968,
4011, 4055, 4100, 4143, 4187, 4230, 4274, 4318, 4362, 4406,
4448, 4493, 4537, 4580, 4624, 4666, 4710, 4755, 4797, 4841,
4883, 4927, 4971, 5013, 5057, 5099, 5144, 5187, 5229, 5273,
5315, 5359, 5402, 5444, 5488, 5530, 5573, 5617, 5658, 5702,
5743, 5787, 5830, 5871, 5915, 5956, 6000, 6043, 6084, 6127,
6169, 6211, 6254, 6296, 6339, 6380, 6423, 6465, 6507, 6549,
6590, 6633, 6675, 6716, 6759, 6799, 6842, 6884, 6925, 6967,
7007, 7050, 7092, 7132, 7175, 7215, 7257, 7299, 7339, 7381,
7421, 7462, 7504, 7544, 7586, 7626, 7667, 7709, 7749, 7790,
7830, 7871, 7912, 7952, 7993, 8032, 8073, 8114, 8153, 8194,
8234, 8275, 8315, 8355, 8395, 8434, 8474, 8515, 8554, 8594,
8632, 8673, 8713, 8752, 8792, 8830, 8871, 8910, 8949, 8989,
9027, 9066, 9106, 9144, 9184, 9221, 9261, 9300, 9338, 9378,
9415, 9454, 9493, 9531, 9570, 9607, 9646, 9685, 9722, 9761,
9798, 9836, 9875, 9912, 9950, 9987, 10025, 10064, 10100, 10138,
10175, 10213, 10250, 10287, 10325, 10361, 10398, 10436, 10472, 10510,
10545, 10583, 10620, 10656, 10692, 10728, 10766, 10803, 10838, 10874,
10910, 10947, 10983, 11018, 11055, 11089, 11126, 11162, 11197, 11233,
11268, 11303, 11340, 11374, 11410, 11444, 11480, 11515, 11549, 11585,
11619, 11654, 11689, 11723, 11758, 11791, 11826, 11861, 11895, 11930,
11963, 11997, 12032, 12065, 12099, 12132, 12166, 12201, 12233, 12267,
12300, 12333, 12367, 12400, 12433, 12465, 12499, 12532, 12563, 12597,
12629, 12662, 12695, 12727, 12759, 12790, 12823, 12856, 12887, 12920,
12951, 12983, 13016, 13046, 13078, 13109, 13141, 13173, 13203, 13235,
13266, 13296, 13328, 13358, 13389, 13419, 13450, 13481, 13510, 13541,
13571, 13602, 13632, 13661, 13692, 13721, 13751, 13781, 13810, 13840,
13869, 13898, 13929, 13957, 13986, 14015, 14044, 14073, 14101, 14130,
14158, 14187, 14216, 14244, 14272, 14300, 14328, 14357, 14384, 14412,
14439, 14468, 14495, 14522, 14550, 14577, 14604, 14632, 14658, 14686,
14711, 14739, 14765, 14792, 14819, 14844, 14871, 14897, 14923, 14949,
14975, 15001, 15027, 15053, 15079, 15103, 15129, 15155, 15180, 15205,
15229, 15255, 15280, 15304, 15329, 15353, 15378, 15403, 15426, 15451,
15475, 15499, 15523, 15546, 15570, 15594, 15618, 15641, 15664, 15688,
15711, 15734, 15757, 15780, 15802, 15825, 15848, 15871, 15892, 15915,
15937, 15960, 15982, 16003, 16026, 16047, 16069, 16090, 16112, 16133,
16154, 16175, 16197, 16217, 16239, 16259, 16279, 16301, 16320, 16341,
16361, 16382, 16402, 16421, 16441, 16461, 16481, 16501, 16520, 16539,
16558, 16578, 16597, 16615, 16635, 16653, 16672, 16691, 16709, 16728,
16746, 16764, 16782, 16800, 16818, 16835, 16853, 16871, 16888, 16905,
16923, 16940, 16957, 16974, 16991, 17008, 17024, 17041, 17057, 17074,
17090, 17106, 17122, 17138, 17154, 17169, 17185, 17201, 17216, 17231,
17246, 17262, 17277, 17291, 17306, 17321, 17336, 17350, 17364, 17379,
17393, 17407, 17421, 17435, 17449, 17462, 17476, 17490, 17502, 17515,
17528, 17542, 17554, 17567, 17580, 17592, 17605, 17618, 17629, 17642,
17653, 17666, 17678, 17689, 17701, 17712, 17724, 17736, 17746, 17757,
17768, 17779, 17790, 17800, 17811, 17822, 17832, 17842, 17852, 17862,
17872, 17882, 17892, 17902, 17911, 17920, 17930, 17938, 17947, 17956,
17965, 17974, 17983, 17991, 17999, 18008, 18016, 18025, 18032, 18040,
18047, 18055, 18063, 18070, 18078, 18085, 18092, 18099, 18106, 18112,
18119, 18126, 18132, 18138, 18144, 18151, 18157, 18163, 18168, 18174,
18179, 18185, 18191, 18196, 18201, 18206, 18211, 18216, 18220, 18225,
18229, 18234, 18238, 18242, 18246, 18250, 18254, 18257, 18260, 18264,
18268, 18271, 18274, 18277, 18280, 18283, 18286, 18288, 18291, 18293,
18295, 18297, 18300, 18301, 18303, 18305, 18306, 18308, 18309, 18311,
18312, 18312, 18314, 18315, 18315, 18316, 18316, 18317, 18317, 18317
};
Word16 max_rmlt_to_samples_window[MAX_DCT_LENGTH]={
0, 43, 88, 131, 176, 219, 265, 310, 353, 398,
442, 487, 532, 575, 620, 663, 709, 754, 797, 842,
885, 931, 975, 1019, 1064, 1107, 1152, 1197, 1240, 1286,
1329, 1373, 1419, 1462, 1507, 1550, 1595, 1640, 1683, 1728,
1771, 1816, 1861, 1904, 1949, 1992, 2037, 2081, 2125, 2170,
2212, 2258, 2302, 2345, 2390, 2433, 2477, 2522, 2565, 2610,
2652, 2697, 2742, 2784, 2829, 2872, 2916, 2961, 3004, 3048,
3091, 3136, 3180, 3223, 3267, 3310, 3354, 3399, 3441, 3485,
3528, 3572, 3616, 3659, 3703, 3745, 3790, 3834, 3876, 3920,
3962, 4006, 4050, 4093, 4136, 4179, 4222, 4266, 4309, 4352,
4394, 4438, 4482, 4524, 4568, 4610, 4653, 4697, 4739, 4782,
4824, 4867, 4911, 4953, 4996, 5038, 5081, 5124, 5166, 5209,
5251, 5294, 5337, 5378, 5421, 5463, 5506, 5548, 5590, 5633,
5674, 5717, 5759, 5800, 5843, 5884, 5927, 5970, 6011, 6053,
6094, 6136, 6178, 6219, 6262, 6302, 6345, 6387, 6428, 6470,
6510, 6552, 6594, 6635, 6677, 6717, 6759, 6801, 6841, 6883,
6922, 6964, 7006, 7046, 7087, 7127, 7169, 7210, 7250, 7291,
7331, 7372, 7413, 7453, 7494, 7533, 7574, 7615, 7655, 7695,
7735, 7776, 7816, 7855, 7896, 7935, 7975, 8016, 8054, 8095,
8134, 8174, 8214, 8253, 8293, 8332, 8371, 8412, 8450, 8490,
8528, 8568, 8607, 8646, 8685, 8723, 8763, 8802, 8840, 8879,
8917, 8956, 8995, 9033, 9072, 9109, 9148, 9187, 9225, 9264,
9301, 9340, 9378, 9415, 9454, 9491, 9529, 9567, 9604, 9642,
9679, 9717, 9755, 9791, 9829, 9866, 9903, 9941, 9977, 10015,
10051, 10089, 10126, 10162, 10199, 10235, 10272, 10309, 10345, 10382,
10417, 10454, 10491, 10526, 10563, 10598, 10635, 10672, 10706, 10742,
10778, 10814, 10850, 10885, 10921, 10955, 10991, 11027, 11061, 11097,
11131, 11166, 11202, 11236, 11271, 11305, 11340, 11376, 11409, 11444,
11478, 11513, 11547, 11580, 11615, 11648, 11683, 11717, 11751, 11785,
11817, 11852, 11886, 11918, 11952, 11985, 12018, 12053, 12085, 12118,
12150, 12184, 12217, 12249, 12282, 12314, 12347, 12380, 12411, 12444,
12476, 12508, 12541, 12572, 12604, 12635, 12668, 12700, 12731, 12763,
12794, 12826, 12858, 12888, 12920, 12950, 12982, 13013, 13043, 13074,
13105, 13135, 13166, 13196, 13227, 13257, 13287, 13317, 13347, 13377,
13407, 13437, 13467, 13496, 13525, 13555, 13585, 13614, 13643, 13672,
13701, 13730, 13760, 13787, 13817, 13845, 13873, 13903, 13930, 13959,
13987, 14015, 14043, 14071, 14099, 14126, 14154, 14183, 14209, 14237,
14264, 14292, 14319, 14346, 14373, 14400, 14427, 14454, 14480, 14507,
14533, 14560, 14586, 14612, 14639, 14664, 14691, 14717, 14742, 14768,
14793, 14819, 14845, 14870, 14896, 14920, 14945, 14971, 14996, 15020,
15044, 15070, 15094, 15118, 15143, 15167, 15192, 15216, 15239, 15263,
15287, 15311, 15335, 15358, 15382, 15405, 15428, 15452, 15474, 15498,
15520, 15543, 15566, 15588, 15611, 15633, 15656, 15678, 15700, 15722,
15744, 15766, 15788, 15809, 15831, 15852, 15874, 15895, 15916, 15937,
15958, 15979, 16000, 16020, 16041, 16061, 16082, 16103, 16122, 16143,
16162, 16183, 16203, 16222, 16242, 16261, 16281, 16300, 16319, 16339,
16357, 16377, 16396, 16414, 16433, 16451, 16470, 16488, 16506, 16525,
16542, 16561, 16579, 16596, 16614, 16631, 16649, 16667, 16683, 16700,
16717, 16735, 16752, 16768, 16785, 16801, 16818, 16834, 16850, 16867,
16883, 16899, 16915, 16930, 16945, 16961, 16977, 16992, 17007, 17022,
17037, 17052, 17067, 17081, 17096, 17111, 17126, 17140, 17154, 17168,
17182, 17196, 17209, 17223, 17237, 17250, 17264, 17277, 17290, 17303,
17315, 17329, 17341, 17354, 17367, 17379, 17391, 17404, 17415, 17428,
17439, 17451, 17463, 17475, 17486, 17497, 17509, 17520, 17531, 17542,
17552, 17563, 17574, 17584, 17595, 17605, 17616, 17626, 17636, 17646,
17655, 17665, 17675, 17684, 17694, 17703, 17712, 17721, 17730, 17739,
17747, 17756, 17764, 17773, 17781, 17789, 17798, 17806, 17813, 17821,
17829, 17836, 17843, 17851, 17858, 17866, 17872, 17879, 17886, 17893,
17899, 17906, 17912, 17918, 17924, 17931, 17937, 17942, 17948, 17953,
17959, 17964, 17970, 17975, 17980, 17985, 17990, 17995, 17999, 18004,
18008, 18012, 18016, 18021, 18025, 18028, 18032, 18036, 18039, 18043,
18046, 18049, 18052, 18055, 18058, 18061, 18064, 18067, 18069, 18071,
18073, 18075, 18078, 18079, 18081, 18083, 18084, 18086, 18087, 18089,
18090, 18090, 18091, 18092, 18093, 18094, 18094, 18095, 18095, 18095
};

47
third_party/g7221/common/tables.h vendored Normal file
View File

@ -0,0 +1,47 @@
/***********************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 1999 PictureTel Coporation
** Andover, MA, USA
**
** All rights reserved.
**
***********************************************************************/
/***********************************************************************
Filename: tables.h
Purpose: Contains table definitions used by G.722.1 Annex C
Design Notes:
***********************************************************************/
/***********************************************************************
Include files
***********************************************************************/
#define REGION_POWER_TABLE_SIZE 64
#define NUM_CATEGORIES 8
#define DCT_LENGTH 320
#define MAX_DCT_LENGTH 640
extern Word16 int_region_standard_deviation_table[REGION_POWER_TABLE_SIZE];
extern Word16 standard_deviation_inverse_table[REGION_POWER_TABLE_SIZE];
extern Word16 step_size_inverse_table[NUM_CATEGORIES];
extern Word16 vector_dimension[NUM_CATEGORIES];
extern Word16 number_of_vectors[NUM_CATEGORIES];
/* The last category isn't really coded with scalar quantization. */
extern Word16 max_bin[NUM_CATEGORIES];
extern Word16 max_bin_plus_one_inverse[NUM_CATEGORIES];
extern Word16 int_dead_zone[NUM_CATEGORIES];
extern Word16 samples_to_rmlt_window[DCT_LENGTH];
extern Word16 rmlt_to_samples_window[DCT_LENGTH];
/* Add next line in Release 1.2 */
extern Word16 int_dead_zone_low_bits[NUM_CATEGORIES];
extern Word16 max_samples_to_rmlt_window[MAX_DCT_LENGTH];
extern Word16 max_rmlt_to_samples_window[MAX_DCT_LENGTH];

180
third_party/g7221/decode/coef2sam.c vendored Normal file
View File

@ -0,0 +1,180 @@
/*****************************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
*****************************************************************************/
/*****************************************************************************
* Filename: rmlt_coefs_to_samples.c
*
* 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. * 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 * to reversing the order of the samples, performing
* an MLT and then negating all * the even-numbered coefficients.
*
*****************************************************************************/
/***************************************************************************
Include files
***************************************************************************/
#include "defs.h"
#include "tables.h"
#include "count.h"
/***************************************************************************
Function: rmlt_coefs_to_samples
Syntax: void rmlt_coefs_to_samples(Word16 *coefs,
Word16 *old_samples,
Word16 *out_samples,
Word16 dct_length,
Word16 mag_shift)
inputs: Word16 *coefs
Word16 *old_samples
Word16 dct_length
Word16 mag_shift
outputs: Word16 *out_samples
Description: Converts the mlt_coefs to samples
Design Notes:
WMOPS: 7kHz | 24kbit | 32kbit
-------|--------------|----------------
AVG | 1.91 | 1.91
-------|--------------|----------------
MAX | 1.91 | 1.91
-------|--------------|----------------
14kHz | 24kbit | 32kbit | 48kbit
-------|--------------|----------------|----------------
AVG | 3.97 | 3.97 | 3.97
-------|--------------|----------------|----------------
MAX | 3.97 | 3.97 | 3.97
-------|--------------|----------------|----------------
***************************************************************************/
void rmlt_coefs_to_samples(Word16 *coefs,
Word16 *old_samples,
Word16 *out_samples,
Word16 dct_length,
Word16 mag_shift)
{
Word16 index, vals_left;
Word16 new_samples[MAX_DCT_LENGTH];
Word16 *new_ptr, *old_ptr;
Word16 *win_new, *win_old;
Word16 *out_ptr;
Word16 half_dct_size;
Word32 sum;
half_dct_size = shr(dct_length,1);
/* Perform a Type IV (inverse) DCT on the coefficients */
dct_type_iv_s(coefs, new_samples, dct_length);
test();
if (mag_shift > 0)
{
for(index=0;index<dct_length;index++)
{
new_samples[index] = shr(new_samples[index],mag_shift);
move16();
}
}
else
{
test();
if (mag_shift < 0)
{
mag_shift = negate(mag_shift);
for(index=0;index<dct_length;index++)
{
new_samples[index] = shl(new_samples[index],mag_shift);
move16();
}
}
}
/* Get the first half of the windowed samples */
out_ptr = out_samples;
move16();
test();
if (dct_length==DCT_LENGTH)
{
win_new = rmlt_to_samples_window;
move16();
win_old = rmlt_to_samples_window + dct_length;
move16();
}
else
{
win_new = max_rmlt_to_samples_window;
move16();
win_old = max_rmlt_to_samples_window + dct_length;
move16();
}
old_ptr = old_samples;
move16();
new_ptr = new_samples + half_dct_size;
move16();
for (vals_left = half_dct_size; vals_left > 0; vals_left--)
{
sum = 0L;
move32();
sum = L_mac(sum,*win_new++, *--new_ptr);
sum = L_mac(sum,*--win_old, *old_ptr++);
*out_ptr++ = round(L_shl(sum,2));
move16();
}
/* Get the second half of the windowed samples */
for (vals_left = half_dct_size; vals_left > 0; vals_left--)
{
sum = 0L;
move32();
sum = L_mac(sum,*win_new++, *new_ptr++);
sum = L_mac(sum,negate(*--win_old), *--old_ptr);
*out_ptr++ = round(L_shl(sum,2));
move16();
}
/* Save the second half of the new samples for */
/* next time, when they will be the old samples. */
/* pointer arithmetic */
new_ptr = new_samples + half_dct_size;
move16();
old_ptr = old_samples;
move16();
for (vals_left = half_dct_size; vals_left > 0; vals_left--)
{
*old_ptr++ = *new_ptr++;
move16();
}
}

480
third_party/g7221/decode/dct4_s.c vendored Normal file
View File

@ -0,0 +1,480 @@
/********************************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
********************************************************************************/
/********************************************************************************
* Filename: dct_type_iv_s.c
*
* Purpose: Discrete Cosine Transform, Type IV used for inverse MLT
*
* The basis functions are
*
* cos(PI*(t+0.5)*(k+0.5)/block_length)
*
* 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.
*
*********************************************************************************/
/***************************************************************************
Include files
***************************************************************************/
#include "defs.h"
#include "count.h"
#include "dct4_s.h"
/***************************************************************************
External variable declarations
***************************************************************************/
extern Word16 syn_bias_7khz[DCT_LENGTH];
extern Word16 dither[DCT_LENGTH];
extern Word16 max_dither[MAX_DCT_LENGTH];
extern Word16 dct_core_s[DCT_LENGTH_DIV_32][DCT_LENGTH_DIV_32];
extern cos_msin_t s_cos_msin_2[DCT_LENGTH_DIV_32];
extern cos_msin_t s_cos_msin_4[DCT_LENGTH_DIV_16];
extern cos_msin_t s_cos_msin_8[DCT_LENGTH_DIV_8];
extern cos_msin_t s_cos_msin_16[DCT_LENGTH_DIV_4];
extern cos_msin_t s_cos_msin_32[DCT_LENGTH_DIV_2];
extern cos_msin_t s_cos_msin_64[DCT_LENGTH];
extern cos_msin_t *s_cos_msin_table[];
/********************************************************************************
Function: dct_type_iv_s
Syntax: void dct_type_iv_s (Word16 *input,Word16 *output,Word16 dct_length)
Description: Discrete Cosine Transform, Type IV used for inverse MLT
Design Notes:
WMOPS: 7kHz | 24kbit | 32kbit
-------|--------------|----------------
AVG | 1.74 | 1.74
-------|--------------|----------------
MAX | 1.74 | 1.74
-------|--------------|----------------
14kHz | 24kbit | 32kbit | 48kbit
-------|--------------|----------------|----------------
AVG | 3.62 | 3.62 | 3.62
-------|--------------|----------------|----------------
MAX | 3.62 | 3.62 | 3.62
-------|--------------|----------------|----------------
********************************************************************************/
void dct_type_iv_s (Word16 *input,Word16 *output,Word16 dct_length)
{
Word16 buffer_a[MAX_DCT_LENGTH], buffer_b[MAX_DCT_LENGTH], buffer_c[MAX_DCT_LENGTH];
Word16 *in_ptr, *in_ptr_low, *in_ptr_high, *next_in_base;
Word16 *out_ptr_low, *out_ptr_high, *next_out_base;
Word16 *out_buffer, *in_buffer, *buffer_swap;
Word16 in_val_low, in_val_high;
Word16 out_val_low, out_val_high;
Word16 in_low_even, in_low_odd;
Word16 in_high_even, in_high_odd;
Word16 out_low_even, out_low_odd;
Word16 out_high_even, out_high_odd;
Word16 *pair_ptr;
Word16 cos_even, cos_odd, msin_even, msin_odd;
Word16 set_span, set_count, set_count_log, pairs_left, sets_left;
Word16 i,k;
Word16 index;
Word16 dummy;
Word32 sum;
cos_msin_t **table_ptr_ptr, *cos_msin_ptr;
Word32 acca;
Word16 temp;
Word16 dct_length_log;
Word16 *dither_ptr;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* Do the sum/difference butterflies, the first part of */
/* converting one N-point transform into 32 - 10 point transforms */
/* transforms, where N = 1 << DCT_LENGTH_LOG. */
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
test();
if (dct_length==DCT_LENGTH)
{
dct_length_log = DCT_LENGTH_LOG;
move16();
dither_ptr = dither;
move16();
}
else
{
dct_length_log = MAX_DCT_LENGTH_LOG;
move16();
dither_ptr = max_dither;
move16();
}
in_buffer = input;
move16();
out_buffer = buffer_a;
move16();
index=0;
move16();
i=0;
move16();
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 */
/*===========================================================*/
/* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */
set_span = shr(dct_length,set_count_log);
set_count = shl(1,set_count_log);
in_ptr = in_buffer;
move16();
next_out_base = out_buffer;
move16();
/*=====================================*/
/* Loop over all the sets of this size */
/*=====================================*/
temp = sub(index,1);
test();
if(temp < 0)
{
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;
move16();
next_out_base += set_span;
move16();
out_ptr_high = next_out_base;
move16();
/*||||||||||||||||||||||||||||||||||||||||||||||||||*/
/* Loop over all the butterflies in the current set */
/*||||||||||||||||||||||||||||||||||||||||||||||||||*/
do
{
in_val_low = *in_ptr++;
move16();
in_val_high = *in_ptr++;
move16();
/* BEST METHOD OF GETTING RID OF BIAS, BUT COMPUTATIONALLY UNPLEASANT */
/* 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);
out_val_low = extract_l(L_shr(acca,1));
dummy = add(in_val_low,dither_ptr[i++]);
acca = L_add(dummy,-in_val_high);
out_val_high = extract_l(L_shr(acca,1));
*out_ptr_low++ = out_val_low;
move16();
*--out_ptr_high = out_val_high;
move16();
test();
/* this involves comparison of pointers */
/* pointer arithmetic */
} while (out_ptr_low < out_ptr_high);
} /* End of loop over sets of the current size */
}
else
{
for (sets_left = set_count; sets_left > 0; sets_left--)
{
/*||||||||||||||||||||||||||||||||||||||||||||*/
/* Set up output pointers for the current set */
/*||||||||||||||||||||||||||||||||||||||||||||*/
out_ptr_low = next_out_base;
move16();
next_out_base += set_span;
move16();
out_ptr_high = next_out_base;
move16();
/*||||||||||||||||||||||||||||||||||||||||||||||||||*/
/* Loop over all the butterflies in the current set */
/*||||||||||||||||||||||||||||||||||||||||||||||||||*/
do
{
in_val_low = *in_ptr++;
move16();
in_val_high = *in_ptr++;
move16();
out_val_low = add(in_val_low,in_val_high);
out_val_high = add(in_val_low,negate(in_val_high));
*out_ptr_low++ = out_val_low;
move16();
*--out_ptr_high = out_val_high;
move16();
test();
} while (out_ptr_low < out_ptr_high);
} /* End of loop over sets of the current size */
}
/*============================================================*/
/* Decide which buffers to use as input and output next time. */
/* Except for the first time (when the input buffer is the */
/* subroutine input) we just alternate the local buffers. */
/*============================================================*/
in_buffer = out_buffer;
move16();
test();
if (out_buffer == buffer_a)
{
out_buffer = buffer_b;
move16();
}
else
{
out_buffer = buffer_a;
move16();
}
index = add(index,1);
} /* End of loop over set sizes */
/*++++++++++++++++++++++++++++++++*/
/* Do 32 - 10 point transforms */
/*++++++++++++++++++++++++++++++++*/
pair_ptr = in_buffer;
move16();
buffer_swap = buffer_c;
move16();
for (pairs_left = 1 << (dct_length_log - 1); pairs_left > 0; pairs_left--)
{
for ( k=0; k<CORE_SIZE; k++ )
{
sum=0L;
move32();
for ( i=0; i<CORE_SIZE; i++ )
{
sum = L_mac(sum, pair_ptr[i],dct_core_s[i][k]);
}
buffer_swap[k] = round(sum);
}
pair_ptr += CORE_SIZE;
move16();
buffer_swap += CORE_SIZE;
move16();
}
for (i=0;i<dct_length;i++)
{
in_buffer[i] = buffer_c[i];
move16();
}
table_ptr_ptr = s_cos_msin_table;
move16();
/*++++++++++++++++++++++++++++++*/
/* Perform rotation butterflies */
/*++++++++++++++++++++++++++++++*/
index=0;
move16();
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 */
/*===========================================================*/
/* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */
set_span = shr(dct_length,set_count_log);
set_count = shl(1,set_count_log);
next_in_base = in_buffer;
move16();
test();
if (set_count_log == 0)
{
next_out_base = output;
move16();
}
else
{
next_out_base = out_buffer;
move16();
}
/*=====================================*/
/* Loop over all the sets of this size */
/*=====================================*/
for (sets_left = set_count; sets_left > 0; sets_left--)
{
/*|||||||||||||||||||||||||||||||||||||||||*/
/* Set up the pointers for the current set */
/*|||||||||||||||||||||||||||||||||||||||||*/
in_ptr_low = next_in_base;
move16();
temp = shr(set_span,1);
in_ptr_high = in_ptr_low + temp;
move16();
next_in_base += set_span;
move16();
out_ptr_low = next_out_base;
move16();
next_out_base += set_span;
move16();
out_ptr_high = next_out_base;
move16();
cos_msin_ptr = *table_ptr_ptr;
move16();
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
/* Loop over all the butterfly pairs in the current set */
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
do
{
in_low_even = *in_ptr_low++;
move16();
in_low_odd = *in_ptr_low++;
move16();
in_high_even = *in_ptr_high++;
move16();
in_high_odd = *in_ptr_high++;
move16();
cos_even = cos_msin_ptr[0].cosine;
move16();
msin_even = cos_msin_ptr[0].minus_sine;
move16();
cos_odd = cos_msin_ptr[1].cosine;
move16();
msin_odd = cos_msin_ptr[1].minus_sine;
move16();
cos_msin_ptr += 2;
sum = 0L;
move32();
sum = L_mac(sum,cos_even,in_low_even);
sum = L_mac(sum,negate(msin_even),in_high_even);
out_low_even = round(L_shl(sum,1));
sum = 0L;
move32();
sum = L_mac(sum,msin_even,in_low_even);
sum = L_mac(sum,cos_even,in_high_even);
out_high_even = round(L_shl(sum,1));
sum = 0L;
move32();
sum = L_mac(sum,cos_odd,in_low_odd);
sum = L_mac(sum,msin_odd,in_high_odd);
out_low_odd = round(L_shl(sum,1));
sum = 0L;
move32();
sum = L_mac(sum,msin_odd,in_low_odd);
sum = L_mac(sum,negate(cos_odd),in_high_odd);
out_high_odd = round(L_shl(sum,1));
*out_ptr_low++ = out_low_even;
move16();
*--out_ptr_high = out_high_even;
move16();
*out_ptr_low++ = out_low_odd;
move16();
*--out_ptr_high = out_high_odd;
move16();
test();
} while (out_ptr_low < out_ptr_high);
} /* End of loop over sets of the current size */
/*=============================================*/
/* Swap input and output buffers for next time */
/*=============================================*/
buffer_swap = in_buffer;
move16();
in_buffer = out_buffer;
move16();
out_buffer = buffer_swap;
move16();
index = add(index,1);
table_ptr_ptr++;
}
/*------------------------------------
ADD IN BIAS FOR OUTPUT
-----------------------------------*/
if (dct_length==DCT_LENGTH)
{
for(i=0;i<320;i++)
{
sum = L_add(output[i],syn_bias_7khz[i]);
acca = L_sub(sum,32767);
test();
if (acca > 0)
{
sum = 32767L;
move32();
}
acca = L_add(sum,32768L);
test();
if (acca < 0)
{
sum = -32768L;
move32();
}
output[i] = extract_l(sum);
}
}
}

856
third_party/g7221/decode/dct4_s.h vendored Normal file
View File

@ -0,0 +1,856 @@
/***********************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
***********************************************************************/
/***********************************************************************
Filename: dct4_s.h
Purpose: Contains tables used by dct4_s.c
Design Notes:
***********************************************************************/
/***************************************************************************
Include files
***************************************************************************/
typedef struct
{
Word16 cosine;
Word16 minus_sine;
} cos_msin_t;
/***************************************************************************
The dct_core_s table was generated by the following code
for(i=0;i<10;++i)
{
for(k=0;k<10;++k)
{
dct_core_s[i][k]=(short) (FTOI(((.9*32768.)*cos(3.1415926*(k+0.5)*(i+0.5)/10.))));
}
}
***************************************************************************/
Word16 dct_core_s[10][10] = {
{ 29400, 28676, 27246, 25145, 22425, 19153, 15409, 11286, 6885, 2314 },
{ 28676, 22425, 11286, -2314, -15409, -25145, -29400, -27246, -19153, -6885 },
{ 27246, 11286, -11286, -27246, -27246, -11286, 11286, 27246, 27246, 11286 },
{ 25145, -2314, -27246, -22425, 6885, 28676, 19153, -11286, -29400, -15409 },
{ 22425, -15409, -27246, 6885, 29400, 2314, -28676, -11286, 25145, 19153 },
{ 19153, -25145, -11286, 28676, 2314, -29400, 6885, 27246, -15409, -22425 },
{ 15409, -29400, 11286, 19153, -28676, 6885, 22425, -27246, 2314, 25145 },
{ 11286, -27246, 27246, -11286, -11286, 27246, -27246, 11286, 11286, -27246 },
{ 6885, -19153, 27246, -29400, 25145, -15409, 2314, 11286, -22425, 28676 },
{ 2314, -6885, 11286, -15409, 19153, -22425, 25145, -27246, 28676, -29400 }
};
Word16 syn_bias_7khz[DCT_LENGTH] = {
-4, 4, -5, -2, 0, -4, 6, 2, -2, -4,
-3, 3, 0, 0, -2, 4, 0, 0, 3, -6,
8, 5, 4, 5, -8, 0, -2, 0, 0, -3,
3, 0, 0, 0, 1, -1, -2, 0, 0, 2,
-2, -5, -2, 3, 2, -1, -1, -6, 3, 1,
-7, 4, 4, 0, 1, 4, 1, 0, 1, -5,
-1, 1, -6, 0, -1, -1, 3, 0, -2, 1,
2, -4, 0, 9, 0, -3, 1, 1, 1, 0,
-3, -2, -1, -4, -2, 0, 5, 2, -3, 5,
0, -2, 4, 4, 0, -6, -4, 2, 0, 0,
0, -1, -1, -2, 0, 6, 1, 0, 0, -1,
0, -4, -1, 0, -4, 1, -1, -5, 0, 1,
2, 4, 0, -8, -4, 0, -2, -2, 2, 5,
-3, -1, 1, -4, 0, 0, 0, -1, -3, 0,
-5, -4, 0, -2, 0, 7, 1, 0, 5, -2,
-1, 2, 2, -2, 3, 7, -3, 4, 1, -4,
0, 0, 3, -7, -5, 0, 0, 4, 0, -2,
-1, 0, -5, 0, 2, 0, 11, 5, -1, 0,
2, 2, -2, -2, 5, 4, -3, 1, 0, -2,
1, 3, 2, 0, 1, 0, 0, 0, 5, 6,
-2, -1, 0, 2, 3, 2, 0, -3, 4, 5,
0, -1, 0, 3, 1, -2, -3, -2, -1, 2,
-1, -1, -2, -7, 4, 6, -5, -6, -3, -4,
0, 2, -5, -2, 3, 0, 0, 0, 2, -2,
-4, 3, 3, 1, 0, 0, 4, -1, 8, 13,
1, 2, 0, 2, 0, -1, 4, -3, 1, 0,
-1, 3, 0, 0, -5, 0, 6, 2, 4, 5,
2, -1, -1, 3, 6, 1, 1, 2, -4, 0,
-1, -6, -2, -2, 2, 1, 2, 6, 2, 0,
-2, -2, 0, -1, 2, 0, 0, 3, -2, 1,
3, 1, 2, -1, -2, 2, 2, -4, 0, 0,
-3, 0, -4, -3, 6, 7, 2, 2, 0, -3};
Word16 dither[DCT_LENGTH]= {
1, 0, 0, 0, 1, 0, 0, 1, 1, 1,
1, 0, 0, 0, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 0, 1, 1, 0, 0, 0,
1, 0, 0, 1, 0, 1, 0, 0, 1, 0,
1, 0, 0, 0, 1, 0, 1, 0, 0, 0,
1, 1, 1, 1, 1, 0, 0, 1, 0, 0,
0, 0, 1, 0, 0, 0, 1, 0, 0, 1,
1, 1, 1, 1, 1, 0, 1, 0, 0, 1,
1, 0, 0, 1, 0, 0, 0, 1, 0, 1,
0, 0, 1, 1, 0, 1, 0, 1, 1, 1,
1, 0, 0, 0, 0, 1, 1, 1, 1, 1,
0, 0, 0, 1, 0, 1, 0, 0, 0, 1,
1, 1, 0, 0, 1, 1, 1, 1, 1, 0,
0, 1, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
1, 0, 1, 1, 1, 1, 0, 0, 0, 0,
1, 1, 0, 1, 0, 0, 1, 0, 0, 1,
0, 0, 0, 1, 1, 0, 0, 1, 1, 1,
1, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 0, 0, 1, 1, 0, 1, 1, 0, 0,
1, 1, 1, 0, 1, 1, 0, 1, 0, 1,
0, 0, 1, 1, 1, 1, 1, 1, 0, 1,
0, 1, 1, 1, 1, 0, 1, 1, 1, 0,
1, 1, 1, 0, 1, 1, 1, 0, 1, 0,
1, 1, 0, 0, 1, 0, 0, 1, 0, 1,
0, 1, 1, 0, 1, 0, 1, 0, 1, 1,
1, 0, 1, 0, 1, 0, 1, 1, 1, 1,
0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
1, 0, 0, 0, 1, 0, 0, 1, 0, 1,
1, 0, 1, 1, 0, 0, 1, 1, 0, 1,
1, 0, 1, 1, 1, 1, 1, 1, 0, 1,
1, 1, 1, 0, 1, 0, 0, 0, 1, 0};
Word16 max_dither[MAX_DCT_LENGTH]= {
1, 0, 1, 0, 1, 1, 0, 1, 0, 1,
1, 1, 0, 0, 0, 0, 0, 1, 1, 1,
1, 1, 1, 0, 1, 1, 0, 0, 0, 1,
0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
1, 1, 1, 0, 1, 0, 1, 1, 1, 1,
0, 1, 0, 1, 1, 1, 1, 1, 1, 0,
1, 0, 1, 1, 0, 1, 0, 0, 0, 1,
0, 1, 1, 1, 1, 1, 0, 1, 1, 0,
0, 0, 1, 1, 0, 0, 0, 1, 1, 1,
1, 0, 1, 1, 1, 1, 1, 0, 0, 0,
1, 0, 1, 0, 1, 0, 0, 0, 1, 1,
0, 1, 1, 1, 1, 1, 1, 0, 1, 0,
0, 0, 1, 0, 1, 0, 0, 0, 1, 0,
0, 1, 0, 1, 0, 0, 0, 0, 1, 0,
1, 0, 0, 1, 0, 1, 0, 0, 0, 1,
0, 1, 0, 0, 1, 1, 1, 1, 0, 1,
1, 0, 0, 0, 1, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 1, 1, 0, 1,
1, 0, 0, 1, 1, 1, 1, 0, 1, 1,
1, 1, 1, 0, 1, 1, 0, 0, 0, 0,
1, 0, 1, 0, 0, 0, 0, 1, 1, 0,
1, 1, 0, 0, 0, 0, 1, 0, 0, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 1, 1, 0, 1, 1, 1, 0,
0, 1, 1, 1, 1, 1, 1, 1, 0, 0,
1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
0, 0, 1, 1, 0, 1, 0, 1, 0, 1,
0, 0, 1, 1, 1, 1, 1, 1, 0, 1,
0, 1, 1, 1, 0, 1, 0, 1, 0, 0,
0, 1, 0, 1, 1, 0, 0, 0, 1, 0,
1, 1, 0, 0, 1, 1, 1, 1, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0, 1, 1,
1, 1, 1, 0, 1, 0, 0, 0, 1, 0,
0, 1, 1, 1, 0, 1, 0, 1, 0, 0,
1, 1, 0, 1, 0, 1, 1, 0, 0, 0,
0, 1, 1, 0, 1, 1, 1, 0, 1, 1,
0, 0, 1, 1, 1, 1, 1, 1, 0, 1,
1, 1, 0, 0, 0, 1, 1, 1, 1, 0,
0, 1, 0, 1, 0, 1, 1, 0, 1, 0,
1, 1, 1, 0, 0, 1, 1, 0, 0, 1,
0, 1, 0, 0, 0, 1, 1, 0, 0, 1,
0, 0, 1, 1, 0, 1, 0, 1, 0, 1,
1, 1, 0, 1, 0, 0, 1, 1, 0, 0,
1, 0, 1, 0, 1, 0, 0, 1, 0, 0,
0, 1, 0, 1, 1, 1, 1, 1, 1, 0,
0, 1, 1, 0, 0, 0, 1, 1, 1, 0,
1, 1, 1, 0, 1, 1, 1, 0, 0, 0,
0, 0, 1, 0, 0, 1, 0, 0, 0, 1,
0, 0, 0, 1, 1, 0, 0, 1, 0, 1,
1, 1, 1, 1, 0, 0, 1, 0, 1, 0,
0, 1, 0, 1, 1, 1, 1, 1, 1, 0,
0, 0, 1, 0, 1, 0, 0, 1, 0, 1,
1, 0, 1, 0, 1, 1, 0, 0, 1, 1,
1, 1, 1, 0, 1, 0, 0, 1, 1, 1,
0, 1, 0, 1, 0, 1, 0, 0, 0, 1,
1, 0, 0, 1, 0, 0, 1, 1, 0, 1,
1, 0, 1, 0, 1, 1, 0, 0, 1, 1,
0, 0, 0, 1, 0, 1, 1, 1, 0, 0,
1, 0, 1, 0, 1, 1, 0, 0, 0, 1,
1, 0, 1, 0, 0, 1, 1, 1, 0, 1,
0, 0, 1, 1, 1, 1, 1, 0, 0, 0,
0, 1, 0, 1, 0, 0, 1, 0, 1, 0,
0, 1, 1, 1, 1, 0, 0, 0, 1, 0,
0, 1, 0, 1, 0, 1, 0, 0, 0, 0
};
/********************************************************************************
The s_cos_min tables were generated by the following code:
double angle, scale;
int index;
for (index = 0;index < length;index++)
{
angle = scale * ((double)index + 0.5);
table[index].cosine = (short) (FTOI((18427)* cos(angle)));
table[index].minus_sine = (short) (FTOI((18427)*(-sin(angle))));
}
********************************************************************************/
cos_msin_t s_cos_msin_2[DCT_LENGTH_DIV_32] = {
{ 18413 , -723 } ,
{ 18299 , -2166 } ,
{ 18073 , -3595 } ,
{ 17735 , -5002 } ,
{ 17288 , -6378 } ,
{ 16734 , -7715 } ,
{ 16077 , -9004 } ,
{ 15321 , -10237 } ,
{ 14471 , -11408 } ,
{ 13531 , -12508 }
};
cos_msin_t s_cos_msin_4[DCT_LENGTH_DIV_16] = {
{ 18423 , -362 } ,
{ 18395 , -1085 } ,
{ 18338 , -1806 } ,
{ 18253 , -2525 } ,
{ 18140 , -3239 } ,
{ 17999 , -3949 } ,
{ 17830 , -4653 } ,
{ 17634 , -5349 } ,
{ 17410 , -6037 } ,
{ 17159 , -6716 } ,
{ 16883 , -7385 } ,
{ 16580 , -8042 } ,
{ 16251 , -8686 } ,
{ 15898 , -9318 } ,
{ 15520 , -9935 } ,
{ 15118 , -10536 } ,
{ 14692 , -11122 } ,
{ 14244 , -11690 } ,
{ 13774 , -12240 } ,
{ 13283 , -12772 }
};
cos_msin_t s_cos_msin_8[DCT_LENGTH_DIV_8] = {
{ 18426 , -181 } ,
{ 18419 , -543 } ,
{ 18405 , -904 } ,
{ 18384 , -1265 } ,
{ 18355 , -1626 } ,
{ 18320 , -1986 } ,
{ 18277 , -2345 } ,
{ 18228 , -2704 } ,
{ 18171 , -3061 } ,
{ 18107 , -3417 } ,
{ 18037 , -3772 } ,
{ 17959 , -4126 } ,
{ 17875 , -4477 } ,
{ 17783 , -4827 } ,
{ 17685 , -5176 } ,
{ 17580 , -5522 } ,
{ 17468 , -5866 } ,
{ 17350 , -6208 } ,
{ 17225 , -6547 } ,
{ 17093 , -6884 } ,
{ 16954 , -7219 } ,
{ 16809 , -7550 } ,
{ 16658 , -7879 } ,
{ 16500 , -8204 } ,
{ 16336 , -8526 } ,
{ 16165 , -8846 } ,
{ 15988 , -9161 } ,
{ 15805 , -9473 } ,
{ 15616 , -9782 } ,
{ 15421 , -10087 } ,
{ 15220 , -10387 } ,
{ 15013 , -10684 } ,
{ 14801 , -10977 } ,
{ 14582 , -11265 } ,
{ 14358 , -11550 } ,
{ 14129 , -11829 } ,
{ 13894 , -12104 } ,
{ 13654 , -12375 } ,
{ 13408 , -12641 } ,
{ 13157 , -12901 }
};
cos_msin_t s_cos_msin_16[DCT_LENGTH_DIV_4] = {
{ 18427 , -90 } ,
{ 18425 , -271 } ,
{ 18421 , -452 } ,
{ 18416 , -633 } ,
{ 18409 , -814 } ,
{ 18400 , -995 } ,
{ 18389 , -1175 } ,
{ 18377 , -1356 } ,
{ 18363 , -1536 } ,
{ 18347 , -1716 } ,
{ 18329 , -1896 } ,
{ 18310 , -2076 } ,
{ 18288 , -2256 } ,
{ 18265 , -2435 } ,
{ 18241 , -2614 } ,
{ 18214 , -2793 } ,
{ 18186 , -2972 } ,
{ 18156 , -3150 } ,
{ 18124 , -3328 } ,
{ 18090 , -3506 } ,
{ 18055 , -3684 } ,
{ 18018 , -3861 } ,
{ 17979 , -4037 } ,
{ 17939 , -4214 } ,
{ 17897 , -4390 } ,
{ 17853 , -4565 } ,
{ 17807 , -4740 } ,
{ 17760 , -4915 } ,
{ 17710 , -5089 } ,
{ 17660 , -5262 } ,
{ 17607 , -5436 } ,
{ 17553 , -5608 } ,
{ 17497 , -5780 } ,
{ 17439 , -5952 } ,
{ 17380 , -6123 } ,
{ 17319 , -6293 } ,
{ 17257 , -6463 } ,
{ 17192 , -6632 } ,
{ 17126 , -6800 } ,
{ 17059 , -6968 } ,
{ 16990 , -7135 } ,
{ 16919 , -7302 } ,
{ 16846 , -7467 } ,
{ 16772 , -7632 } ,
{ 16696 , -7797 } ,
{ 16619 , -7960 } ,
{ 16540 , -8123 } ,
{ 16459 , -8285 } ,
{ 16377 , -8446 } ,
{ 16294 , -8607 } ,
{ 16208 , -8766 } ,
{ 16121 , -8925 } ,
{ 16033 , -9083 } ,
{ 15943 , -9240 } ,
{ 15852 , -9396 } ,
{ 15759 , -9551 } ,
{ 15664 , -9705 } ,
{ 15568 , -9858 } ,
{ 15471 , -10011 } ,
{ 15372 , -10162 } ,
{ 15271 , -10313 } ,
{ 15169 , -10462 } ,
{ 15066 , -10610 } ,
{ 14961 , -10758 } ,
{ 14854 , -10904 } ,
{ 14747 , -11049 } ,
{ 14637 , -11194 } ,
{ 14527 , -11337 } ,
{ 14415 , -11479 } ,
{ 14301 , -11620 } ,
{ 14187 , -11760 } ,
{ 14071 , -11898 } ,
{ 13953 , -12036 } ,
{ 13834 , -12172 } ,
{ 13714 , -12308 } ,
{ 13593 , -12442 } ,
{ 13470 , -12575 } ,
{ 13346 , -12706 } ,
{ 13220 , -12837 } ,
{ 13094 , -12966 }
};
cos_msin_t s_cos_msin_32[DCT_LENGTH_DIV_2] = {
{ 18427 , -45 } ,
{ 18427 , -136 } ,
{ 18426 , -226 } ,
{ 18424 , -317 } ,
{ 18423 , -407 } ,
{ 18420 , -497 } ,
{ 18418 , -588 } ,
{ 18415 , -678 } ,
{ 18411 , -769 } ,
{ 18407 , -859 } ,
{ 18403 , -949 } ,
{ 18398 , -1040 } ,
{ 18392 , -1130 } ,
{ 18387 , -1220 } ,
{ 18380 , -1310 } ,
{ 18374 , -1401 } ,
{ 18367 , -1491 } ,
{ 18359 , -1581 } ,
{ 18351 , -1671 } ,
{ 18343 , -1761 } ,
{ 18334 , -1851 } ,
{ 18324 , -1941 } ,
{ 18315 , -2031 } ,
{ 18305 , -2121 } ,
{ 18294 , -2211 } ,
{ 18283 , -2301 } ,
{ 18271 , -2390 } ,
{ 18259 , -2480 } ,
{ 18247 , -2570 } ,
{ 18234 , -2659 } ,
{ 18221 , -2749 } ,
{ 18207 , -2838 } ,
{ 18193 , -2927 } ,
{ 18178 , -3017 } ,
{ 18163 , -3106 } ,
{ 18148 , -3195 } ,
{ 18132 , -3284 } ,
{ 18116 , -3373 } ,
{ 18099 , -3462 } ,
{ 18082 , -3551 } ,
{ 18064 , -3639 } ,
{ 18046 , -3728 } ,
{ 18027 , -3816 } ,
{ 18009 , -3905 } ,
{ 17989 , -3993 } ,
{ 17969 , -4081 } ,
{ 17949 , -4170 } ,
{ 17928 , -4258 } ,
{ 17907 , -4346 } ,
{ 17886 , -4434 } ,
{ 17864 , -4521 } ,
{ 17841 , -4609 } ,
{ 17818 , -4696 } ,
{ 17795 , -4784 } ,
{ 17772 , -4871 } ,
{ 17747 , -4958 } ,
{ 17723 , -5045 } ,
{ 17698 , -5132 } ,
{ 17672 , -5219 } ,
{ 17647 , -5306 } ,
{ 17620 , -5392 } ,
{ 17594 , -5479 } ,
{ 17567 , -5565 } ,
{ 17539 , -5651 } ,
{ 17511 , -5737 } ,
{ 17483 , -5823 } ,
{ 17454 , -5909 } ,
{ 17425 , -5994 } ,
{ 17395 , -6080 } ,
{ 17365 , -6165 } ,
{ 17335 , -6250 } ,
{ 17304 , -6335 } ,
{ 17272 , -6420 } ,
{ 17241 , -6505 } ,
{ 17208 , -6590 } ,
{ 17176 , -6674 } ,
{ 17143 , -6758 } ,
{ 17110 , -6842 } ,
{ 17076 , -6926 } ,
{ 17042 , -7010 } ,
{ 17007 , -7093 } ,
{ 16972 , -7177 } ,
{ 16937 , -7260 } ,
{ 16901 , -7343 } ,
{ 16864 , -7426 } ,
{ 16828 , -7509 } ,
{ 16791 , -7591 } ,
{ 16753 , -7674 } ,
{ 16715 , -7756 } ,
{ 16677 , -7838 } ,
{ 16638 , -7919 } ,
{ 16599 , -8001 } ,
{ 16560 , -8082 } ,
{ 16520 , -8164 } ,
{ 16480 , -8245 } ,
{ 16439 , -8325 } ,
{ 16398 , -8406 } ,
{ 16357 , -8486 } ,
{ 16315 , -8567 } ,
{ 16272 , -8647 } ,
{ 16230 , -8726 } ,
{ 16187 , -8806 } ,
{ 16143 , -8885 } ,
{ 16100 , -8964 } ,
{ 16055 , -9043 } ,
{ 16011 , -9122 } ,
{ 15966 , -9200 } ,
{ 15920 , -9279 } ,
{ 15875 , -9357 } ,
{ 15829 , -9435 } ,
{ 15782 , -9512 } ,
{ 15735 , -9589 } ,
{ 15688 , -9667 } ,
{ 15640 , -9744 } ,
{ 15592 , -9820 } ,
{ 15544 , -9897 } ,
{ 15495 , -9973 } ,
{ 15446 , -10049 } ,
{ 15396 , -10124 } ,
{ 15347 , -10200 } ,
{ 15296 , -10275 } ,
{ 15246 , -10350 } ,
{ 15195 , -10425 } ,
{ 15143 , -10499 } ,
{ 15092 , -10573 } ,
{ 15040 , -10647 } ,
{ 14987 , -10721 } ,
{ 14934 , -10794 } ,
{ 14881 , -10868 } ,
{ 14828 , -10941 } ,
{ 14774 , -11013 } ,
{ 14719 , -11086 } ,
{ 14665 , -11158 } ,
{ 14610 , -11230 } ,
{ 14555 , -11301 } ,
{ 14499 , -11372 } ,
{ 14443 , -11444 } ,
{ 14387 , -11514 } ,
{ 14330 , -11585 } ,
{ 14273 , -11655 } ,
{ 14216 , -11725 } ,
{ 14158 , -11795 } ,
{ 14100 , -11864 } ,
{ 14041 , -11933 } ,
{ 13983 , -12002 } ,
{ 13924 , -12070 } ,
{ 13864 , -12138 } ,
{ 13804 , -12206 } ,
{ 13744 , -12274 } ,
{ 13684 , -12341 } ,
{ 13623 , -12408 } ,
{ 13562 , -12475 } ,
{ 13501 , -12541 } ,
{ 13439 , -12608 } ,
{ 13377 , -12673 } ,
{ 13314 , -12739 } ,
{ 13252 , -12804 } ,
{ 13189 , -12869 } ,
{ 13125 , -12934 } ,
{ 13062 , -12998 }
};
cos_msin_t s_cos_msin_64[DCT_LENGTH] = {
{18426, -21},
{18426, -66},
{18426, -110},
{18426, -154},
{18425, -198},
{18425, -242},
{18424, -286},
{18424, -331},
{18423, -374},
{18421, -419},
{18421, -463},
{18419, -507},
{18418, -552},
{18417, -595},
{18415, -639},
{18414, -684},
{18412, -728},
{18410, -772},
{18408, -816},
{18406, -860},
{18404, -904},
{18402, -949},
{18400, -992},
{18397, -1037},
{18394, -1081},
{18392, -1125},
{18389, -1169},
{18387, -1213},
{18384, -1257},
{18380, -1301},
{18378, -1345},
{18374, -1389},
{18371, -1433},
{18367, -1477},
{18364, -1521},
{18360, -1566},
{18356, -1609},
{18352, -1653},
{18348, -1697},
{18344, -1742},
{18339, -1785},
{18335, -1829},
{18331, -1873},
{18326, -1917},
{18322, -1961},
{18317, -2005},
{18312, -2049},
{18307, -2092},
{18302, -2137},
{18297, -2180},
{18292, -2224},
{18286, -2268},
{18281, -2312},
{18275, -2356},
{18270, -2399},
{18264, -2443},
{18258, -2487},
{18252, -2531},
{18246, -2574},
{18240, -2618},
{18233, -2662},
{18227, -2706},
{18220, -2749},
{18214, -2793},
{18207, -2836},
{18200, -2880},
{18193, -2924},
{18186, -2967},
{18179, -3011},
{18172, -3055},
{18164, -3098},
{18157, -3142},
{18149, -3185},
{18141, -3229},
{18134, -3272},
{18126, -3316},
{18118, -3359},
{18109, -3403},
{18101, -3446},
{18094, -3489},
{18085, -3533},
{18076, -3576},
{18068, -3619},
{18059, -3663},
{18050, -3706},
{18041, -3749},
{18032, -3792},
{18023, -3836},
{18014, -3879},
{18005, -3922},
{17995, -3965},
{17986, -4008},
{17975, -4051},
{17966, -4094},
{17956, -4138},
{17946, -4180},
{17936, -4224},
{17926, -4266},
{17916, -4309},
{17905, -4353},
{17895, -4395},
{17884, -4438},
{17874, -4481},
{17863, -4524},
{17852, -4567},
{17841, -4609},
{17830, -4652},
{17819, -4695},
{17807, -4738},
{17796, -4780},
{17784, -4823},
{17772, -4865},
{17761, -4908},
{17749, -4951},
{17738, -4993},
{17725, -5036},
{17713, -5078},
{17701, -5121},
{17689, -5163},
{17676, -5205},
{17664, -5248},
{17651, -5290},
{17638, -5333},
{17626, -5375},
{17613, -5417},
{17599, -5459},
{17586, -5501},
{17573, -5544},
{17560, -5586},
{17546, -5627},
{17533, -5670},
{17519, -5712},
{17505, -5753},
{17492, -5795},
{17478, -5837},
{17464, -5879},
{17450, -5921},
{17435, -5963},
{17421, -6005},
{17406, -6046},
{17392, -6088},
{17377, -6130},
{17363, -6172},
{17348, -6213},
{17333, -6254},
{17318, -6296},
{17303, -6338},
{17288, -6379},
{17272, -6420},
{17257, -6462},
{17241, -6503},
{17225, -6545},
{17210, -6586},
{17194, -6627},
{17178, -6668},
{17162, -6709},
{17145, -6750},
{17130, -6791},
{17113, -6832},
{17097, -6874},
{17080, -6915},
{17064, -6956},
{17047, -6996},
{17030, -7037},
{17013, -7078},
{16996, -7119},
{16979, -7159},
{16962, -7200},
{16945, -7241},
{16927, -7281},
{16910, -7322},
{16892, -7362},
{16874, -7403},
{16856, -7444},
{16838, -7484},
{16821, -7524},
{16802, -7564},
{16784, -7605},
{16766, -7645},
{16748, -7685},
{16729, -7725},
{16711, -7765},
{16692, -7805},
{16674, -7845},
{16654, -7885},
{16635, -7925},
{16616, -7964},
{16597, -8004},
{16578, -8044},
{16559, -8084},
{16539, -8124},
{16520, -8164},
{16500, -8203},
{16480, -8242},
{16461, -8282},
{16441, -8322},
{16421, -8361},
{16401, -8400},
{16380, -8440},
{16360, -8479},
{16340, -8518},
{16319, -8557},
{16299, -8597},
{16278, -8635},
{16257, -8674},
{16237, -8713},
{16215, -8752},
{16195, -8791},
{16173, -8829},
{16152, -8868},
{16131, -8907},
{16110, -8946},
{16088, -8985},
{16067, -9023},
{16045, -9061},
{16023, -9100},
{16001, -9138},
{15979, -9176},
{15957, -9215},
{15935, -9253},
{15913, -9291},
{15891, -9329},
{15868, -9367},
{15846, -9405},
{15823, -9443},
{15800, -9481},
{15778, -9519},
{15755, -9557},
{15732, -9595},
{15709, -9632},
{15686, -9670},
{15662, -9708},
{15639, -9745},
{15615, -9782},
{15592, -9820},
{15569, -9857},
{15544, -9894},
{15521, -9932},
{15497, -9969},
{15473, -10006},
{15449, -10043},
{15425, -10080},
{15401, -10117},
{15377, -10154},
{15352, -10191},
{15327, -10227},
{15303, -10264},
{15278, -10301},
{15254, -10337},
{15229, -10374},
{15204, -10411},
{15180, -10447},
{15154, -10483},
{15129, -10519},
{15104, -10556},
{15078, -10592},
{15053, -10628},
{15027, -10664},
{15002, -10700},
{14976, -10736},
{14950, -10772},
{14924, -10808},
{14898, -10844},
{14872, -10879},
{14846, -10915},
{14820, -10950},
{14794, -10985},
{14767, -11021},
{14741, -11056},
{14714, -11092},
{14687, -11127},
{14661, -11162},
{14635, -11197},
{14607, -11232},
{14581, -11267},
{14554, -11302},
{14526, -11337},
{14499, -11372},
{14472, -11407},
{14444, -11441},
{14417, -11476},
{14389, -11511},
{14362, -11545},
{14334, -11579},
{14306, -11614},
{14278, -11648},
{14251, -11682},
{14222, -11716},
{14194, -11750},
{14166, -11784},
{14137, -11818},
{14109, -11852},
{14081, -11886},
{14053, -11919},
{14023, -11953},
{13995, -11987},
{13966, -12020},
{13937, -12054},
{13909, -12087},
{13879, -12120},
{13851, -12153},
{13821, -12187},
{13792, -12220},
{13763, -12253},
{13733, -12286},
{13704, -12319},
{13674, -12351},
{13645, -12385},
{13615, -12417},
{13585, -12450},
{13555, -12482},
{13525, -12514},
{13495, -12546},
{13465, -12579},
{13435, -12611},
{13405, -12644},
{13374, -12676},
{13345, -12708},
{13314, -12739},
{13283, -12772}
};
cos_msin_t *s_cos_msin_table[] = {s_cos_msin_2, s_cos_msin_4,
s_cos_msin_8, s_cos_msin_16,
s_cos_msin_32, s_cos_msin_64
};

1112
third_party/g7221/decode/decoder.c vendored Normal file

File diff suppressed because it is too large Load Diff

352
third_party/g7221/encode/dct4_a.c vendored Normal file
View File

@ -0,0 +1,352 @@
/*********************************************************************************
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
*********************************************************************************/
/*********************************************************************************
* Filename: dct_type_iv_a.c
*
* Purpose: Discrete Cosine Transform, Type IV used for MLT
*
* The basis functions are
*
* cos(PI*(t+0.5)*(k+0.5)/block_length)
*
* 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.
*
*********************************************************************************/
/*********************************************************************************
Include files
*********************************************************************************/
#include "defs.h"
#include "count.h"
#include "dct4_a.h"
/*********************************************************************************
External variable declarations
*********************************************************************************/
extern Word16 anal_bias[DCT_LENGTH];
extern Word16 dct_core_a[DCT_LENGTH_DIV_32][DCT_LENGTH_DIV_32];
extern cos_msin_t a_cos_msin_2 [DCT_LENGTH_DIV_32];
extern cos_msin_t a_cos_msin_4 [DCT_LENGTH_DIV_16];
extern cos_msin_t a_cos_msin_8 [DCT_LENGTH_DIV_8];
extern cos_msin_t a_cos_msin_16[DCT_LENGTH_DIV_4];
extern cos_msin_t a_cos_msin_32[DCT_LENGTH_DIV_2];
extern cos_msin_t a_cos_msin_64[DCT_LENGTH];
extern cos_msin_t *a_cos_msin_table[];
/*********************************************************************************
Function: dct_type_iv_a
Syntax: void dct_type_iv_a (input, output, dct_length)
Word16 input[], output[], dct_length;
Description: Discrete Cosine Transform, Type IV used for MLT
Design Notes:
WMOPS: | 24kbit | 32kbit
-------|--------------|----------------
AVG | 1.14 | 1.14
-------|--------------|----------------
MAX | 1.14 | 1.14
-------|--------------|----------------
14kHz | 24kbit | 32kbit | 48kbit
-------|--------------|----------------|----------------
AVG | 2.57 | 2.57 | 2.57
-------|--------------|----------------|----------------
MAX | 2.57 | 2.57 | 2.57
-------|--------------|----------------|----------------
*********************************************************************************/
void dct_type_iv_a (Word16 *input,Word16 *output,Word16 dct_length)
{
Word16 buffer_a[MAX_DCT_LENGTH], buffer_b[MAX_DCT_LENGTH], buffer_c[MAX_DCT_LENGTH];
Word16 *in_ptr, *in_ptr_low, *in_ptr_high, *next_in_base;
Word16 *out_ptr_low, *out_ptr_high, *next_out_base;
Word16 *out_buffer, *in_buffer, *buffer_swap;
Word16 in_val_low, in_val_high;
Word16 out_val_low, out_val_high;
Word16 in_low_even, in_low_odd;
Word16 in_high_even, in_high_odd;
Word16 out_low_even, out_low_odd;
Word16 out_high_even, out_high_odd;
Word16 *pair_ptr;
Word16 cos_even, cos_odd, msin_even, msin_odd;
Word16 neg_cos_odd;
Word16 neg_msin_even;
Word32 sum;
Word16 set_span, set_count, set_count_log, pairs_left, sets_left;
Word16 i,k;
Word16 index;
cos_msin_t **table_ptr_ptr, *cos_msin_ptr;
Word16 temp;
Word32 acca;
Word16 dct_length_log;
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* Do the sum/difference butterflies, the first part of */
/* converting one N-point transform into N/2 two-point */
/* transforms, where N = 1 << DCT_LENGTH_LOG. = 64/128 */
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
test();
if (dct_length==DCT_LENGTH)
{
dct_length_log = DCT_LENGTH_LOG;
/* Add bias offsets */
for (i=0;i<dct_length;i++)
{
input[i] = add(input[i],anal_bias[i]);
move16();
}
}
else
dct_length_log = MAX_DCT_LENGTH_LOG;
index = 0L;
move16();
in_buffer = input;
move16();
out_buffer = buffer_a;
move16();
temp = sub(dct_length_log,2);
for (set_count_log=0;set_count_log<=temp;set_count_log++)
{
/*===========================================================*/
/* Initialization for the loop over sets at the current size */
/*===========================================================*/
/* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */
set_span = shr(dct_length,set_count_log);
set_count = shl(1,set_count_log);
in_ptr = in_buffer;
move16();
next_out_base = out_buffer;
move16();
/*=====================================*/
/* Loop over all the sets of this size */
/*=====================================*/
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 */
/*||||||||||||||||||||||||||||||||||||||||||||||||||*/
do
{
in_val_low = *in_ptr++;
in_val_high = *in_ptr++;
acca = L_add(in_val_low,in_val_high);
acca = L_shr(acca,1);
out_val_low = extract_l(acca);
acca = L_sub(in_val_low,in_val_high);
acca = L_shr(acca,1);
out_val_high = extract_l(acca);
*out_ptr_low++ = out_val_low;
*--out_ptr_high = out_val_high;
test();
} while (out_ptr_low < out_ptr_high);
} /* End of loop over sets of the current size */
/*============================================================*/
/* Decide which buffers to use as input and output next time. */
/* Except for the first time (when the input buffer is the */
/* subroutine input) we just alternate the local buffers. */
/*============================================================*/
in_buffer = out_buffer;
move16();
if (out_buffer == buffer_a)
out_buffer = buffer_b;
else
out_buffer = buffer_a;
index = add(index,1);
} /* End of loop over set sizes */
/*++++++++++++++++++++++++++++++++*/
/* Do N/2 two-point transforms, */
/* where N = 1 << DCT_LENGTH_LOG */
/*++++++++++++++++++++++++++++++++*/
pair_ptr = in_buffer;
move16();
buffer_swap = buffer_c;
move16();
temp = sub(dct_length_log,1);
temp = shl(1,temp);
for (pairs_left=temp; pairs_left > 0; pairs_left--)
{
for ( k=0; k<CORE_SIZE; k++ )
{
sum=0L;
move32();
for ( i=0; i<CORE_SIZE; i++ )
{
sum = L_mac(sum, pair_ptr[i],dct_core_a[i][k]);
}
buffer_swap[k] = round(sum);
}
/* address arithmetic */
pair_ptr += CORE_SIZE;
buffer_swap += CORE_SIZE;
}
for (i=0;i<dct_length;i++)
{
in_buffer[i] = buffer_c[i];
move16();
}
table_ptr_ptr = a_cos_msin_table;
/*++++++++++++++++++++++++++++++*/
/* Perform rotation butterflies */
/*++++++++++++++++++++++++++++++*/
temp = sub(dct_length_log,2);
for (set_count_log = temp; set_count_log >= 0; set_count_log--)
{
/*===========================================================*/
/* Initialization for the loop over sets at the current size */
/*===========================================================*/
/* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */
set_span = shr(dct_length,set_count_log);
set_count = shl(1,set_count_log);
next_in_base = in_buffer;
move16();
test();
if (set_count_log == 0)
{
next_out_base = output;
}
else
{
next_out_base = out_buffer;
}
/*=====================================*/
/* Loop over all the sets of this size */
/*=====================================*/
for (sets_left = set_count; sets_left > 0;sets_left--)
{
/*|||||||||||||||||||||||||||||||||||||||||*/
/* Set up the pointers for the current set */
/*|||||||||||||||||||||||||||||||||||||||||*/
in_ptr_low = next_in_base;
move16();
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 */
/*||||||||||||||||||||||||||||||||||||||||||||||||||||||*/
do
{
/* address arithmetic */
in_low_even = *in_ptr_low++;
in_low_odd = *in_ptr_low++;
in_high_even = *in_ptr_high++;
in_high_odd = *in_ptr_high++;
cos_even = cos_msin_ptr[0].cosine;
move16();
msin_even = cos_msin_ptr[0].minus_sine;
move16();
cos_odd = cos_msin_ptr[1].cosine;
move16();
msin_odd = cos_msin_ptr[1].minus_sine;
move16();
cos_msin_ptr += 2;
sum = 0L;
sum=L_mac(sum,cos_even,in_low_even);
neg_msin_even = negate(msin_even);
sum=L_mac(sum,neg_msin_even,in_high_even);
out_low_even = round(sum);
sum = 0L;
sum=L_mac(sum,msin_even,in_low_even);
sum=L_mac(sum,cos_even,in_high_even);
out_high_even= round(sum);
sum = 0L;
sum=L_mac(sum,cos_odd,in_low_odd);
sum=L_mac(sum,msin_odd,in_high_odd);
out_low_odd= round(sum);
sum = 0L;
sum=L_mac(sum,msin_odd,in_low_odd);
neg_cos_odd = negate(cos_odd);
sum=L_mac(sum,neg_cos_odd,in_high_odd);
out_high_odd= round(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;
test();
} while (out_ptr_low < out_ptr_high);
} /* End of loop over sets of the current size */
/*=============================================*/
/* Swap input and output buffers for next time */
/*=============================================*/
buffer_swap = in_buffer;
in_buffer = out_buffer;
out_buffer = buffer_swap;
table_ptr_ptr++;
}
}

728
third_party/g7221/encode/dct4_a.h vendored Normal file
View File

@ -0,0 +1,728 @@
/****************************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
****************************************************************************/
/****************************************************************************
Filename: dct4_a.h
Purpose: Contains tables used by dct4_a.c
Design Notes:
****************************************************************************/
/***************************************************************************
Include files
***************************************************************************/
#include <stdio.h>
#include <math.h>
typedef struct
{
Word16 cosine;
Word16 minus_sine;
} cos_msin_t;
cos_msin_t a_cos_msin_2[10] = {
{ 29805 , -1171 } ,
{ 29621 , -3506 } ,
{ 29255 , -5819 } ,
{ 28708 , -8097 } ,
{ 27984 , -10324 } ,
{ 27088 , -12488 } ,
{ 26025 , -14575 } ,
{ 24801 , -16572 } ,
{ 23425 , -18466 } ,
{ 21903 , -20247 }
};
cos_msin_t a_cos_msin_4[20] = {
{ 29822 , -586 } ,
{ 29776 , -1756 } ,
{ 29684 , -2924 } ,
{ 29547 , -4087 } ,
{ 29364 , -5244 } ,
{ 29135 , -6392 } ,
{ 28862 , -7531 } ,
{ 28544 , -8659 } ,
{ 28182 , -9773 } ,
{ 27776 , -10871 } ,
{ 27328 , -11954 } ,
{ 26838 , -13017 } ,
{ 26306 , -14061 } ,
{ 25734 , -15083 } ,
{ 25122 , -16081 } ,
{ 24471 , -17055 } ,
{ 23783 , -18003 } ,
{ 23057 , -18923 } ,
{ 22297 , -19813 } ,
{ 21502 , -20673 }
};
cos_msin_t a_cos_msin_8[40] = {
{ 29827 , -293 } ,
{ 29815 , -878 } ,
{ 29792 , -1464 } ,
{ 29758 , -2048 } ,
{ 29712 , -2632 } ,
{ 29654 , -3215 } ,
{ 29586 , -3797 } ,
{ 29505 , -4377 } ,
{ 29414 , -4955 } ,
{ 29311 , -5532 } ,
{ 29196 , -6106 } ,
{ 29071 , -6678 } ,
{ 28934 , -7248 } ,
{ 28786 , -7814 } ,
{ 28627 , -8378 } ,
{ 28457 , -8938 } ,
{ 28276 , -9495 } ,
{ 28084 , -10049 } ,
{ 27882 , -10598 } ,
{ 27668 , -11144 } ,
{ 27444 , -11685 } ,
{ 27209 , -12221 } ,
{ 26964 , -12753 } ,
{ 26709 , -13280 } ,
{ 26443 , -13802 } ,
{ 26167 , -14318 } ,
{ 25881 , -14829 } ,
{ 25584 , -15335 } ,
{ 25278 , -15834 } ,
{ 24963 , -16327 } ,
{ 24637 , -16814 } ,
{ 24302 , -17295 } ,
{ 23958 , -17769 } ,
{ 23605 , -18236 } ,
{ 23242 , -18695 } ,
{ 22871 , -19148 } ,
{ 22490 , -19594 } ,
{ 22101 , -20031 } ,
{ 21704 , -20461 } ,
{ 21298 , -20884 }
};
cos_msin_t a_cos_msin_16[80] = {
{ 29828 , -146 } ,
{ 29825 , -439 } ,
{ 29819 , -732 } ,
{ 29811 , -1025 } ,
{ 29799 , -1317 } ,
{ 29785 , -1610 } ,
{ 29767 , -1902 } ,
{ 29747 , -2194 } ,
{ 29724 , -2486 } ,
{ 29698 , -2778 } ,
{ 29670 , -3069 } ,
{ 29638 , -3360 } ,
{ 29604 , -3651 } ,
{ 29567 , -3942 } ,
{ 29526 , -4232 } ,
{ 29483 , -4521 } ,
{ 29438 , -4811 } ,
{ 29389 , -5099 } ,
{ 29338 , -5388 } ,
{ 29283 , -5676 } ,
{ 29226 , -5963 } ,
{ 29166 , -6249 } ,
{ 29103 , -6535 } ,
{ 29038 , -6821 } ,
{ 28969 , -7106 } ,
{ 28898 , -7390 } ,
{ 28824 , -7673 } ,
{ 28748 , -7956 } ,
{ 28668 , -8237 } ,
{ 28586 , -8518 } ,
{ 28501 , -8799 } ,
{ 28413 , -9078 } ,
{ 28323 , -9357 } ,
{ 28229 , -9634 } ,
{ 28133 , -9911 } ,
{ 28035 , -10187 } ,
{ 27933 , -10461 } ,
{ 27829 , -10735 } ,
{ 27723 , -11008 } ,
{ 27613 , -11279 } ,
{ 27501 , -11550 } ,
{ 27387 , -11819 } ,
{ 27269 , -12088 } ,
{ 27149 , -12355 } ,
{ 27027 , -12621 } ,
{ 26901 , -12885 } ,
{ 26774 , -13149 } ,
{ 26643 , -13411 } ,
{ 26510 , -13672 } ,
{ 26375 , -13932 } ,
{ 26237 , -14190 } ,
{ 26096 , -14447 } ,
{ 25953 , -14702 } ,
{ 25807 , -14956 } ,
{ 25659 , -15209 } ,
{ 25509 , -15460 } ,
{ 25356 , -15710 } ,
{ 25200 , -15958 } ,
{ 25043 , -16205 } ,
{ 24882 , -16450 } ,
{ 24720 , -16693 } ,
{ 24554 , -16935 } ,
{ 24387 , -17175 } ,
{ 24217 , -17414 } ,
{ 24045 , -17651 } ,
{ 23871 , -17886 } ,
{ 23694 , -18119 } ,
{ 23515 , -18351 } ,
{ 23334 , -18581 } ,
{ 23150 , -18809 } ,
{ 22964 , -19036 } ,
{ 22776 , -19260 } ,
{ 22586 , -19483 } ,
{ 22394 , -19704 } ,
{ 22199 , -19923 } ,
{ 22003 , -20140 } ,
{ 21804 , -20355 } ,
{ 21603 , -20568 } ,
{ 21400 , -20779 } ,
{ 21195 , -20988 }
};
cos_msin_t a_cos_msin_32[160]= {
{ 29828 , -73 } ,
{ 29827 , -220 } ,
{ 29826 , -366 } ,
{ 29824 , -512 } ,
{ 29821 , -659 } ,
{ 29817 , -805 } ,
{ 29813 , -952 } ,
{ 29808 , -1098 } ,
{ 29802 , -1244 } ,
{ 29796 , -1390 } ,
{ 29789 , -1537 } ,
{ 29781 , -1683 } ,
{ 29772 , -1829 } ,
{ 29763 , -1975 } ,
{ 29753 , -2121 } ,
{ 29742 , -2267 } ,
{ 29730 , -2413 } ,
{ 29718 , -2559 } ,
{ 29705 , -2705 } ,
{ 29692 , -2851 } ,
{ 29677 , -2997 } ,
{ 29662 , -3142 } ,
{ 29646 , -3288 } ,
{ 29630 , -3433 } ,
{ 29613 , -3579 } ,
{ 29595 , -3724 } ,
{ 29576 , -3869 } ,
{ 29557 , -4014 } ,
{ 29537 , -4159 } ,
{ 29516 , -4304 } ,
{ 29494 , -4449 } ,
{ 29472 , -4594 } ,
{ 29449 , -4738 } ,
{ 29426 , -4883 } ,
{ 29401 , -5027 } ,
{ 29376 , -5172 } ,
{ 29351 , -5316 } ,
{ 29324 , -5460 } ,
{ 29297 , -5604 } ,
{ 29269 , -5747 } ,
{ 29241 , -5891 } ,
{ 29211 , -6034 } ,
{ 29181 , -6178 } ,
{ 29151 , -6321 } ,
{ 29119 , -6464 } ,
{ 29087 , -6607 } ,
{ 29054 , -6749 } ,
{ 29021 , -6892 } ,
{ 28987 , -7034 } ,
{ 28952 , -7177 } ,
{ 28916 , -7319 } ,
{ 28880 , -7460 } ,
{ 28843 , -7602 } ,
{ 28805 , -7744 } ,
{ 28767 , -7885 } ,
{ 28728 , -8026 } ,
{ 28688 , -8167 } ,
{ 28648 , -8308 } ,
{ 28607 , -8448 } ,
{ 28565 , -8589 } ,
{ 28522 , -8729 } ,
{ 28479 , -8869 } ,
{ 28435 , -9008 } ,
{ 28391 , -9148 } ,
{ 28346 , -9287 } ,
{ 28300 , -9426 } ,
{ 28253 , -9565 } ,
{ 28206 , -9703 } ,
{ 28158 , -9842 } ,
{ 28109 , -9980 } ,
{ 28060 , -10118 } ,
{ 28010 , -10255 } ,
{ 27959 , -10393 } ,
{ 27908 , -10530 } ,
{ 27856 , -10667 } ,
{ 27803 , -10803 } ,
{ 27750 , -10940 } ,
{ 27696 , -11076 } ,
{ 27641 , -11212 } ,
{ 27586 , -11347 } ,
{ 27529 , -11482 } ,
{ 27473 , -11617 } ,
{ 27415 , -11752 } ,
{ 27357 , -11886 } ,
{ 27299 , -12021 } ,
{ 27239 , -12154 } ,
{ 27179 , -12288 } ,
{ 27119 , -12421 } ,
{ 27057 , -12554 } ,
{ 26996 , -12687 } ,
{ 26933 , -12819 } ,
{ 26870 , -12951 } ,
{ 26806 , -13083 } ,
{ 26741 , -13215 } ,
{ 26676 , -13346 } ,
{ 26610 , -13476 } ,
{ 26544 , -13607 } ,
{ 26477 , -13737 } ,
{ 26409 , -13867 } ,
{ 26340 , -13996 } ,
{ 26271 , -14125 } ,
{ 26202 , -14254 } ,
{ 26132 , -14383 } ,
{ 26061 , -14511 } ,
{ 25989 , -14638 } ,
{ 25917 , -14766 } ,
{ 25844 , -14893 } ,
{ 25771 , -15020 } ,
{ 25697 , -15146 } ,
{ 25622 , -15272 } ,
{ 25547 , -15397 } ,
{ 25471 , -15523 } ,
{ 25394 , -15648 } ,
{ 25317 , -15772 } ,
{ 25239 , -15896 } ,
{ 25161 , -16020 } ,
{ 25082 , -16143 } ,
{ 25003 , -16266 } ,
{ 24923 , -16389 } ,
{ 24842 , -16511 } ,
{ 24760 , -16632 } ,
{ 24678 , -16754 } ,
{ 24596 , -16875 } ,
{ 24513 , -16995 } ,
{ 24429 , -17115 } ,
{ 24345 , -17235 } ,
{ 24260 , -17354 } ,
{ 24174 , -17473 } ,
{ 24088 , -17592 } ,
{ 24002 , -17710 } ,
{ 23914 , -17827 } ,
{ 23827 , -17945 } ,
{ 23738 , -18061 } ,
{ 23649 , -18178 } ,
{ 23560 , -18293 } ,
{ 23470 , -18409 } ,
{ 23379 , -18524 } ,
{ 23288 , -18638 } ,
{ 23196 , -18752 } ,
{ 23104 , -18866 } ,
{ 23011 , -18979 } ,
{ 22917 , -19092 } ,
{ 22824 , -19204 } ,
{ 22729 , -19316 } ,
{ 22634 , -19427 } ,
{ 22538 , -19538 } ,
{ 22442 , -19649 } ,
{ 22345 , -19759 } ,
{ 22248 , -19868 } ,
{ 22150 , -19977 } ,
{ 22052 , -20086 } ,
{ 21953 , -20194 } ,
{ 21854 , -20301 } ,
{ 21754 , -20408 } ,
{ 21653 , -20515 } ,
{ 21552 , -20621 } ,
{ 21451 , -20726 } ,
{ 21349 , -20831 } ,
{ 21246 , -20936 } ,
{ 21143 , -21040 }
};
cos_msin_t a_cos_msin_64[320] = {
{29827, -34},
{29827, -106},
{29827, -177},
{29827, -249},
{29826, -320},
{29825, -392},
{29824, -463},
{29823, -535},
{29821, -606},
{29819, -678},
{29818, -750},
{29816, -821},
{29814, -893},
{29812, -964},
{29809, -1035},
{29807, -1106},
{29804, -1177},
{29801, -1249},
{29797, -1320},
{29795, -1392},
{29791, -1463},
{29787, -1535},
{29784, -1606},
{29780, -1678},
{29776, -1749},
{29771, -1820},
{29767, -1892},
{29763, -1963},
{29758, -2035},
{29753, -2106},
{29748, -2177},
{29742, -2249},
{29737, -2320},
{29731, -2391},
{29726, -2462},
{29719, -2534},
{29713, -2605},
{29707, -2676},
{29701, -2747},
{29694, -2819},
{29686, -2890},
{29680, -2961},
{29673, -3032},
{29665, -3103},
{29658, -3174},
{29650, -3245},
{29643, -3316},
{29635, -3387},
{29626, -3459},
{29618, -3529},
{29610, -3600},
{29601, -3671},
{29592, -3742},
{29583, -3813},
{29574, -3884},
{29564, -3955},
{29554, -4026},
{29544, -4097},
{29535, -4167},
{29525, -4238},
{29514, -4309},
{29504, -4380},
{29493, -4450},
{29483, -4521},
{29472, -4591},
{29461, -4662},
{29450, -4733},
{29439, -4803},
{29427, -4874},
{29415, -4944},
{29403, -5015},
{29391, -5085},
{29379, -5155},
{29366, -5226},
{29353, -5296},
{29341, -5367},
{29328, -5438},
{29314, -5508},
{29301, -5578},
{29289, -5648},
{29274, -5718},
{29260, -5788},
{29247, -5858},
{29232, -5928},
{29218, -5998},
{29204, -6068},
{29188, -6139},
{29175, -6209},
{29159, -6279},
{29145, -6348},
{29128, -6418},
{29114, -6488},
{29097, -6557},
{29082, -6627},
{29066, -6697},
{29050, -6767},
{29034, -6837},
{29017, -6906},
{29001, -6975},
{28984, -7045},
{28966, -7114},
{28950, -7184},
{28933, -7254},
{28915, -7323},
{28897, -7392},
{28880, -7461},
{28862, -7530},
{28843, -7600},
{28825, -7669},
{28807, -7738},
{28788, -7806},
{28769, -7875},
{28751, -7944},
{28732, -8014},
{28712, -8082},
{28692, -8151},
{28672, -8219},
{28653, -8289},
{28633, -8357},
{28613, -8425},
{28593, -8494},
{28572, -8563},
{28551, -8632},
{28531, -8700},
{28510, -8768},
{28488, -8837},
{28468, -8905},
{28447, -8973},
{28425, -9041},
{28403, -9109},
{28381, -9177},
{28359, -9245},
{28336, -9313},
{28315, -9381},
{28292, -9448},
{28269, -9517},
{28246, -9584},
{28223, -9652},
{28200, -9720},
{28176, -9787},
{28153, -9854},
{28129, -9922},
{28105, -9990},
{28082, -10056},
{28057, -10124},
{28032, -10191},
{28009, -10258},
{27984, -10326},
{27959, -10392},
{27934, -10460},
{27909, -10526},
{27883, -10593},
{27858, -10661},
{27832, -10727},
{27807, -10794},
{27780, -10860},
{27754, -10927},
{27728, -10993},
{27701, -11059},
{27676, -11126},
{27648, -11192},
{27622, -11259},
{27595, -11324},
{27567, -11391},
{27540, -11456},
{27512, -11523},
{27484, -11588},
{27456, -11655},
{27429, -11720},
{27401, -11786},
{27372, -11852},
{27344, -11917},
{27315, -11982},
{27286, -12049},
{27257, -12114},
{27229, -12179},
{27199, -12244},
{27169, -12309},
{27140, -12375},
{27110, -12439},
{27080, -12505},
{27050, -12570},
{27019, -12634},
{26990, -12699},
{26958, -12764},
{26928, -12828},
{26897, -12892},
{26866, -12956},
{26835, -13021},
{26804, -13086},
{26773, -13149},
{26741, -13214},
{26709, -13278},
{26677, -13342},
{26645, -13406},
{26613, -13470},
{26581, -13534},
{26549, -13597},
{26515, -13661},
{26483, -13725},
{26450, -13788},
{26417, -13851},
{26384, -13915},
{26350, -13978},
{26316, -14041},
{26283, -14103},
{26248, -14166},
{26215, -14229},
{26180, -14292},
{26146, -14355},
{26112, -14417},
{26077, -14480},
{26042, -14543},
{26008, -14605},
{25972, -14667},
{25937, -14730},
{25901, -14792},
{25866, -14854},
{25830, -14916},
{25794, -14977},
{25759, -15039},
{25723, -15101},
{25687, -15162},
{25650, -15224},
{25613, -15286},
{25577, -15347},
{25540, -15408},
{25503, -15470},
{25465, -15531},
{25428, -15592},
{25391, -15653},
{25353, -15714},
{25315, -15774},
{25277, -15834},
{25240, -15895},
{25201, -15956},
{25162, -16016},
{25124, -16076},
{25086, -16136},
{25047, -16196},
{25008, -16256},
{24969, -16316},
{24930, -16375},
{24891, -16436},
{24851, -16496},
{24811, -16555},
{24772, -16615},
{24732, -16674},
{24692, -16732},
{24652, -16791},
{24612, -16852},
{24572, -16911},
{24531, -16969},
{24490, -17027},
{24449, -17086},
{24408, -17145},
{24367, -17203},
{24325, -17261},
{24284, -17320},
{24242, -17379},
{24200, -17436},
{24158, -17494},
{24116, -17552},
{24075, -17610},
{24032, -17668},
{23990, -17725},
{23947, -17782},
{23904, -17840},
{23862, -17897},
{23819, -17954},
{23775, -18011},
{23732, -18068},
{23689, -18125},
{23645, -18181},
{23602, -18238},
{23558, -18294},
{23514, -18351},
{23470, -18407},
{23426, -18464},
{23381, -18520},
{23337, -18576},
{23293, -18632},
{23248, -18688},
{23202, -18743},
{23158, -18799},
{23112, -18854},
{23068, -18910},
{23022, -18964},
{22977, -19020},
{22931, -19074},
{22885, -19129},
{22839, -19185},
{22793, -19239},
{22747, -19294},
{22700, -19348},
{22655, -19403},
{22607, -19457},
{22561, -19511},
{22514, -19565},
{22467, -19619},
{22421, -19673},
{22373, -19726},
{22326, -19780},
{22279, -19834},
{22230, -19887},
{22183, -19940},
{22135, -19993},
{22087, -20047},
{22039, -20099},
{21991, -20152},
{21942, -20205},
{21894, -20257},
{21845, -20309},
{21797, -20362},
{21748, -20413},
{21699, -20466},
{21650, -20518},
{21601, -20570},
{21551, -20621},
{21502, -20674}
};
cos_msin_t *a_cos_msin_table[] = {a_cos_msin_2, a_cos_msin_4,
a_cos_msin_8, a_cos_msin_16,
a_cos_msin_32,a_cos_msin_64
};
Word16 dct_core_a[10][10] = {
{ 10453, 10196, 9688, 8941, 7973, 6810, 5479, 4013, 2448, 823 },
{ 10196, 7973, 4013, -823, -5479, -8941, -10453, -9688, -6810, -2448 },
{ 9688 , 4013, -4013, -9688, -9688, -4013, 4013, 9688, 9688, 4013 },
{ 8941 , -823, -9688, -7973, 2448, 10196, 6810, -4013, -10453, -5479 },
{ 7973 , -5479, -9688, 2448, 10453, 823, -10196, -4013, 8941, 6810 },
{ 6810 , -8941, -4013, 10196, 823, -10453, 2448, 9688, -5479, -7973 },
{ 5479 , -10453, 4013, 6810, -10196, 2448, 7973, -9688, 823, 8941 },
{ 4013 , -9688, 9688, -4013, -4013, 9688, -9688, 4013, 4013, -9688 },
{ 2448 , -6810, 9688, -10453, 8941, -5479, 823, 4013, -7973, 10196 },
{ 823 , -2448, 4013, -5479, 6810, -7973, 8941, -9688, 10196, -10453 }};
Word16 anal_bias[320] = {
1, 1, 3, 1, 4, 1, 3, -2, 4, 3,
4, 1, 3, 0, 2, -3, 0, 0, 2, 2,
4, 1, 1, -5, 4, 1, 2, -1, 0, -1,
1, -2, 0, 2, 2, 2, 4, 1, 3, 0,
5, 3, 2, 0, 3, 0, 1, -4, 1, 1,
2, 0, 4, 0, 1, -4, 6, 1, 3, -1,
1, 0, 0, -4, 1, 1, 3, 1, 3, 2,
4, -2, 4, 3, 5, 1, 3, 0, 1, -3,
1, 1, 2, 0, 4, 1, 2, -4, 4, 2,
2, -1, 1, -1, 1, -4, 0, 0, 3, 0,
5, 2, 3, -1, 6, 2, 5, 0, 4, 0,
1, -3, 1, 0, 3, 0, 4, 0, 1, -3,
4, 1, 3, -1, 1, -2, 1, -4, 0, 1,
2, 1, 3, 2, 2, -2, 4, 3, 3, 0,
3, 0, 0, -2, 1, 0, 2, 0, 5, -1,
1, -3, 4, 2, 2, 0, 2, -3, 1, -4,
-1, 1, 2, 2, 4, 1, 3, -1, 5, 2,
2, 0, 3, -1, 2, -3, 0, 1, 2, 2,
4, 0, 1, -5, 5, 1, 3, 0, 2, -1,
0, -2, 1, 2, 2, 2, 4, 1, 0, 0,
4, 2, 4, 1, 4, -1, 1, -4, 0, 1,
3, 1, 5, 1, 1, -2, 4, 0, 2, 0,
2, -1, 0, -2, 0, 1, 1, 1, 4, 2,
3, -2, 5, 4, 4, 0, 3, 0, 3, -4,
1, 2, 2, 0, 4, 1, 0, -3, 4, 2,
3, -1, 1, -1, 1, -4, 0, 2, 3, 1,
4, 1, 3, 0, 3, 3, 4, 1, 2, 0,
1, -3, 2, 2, 2, 1, 5, 0, 1, -4,
4, 1, 3, -2, 3, -1, 0, -2, 0, 2,
2, 0, 5, 1, 4, -1, 4, 3, 4, 1,
3, 0, 1, -4, 2, 0, 3, 1, 5, 0,
1, -5, 5, 2, 2, 0, 0, 0, 0, -4};

1125
third_party/g7221/encode/encoder.c vendored Normal file

File diff suppressed because it is too large Load Diff

270
third_party/g7221/encode/sam2coef.c vendored Normal file
View File

@ -0,0 +1,270 @@
/******************************************************************************
**
** ITU-T G.722.1 (2005-05) - Fixed point implementation for main body and Annex C
** > Software Release 2.1 (2008-06)
** (Simple repackaging; no change from 2005-05 Release 2.0 code)
**
** © 2004 Polycom, Inc.
**
** All rights reserved.
**
******************************************************************************/
/******************************************************************************
* Filename: samples_to_rmlt_coefs.c
*
* Purpose: Convert Samples to Reversed MLT (Modulated Lapped Transform)
* Coefficients
*
* 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. * 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 * to reversing the order of the samples, performing
* an MLT and then negating all * the even-numbered coefficients.
*
******************************************************************************/
/***************************************************************************
Include files
***************************************************************************/
#include "defs.h"
#include "tables.h"
#include "count.h"
/***************************************************************************
Function: samples_to_rmlt_coefs
Syntax: Word16 samples_to_rmlt_coefs(new_samples,
old_samples,
coefs,
dct_length)
Word16 *new_samples;
Word16 *old_samples;
Word16 *coefs;
Word16 dct_length;
Description: Convert samples to MLT coefficients
Design Notes:
WMOPS: 7kHz | 24kbit | 32kbit
-------|--------------|----------------
AVG | 1.40 | 1.40
-------|--------------|----------------
MAX | 1.40 | 1.40
-------|--------------|----------------
14kHz | 24kbit | 32kbit | 48kbit
-------|--------------|----------------|----------------
AVG | 3.07 | 3.07 | 3.07
-------|--------------|----------------|----------------
MAX | 3.10 | 3.10 | 3.10
-------|--------------|----------------|----------------
***************************************************************************/
Word16 samples_to_rmlt_coefs(Word16 *new_samples,Word16 *old_samples,Word16 *coefs,Word16 dct_length)
{
Word16 index, vals_left,mag_shift,n;
Word16 windowed_data[MAX_DCT_LENGTH];
Word16 *new_ptr, *old_ptr, *sam_low, *sam_high;
Word16 *win_low, *win_high;
Word16 *dst_ptr;
Word16 neg_win_low;
Word16 samp_high;
Word16 half_dct_size;
Word32 acca;
Word32 accb;
Word16 temp;
Word16 temp1;
Word16 temp2;
Word16 temp5;
half_dct_size = shr(dct_length,1);
/*++++++++++++++++++++++++++++++++++++++++++++*/
/* Get the first half of the windowed samples */
/*++++++++++++++++++++++++++++++++++++++++++++*/
dst_ptr = windowed_data;
move16();
/* address arithmetic */
test();
if (dct_length==DCT_LENGTH)
{
win_high = samples_to_rmlt_window + half_dct_size;
}
else
{
win_high = max_samples_to_rmlt_window + half_dct_size;
}
win_low = win_high;
move16();
/* address arithmetic */
sam_high = old_samples + half_dct_size;
sam_low = sam_high;
move16();
for (vals_left = half_dct_size;vals_left > 0;vals_left--)
{
acca = 0L;
move32();
acca = L_mac(acca,*--win_low, *--sam_low);
acca = L_mac(acca,*win_high++, *sam_high++);
temp = round(acca);
*dst_ptr++ = temp;
move16();
}
/*+++++++++++++++++++++++++++++++++++++++++++++*/
/* Get the second half of the windowed samples */
/*+++++++++++++++++++++++++++++++++++++++++++++*/
sam_low = new_samples;
move16();
/* address arithmetic */
sam_high = new_samples + dct_length;
for (vals_left = half_dct_size; vals_left > 0; vals_left--)
{
acca = 0L;
move32();
acca = L_mac(acca,*--win_high, *sam_low++);
neg_win_low = negate(*win_low++);
samp_high = *--sam_high;
acca = L_mac(acca, neg_win_low, samp_high);
temp = round(acca);
*dst_ptr++=temp;
move16();
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* Save the new samples for next time, when they will be the old samples */
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
new_ptr = new_samples;
move16();
old_ptr = old_samples;
move16();
for (vals_left = dct_length;vals_left > 0;vals_left--)
{
*old_ptr++ = *new_ptr++;
move16();
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* Calculate how many bits to shift up the input to the DCT. */
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
temp1=0;
move16();
for(index=0;index<dct_length;index++)
{
temp2 = abs_s(windowed_data[index]);
temp = sub(temp2,temp1);
test();
if(temp > 0)
{
move16();
temp1 = temp2;
}
}
mag_shift=0;
move16();
temp = sub(temp1,14000);
test();
if (temp >= 0)
{
mag_shift = 0;
move16();
}
else
{
temp = sub(temp1,438);
test();
if(temp < 0)
temp = add(temp1,1);
else
{
temp = temp1;
move16();
}
accb = L_mult(temp,9587);
acca = L_shr(accb,20);
temp5 = extract_l(acca);
temp = norm_s(temp5);
test();
if (temp == 0)
{
mag_shift = 9;
move16();
}
else
mag_shift = sub(temp,6);
}
acca = 0L;
move32();
for(index=0; index<dct_length; index++)
{
temp = abs_s( windowed_data[index]);
acca = L_add(acca,temp);
}
acca = L_shr(acca,7);
test();
if (temp1 < acca)
{
mag_shift = sub(mag_shift,1);
}
test();
if (mag_shift > 0)
{
for(index=0;index<dct_length;index++)
{
windowed_data[index] = shl(windowed_data[index],mag_shift);
}
}
else
{
test();
if (mag_shift < 0)
{
n = negate(mag_shift);
for(index=0;index<dct_length;index++)
{
windowed_data[index] = shr(windowed_data[index],n);
move16();
}
}
}
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
/* Perform a Type IV DCT on the windowed data to get the coefficients */
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
dct_type_iv_a(windowed_data, coefs, dct_length);
return(mag_shift);
}