Fixed the AAC/M4A decoder and upgraded its dependencies.

This commit is contained in:
casey 2016-06-04 17:34:43 -07:00
parent 6a6f7fe24d
commit 4effb493e9
130 changed files with 66146 additions and 48872 deletions

View File

@ -20,6 +20,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flacdecoder", "src\contrib\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpg123decoder", "src\contrib\mpg123decoder\mpg123decoder.vcxproj", "{04118CC2-DE10-4627-A695-2219428C7D59}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aacdecoder", "src\contrib\aacdecoder\aacdecoder.vcxproj", "{4993E68D-E97A-4CD2-AC8E-168AE315BAC5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -62,6 +64,10 @@ Global
{04118CC2-DE10-4627-A695-2219428C7D59}.Debug|Win32.Build.0 = Debug|Win32
{04118CC2-DE10-4627-A695-2219428C7D59}.Release|Win32.ActiveCfg = Release|Win32
{04118CC2-DE10-4627-A695-2219428C7D59}.Release|Win32.Build.0 = Release|Win32
{4993E68D-E97A-4CD2-AC8E-168AE315BAC5}.Debug|Win32.ActiveCfg = Debug|Win32
{4993E68D-E97A-4CD2-AC8E-168AE315BAC5}.Debug|Win32.Build.0 = Debug|Win32
{4993E68D-E97A-4CD2-AC8E-168AE315BAC5}.Release|Win32.ActiveCfg = Release|Win32
{4993E68D-E97A-4CD2-AC8E-168AE315BAC5}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -0,0 +1,202 @@
#include "stdafx.h"
#include "AacDecoder.h"
#include <io.h>
using musik::core::io::IDataStream;
using musik::core::audio::IBuffer;
static uint32_t streamReadCallback(void *userData, void *buffer, uint32_t length) {
IDataStream *stream = static_cast<IDataStream*>(userData);
return (uint32_t) stream->Read(buffer, length);
}
static uint32_t streamSeekCallback(void *userData, uint64_t position) {
IDataStream *stream = static_cast<IDataStream*>(userData);
return (uint32_t) stream->SetPosition((long) position);
}
static int FindAacTrack(mp4ff_t *infile) {
int i, rc;
int numTracks = mp4ff_total_tracks(infile);
for (i = 0; i < numTracks; i++) {
unsigned char *buff = NULL;
int size = 0;
mp4AudioSpecificConfig mp4ASC;
mp4ff_get_decoder_config(infile, i, &buff, (unsigned int *) &size);
if (buff) {
rc = NeAACDecAudioSpecificConfig(buff, size, &mp4ASC);
free(buff);
if (rc < 0) {
continue;
}
return i;
}
}
/* can't decode this */
return -1;
}
AacDecoder::AacDecoder() {
this->decoder = NULL;
this->decoderFile = NULL;
memset(&decoderCallbacks, 0, sizeof(this->decoderCallbacks));
}
AacDecoder::~AacDecoder() {
}
bool AacDecoder::Open(musik::core::io::IDataStream *stream)
{
unsigned char* buffer;
unsigned int buffer_size;
NeAACDecConfigurationPtr config;
decoder = NeAACDecOpen();
if (!decoder) {
return false;
}
config = NeAACDecGetCurrentConfiguration(decoder);
config->outputFormat = FAAD_FMT_FLOAT;
config->downMatrix = 0;
int ret = NeAACDecSetConfiguration(decoder, config);
decoderCallbacks.read = streamReadCallback;
decoderCallbacks.seek = streamSeekCallback;
decoderCallbacks.user_data = stream;
decoderFile = mp4ff_open_read(&decoderCallbacks);
if (!decoderFile) {
return false;
}
if ((audioTrackId = FindAacTrack(decoderFile)) < 0) {
return false;
}
buffer = NULL;
buffer_size = 0;
mp4ff_get_decoder_config(decoderFile, audioTrackId, &buffer, &buffer_size);
if (!buffer) {
return false;
}
if (NeAACDecInit2(
decoder,
buffer,
buffer_size,
&this->sampleRate,
&this->channelCount) < 0)
{
if (buffer) {
free(buffer);
}
return false;
}
free(buffer);
this->totalSamples = mp4ff_num_samples(decoderFile, audioTrackId);
decoderSampleId = 0;
return true;
}
void AacDecoder::Destroy(void)
{
mp4ff_close(decoderFile);
if (decoder) {
NeAACDecClose(decoder);
decoder = NULL;
}
delete this;
}
double AacDecoder::SetPosition(double seconds) {
int64_t duration;
float fms = (float) seconds * 1000;
int32_t skip_samples = 0;
duration = (int64_t)(fms / 1000.0 * sampleRate + 0.5);
decoderSampleId = mp4ff_find_sample_use_offsets(
decoderFile, audioTrackId, duration, &skip_samples);
return seconds;
}
bool AacDecoder::GetBuffer(IBuffer* target) {
if (this->decoderSampleId < 0) {
return false;
}
void* sampleBuffer = NULL;
unsigned char* encodedData = NULL;
unsigned int encodedDataLength = 0;
NeAACDecFrameInfo frameInfo;
/* get acces unit from MP4 file */
long duration = mp4ff_get_sample_duration(
decoderFile, audioTrackId, decoderSampleId);
if (duration <= 0) {
return false;
}
/* read the raw data required */
int rc =
mp4ff_read_sample(
decoderFile,
audioTrackId,
decoderSampleId,
&encodedData,
&encodedDataLength);
decoderSampleId++;
if (rc == 0 || encodedData == NULL) {
return false;
}
sampleBuffer =
NeAACDecDecode(
decoder,
&frameInfo,
encodedData,
encodedDataLength);
free(encodedData);
if (frameInfo.error > 0) {
return false;
}
if (decoderSampleId > this->totalSamples) {
return false;
}
target->SetSampleRate(frameInfo.samplerate);
target->SetChannels(frameInfo.channels);
target->SetSamples(frameInfo.samples / frameInfo.channels);
memcpy(
static_cast<void*>(target->BufferPointer()),
static_cast<void*>(sampleBuffer),
sizeof(float) * frameInfo.samples);
return true;
}

View File

@ -0,0 +1,27 @@
#pragma once
#include <core/sdk/IDecoder.h>
#include <neaacdec.h>
#include <mp4ff.h>
class AacDecoder : public musik::core::audio::IDecoder {
public:
AacDecoder();
~AacDecoder();
virtual void Destroy();
virtual double SetPosition(double seconds);
virtual bool GetBuffer(musik::core::audio::IBuffer *buffer);
virtual bool Open(musik::core::io::IDataStream *stream);
private:
NeAACDecHandle decoder;
mp4ff_t* decoderFile;
mp4ff_callback_t decoderCallbacks;
int audioTrackId;
long totalSamples;
unsigned long sampleRate;
unsigned char channelCount;
long decoderSampleId;
};

View File

@ -33,45 +33,35 @@
#include "stdafx.h"
#include "AACSourceSupplier.h"
#include "m4aAudioSource.h"
#include "AacDecoderFactory.h"
#include "AacDecoder.h"
#include <algorithm>
#include "boost/algorithm/string.hpp"
#include "boost/filesystem.hpp"
using musik::core::audio::IDecoder;
AACSourceSupplier::AACSourceSupplier(void)
{
AacDecoderFactory::AacDecoderFactory() {
}
AACSourceSupplier::~AACSourceSupplier(void)
{
AacDecoderFactory::~AacDecoderFactory() {
}
void AACSourceSupplier::Destroy()
{
void AacDecoderFactory::Destroy() {
delete this;
}
IAudioSource* AACSourceSupplier::CreateAudioSource()
{
return new M4ADecoder();
IDecoder* AacDecoderFactory::CreateDecoder() {
return new AacDecoder();
}
bool AACSourceSupplier::CanHandle(const utfchar* source) const
{
using namespace boost::filesystem;
using namespace boost::algorithm;
bool AacDecoderFactory::CanHandle(const char* type) const {
std::string str(type);
std::transform(str.begin(), str.end(), str.begin(), tolower);
wpath sourcepath(source);
if (!is_regular(sourcepath))
return false;
if (to_lower_copy(extension(sourcepath)) != _T(".aac") &&
to_lower_copy(extension(sourcepath)) != _T(".m4a") )
return false;
return true;
return
musik::sdk::endsWith(str, ".aac") ||
musik::sdk::endsWith(str, ".m4a") ||
str.find("audio/aac") != std::string::npos ||
str.find("audio/mp4") != std::string::npos;
}

View File

@ -33,16 +33,14 @@
#pragma once
#include "IAudioSource.h"
#include <core/sdk/IDecoderFactory.h>
using namespace musik::core::audio;
class AacDecoderFactory : public musik::core::audio::IDecoderFactory {
public:
AacDecoderFactory();
virtual ~AacDecoderFactory();
class AACSourceSupplier : public IAudioSourceSupplier
{
public: AACSourceSupplier();
public: ~AACSourceSupplier();
public: IAudioSource* CreateAudioSource();
public: void Destroy();
public: bool CanHandle(const utfchar* source) const;
musik::core::audio::IDecoder* CreateDecoder();
void Destroy();
bool CanHandle(const char* source) const;
};

View File

@ -598,11 +598,11 @@
Name="plugin"
>
<File
RelativePath=".\AACSourceSupplier.cpp"
RelativePath=".\AacDecoderFactory.cpp"
>
</File>
<File
RelativePath=".\AACSourceSupplier.h"
RelativePath=".\AacDecoderFactory.h"
>
</File>
<File

View File

@ -14,18 +14,19 @@
<ProjectGuid>{4993E68D-E97A-4CD2-AC8E-168AE315BAC5}</ProjectGuid>
<RootNamespace>aacdecoder</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
@ -38,28 +39,31 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)/bin/$(Configuration)/plugins\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)/obj/$(Configuration)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)/bin/$(Configuration)/plugins\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)/obj/$(Configuration)\</IntDir>
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<_ProjectFileVersion>14.0.25123.0</_ProjectFileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)/bin/$(Configuration)/plugins\</OutDir>
<IntDir>./obj/$(Configuration)\</IntDir>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)/bin/$(Configuration)/plugins\</OutDir>
<IntDir>./obj/$(Configuration)\</IntDir>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRules />
<CodeAnalysisRuleAssemblies />
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>../../core/audio;../../;../../3rdparty/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>./;../../;../../3rdparty/include;./mp4ff;./libfaad;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;AACDECODER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
@ -70,11 +74,10 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>../../core/audio;../../;../../3rdparty/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>./;../../;../../3rdparty/include;./mp4ff;./libfaad;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;AACDECODER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
@ -83,18 +86,11 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="AacDecoderFactory.h" />
<ClInclude Include="libfaad\analysis.h" />
<ClInclude Include="libfaad\bits.h" />
<ClInclude Include="libfaad\cfft.h" />
<ClInclude Include="libfaad\cfft_tab.h" />
<ClInclude Include="libfaad\common.h" />
<ClInclude Include="libfaad\decoder.h" />
<ClInclude Include="libfaad\drc.h" />
<ClInclude Include="drms.h" />
<ClInclude Include="drmstables.h" />
<ClInclude Include="libfaad\error.h" />
<ClInclude Include="libfaad\filtbank.h" />
<ClInclude Include="libfaad\fixed.h" />
<ClInclude Include="libfaad\codebook\hcb.h" />
<ClInclude Include="libfaad\codebook\hcb_1.h" />
<ClInclude Include="libfaad\codebook\hcb_10.h" />
@ -108,6 +104,12 @@
<ClInclude Include="libfaad\codebook\hcb_8.h" />
<ClInclude Include="libfaad\codebook\hcb_9.h" />
<ClInclude Include="libfaad\codebook\hcb_sf.h" />
<ClInclude Include="libfaad\common.h" />
<ClInclude Include="libfaad\drc.h" />
<ClInclude Include="libfaad\drm_dec.h" />
<ClInclude Include="libfaad\error.h" />
<ClInclude Include="libfaad\filtbank.h" />
<ClInclude Include="libfaad\fixed.h" />
<ClInclude Include="libfaad\huffman.h" />
<ClInclude Include="libfaad\ic_predict.h" />
<ClInclude Include="libfaad\iq_table.h" />
@ -115,14 +117,13 @@
<ClInclude Include="libfaad\kbd_win.h" />
<ClInclude Include="libfaad\lt_predict.h" />
<ClInclude Include="libfaad\mdct.h" />
<ClInclude Include="libfaad\mdct_tab.h" />
<ClInclude Include="libfaad\mp4.h" />
<ClInclude Include="mp4ff.h" />
<ClInclude Include="mp4ff_int_types.h" />
<ClInclude Include="mp4ffint.h" />
<ClInclude Include="libfaad\ms.h" />
<ClInclude Include="neaacdec.h" />
<ClInclude Include="libfaad\output.h" />
<ClInclude Include="libfaad\pns.h" />
<ClInclude Include="libfaad\ps_dec.h" />
<ClInclude Include="libfaad\ps_tables.h" />
<ClInclude Include="libfaad\pulse.h" />
<ClInclude Include="libfaad\rvlc.h" />
<ClInclude Include="libfaad\sbr_dct.h" />
@ -146,17 +147,21 @@
<ClInclude Include="libfaad\structs.h" />
<ClInclude Include="libfaad\syntax.h" />
<ClInclude Include="libfaad\tns.h" />
<ClInclude Include="AACSourceSupplier.h" />
<ClInclude Include="m4aAudioSource.h" />
<ClInclude Include="AacDecoder.h" />
<ClInclude Include="mp4ff\mp4ff.h" />
<ClInclude Include="mp4ff\mp4ffint.h" />
<ClInclude Include="mp4ff\mp4ff_int_types.h" />
<ClInclude Include="stdafx.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="AacDecoderFactory.cpp" />
<ClCompile Include="accdecoder_plugin.cpp" />
<ClCompile Include="libfaad\bits.c" />
<ClCompile Include="libfaad\cfft.c" />
<ClCompile Include="libfaad\common.c" />
<ClCompile Include="libfaad\decoder.c" />
<ClCompile Include="libfaad\drc.c" />
<ClCompile Include="drms.c" />
<ClCompile Include="libfaad\drm_dec.c" />
<ClCompile Include="libfaad\error.c" />
<ClCompile Include="libfaad\filtbank.c" />
<ClCompile Include="libfaad\hcr.c" />
@ -166,15 +171,11 @@
<ClCompile Include="libfaad\lt_predict.c" />
<ClCompile Include="libfaad\mdct.c" />
<ClCompile Include="libfaad\mp4.c" />
<ClCompile Include="mp4atom.c" />
<ClCompile Include="mp4ff.c" />
<ClCompile Include="mp4meta.c" />
<ClCompile Include="mp4sample.c" />
<ClCompile Include="mp4tagupdate.c" />
<ClCompile Include="mp4util.c" />
<ClCompile Include="libfaad\ms.c" />
<ClCompile Include="libfaad\output.c" />
<ClCompile Include="libfaad\pns.c" />
<ClCompile Include="libfaad\ps_dec.c" />
<ClCompile Include="libfaad\ps_syntax.c" />
<ClCompile Include="libfaad\pulse.c" />
<ClCompile Include="libfaad\rvlc.c" />
<ClCompile Include="libfaad\sbr_dct.c" />
@ -193,9 +194,13 @@
<ClCompile Include="libfaad\ssr_ipqf.c" />
<ClCompile Include="libfaad\syntax.c" />
<ClCompile Include="libfaad\tns.c" />
<ClCompile Include="AACSourceSupplier.cpp" />
<ClCompile Include="accdecoder_plugin.cpp" />
<ClCompile Include="m4aAudioSource.cpp" />
<ClCompile Include="AacDecoder.cpp" />
<ClCompile Include="mp4ff\mp4atom.c" />
<ClCompile Include="mp4ff\mp4ff.c" />
<ClCompile Include="mp4ff\mp4meta.c" />
<ClCompile Include="mp4ff\mp4sample.c" />
<ClCompile Include="mp4ff\mp4tagupdate.c" />
<ClCompile Include="mp4ff\mp4util.c" />
<ClCompile Include="stdafx.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -5,14 +5,95 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
</Filter>
<Filter Include="libfaad">
<UniqueIdentifier>{a25795f5-4cce-4cf6-8adb-70a3b40c4070}</UniqueIdentifier>
</Filter>
<Filter Include="plugin">
<UniqueIdentifier>{c7d5fc81-078c-4e75-8864-254c9279ec07}</UniqueIdentifier>
<UniqueIdentifier>{37be8e13-9515-4d79-8e2b-a9486ca27f9b}</UniqueIdentifier>
</Filter>
<Filter Include="libfaad">
<UniqueIdentifier>{795089cd-ac9e-4f29-abe4-60d703516eb8}</UniqueIdentifier>
</Filter>
<Filter Include="mp4ff">
<UniqueIdentifier>{97896785-abd6-4910-bfe3-4f426916a0ea}</UniqueIdentifier>
</Filter>
<Filter Include="libfaad\codebook">
<UniqueIdentifier>{c6bb8215-e205-4007-a8ae-fd9ba8992ac0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>plugin</Filter>
</ClInclude>
<ClInclude Include="mp4ff\mp4ff.h">
<Filter>mp4ff</Filter>
</ClInclude>
<ClInclude Include="mp4ff\mp4ff_int_types.h">
<Filter>mp4ff</Filter>
</ClInclude>
<ClInclude Include="mp4ff\mp4ffint.h">
<Filter>mp4ff</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_3.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_4.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_5.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_6.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_7.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_8.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_9.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_10.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_11.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_sf.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_1.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_2.h">
<Filter>libfaad\codebook</Filter>
</ClInclude>
<ClInclude Include="libfaad\specrec.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ssr.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ssr_fb.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ssr_ipqf.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ssr_win.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\structs.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\syntax.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\tns.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\analysis.h">
<Filter>libfaad</Filter>
</ClInclude>
@ -28,16 +109,10 @@
<ClInclude Include="libfaad\common.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\decoder.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\drc.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="drms.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="drmstables.h">
<ClInclude Include="libfaad\drm_dec.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\error.h">
@ -49,45 +124,6 @@
<ClInclude Include="libfaad\fixed.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_1.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_10.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_11.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_2.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_3.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_4.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_5.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_6.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_7.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_8.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_9.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\codebook\hcb_sf.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\huffman.h">
<Filter>libfaad</Filter>
</ClInclude>
@ -109,30 +145,27 @@
<ClInclude Include="libfaad\mdct.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\mdct_tab.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\mp4.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="mp4ff.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="mp4ff_int_types.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="mp4ffint.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ms.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="neaacdec.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\output.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\pns.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ps_dec.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ps_tables.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\pulse.h">
<Filter>libfaad</Filter>
</ClInclude>
@ -178,41 +211,38 @@
<ClInclude Include="libfaad\sine_win.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\specrec.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ssr.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ssr_fb.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ssr_ipqf.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\ssr_win.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\structs.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\syntax.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="libfaad\tns.h">
<Filter>libfaad</Filter>
</ClInclude>
<ClInclude Include="AACSourceSupplier.h">
<ClInclude Include="AacDecoderFactory.h">
<Filter>plugin</Filter>
</ClInclude>
<ClInclude Include="m4aAudioSource.h">
<Filter>plugin</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<ClInclude Include="AacDecoder.h">
<Filter>plugin</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="accdecoder_plugin.cpp">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="mp4ff\mp4util.c">
<Filter>mp4ff</Filter>
</ClCompile>
<ClCompile Include="mp4ff\mp4atom.c">
<Filter>mp4ff</Filter>
</ClCompile>
<ClCompile Include="mp4ff\mp4ff.c">
<Filter>mp4ff</Filter>
</ClCompile>
<ClCompile Include="mp4ff\mp4meta.c">
<Filter>mp4ff</Filter>
</ClCompile>
<ClCompile Include="mp4ff\mp4sample.c">
<Filter>mp4ff</Filter>
</ClCompile>
<ClCompile Include="mp4ff\mp4tagupdate.c">
<Filter>mp4ff</Filter>
</ClCompile>
<ClCompile Include="libfaad\bits.c">
<Filter>libfaad</Filter>
</ClCompile>
@ -228,7 +258,7 @@
<ClCompile Include="libfaad\drc.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="drms.c">
<ClCompile Include="libfaad\drm_dec.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="libfaad\error.c">
@ -258,24 +288,6 @@
<ClCompile Include="libfaad\mp4.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="mp4atom.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="mp4ff.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="mp4meta.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="mp4sample.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="mp4tagupdate.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="mp4util.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="libfaad\ms.c">
<Filter>libfaad</Filter>
</ClCompile>
@ -285,6 +297,12 @@
<ClCompile Include="libfaad\pns.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="libfaad\ps_dec.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="libfaad\ps_syntax.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="libfaad\pulse.c">
<Filter>libfaad</Filter>
</ClCompile>
@ -339,16 +357,10 @@
<ClCompile Include="libfaad\tns.c">
<Filter>libfaad</Filter>
</ClCompile>
<ClCompile Include="AACSourceSupplier.cpp">
<ClCompile Include="AacDecoderFactory.cpp">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="accdecoder_plugin.cpp">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="m4aAudioSource.cpp">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="stdafx.cpp">
<ClCompile Include="AacDecoder.cpp">
<Filter>plugin</Filter>
</ClCompile>
</ItemGroup>

View File

@ -36,29 +36,33 @@
#include "stdafx.h"
#include "AACSourceSupplier.h"
#include <core/IPlugin.h>
#include "AacDecoderFactory.h"
#include <core/sdk/IPlugin.h>
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
#ifdef WIN32
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif
#ifdef WIN32
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
return true;
}
#endif
class AACDecoderPlugin : public musik::core::IPlugin
{
void Destroy() { delete this; };
const utfchar* Name() { return TEXT("AAC decoder"); };
const utfchar* Version() { return TEXT("1"); };
const utfchar* Author() { return TEXT("Björn Olievier"); };
class AacDecoderPlugin : public musik::core::IPlugin {
public:
virtual void Destroy() { delete this; };
virtual const char* Name() { return "AAC IDecoder"; };
virtual const char* Version() { return "0.2"; };
virtual const char* Author() { return "Björn Olievier, clangen"; };
};
extern "C" __declspec(dllexport) musik::core::IPlugin* GetPlugin()
{
return new AACDecoderPlugin();
extern "C" DLLEXPORT musik::core::IPlugin* GetPlugin() {
return new AacDecoderPlugin();
}
extern "C" __declspec(dllexport) IAudioSourceSupplier* CreateAudioSourceSupplier()
{
return new AACSourceSupplier();
extern "C" DLLEXPORT musik::core::audio::IDecoderFactory* GetDecoderFactory() {
return new AacDecoderFactory();
}

101
src/contrib/aacdecoder/libfaad/analysis.h Normal file → Executable file
View File

@ -1,49 +1,52 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: analysis.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __ANALYSIS_H__
#define __ANALYSIS_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ANALYSIS
#define DEBUGDEC ,uint8_t print,uint16_t var,uint8_t *dbg
#define DEBUGVAR(A,B,C) ,A,B,C
extern uint16_t dbg_count;
#else
#define DEBUGDEC
#define DEBUGVAR(A,B,C)
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: analysis.h,v 1.18 2007/11/01 12:33:29 menno Exp $
**/
#ifndef __ANALYSIS_H__
#define __ANALYSIS_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef ANALYSIS
#define DEBUGDEC ,uint8_t print,uint16_t var,uint8_t *dbg
#define DEBUGVAR(A,B,C) ,A,B,C
extern uint16_t dbg_count;
#else
#define DEBUGDEC
#define DEBUGVAR(A,B,C)
#endif
#ifdef __cplusplus
}
#endif
#endif

484
src/contrib/aacdecoder/libfaad/bits.c Normal file → Executable file
View File

@ -1,213 +1,271 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: bits.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#include "bits.h"
/* initialize buffer, call once before first getbits or showbits */
void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size)
{
uint32_t tmp;
if (ld == NULL)
return;
memset(ld, 0, sizeof(bitfile));
if (buffer_size == 0 || _buffer == NULL)
{
ld->error = 1;
ld->no_more_reading = 1;
return;
}
ld->buffer = faad_malloc((buffer_size+12)*sizeof(uint8_t));
memset(ld->buffer, 0, (buffer_size+12)*sizeof(uint8_t));
memcpy(ld->buffer, _buffer, buffer_size*sizeof(uint8_t));
ld->buffer_size = buffer_size;
tmp = getdword((uint32_t*)ld->buffer);
ld->bufa = tmp;
tmp = getdword((uint32_t*)ld->buffer + 1);
ld->bufb = tmp;
ld->start = (uint32_t*)ld->buffer;
ld->tail = ((uint32_t*)ld->buffer + 2);
ld->bits_left = 32;
ld->bytes_used = 0;
ld->no_more_reading = 0;
ld->error = 0;
}
void faad_endbits(bitfile *ld)
{
if (ld)
{
if (ld->buffer)
{
faad_free(ld->buffer);
ld->buffer = NULL;
}
}
}
uint32_t faad_get_processed_bits(bitfile *ld)
{
return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left));
}
uint8_t faad_byte_align(bitfile *ld)
{
uint8_t remainder = (uint8_t)((32 - ld->bits_left) % 8);
if (remainder)
{
faad_flushbits(ld, 8 - remainder);
return (8 - remainder);
}
return 0;
}
void faad_flushbits_ex(bitfile *ld, uint32_t bits)
{
uint32_t tmp;
ld->bufa = ld->bufb;
if (ld->no_more_reading == 0)
{
tmp = getdword(ld->tail);
ld->tail++;
} else {
tmp = 0;
}
ld->bufb = tmp;
ld->bits_left += (32 - bits);
ld->bytes_used += 4;
if (ld->bytes_used == ld->buffer_size)
ld->no_more_reading = 1;
if (ld->bytes_used > ld->buffer_size)
ld->error = 1;
}
/* rewind to beginning */
void faad_rewindbits(bitfile *ld)
{
uint32_t tmp;
tmp = ld->start[0];
#ifndef ARCH_IS_BIG_ENDIAN
BSWAP(tmp);
#endif
ld->bufa = tmp;
tmp = ld->start[1];
#ifndef ARCH_IS_BIG_ENDIAN
BSWAP(tmp);
#endif
ld->bufb = tmp;
ld->bits_left = 32;
ld->tail = &ld->start[2];
ld->bytes_used = 0;
ld->no_more_reading = 0;
}
uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
DEBUGDEC)
{
uint16_t i;
uint8_t temp;
uint16_t bytes = (uint16_t)bits / 8;
uint8_t remainder = (uint8_t)bits % 8;
uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t));
for (i = 0; i < bytes; i++)
{
buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg));
}
if (remainder)
{
temp = (uint8_t)faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder);
buffer[bytes] = temp;
}
return buffer;
}
#ifdef DRM
/* return the original data buffer */
void *faad_origbitbuffer(bitfile *ld)
{
return (void*)ld->start;
}
/* return the original data buffer size */
uint32_t faad_origbitbuffer_size(bitfile *ld)
{
return ld->buffer_size;
}
#endif
/* reversed bit reading routines, used for RVLC and HCR */
void faad_initbits_rev(bitfile *ld, void *buffer,
uint32_t bits_in_buffer)
{
uint32_t tmp;
int32_t index;
ld->buffer_size = bit2byte(bits_in_buffer);
index = (bits_in_buffer+31)/32 - 1;
ld->start = (uint32_t*)buffer + index - 2;
tmp = getdword((uint32_t*)buffer + index);
ld->bufa = tmp;
tmp = getdword((uint32_t*)buffer + index - 1);
ld->bufb = tmp;
ld->tail = (uint32_t*)buffer + index;
ld->bits_left = bits_in_buffer % 32;
if (ld->bits_left == 0)
ld->bits_left = 32;
ld->bytes_used = 0;
ld->no_more_reading = 0;
ld->error = 0;
}
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: bits.c,v 1.44 2007/11/01 12:33:29 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include "bits.h"
/* initialize buffer, call once before first getbits or showbits */
void faad_initbits(bitfile *ld, const void *_buffer, const uint32_t buffer_size)
{
uint32_t tmp;
if (ld == NULL)
return;
// useless
//memset(ld, 0, sizeof(bitfile));
if (buffer_size == 0 || _buffer == NULL)
{
ld->error = 1;
return;
}
ld->buffer = _buffer;
ld->buffer_size = buffer_size;
ld->bytes_left = buffer_size;
if (ld->bytes_left >= 4)
{
tmp = getdword((uint32_t*)ld->buffer);
ld->bytes_left -= 4;
} else {
tmp = getdword_n((uint32_t*)ld->buffer, ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufa = tmp;
if (ld->bytes_left >= 4)
{
tmp = getdword((uint32_t*)ld->buffer + 1);
ld->bytes_left -= 4;
} else {
tmp = getdword_n((uint32_t*)ld->buffer + 1, ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufb = tmp;
ld->start = (uint32_t*)ld->buffer;
ld->tail = ((uint32_t*)ld->buffer + 2);
ld->bits_left = 32;
ld->error = 0;
}
void faad_endbits(bitfile *ld)
{
// void
}
uint32_t faad_get_processed_bits(bitfile *ld)
{
return (uint32_t)(8 * (4*(ld->tail - ld->start) - 4) - (ld->bits_left));
}
uint8_t faad_byte_align(bitfile *ld)
{
int remainder = (32 - ld->bits_left) & 0x7;
if (remainder)
{
faad_flushbits(ld, 8 - remainder);
return (uint8_t)(8 - remainder);
}
return 0;
}
void faad_flushbits_ex(bitfile *ld, uint32_t bits)
{
uint32_t tmp;
ld->bufa = ld->bufb;
if (ld->bytes_left >= 4)
{
tmp = getdword(ld->tail);
ld->bytes_left -= 4;
} else {
tmp = getdword_n(ld->tail, ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufb = tmp;
ld->tail++;
ld->bits_left += (32 - bits);
//ld->bytes_left -= 4;
// if (ld->bytes_left == 0)
// ld->no_more_reading = 1;
// if (ld->bytes_left < 0)
// ld->error = 1;
}
/* rewind to beginning */
void faad_rewindbits(bitfile *ld)
{
uint32_t tmp;
ld->bytes_left = ld->buffer_size;
if (ld->bytes_left >= 4)
{
tmp = getdword((uint32_t*)&ld->start[0]);
ld->bytes_left -= 4;
} else {
tmp = getdword_n((uint32_t*)&ld->start[0], ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufa = tmp;
if (ld->bytes_left >= 4)
{
tmp = getdword((uint32_t*)&ld->start[1]);
ld->bytes_left -= 4;
} else {
tmp = getdword_n((uint32_t*)&ld->start[1], ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufb = tmp;
ld->bits_left = 32;
ld->tail = &ld->start[2];
}
/* reset to a certain point */
void faad_resetbits(bitfile *ld, int bits)
{
uint32_t tmp;
int words = bits >> 5;
int remainder = bits & 0x1F;
ld->bytes_left = ld->buffer_size - words*4;
if (ld->bytes_left >= 4)
{
tmp = getdword(&ld->start[words]);
ld->bytes_left -= 4;
} else {
tmp = getdword_n(&ld->start[words], ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufa = tmp;
if (ld->bytes_left >= 4)
{
tmp = getdword(&ld->start[words+1]);
ld->bytes_left -= 4;
} else {
tmp = getdword_n(&ld->start[words+1], ld->bytes_left);
ld->bytes_left = 0;
}
ld->bufb = tmp;
ld->bits_left = 32 - remainder;
ld->tail = &ld->start[words+2];
/* recheck for reading too many bytes */
ld->error = 0;
// if (ld->bytes_left == 0)
// ld->no_more_reading = 1;
// if (ld->bytes_left < 0)
// ld->error = 1;
}
uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
DEBUGDEC)
{
int i;
unsigned int temp;
int bytes = bits >> 3;
int remainder = bits & 0x7;
uint8_t *buffer = (uint8_t*)faad_malloc((bytes+1)*sizeof(uint8_t));
for (i = 0; i < bytes; i++)
{
buffer[i] = (uint8_t)faad_getbits(ld, 8 DEBUGVAR(print,var,dbg));
}
if (remainder)
{
temp = faad_getbits(ld, remainder DEBUGVAR(print,var,dbg)) << (8-remainder);
buffer[bytes] = (uint8_t)temp;
}
return buffer;
}
#ifdef DRM
/* return the original data buffer */
void *faad_origbitbuffer(bitfile *ld)
{
return (void*)ld->start;
}
/* return the original data buffer size */
uint32_t faad_origbitbuffer_size(bitfile *ld)
{
return ld->buffer_size;
}
#endif
/* reversed bit reading routines, used for RVLC and HCR */
void faad_initbits_rev(bitfile *ld, void *buffer,
uint32_t bits_in_buffer)
{
uint32_t tmp;
int32_t index;
ld->buffer_size = bit2byte(bits_in_buffer);
index = (bits_in_buffer+31)/32 - 1;
ld->start = (uint32_t*)buffer + index - 2;
tmp = getdword((uint32_t*)buffer + index);
ld->bufa = tmp;
tmp = getdword((uint32_t*)buffer + index - 1);
ld->bufb = tmp;
ld->tail = (uint32_t*)buffer + index;
ld->bits_left = bits_in_buffer % 32;
if (ld->bits_left == 0)
ld->bits_left = 32;
ld->bytes_left = ld->buffer_size;
ld->error = 0;
}
/* EOF */

829
src/contrib/aacdecoder/libfaad/bits.h Normal file → Executable file
View File

@ -1,377 +1,452 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: bits.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __BITS_H__
#define __BITS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "common.h"
#include "analysis.h"
#ifdef ANALYSIS
#include <stdio.h>
#endif
#define BYTE_NUMBIT 8
#define bit2byte(a) ((a+7)/BYTE_NUMBIT)
typedef struct _bitfile
{
/* bit input */
uint32_t bufa;
uint32_t bufb;
uint32_t bits_left;
uint32_t buffer_size; /* size of the buffer in bytes */
uint32_t bytes_used;
uint8_t no_more_reading;
uint8_t error;
uint32_t *tail;
uint32_t *start;
void *buffer;
} bitfile;
#define BSWAP(a) \
((a) = ( ((a)&0xff)<<24) | (((a)&0xff00)<<8) | (((a)>>8)&0xff00) | (((a)>>24)&0xff))
static uint32_t bitmask[] = {
0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF,
0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF,
0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF,
0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF,
0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF
/* added bitmask 32, correct?!?!?! */
, 0xFFFFFFFF
};
void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size);
void faad_endbits(bitfile *ld);
void faad_initbits_rev(bitfile *ld, void *buffer,
uint32_t bits_in_buffer);
uint8_t faad_byte_align(bitfile *ld);
uint32_t faad_get_processed_bits(bitfile *ld);
void faad_flushbits_ex(bitfile *ld, uint32_t bits);
void faad_rewindbits(bitfile *ld);
uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
DEBUGDEC);
#ifdef DRM
void *faad_origbitbuffer(bitfile *ld);
uint32_t faad_origbitbuffer_size(bitfile *ld);
#endif
/* circumvent memory alignment errors on ARM */
static INLINE uint32_t getdword(void *mem)
{
#ifdef ARM
uint32_t tmp;
#ifndef ARCH_IS_BIG_ENDIAN
((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3];
((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
#else
((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3];
#endif
return tmp;
#else
uint32_t tmp;
tmp = *(uint32_t*)mem;
#ifndef ARCH_IS_BIG_ENDIAN
BSWAP(tmp);
#endif
return tmp;
#endif
}
static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits)
{
if (bits <= ld->bits_left)
{
return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits];
}
bits -= ld->bits_left;
return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits));
}
static INLINE void faad_flushbits(bitfile *ld, uint32_t bits)
{
/* do nothing if error */
if (ld->error != 0)
return;
if (bits < ld->bits_left)
{
ld->bits_left -= bits;
} else {
faad_flushbits_ex(ld, bits);
}
}
/* return next n bits (right adjusted) */
static INLINE uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC)
{
uint32_t ret;
if (ld->no_more_reading || n == 0)
return 0;
ret = faad_showbits(ld, n);
faad_flushbits(ld, n);
#ifdef ANALYSIS
if (print)
fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
#endif
return ret;
}
static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC)
{
uint8_t r;
if (ld->bits_left > 0)
{
ld->bits_left--;
r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
return r;
}
/* bits_left == 0 */
#if 0
r = (uint8_t)(ld->bufb >> 31);
faad_flushbits_ex(ld, 1);
#else
r = (uint8_t)faad_getbits(ld, 1);
#endif
return r;
}
/* reversed bitreading routines */
static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits)
{
uint8_t i;
uint32_t B = 0;
if (bits <= ld->bits_left)
{
for (i = 0; i < bits; i++)
{
if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
B |= (1 << (bits - i - 1));
}
return B;
} else {
for (i = 0; i < ld->bits_left; i++)
{
if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
B |= (1 << (bits - i - 1));
}
for (i = 0; i < bits - ld->bits_left; i++)
{
if (ld->bufb & (1 << (i + (32-ld->bits_left))))
B |= (1 << (bits - ld->bits_left - i - 1));
}
return B;
}
}
static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits)
{
/* do nothing if error */
if (ld->error != 0)
return;
if (bits < ld->bits_left)
{
ld->bits_left -= bits;
} else {
uint32_t tmp;
ld->bufa = ld->bufb;
tmp = getdword(ld->start);
ld->bufb = tmp;
ld->start--;
ld->bits_left += (32 - bits);
ld->bytes_used += 4;
if (ld->bytes_used == ld->buffer_size)
ld->no_more_reading = 1;
if (ld->bytes_used > ld->buffer_size)
ld->error = 1;
}
}
static INLINE uint32_t faad_getbits_rev(bitfile *ld, uint32_t n
DEBUGDEC)
{
uint32_t ret;
if (ld->no_more_reading)
return 0;
if (n == 0)
return 0;
ret = faad_showbits_rev(ld, n);
faad_flushbits_rev(ld, n);
#ifdef ANALYSIS
if (print)
fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
#endif
return ret;
}
#ifdef DRM
static uint8_t faad_check_CRC(bitfile *ld, uint16_t len)
{
uint8_t CRC;
uint16_t r=255; /* Initialize to all ones */
/* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */
#define GPOLY 0435
faad_rewindbits(ld);
CRC = (uint8_t) ~faad_getbits(ld, 8
DEBUGVAR(1,999,"faad_check_CRC(): CRC")); /* CRC is stored inverted */
for (; len>0; len--)
{
r = ( (r << 1) ^ (( ( faad_get1bit(ld
DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF;
}
if (r != CRC)
{
return 8;
} else {
return 0;
}
}
static uint8_t tabFlipbits[256] = {
0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,
8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,
4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,
12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,
2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,
10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,
6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,
14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,
1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,
9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,
5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,
13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,
3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,
11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,
7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,
15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255
};
#endif
#ifdef ERROR_RESILIENCE
/* Modified bit reading functions for HCR */
typedef struct
{
/* bit input */
uint32_t bufa;
uint32_t bufb;
int8_t len;
} bits_t;
static INLINE uint32_t showbits_hcr(bits_t *ld, uint8_t bits)
{
if (bits == 0) return 0;
if (ld->len <= 32)
{
/* huffman_spectral_data_2 needs to read more than may be available, bits maybe
> ld->len, deliver 0 than */
if (ld->len >= bits)
return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits)));
else
return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));
} else {
if ((ld->len - bits) < 32)
{
return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) |
(ld->bufa >> (ld->len - bits));
} else {
return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits)));
}
}
}
/* return 1 if position is outside of buffer, 0 otherwise */
static INLINE int8_t flushbits_hcr( bits_t *ld, uint8_t bits)
{
ld->len -= bits;
if (ld->len <0)
{
ld->len = 0;
return 1;
} else {
return 0;
}
}
static INLINE int8_t getbits_hcr(bits_t *ld, uint8_t n, uint32_t *result)
{
*result = showbits_hcr(ld, n);
return flushbits_hcr(ld, n);
}
static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result)
{
uint32_t res;
int8_t ret;
ret = getbits_hcr(ld, 1, &res);
*result = (int8_t)(res & 1);
return ret;
}
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: bits.h,v 1.45 2007/11/01 12:33:29 menno Exp $
**/
#ifndef __BITS_H__
#define __BITS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "analysis.h"
#ifdef ANALYSIS
#include <stdio.h>
#endif
#define BYTE_NUMBIT 8
#define BYTE_NUMBIT_LD 3
//#define bit2byte(a) ((a+7)/BYTE_NUMBIT)
#define bit2byte(a) ((a+7)>>BYTE_NUMBIT_LD)
typedef struct _bitfile
{
/* bit input */
uint32_t bufa;
uint32_t bufb;
uint32_t bits_left;
uint32_t buffer_size; /* size of the buffer in bytes */
uint32_t bytes_left;
uint8_t error;
uint32_t *tail;
uint32_t *start;
const void *buffer;
} bitfile;
#if 0
static uint32_t const bitmask[] = {
0x0, 0x1, 0x3, 0x7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, 0x1FF,
0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF,
0x1FFFF, 0x3FFFF, 0x7FFFF, 0xFFFFF, 0x1FFFFF, 0x3FFFFF,
0x7FFFFF, 0xFFFFFF, 0x1FFFFFF, 0x3FFFFFF, 0x7FFFFFF,
0xFFFFFFF, 0x1FFFFFFF, 0x3FFFFFFF, 0x7FFFFFFF
/* added bitmask 32, correct?!?!?! */
, 0xFFFFFFFF
};
#endif
void faad_initbits(bitfile *ld, const void *buffer, const uint32_t buffer_size);
void faad_endbits(bitfile *ld);
void faad_initbits_rev(bitfile *ld, void *buffer,
uint32_t bits_in_buffer);
uint8_t faad_byte_align(bitfile *ld);
uint32_t faad_get_processed_bits(bitfile *ld);
void faad_flushbits_ex(bitfile *ld, uint32_t bits);
void faad_rewindbits(bitfile *ld);
void faad_resetbits(bitfile *ld, int bits);
uint8_t *faad_getbitbuffer(bitfile *ld, uint32_t bits
DEBUGDEC);
#ifdef DRM
void *faad_origbitbuffer(bitfile *ld);
uint32_t faad_origbitbuffer_size(bitfile *ld);
#endif
/* circumvent memory alignment errors on ARM */
static INLINE uint32_t getdword(void *mem)
{
uint32_t tmp;
#ifndef ARCH_IS_BIG_ENDIAN
((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[3];
((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
#else
((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[3];
#endif
return tmp;
}
/* reads only n bytes from the stream instead of the standard 4 */
static /*INLINE*/ uint32_t getdword_n(void *mem, int n)
{
uint32_t tmp = 0;
#ifndef ARCH_IS_BIG_ENDIAN
switch (n)
{
case 3:
((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[2];
case 2:
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[1];
case 1:
((uint8_t*)&tmp)[3] = ((uint8_t*)mem)[0];
default:
break;
}
#else
switch (n)
{
case 3:
((uint8_t*)&tmp)[2] = ((uint8_t*)mem)[2];
case 2:
((uint8_t*)&tmp)[1] = ((uint8_t*)mem)[1];
case 1:
((uint8_t*)&tmp)[0] = ((uint8_t*)mem)[0];
default:
break;
}
#endif
return tmp;
}
static INLINE uint32_t faad_showbits(bitfile *ld, uint32_t bits)
{
if (bits <= ld->bits_left)
{
//return (ld->bufa >> (ld->bits_left - bits)) & bitmask[bits];
return (ld->bufa << (32 - ld->bits_left)) >> (32 - bits);
}
bits -= ld->bits_left;
//return ((ld->bufa & bitmask[ld->bits_left]) << bits) | (ld->bufb >> (32 - bits));
return ((ld->bufa & ((1<<ld->bits_left)-1)) << bits) | (ld->bufb >> (32 - bits));
}
static INLINE void faad_flushbits(bitfile *ld, uint32_t bits)
{
/* do nothing if error */
if (ld->error != 0)
return;
if (bits < ld->bits_left)
{
ld->bits_left -= bits;
} else {
faad_flushbits_ex(ld, bits);
}
}
/* return next n bits (right adjusted) */
static /*INLINE*/ uint32_t faad_getbits(bitfile *ld, uint32_t n DEBUGDEC)
{
uint32_t ret;
if (n == 0)
return 0;
ret = faad_showbits(ld, n);
faad_flushbits(ld, n);
#ifdef ANALYSIS
if (print)
fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
#endif
return ret;
}
static INLINE uint8_t faad_get1bit(bitfile *ld DEBUGDEC)
{
uint8_t r;
if (ld->bits_left > 0)
{
ld->bits_left--;
r = (uint8_t)((ld->bufa >> ld->bits_left) & 1);
return r;
}
/* bits_left == 0 */
#if 0
r = (uint8_t)(ld->bufb >> 31);
faad_flushbits_ex(ld, 1);
#else
r = (uint8_t)faad_getbits(ld, 1);
#endif
return r;
}
/* reversed bitreading routines */
static INLINE uint32_t faad_showbits_rev(bitfile *ld, uint32_t bits)
{
uint8_t i;
uint32_t B = 0;
if (bits <= ld->bits_left)
{
for (i = 0; i < bits; i++)
{
if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
B |= (1 << (bits - i - 1));
}
return B;
} else {
for (i = 0; i < ld->bits_left; i++)
{
if (ld->bufa & (1 << (i + (32 - ld->bits_left))))
B |= (1 << (bits - i - 1));
}
for (i = 0; i < bits - ld->bits_left; i++)
{
if (ld->bufb & (1 << (i + (32-ld->bits_left))))
B |= (1 << (bits - ld->bits_left - i - 1));
}
return B;
}
}
static INLINE void faad_flushbits_rev(bitfile *ld, uint32_t bits)
{
/* do nothing if error */
if (ld->error != 0)
return;
if (bits < ld->bits_left)
{
ld->bits_left -= bits;
} else {
uint32_t tmp;
ld->bufa = ld->bufb;
tmp = getdword(ld->start);
ld->bufb = tmp;
ld->start--;
ld->bits_left += (32 - bits);
if (ld->bytes_left < 4)
{
ld->error = 1;
ld->bytes_left = 0;
} else {
ld->bytes_left -= 4;
}
// if (ld->bytes_left == 0)
// ld->no_more_reading = 1;
}
}
static /*INLINE*/ uint32_t faad_getbits_rev(bitfile *ld, uint32_t n
DEBUGDEC)
{
uint32_t ret;
if (n == 0)
return 0;
ret = faad_showbits_rev(ld, n);
faad_flushbits_rev(ld, n);
#ifdef ANALYSIS
if (print)
fprintf(stdout, "%4d %2d bits, val: %4d, variable: %d %s\n", dbg_count++, n, ret, var, dbg);
#endif
return ret;
}
#ifdef DRM
/* CRC lookup table for G8 polynome in DRM standard */
static const uint8_t crc_table_G8[256] = {
0x0, 0x1d, 0x3a, 0x27, 0x74, 0x69, 0x4e, 0x53,
0xe8, 0xf5, 0xd2, 0xcf, 0x9c, 0x81, 0xa6, 0xbb,
0xcd, 0xd0, 0xf7, 0xea, 0xb9, 0xa4, 0x83, 0x9e,
0x25, 0x38, 0x1f, 0x2, 0x51, 0x4c, 0x6b, 0x76,
0x87, 0x9a, 0xbd, 0xa0, 0xf3, 0xee, 0xc9, 0xd4,
0x6f, 0x72, 0x55, 0x48, 0x1b, 0x6, 0x21, 0x3c,
0x4a, 0x57, 0x70, 0x6d, 0x3e, 0x23, 0x4, 0x19,
0xa2, 0xbf, 0x98, 0x85, 0xd6, 0xcb, 0xec, 0xf1,
0x13, 0xe, 0x29, 0x34, 0x67, 0x7a, 0x5d, 0x40,
0xfb, 0xe6, 0xc1, 0xdc, 0x8f, 0x92, 0xb5, 0xa8,
0xde, 0xc3, 0xe4, 0xf9, 0xaa, 0xb7, 0x90, 0x8d,
0x36, 0x2b, 0xc, 0x11, 0x42, 0x5f, 0x78, 0x65,
0x94, 0x89, 0xae, 0xb3, 0xe0, 0xfd, 0xda, 0xc7,
0x7c, 0x61, 0x46, 0x5b, 0x8, 0x15, 0x32, 0x2f,
0x59, 0x44, 0x63, 0x7e, 0x2d, 0x30, 0x17, 0xa,
0xb1, 0xac, 0x8b, 0x96, 0xc5, 0xd8, 0xff, 0xe2,
0x26, 0x3b, 0x1c, 0x1, 0x52, 0x4f, 0x68, 0x75,
0xce, 0xd3, 0xf4, 0xe9, 0xba, 0xa7, 0x80, 0x9d,
0xeb, 0xf6, 0xd1, 0xcc, 0x9f, 0x82, 0xa5, 0xb8,
0x3, 0x1e, 0x39, 0x24, 0x77, 0x6a, 0x4d, 0x50,
0xa1, 0xbc, 0x9b, 0x86, 0xd5, 0xc8, 0xef, 0xf2,
0x49, 0x54, 0x73, 0x6e, 0x3d, 0x20, 0x7, 0x1a,
0x6c, 0x71, 0x56, 0x4b, 0x18, 0x5, 0x22, 0x3f,
0x84, 0x99, 0xbe, 0xa3, 0xf0, 0xed, 0xca, 0xd7,
0x35, 0x28, 0xf, 0x12, 0x41, 0x5c, 0x7b, 0x66,
0xdd, 0xc0, 0xe7, 0xfa, 0xa9, 0xb4, 0x93, 0x8e,
0xf8, 0xe5, 0xc2, 0xdf, 0x8c, 0x91, 0xb6, 0xab,
0x10, 0xd, 0x2a, 0x37, 0x64, 0x79, 0x5e, 0x43,
0xb2, 0xaf, 0x88, 0x95, 0xc6, 0xdb, 0xfc, 0xe1,
0x5a, 0x47, 0x60, 0x7d, 0x2e, 0x33, 0x14, 0x9,
0x7f, 0x62, 0x45, 0x58, 0xb, 0x16, 0x31, 0x2c,
0x97, 0x8a, 0xad, 0xb0, 0xe3, 0xfe, 0xd9, 0xc4,
};
static uint8_t faad_check_CRC(bitfile *ld, uint16_t len)
{
int bytes, rem;
unsigned int CRC;
unsigned int r=255; /* Initialize to all ones */
/* CRC polynome used x^8 + x^4 + x^3 + x^2 +1 */
#define GPOLY 0435
faad_rewindbits(ld);
CRC = (unsigned int) ~faad_getbits(ld, 8
DEBUGVAR(1,999,"faad_check_CRC(): CRC")) & 0xFF; /* CRC is stored inverted */
bytes = len >> 3;
rem = len & 0x7;
for (; bytes > 0; bytes--)
{
r = crc_table_G8[( r ^ faad_getbits(ld, 8 DEBUGVAR(1,998,"")) ) & 0xFF];
}
for (; rem > 0; rem--)
{
r = ( (r << 1) ^ (( ( faad_get1bit(ld
DEBUGVAR(1,998,"")) & 1) ^ ((r >> 7) & 1)) * GPOLY )) & 0xFF;
}
if (r != CRC)
// if (0)
{
return 28;
} else {
return 0;
}
}
static uint8_t tabFlipbits[256] = {
0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,
8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,
4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,
12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,
2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,
10,138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,
6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,
14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,
1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,
9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,
5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,
13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,
3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,
11,139,75,203,43,171,107,235,27,155,91,219,59,187,123,251,
7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,
15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255
};
#endif
#ifdef ERROR_RESILIENCE
/* Modified bit reading functions for HCR */
typedef struct
{
/* bit input */
uint32_t bufa;
uint32_t bufb;
int8_t len;
} bits_t;
static INLINE uint32_t showbits_hcr(bits_t *ld, uint8_t bits)
{
if (bits == 0) return 0;
if (ld->len <= 32)
{
/* huffman_spectral_data_2 needs to read more than may be available, bits maybe
> ld->len, deliver 0 than */
if (ld->len >= bits)
return ((ld->bufa >> (ld->len - bits)) & (0xFFFFFFFF >> (32 - bits)));
else
return ((ld->bufa << (bits - ld->len)) & (0xFFFFFFFF >> (32 - bits)));
} else {
if ((ld->len - bits) < 32)
{
return ( (ld->bufb & (0xFFFFFFFF >> (64 - ld->len))) << (bits - ld->len + 32)) |
(ld->bufa >> (ld->len - bits));
} else {
return ((ld->bufb >> (ld->len - bits - 32)) & (0xFFFFFFFF >> (32 - bits)));
}
}
}
/* return 1 if position is outside of buffer, 0 otherwise */
static INLINE int8_t flushbits_hcr( bits_t *ld, uint8_t bits)
{
ld->len -= bits;
if (ld->len <0)
{
ld->len = 0;
return 1;
} else {
return 0;
}
}
static INLINE int8_t getbits_hcr(bits_t *ld, uint8_t n, uint32_t *result)
{
*result = showbits_hcr(ld, n);
return flushbits_hcr(ld, n);
}
static INLINE int8_t get1bit_hcr(bits_t *ld, uint8_t *result)
{
uint32_t res;
int8_t ret;
ret = getbits_hcr(ld, 1, &res);
*result = (int8_t)(res & 1);
return ret;
}
#endif
#ifdef __cplusplus
}
#endif
#endif

2411
src/contrib/aacdecoder/libfaad/cfft.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

113
src/contrib/aacdecoder/libfaad/cfft.h Normal file → Executable file
View File

@ -1,57 +1,56 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: cfft.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __CFFT_H__
#define __CFFT_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
uint16_t n;
uint16_t ifac[15];
complex_t *work;
complex_t *tab;
} cfft_info;
void cfftf(cfft_info *cfft, complex_t *c);
void cfftb(cfft_info *cfft, complex_t *c);
cfft_info *cffti(uint16_t n);
void cfftu(cfft_info *cfft);
#ifdef USE_SSE
void cfftb_sse(cfft_info *cfft, complex_t *c);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: cfft.h,v 1.24 2007/11/01 12:33:29 menno Exp $
**/
#ifndef __CFFT_H__
#define __CFFT_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
uint16_t n;
uint16_t ifac[15];
complex_t *work;
complex_t *tab;
} cfft_info;
void cfftf(cfft_info *cfft, complex_t *c);
void cfftb(cfft_info *cfft, complex_t *c);
cfft_info *cffti(uint16_t n);
void cfftu(cfft_info *cfft);
#ifdef __cplusplus
}
#endif
#endif

3511
src/contrib/aacdecoder/libfaad/cfft_tab.h Normal file → Executable file

File diff suppressed because it is too large Load Diff

287
src/contrib/aacdecoder/libfaad/codebook/hcb.h Normal file → Executable file
View File

@ -1,142 +1,145 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
#ifndef __HCB_H__
#define __HCB_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* Optimal huffman decoding for AAC taken from:
* "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
* VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
* AES paper 5436
*
* 2 methods are used for huffman decoding:
* - binary search
* - 2-step table lookup
*
* The choice of the "optimal" method is based on the fact that if the
* memory size for the Two-step is exorbitantly high then the decision
* is Binary search for that codebook. However, for marginally more memory
* size, if Twostep outperforms even the best case of Binary then the
* decision is Two-step for that codebook.
*
* The following methods are used for the different tables.
* codebook "optimal" method
* HCB_1 2-Step
* HCB_2 2-Step
* HCB_3 Binary
* HCB_4 2-Step
* HCB_5 Binary
* HCB_6 2-Step
* HCB_7 Binary
* HCB_8 2-Step
* HCB_9 Binary
* HCB_10 2-Step
* HCB_11 2-Step
* HCB_SF Binary
*
*/
#define ZERO_HCB 0
#define FIRST_PAIR_HCB 5
#define ESC_HCB 11
#define QUAD_LEN 4
#define PAIR_LEN 2
#define NOISE_HCB 13
#define INTENSITY_HCB2 14
#define INTENSITY_HCB 15
/* 1st step table */
typedef struct
{
uint8_t offset;
uint8_t extra_bits;
} hcb;
/* 2nd step table with quadruple data */
typedef struct
{
uint8_t bits;
int8_t x;
int8_t y;
} hcb_2_pair;
typedef struct
{
uint8_t bits;
int8_t x;
int8_t y;
int8_t v;
int8_t w;
} hcb_2_quad;
/* binary search table */
typedef struct
{
uint8_t is_leaf;
int8_t data[4];
} hcb_bin_quad;
typedef struct
{
uint8_t is_leaf;
int8_t data[2];
} hcb_bin_pair;
hcb *hcb_table[];
hcb_2_quad *hcb_2_quad_table[];
hcb_2_pair *hcb_2_pair_table[];
hcb_bin_pair *hcb_bin_table[];
uint8_t hcbN[];
uint8_t unsigned_cb[];
int hcb_2_quad_table_size[];
int hcb_2_pair_table_size[];
int hcb_bin_table_size[];
#include "codebook/hcb_1.h"
#include "codebook/hcb_2.h"
#include "codebook/hcb_3.h"
#include "codebook/hcb_4.h"
#include "codebook/hcb_5.h"
#include "codebook/hcb_6.h"
#include "codebook/hcb_7.h"
#include "codebook/hcb_8.h"
#include "codebook/hcb_9.h"
#include "codebook/hcb_10.h"
#include "codebook/hcb_11.h"
#include "codebook/hcb_sf.h"
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb.h,v 1.8 2007/11/01 12:34:10 menno Exp $
**/
#ifndef __HCB_H__
#define __HCB_H__
#ifdef __cplusplus
extern "C" {
#endif
/*
* Optimal huffman decoding for AAC taken from:
* "SELECTING AN OPTIMAL HUFFMAN DECODER FOR AAC" by
* VLADIMIR Z. MESAROVIC , RAGHUNATH RAO, MIROSLAV V. DOKIC, and SACHIN DEO
* AES paper 5436
*
* 2 methods are used for huffman decoding:
* - binary search
* - 2-step table lookup
*
* The choice of the "optimal" method is based on the fact that if the
* memory size for the Two-step is exorbitantly high then the decision
* is Binary search for that codebook. However, for marginally more memory
* size, if Twostep outperforms even the best case of Binary then the
* decision is Two-step for that codebook.
*
* The following methods are used for the different tables.
* codebook "optimal" method
* HCB_1 2-Step
* HCB_2 2-Step
* HCB_3 Binary
* HCB_4 2-Step
* HCB_5 Binary
* HCB_6 2-Step
* HCB_7 Binary
* HCB_8 2-Step
* HCB_9 Binary
* HCB_10 2-Step
* HCB_11 2-Step
* HCB_SF Binary
*
*/
#define ZERO_HCB 0
#define FIRST_PAIR_HCB 5
#define ESC_HCB 11
#define QUAD_LEN 4
#define PAIR_LEN 2
#define NOISE_HCB 13
#define INTENSITY_HCB2 14
#define INTENSITY_HCB 15
/* 1st step table */
typedef struct
{
uint8_t offset;
uint8_t extra_bits;
} hcb;
/* 2nd step table with quadruple data */
typedef struct
{
uint8_t bits;
int8_t x;
int8_t y;
} hcb_2_pair;
typedef struct
{
uint8_t bits;
int8_t x;
int8_t y;
int8_t v;
int8_t w;
} hcb_2_quad;
/* binary search table */
typedef struct
{
uint8_t is_leaf;
int8_t data[4];
} hcb_bin_quad;
typedef struct
{
uint8_t is_leaf;
int8_t data[2];
} hcb_bin_pair;
hcb *hcb_table[];
hcb_2_quad *hcb_2_quad_table[];
hcb_2_pair *hcb_2_pair_table[];
hcb_bin_pair *hcb_bin_table[];
uint8_t hcbN[];
uint8_t unsigned_cb[];
int hcb_2_quad_table_size[];
int hcb_2_pair_table_size[];
int hcb_bin_table_size[];
#include "codebook/hcb_1.h"
#include "codebook/hcb_2.h"
#include "codebook/hcb_3.h"
#include "codebook/hcb_4.h"
#include "codebook/hcb_5.h"
#include "codebook/hcb_6.h"
#include "codebook/hcb_7.h"
#include "codebook/hcb_8.h"
#include "codebook/hcb_9.h"
#include "codebook/hcb_10.h"
#include "codebook/hcb_11.h"
#include "codebook/hcb_sf.h"
#ifdef __cplusplus
}
#endif
#endif

369
src/contrib/aacdecoder/libfaad/codebook/hcb_1.h Normal file → Executable file
View File

@ -1,183 +1,186 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_1.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* 2-step huffman table HCB_1 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb1_1[] = {
{ /* 00000 */ 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 },
{ /* 10000 */ 1, 0 },
{ /* 10001 */ 2, 0 },
{ /* 10010 */ 3, 0 },
{ /* 10011 */ 4, 0 },
{ /* 10100 */ 5, 0 },
{ /* 10101 */ 6, 0 },
{ /* 10110 */ 7, 0 },
{ /* 10111 */ 8, 0 },
/* 7 bit codewords */
{ /* 11000 */ 9, 2 },
{ /* 11001 */ 13, 2 },
{ /* 11010 */ 17, 2 },
{ /* 11011 */ 21, 2 },
{ /* 11100 */ 25, 2 },
{ /* 11101 */ 29, 2 },
/* 9 bit codewords */
{ /* 11110 */ 33, 4 },
/* 9/10/11 bit codewords */
{ /* 11111 */ 49, 6 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_quad hcb1_2[] = {
/* 1 bit codeword */
{ 1, 0, 0, 0, 0 },
/* 5 bit codewords */
{ 5, 1, 0, 0, 0 },
{ 5, -1, 0, 0, 0 },
{ 5, 0, 0, 0, -1 },
{ 5, 0, 1, 0, 0 },
{ 5, 0, 0, 0, 1 },
{ 5, 0, 0, -1, 0 },
{ 5, 0, 0, 1, 0 },
{ 5, 0, -1, 0, 0 },
/* 7 bit codewords */
/* first 5 bits: 11000 */
{ 7, 1, -1, 0, 0 },
{ 7, -1, 1, 0, 0 },
{ 7, 0, 0, -1, 1 },
{ 7, 0, 1, -1, 0 },
/* first 5 bits: 11001 */
{ 7, 0, -1, 1, 0 },
{ 7, 0, 0, 1, -1 },
{ 7, 1, 1, 0, 0 },
{ 7, 0, 0, -1, -1 },
/* first 5 bits: 11010 */
{ 7, -1, -1, 0, 0 },
{ 7, 0, -1, -1, 0 },
{ 7, 1, 0, -1, 0 },
{ 7, 0, 1, 0, -1 },
/* first 5 bits: 11011 */
{ 7, -1, 0, 1, 0 },
{ 7, 0, 0, 1, 1 },
{ 7, 1, 0, 1, 0 },
{ 7, 0, -1, 0, 1 },
/* first 5 bits: 11100 */
{ 7, 0, 1, 1, 0 },
{ 7, 0, 1, 0, 1 },
{ 7, -1, 0, -1, 0 },
{ 7, 1, 0, 0, 1 },
/* first 5 bits: 11101 */
{ 7, -1, 0, 0, -1 },
{ 7, 1, 0, 0, -1 },
{ 7, -1, 0, 0, 1 },
{ 7, 0, -1, 0, -1 },
/* 9 bit codeword */
/* first 5 bits: 11110 */
{ 9, 1, 1, -1, 0 },
{ 9, -1, 1, -1, 0 },
{ 9, 1, -1, 1, 0 },
{ 9, 0, 1, 1, -1 },
{ 9, 0, 1, -1, 1 },
{ 9, 0, -1, 1, 1 },
{ 9, 0, -1, 1, -1 },
{ 9, 1, -1, -1, 0 },
{ 9, 1, 0, -1, 1 },
{ 9, 0, 1, -1, -1 },
{ 9, -1, 1, 1, 0 },
{ 9, -1, 0, 1, -1 },
{ 9, -1, -1, 1, 0 },
{ 9, 0, -1, -1, 1 },
{ 9, 1, -1, 0, 1 },
{ 9, 1, -1, 0, -1 },
/* 9/10/11 bit codewords */
/* first 5 bits: 11111 */
/* 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword */
{ 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 },
{ 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 },
{ 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 },
{ 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 },
{ 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 },
{ 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 },
{ 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 },
{ 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 },
/* 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword */
{ 10, -1, -1, 0, 1 }, { 10, -1, -1, 0, 1 },
{ 10, -1, 0, -1, -1 }, { 10, -1, 0, -1, -1 },
{ 10, 1, 1, 0, -1 }, { 10, 1, 1, 0, -1 },
{ 10, 1, 0, -1, -1 }, { 10, 1, 0, -1, -1 },
{ 10, -1, 0, -1, 1 }, { 10, -1, 0, -1, 1 },
{ 10, -1, -1, 0, -1 }, { 10, -1, -1, 0, -1 },
{ 10, -1, 0, 1, 1 }, { 10, -1, 0, 1, 1 },
{ 10, 1, 0, 1, 1 }, { 10, 1, 0, 1, 1 },
/* 11 bit */
{ 11, 1, -1, 1, -1 },
{ 11, -1, 1, -1, 1 },
{ 11, -1, 1, 1, -1 },
{ 11, 1, -1, -1, 1 },
{ 11, 1, 1, 1, 1 },
{ 11, -1, -1, 1, 1 },
{ 11, 1, 1, -1, -1 },
{ 11, -1, -1, 1, -1 },
{ 11, -1, -1, -1, -1 },
{ 11, 1, 1, -1, 1 },
{ 11, 1, -1, 1, 1 },
{ 11, -1, 1, 1, 1 },
{ 11, -1, 1, -1, -1 },
{ 11, -1, -1, -1, 1 },
{ 11, 1, -1, -1, -1 },
{ 11, 1, 1, 1, -1 }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_1.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* 2-step huffman table HCB_1 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb1_1[] = {
{ /* 00000 */ 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 },
{ /* 10000 */ 1, 0 },
{ /* 10001 */ 2, 0 },
{ /* 10010 */ 3, 0 },
{ /* 10011 */ 4, 0 },
{ /* 10100 */ 5, 0 },
{ /* 10101 */ 6, 0 },
{ /* 10110 */ 7, 0 },
{ /* 10111 */ 8, 0 },
/* 7 bit codewords */
{ /* 11000 */ 9, 2 },
{ /* 11001 */ 13, 2 },
{ /* 11010 */ 17, 2 },
{ /* 11011 */ 21, 2 },
{ /* 11100 */ 25, 2 },
{ /* 11101 */ 29, 2 },
/* 9 bit codewords */
{ /* 11110 */ 33, 4 },
/* 9/10/11 bit codewords */
{ /* 11111 */ 49, 6 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_quad hcb1_2[] = {
/* 1 bit codeword */
{ 1, 0, 0, 0, 0 },
/* 5 bit codewords */
{ 5, 1, 0, 0, 0 },
{ 5, -1, 0, 0, 0 },
{ 5, 0, 0, 0, -1 },
{ 5, 0, 1, 0, 0 },
{ 5, 0, 0, 0, 1 },
{ 5, 0, 0, -1, 0 },
{ 5, 0, 0, 1, 0 },
{ 5, 0, -1, 0, 0 },
/* 7 bit codewords */
/* first 5 bits: 11000 */
{ 7, 1, -1, 0, 0 },
{ 7, -1, 1, 0, 0 },
{ 7, 0, 0, -1, 1 },
{ 7, 0, 1, -1, 0 },
/* first 5 bits: 11001 */
{ 7, 0, -1, 1, 0 },
{ 7, 0, 0, 1, -1 },
{ 7, 1, 1, 0, 0 },
{ 7, 0, 0, -1, -1 },
/* first 5 bits: 11010 */
{ 7, -1, -1, 0, 0 },
{ 7, 0, -1, -1, 0 },
{ 7, 1, 0, -1, 0 },
{ 7, 0, 1, 0, -1 },
/* first 5 bits: 11011 */
{ 7, -1, 0, 1, 0 },
{ 7, 0, 0, 1, 1 },
{ 7, 1, 0, 1, 0 },
{ 7, 0, -1, 0, 1 },
/* first 5 bits: 11100 */
{ 7, 0, 1, 1, 0 },
{ 7, 0, 1, 0, 1 },
{ 7, -1, 0, -1, 0 },
{ 7, 1, 0, 0, 1 },
/* first 5 bits: 11101 */
{ 7, -1, 0, 0, -1 },
{ 7, 1, 0, 0, -1 },
{ 7, -1, 0, 0, 1 },
{ 7, 0, -1, 0, -1 },
/* 9 bit codeword */
/* first 5 bits: 11110 */
{ 9, 1, 1, -1, 0 },
{ 9, -1, 1, -1, 0 },
{ 9, 1, -1, 1, 0 },
{ 9, 0, 1, 1, -1 },
{ 9, 0, 1, -1, 1 },
{ 9, 0, -1, 1, 1 },
{ 9, 0, -1, 1, -1 },
{ 9, 1, -1, -1, 0 },
{ 9, 1, 0, -1, 1 },
{ 9, 0, 1, -1, -1 },
{ 9, -1, 1, 1, 0 },
{ 9, -1, 0, 1, -1 },
{ 9, -1, -1, 1, 0 },
{ 9, 0, -1, -1, 1 },
{ 9, 1, -1, 0, 1 },
{ 9, 1, -1, 0, -1 },
/* 9/10/11 bit codewords */
/* first 5 bits: 11111 */
/* 9 bit: reading 11 bits -> 2 too much so 4 entries for each codeword */
{ 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 }, { 9, -1, 1, 0, -1 },
{ 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 }, { 9, -1, -1, -1, 0 },
{ 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 }, { 9, 0, -1, -1, -1 },
{ 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 }, { 9, 0, 1, 1, 1 },
{ 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 }, { 9, 1, 0, 1, -1 },
{ 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 }, { 9, 1, 1, 0, 1 },
{ 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 }, { 9, -1, 1, 0, 1 },
{ 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 }, { 9, 1, 1, 1, 0 },
/* 10 bit: reading 11 bits -> 1 too much so 2 entries for each codeword */
{ 10, -1, -1, 0, 1 }, { 10, -1, -1, 0, 1 },
{ 10, -1, 0, -1, -1 }, { 10, -1, 0, -1, -1 },
{ 10, 1, 1, 0, -1 }, { 10, 1, 1, 0, -1 },
{ 10, 1, 0, -1, -1 }, { 10, 1, 0, -1, -1 },
{ 10, -1, 0, -1, 1 }, { 10, -1, 0, -1, 1 },
{ 10, -1, -1, 0, -1 }, { 10, -1, -1, 0, -1 },
{ 10, -1, 0, 1, 1 }, { 10, -1, 0, 1, 1 },
{ 10, 1, 0, 1, 1 }, { 10, 1, 0, 1, 1 },
/* 11 bit */
{ 11, 1, -1, 1, -1 },
{ 11, -1, 1, -1, 1 },
{ 11, -1, 1, 1, -1 },
{ 11, 1, -1, -1, 1 },
{ 11, 1, 1, 1, 1 },
{ 11, -1, -1, 1, 1 },
{ 11, 1, 1, -1, -1 },
{ 11, -1, -1, 1, -1 },
{ 11, -1, -1, -1, -1 },
{ 11, 1, 1, -1, 1 },
{ 11, 1, -1, 1, 1 },
{ 11, -1, 1, 1, 1 },
{ 11, -1, 1, -1, -1 },
{ 11, -1, -1, -1, 1 },
{ 11, 1, -1, -1, -1 },
{ 11, 1, 1, 1, -1 }
};

621
src/contrib/aacdecoder/libfaad/codebook/hcb_10.h Normal file → Executable file
View File

@ -1,309 +1,312 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_10.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* 2-step huffman table HCB_10 */
/* 1st step: 6 bits
* 2^6 = 64 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb10_1[] = {
/* 4 bit codewords */
{ /* 000000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* 000100 */ 1, 0 },
{ /* */ 1, 0 },
{ /* */ 1, 0 },
{ /* */ 1, 0 },
{ /* 001000 */ 2, 0 },
{ /* */ 2, 0 },
{ /* */ 2, 0 },
{ /* */ 2, 0 },
/* 5 bit codewords */
{ /* 001100 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 001110 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 010000 */ 5, 0 },
{ /* */ 5, 0 },
{ /* 010010 */ 6, 0 },
{ /* */ 6, 0 },
{ /* 010100 */ 7, 0 },
{ /* */ 7, 0 },
{ /* 010110 */ 8, 0 },
{ /* */ 8, 0 },
{ /* 011000 */ 9, 0 },
{ /* */ 9, 0 },
{ /* 011010 */ 10, 0 },
{ /* */ 10, 0 },
/* 6 bit codewords */
{ /* 011100 */ 11, 0 },
{ /* 011101 */ 12, 0 },
{ /* 011110 */ 13, 0 },
{ /* 011111 */ 14, 0 },
{ /* 100000 */ 15, 0 },
{ /* 100001 */ 16, 0 },
{ /* 100010 */ 17, 0 },
{ /* 100011 */ 18, 0 },
{ /* 100100 */ 19, 0 },
{ /* 100101 */ 20, 0 },
{ /* 100110 */ 21, 0 },
{ /* 100111 */ 22, 0 },
{ /* 101000 */ 23, 0 },
{ /* 101001 */ 24, 0 },
/* 7 bit codewords */
{ /* 101010 */ 25, 1 },
{ /* 101011 */ 27, 1 },
{ /* 101100 */ 29, 1 },
{ /* 101101 */ 31, 1 },
{ /* 101110 */ 33, 1 },
{ /* 101111 */ 35, 1 },
{ /* 110000 */ 37, 1 },
{ /* 110001 */ 39, 1 },
/* 7/8 bit codewords */
{ /* 110010 */ 41, 2 },
/* 8 bit codewords */
{ /* 110011 */ 45, 2 },
{ /* 110100 */ 49, 2 },
{ /* 110101 */ 53, 2 },
{ /* 110110 */ 57, 2 },
{ /* 110111 */ 61, 2 },
/* 8/9 bit codewords */
{ /* 111000 */ 65, 3 },
/* 9 bit codewords */
{ /* 111001 */ 73, 3 },
{ /* 111010 */ 81, 3 },
{ /* 111011 */ 89, 3 },
/* 9/10 bit codewords */
{ /* 111100 */ 97, 4 },
/* 10 bit codewords */
{ /* 111101 */ 113, 4 },
{ /* 111110 */ 129, 4 },
/* 10/11/12 bit codewords */
{ /* 111111 */ 145, 6 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb10_2[] = {
/* 4 bit codewords */
{ 4, 1, 1 },
{ 4, 1, 2 },
{ 4, 2, 1 },
/* 5 bit codewords */
{ 5, 2, 2 },
{ 5, 1, 0 },
{ 5, 0, 1 },
{ 5, 1, 3 },
{ 5, 3, 2 },
{ 5, 3, 1 },
{ 5, 2, 3 },
{ 5, 3, 3 },
/* 6 bit codewords */
{ 6, 2, 0 },
{ 6, 0, 2 },
{ 6, 2, 4 },
{ 6, 4, 2 },
{ 6, 1, 4 },
{ 6, 4, 1 },
{ 6, 0, 0 },
{ 6, 4, 3 },
{ 6, 3, 4 },
{ 6, 3, 0 },
{ 6, 0, 3 },
{ 6, 4, 4 },
{ 6, 2, 5 },
{ 6, 5, 2 },
/* 7 bit codewords */
{ 7, 1, 5 },
{ 7, 5, 1 },
{ 7, 5, 3 },
{ 7, 3, 5 },
{ 7, 5, 4 },
{ 7, 4, 5 },
{ 7, 6, 2 },
{ 7, 2, 6 },
{ 7, 6, 3 },
{ 7, 4, 0 },
{ 7, 6, 1 },
{ 7, 0, 4 },
{ 7, 1, 6 },
{ 7, 3, 6 },
{ 7, 5, 5 },
{ 7, 6, 4 },
/* 7/8 bit codewords */
{ 7, 4, 6 }, { 7, 4, 6 },
{ 8, 6, 5 },
{ 8, 7, 2 },
/* 8 bit codewords */
{ 8, 3, 7 },
{ 8, 2, 7 },
{ 8, 5, 6 },
{ 8, 8, 2 },
{ 8, 7, 3 },
{ 8, 5, 0 },
{ 8, 7, 1 },
{ 8, 0, 5 },
{ 8, 8, 1 },
{ 8, 1, 7 },
{ 8, 8, 3 },
{ 8, 7, 4 },
{ 8, 4, 7 },
{ 8, 2, 8 },
{ 8, 6, 6 },
{ 8, 7, 5 },
{ 8, 1, 8 },
{ 8, 3, 8 },
{ 8, 8, 4 },
{ 8, 4, 8 },
/* 8/9 bit codewords */
{ 8, 5, 7 }, { 8, 5, 7 },
{ 8, 8, 5 }, { 8, 8, 5 },
{ 8, 5, 8 }, { 8, 5, 8 },
{ 9, 7, 6 },
{ 9, 6, 7 },
/* 9 bit codewords */
{ 9, 9, 2 },
{ 9, 6, 0 },
{ 9, 6, 8 },
{ 9, 9, 3 },
{ 9, 3, 9 },
{ 9, 9, 1 },
{ 9, 2, 9 },
{ 9, 0, 6 },
{ 9, 8, 6 },
{ 9, 9, 4 },
{ 9, 4, 9 },
{ 9, 10, 2 },
{ 9, 1, 9 },
{ 9, 7, 7 },
{ 9, 8, 7 },
{ 9, 9, 5 },
{ 9, 7, 8 },
{ 9, 10, 3 },
{ 9, 5, 9 },
{ 9, 10, 4 },
{ 9, 2, 10 },
{ 9, 10, 1 },
{ 9, 3, 10 },
{ 9, 9, 6 },
/* 9/10 bit codewords */
{ 9, 6, 9 }, { 9, 6, 9 },
{ 9, 8, 0 }, { 9, 8, 0 },
{ 9, 4, 10 }, { 9, 4, 10 },
{ 9, 7, 0 }, { 9, 7, 0 },
{ 9, 11, 2 }, { 9, 11, 2 },
{ 10, 7, 9 },
{ 10, 11, 3 },
{ 10, 10, 6 },
{ 10, 1, 10 },
{ 10, 11, 1 },
{ 10, 9, 7 },
/* 10 bit codewords */
{ 10, 0, 7 },
{ 10, 8, 8 },
{ 10, 10, 5 },
{ 10, 3, 11 },
{ 10, 5, 10 },
{ 10, 8, 9 },
{ 10, 11, 5 },
{ 10, 0, 8 },
{ 10, 11, 4 },
{ 10, 2, 11 },
{ 10, 7, 10 },
{ 10, 6, 10 },
{ 10, 10, 7 },
{ 10, 4, 11 },
{ 10, 1, 11 },
{ 10, 12, 2 },
{ 10, 9, 8 },
{ 10, 12, 3 },
{ 10, 11, 6 },
{ 10, 5, 11 },
{ 10, 12, 4 },
{ 10, 11, 7 },
{ 10, 12, 5 },
{ 10, 3, 12 },
{ 10, 6, 11 },
{ 10, 9, 0 },
{ 10, 10, 8 },
{ 10, 10, 0 },
{ 10, 12, 1 },
{ 10, 0, 9 },
{ 10, 4, 12 },
{ 10, 9, 9 },
/* 10/11/12 bit codewords */
{ 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 },
{ 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 },
{ 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 },
{ 11, 9, 10 }, { 11, 9, 10 },
{ 11, 1, 12 }, { 11, 1, 12 },
{ 11, 11, 8 }, { 11, 11, 8 },
{ 11, 12, 7 }, { 11, 12, 7 },
{ 11, 7, 11 }, { 11, 7, 11 },
{ 11, 5, 12 }, { 11, 5, 12 },
{ 11, 6, 12 }, { 11, 6, 12 },
{ 11, 10, 9 }, { 11, 10, 9 },
{ 11, 8, 11 }, { 11, 8, 11 },
{ 11, 12, 8 }, { 11, 12, 8 },
{ 11, 0, 10 }, { 11, 0, 10 },
{ 11, 7, 12 }, { 11, 7, 12 },
{ 11, 11, 0 }, { 11, 11, 0 },
{ 11, 10, 10 }, { 11, 10, 10 },
{ 11, 11, 9 }, { 11, 11, 9 },
{ 11, 11, 10 }, { 11, 11, 10 },
{ 11, 0, 11 }, { 11, 0, 11 },
{ 11, 11, 11 }, { 11, 11, 11 },
{ 11, 9, 11 }, { 11, 9, 11 },
{ 11, 10, 11 }, { 11, 10, 11 },
{ 11, 12, 0 }, { 11, 12, 0 },
{ 11, 8, 12 }, { 11, 8, 12 },
{ 12, 12, 9 },
{ 12, 10, 12 },
{ 12, 9, 12 },
{ 12, 11, 12 },
{ 12, 12, 11 },
{ 12, 0, 12 },
{ 12, 12, 10 },
{ 12, 12, 12 }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_10.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* 2-step huffman table HCB_10 */
/* 1st step: 6 bits
* 2^6 = 64 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb10_1[] = {
/* 4 bit codewords */
{ /* 000000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* 000100 */ 1, 0 },
{ /* */ 1, 0 },
{ /* */ 1, 0 },
{ /* */ 1, 0 },
{ /* 001000 */ 2, 0 },
{ /* */ 2, 0 },
{ /* */ 2, 0 },
{ /* */ 2, 0 },
/* 5 bit codewords */
{ /* 001100 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 001110 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 010000 */ 5, 0 },
{ /* */ 5, 0 },
{ /* 010010 */ 6, 0 },
{ /* */ 6, 0 },
{ /* 010100 */ 7, 0 },
{ /* */ 7, 0 },
{ /* 010110 */ 8, 0 },
{ /* */ 8, 0 },
{ /* 011000 */ 9, 0 },
{ /* */ 9, 0 },
{ /* 011010 */ 10, 0 },
{ /* */ 10, 0 },
/* 6 bit codewords */
{ /* 011100 */ 11, 0 },
{ /* 011101 */ 12, 0 },
{ /* 011110 */ 13, 0 },
{ /* 011111 */ 14, 0 },
{ /* 100000 */ 15, 0 },
{ /* 100001 */ 16, 0 },
{ /* 100010 */ 17, 0 },
{ /* 100011 */ 18, 0 },
{ /* 100100 */ 19, 0 },
{ /* 100101 */ 20, 0 },
{ /* 100110 */ 21, 0 },
{ /* 100111 */ 22, 0 },
{ /* 101000 */ 23, 0 },
{ /* 101001 */ 24, 0 },
/* 7 bit codewords */
{ /* 101010 */ 25, 1 },
{ /* 101011 */ 27, 1 },
{ /* 101100 */ 29, 1 },
{ /* 101101 */ 31, 1 },
{ /* 101110 */ 33, 1 },
{ /* 101111 */ 35, 1 },
{ /* 110000 */ 37, 1 },
{ /* 110001 */ 39, 1 },
/* 7/8 bit codewords */
{ /* 110010 */ 41, 2 },
/* 8 bit codewords */
{ /* 110011 */ 45, 2 },
{ /* 110100 */ 49, 2 },
{ /* 110101 */ 53, 2 },
{ /* 110110 */ 57, 2 },
{ /* 110111 */ 61, 2 },
/* 8/9 bit codewords */
{ /* 111000 */ 65, 3 },
/* 9 bit codewords */
{ /* 111001 */ 73, 3 },
{ /* 111010 */ 81, 3 },
{ /* 111011 */ 89, 3 },
/* 9/10 bit codewords */
{ /* 111100 */ 97, 4 },
/* 10 bit codewords */
{ /* 111101 */ 113, 4 },
{ /* 111110 */ 129, 4 },
/* 10/11/12 bit codewords */
{ /* 111111 */ 145, 6 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb10_2[] = {
/* 4 bit codewords */
{ 4, 1, 1 },
{ 4, 1, 2 },
{ 4, 2, 1 },
/* 5 bit codewords */
{ 5, 2, 2 },
{ 5, 1, 0 },
{ 5, 0, 1 },
{ 5, 1, 3 },
{ 5, 3, 2 },
{ 5, 3, 1 },
{ 5, 2, 3 },
{ 5, 3, 3 },
/* 6 bit codewords */
{ 6, 2, 0 },
{ 6, 0, 2 },
{ 6, 2, 4 },
{ 6, 4, 2 },
{ 6, 1, 4 },
{ 6, 4, 1 },
{ 6, 0, 0 },
{ 6, 4, 3 },
{ 6, 3, 4 },
{ 6, 3, 0 },
{ 6, 0, 3 },
{ 6, 4, 4 },
{ 6, 2, 5 },
{ 6, 5, 2 },
/* 7 bit codewords */
{ 7, 1, 5 },
{ 7, 5, 1 },
{ 7, 5, 3 },
{ 7, 3, 5 },
{ 7, 5, 4 },
{ 7, 4, 5 },
{ 7, 6, 2 },
{ 7, 2, 6 },
{ 7, 6, 3 },
{ 7, 4, 0 },
{ 7, 6, 1 },
{ 7, 0, 4 },
{ 7, 1, 6 },
{ 7, 3, 6 },
{ 7, 5, 5 },
{ 7, 6, 4 },
/* 7/8 bit codewords */
{ 7, 4, 6 }, { 7, 4, 6 },
{ 8, 6, 5 },
{ 8, 7, 2 },
/* 8 bit codewords */
{ 8, 3, 7 },
{ 8, 2, 7 },
{ 8, 5, 6 },
{ 8, 8, 2 },
{ 8, 7, 3 },
{ 8, 5, 0 },
{ 8, 7, 1 },
{ 8, 0, 5 },
{ 8, 8, 1 },
{ 8, 1, 7 },
{ 8, 8, 3 },
{ 8, 7, 4 },
{ 8, 4, 7 },
{ 8, 2, 8 },
{ 8, 6, 6 },
{ 8, 7, 5 },
{ 8, 1, 8 },
{ 8, 3, 8 },
{ 8, 8, 4 },
{ 8, 4, 8 },
/* 8/9 bit codewords */
{ 8, 5, 7 }, { 8, 5, 7 },
{ 8, 8, 5 }, { 8, 8, 5 },
{ 8, 5, 8 }, { 8, 5, 8 },
{ 9, 7, 6 },
{ 9, 6, 7 },
/* 9 bit codewords */
{ 9, 9, 2 },
{ 9, 6, 0 },
{ 9, 6, 8 },
{ 9, 9, 3 },
{ 9, 3, 9 },
{ 9, 9, 1 },
{ 9, 2, 9 },
{ 9, 0, 6 },
{ 9, 8, 6 },
{ 9, 9, 4 },
{ 9, 4, 9 },
{ 9, 10, 2 },
{ 9, 1, 9 },
{ 9, 7, 7 },
{ 9, 8, 7 },
{ 9, 9, 5 },
{ 9, 7, 8 },
{ 9, 10, 3 },
{ 9, 5, 9 },
{ 9, 10, 4 },
{ 9, 2, 10 },
{ 9, 10, 1 },
{ 9, 3, 10 },
{ 9, 9, 6 },
/* 9/10 bit codewords */
{ 9, 6, 9 }, { 9, 6, 9 },
{ 9, 8, 0 }, { 9, 8, 0 },
{ 9, 4, 10 }, { 9, 4, 10 },
{ 9, 7, 0 }, { 9, 7, 0 },
{ 9, 11, 2 }, { 9, 11, 2 },
{ 10, 7, 9 },
{ 10, 11, 3 },
{ 10, 10, 6 },
{ 10, 1, 10 },
{ 10, 11, 1 },
{ 10, 9, 7 },
/* 10 bit codewords */
{ 10, 0, 7 },
{ 10, 8, 8 },
{ 10, 10, 5 },
{ 10, 3, 11 },
{ 10, 5, 10 },
{ 10, 8, 9 },
{ 10, 11, 5 },
{ 10, 0, 8 },
{ 10, 11, 4 },
{ 10, 2, 11 },
{ 10, 7, 10 },
{ 10, 6, 10 },
{ 10, 10, 7 },
{ 10, 4, 11 },
{ 10, 1, 11 },
{ 10, 12, 2 },
{ 10, 9, 8 },
{ 10, 12, 3 },
{ 10, 11, 6 },
{ 10, 5, 11 },
{ 10, 12, 4 },
{ 10, 11, 7 },
{ 10, 12, 5 },
{ 10, 3, 12 },
{ 10, 6, 11 },
{ 10, 9, 0 },
{ 10, 10, 8 },
{ 10, 10, 0 },
{ 10, 12, 1 },
{ 10, 0, 9 },
{ 10, 4, 12 },
{ 10, 9, 9 },
/* 10/11/12 bit codewords */
{ 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 }, { 10, 12, 6 },
{ 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 }, { 10, 2, 12 },
{ 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 }, { 10, 8, 10 },
{ 11, 9, 10 }, { 11, 9, 10 },
{ 11, 1, 12 }, { 11, 1, 12 },
{ 11, 11, 8 }, { 11, 11, 8 },
{ 11, 12, 7 }, { 11, 12, 7 },
{ 11, 7, 11 }, { 11, 7, 11 },
{ 11, 5, 12 }, { 11, 5, 12 },
{ 11, 6, 12 }, { 11, 6, 12 },
{ 11, 10, 9 }, { 11, 10, 9 },
{ 11, 8, 11 }, { 11, 8, 11 },
{ 11, 12, 8 }, { 11, 12, 8 },
{ 11, 0, 10 }, { 11, 0, 10 },
{ 11, 7, 12 }, { 11, 7, 12 },
{ 11, 11, 0 }, { 11, 11, 0 },
{ 11, 10, 10 }, { 11, 10, 10 },
{ 11, 11, 9 }, { 11, 11, 9 },
{ 11, 11, 10 }, { 11, 11, 10 },
{ 11, 0, 11 }, { 11, 0, 11 },
{ 11, 11, 11 }, { 11, 11, 11 },
{ 11, 9, 11 }, { 11, 9, 11 },
{ 11, 10, 11 }, { 11, 10, 11 },
{ 11, 12, 0 }, { 11, 12, 0 },
{ 11, 8, 12 }, { 11, 8, 12 },
{ 12, 12, 9 },
{ 12, 10, 12 },
{ 12, 9, 12 },
{ 12, 11, 12 },
{ 12, 12, 11 },
{ 12, 0, 12 },
{ 12, 12, 10 },
{ 12, 12, 12 }
};

827
src/contrib/aacdecoder/libfaad/codebook/hcb_11.h Normal file → Executable file
View File

@ -1,412 +1,415 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_11.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* 2-step huffman table HCB_11 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb11_1[] = {
/* 4 bits */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00010 */ 1, 0 },
{ /* */ 1, 0 },
/* 5 bits */
{ /* 00100 */ 2, 0 },
{ /* 00101 */ 3, 0 },
{ /* 00110 */ 4, 0 },
{ /* 00111 */ 5, 0 },
{ /* 01000 */ 6, 0 },
{ /* 01001 */ 7, 0 },
/* 6 bits */
{ /* 01010 */ 8, 1 },
{ /* 01011 */ 10, 1 },
{ /* 01100 */ 12, 1 },
/* 6/7 bits */
{ /* 01101 */ 14, 2 },
/* 7 bits */
{ /* 01110 */ 18, 2 },
{ /* 01111 */ 22, 2 },
{ /* 10000 */ 26, 2 },
/* 7/8 bits */
{ /* 10001 */ 30, 3 },
/* 8 bits */
{ /* 10010 */ 38, 3 },
{ /* 10011 */ 46, 3 },
{ /* 10100 */ 54, 3 },
{ /* 10101 */ 62, 3 },
{ /* 10110 */ 70, 3 },
{ /* 10111 */ 78, 3 },
/* 8/9 bits */
{ /* 11000 */ 86, 4 },
/* 9 bits */
{ /* 11001 */ 102, 4 },
{ /* 11010 */ 118, 4 },
{ /* 11011 */ 134, 4 },
/* 9/10 bits */
{ /* 11100 */ 150, 5 },
/* 10 bits */
{ /* 11101 */ 182, 5 },
{ /* 11110 */ 214, 5 },
/* 10/11/12 bits */
{ /* 11111 */ 246, 7 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb11_2[] = {
/* 4 */
{ 4, 0, 0 },
{ 4, 1, 1 },
/* 5 */
{ 5, 16, 16 },
{ 5, 1, 0 },
{ 5, 0, 1 },
{ 5, 2, 1 },
{ 5, 1, 2 },
{ 5, 2, 2 },
/* 6 */
{ 6, 1, 3 },
{ 6, 3, 1 },
{ 6, 3, 2 },
{ 6, 2, 0 },
{ 6, 2, 3 },
{ 6, 0, 2 },
/* 6/7 */
{ 6, 3, 3 }, { 6, 3, 3 },
{ 7, 4, 1 },
{ 7, 1, 4 },
/* 7 */
{ 7, 4, 2 },
{ 7, 2, 4 },
{ 7, 4, 3 },
{ 7, 3, 4 },
{ 7, 3, 0 },
{ 7, 0, 3 },
{ 7, 5, 1 },
{ 7, 5, 2 },
{ 7, 2, 5 },
{ 7, 4, 4 },
{ 7, 1, 5 },
{ 7, 5, 3 },
/* 7/8 */
{ 7, 3, 5 }, { 7, 3, 5 },
{ 7, 5, 4 }, { 7, 5, 4 },
{ 8, 4, 5 },
{ 8, 6, 2 },
{ 8, 2, 6 },
{ 8, 6, 1 },
/* 8 */
{ 8, 6, 3 },
{ 8, 3, 6 },
{ 8, 1, 6 },
{ 8, 4, 16 },
{ 8, 3, 16 },
{ 8, 16, 5 },
{ 8, 16, 3 },
{ 8, 16, 4 },
{ 8, 6, 4 },
{ 8, 16, 6 },
{ 8, 4, 0 },
{ 8, 4, 6 },
{ 8, 0, 4 },
{ 8, 2, 16 },
{ 8, 5, 5 },
{ 8, 5, 16 },
{ 8, 16, 7 },
{ 8, 16, 2 },
{ 8, 16, 8 },
{ 8, 2, 7 },
{ 8, 7, 2 },
{ 8, 3, 7 },
{ 8, 6, 5 },
{ 8, 5, 6 },
{ 8, 6, 16 },
{ 8, 16, 10 },
{ 8, 7, 3 },
{ 8, 7, 1 },
{ 8, 16, 9 },
{ 8, 7, 16 },
{ 8, 1, 16 },
{ 8, 1, 7 },
{ 8, 4, 7 },
{ 8, 16, 11 },
{ 8, 7, 4 },
{ 8, 16, 12 },
{ 8, 8, 16 },
{ 8, 16, 1 },
{ 8, 6, 6 },
{ 8, 9, 16 },
{ 8, 2, 8 },
{ 8, 5, 7 },
{ 8, 10, 16 },
{ 8, 16, 13 },
{ 8, 8, 3 },
{ 8, 8, 2 },
{ 8, 3, 8 },
{ 8, 5, 0 },
/* 8/9 */
{ 8, 16, 14 }, { 8, 16, 14 },
{ 8, 11, 16 }, { 8, 11, 16 },
{ 8, 7, 5 }, { 8, 7, 5 },
{ 8, 4, 8 }, { 8, 4, 8 },
{ 8, 6, 7 }, { 8, 6, 7 },
{ 8, 7, 6 }, { 8, 7, 6 },
{ 8, 0, 5 }, { 8, 0, 5 },
{ 9, 8, 4 },
{ 9, 16, 15 },
/* 9 */
{ 9, 12, 16 },
{ 9, 1, 8 },
{ 9, 8, 1 },
{ 9, 14, 16 },
{ 9, 5, 8 },
{ 9, 13, 16 },
{ 9, 3, 9 },
{ 9, 8, 5 },
{ 9, 7, 7 },
{ 9, 2, 9 },
{ 9, 8, 6 },
{ 9, 9, 2 },
{ 9, 9, 3 },
{ 9, 15, 16 },
{ 9, 4, 9 },
{ 9, 6, 8 },
{ 9, 6, 0 },
{ 9, 9, 4 },
{ 9, 5, 9 },
{ 9, 8, 7 },
{ 9, 7, 8 },
{ 9, 1, 9 },
{ 9, 10, 3 },
{ 9, 0, 6 },
{ 9, 10, 2 },
{ 9, 9, 1 },
{ 9, 9, 5 },
{ 9, 4, 10 },
{ 9, 2, 10 },
{ 9, 9, 6 },
{ 9, 3, 10 },
{ 9, 6, 9 },
{ 9, 10, 4 },
{ 9, 8, 8 },
{ 9, 10, 5 },
{ 9, 9, 7 },
{ 9, 11, 3 },
{ 9, 1, 10 },
{ 9, 7, 0 },
{ 9, 10, 6 },
{ 9, 7, 9 },
{ 9, 3, 11 },
{ 9, 5, 10 },
{ 9, 10, 1 },
{ 9, 4, 11 },
{ 9, 11, 2 },
{ 9, 13, 2 },
{ 9, 6, 10 },
/* 9/10 */
{ 9, 13, 3 }, { 9, 13, 3 },
{ 9, 2, 11 }, { 9, 2, 11 },
{ 9, 16, 0 }, { 9, 16, 0 },
{ 9, 5, 11 }, { 9, 5, 11 },
{ 9, 11, 5 }, { 9, 11, 5 },
{ 10, 11, 4 },
{ 10, 9, 8 },
{ 10, 7, 10 },
{ 10, 8, 9 },
{ 10, 0, 16 },
{ 10, 4, 13 },
{ 10, 0, 7 },
{ 10, 3, 13 },
{ 10, 11, 6 },
{ 10, 13, 1 },
{ 10, 13, 4 },
{ 10, 12, 3 },
{ 10, 2, 13 },
{ 10, 13, 5 },
{ 10, 8, 10 },
{ 10, 6, 11 },
{ 10, 10, 8 },
{ 10, 10, 7 },
{ 10, 14, 2 },
{ 10, 12, 4 },
{ 10, 1, 11 },
{ 10, 4, 12 },
/* 10 */
{ 10, 11, 1 },
{ 10, 3, 12 },
{ 10, 1, 13 },
{ 10, 12, 2 },
{ 10, 7, 11 },
{ 10, 3, 14 },
{ 10, 5, 12 },
{ 10, 5, 13 },
{ 10, 14, 4 },
{ 10, 4, 14 },
{ 10, 11, 7 },
{ 10, 14, 3 },
{ 10, 12, 5 },
{ 10, 13, 6 },
{ 10, 12, 6 },
{ 10, 8, 0 },
{ 10, 11, 8 },
{ 10, 2, 12 },
{ 10, 9, 9 },
{ 10, 14, 5 },
{ 10, 6, 13 },
{ 10, 10, 10 },
{ 10, 15, 2 },
{ 10, 8, 11 },
{ 10, 9, 10 },
{ 10, 14, 6 },
{ 10, 10, 9 },
{ 10, 5, 14 },
{ 10, 11, 9 },
{ 10, 14, 1 },
{ 10, 2, 14 },
{ 10, 6, 12 },
{ 10, 1, 12 },
{ 10, 13, 8 },
{ 10, 0, 8 },
{ 10, 13, 7 },
{ 10, 7, 12 },
{ 10, 12, 7 },
{ 10, 7, 13 },
{ 10, 15, 3 },
{ 10, 12, 1 },
{ 10, 6, 14 },
{ 10, 2, 15 },
{ 10, 15, 5 },
{ 10, 15, 4 },
{ 10, 1, 14 },
{ 10, 9, 11 },
{ 10, 4, 15 },
{ 10, 14, 7 },
{ 10, 8, 13 },
{ 10, 13, 9 },
{ 10, 8, 12 },
{ 10, 5, 15 },
{ 10, 3, 15 },
{ 10, 10, 11 },
{ 10, 11, 10 },
{ 10, 12, 8 },
{ 10, 15, 6 },
{ 10, 15, 7 },
{ 10, 8, 14 },
{ 10, 15, 1 },
{ 10, 7, 14 },
{ 10, 9, 0 },
{ 10, 0, 9 },
/* 10/11/12 */
{ 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 },
{ 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 },
{ 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 },
{ 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 },
{ 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 },
{ 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 },
{ 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 },
{ 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 },
{ 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 },
{ 11, 9, 14 }, { 11, 9, 14 },
{ 11, 15, 8 }, { 11, 15, 8 },
{ 11, 11, 11 }, { 11, 11, 11 },
{ 11, 11, 14 }, { 11, 11, 14 },
{ 11, 1, 15 }, { 11, 1, 15 },
{ 11, 10, 12 }, { 11, 10, 12 },
{ 11, 10, 14 }, { 11, 10, 14 },
{ 11, 13, 11 }, { 11, 13, 11 },
{ 11, 13, 10 }, { 11, 13, 10 },
{ 11, 11, 13 }, { 11, 11, 13 },
{ 11, 11, 12 }, { 11, 11, 12 },
{ 11, 8, 15 }, { 11, 8, 15 },
{ 11, 14, 11 }, { 11, 14, 11 },
{ 11, 13, 12 }, { 11, 13, 12 },
{ 11, 12, 13 }, { 11, 12, 13 },
{ 11, 15, 9 }, { 11, 15, 9 },
{ 11, 14, 10 }, { 11, 14, 10 },
{ 11, 10, 0 }, { 11, 10, 0 },
{ 11, 12, 11 }, { 11, 12, 11 },
{ 11, 9, 15 }, { 11, 9, 15 },
{ 11, 0, 10 }, { 11, 0, 10 },
{ 11, 12, 12 }, { 11, 12, 12 },
{ 11, 11, 0 }, { 11, 11, 0 },
{ 11, 12, 14 }, { 11, 12, 14 },
{ 11, 10, 15 }, { 11, 10, 15 },
{ 11, 13, 13 }, { 11, 13, 13 },
{ 11, 0, 13 }, { 11, 0, 13 },
{ 11, 14, 12 }, { 11, 14, 12 },
{ 11, 15, 10 }, { 11, 15, 10 },
{ 11, 15, 11 }, { 11, 15, 11 },
{ 11, 11, 15 }, { 11, 11, 15 },
{ 11, 14, 13 }, { 11, 14, 13 },
{ 11, 13, 0 }, { 11, 13, 0 },
{ 11, 0, 11 }, { 11, 0, 11 },
{ 11, 13, 14 }, { 11, 13, 14 },
{ 11, 15, 12 }, { 11, 15, 12 },
{ 11, 15, 13 }, { 11, 15, 13 },
{ 11, 12, 15 }, { 11, 12, 15 },
{ 11, 14, 0 }, { 11, 14, 0 },
{ 11, 14, 14 }, { 11, 14, 14 },
{ 11, 13, 15 }, { 11, 13, 15 },
{ 11, 12, 0 }, { 11, 12, 0 },
{ 11, 14, 15 }, { 11, 14, 15 },
{ 12, 0, 14 },
{ 12, 0, 12 },
{ 12, 15, 14 },
{ 12, 15, 0 },
{ 12, 0, 15 },
{ 12, 15, 15 }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_11.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* 2-step huffman table HCB_11 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb11_1[] = {
/* 4 bits */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00010 */ 1, 0 },
{ /* */ 1, 0 },
/* 5 bits */
{ /* 00100 */ 2, 0 },
{ /* 00101 */ 3, 0 },
{ /* 00110 */ 4, 0 },
{ /* 00111 */ 5, 0 },
{ /* 01000 */ 6, 0 },
{ /* 01001 */ 7, 0 },
/* 6 bits */
{ /* 01010 */ 8, 1 },
{ /* 01011 */ 10, 1 },
{ /* 01100 */ 12, 1 },
/* 6/7 bits */
{ /* 01101 */ 14, 2 },
/* 7 bits */
{ /* 01110 */ 18, 2 },
{ /* 01111 */ 22, 2 },
{ /* 10000 */ 26, 2 },
/* 7/8 bits */
{ /* 10001 */ 30, 3 },
/* 8 bits */
{ /* 10010 */ 38, 3 },
{ /* 10011 */ 46, 3 },
{ /* 10100 */ 54, 3 },
{ /* 10101 */ 62, 3 },
{ /* 10110 */ 70, 3 },
{ /* 10111 */ 78, 3 },
/* 8/9 bits */
{ /* 11000 */ 86, 4 },
/* 9 bits */
{ /* 11001 */ 102, 4 },
{ /* 11010 */ 118, 4 },
{ /* 11011 */ 134, 4 },
/* 9/10 bits */
{ /* 11100 */ 150, 5 },
/* 10 bits */
{ /* 11101 */ 182, 5 },
{ /* 11110 */ 214, 5 },
/* 10/11/12 bits */
{ /* 11111 */ 246, 7 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb11_2[] = {
/* 4 */
{ 4, 0, 0 },
{ 4, 1, 1 },
/* 5 */
{ 5, 16, 16 },
{ 5, 1, 0 },
{ 5, 0, 1 },
{ 5, 2, 1 },
{ 5, 1, 2 },
{ 5, 2, 2 },
/* 6 */
{ 6, 1, 3 },
{ 6, 3, 1 },
{ 6, 3, 2 },
{ 6, 2, 0 },
{ 6, 2, 3 },
{ 6, 0, 2 },
/* 6/7 */
{ 6, 3, 3 }, { 6, 3, 3 },
{ 7, 4, 1 },
{ 7, 1, 4 },
/* 7 */
{ 7, 4, 2 },
{ 7, 2, 4 },
{ 7, 4, 3 },
{ 7, 3, 4 },
{ 7, 3, 0 },
{ 7, 0, 3 },
{ 7, 5, 1 },
{ 7, 5, 2 },
{ 7, 2, 5 },
{ 7, 4, 4 },
{ 7, 1, 5 },
{ 7, 5, 3 },
/* 7/8 */
{ 7, 3, 5 }, { 7, 3, 5 },
{ 7, 5, 4 }, { 7, 5, 4 },
{ 8, 4, 5 },
{ 8, 6, 2 },
{ 8, 2, 6 },
{ 8, 6, 1 },
/* 8 */
{ 8, 6, 3 },
{ 8, 3, 6 },
{ 8, 1, 6 },
{ 8, 4, 16 },
{ 8, 3, 16 },
{ 8, 16, 5 },
{ 8, 16, 3 },
{ 8, 16, 4 },
{ 8, 6, 4 },
{ 8, 16, 6 },
{ 8, 4, 0 },
{ 8, 4, 6 },
{ 8, 0, 4 },
{ 8, 2, 16 },
{ 8, 5, 5 },
{ 8, 5, 16 },
{ 8, 16, 7 },
{ 8, 16, 2 },
{ 8, 16, 8 },
{ 8, 2, 7 },
{ 8, 7, 2 },
{ 8, 3, 7 },
{ 8, 6, 5 },
{ 8, 5, 6 },
{ 8, 6, 16 },
{ 8, 16, 10 },
{ 8, 7, 3 },
{ 8, 7, 1 },
{ 8, 16, 9 },
{ 8, 7, 16 },
{ 8, 1, 16 },
{ 8, 1, 7 },
{ 8, 4, 7 },
{ 8, 16, 11 },
{ 8, 7, 4 },
{ 8, 16, 12 },
{ 8, 8, 16 },
{ 8, 16, 1 },
{ 8, 6, 6 },
{ 8, 9, 16 },
{ 8, 2, 8 },
{ 8, 5, 7 },
{ 8, 10, 16 },
{ 8, 16, 13 },
{ 8, 8, 3 },
{ 8, 8, 2 },
{ 8, 3, 8 },
{ 8, 5, 0 },
/* 8/9 */
{ 8, 16, 14 }, { 8, 16, 14 },
{ 8, 11, 16 }, { 8, 11, 16 },
{ 8, 7, 5 }, { 8, 7, 5 },
{ 8, 4, 8 }, { 8, 4, 8 },
{ 8, 6, 7 }, { 8, 6, 7 },
{ 8, 7, 6 }, { 8, 7, 6 },
{ 8, 0, 5 }, { 8, 0, 5 },
{ 9, 8, 4 },
{ 9, 16, 15 },
/* 9 */
{ 9, 12, 16 },
{ 9, 1, 8 },
{ 9, 8, 1 },
{ 9, 14, 16 },
{ 9, 5, 8 },
{ 9, 13, 16 },
{ 9, 3, 9 },
{ 9, 8, 5 },
{ 9, 7, 7 },
{ 9, 2, 9 },
{ 9, 8, 6 },
{ 9, 9, 2 },
{ 9, 9, 3 },
{ 9, 15, 16 },
{ 9, 4, 9 },
{ 9, 6, 8 },
{ 9, 6, 0 },
{ 9, 9, 4 },
{ 9, 5, 9 },
{ 9, 8, 7 },
{ 9, 7, 8 },
{ 9, 1, 9 },
{ 9, 10, 3 },
{ 9, 0, 6 },
{ 9, 10, 2 },
{ 9, 9, 1 },
{ 9, 9, 5 },
{ 9, 4, 10 },
{ 9, 2, 10 },
{ 9, 9, 6 },
{ 9, 3, 10 },
{ 9, 6, 9 },
{ 9, 10, 4 },
{ 9, 8, 8 },
{ 9, 10, 5 },
{ 9, 9, 7 },
{ 9, 11, 3 },
{ 9, 1, 10 },
{ 9, 7, 0 },
{ 9, 10, 6 },
{ 9, 7, 9 },
{ 9, 3, 11 },
{ 9, 5, 10 },
{ 9, 10, 1 },
{ 9, 4, 11 },
{ 9, 11, 2 },
{ 9, 13, 2 },
{ 9, 6, 10 },
/* 9/10 */
{ 9, 13, 3 }, { 9, 13, 3 },
{ 9, 2, 11 }, { 9, 2, 11 },
{ 9, 16, 0 }, { 9, 16, 0 },
{ 9, 5, 11 }, { 9, 5, 11 },
{ 9, 11, 5 }, { 9, 11, 5 },
{ 10, 11, 4 },
{ 10, 9, 8 },
{ 10, 7, 10 },
{ 10, 8, 9 },
{ 10, 0, 16 },
{ 10, 4, 13 },
{ 10, 0, 7 },
{ 10, 3, 13 },
{ 10, 11, 6 },
{ 10, 13, 1 },
{ 10, 13, 4 },
{ 10, 12, 3 },
{ 10, 2, 13 },
{ 10, 13, 5 },
{ 10, 8, 10 },
{ 10, 6, 11 },
{ 10, 10, 8 },
{ 10, 10, 7 },
{ 10, 14, 2 },
{ 10, 12, 4 },
{ 10, 1, 11 },
{ 10, 4, 12 },
/* 10 */
{ 10, 11, 1 },
{ 10, 3, 12 },
{ 10, 1, 13 },
{ 10, 12, 2 },
{ 10, 7, 11 },
{ 10, 3, 14 },
{ 10, 5, 12 },
{ 10, 5, 13 },
{ 10, 14, 4 },
{ 10, 4, 14 },
{ 10, 11, 7 },
{ 10, 14, 3 },
{ 10, 12, 5 },
{ 10, 13, 6 },
{ 10, 12, 6 },
{ 10, 8, 0 },
{ 10, 11, 8 },
{ 10, 2, 12 },
{ 10, 9, 9 },
{ 10, 14, 5 },
{ 10, 6, 13 },
{ 10, 10, 10 },
{ 10, 15, 2 },
{ 10, 8, 11 },
{ 10, 9, 10 },
{ 10, 14, 6 },
{ 10, 10, 9 },
{ 10, 5, 14 },
{ 10, 11, 9 },
{ 10, 14, 1 },
{ 10, 2, 14 },
{ 10, 6, 12 },
{ 10, 1, 12 },
{ 10, 13, 8 },
{ 10, 0, 8 },
{ 10, 13, 7 },
{ 10, 7, 12 },
{ 10, 12, 7 },
{ 10, 7, 13 },
{ 10, 15, 3 },
{ 10, 12, 1 },
{ 10, 6, 14 },
{ 10, 2, 15 },
{ 10, 15, 5 },
{ 10, 15, 4 },
{ 10, 1, 14 },
{ 10, 9, 11 },
{ 10, 4, 15 },
{ 10, 14, 7 },
{ 10, 8, 13 },
{ 10, 13, 9 },
{ 10, 8, 12 },
{ 10, 5, 15 },
{ 10, 3, 15 },
{ 10, 10, 11 },
{ 10, 11, 10 },
{ 10, 12, 8 },
{ 10, 15, 6 },
{ 10, 15, 7 },
{ 10, 8, 14 },
{ 10, 15, 1 },
{ 10, 7, 14 },
{ 10, 9, 0 },
{ 10, 0, 9 },
/* 10/11/12 */
{ 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 }, { 10, 9, 13 },
{ 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 }, { 10, 9, 12 },
{ 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 }, { 10, 12, 9 },
{ 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 }, { 10, 14, 8 },
{ 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 }, { 10, 10, 13 },
{ 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 }, { 10, 14, 9 },
{ 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 }, { 10, 12, 10 },
{ 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 }, { 10, 6, 15 },
{ 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 }, { 10, 7, 15 },
{ 11, 9, 14 }, { 11, 9, 14 },
{ 11, 15, 8 }, { 11, 15, 8 },
{ 11, 11, 11 }, { 11, 11, 11 },
{ 11, 11, 14 }, { 11, 11, 14 },
{ 11, 1, 15 }, { 11, 1, 15 },
{ 11, 10, 12 }, { 11, 10, 12 },
{ 11, 10, 14 }, { 11, 10, 14 },
{ 11, 13, 11 }, { 11, 13, 11 },
{ 11, 13, 10 }, { 11, 13, 10 },
{ 11, 11, 13 }, { 11, 11, 13 },
{ 11, 11, 12 }, { 11, 11, 12 },
{ 11, 8, 15 }, { 11, 8, 15 },
{ 11, 14, 11 }, { 11, 14, 11 },
{ 11, 13, 12 }, { 11, 13, 12 },
{ 11, 12, 13 }, { 11, 12, 13 },
{ 11, 15, 9 }, { 11, 15, 9 },
{ 11, 14, 10 }, { 11, 14, 10 },
{ 11, 10, 0 }, { 11, 10, 0 },
{ 11, 12, 11 }, { 11, 12, 11 },
{ 11, 9, 15 }, { 11, 9, 15 },
{ 11, 0, 10 }, { 11, 0, 10 },
{ 11, 12, 12 }, { 11, 12, 12 },
{ 11, 11, 0 }, { 11, 11, 0 },
{ 11, 12, 14 }, { 11, 12, 14 },
{ 11, 10, 15 }, { 11, 10, 15 },
{ 11, 13, 13 }, { 11, 13, 13 },
{ 11, 0, 13 }, { 11, 0, 13 },
{ 11, 14, 12 }, { 11, 14, 12 },
{ 11, 15, 10 }, { 11, 15, 10 },
{ 11, 15, 11 }, { 11, 15, 11 },
{ 11, 11, 15 }, { 11, 11, 15 },
{ 11, 14, 13 }, { 11, 14, 13 },
{ 11, 13, 0 }, { 11, 13, 0 },
{ 11, 0, 11 }, { 11, 0, 11 },
{ 11, 13, 14 }, { 11, 13, 14 },
{ 11, 15, 12 }, { 11, 15, 12 },
{ 11, 15, 13 }, { 11, 15, 13 },
{ 11, 12, 15 }, { 11, 12, 15 },
{ 11, 14, 0 }, { 11, 14, 0 },
{ 11, 14, 14 }, { 11, 14, 14 },
{ 11, 13, 15 }, { 11, 13, 15 },
{ 11, 12, 0 }, { 11, 12, 0 },
{ 11, 14, 15 }, { 11, 14, 15 },
{ 12, 0, 14 },
{ 12, 0, 12 },
{ 12, 15, 14 },
{ 12, 15, 0 },
{ 12, 0, 15 },
{ 12, 15, 15 }
};

367
src/contrib/aacdecoder/libfaad/codebook/hcb_2.h Normal file → Executable file
View File

@ -1,182 +1,185 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_2.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* 2-step huffman table HCB_2 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb2_1[] = {
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00100 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00110 */ 2, 0 },
{ /* 00111 */ 3, 0 },
{ /* 01000 */ 4, 0 },
{ /* 01001 */ 5, 0 },
{ /* 01010 */ 6, 0 },
{ /* 01011 */ 7, 0 },
{ /* 01100 */ 8, 0 },
/* 6 bit codewords */
{ /* 01101 */ 9, 1 },
{ /* 01110 */ 11, 1 },
{ /* 01111 */ 13, 1 },
{ /* 10000 */ 15, 1 },
{ /* 10001 */ 17, 1 },
{ /* 10010 */ 19, 1 },
{ /* 10011 */ 21, 1 },
{ /* 10100 */ 23, 1 },
{ /* 10101 */ 25, 1 },
{ /* 10110 */ 27, 1 },
{ /* 10111 */ 29, 1 },
{ /* 11000 */ 31, 1 },
/* 7 bit codewords */
{ /* 11001 */ 33, 2 },
{ /* 11010 */ 37, 2 },
{ /* 11011 */ 41, 2 },
/* 7/8 bit codewords */
{ /* 11100 */ 45, 3 },
/* 8 bit codewords */
{ /* 11101 */ 53, 3 },
{ /* 11110 */ 61, 3 },
/* 8/9 bit codewords */
{ /* 11111 */ 69, 4 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_quad hcb2_2[] = {
/* 3 bit codeword */
{ 3, 0, 0, 0, 0 },
/* 4 bit codeword */
{ 4, 1, 0, 0, 0 },
/* 5 bit codewords */
{ 5, -1, 0, 0, 0 },
{ 5, 0, 0, 0, 1 },
{ 5, 0, 0, -1, 0 },
{ 5, 0, 0, 0, -1 },
{ 5, 0, -1, 0, 0 },
{ 5, 0, 0, 1, 0 },
{ 5, 0, 1, 0, 0 },
/* 6 bit codewords */
{ 6, 0, -1, 1, 0 },
{ 6, -1, 1, 0, 0 },
{ 6, 0, 1, -1, 0 },
{ 6, 0, 0, 1, -1 },
{ 6, 0, 1, 0, -1 },
{ 6, 0, 0, -1, 1 },
{ 6, -1, 0, 0, -1 },
{ 6, 1, -1, 0, 0 },
{ 6, 1, 0, -1, 0 },
{ 6, -1, -1, 0, 0 },
{ 6, 0, 0, -1, -1 },
{ 6, 1, 0, 1, 0 },
{ 6, 1, 0, 0, 1 },
{ 6, 0, -1, 0, 1 },
{ 6, -1, 0, 1, 0 },
{ 6, 0, 1, 0, 1 },
{ 6, 0, -1, -1, 0 },
{ 6, -1, 0, 0, 1 },
{ 6, 0, -1, 0, -1 },
{ 6, -1, 0, -1, 0 },
{ 6, 1, 1, 0, 0 },
{ 6, 0, 1, 1, 0 },
{ 6, 0, 0, 1, 1 },
{ 6, 1, 0, 0, -1 },
/* 7 bit codewords */
{ 7, 0, 1, -1, 1 },
{ 7, 1, 0, -1, 1 },
{ 7, -1, 1, -1, 0 },
{ 7, 0, -1, 1, -1 },
{ 7, 1, -1, 1, 0 },
{ 7, 1, 1, 0, -1 },
{ 7, 1, 0, 1, 1 },
{ 7, -1, 1, 1, 0 },
{ 7, 0, -1, -1, 1 },
{ 7, 1, 1, 1, 0 },
{ 7, -1, 0, 1, -1 },
{ 7, -1, -1, -1, 0 },
/* 7/8 bit codewords */
{ 7, -1, 0, -1, 1 }, { 7, -1, 0, -1, 1 },
{ 7, 1, -1, -1, 0 }, { 7, 1, -1, -1, 0 },
{ 7, 1, 1, -1, 0 }, { 7, 1, 1, -1, 0 },
{ 8, 1, -1, 0, 1 },
{ 8, -1, 1, 0, -1 },
/* 8 bit codewords */
{ 8, -1, -1, 1, 0 },
{ 8, -1, 0, 1, 1 },
{ 8, -1, -1, 0, 1 },
{ 8, -1, -1, 0, -1 },
{ 8, 0, -1, -1, -1 },
{ 8, 1, 0, 1, -1 },
{ 8, 1, 0, -1, -1 },
{ 8, 0, 1, -1, -1 },
{ 8, 0, 1, 1, 1 },
{ 8, -1, 1, 0, 1 },
{ 8, -1, 0, -1, -1 },
{ 8, 0, 1, 1, -1 },
{ 8, 1, -1, 0, -1 },
{ 8, 0, -1, 1, 1 },
{ 8, 1, 1, 0, 1 },
{ 8, 1, -1, 1, -1 },
/* 8/9 bit codewords */
{ 8, -1, 1, -1, 1 }, { 8, -1, 1, -1, 1 },
{ 9, 1, -1, -1, 1 },
{ 9, -1, -1, -1, -1 },
{ 9, -1, 1, 1, -1 },
{ 9, -1, 1, 1, 1 },
{ 9, 1, 1, 1, 1 },
{ 9, -1, -1, 1, -1 },
{ 9, 1, -1, 1, 1 },
{ 9, -1, 1, -1, -1 },
{ 9, -1, -1, 1, 1 },
{ 9, 1, 1, -1, -1 },
{ 9, 1, -1, -1, -1 },
{ 9, -1, -1, -1, 1 },
{ 9, 1, 1, -1, 1 },
{ 9, 1, 1, 1, -1 }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_2.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* 2-step huffman table HCB_2 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb2_1[] = {
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00100 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00110 */ 2, 0 },
{ /* 00111 */ 3, 0 },
{ /* 01000 */ 4, 0 },
{ /* 01001 */ 5, 0 },
{ /* 01010 */ 6, 0 },
{ /* 01011 */ 7, 0 },
{ /* 01100 */ 8, 0 },
/* 6 bit codewords */
{ /* 01101 */ 9, 1 },
{ /* 01110 */ 11, 1 },
{ /* 01111 */ 13, 1 },
{ /* 10000 */ 15, 1 },
{ /* 10001 */ 17, 1 },
{ /* 10010 */ 19, 1 },
{ /* 10011 */ 21, 1 },
{ /* 10100 */ 23, 1 },
{ /* 10101 */ 25, 1 },
{ /* 10110 */ 27, 1 },
{ /* 10111 */ 29, 1 },
{ /* 11000 */ 31, 1 },
/* 7 bit codewords */
{ /* 11001 */ 33, 2 },
{ /* 11010 */ 37, 2 },
{ /* 11011 */ 41, 2 },
/* 7/8 bit codewords */
{ /* 11100 */ 45, 3 },
/* 8 bit codewords */
{ /* 11101 */ 53, 3 },
{ /* 11110 */ 61, 3 },
/* 8/9 bit codewords */
{ /* 11111 */ 69, 4 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_quad hcb2_2[] = {
/* 3 bit codeword */
{ 3, 0, 0, 0, 0 },
/* 4 bit codeword */
{ 4, 1, 0, 0, 0 },
/* 5 bit codewords */
{ 5, -1, 0, 0, 0 },
{ 5, 0, 0, 0, 1 },
{ 5, 0, 0, -1, 0 },
{ 5, 0, 0, 0, -1 },
{ 5, 0, -1, 0, 0 },
{ 5, 0, 0, 1, 0 },
{ 5, 0, 1, 0, 0 },
/* 6 bit codewords */
{ 6, 0, -1, 1, 0 },
{ 6, -1, 1, 0, 0 },
{ 6, 0, 1, -1, 0 },
{ 6, 0, 0, 1, -1 },
{ 6, 0, 1, 0, -1 },
{ 6, 0, 0, -1, 1 },
{ 6, -1, 0, 0, -1 },
{ 6, 1, -1, 0, 0 },
{ 6, 1, 0, -1, 0 },
{ 6, -1, -1, 0, 0 },
{ 6, 0, 0, -1, -1 },
{ 6, 1, 0, 1, 0 },
{ 6, 1, 0, 0, 1 },
{ 6, 0, -1, 0, 1 },
{ 6, -1, 0, 1, 0 },
{ 6, 0, 1, 0, 1 },
{ 6, 0, -1, -1, 0 },
{ 6, -1, 0, 0, 1 },
{ 6, 0, -1, 0, -1 },
{ 6, -1, 0, -1, 0 },
{ 6, 1, 1, 0, 0 },
{ 6, 0, 1, 1, 0 },
{ 6, 0, 0, 1, 1 },
{ 6, 1, 0, 0, -1 },
/* 7 bit codewords */
{ 7, 0, 1, -1, 1 },
{ 7, 1, 0, -1, 1 },
{ 7, -1, 1, -1, 0 },
{ 7, 0, -1, 1, -1 },
{ 7, 1, -1, 1, 0 },
{ 7, 1, 1, 0, -1 },
{ 7, 1, 0, 1, 1 },
{ 7, -1, 1, 1, 0 },
{ 7, 0, -1, -1, 1 },
{ 7, 1, 1, 1, 0 },
{ 7, -1, 0, 1, -1 },
{ 7, -1, -1, -1, 0 },
/* 7/8 bit codewords */
{ 7, -1, 0, -1, 1 }, { 7, -1, 0, -1, 1 },
{ 7, 1, -1, -1, 0 }, { 7, 1, -1, -1, 0 },
{ 7, 1, 1, -1, 0 }, { 7, 1, 1, -1, 0 },
{ 8, 1, -1, 0, 1 },
{ 8, -1, 1, 0, -1 },
/* 8 bit codewords */
{ 8, -1, -1, 1, 0 },
{ 8, -1, 0, 1, 1 },
{ 8, -1, -1, 0, 1 },
{ 8, -1, -1, 0, -1 },
{ 8, 0, -1, -1, -1 },
{ 8, 1, 0, 1, -1 },
{ 8, 1, 0, -1, -1 },
{ 8, 0, 1, -1, -1 },
{ 8, 0, 1, 1, 1 },
{ 8, -1, 1, 0, 1 },
{ 8, -1, 0, -1, -1 },
{ 8, 0, 1, 1, -1 },
{ 8, 1, -1, 0, -1 },
{ 8, 0, -1, 1, 1 },
{ 8, 1, 1, 0, 1 },
{ 8, 1, -1, 1, -1 },
/* 8/9 bit codewords */
{ 8, -1, 1, -1, 1 }, { 8, -1, 1, -1, 1 },
{ 9, 1, -1, -1, 1 },
{ 9, -1, -1, -1, -1 },
{ 9, -1, 1, 1, -1 },
{ 9, -1, 1, 1, 1 },
{ 9, 1, 1, 1, 1 },
{ 9, -1, -1, 1, -1 },
{ 9, 1, -1, 1, 1 },
{ 9, -1, 1, -1, -1 },
{ 9, -1, -1, 1, 1 },
{ 9, 1, 1, -1, -1 },
{ 9, 1, -1, -1, -1 },
{ 9, -1, -1, -1, 1 },
{ 9, 1, 1, -1, 1 },
{ 9, 1, 1, 1, -1 }
};

389
src/contrib/aacdecoder/libfaad/codebook/hcb_3.h Normal file → Executable file
View File

@ -1,193 +1,196 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_3.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* Binary search huffman table HCB_3 */
static hcb_bin_quad hcb3[] = {
{ /* 0 */ 0, { 1, 2, 0, 0 } },
{ /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */
{ /* 2 */ 0, { 1, 2, 0, 0 } },
{ /* 3 */ 0, { 2, 3, 0, 0 } },
{ /* 4 */ 0, { 3, 4, 0, 0 } },
{ /* 5 */ 0, { 4, 5, 0, 0 } },
{ /* 6 */ 0, { 5, 6, 0, 0 } },
{ /* 7 */ 0, { 6, 7, 0, 0 } },
{ /* 8 */ 0, { 7, 8, 0, 0 } },
{ /* 9 */ 1, { 1, 0, 0, 0 } }, /* 1000 */
{ /* 10 */ 1, { 0, 0, 0, 1 } }, /* 1001 */
{ /* 11 */ 1, { 0, 1, 0, 0 } }, /* 1010 */
{ /* 12 */ 1, { 0, 0, 1, 0 } }, /* 1011 */
{ /* 13 */ 0, { 4, 5, 0, 0 } },
{ /* 14 */ 0, { 5, 6, 0, 0 } },
{ /* 15 */ 0, { 6, 7, 0, 0 } },
{ /* 16 */ 0, { 7, 8, 0, 0 } },
{ /* 17 */ 1, { 1, 1, 0, 0 } },
{ /* 18 */ 1, { 0, 0, 1, 1 } },
{ /* 19 */ 0, { 6, 7, 0, 0 } },
{ /* 20 */ 0, { 7, 8, 0, 0 } },
{ /* 21 */ 0, { 8, 9, 0, 0 } },
{ /* 22 */ 0, { 9, 10, 0, 0 } },
{ /* 23 */ 0, { 10, 11, 0, 0 } },
{ /* 24 */ 0, { 11, 12, 0, 0 } },
{ /* 25 */ 1, { 0, 1, 1, 0 } }, /* 110100 */
{ /* 26 */ 1, { 0, 1, 0, 1 } }, /* 110101 */
{ /* 27 */ 1, { 1, 0, 1, 0 } }, /* 110110 */
{ /* 28 */ 1, { 0, 1, 1, 1 } }, /* 110111 */
{ /* 29 */ 1, { 1, 0, 0, 1 } }, /* 111000 */
{ /* 30 */ 1, { 1, 1, 1, 0 } }, /* 111001 */
{ /* 31 */ 0, { 6, 7, 0, 0 } },
{ /* 32 */ 0, { 7, 8, 0, 0 } },
{ /* 33 */ 0, { 8, 9, 0, 0 } },
{ /* 34 */ 0, { 9, 10, 0, 0 } },
{ /* 35 */ 0, { 10, 11, 0, 0 } },
{ /* 36 */ 0, { 11, 12, 0, 0 } },
{ /* 37 */ 1, { 1, 1, 1, 1 } }, /* 1110100 */
{ /* 38 */ 1, { 1, 0, 1, 1 } }, /* 1110101 */
{ /* 39 */ 1, { 1, 1, 0, 1 } }, /* 1110110 */
{ /* 40 */ 0, { 9, 10, 0, 0 } },
{ /* 41 */ 0, { 10, 11, 0, 0 } },
{ /* 42 */ 0, { 11, 12, 0, 0 } },
{ /* 43 */ 0, { 12, 13, 0, 0 } },
{ /* 44 */ 0, { 13, 14, 0, 0 } },
{ /* 45 */ 0, { 14, 15, 0, 0 } },
{ /* 46 */ 0, { 15, 16, 0, 0 } },
{ /* 47 */ 0, { 16, 17, 0, 0 } },
{ /* 48 */ 0, { 17, 18, 0, 0 } },
{ /* 49 */ 1, { 2, 0, 0, 0 } }, /* 11101110 */
{ /* 50 */ 1, { 0, 0, 0, 2 } }, /* 11101111 */
{ /* 51 */ 1, { 0, 0, 1, 2 } }, /* 11110000 */
{ /* 52 */ 1, { 2, 1, 0, 0 } }, /* 11110001 */
{ /* 53 */ 1, { 1, 2, 1, 0 } }, /* 11110010 */
{ /* 54 */ 0, { 13, 14, 0, 0 } },
{ /* 55 */ 0, { 14, 15, 0, 0 } },
{ /* 56 */ 0, { 15, 16, 0, 0 } },
{ /* 57 */ 0, { 16, 17, 0, 0 } },
{ /* 58 */ 0, { 17, 18, 0, 0 } },
{ /* 59 */ 0, { 18, 19, 0, 0 } },
{ /* 60 */ 0, { 19, 20, 0, 0 } },
{ /* 61 */ 0, { 20, 21, 0, 0 } },
{ /* 62 */ 0, { 21, 22, 0, 0 } },
{ /* 63 */ 0, { 22, 23, 0, 0 } },
{ /* 64 */ 0, { 23, 24, 0, 0 } },
{ /* 65 */ 0, { 24, 25, 0, 0 } },
{ /* 66 */ 0, { 25, 26, 0, 0 } },
{ /* 67 */ 1, { 0, 0, 2, 1 } },
{ /* 68 */ 1, { 0, 1, 2, 1 } },
{ /* 69 */ 1, { 1, 2, 0, 0 } },
{ /* 70 */ 1, { 0, 1, 1, 2 } },
{ /* 71 */ 1, { 2, 1, 1, 0 } },
{ /* 72 */ 1, { 0, 0, 2, 0 } },
{ /* 73 */ 1, { 0, 2, 1, 0 } },
{ /* 74 */ 1, { 0, 1, 2, 0 } },
{ /* 75 */ 1, { 0, 2, 0, 0 } },
{ /* 76 */ 1, { 0, 1, 0, 2 } },
{ /* 77 */ 1, { 2, 0, 1, 0 } },
{ /* 78 */ 1, { 1, 2, 1, 1 } },
{ /* 79 */ 1, { 0, 2, 1, 1 } },
{ /* 80 */ 1, { 1, 1, 2, 0 } },
{ /* 81 */ 1, { 1, 1, 2, 1 } },
{ /* 82 */ 0, { 11, 12, 0, 0 } },
{ /* 83 */ 0, { 12, 13, 0, 0 } },
{ /* 84 */ 0, { 13, 14, 0, 0 } },
{ /* 85 */ 0, { 14, 15, 0, 0 } },
{ /* 86 */ 0, { 15, 16, 0, 0 } },
{ /* 87 */ 0, { 16, 17, 0, 0 } },
{ /* 88 */ 0, { 17, 18, 0, 0 } },
{ /* 89 */ 0, { 18, 19, 0, 0 } },
{ /* 90 */ 0, { 19, 20, 0, 0 } },
{ /* 91 */ 0, { 20, 21, 0, 0 } },
{ /* 92 */ 0, { 21, 22, 0, 0 } },
{ /* 93 */ 1, { 1, 2, 0, 1 } }, /* 1111101010 */
{ /* 94 */ 1, { 1, 0, 2, 0 } }, /* 1111101011 */
{ /* 95 */ 1, { 1, 0, 2, 1 } }, /* 1111101100 */
{ /* 96 */ 1, { 0, 2, 0, 1 } }, /* 1111101101 */
{ /* 97 */ 1, { 2, 1, 1, 1 } }, /* 1111101110 */
{ /* 98 */ 1, { 1, 1, 1, 2 } }, /* 1111101111 */
{ /* 99 */ 1, { 2, 1, 0, 1 } }, /* 1111110000 */
{ /* 00 */ 1, { 1, 0, 1, 2 } }, /* 1111110001 */
{ /* 01 */ 1, { 0, 0, 2, 2 } }, /* 1111110010 */
{ /* 02 */ 1, { 0, 1, 2, 2 } }, /* 1111110011 */
{ /* 03 */ 1, { 2, 2, 1, 0 } }, /* 1111110100 */
{ /* 04 */ 1, { 1, 2, 2, 0 } }, /* 1111110101 */
{ /* 05 */ 1, { 1, 0, 0, 2 } }, /* 1111110110 */
{ /* 06 */ 1, { 2, 0, 0, 1 } }, /* 1111110111 */
{ /* 07 */ 1, { 0, 2, 2, 1 } }, /* 1111111000 */
{ /* 08 */ 0, { 7, 8, 0, 0 } },
{ /* 09 */ 0, { 8, 9, 0, 0 } },
{ /* 10 */ 0, { 9, 10, 0, 0 } },
{ /* 11 */ 0, { 10, 11, 0, 0 } },
{ /* 12 */ 0, { 11, 12, 0, 0 } },
{ /* 13 */ 0, { 12, 13, 0, 0 } },
{ /* 14 */ 0, { 13, 14, 0, 0 } },
{ /* 15 */ 1, { 2, 2, 0, 0 } }, /* 11111110010 */
{ /* 16 */ 1, { 1, 2, 2, 1 } }, /* 11111110011 */
{ /* 17 */ 1, { 1, 1, 0, 2 } }, /* 11111110100 */
{ /* 18 */ 1, { 2, 0, 1, 1 } }, /* 11111110101 */
{ /* 19 */ 1, { 1, 1, 2, 2 } }, /* 11111110110 */
{ /* 20 */ 1, { 2, 2, 1, 1 } }, /* 11111110111 */
{ /* 21 */ 1, { 0, 2, 2, 0 } }, /* 11111111000 */
{ /* 22 */ 1, { 0, 2, 1, 2 } }, /* 11111111001 */
{ /* 23 */ 0, { 6, 7, 0, 0 } },
{ /* 24 */ 0, { 7, 8, 0, 0 } },
{ /* 25 */ 0, { 8, 9, 0, 0 } },
{ /* 26 */ 0, { 9, 10, 0, 0 } },
{ /* 27 */ 0, { 10, 11, 0, 0 } },
{ /* 28 */ 0, { 11, 12, 0, 0 } },
{ /* 29 */ 1, { 1, 0, 2, 2 } }, /* 111111110100 */
{ /* 30 */ 1, { 2, 2, 0, 1 } }, /* 111111110101 */
{ /* 31 */ 1, { 2, 1, 2, 0 } }, /* 111111110110 */
{ /* 32 */ 1, { 2, 2, 2, 0 } }, /* 111111110111 */
{ /* 33 */ 1, { 0, 2, 2, 2 } }, /* 111111111000 */
{ /* 34 */ 1, { 2, 2, 2, 1 } }, /* 111111111001 */
{ /* 35 */ 1, { 2, 1, 2, 1 } }, /* 111111111010 */
{ /* 36 */ 1, { 1, 2, 1, 2 } }, /* 111111111011 */
{ /* 37 */ 1, { 1, 2, 2, 2 } }, /* 111111111100 */
{ /* 38 */ 0, { 3, 4, 0, 0 } },
{ /* 39 */ 0, { 4, 5, 0, 0 } },
{ /* 40 */ 0, { 5, 6, 0, 0 } },
{ /* 41 */ 1, { 0, 2, 0, 2 } }, /* 1111111111010 */
{ /* 42 */ 1, { 2, 0, 2, 0 } }, /* 1111111111011 */
{ /* 43 */ 1, { 1, 2, 0, 2 } }, /* 1111111111100 */
{ /* 44 */ 0, { 3, 4, 0, 0 } },
{ /* 45 */ 0, { 4, 5, 0, 0 } },
{ /* 46 */ 0, { 5, 6, 0, 0 } },
{ /* 47 */ 1, { 2, 0, 2, 1 } }, /* 11111111111010 */
{ /* 48 */ 1, { 2, 1, 1, 2 } }, /* 11111111111011 */
{ /* 49 */ 1, { 2, 1, 0, 2 } }, /* 11111111111100 */
{ /* 50 */ 0, { 3, 4, 0, 0 } },
{ /* 51 */ 0, { 4, 5, 0, 0 } },
{ /* 52 */ 0, { 5, 6, 0, 0 } },
{ /* 53 */ 1, { 2, 2, 2, 2 } }, /* 111111111111010 */
{ /* 54 */ 1, { 2, 2, 1, 2 } }, /* 111111111111011 */
{ /* 55 */ 1, { 2, 1, 2, 2 } }, /* 111111111111100 */
{ /* 56 */ 1, { 2, 0, 1, 2 } }, /* 111111111111101 */
{ /* 57 */ 1, { 2, 0, 0, 2 } }, /* 111111111111110 */
{ /* 58 */ 0, { 1, 2, 0, 0 } },
{ /* 59 */ 1, { 2, 2, 0, 2 } }, /* 1111111111111110 */
{ /* 60 */ 1, { 2, 0, 2, 2 } } /* 1111111111111111 */
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_3.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* Binary search huffman table HCB_3 */
static hcb_bin_quad hcb3[] = {
{ /* 0 */ 0, { 1, 2, 0, 0 } },
{ /* 1 */ 1, { 0, 0, 0, 0 } }, /* 0 */
{ /* 2 */ 0, { 1, 2, 0, 0 } },
{ /* 3 */ 0, { 2, 3, 0, 0 } },
{ /* 4 */ 0, { 3, 4, 0, 0 } },
{ /* 5 */ 0, { 4, 5, 0, 0 } },
{ /* 6 */ 0, { 5, 6, 0, 0 } },
{ /* 7 */ 0, { 6, 7, 0, 0 } },
{ /* 8 */ 0, { 7, 8, 0, 0 } },
{ /* 9 */ 1, { 1, 0, 0, 0 } }, /* 1000 */
{ /* 10 */ 1, { 0, 0, 0, 1 } }, /* 1001 */
{ /* 11 */ 1, { 0, 1, 0, 0 } }, /* 1010 */
{ /* 12 */ 1, { 0, 0, 1, 0 } }, /* 1011 */
{ /* 13 */ 0, { 4, 5, 0, 0 } },
{ /* 14 */ 0, { 5, 6, 0, 0 } },
{ /* 15 */ 0, { 6, 7, 0, 0 } },
{ /* 16 */ 0, { 7, 8, 0, 0 } },
{ /* 17 */ 1, { 1, 1, 0, 0 } },
{ /* 18 */ 1, { 0, 0, 1, 1 } },
{ /* 19 */ 0, { 6, 7, 0, 0 } },
{ /* 20 */ 0, { 7, 8, 0, 0 } },
{ /* 21 */ 0, { 8, 9, 0, 0 } },
{ /* 22 */ 0, { 9, 10, 0, 0 } },
{ /* 23 */ 0, { 10, 11, 0, 0 } },
{ /* 24 */ 0, { 11, 12, 0, 0 } },
{ /* 25 */ 1, { 0, 1, 1, 0 } }, /* 110100 */
{ /* 26 */ 1, { 0, 1, 0, 1 } }, /* 110101 */
{ /* 27 */ 1, { 1, 0, 1, 0 } }, /* 110110 */
{ /* 28 */ 1, { 0, 1, 1, 1 } }, /* 110111 */
{ /* 29 */ 1, { 1, 0, 0, 1 } }, /* 111000 */
{ /* 30 */ 1, { 1, 1, 1, 0 } }, /* 111001 */
{ /* 31 */ 0, { 6, 7, 0, 0 } },
{ /* 32 */ 0, { 7, 8, 0, 0 } },
{ /* 33 */ 0, { 8, 9, 0, 0 } },
{ /* 34 */ 0, { 9, 10, 0, 0 } },
{ /* 35 */ 0, { 10, 11, 0, 0 } },
{ /* 36 */ 0, { 11, 12, 0, 0 } },
{ /* 37 */ 1, { 1, 1, 1, 1 } }, /* 1110100 */
{ /* 38 */ 1, { 1, 0, 1, 1 } }, /* 1110101 */
{ /* 39 */ 1, { 1, 1, 0, 1 } }, /* 1110110 */
{ /* 40 */ 0, { 9, 10, 0, 0 } },
{ /* 41 */ 0, { 10, 11, 0, 0 } },
{ /* 42 */ 0, { 11, 12, 0, 0 } },
{ /* 43 */ 0, { 12, 13, 0, 0 } },
{ /* 44 */ 0, { 13, 14, 0, 0 } },
{ /* 45 */ 0, { 14, 15, 0, 0 } },
{ /* 46 */ 0, { 15, 16, 0, 0 } },
{ /* 47 */ 0, { 16, 17, 0, 0 } },
{ /* 48 */ 0, { 17, 18, 0, 0 } },
{ /* 49 */ 1, { 2, 0, 0, 0 } }, /* 11101110 */
{ /* 50 */ 1, { 0, 0, 0, 2 } }, /* 11101111 */
{ /* 51 */ 1, { 0, 0, 1, 2 } }, /* 11110000 */
{ /* 52 */ 1, { 2, 1, 0, 0 } }, /* 11110001 */
{ /* 53 */ 1, { 1, 2, 1, 0 } }, /* 11110010 */
{ /* 54 */ 0, { 13, 14, 0, 0 } },
{ /* 55 */ 0, { 14, 15, 0, 0 } },
{ /* 56 */ 0, { 15, 16, 0, 0 } },
{ /* 57 */ 0, { 16, 17, 0, 0 } },
{ /* 58 */ 0, { 17, 18, 0, 0 } },
{ /* 59 */ 0, { 18, 19, 0, 0 } },
{ /* 60 */ 0, { 19, 20, 0, 0 } },
{ /* 61 */ 0, { 20, 21, 0, 0 } },
{ /* 62 */ 0, { 21, 22, 0, 0 } },
{ /* 63 */ 0, { 22, 23, 0, 0 } },
{ /* 64 */ 0, { 23, 24, 0, 0 } },
{ /* 65 */ 0, { 24, 25, 0, 0 } },
{ /* 66 */ 0, { 25, 26, 0, 0 } },
{ /* 67 */ 1, { 0, 0, 2, 1 } },
{ /* 68 */ 1, { 0, 1, 2, 1 } },
{ /* 69 */ 1, { 1, 2, 0, 0 } },
{ /* 70 */ 1, { 0, 1, 1, 2 } },
{ /* 71 */ 1, { 2, 1, 1, 0 } },
{ /* 72 */ 1, { 0, 0, 2, 0 } },
{ /* 73 */ 1, { 0, 2, 1, 0 } },
{ /* 74 */ 1, { 0, 1, 2, 0 } },
{ /* 75 */ 1, { 0, 2, 0, 0 } },
{ /* 76 */ 1, { 0, 1, 0, 2 } },
{ /* 77 */ 1, { 2, 0, 1, 0 } },
{ /* 78 */ 1, { 1, 2, 1, 1 } },
{ /* 79 */ 1, { 0, 2, 1, 1 } },
{ /* 80 */ 1, { 1, 1, 2, 0 } },
{ /* 81 */ 1, { 1, 1, 2, 1 } },
{ /* 82 */ 0, { 11, 12, 0, 0 } },
{ /* 83 */ 0, { 12, 13, 0, 0 } },
{ /* 84 */ 0, { 13, 14, 0, 0 } },
{ /* 85 */ 0, { 14, 15, 0, 0 } },
{ /* 86 */ 0, { 15, 16, 0, 0 } },
{ /* 87 */ 0, { 16, 17, 0, 0 } },
{ /* 88 */ 0, { 17, 18, 0, 0 } },
{ /* 89 */ 0, { 18, 19, 0, 0 } },
{ /* 90 */ 0, { 19, 20, 0, 0 } },
{ /* 91 */ 0, { 20, 21, 0, 0 } },
{ /* 92 */ 0, { 21, 22, 0, 0 } },
{ /* 93 */ 1, { 1, 2, 0, 1 } }, /* 1111101010 */
{ /* 94 */ 1, { 1, 0, 2, 0 } }, /* 1111101011 */
{ /* 95 */ 1, { 1, 0, 2, 1 } }, /* 1111101100 */
{ /* 96 */ 1, { 0, 2, 0, 1 } }, /* 1111101101 */
{ /* 97 */ 1, { 2, 1, 1, 1 } }, /* 1111101110 */
{ /* 98 */ 1, { 1, 1, 1, 2 } }, /* 1111101111 */
{ /* 99 */ 1, { 2, 1, 0, 1 } }, /* 1111110000 */
{ /* 00 */ 1, { 1, 0, 1, 2 } }, /* 1111110001 */
{ /* 01 */ 1, { 0, 0, 2, 2 } }, /* 1111110010 */
{ /* 02 */ 1, { 0, 1, 2, 2 } }, /* 1111110011 */
{ /* 03 */ 1, { 2, 2, 1, 0 } }, /* 1111110100 */
{ /* 04 */ 1, { 1, 2, 2, 0 } }, /* 1111110101 */
{ /* 05 */ 1, { 1, 0, 0, 2 } }, /* 1111110110 */
{ /* 06 */ 1, { 2, 0, 0, 1 } }, /* 1111110111 */
{ /* 07 */ 1, { 0, 2, 2, 1 } }, /* 1111111000 */
{ /* 08 */ 0, { 7, 8, 0, 0 } },
{ /* 09 */ 0, { 8, 9, 0, 0 } },
{ /* 10 */ 0, { 9, 10, 0, 0 } },
{ /* 11 */ 0, { 10, 11, 0, 0 } },
{ /* 12 */ 0, { 11, 12, 0, 0 } },
{ /* 13 */ 0, { 12, 13, 0, 0 } },
{ /* 14 */ 0, { 13, 14, 0, 0 } },
{ /* 15 */ 1, { 2, 2, 0, 0 } }, /* 11111110010 */
{ /* 16 */ 1, { 1, 2, 2, 1 } }, /* 11111110011 */
{ /* 17 */ 1, { 1, 1, 0, 2 } }, /* 11111110100 */
{ /* 18 */ 1, { 2, 0, 1, 1 } }, /* 11111110101 */
{ /* 19 */ 1, { 1, 1, 2, 2 } }, /* 11111110110 */
{ /* 20 */ 1, { 2, 2, 1, 1 } }, /* 11111110111 */
{ /* 21 */ 1, { 0, 2, 2, 0 } }, /* 11111111000 */
{ /* 22 */ 1, { 0, 2, 1, 2 } }, /* 11111111001 */
{ /* 23 */ 0, { 6, 7, 0, 0 } },
{ /* 24 */ 0, { 7, 8, 0, 0 } },
{ /* 25 */ 0, { 8, 9, 0, 0 } },
{ /* 26 */ 0, { 9, 10, 0, 0 } },
{ /* 27 */ 0, { 10, 11, 0, 0 } },
{ /* 28 */ 0, { 11, 12, 0, 0 } },
{ /* 29 */ 1, { 1, 0, 2, 2 } }, /* 111111110100 */
{ /* 30 */ 1, { 2, 2, 0, 1 } }, /* 111111110101 */
{ /* 31 */ 1, { 2, 1, 2, 0 } }, /* 111111110110 */
{ /* 32 */ 1, { 2, 2, 2, 0 } }, /* 111111110111 */
{ /* 33 */ 1, { 0, 2, 2, 2 } }, /* 111111111000 */
{ /* 34 */ 1, { 2, 2, 2, 1 } }, /* 111111111001 */
{ /* 35 */ 1, { 2, 1, 2, 1 } }, /* 111111111010 */
{ /* 36 */ 1, { 1, 2, 1, 2 } }, /* 111111111011 */
{ /* 37 */ 1, { 1, 2, 2, 2 } }, /* 111111111100 */
{ /* 38 */ 0, { 3, 4, 0, 0 } },
{ /* 39 */ 0, { 4, 5, 0, 0 } },
{ /* 40 */ 0, { 5, 6, 0, 0 } },
{ /* 41 */ 1, { 0, 2, 0, 2 } }, /* 1111111111010 */
{ /* 42 */ 1, { 2, 0, 2, 0 } }, /* 1111111111011 */
{ /* 43 */ 1, { 1, 2, 0, 2 } }, /* 1111111111100 */
{ /* 44 */ 0, { 3, 4, 0, 0 } },
{ /* 45 */ 0, { 4, 5, 0, 0 } },
{ /* 46 */ 0, { 5, 6, 0, 0 } },
{ /* 47 */ 1, { 2, 0, 2, 1 } }, /* 11111111111010 */
{ /* 48 */ 1, { 2, 1, 1, 2 } }, /* 11111111111011 */
{ /* 49 */ 1, { 2, 1, 0, 2 } }, /* 11111111111100 */
{ /* 50 */ 0, { 3, 4, 0, 0 } },
{ /* 51 */ 0, { 4, 5, 0, 0 } },
{ /* 52 */ 0, { 5, 6, 0, 0 } },
{ /* 53 */ 1, { 2, 2, 2, 2 } }, /* 111111111111010 */
{ /* 54 */ 1, { 2, 2, 1, 2 } }, /* 111111111111011 */
{ /* 55 */ 1, { 2, 1, 2, 2 } }, /* 111111111111100 */
{ /* 56 */ 1, { 2, 0, 1, 2 } }, /* 111111111111101 */
{ /* 57 */ 1, { 2, 0, 0, 2 } }, /* 111111111111110 */
{ /* 58 */ 0, { 1, 2, 0, 0 } },
{ /* 59 */ 1, { 2, 2, 0, 2 } }, /* 1111111111111110 */
{ /* 60 */ 1, { 2, 0, 2, 2 } } /* 1111111111111111 */
};

395
src/contrib/aacdecoder/libfaad/codebook/hcb_4.h Normal file → Executable file
View File

@ -1,196 +1,199 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_4.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* 2-step huffman table HCB_4 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb4_1[] = {
/* 4 bit codewords */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00010 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00100 */ 2, 0 },
{ /* */ 2, 0 },
{ /* 00110 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 01000 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 01010 */ 5, 0 },
{ /* */ 5, 0 },
{ /* 01100 */ 6, 0 },
{ /* */ 6, 0 },
{ /* 01110 */ 7, 0 },
{ /* */ 7, 0 },
{ /* 10000 */ 8, 0 },
{ /* */ 8, 0 },
{ /* 10010 */ 9, 0 },
{ /* */ 9, 0 },
/* 5 bit codewords */
{ /* 10100 */ 10, 0 },
{ /* 10101 */ 11, 0 },
{ /* 10110 */ 12, 0 },
{ /* 10111 */ 13, 0 },
{ /* 11000 */ 14, 0 },
{ /* 11001 */ 15, 0 },
/* 7 bit codewords */
{ /* 11010 */ 16, 2 },
{ /* 11011 */ 20, 2 },
/* 7/8 bit codewords */
{ /* 11100 */ 24, 3 },
/* 8 bit codewords */
{ /* 11101 */ 32, 3 },
/* 8/9 bit codewords */
{ /* 11110 */ 40, 4 },
/* 9/10/11/12 bit codewords */
{ /* 11111 */ 56, 7 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_quad hcb4_2[] = {
/* 4 bit codewords */
{ 4, 1, 1, 1, 1 },
{ 4, 0, 1, 1, 1 },
{ 4, 1, 1, 0, 1 },
{ 4, 1, 1, 1, 0 },
{ 4, 1, 0, 1, 1 },
{ 4, 1, 0, 0, 0 },
{ 4, 1, 1, 0, 0 },
{ 4, 0, 0, 0, 0 },
{ 4, 0, 0, 1, 1 },
{ 4, 1, 0, 1, 0 },
/* 5 bit codewords */
{ 5, 1, 0, 0, 1 },
{ 5, 0, 1, 1, 0 },
{ 5, 0, 0, 0, 1 },
{ 5, 0, 1, 0, 1 },
{ 5, 0, 0, 1, 0 },
{ 5, 0, 1, 0, 0 },
/* 7 bit codewords */
/* first 5 bits: 11010 */
{ 7, 2, 1, 1, 1 },
{ 7, 1, 1, 2, 1 },
{ 7, 1, 2, 1, 1 },
{ 7, 1, 1, 1, 2 },
/* first 5 bits: 11011 */
{ 7, 2, 1, 1, 0 },
{ 7, 2, 1, 0, 1 },
{ 7, 1, 2, 1, 0 },
{ 7, 2, 0, 1, 1 },
/* 7/8 bit codewords */
/* first 5 bits: 11100 */
{ 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 },
{ 8, 0, 1, 1, 2 },
{ 8, 1, 1, 2, 0 },
{ 8, 0, 2, 1, 1 },
{ 8, 1, 0, 1, 2 },
{ 8, 1, 2, 0, 1 },
{ 8, 1, 1, 0, 2 },
/* 8 bit codewords */
{ 8, 1, 0, 2, 1 },
{ 8, 2, 1, 0, 0 },
{ 8, 2, 0, 1, 0 },
{ 8, 1, 2, 0, 0 },
{ 8, 2, 0, 0, 1 },
{ 8, 0, 1, 0, 2 },
{ 8, 0, 2, 1, 0 },
{ 8, 0, 0, 1, 2 },
/* 8/9 bit codewords */
{ 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 },
{ 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 },
{ 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 },
{ 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 },
{ 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 },
{ 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 },
{ 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 },
{ 9, 0, 2, 0, 0 },
{ 9, 0, 0, 2, 0 },
/* 9/10/11 bit codewords */
/* 9 bit codewords repeated 2^3 = 8 times */
{ 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
{ 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
{ 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
{ 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
{ 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
{ 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
{ 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
{ 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
{ 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
{ 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
{ 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
{ 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
/* 10 bit codewords repeated 2^2 = 4 times */
{ 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 },
{ 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 },
{ 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 },
{ 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 },
{ 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 },
{ 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 },
{ 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 },
{ 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 },
{ 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 },
{ 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 },
{ 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 },
{ 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 },
{ 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 },
{ 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 },
/* 11 bit codewords repeated 2^1 = 2 times */
{ 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 },
{ 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 },
{ 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 },
{ 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 },
{ 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 },
{ 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 },
{ 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 },
{ 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 },
{ 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 },
{ 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 },
{ 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 },
/* 12 bit codewords */
{ 12, 2, 2, 0, 2 },
{ 12, 2, 0, 2, 2 },
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_4.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* 2-step huffman table HCB_4 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb4_1[] = {
/* 4 bit codewords */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00010 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00100 */ 2, 0 },
{ /* */ 2, 0 },
{ /* 00110 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 01000 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 01010 */ 5, 0 },
{ /* */ 5, 0 },
{ /* 01100 */ 6, 0 },
{ /* */ 6, 0 },
{ /* 01110 */ 7, 0 },
{ /* */ 7, 0 },
{ /* 10000 */ 8, 0 },
{ /* */ 8, 0 },
{ /* 10010 */ 9, 0 },
{ /* */ 9, 0 },
/* 5 bit codewords */
{ /* 10100 */ 10, 0 },
{ /* 10101 */ 11, 0 },
{ /* 10110 */ 12, 0 },
{ /* 10111 */ 13, 0 },
{ /* 11000 */ 14, 0 },
{ /* 11001 */ 15, 0 },
/* 7 bit codewords */
{ /* 11010 */ 16, 2 },
{ /* 11011 */ 20, 2 },
/* 7/8 bit codewords */
{ /* 11100 */ 24, 3 },
/* 8 bit codewords */
{ /* 11101 */ 32, 3 },
/* 8/9 bit codewords */
{ /* 11110 */ 40, 4 },
/* 9/10/11/12 bit codewords */
{ /* 11111 */ 56, 7 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_quad hcb4_2[] = {
/* 4 bit codewords */
{ 4, 1, 1, 1, 1 },
{ 4, 0, 1, 1, 1 },
{ 4, 1, 1, 0, 1 },
{ 4, 1, 1, 1, 0 },
{ 4, 1, 0, 1, 1 },
{ 4, 1, 0, 0, 0 },
{ 4, 1, 1, 0, 0 },
{ 4, 0, 0, 0, 0 },
{ 4, 0, 0, 1, 1 },
{ 4, 1, 0, 1, 0 },
/* 5 bit codewords */
{ 5, 1, 0, 0, 1 },
{ 5, 0, 1, 1, 0 },
{ 5, 0, 0, 0, 1 },
{ 5, 0, 1, 0, 1 },
{ 5, 0, 0, 1, 0 },
{ 5, 0, 1, 0, 0 },
/* 7 bit codewords */
/* first 5 bits: 11010 */
{ 7, 2, 1, 1, 1 },
{ 7, 1, 1, 2, 1 },
{ 7, 1, 2, 1, 1 },
{ 7, 1, 1, 1, 2 },
/* first 5 bits: 11011 */
{ 7, 2, 1, 1, 0 },
{ 7, 2, 1, 0, 1 },
{ 7, 1, 2, 1, 0 },
{ 7, 2, 0, 1, 1 },
/* 7/8 bit codewords */
/* first 5 bits: 11100 */
{ 7, 0, 1, 2, 1 }, { 7, 0, 1, 2, 1 },
{ 8, 0, 1, 1, 2 },
{ 8, 1, 1, 2, 0 },
{ 8, 0, 2, 1, 1 },
{ 8, 1, 0, 1, 2 },
{ 8, 1, 2, 0, 1 },
{ 8, 1, 1, 0, 2 },
/* 8 bit codewords */
{ 8, 1, 0, 2, 1 },
{ 8, 2, 1, 0, 0 },
{ 8, 2, 0, 1, 0 },
{ 8, 1, 2, 0, 0 },
{ 8, 2, 0, 0, 1 },
{ 8, 0, 1, 0, 2 },
{ 8, 0, 2, 1, 0 },
{ 8, 0, 0, 1, 2 },
/* 8/9 bit codewords */
{ 8, 0, 1, 2, 0 }, { 8, 0, 1, 2, 0 },
{ 8, 0, 2, 0, 1 }, { 8, 0, 2, 0, 1 },
{ 8, 1, 0, 0, 2 }, { 8, 1, 0, 0, 2 },
{ 8, 0, 0, 2, 1 }, { 8, 0, 0, 2, 1 },
{ 8, 1, 0, 2, 0 }, { 8, 1, 0, 2, 0 },
{ 8, 2, 0, 0, 0 }, { 8, 2, 0, 0, 0 },
{ 8, 0, 0, 0, 2 }, { 8, 0, 0, 0, 2 },
{ 9, 0, 2, 0, 0 },
{ 9, 0, 0, 2, 0 },
/* 9/10/11 bit codewords */
/* 9 bit codewords repeated 2^3 = 8 times */
{ 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
{ 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 }, { 9, 1, 2, 2, 1 },
{ 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
{ 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 }, { 9, 2, 2, 1, 1 },
{ 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
{ 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 }, { 9, 2, 1, 2, 1 },
{ 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
{ 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 }, { 9, 1, 1, 2, 2 },
{ 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
{ 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 }, { 9, 1, 2, 1, 2 },
{ 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
{ 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 }, { 9, 2, 1, 1, 2 },
/* 10 bit codewords repeated 2^2 = 4 times */
{ 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 }, { 10, 1, 2, 2, 0 },
{ 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 }, { 10, 2, 2, 1, 0 },
{ 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 }, { 10, 2, 1, 2, 0 },
{ 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 }, { 10, 0, 2, 2, 1 },
{ 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 }, { 10, 0, 1, 2, 2 },
{ 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 }, { 10, 2, 2, 0, 1 },
{ 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 }, { 10, 0, 2, 1, 2 },
{ 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 }, { 10, 2, 0, 2, 1 },
{ 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 }, { 10, 1, 0, 2, 2 },
{ 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 }, { 10, 2, 2, 2, 1 },
{ 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 }, { 10, 1, 2, 0, 2 },
{ 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 }, { 10, 2, 0, 1, 2 },
{ 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 }, { 10, 2, 1, 0, 2 },
{ 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 }, { 10, 1, 2, 2, 2 },
/* 11 bit codewords repeated 2^1 = 2 times */
{ 11, 2, 1, 2, 2 }, { 11, 2, 1, 2, 2 },
{ 11, 2, 2, 1, 2 }, { 11, 2, 2, 1, 2 },
{ 11, 0, 2, 2, 0 }, { 11, 0, 2, 2, 0 },
{ 11, 2, 2, 0, 0 }, { 11, 2, 2, 0, 0 },
{ 11, 0, 0, 2, 2 }, { 11, 0, 0, 2, 2 },
{ 11, 2, 0, 2, 0 }, { 11, 2, 0, 2, 0 },
{ 11, 0, 2, 0, 2 }, { 11, 0, 2, 0, 2 },
{ 11, 2, 0, 0, 2 }, { 11, 2, 0, 0, 2 },
{ 11, 2, 2, 2, 2 }, { 11, 2, 2, 2, 2 },
{ 11, 0, 2, 2, 2 }, { 11, 0, 2, 2, 2 },
{ 11, 2, 2, 2, 0 }, { 11, 2, 2, 2, 0 },
/* 12 bit codewords */
{ 12, 2, 2, 0, 2 },
{ 12, 2, 0, 2, 2 },
};

389
src/contrib/aacdecoder/libfaad/codebook/hcb_5.h Normal file → Executable file
View File

@ -1,193 +1,196 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_5.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* Binary search huffman table HCB_5 */
static hcb_bin_pair hcb5[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } }, /* 0 */
{ /* 2 */ 0, { 1, 2 } },
{ /* 3 */ 0, { 2, 3 } },
{ /* 4 */ 0, { 3, 4 } },
{ /* 5 */ 0, { 4, 5 } },
{ /* 6 */ 0, { 5, 6 } },
{ /* 7 */ 0, { 6, 7 } },
{ /* 8 */ 0, { 7, 8 } },
{ /* 9 */ 1, { -1, 0 } }, /* 1000 */
{ /* 10 */ 1, { 1, 0 } }, /* 1001 */
{ /* 11 */ 1, { 0, 1 } }, /* 1010 */
{ /* 12 */ 1, { 0, -1 } }, /* 1011 */
{ /* 13 */ 0, { 4, 5 } },
{ /* 14 */ 0, { 5, 6 } },
{ /* 15 */ 0, { 6, 7 } },
{ /* 16 */ 0, { 7, 8 } },
{ /* 17 */ 1, { 1, -1 } },
{ /* 18 */ 1, { -1, 1 } },
{ /* 19 */ 1, { -1, -1 } },
{ /* 20 */ 1, { 1, 1 } },
{ /* 21 */ 0, { 4, 5 } },
{ /* 22 */ 0, { 5, 6 } },
{ /* 23 */ 0, { 6, 7 } },
{ /* 24 */ 0, { 7, 8 } },
{ /* 25 */ 0, { 8, 9 } },
{ /* 26 */ 0, { 9, 10 } },
{ /* 27 */ 0, { 10, 11 } },
{ /* 28 */ 0, { 11, 12 } },
{ /* 29 */ 0, { 12, 13 } },
{ /* 30 */ 0, { 13, 14 } },
{ /* 31 */ 0, { 14, 15 } },
{ /* 32 */ 0, { 15, 16 } },
{ /* 33 */ 1, { -2, 0 } },
{ /* 34 */ 1, { 0, 2 } },
{ /* 35 */ 1, { 2, 0 } },
{ /* 36 */ 1, { 0, -2 } },
{ /* 37 */ 0, { 12, 13 } },
{ /* 38 */ 0, { 13, 14 } },
{ /* 39 */ 0, { 14, 15 } },
{ /* 40 */ 0, { 15, 16 } },
{ /* 41 */ 0, { 16, 17 } },
{ /* 42 */ 0, { 17, 18 } },
{ /* 43 */ 0, { 18, 19 } },
{ /* 44 */ 0, { 19, 20 } },
{ /* 45 */ 0, { 20, 21 } },
{ /* 46 */ 0, { 21, 22 } },
{ /* 47 */ 0, { 22, 23 } },
{ /* 48 */ 0, { 23, 24 } },
{ /* 49 */ 1, { -2, -1 } },
{ /* 50 */ 1, { 2, 1 } },
{ /* 51 */ 1, { -1, -2 } },
{ /* 52 */ 1, { 1, 2 } },
{ /* 53 */ 1, { -2, 1 } },
{ /* 54 */ 1, { 2, -1 } },
{ /* 55 */ 1, { -1, 2 } },
{ /* 56 */ 1, { 1, -2 } },
{ /* 57 */ 1, { -3, 0 } },
{ /* 58 */ 1, { 3, 0 } },
{ /* 59 */ 1, { 0, -3 } },
{ /* 60 */ 1, { 0, 3 } },
{ /* 61 */ 0, { 12, 13 } },
{ /* 62 */ 0, { 13, 14 } },
{ /* 63 */ 0, { 14, 15 } },
{ /* 64 */ 0, { 15, 16 } },
{ /* 65 */ 0, { 16, 17 } },
{ /* 66 */ 0, { 17, 18 } },
{ /* 67 */ 0, { 18, 19 } },
{ /* 68 */ 0, { 19, 20 } },
{ /* 69 */ 0, { 20, 21 } },
{ /* 70 */ 0, { 21, 22 } },
{ /* 71 */ 0, { 22, 23 } },
{ /* 72 */ 0, { 23, 24 } },
{ /* 73 */ 1, { -3, -1 } },
{ /* 74 */ 1, { 1, 3 } },
{ /* 75 */ 1, { 3, 1 } },
{ /* 76 */ 1, { -1, -3 } },
{ /* 77 */ 1, { -3, 1 } },
{ /* 78 */ 1, { 3, -1 } },
{ /* 79 */ 1, { 1, -3 } },
{ /* 80 */ 1, { -1, 3 } },
{ /* 81 */ 1, { -2, 2 } },
{ /* 82 */ 1, { 2, 2 } },
{ /* 83 */ 1, { -2, -2 } },
{ /* 84 */ 1, { 2, -2 } },
{ /* 85 */ 0, { 12, 13 } },
{ /* 86 */ 0, { 13, 14 } },
{ /* 87 */ 0, { 14, 15 } },
{ /* 88 */ 0, { 15, 16 } },
{ /* 89 */ 0, { 16, 17 } },
{ /* 90 */ 0, { 17, 18 } },
{ /* 91 */ 0, { 18, 19 } },
{ /* 92 */ 0, { 19, 20 } },
{ /* 93 */ 0, { 20, 21 } },
{ /* 94 */ 0, { 21, 22 } },
{ /* 95 */ 0, { 22, 23 } },
{ /* 96 */ 0, { 23, 24 } },
{ /* 97 */ 1, { -3, -2 } },
{ /* 98 */ 1, { 3, -2 } },
{ /* 99 */ 1, { -2, 3 } },
{ /* 00 */ 1, { 2, -3 } },
{ /* 01 */ 1, { 3, 2 } },
{ /* 02 */ 1, { 2, 3 } },
{ /* 03 */ 1, { -3, 2 } },
{ /* 04 */ 1, { -2, -3 } },
{ /* 05 */ 1, { 0, -4 } },
{ /* 06 */ 1, { -4, 0 } },
{ /* 07 */ 1, { 4, 1 } },
{ /* 08 */ 1, { 4, 0 } },
{ /* 09 */ 0, { 12, 13 } },
{ /* 10 */ 0, { 13, 14 } },
{ /* 11 */ 0, { 14, 15 } },
{ /* 12 */ 0, { 15, 16 } },
{ /* 13 */ 0, { 16, 17 } },
{ /* 14 */ 0, { 17, 18 } },
{ /* 15 */ 0, { 18, 19 } },
{ /* 16 */ 0, { 19, 20 } },
{ /* 17 */ 0, { 20, 21 } },
{ /* 18 */ 0, { 21, 22 } },
{ /* 19 */ 0, { 22, 23 } },
{ /* 20 */ 0, { 23, 24 } },
{ /* 21 */ 1, { -4, -1 } },
{ /* 22 */ 1, { 0, 4 } },
{ /* 23 */ 1, { 4, -1 } },
{ /* 24 */ 1, { -1, -4 } },
{ /* 25 */ 1, { 1, 4 } },
{ /* 26 */ 1, { -1, 4 } },
{ /* 27 */ 1, { -4, 1 } },
{ /* 28 */ 1, { 1, -4 } },
{ /* 29 */ 1, { 3, -3 } },
{ /* 30 */ 1, { -3, -3 } },
{ /* 31 */ 1, { -3, 3 } },
{ /* 32 */ 1, { -2, 4 } },
{ /* 33 */ 1, { -4, -2 } },
{ /* 34 */ 1, { 4, 2 } },
{ /* 35 */ 1, { 2, -4 } },
{ /* 36 */ 1, { 2, 4 } },
{ /* 37 */ 1, { 3, 3 } },
{ /* 38 */ 1, { -4, 2 } },
{ /* 39 */ 0, { 6, 7 } },
{ /* 40 */ 0, { 7, 8 } },
{ /* 41 */ 0, { 8, 9 } },
{ /* 42 */ 0, { 9, 10 } },
{ /* 43 */ 0, { 10, 11 } },
{ /* 44 */ 0, { 11, 12 } },
{ /* 45 */ 1, { -2, -4 } },
{ /* 46 */ 1, { 4, -2 } },
{ /* 47 */ 1, { 3, -4 } },
{ /* 48 */ 1, { -4, -3 } },
{ /* 49 */ 1, { -4, 3 } },
{ /* 50 */ 1, { 3, 4 } },
{ /* 51 */ 1, { -3, 4 } },
{ /* 52 */ 1, { 4, 3 } },
{ /* 53 */ 1, { 4, -3 } },
{ /* 54 */ 1, { -3, -4 } },
{ /* 55 */ 0, { 2, 3 } },
{ /* 56 */ 0, { 3, 4 } },
{ /* 57 */ 1, { 4, -4 } },
{ /* 58 */ 1, { -4, 4 } },
{ /* 59 */ 1, { 4, 4 } },
{ /* 60 */ 1, { -4, -4 } }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_5.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* Binary search huffman table HCB_5 */
static hcb_bin_pair hcb5[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } }, /* 0 */
{ /* 2 */ 0, { 1, 2 } },
{ /* 3 */ 0, { 2, 3 } },
{ /* 4 */ 0, { 3, 4 } },
{ /* 5 */ 0, { 4, 5 } },
{ /* 6 */ 0, { 5, 6 } },
{ /* 7 */ 0, { 6, 7 } },
{ /* 8 */ 0, { 7, 8 } },
{ /* 9 */ 1, { -1, 0 } }, /* 1000 */
{ /* 10 */ 1, { 1, 0 } }, /* 1001 */
{ /* 11 */ 1, { 0, 1 } }, /* 1010 */
{ /* 12 */ 1, { 0, -1 } }, /* 1011 */
{ /* 13 */ 0, { 4, 5 } },
{ /* 14 */ 0, { 5, 6 } },
{ /* 15 */ 0, { 6, 7 } },
{ /* 16 */ 0, { 7, 8 } },
{ /* 17 */ 1, { 1, -1 } },
{ /* 18 */ 1, { -1, 1 } },
{ /* 19 */ 1, { -1, -1 } },
{ /* 20 */ 1, { 1, 1 } },
{ /* 21 */ 0, { 4, 5 } },
{ /* 22 */ 0, { 5, 6 } },
{ /* 23 */ 0, { 6, 7 } },
{ /* 24 */ 0, { 7, 8 } },
{ /* 25 */ 0, { 8, 9 } },
{ /* 26 */ 0, { 9, 10 } },
{ /* 27 */ 0, { 10, 11 } },
{ /* 28 */ 0, { 11, 12 } },
{ /* 29 */ 0, { 12, 13 } },
{ /* 30 */ 0, { 13, 14 } },
{ /* 31 */ 0, { 14, 15 } },
{ /* 32 */ 0, { 15, 16 } },
{ /* 33 */ 1, { -2, 0 } },
{ /* 34 */ 1, { 0, 2 } },
{ /* 35 */ 1, { 2, 0 } },
{ /* 36 */ 1, { 0, -2 } },
{ /* 37 */ 0, { 12, 13 } },
{ /* 38 */ 0, { 13, 14 } },
{ /* 39 */ 0, { 14, 15 } },
{ /* 40 */ 0, { 15, 16 } },
{ /* 41 */ 0, { 16, 17 } },
{ /* 42 */ 0, { 17, 18 } },
{ /* 43 */ 0, { 18, 19 } },
{ /* 44 */ 0, { 19, 20 } },
{ /* 45 */ 0, { 20, 21 } },
{ /* 46 */ 0, { 21, 22 } },
{ /* 47 */ 0, { 22, 23 } },
{ /* 48 */ 0, { 23, 24 } },
{ /* 49 */ 1, { -2, -1 } },
{ /* 50 */ 1, { 2, 1 } },
{ /* 51 */ 1, { -1, -2 } },
{ /* 52 */ 1, { 1, 2 } },
{ /* 53 */ 1, { -2, 1 } },
{ /* 54 */ 1, { 2, -1 } },
{ /* 55 */ 1, { -1, 2 } },
{ /* 56 */ 1, { 1, -2 } },
{ /* 57 */ 1, { -3, 0 } },
{ /* 58 */ 1, { 3, 0 } },
{ /* 59 */ 1, { 0, -3 } },
{ /* 60 */ 1, { 0, 3 } },
{ /* 61 */ 0, { 12, 13 } },
{ /* 62 */ 0, { 13, 14 } },
{ /* 63 */ 0, { 14, 15 } },
{ /* 64 */ 0, { 15, 16 } },
{ /* 65 */ 0, { 16, 17 } },
{ /* 66 */ 0, { 17, 18 } },
{ /* 67 */ 0, { 18, 19 } },
{ /* 68 */ 0, { 19, 20 } },
{ /* 69 */ 0, { 20, 21 } },
{ /* 70 */ 0, { 21, 22 } },
{ /* 71 */ 0, { 22, 23 } },
{ /* 72 */ 0, { 23, 24 } },
{ /* 73 */ 1, { -3, -1 } },
{ /* 74 */ 1, { 1, 3 } },
{ /* 75 */ 1, { 3, 1 } },
{ /* 76 */ 1, { -1, -3 } },
{ /* 77 */ 1, { -3, 1 } },
{ /* 78 */ 1, { 3, -1 } },
{ /* 79 */ 1, { 1, -3 } },
{ /* 80 */ 1, { -1, 3 } },
{ /* 81 */ 1, { -2, 2 } },
{ /* 82 */ 1, { 2, 2 } },
{ /* 83 */ 1, { -2, -2 } },
{ /* 84 */ 1, { 2, -2 } },
{ /* 85 */ 0, { 12, 13 } },
{ /* 86 */ 0, { 13, 14 } },
{ /* 87 */ 0, { 14, 15 } },
{ /* 88 */ 0, { 15, 16 } },
{ /* 89 */ 0, { 16, 17 } },
{ /* 90 */ 0, { 17, 18 } },
{ /* 91 */ 0, { 18, 19 } },
{ /* 92 */ 0, { 19, 20 } },
{ /* 93 */ 0, { 20, 21 } },
{ /* 94 */ 0, { 21, 22 } },
{ /* 95 */ 0, { 22, 23 } },
{ /* 96 */ 0, { 23, 24 } },
{ /* 97 */ 1, { -3, -2 } },
{ /* 98 */ 1, { 3, -2 } },
{ /* 99 */ 1, { -2, 3 } },
{ /* 00 */ 1, { 2, -3 } },
{ /* 01 */ 1, { 3, 2 } },
{ /* 02 */ 1, { 2, 3 } },
{ /* 03 */ 1, { -3, 2 } },
{ /* 04 */ 1, { -2, -3 } },
{ /* 05 */ 1, { 0, -4 } },
{ /* 06 */ 1, { -4, 0 } },
{ /* 07 */ 1, { 4, 1 } },
{ /* 08 */ 1, { 4, 0 } },
{ /* 09 */ 0, { 12, 13 } },
{ /* 10 */ 0, { 13, 14 } },
{ /* 11 */ 0, { 14, 15 } },
{ /* 12 */ 0, { 15, 16 } },
{ /* 13 */ 0, { 16, 17 } },
{ /* 14 */ 0, { 17, 18 } },
{ /* 15 */ 0, { 18, 19 } },
{ /* 16 */ 0, { 19, 20 } },
{ /* 17 */ 0, { 20, 21 } },
{ /* 18 */ 0, { 21, 22 } },
{ /* 19 */ 0, { 22, 23 } },
{ /* 20 */ 0, { 23, 24 } },
{ /* 21 */ 1, { -4, -1 } },
{ /* 22 */ 1, { 0, 4 } },
{ /* 23 */ 1, { 4, -1 } },
{ /* 24 */ 1, { -1, -4 } },
{ /* 25 */ 1, { 1, 4 } },
{ /* 26 */ 1, { -1, 4 } },
{ /* 27 */ 1, { -4, 1 } },
{ /* 28 */ 1, { 1, -4 } },
{ /* 29 */ 1, { 3, -3 } },
{ /* 30 */ 1, { -3, -3 } },
{ /* 31 */ 1, { -3, 3 } },
{ /* 32 */ 1, { -2, 4 } },
{ /* 33 */ 1, { -4, -2 } },
{ /* 34 */ 1, { 4, 2 } },
{ /* 35 */ 1, { 2, -4 } },
{ /* 36 */ 1, { 2, 4 } },
{ /* 37 */ 1, { 3, 3 } },
{ /* 38 */ 1, { -4, 2 } },
{ /* 39 */ 0, { 6, 7 } },
{ /* 40 */ 0, { 7, 8 } },
{ /* 41 */ 0, { 8, 9 } },
{ /* 42 */ 0, { 9, 10 } },
{ /* 43 */ 0, { 10, 11 } },
{ /* 44 */ 0, { 11, 12 } },
{ /* 45 */ 1, { -2, -4 } },
{ /* 46 */ 1, { 4, -2 } },
{ /* 47 */ 1, { 3, -4 } },
{ /* 48 */ 1, { -4, -3 } },
{ /* 49 */ 1, { -4, 3 } },
{ /* 50 */ 1, { 3, 4 } },
{ /* 51 */ 1, { -3, 4 } },
{ /* 52 */ 1, { 4, 3 } },
{ /* 53 */ 1, { 4, -3 } },
{ /* 54 */ 1, { -3, -4 } },
{ /* 55 */ 0, { 2, 3 } },
{ /* 56 */ 0, { 3, 4 } },
{ /* 57 */ 1, { 4, -4 } },
{ /* 58 */ 1, { -4, 4 } },
{ /* 59 */ 1, { 4, 4 } },
{ /* 60 */ 1, { -4, -4 } }
};

361
src/contrib/aacdecoder/libfaad/codebook/hcb_6.h Normal file → Executable file
View File

@ -1,179 +1,182 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_6.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* 2-step huffman table HCB_6 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb6_1[] = {
/* 4 bit codewords */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00010 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00100 */ 2, 0 },
{ /* */ 2, 0 },
{ /* 00110 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 01000 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 01010 */ 5, 0 },
{ /* */ 5, 0 },
{ /* 01100 */ 6, 0 },
{ /* */ 6, 0 },
{ /* 01110 */ 7, 0 },
{ /* */ 7, 0 },
{ /* 10000 */ 8, 0 },
{ /* */ 8, 0 },
/* 6 bit codewords */
{ /* 10010 */ 9, 1 },
{ /* 10011 */ 11, 1 },
{ /* 10100 */ 13, 1 },
{ /* 10101 */ 15, 1 },
{ /* 10110 */ 17, 1 },
{ /* 10111 */ 19, 1 },
{ /* 11000 */ 21, 1 },
{ /* 11001 */ 23, 1 },
/* 7 bit codewords */
{ /* 11010 */ 25, 2 },
{ /* 11011 */ 29, 2 },
{ /* 11100 */ 33, 2 },
/* 7/8 bit codewords */
{ /* 11101 */ 37, 3 },
/* 8/9 bit codewords */
{ /* 11110 */ 45, 4 },
/* 9/10/11 bit codewords */
{ /* 11111 */ 61, 6 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb6_2[] = {
/* 4 bit codewords */
{ 4, 0, 0 },
{ 4, 1, 0 },
{ 4, 0, -1 },
{ 4, 0, 1 },
{ 4, -1, 0 },
{ 4, 1, 1 },
{ 4, -1, 1 },
{ 4, 1, -1 },
{ 4, -1, -1 },
/* 6 bit codewords */
{ 6, 2, -1 },
{ 6, 2, 1 },
{ 6, -2, 1 },
{ 6, -2, -1 },
{ 6, -2, 0 },
{ 6, -1, 2 },
{ 6, 2, 0 },
{ 6, 1, -2 },
{ 6, 1, 2 },
{ 6, 0, -2 },
{ 6, -1, -2 },
{ 6, 0, 2 },
{ 6, 2, -2 },
{ 6, -2, 2 },
{ 6, -2, -2 },
{ 6, 2, 2 },
/* 7 bit codewords */
{ 7, -3, 1 },
{ 7, 3, 1 },
{ 7, 3, -1 },
{ 7, -1, 3 },
{ 7, -3, -1 },
{ 7, 1, 3 },
{ 7, 1, -3 },
{ 7, -1, -3 },
{ 7, 3, 0 },
{ 7, -3, 0 },
{ 7, 0, -3 },
{ 7, 0, 3 },
/* 7/8 bit codewords */
{ 7, 3, 2 }, { 7, 3, 2 },
{ 8, -3, -2 },
{ 8, -2, 3 },
{ 8, 2, 3 },
{ 8, 3, -2 },
{ 8, 2, -3 },
{ 8, -2, -3 },
/* 8 bit codewords */
{ 8, -3, 2 }, { 8, -3, 2 },
{ 8, 3, 3 }, { 8, 3, 3 },
{ 9, 3, -3 },
{ 9, -3, -3 },
{ 9, -3, 3 },
{ 9, 1, -4 },
{ 9, -1, -4 },
{ 9, 4, 1 },
{ 9, -4, 1 },
{ 9, -4, -1 },
{ 9, 1, 4 },
{ 9, 4, -1 },
{ 9, -1, 4 },
{ 9, 0, -4 },
/* 9/10/11 bit codewords */
{ 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 },
{ 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 },
{ 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 },
{ 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 },
{ 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 },
{ 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 },
{ 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 },
{ 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 },
{ 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 },
{ 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 },
{ 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 },
{ 10, -3, -4 }, { 10, -3, -4 },
{ 10, -3, 4 }, { 10, -3, 4 },
{ 10, 3, -4 }, { 10, 3, -4 },
{ 10, 4, -3 }, { 10, 4, -3 },
{ 10, 3, 4 }, { 10, 3, 4 },
{ 10, 4, 3 }, { 10, 4, 3 },
{ 10, -4, 3 }, { 10, -4, 3 },
{ 10, -4, -3 }, { 10, -4, -3 },
{ 11, 4, 4 },
{ 11, -4, 4 },
{ 11, -4, -4 },
{ 11, 4, -4 }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_6.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* 2-step huffman table HCB_6 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb6_1[] = {
/* 4 bit codewords */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* 00010 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00100 */ 2, 0 },
{ /* */ 2, 0 },
{ /* 00110 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 01000 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 01010 */ 5, 0 },
{ /* */ 5, 0 },
{ /* 01100 */ 6, 0 },
{ /* */ 6, 0 },
{ /* 01110 */ 7, 0 },
{ /* */ 7, 0 },
{ /* 10000 */ 8, 0 },
{ /* */ 8, 0 },
/* 6 bit codewords */
{ /* 10010 */ 9, 1 },
{ /* 10011 */ 11, 1 },
{ /* 10100 */ 13, 1 },
{ /* 10101 */ 15, 1 },
{ /* 10110 */ 17, 1 },
{ /* 10111 */ 19, 1 },
{ /* 11000 */ 21, 1 },
{ /* 11001 */ 23, 1 },
/* 7 bit codewords */
{ /* 11010 */ 25, 2 },
{ /* 11011 */ 29, 2 },
{ /* 11100 */ 33, 2 },
/* 7/8 bit codewords */
{ /* 11101 */ 37, 3 },
/* 8/9 bit codewords */
{ /* 11110 */ 45, 4 },
/* 9/10/11 bit codewords */
{ /* 11111 */ 61, 6 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb6_2[] = {
/* 4 bit codewords */
{ 4, 0, 0 },
{ 4, 1, 0 },
{ 4, 0, -1 },
{ 4, 0, 1 },
{ 4, -1, 0 },
{ 4, 1, 1 },
{ 4, -1, 1 },
{ 4, 1, -1 },
{ 4, -1, -1 },
/* 6 bit codewords */
{ 6, 2, -1 },
{ 6, 2, 1 },
{ 6, -2, 1 },
{ 6, -2, -1 },
{ 6, -2, 0 },
{ 6, -1, 2 },
{ 6, 2, 0 },
{ 6, 1, -2 },
{ 6, 1, 2 },
{ 6, 0, -2 },
{ 6, -1, -2 },
{ 6, 0, 2 },
{ 6, 2, -2 },
{ 6, -2, 2 },
{ 6, -2, -2 },
{ 6, 2, 2 },
/* 7 bit codewords */
{ 7, -3, 1 },
{ 7, 3, 1 },
{ 7, 3, -1 },
{ 7, -1, 3 },
{ 7, -3, -1 },
{ 7, 1, 3 },
{ 7, 1, -3 },
{ 7, -1, -3 },
{ 7, 3, 0 },
{ 7, -3, 0 },
{ 7, 0, -3 },
{ 7, 0, 3 },
/* 7/8 bit codewords */
{ 7, 3, 2 }, { 7, 3, 2 },
{ 8, -3, -2 },
{ 8, -2, 3 },
{ 8, 2, 3 },
{ 8, 3, -2 },
{ 8, 2, -3 },
{ 8, -2, -3 },
/* 8 bit codewords */
{ 8, -3, 2 }, { 8, -3, 2 },
{ 8, 3, 3 }, { 8, 3, 3 },
{ 9, 3, -3 },
{ 9, -3, -3 },
{ 9, -3, 3 },
{ 9, 1, -4 },
{ 9, -1, -4 },
{ 9, 4, 1 },
{ 9, -4, 1 },
{ 9, -4, -1 },
{ 9, 1, 4 },
{ 9, 4, -1 },
{ 9, -1, 4 },
{ 9, 0, -4 },
/* 9/10/11 bit codewords */
{ 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 }, { 9, -4, 2 },
{ 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 }, { 9, -4, -2 },
{ 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 }, { 9, 2, 4 },
{ 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 }, { 9, -2, -4 },
{ 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 }, { 9, -4, 0 },
{ 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 }, { 9, 4, 2 },
{ 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 }, { 9, 4, -2 },
{ 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 }, { 9, -2, 4 },
{ 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 }, { 9, 4, 0 },
{ 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 }, { 9, 2, -4 },
{ 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 }, { 9, 0, 4 },
{ 10, -3, -4 }, { 10, -3, -4 },
{ 10, -3, 4 }, { 10, -3, 4 },
{ 10, 3, -4 }, { 10, 3, -4 },
{ 10, 4, -3 }, { 10, 4, -3 },
{ 10, 3, 4 }, { 10, 3, 4 },
{ 10, 4, 3 }, { 10, 4, 3 },
{ 10, -4, 3 }, { 10, -4, 3 },
{ 10, -4, -3 }, { 10, -4, -3 },
{ 11, 4, 4 },
{ 11, -4, 4 },
{ 11, -4, -4 },
{ 11, 4, -4 }
};

321
src/contrib/aacdecoder/libfaad/codebook/hcb_7.h Normal file → Executable file
View File

@ -1,159 +1,162 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_7.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* Binary search huffman table HCB_7 */
static hcb_bin_pair hcb7[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } },
{ /* 2 */ 0, { 1, 2 } },
{ /* 3 */ 0, { 2, 3 } },
{ /* 4 */ 0, { 3, 4 } },
{ /* 5 */ 1, { 1, 0 } },
{ /* 6 */ 1, { 0, 1 } },
{ /* 7 */ 0, { 2, 3 } },
{ /* 8 */ 0, { 3, 4 } },
{ /* 9 */ 1, { 1, 1 } },
{ /* 10 */ 0, { 3, 4 } },
{ /* 11 */ 0, { 4, 5 } },
{ /* 12 */ 0, { 5, 6 } },
{ /* 13 */ 0, { 6, 7 } },
{ /* 14 */ 0, { 7, 8 } },
{ /* 15 */ 0, { 8, 9 } },
{ /* 16 */ 0, { 9, 10 } },
{ /* 17 */ 0, { 10, 11 } },
{ /* 18 */ 0, { 11, 12 } },
{ /* 19 */ 1, { 2, 1 } },
{ /* 20 */ 1, { 1, 2 } },
{ /* 21 */ 1, { 2, 0 } },
{ /* 22 */ 1, { 0, 2 } },
{ /* 23 */ 0, { 8, 9 } },
{ /* 24 */ 0, { 9, 10 } },
{ /* 25 */ 0, { 10, 11 } },
{ /* 26 */ 0, { 11, 12 } },
{ /* 27 */ 0, { 12, 13 } },
{ /* 28 */ 0, { 13, 14 } },
{ /* 29 */ 0, { 14, 15 } },
{ /* 30 */ 0, { 15, 16 } },
{ /* 31 */ 1, { 3, 1 } },
{ /* 32 */ 1, { 1, 3 } },
{ /* 33 */ 1, { 2, 2 } },
{ /* 34 */ 1, { 3, 0 } },
{ /* 35 */ 1, { 0, 3 } },
{ /* 36 */ 0, { 11, 12 } },
{ /* 37 */ 0, { 12, 13 } },
{ /* 38 */ 0, { 13, 14 } },
{ /* 39 */ 0, { 14, 15 } },
{ /* 40 */ 0, { 15, 16 } },
{ /* 41 */ 0, { 16, 17 } },
{ /* 42 */ 0, { 17, 18 } },
{ /* 43 */ 0, { 18, 19 } },
{ /* 44 */ 0, { 19, 20 } },
{ /* 45 */ 0, { 20, 21 } },
{ /* 46 */ 0, { 21, 22 } },
{ /* 47 */ 1, { 2, 3 } },
{ /* 48 */ 1, { 3, 2 } },
{ /* 49 */ 1, { 1, 4 } },
{ /* 50 */ 1, { 4, 1 } },
{ /* 51 */ 1, { 1, 5 } },
{ /* 52 */ 1, { 5, 1 } },
{ /* 53 */ 1, { 3, 3 } },
{ /* 54 */ 1, { 2, 4 } },
{ /* 55 */ 1, { 0, 4 } },
{ /* 56 */ 1, { 4, 0 } },
{ /* 57 */ 0, { 12, 13 } },
{ /* 58 */ 0, { 13, 14 } },
{ /* 59 */ 0, { 14, 15 } },
{ /* 60 */ 0, { 15, 16 } },
{ /* 61 */ 0, { 16, 17 } },
{ /* 62 */ 0, { 17, 18 } },
{ /* 63 */ 0, { 18, 19 } },
{ /* 64 */ 0, { 19, 20 } },
{ /* 65 */ 0, { 20, 21 } },
{ /* 66 */ 0, { 21, 22 } },
{ /* 67 */ 0, { 22, 23 } },
{ /* 68 */ 0, { 23, 24 } },
{ /* 69 */ 1, { 4, 2 } },
{ /* 70 */ 1, { 2, 5 } },
{ /* 71 */ 1, { 5, 2 } },
{ /* 72 */ 1, { 0, 5 } },
{ /* 73 */ 1, { 6, 1 } },
{ /* 74 */ 1, { 5, 0 } },
{ /* 75 */ 1, { 1, 6 } },
{ /* 76 */ 1, { 4, 3 } },
{ /* 77 */ 1, { 3, 5 } },
{ /* 78 */ 1, { 3, 4 } },
{ /* 79 */ 1, { 5, 3 } },
{ /* 80 */ 1, { 2, 6 } },
{ /* 81 */ 1, { 6, 2 } },
{ /* 82 */ 1, { 1, 7 } },
{ /* 83 */ 0, { 10, 11 } },
{ /* 84 */ 0, { 11, 12 } },
{ /* 85 */ 0, { 12, 13 } },
{ /* 86 */ 0, { 13, 14 } },
{ /* 87 */ 0, { 14, 15 } },
{ /* 88 */ 0, { 15, 16 } },
{ /* 89 */ 0, { 16, 17 } },
{ /* 90 */ 0, { 17, 18 } },
{ /* 91 */ 0, { 18, 19 } },
{ /* 92 */ 0, { 19, 20 } },
{ /* 93 */ 1, { 3, 6 } },
{ /* 94 */ 1, { 0, 6 } },
{ /* 95 */ 1, { 6, 0 } },
{ /* 96 */ 1, { 4, 4 } },
{ /* 97 */ 1, { 7, 1 } },
{ /* 98 */ 1, { 4, 5 } },
{ /* 99 */ 1, { 7, 2 } },
{ /* 00 */ 1, { 5, 4 } },
{ /* 01 */ 1, { 6, 3 } },
{ /* 02 */ 1, { 2, 7 } },
{ /* 03 */ 1, { 7, 3 } },
{ /* 04 */ 1, { 6, 4 } },
{ /* 05 */ 1, { 5, 5 } },
{ /* 06 */ 1, { 4, 6 } },
{ /* 07 */ 1, { 3, 7 } },
{ /* 08 */ 0, { 5, 6 } },
{ /* 09 */ 0, { 6, 7 } },
{ /* 10 */ 0, { 7, 8 } },
{ /* 11 */ 0, { 8, 9 } },
{ /* 12 */ 0, { 9, 10 } },
{ /* 13 */ 1, { 7, 0 } },
{ /* 14 */ 1, { 0, 7 } },
{ /* 15 */ 1, { 6, 5 } },
{ /* 16 */ 1, { 5, 6 } },
{ /* 17 */ 1, { 7, 4 } },
{ /* 18 */ 1, { 4, 7 } },
{ /* 19 */ 1, { 5, 7 } },
{ /* 20 */ 1, { 7, 5 } },
{ /* 21 */ 0, { 2, 3 } },
{ /* 22 */ 0, { 3, 4 } },
{ /* 23 */ 1, { 7, 6 } },
{ /* 24 */ 1, { 6, 6 } },
{ /* 25 */ 1, { 6, 7 } },
{ /* 26 */ 1, { 7, 7 } }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_7.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* Binary search huffman table HCB_7 */
static hcb_bin_pair hcb7[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } },
{ /* 2 */ 0, { 1, 2 } },
{ /* 3 */ 0, { 2, 3 } },
{ /* 4 */ 0, { 3, 4 } },
{ /* 5 */ 1, { 1, 0 } },
{ /* 6 */ 1, { 0, 1 } },
{ /* 7 */ 0, { 2, 3 } },
{ /* 8 */ 0, { 3, 4 } },
{ /* 9 */ 1, { 1, 1 } },
{ /* 10 */ 0, { 3, 4 } },
{ /* 11 */ 0, { 4, 5 } },
{ /* 12 */ 0, { 5, 6 } },
{ /* 13 */ 0, { 6, 7 } },
{ /* 14 */ 0, { 7, 8 } },
{ /* 15 */ 0, { 8, 9 } },
{ /* 16 */ 0, { 9, 10 } },
{ /* 17 */ 0, { 10, 11 } },
{ /* 18 */ 0, { 11, 12 } },
{ /* 19 */ 1, { 2, 1 } },
{ /* 20 */ 1, { 1, 2 } },
{ /* 21 */ 1, { 2, 0 } },
{ /* 22 */ 1, { 0, 2 } },
{ /* 23 */ 0, { 8, 9 } },
{ /* 24 */ 0, { 9, 10 } },
{ /* 25 */ 0, { 10, 11 } },
{ /* 26 */ 0, { 11, 12 } },
{ /* 27 */ 0, { 12, 13 } },
{ /* 28 */ 0, { 13, 14 } },
{ /* 29 */ 0, { 14, 15 } },
{ /* 30 */ 0, { 15, 16 } },
{ /* 31 */ 1, { 3, 1 } },
{ /* 32 */ 1, { 1, 3 } },
{ /* 33 */ 1, { 2, 2 } },
{ /* 34 */ 1, { 3, 0 } },
{ /* 35 */ 1, { 0, 3 } },
{ /* 36 */ 0, { 11, 12 } },
{ /* 37 */ 0, { 12, 13 } },
{ /* 38 */ 0, { 13, 14 } },
{ /* 39 */ 0, { 14, 15 } },
{ /* 40 */ 0, { 15, 16 } },
{ /* 41 */ 0, { 16, 17 } },
{ /* 42 */ 0, { 17, 18 } },
{ /* 43 */ 0, { 18, 19 } },
{ /* 44 */ 0, { 19, 20 } },
{ /* 45 */ 0, { 20, 21 } },
{ /* 46 */ 0, { 21, 22 } },
{ /* 47 */ 1, { 2, 3 } },
{ /* 48 */ 1, { 3, 2 } },
{ /* 49 */ 1, { 1, 4 } },
{ /* 50 */ 1, { 4, 1 } },
{ /* 51 */ 1, { 1, 5 } },
{ /* 52 */ 1, { 5, 1 } },
{ /* 53 */ 1, { 3, 3 } },
{ /* 54 */ 1, { 2, 4 } },
{ /* 55 */ 1, { 0, 4 } },
{ /* 56 */ 1, { 4, 0 } },
{ /* 57 */ 0, { 12, 13 } },
{ /* 58 */ 0, { 13, 14 } },
{ /* 59 */ 0, { 14, 15 } },
{ /* 60 */ 0, { 15, 16 } },
{ /* 61 */ 0, { 16, 17 } },
{ /* 62 */ 0, { 17, 18 } },
{ /* 63 */ 0, { 18, 19 } },
{ /* 64 */ 0, { 19, 20 } },
{ /* 65 */ 0, { 20, 21 } },
{ /* 66 */ 0, { 21, 22 } },
{ /* 67 */ 0, { 22, 23 } },
{ /* 68 */ 0, { 23, 24 } },
{ /* 69 */ 1, { 4, 2 } },
{ /* 70 */ 1, { 2, 5 } },
{ /* 71 */ 1, { 5, 2 } },
{ /* 72 */ 1, { 0, 5 } },
{ /* 73 */ 1, { 6, 1 } },
{ /* 74 */ 1, { 5, 0 } },
{ /* 75 */ 1, { 1, 6 } },
{ /* 76 */ 1, { 4, 3 } },
{ /* 77 */ 1, { 3, 5 } },
{ /* 78 */ 1, { 3, 4 } },
{ /* 79 */ 1, { 5, 3 } },
{ /* 80 */ 1, { 2, 6 } },
{ /* 81 */ 1, { 6, 2 } },
{ /* 82 */ 1, { 1, 7 } },
{ /* 83 */ 0, { 10, 11 } },
{ /* 84 */ 0, { 11, 12 } },
{ /* 85 */ 0, { 12, 13 } },
{ /* 86 */ 0, { 13, 14 } },
{ /* 87 */ 0, { 14, 15 } },
{ /* 88 */ 0, { 15, 16 } },
{ /* 89 */ 0, { 16, 17 } },
{ /* 90 */ 0, { 17, 18 } },
{ /* 91 */ 0, { 18, 19 } },
{ /* 92 */ 0, { 19, 20 } },
{ /* 93 */ 1, { 3, 6 } },
{ /* 94 */ 1, { 0, 6 } },
{ /* 95 */ 1, { 6, 0 } },
{ /* 96 */ 1, { 4, 4 } },
{ /* 97 */ 1, { 7, 1 } },
{ /* 98 */ 1, { 4, 5 } },
{ /* 99 */ 1, { 7, 2 } },
{ /* 00 */ 1, { 5, 4 } },
{ /* 01 */ 1, { 6, 3 } },
{ /* 02 */ 1, { 2, 7 } },
{ /* 03 */ 1, { 7, 3 } },
{ /* 04 */ 1, { 6, 4 } },
{ /* 05 */ 1, { 5, 5 } },
{ /* 06 */ 1, { 4, 6 } },
{ /* 07 */ 1, { 3, 7 } },
{ /* 08 */ 0, { 5, 6 } },
{ /* 09 */ 0, { 6, 7 } },
{ /* 10 */ 0, { 7, 8 } },
{ /* 11 */ 0, { 8, 9 } },
{ /* 12 */ 0, { 9, 10 } },
{ /* 13 */ 1, { 7, 0 } },
{ /* 14 */ 1, { 0, 7 } },
{ /* 15 */ 1, { 6, 5 } },
{ /* 16 */ 1, { 5, 6 } },
{ /* 17 */ 1, { 7, 4 } },
{ /* 18 */ 1, { 4, 7 } },
{ /* 19 */ 1, { 5, 7 } },
{ /* 20 */ 1, { 7, 5 } },
{ /* 21 */ 0, { 2, 3 } },
{ /* 22 */ 0, { 3, 4 } },
{ /* 23 */ 1, { 7, 6 } },
{ /* 24 */ 1, { 6, 6 } },
{ /* 25 */ 1, { 6, 7 } },
{ /* 26 */ 1, { 7, 7 } }
};

343
src/contrib/aacdecoder/libfaad/codebook/hcb_8.h Normal file → Executable file
View File

@ -1,170 +1,173 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_8.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* 2-step huffman table HCB_8 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb8_1[] = {
/* 3 bit codeword */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
/* 4 bit codewords */
{ /* 00100 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00110 */ 2, 0 },
{ /* */ 2, 0 },
{ /* 01000 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 01010 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 01100 */ 5, 0 },
{ /* */ 5, 0 },
/* 5 bit codewords */
{ /* 01110 */ 6, 0 },
{ /* 01111 */ 7, 0 },
{ /* 10000 */ 8, 0 },
{ /* 10001 */ 9, 0 },
{ /* 10010 */ 10, 0 },
{ /* 10011 */ 11, 0 },
{ /* 10100 */ 12, 0 },
/* 6 bit codewords */
{ /* 10101 */ 13, 1 },
{ /* 10110 */ 15, 1 },
{ /* 10111 */ 17, 1 },
{ /* 11000 */ 19, 1 },
{ /* 11001 */ 21, 1 },
/* 7 bit codewords */
{ /* 11010 */ 23, 2 },
{ /* 11011 */ 27, 2 },
{ /* 11100 */ 31, 2 },
/* 7/8 bit codewords */
{ /* 11101 */ 35, 3 },
/* 8 bit codewords */
{ /* 11110 */ 43, 3 },
/* 8/9/10 bit codewords */
{ /* 11111 */ 51, 5 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb8_2[] = {
/* 3 bit codeword */
{ 3, 1, 1 },
/* 4 bit codewords */
{ 4, 2, 1 },
{ 4, 1, 0 },
{ 4, 1, 2 },
{ 4, 0, 1 },
{ 4, 2, 2 },
/* 5 bit codewords */
{ 5, 0, 0 },
{ 5, 2, 0 },
{ 5, 0, 2 },
{ 5, 3, 1 },
{ 5, 1, 3 },
{ 5, 3, 2 },
{ 5, 2, 3 },
/* 6 bit codewords */
{ 6, 3, 3 },
{ 6, 4, 1 },
{ 6, 1, 4 },
{ 6, 4, 2 },
{ 6, 2, 4 },
{ 6, 3, 0 },
{ 6, 0, 3 },
{ 6, 4, 3 },
{ 6, 3, 4 },
{ 6, 5, 2 },
/* 7 bit codewords */
{ 7, 5, 1 },
{ 7, 2, 5 },
{ 7, 1, 5 },
{ 7, 5, 3 },
{ 7, 3, 5 },
{ 7, 4, 4 },
{ 7, 5, 4 },
{ 7, 0, 4 },
{ 7, 4, 5 },
{ 7, 4, 0 },
{ 7, 2, 6 },
{ 7, 6, 2 },
/* 7/8 bit codewords */
{ 7, 6, 1 }, { 7, 6, 1 },
{ 7, 1, 6 }, { 7, 1, 6 },
{ 8, 3, 6 },
{ 8, 6, 3 },
{ 8, 5, 5 },
{ 8, 5, 0 },
/* 8 bit codewords */
{ 8, 6, 4 },
{ 8, 0, 5 },
{ 8, 4, 6 },
{ 8, 7, 1 },
{ 8, 7, 2 },
{ 8, 2, 7 },
{ 8, 6, 5 },
{ 8, 7, 3 },
/* 8/9/10 bit codewords */
{ 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 },
{ 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 },
{ 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 },
{ 9, 6, 6 }, { 9, 6, 6 },
{ 9, 7, 4 }, { 9, 7, 4 },
{ 9, 6, 0 }, { 9, 6, 0 },
{ 9, 4, 7 }, { 9, 4, 7 },
{ 9, 0, 6 }, { 9, 0, 6 },
{ 9, 7, 5 }, { 9, 7, 5 },
{ 9, 7, 6 }, { 9, 7, 6 },
{ 9, 6, 7 }, { 9, 6, 7 },
{ 10, 5, 7 },
{ 10, 7, 0 },
{ 10, 0, 7 },
{ 10, 7, 7 }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_8.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* 2-step huffman table HCB_8 */
/* 1st step: 5 bits
* 2^5 = 32 entries
*
* Used to find offset into 2nd step table and number of extra bits to get
*/
static hcb hcb8_1[] = {
/* 3 bit codeword */
{ /* 00000 */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
{ /* */ 0, 0 },
/* 4 bit codewords */
{ /* 00100 */ 1, 0 },
{ /* */ 1, 0 },
{ /* 00110 */ 2, 0 },
{ /* */ 2, 0 },
{ /* 01000 */ 3, 0 },
{ /* */ 3, 0 },
{ /* 01010 */ 4, 0 },
{ /* */ 4, 0 },
{ /* 01100 */ 5, 0 },
{ /* */ 5, 0 },
/* 5 bit codewords */
{ /* 01110 */ 6, 0 },
{ /* 01111 */ 7, 0 },
{ /* 10000 */ 8, 0 },
{ /* 10001 */ 9, 0 },
{ /* 10010 */ 10, 0 },
{ /* 10011 */ 11, 0 },
{ /* 10100 */ 12, 0 },
/* 6 bit codewords */
{ /* 10101 */ 13, 1 },
{ /* 10110 */ 15, 1 },
{ /* 10111 */ 17, 1 },
{ /* 11000 */ 19, 1 },
{ /* 11001 */ 21, 1 },
/* 7 bit codewords */
{ /* 11010 */ 23, 2 },
{ /* 11011 */ 27, 2 },
{ /* 11100 */ 31, 2 },
/* 7/8 bit codewords */
{ /* 11101 */ 35, 3 },
/* 8 bit codewords */
{ /* 11110 */ 43, 3 },
/* 8/9/10 bit codewords */
{ /* 11111 */ 51, 5 }
};
/* 2nd step table
*
* Gives size of codeword and actual data (x,y,v,w)
*/
static hcb_2_pair hcb8_2[] = {
/* 3 bit codeword */
{ 3, 1, 1 },
/* 4 bit codewords */
{ 4, 2, 1 },
{ 4, 1, 0 },
{ 4, 1, 2 },
{ 4, 0, 1 },
{ 4, 2, 2 },
/* 5 bit codewords */
{ 5, 0, 0 },
{ 5, 2, 0 },
{ 5, 0, 2 },
{ 5, 3, 1 },
{ 5, 1, 3 },
{ 5, 3, 2 },
{ 5, 2, 3 },
/* 6 bit codewords */
{ 6, 3, 3 },
{ 6, 4, 1 },
{ 6, 1, 4 },
{ 6, 4, 2 },
{ 6, 2, 4 },
{ 6, 3, 0 },
{ 6, 0, 3 },
{ 6, 4, 3 },
{ 6, 3, 4 },
{ 6, 5, 2 },
/* 7 bit codewords */
{ 7, 5, 1 },
{ 7, 2, 5 },
{ 7, 1, 5 },
{ 7, 5, 3 },
{ 7, 3, 5 },
{ 7, 4, 4 },
{ 7, 5, 4 },
{ 7, 0, 4 },
{ 7, 4, 5 },
{ 7, 4, 0 },
{ 7, 2, 6 },
{ 7, 6, 2 },
/* 7/8 bit codewords */
{ 7, 6, 1 }, { 7, 6, 1 },
{ 7, 1, 6 }, { 7, 1, 6 },
{ 8, 3, 6 },
{ 8, 6, 3 },
{ 8, 5, 5 },
{ 8, 5, 0 },
/* 8 bit codewords */
{ 8, 6, 4 },
{ 8, 0, 5 },
{ 8, 4, 6 },
{ 8, 7, 1 },
{ 8, 7, 2 },
{ 8, 2, 7 },
{ 8, 6, 5 },
{ 8, 7, 3 },
/* 8/9/10 bit codewords */
{ 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 }, { 8, 1, 7 },
{ 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 }, { 8, 5, 6 },
{ 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 }, { 8, 3, 7 },
{ 9, 6, 6 }, { 9, 6, 6 },
{ 9, 7, 4 }, { 9, 7, 4 },
{ 9, 6, 0 }, { 9, 6, 0 },
{ 9, 4, 7 }, { 9, 4, 7 },
{ 9, 0, 6 }, { 9, 0, 6 },
{ 9, 7, 5 }, { 9, 7, 5 },
{ 9, 7, 6 }, { 9, 7, 6 },
{ 9, 6, 7 }, { 9, 6, 7 },
{ 10, 5, 7 },
{ 10, 7, 0 },
{ 10, 0, 7 },
{ 10, 7, 7 }
};

741
src/contrib/aacdecoder/libfaad/codebook/hcb_9.h Normal file → Executable file
View File

@ -1,369 +1,372 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_9.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* Binary search huffman table HCB_9 */
static hcb_bin_pair hcb9[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } },
{ /* 2 */ 0, { 1, 2 } },
{ /* 3 */ 0, { 2, 3 } },
{ /* 4 */ 0, { 3, 4 } },
{ /* 5 */ 1, { 1, 0 } },
{ /* 6 */ 1, { 0, 1 } },
{ /* 7 */ 0, { 2, 3 } },
{ /* 8 */ 0, { 3, 4 } },
{ /* 9 */ 1, { 1, 1 } },
{ /* 10 */ 0, { 3, 4 } },
{ /* 11 */ 0, { 4, 5 } },
{ /* 12 */ 0, { 5, 6 } },
{ /* 13 */ 0, { 6, 7 } },
{ /* 14 */ 0, { 7, 8 } },
{ /* 15 */ 0, { 8, 9 } },
{ /* 16 */ 0, { 9, 10 } },
{ /* 17 */ 0, { 10, 11 } },
{ /* 18 */ 0, { 11, 12 } },
{ /* 19 */ 1, { 2, 1 } },
{ /* 20 */ 1, { 1, 2 } },
{ /* 21 */ 1, { 2, 0 } },
{ /* 22 */ 1, { 0, 2 } },
{ /* 23 */ 0, { 8, 9 } },
{ /* 24 */ 0, { 9, 10 } },
{ /* 25 */ 0, { 10, 11 } },
{ /* 26 */ 0, { 11, 12 } },
{ /* 27 */ 0, { 12, 13 } },
{ /* 28 */ 0, { 13, 14 } },
{ /* 29 */ 0, { 14, 15 } },
{ /* 30 */ 0, { 15, 16 } },
{ /* 31 */ 1, { 3, 1 } },
{ /* 32 */ 1, { 2, 2 } },
{ /* 33 */ 1, { 1, 3 } },
{ /* 34 */ 0, { 13, 14 } },
{ /* 35 */ 0, { 14, 15 } },
{ /* 36 */ 0, { 15, 16 } },
{ /* 37 */ 0, { 16, 17 } },
{ /* 38 */ 0, { 17, 18 } },
{ /* 39 */ 0, { 18, 19 } },
{ /* 40 */ 0, { 19, 20 } },
{ /* 41 */ 0, { 20, 21 } },
{ /* 42 */ 0, { 21, 22 } },
{ /* 43 */ 0, { 22, 23 } },
{ /* 44 */ 0, { 23, 24 } },
{ /* 45 */ 0, { 24, 25 } },
{ /* 46 */ 0, { 25, 26 } },
{ /* 47 */ 1, { 3, 0 } },
{ /* 48 */ 1, { 0, 3 } },
{ /* 49 */ 1, { 2, 3 } },
{ /* 50 */ 1, { 3, 2 } },
{ /* 51 */ 1, { 1, 4 } },
{ /* 52 */ 1, { 4, 1 } },
{ /* 53 */ 1, { 2, 4 } },
{ /* 54 */ 1, { 1, 5 } },
{ /* 55 */ 0, { 18, 19 } },
{ /* 56 */ 0, { 19, 20 } },
{ /* 57 */ 0, { 20, 21 } },
{ /* 58 */ 0, { 21, 22 } },
{ /* 59 */ 0, { 22, 23 } },
{ /* 60 */ 0, { 23, 24 } },
{ /* 61 */ 0, { 24, 25 } },
{ /* 62 */ 0, { 25, 26 } },
{ /* 63 */ 0, { 26, 27 } },
{ /* 64 */ 0, { 27, 28 } },
{ /* 65 */ 0, { 28, 29 } },
{ /* 66 */ 0, { 29, 30 } },
{ /* 67 */ 0, { 30, 31 } },
{ /* 68 */ 0, { 31, 32 } },
{ /* 69 */ 0, { 32, 33 } },
{ /* 70 */ 0, { 33, 34 } },
{ /* 71 */ 0, { 34, 35 } },
{ /* 72 */ 0, { 35, 36 } },
{ /* 73 */ 1, { 4, 2 } },
{ /* 74 */ 1, { 3, 3 } },
{ /* 75 */ 1, { 0, 4 } },
{ /* 76 */ 1, { 4, 0 } },
{ /* 77 */ 1, { 5, 1 } },
{ /* 78 */ 1, { 2, 5 } },
{ /* 79 */ 1, { 1, 6 } },
{ /* 80 */ 1, { 3, 4 } },
{ /* 81 */ 1, { 5, 2 } },
{ /* 82 */ 1, { 6, 1 } },
{ /* 83 */ 1, { 4, 3 } },
{ /* 84 */ 0, { 25, 26 } },
{ /* 85 */ 0, { 26, 27 } },
{ /* 86 */ 0, { 27, 28 } },
{ /* 87 */ 0, { 28, 29 } },
{ /* 88 */ 0, { 29, 30 } },
{ /* 89 */ 0, { 30, 31 } },
{ /* 90 */ 0, { 31, 32 } },
{ /* 91 */ 0, { 32, 33 } },
{ /* 92 */ 0, { 33, 34 } },
{ /* 93 */ 0, { 34, 35 } },
{ /* 94 */ 0, { 35, 36 } },
{ /* 95 */ 0, { 36, 37 } },
{ /* 96 */ 0, { 37, 38 } },
{ /* 97 */ 0, { 38, 39 } },
{ /* 98 */ 0, { 39, 40 } },
{ /* 99 */ 0, { 40, 41 } },
{ /* 00 */ 0, { 41, 42 } },
{ /* 01 */ 0, { 42, 43 } },
{ /* 02 */ 0, { 43, 44 } },
{ /* 03 */ 0, { 44, 45 } },
{ /* 04 */ 0, { 45, 46 } },
{ /* 05 */ 0, { 46, 47 } },
{ /* 06 */ 0, { 47, 48 } },
{ /* 07 */ 0, { 48, 49 } },
{ /* 08 */ 0, { 49, 50 } },
{ /* 09 */ 1, { 0, 5 } },
{ /* 10 */ 1, { 2, 6 } },
{ /* 11 */ 1, { 5, 0 } },
{ /* 12 */ 1, { 1, 7 } },
{ /* 13 */ 1, { 3, 5 } },
{ /* 14 */ 1, { 1, 8 } },
{ /* 15 */ 1, { 8, 1 } },
{ /* 16 */ 1, { 4, 4 } },
{ /* 17 */ 1, { 5, 3 } },
{ /* 18 */ 1, { 6, 2 } },
{ /* 19 */ 1, { 7, 1 } },
{ /* 20 */ 1, { 0, 6 } },
{ /* 21 */ 1, { 8, 2 } },
{ /* 22 */ 1, { 2, 8 } },
{ /* 23 */ 1, { 3, 6 } },
{ /* 24 */ 1, { 2, 7 } },
{ /* 25 */ 1, { 4, 5 } },
{ /* 26 */ 1, { 9, 1 } },
{ /* 27 */ 1, { 1, 9 } },
{ /* 28 */ 1, { 7, 2 } },
{ /* 29 */ 0, { 30, 31 } },
{ /* 30 */ 0, { 31, 32 } },
{ /* 31 */ 0, { 32, 33 } },
{ /* 32 */ 0, { 33, 34 } },
{ /* 33 */ 0, { 34, 35 } },
{ /* 34 */ 0, { 35, 36 } },
{ /* 35 */ 0, { 36, 37 } },
{ /* 36 */ 0, { 37, 38 } },
{ /* 37 */ 0, { 38, 39 } },
{ /* 38 */ 0, { 39, 40 } },
{ /* 39 */ 0, { 40, 41 } },
{ /* 40 */ 0, { 41, 42 } },
{ /* 41 */ 0, { 42, 43 } },
{ /* 42 */ 0, { 43, 44 } },
{ /* 43 */ 0, { 44, 45 } },
{ /* 44 */ 0, { 45, 46 } },
{ /* 45 */ 0, { 46, 47 } },
{ /* 46 */ 0, { 47, 48 } },
{ /* 47 */ 0, { 48, 49 } },
{ /* 48 */ 0, { 49, 50 } },
{ /* 49 */ 0, { 50, 51 } },
{ /* 50 */ 0, { 51, 52 } },
{ /* 51 */ 0, { 52, 53 } },
{ /* 52 */ 0, { 53, 54 } },
{ /* 53 */ 0, { 54, 55 } },
{ /* 54 */ 0, { 55, 56 } },
{ /* 55 */ 0, { 56, 57 } },
{ /* 56 */ 0, { 57, 58 } },
{ /* 57 */ 0, { 58, 59 } },
{ /* 58 */ 0, { 59, 60 } },
{ /* 59 */ 1, { 6, 0 } },
{ /* 60 */ 1, { 5, 4 } },
{ /* 61 */ 1, { 6, 3 } },
{ /* 62 */ 1, { 8, 3 } },
{ /* 63 */ 1, { 0, 7 } },
{ /* 64 */ 1, { 9, 2 } },
{ /* 65 */ 1, { 3, 8 } },
{ /* 66 */ 1, { 4, 6 } },
{ /* 67 */ 1, { 3, 7 } },
{ /* 68 */ 1, { 0, 8 } },
{ /* 69 */ 1, { 10, 1 } },
{ /* 70 */ 1, { 6, 4 } },
{ /* 71 */ 1, { 2, 9 } },
{ /* 72 */ 1, { 5, 5 } },
{ /* 73 */ 1, { 8, 0 } },
{ /* 74 */ 1, { 7, 0 } },
{ /* 75 */ 1, { 7, 3 } },
{ /* 76 */ 1, { 10, 2 } },
{ /* 77 */ 1, { 9, 3 } },
{ /* 78 */ 1, { 8, 4 } },
{ /* 79 */ 1, { 1, 10 } },
{ /* 80 */ 1, { 7, 4 } },
{ /* 81 */ 1, { 6, 5 } },
{ /* 82 */ 1, { 5, 6 } },
{ /* 83 */ 1, { 4, 8 } },
{ /* 84 */ 1, { 4, 7 } },
{ /* 85 */ 1, { 3, 9 } },
{ /* 86 */ 1, { 11, 1 } },
{ /* 87 */ 1, { 5, 8 } },
{ /* 88 */ 1, { 9, 0 } },
{ /* 89 */ 1, { 8, 5 } },
{ /* 90 */ 0, { 29, 30 } },
{ /* 91 */ 0, { 30, 31 } },
{ /* 92 */ 0, { 31, 32 } },
{ /* 93 */ 0, { 32, 33 } },
{ /* 94 */ 0, { 33, 34 } },
{ /* 95 */ 0, { 34, 35 } },
{ /* 96 */ 0, { 35, 36 } },
{ /* 97 */ 0, { 36, 37 } },
{ /* 98 */ 0, { 37, 38 } },
{ /* 99 */ 0, { 38, 39 } },
{ /* 00 */ 0, { 39, 40 } },
{ /* 01 */ 0, { 40, 41 } },
{ /* 02 */ 0, { 41, 42 } },
{ /* 03 */ 0, { 42, 43 } },
{ /* 04 */ 0, { 43, 44 } },
{ /* 05 */ 0, { 44, 45 } },
{ /* 06 */ 0, { 45, 46 } },
{ /* 07 */ 0, { 46, 47 } },
{ /* 08 */ 0, { 47, 48 } },
{ /* 09 */ 0, { 48, 49 } },
{ /* 10 */ 0, { 49, 50 } },
{ /* 11 */ 0, { 50, 51 } },
{ /* 12 */ 0, { 51, 52 } },
{ /* 13 */ 0, { 52, 53 } },
{ /* 14 */ 0, { 53, 54 } },
{ /* 15 */ 0, { 54, 55 } },
{ /* 16 */ 0, { 55, 56 } },
{ /* 17 */ 0, { 56, 57 } },
{ /* 18 */ 0, { 57, 58 } },
{ /* 19 */ 1, { 10, 3 } },
{ /* 20 */ 1, { 2, 10 } },
{ /* 21 */ 1, { 0, 9 } },
{ /* 22 */ 1, { 11, 2 } },
{ /* 23 */ 1, { 9, 4 } },
{ /* 24 */ 1, { 6, 6 } },
{ /* 25 */ 1, { 12, 1 } },
{ /* 26 */ 1, { 4, 9 } },
{ /* 27 */ 1, { 8, 6 } },
{ /* 28 */ 1, { 1, 11 } },
{ /* 29 */ 1, { 9, 5 } },
{ /* 30 */ 1, { 10, 4 } },
{ /* 31 */ 1, { 5, 7 } },
{ /* 32 */ 1, { 7, 5 } },
{ /* 33 */ 1, { 2, 11 } },
{ /* 34 */ 1, { 1, 12 } },
{ /* 35 */ 1, { 12, 2 } },
{ /* 36 */ 1, { 11, 3 } },
{ /* 37 */ 1, { 3, 10 } },
{ /* 38 */ 1, { 5, 9 } },
{ /* 39 */ 1, { 6, 7 } },
{ /* 40 */ 1, { 8, 7 } },
{ /* 41 */ 1, { 11, 4 } },
{ /* 42 */ 1, { 0, 10 } },
{ /* 43 */ 1, { 7, 6 } },
{ /* 44 */ 1, { 12, 3 } },
{ /* 45 */ 1, { 10, 0 } },
{ /* 46 */ 1, { 10, 5 } },
{ /* 47 */ 1, { 4, 10 } },
{ /* 48 */ 1, { 6, 8 } },
{ /* 49 */ 1, { 2, 12 } },
{ /* 50 */ 1, { 9, 6 } },
{ /* 51 */ 1, { 9, 7 } },
{ /* 52 */ 1, { 4, 11 } },
{ /* 53 */ 1, { 11, 0 } },
{ /* 54 */ 1, { 6, 9 } },
{ /* 55 */ 1, { 3, 11 } },
{ /* 56 */ 1, { 5, 10 } },
{ /* 57 */ 0, { 20, 21 } },
{ /* 58 */ 0, { 21, 22 } },
{ /* 59 */ 0, { 22, 23 } },
{ /* 60 */ 0, { 23, 24 } },
{ /* 61 */ 0, { 24, 25 } },
{ /* 62 */ 0, { 25, 26 } },
{ /* 63 */ 0, { 26, 27 } },
{ /* 64 */ 0, { 27, 28 } },
{ /* 65 */ 0, { 28, 29 } },
{ /* 66 */ 0, { 29, 30 } },
{ /* 67 */ 0, { 30, 31 } },
{ /* 68 */ 0, { 31, 32 } },
{ /* 69 */ 0, { 32, 33 } },
{ /* 70 */ 0, { 33, 34 } },
{ /* 71 */ 0, { 34, 35 } },
{ /* 72 */ 0, { 35, 36 } },
{ /* 73 */ 0, { 36, 37 } },
{ /* 74 */ 0, { 37, 38 } },
{ /* 75 */ 0, { 38, 39 } },
{ /* 76 */ 0, { 39, 40 } },
{ /* 77 */ 1, { 8, 8 } },
{ /* 78 */ 1, { 7, 8 } },
{ /* 79 */ 1, { 12, 5 } },
{ /* 80 */ 1, { 3, 12 } },
{ /* 81 */ 1, { 11, 5 } },
{ /* 82 */ 1, { 7, 7 } },
{ /* 83 */ 1, { 12, 4 } },
{ /* 84 */ 1, { 11, 6 } },
{ /* 85 */ 1, { 10, 6 } },
{ /* 86 */ 1, { 4, 12 } },
{ /* 87 */ 1, { 7, 9 } },
{ /* 88 */ 1, { 5, 11 } },
{ /* 89 */ 1, { 0, 11 } },
{ /* 90 */ 1, { 12, 6 } },
{ /* 91 */ 1, { 6, 10 } },
{ /* 92 */ 1, { 12, 0 } },
{ /* 93 */ 1, { 10, 7 } },
{ /* 94 */ 1, { 5, 12 } },
{ /* 95 */ 1, { 7, 10 } },
{ /* 96 */ 1, { 9, 8 } },
{ /* 97 */ 1, { 0, 12 } },
{ /* 98 */ 1, { 11, 7 } },
{ /* 99 */ 1, { 8, 9 } },
{ /* 00 */ 1, { 9, 9 } },
{ /* 01 */ 1, { 10, 8 } },
{ /* 02 */ 1, { 7, 11 } },
{ /* 03 */ 1, { 12, 7 } },
{ /* 04 */ 1, { 6, 11 } },
{ /* 05 */ 1, { 8, 11 } },
{ /* 06 */ 1, { 11, 8 } },
{ /* 07 */ 1, { 7, 12 } },
{ /* 08 */ 1, { 6, 12 } },
{ /* 09 */ 0, { 8, 9 } },
{ /* 10 */ 0, { 9, 10 } },
{ /* 11 */ 0, { 10, 11 } },
{ /* 12 */ 0, { 11, 12 } },
{ /* 13 */ 0, { 12, 13 } },
{ /* 14 */ 0, { 13, 14 } },
{ /* 15 */ 0, { 14, 15 } },
{ /* 16 */ 0, { 15, 16 } },
{ /* 17 */ 1, { 8, 10 } },
{ /* 18 */ 1, { 10, 9 } },
{ /* 19 */ 1, { 8, 12 } },
{ /* 20 */ 1, { 9, 10 } },
{ /* 21 */ 1, { 9, 11 } },
{ /* 22 */ 1, { 9, 12 } },
{ /* 23 */ 1, { 10, 11 } },
{ /* 24 */ 1, { 12, 9 } },
{ /* 25 */ 1, { 10, 10 } },
{ /* 26 */ 1, { 11, 9 } },
{ /* 27 */ 1, { 12, 8 } },
{ /* 28 */ 1, { 11, 10 } },
{ /* 29 */ 1, { 12, 10 } },
{ /* 30 */ 1, { 12, 11 } },
{ /* 31 */ 0, { 2, 3 } },
{ /* 32 */ 0, { 3, 4 } },
{ /* 33 */ 1, { 10, 12 } },
{ /* 34 */ 1, { 11, 11 } },
{ /* 35 */ 1, { 11, 12 } },
{ /* 36 */ 1, { 12, 12 } }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_9.h,v 1.5 2007/11/01 12:34:11 menno Exp $
**/
/* Binary search huffman table HCB_9 */
static hcb_bin_pair hcb9[] = {
{ /* 0 */ 0, { 1, 2 } },
{ /* 1 */ 1, { 0, 0 } },
{ /* 2 */ 0, { 1, 2 } },
{ /* 3 */ 0, { 2, 3 } },
{ /* 4 */ 0, { 3, 4 } },
{ /* 5 */ 1, { 1, 0 } },
{ /* 6 */ 1, { 0, 1 } },
{ /* 7 */ 0, { 2, 3 } },
{ /* 8 */ 0, { 3, 4 } },
{ /* 9 */ 1, { 1, 1 } },
{ /* 10 */ 0, { 3, 4 } },
{ /* 11 */ 0, { 4, 5 } },
{ /* 12 */ 0, { 5, 6 } },
{ /* 13 */ 0, { 6, 7 } },
{ /* 14 */ 0, { 7, 8 } },
{ /* 15 */ 0, { 8, 9 } },
{ /* 16 */ 0, { 9, 10 } },
{ /* 17 */ 0, { 10, 11 } },
{ /* 18 */ 0, { 11, 12 } },
{ /* 19 */ 1, { 2, 1 } },
{ /* 20 */ 1, { 1, 2 } },
{ /* 21 */ 1, { 2, 0 } },
{ /* 22 */ 1, { 0, 2 } },
{ /* 23 */ 0, { 8, 9 } },
{ /* 24 */ 0, { 9, 10 } },
{ /* 25 */ 0, { 10, 11 } },
{ /* 26 */ 0, { 11, 12 } },
{ /* 27 */ 0, { 12, 13 } },
{ /* 28 */ 0, { 13, 14 } },
{ /* 29 */ 0, { 14, 15 } },
{ /* 30 */ 0, { 15, 16 } },
{ /* 31 */ 1, { 3, 1 } },
{ /* 32 */ 1, { 2, 2 } },
{ /* 33 */ 1, { 1, 3 } },
{ /* 34 */ 0, { 13, 14 } },
{ /* 35 */ 0, { 14, 15 } },
{ /* 36 */ 0, { 15, 16 } },
{ /* 37 */ 0, { 16, 17 } },
{ /* 38 */ 0, { 17, 18 } },
{ /* 39 */ 0, { 18, 19 } },
{ /* 40 */ 0, { 19, 20 } },
{ /* 41 */ 0, { 20, 21 } },
{ /* 42 */ 0, { 21, 22 } },
{ /* 43 */ 0, { 22, 23 } },
{ /* 44 */ 0, { 23, 24 } },
{ /* 45 */ 0, { 24, 25 } },
{ /* 46 */ 0, { 25, 26 } },
{ /* 47 */ 1, { 3, 0 } },
{ /* 48 */ 1, { 0, 3 } },
{ /* 49 */ 1, { 2, 3 } },
{ /* 50 */ 1, { 3, 2 } },
{ /* 51 */ 1, { 1, 4 } },
{ /* 52 */ 1, { 4, 1 } },
{ /* 53 */ 1, { 2, 4 } },
{ /* 54 */ 1, { 1, 5 } },
{ /* 55 */ 0, { 18, 19 } },
{ /* 56 */ 0, { 19, 20 } },
{ /* 57 */ 0, { 20, 21 } },
{ /* 58 */ 0, { 21, 22 } },
{ /* 59 */ 0, { 22, 23 } },
{ /* 60 */ 0, { 23, 24 } },
{ /* 61 */ 0, { 24, 25 } },
{ /* 62 */ 0, { 25, 26 } },
{ /* 63 */ 0, { 26, 27 } },
{ /* 64 */ 0, { 27, 28 } },
{ /* 65 */ 0, { 28, 29 } },
{ /* 66 */ 0, { 29, 30 } },
{ /* 67 */ 0, { 30, 31 } },
{ /* 68 */ 0, { 31, 32 } },
{ /* 69 */ 0, { 32, 33 } },
{ /* 70 */ 0, { 33, 34 } },
{ /* 71 */ 0, { 34, 35 } },
{ /* 72 */ 0, { 35, 36 } },
{ /* 73 */ 1, { 4, 2 } },
{ /* 74 */ 1, { 3, 3 } },
{ /* 75 */ 1, { 0, 4 } },
{ /* 76 */ 1, { 4, 0 } },
{ /* 77 */ 1, { 5, 1 } },
{ /* 78 */ 1, { 2, 5 } },
{ /* 79 */ 1, { 1, 6 } },
{ /* 80 */ 1, { 3, 4 } },
{ /* 81 */ 1, { 5, 2 } },
{ /* 82 */ 1, { 6, 1 } },
{ /* 83 */ 1, { 4, 3 } },
{ /* 84 */ 0, { 25, 26 } },
{ /* 85 */ 0, { 26, 27 } },
{ /* 86 */ 0, { 27, 28 } },
{ /* 87 */ 0, { 28, 29 } },
{ /* 88 */ 0, { 29, 30 } },
{ /* 89 */ 0, { 30, 31 } },
{ /* 90 */ 0, { 31, 32 } },
{ /* 91 */ 0, { 32, 33 } },
{ /* 92 */ 0, { 33, 34 } },
{ /* 93 */ 0, { 34, 35 } },
{ /* 94 */ 0, { 35, 36 } },
{ /* 95 */ 0, { 36, 37 } },
{ /* 96 */ 0, { 37, 38 } },
{ /* 97 */ 0, { 38, 39 } },
{ /* 98 */ 0, { 39, 40 } },
{ /* 99 */ 0, { 40, 41 } },
{ /* 00 */ 0, { 41, 42 } },
{ /* 01 */ 0, { 42, 43 } },
{ /* 02 */ 0, { 43, 44 } },
{ /* 03 */ 0, { 44, 45 } },
{ /* 04 */ 0, { 45, 46 } },
{ /* 05 */ 0, { 46, 47 } },
{ /* 06 */ 0, { 47, 48 } },
{ /* 07 */ 0, { 48, 49 } },
{ /* 08 */ 0, { 49, 50 } },
{ /* 09 */ 1, { 0, 5 } },
{ /* 10 */ 1, { 2, 6 } },
{ /* 11 */ 1, { 5, 0 } },
{ /* 12 */ 1, { 1, 7 } },
{ /* 13 */ 1, { 3, 5 } },
{ /* 14 */ 1, { 1, 8 } },
{ /* 15 */ 1, { 8, 1 } },
{ /* 16 */ 1, { 4, 4 } },
{ /* 17 */ 1, { 5, 3 } },
{ /* 18 */ 1, { 6, 2 } },
{ /* 19 */ 1, { 7, 1 } },
{ /* 20 */ 1, { 0, 6 } },
{ /* 21 */ 1, { 8, 2 } },
{ /* 22 */ 1, { 2, 8 } },
{ /* 23 */ 1, { 3, 6 } },
{ /* 24 */ 1, { 2, 7 } },
{ /* 25 */ 1, { 4, 5 } },
{ /* 26 */ 1, { 9, 1 } },
{ /* 27 */ 1, { 1, 9 } },
{ /* 28 */ 1, { 7, 2 } },
{ /* 29 */ 0, { 30, 31 } },
{ /* 30 */ 0, { 31, 32 } },
{ /* 31 */ 0, { 32, 33 } },
{ /* 32 */ 0, { 33, 34 } },
{ /* 33 */ 0, { 34, 35 } },
{ /* 34 */ 0, { 35, 36 } },
{ /* 35 */ 0, { 36, 37 } },
{ /* 36 */ 0, { 37, 38 } },
{ /* 37 */ 0, { 38, 39 } },
{ /* 38 */ 0, { 39, 40 } },
{ /* 39 */ 0, { 40, 41 } },
{ /* 40 */ 0, { 41, 42 } },
{ /* 41 */ 0, { 42, 43 } },
{ /* 42 */ 0, { 43, 44 } },
{ /* 43 */ 0, { 44, 45 } },
{ /* 44 */ 0, { 45, 46 } },
{ /* 45 */ 0, { 46, 47 } },
{ /* 46 */ 0, { 47, 48 } },
{ /* 47 */ 0, { 48, 49 } },
{ /* 48 */ 0, { 49, 50 } },
{ /* 49 */ 0, { 50, 51 } },
{ /* 50 */ 0, { 51, 52 } },
{ /* 51 */ 0, { 52, 53 } },
{ /* 52 */ 0, { 53, 54 } },
{ /* 53 */ 0, { 54, 55 } },
{ /* 54 */ 0, { 55, 56 } },
{ /* 55 */ 0, { 56, 57 } },
{ /* 56 */ 0, { 57, 58 } },
{ /* 57 */ 0, { 58, 59 } },
{ /* 58 */ 0, { 59, 60 } },
{ /* 59 */ 1, { 6, 0 } },
{ /* 60 */ 1, { 5, 4 } },
{ /* 61 */ 1, { 6, 3 } },
{ /* 62 */ 1, { 8, 3 } },
{ /* 63 */ 1, { 0, 7 } },
{ /* 64 */ 1, { 9, 2 } },
{ /* 65 */ 1, { 3, 8 } },
{ /* 66 */ 1, { 4, 6 } },
{ /* 67 */ 1, { 3, 7 } },
{ /* 68 */ 1, { 0, 8 } },
{ /* 69 */ 1, { 10, 1 } },
{ /* 70 */ 1, { 6, 4 } },
{ /* 71 */ 1, { 2, 9 } },
{ /* 72 */ 1, { 5, 5 } },
{ /* 73 */ 1, { 8, 0 } },
{ /* 74 */ 1, { 7, 0 } },
{ /* 75 */ 1, { 7, 3 } },
{ /* 76 */ 1, { 10, 2 } },
{ /* 77 */ 1, { 9, 3 } },
{ /* 78 */ 1, { 8, 4 } },
{ /* 79 */ 1, { 1, 10 } },
{ /* 80 */ 1, { 7, 4 } },
{ /* 81 */ 1, { 6, 5 } },
{ /* 82 */ 1, { 5, 6 } },
{ /* 83 */ 1, { 4, 8 } },
{ /* 84 */ 1, { 4, 7 } },
{ /* 85 */ 1, { 3, 9 } },
{ /* 86 */ 1, { 11, 1 } },
{ /* 87 */ 1, { 5, 8 } },
{ /* 88 */ 1, { 9, 0 } },
{ /* 89 */ 1, { 8, 5 } },
{ /* 90 */ 0, { 29, 30 } },
{ /* 91 */ 0, { 30, 31 } },
{ /* 92 */ 0, { 31, 32 } },
{ /* 93 */ 0, { 32, 33 } },
{ /* 94 */ 0, { 33, 34 } },
{ /* 95 */ 0, { 34, 35 } },
{ /* 96 */ 0, { 35, 36 } },
{ /* 97 */ 0, { 36, 37 } },
{ /* 98 */ 0, { 37, 38 } },
{ /* 99 */ 0, { 38, 39 } },
{ /* 00 */ 0, { 39, 40 } },
{ /* 01 */ 0, { 40, 41 } },
{ /* 02 */ 0, { 41, 42 } },
{ /* 03 */ 0, { 42, 43 } },
{ /* 04 */ 0, { 43, 44 } },
{ /* 05 */ 0, { 44, 45 } },
{ /* 06 */ 0, { 45, 46 } },
{ /* 07 */ 0, { 46, 47 } },
{ /* 08 */ 0, { 47, 48 } },
{ /* 09 */ 0, { 48, 49 } },
{ /* 10 */ 0, { 49, 50 } },
{ /* 11 */ 0, { 50, 51 } },
{ /* 12 */ 0, { 51, 52 } },
{ /* 13 */ 0, { 52, 53 } },
{ /* 14 */ 0, { 53, 54 } },
{ /* 15 */ 0, { 54, 55 } },
{ /* 16 */ 0, { 55, 56 } },
{ /* 17 */ 0, { 56, 57 } },
{ /* 18 */ 0, { 57, 58 } },
{ /* 19 */ 1, { 10, 3 } },
{ /* 20 */ 1, { 2, 10 } },
{ /* 21 */ 1, { 0, 9 } },
{ /* 22 */ 1, { 11, 2 } },
{ /* 23 */ 1, { 9, 4 } },
{ /* 24 */ 1, { 6, 6 } },
{ /* 25 */ 1, { 12, 1 } },
{ /* 26 */ 1, { 4, 9 } },
{ /* 27 */ 1, { 8, 6 } },
{ /* 28 */ 1, { 1, 11 } },
{ /* 29 */ 1, { 9, 5 } },
{ /* 30 */ 1, { 10, 4 } },
{ /* 31 */ 1, { 5, 7 } },
{ /* 32 */ 1, { 7, 5 } },
{ /* 33 */ 1, { 2, 11 } },
{ /* 34 */ 1, { 1, 12 } },
{ /* 35 */ 1, { 12, 2 } },
{ /* 36 */ 1, { 11, 3 } },
{ /* 37 */ 1, { 3, 10 } },
{ /* 38 */ 1, { 5, 9 } },
{ /* 39 */ 1, { 6, 7 } },
{ /* 40 */ 1, { 8, 7 } },
{ /* 41 */ 1, { 11, 4 } },
{ /* 42 */ 1, { 0, 10 } },
{ /* 43 */ 1, { 7, 6 } },
{ /* 44 */ 1, { 12, 3 } },
{ /* 45 */ 1, { 10, 0 } },
{ /* 46 */ 1, { 10, 5 } },
{ /* 47 */ 1, { 4, 10 } },
{ /* 48 */ 1, { 6, 8 } },
{ /* 49 */ 1, { 2, 12 } },
{ /* 50 */ 1, { 9, 6 } },
{ /* 51 */ 1, { 9, 7 } },
{ /* 52 */ 1, { 4, 11 } },
{ /* 53 */ 1, { 11, 0 } },
{ /* 54 */ 1, { 6, 9 } },
{ /* 55 */ 1, { 3, 11 } },
{ /* 56 */ 1, { 5, 10 } },
{ /* 57 */ 0, { 20, 21 } },
{ /* 58 */ 0, { 21, 22 } },
{ /* 59 */ 0, { 22, 23 } },
{ /* 60 */ 0, { 23, 24 } },
{ /* 61 */ 0, { 24, 25 } },
{ /* 62 */ 0, { 25, 26 } },
{ /* 63 */ 0, { 26, 27 } },
{ /* 64 */ 0, { 27, 28 } },
{ /* 65 */ 0, { 28, 29 } },
{ /* 66 */ 0, { 29, 30 } },
{ /* 67 */ 0, { 30, 31 } },
{ /* 68 */ 0, { 31, 32 } },
{ /* 69 */ 0, { 32, 33 } },
{ /* 70 */ 0, { 33, 34 } },
{ /* 71 */ 0, { 34, 35 } },
{ /* 72 */ 0, { 35, 36 } },
{ /* 73 */ 0, { 36, 37 } },
{ /* 74 */ 0, { 37, 38 } },
{ /* 75 */ 0, { 38, 39 } },
{ /* 76 */ 0, { 39, 40 } },
{ /* 77 */ 1, { 8, 8 } },
{ /* 78 */ 1, { 7, 8 } },
{ /* 79 */ 1, { 12, 5 } },
{ /* 80 */ 1, { 3, 12 } },
{ /* 81 */ 1, { 11, 5 } },
{ /* 82 */ 1, { 7, 7 } },
{ /* 83 */ 1, { 12, 4 } },
{ /* 84 */ 1, { 11, 6 } },
{ /* 85 */ 1, { 10, 6 } },
{ /* 86 */ 1, { 4, 12 } },
{ /* 87 */ 1, { 7, 9 } },
{ /* 88 */ 1, { 5, 11 } },
{ /* 89 */ 1, { 0, 11 } },
{ /* 90 */ 1, { 12, 6 } },
{ /* 91 */ 1, { 6, 10 } },
{ /* 92 */ 1, { 12, 0 } },
{ /* 93 */ 1, { 10, 7 } },
{ /* 94 */ 1, { 5, 12 } },
{ /* 95 */ 1, { 7, 10 } },
{ /* 96 */ 1, { 9, 8 } },
{ /* 97 */ 1, { 0, 12 } },
{ /* 98 */ 1, { 11, 7 } },
{ /* 99 */ 1, { 8, 9 } },
{ /* 00 */ 1, { 9, 9 } },
{ /* 01 */ 1, { 10, 8 } },
{ /* 02 */ 1, { 7, 11 } },
{ /* 03 */ 1, { 12, 7 } },
{ /* 04 */ 1, { 6, 11 } },
{ /* 05 */ 1, { 8, 11 } },
{ /* 06 */ 1, { 11, 8 } },
{ /* 07 */ 1, { 7, 12 } },
{ /* 08 */ 1, { 6, 12 } },
{ /* 09 */ 0, { 8, 9 } },
{ /* 10 */ 0, { 9, 10 } },
{ /* 11 */ 0, { 10, 11 } },
{ /* 12 */ 0, { 11, 12 } },
{ /* 13 */ 0, { 12, 13 } },
{ /* 14 */ 0, { 13, 14 } },
{ /* 15 */ 0, { 14, 15 } },
{ /* 16 */ 0, { 15, 16 } },
{ /* 17 */ 1, { 8, 10 } },
{ /* 18 */ 1, { 10, 9 } },
{ /* 19 */ 1, { 8, 12 } },
{ /* 20 */ 1, { 9, 10 } },
{ /* 21 */ 1, { 9, 11 } },
{ /* 22 */ 1, { 9, 12 } },
{ /* 23 */ 1, { 10, 11 } },
{ /* 24 */ 1, { 12, 9 } },
{ /* 25 */ 1, { 10, 10 } },
{ /* 26 */ 1, { 11, 9 } },
{ /* 27 */ 1, { 12, 8 } },
{ /* 28 */ 1, { 11, 10 } },
{ /* 29 */ 1, { 12, 10 } },
{ /* 30 */ 1, { 12, 11 } },
{ /* 31 */ 0, { 2, 3 } },
{ /* 32 */ 0, { 3, 4 } },
{ /* 33 */ 1, { 10, 12 } },
{ /* 34 */ 1, { 11, 11 } },
{ /* 35 */ 1, { 11, 12 } },
{ /* 36 */ 1, { 12, 12 } }
};

549
src/contrib/aacdecoder/libfaad/codebook/hcb_sf.h Normal file → Executable file
View File

@ -1,273 +1,276 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_sf.h,v 1.1 2005/11/27 01:00:59 tonymillion Exp $
**/
/* Binary search huffman table HCB_SF */
static uint8_t hcb_sf[][2] = {
{ /* 0 */ 1, 2 },
{ /* 1 */ 60, 0 },
{ /* 2 */ 1, 2 },
{ /* 3 */ 2, 3 },
{ /* 4 */ 3, 4 },
{ /* 5 */ 59, 0 },
{ /* 6 */ 3, 4 },
{ /* 7 */ 4, 5 },
{ /* 8 */ 5, 6 },
{ /* 9 */ 61, 0 },
{ /* 10 */ 58, 0 },
{ /* 11 */ 62, 0 },
{ /* 12 */ 3, 4 },
{ /* 13 */ 4, 5 },
{ /* 14 */ 5, 6 },
{ /* 15 */ 57, 0 },
{ /* 16 */ 63, 0 },
{ /* 17 */ 4, 5 },
{ /* 18 */ 5, 6 },
{ /* 19 */ 6, 7 },
{ /* 20 */ 7, 8 },
{ /* 21 */ 56, 0 },
{ /* 22 */ 64, 0 },
{ /* 23 */ 55, 0 },
{ /* 24 */ 65, 0 },
{ /* 25 */ 4, 5 },
{ /* 26 */ 5, 6 },
{ /* 27 */ 6, 7 },
{ /* 28 */ 7, 8 },
{ /* 29 */ 66, 0 },
{ /* 30 */ 54, 0 },
{ /* 31 */ 67, 0 },
{ /* 32 */ 5, 6 },
{ /* 33 */ 6, 7 },
{ /* 34 */ 7, 8 },
{ /* 35 */ 8, 9 },
{ /* 36 */ 9, 10 },
{ /* 37 */ 53, 0 },
{ /* 38 */ 68, 0 },
{ /* 39 */ 52, 0 },
{ /* 40 */ 69, 0 },
{ /* 41 */ 51, 0 },
{ /* 42 */ 5, 6 },
{ /* 43 */ 6, 7 },
{ /* 44 */ 7, 8 },
{ /* 45 */ 8, 9 },
{ /* 46 */ 9, 10 },
{ /* 47 */ 70, 0 },
{ /* 48 */ 50, 0 },
{ /* 49 */ 49, 0 },
{ /* 50 */ 71, 0 },
{ /* 51 */ 6, 7 },
{ /* 52 */ 7, 8 },
{ /* 53 */ 8, 9 },
{ /* 54 */ 9, 10 },
{ /* 55 */ 10, 11 },
{ /* 56 */ 11, 12 },
{ /* 57 */ 72, 0 },
{ /* 58 */ 48, 0 },
{ /* 59 */ 73, 0 },
{ /* 60 */ 47, 0 },
{ /* 61 */ 74, 0 },
{ /* 62 */ 46, 0 },
{ /* 63 */ 6, 7 },
{ /* 64 */ 7, 8 },
{ /* 65 */ 8, 9 },
{ /* 66 */ 9, 10 },
{ /* 67 */ 10, 11 },
{ /* 68 */ 11, 12 },
{ /* 69 */ 76, 0 },
{ /* 70 */ 75, 0 },
{ /* 71 */ 77, 0 },
{ /* 72 */ 78, 0 },
{ /* 73 */ 45, 0 },
{ /* 74 */ 43, 0 },
{ /* 75 */ 6, 7 },
{ /* 76 */ 7, 8 },
{ /* 77 */ 8, 9 },
{ /* 78 */ 9, 10 },
{ /* 79 */ 10, 11 },
{ /* 80 */ 11, 12 },
{ /* 81 */ 44, 0 },
{ /* 82 */ 79, 0 },
{ /* 83 */ 42, 0 },
{ /* 84 */ 41, 0 },
{ /* 85 */ 80, 0 },
{ /* 86 */ 40, 0 },
{ /* 87 */ 6, 7 },
{ /* 88 */ 7, 8 },
{ /* 89 */ 8, 9 },
{ /* 90 */ 9, 10 },
{ /* 91 */ 10, 11 },
{ /* 92 */ 11, 12 },
{ /* 93 */ 81, 0 },
{ /* 94 */ 39, 0 },
{ /* 95 */ 82, 0 },
{ /* 96 */ 38, 0 },
{ /* 97 */ 83, 0 },
{ /* 98 */ 7, 8 },
{ /* 99 */ 8, 9 },
{ /* 00 */ 9, 10 },
{ /* 01 */ 10, 11 },
{ /* 02 */ 11, 12 },
{ /* 03 */ 12, 13 },
{ /* 04 */ 13, 14 },
{ /* 05 */ 37, 0 },
{ /* 06 */ 35, 0 },
{ /* 07 */ 85, 0 },
{ /* 08 */ 33, 0 },
{ /* 09 */ 36, 0 },
{ /* 10 */ 34, 0 },
{ /* 11 */ 84, 0 },
{ /* 12 */ 32, 0 },
{ /* 13 */ 6, 7 },
{ /* 14 */ 7, 8 },
{ /* 15 */ 8, 9 },
{ /* 16 */ 9, 10 },
{ /* 17 */ 10, 11 },
{ /* 18 */ 11, 12 },
{ /* 19 */ 87, 0 },
{ /* 20 */ 89, 0 },
{ /* 21 */ 30, 0 },
{ /* 22 */ 31, 0 },
{ /* 23 */ 8, 9 },
{ /* 24 */ 9, 10 },
{ /* 25 */ 10, 11 },
{ /* 26 */ 11, 12 },
{ /* 27 */ 12, 13 },
{ /* 28 */ 13, 14 },
{ /* 29 */ 14, 15 },
{ /* 30 */ 15, 16 },
{ /* 31 */ 86, 0 },
{ /* 32 */ 29, 0 },
{ /* 33 */ 26, 0 },
{ /* 34 */ 27, 0 },
{ /* 35 */ 28, 0 },
{ /* 36 */ 24, 0 },
{ /* 37 */ 88, 0 },
{ /* 38 */ 9, 10 },
{ /* 39 */ 10, 11 },
{ /* 40 */ 11, 12 },
{ /* 41 */ 12, 13 },
{ /* 42 */ 13, 14 },
{ /* 43 */ 14, 15 },
{ /* 44 */ 15, 16 },
{ /* 45 */ 16, 17 },
{ /* 46 */ 17, 18 },
{ /* 47 */ 25, 0 },
{ /* 48 */ 22, 0 },
{ /* 49 */ 23, 0 },
{ /* 50 */ 15, 16 },
{ /* 51 */ 16, 17 },
{ /* 52 */ 17, 18 },
{ /* 53 */ 18, 19 },
{ /* 54 */ 19, 20 },
{ /* 55 */ 20, 21 },
{ /* 56 */ 21, 22 },
{ /* 57 */ 22, 23 },
{ /* 58 */ 23, 24 },
{ /* 59 */ 24, 25 },
{ /* 60 */ 25, 26 },
{ /* 61 */ 26, 27 },
{ /* 62 */ 27, 28 },
{ /* 63 */ 28, 29 },
{ /* 64 */ 29, 30 },
{ /* 65 */ 90, 0 },
{ /* 66 */ 21, 0 },
{ /* 67 */ 19, 0 },
{ /* 68 */ 3, 0 },
{ /* 69 */ 1, 0 },
{ /* 70 */ 2, 0 },
{ /* 71 */ 0, 0 },
{ /* 72 */ 23, 24 },
{ /* 73 */ 24, 25 },
{ /* 74 */ 25, 26 },
{ /* 75 */ 26, 27 },
{ /* 76 */ 27, 28 },
{ /* 77 */ 28, 29 },
{ /* 78 */ 29, 30 },
{ /* 79 */ 30, 31 },
{ /* 80 */ 31, 32 },
{ /* 81 */ 32, 33 },
{ /* 82 */ 33, 34 },
{ /* 83 */ 34, 35 },
{ /* 84 */ 35, 36 },
{ /* 85 */ 36, 37 },
{ /* 86 */ 37, 38 },
{ /* 87 */ 38, 39 },
{ /* 88 */ 39, 40 },
{ /* 89 */ 40, 41 },
{ /* 90 */ 41, 42 },
{ /* 91 */ 42, 43 },
{ /* 92 */ 43, 44 },
{ /* 93 */ 44, 45 },
{ /* 94 */ 45, 46 },
{ /* 95 */ 98, 0 },
{ /* 96 */ 99, 0 },
{ /* 97 */ 100, 0 },
{ /* 98 */ 101, 0 },
{ /* 99 */ 102, 0 },
{ /* 00 */ 117, 0 },
{ /* 01 */ 97, 0 },
{ /* 02 */ 91, 0 },
{ /* 03 */ 92, 0 },
{ /* 04 */ 93, 0 },
{ /* 05 */ 94, 0 },
{ /* 06 */ 95, 0 },
{ /* 07 */ 96, 0 },
{ /* 08 */ 104, 0 },
{ /* 09 */ 111, 0 },
{ /* 10 */ 112, 0 },
{ /* 11 */ 113, 0 },
{ /* 12 */ 114, 0 },
{ /* 13 */ 115, 0 },
{ /* 14 */ 116, 0 },
{ /* 15 */ 110, 0 },
{ /* 16 */ 105, 0 },
{ /* 17 */ 106, 0 },
{ /* 18 */ 107, 0 },
{ /* 19 */ 108, 0 },
{ /* 20 */ 109, 0 },
{ /* 21 */ 118, 0 },
{ /* 22 */ 6, 0 },
{ /* 23 */ 8, 0 },
{ /* 24 */ 9, 0 },
{ /* 25 */ 10, 0 },
{ /* 26 */ 5, 0 },
{ /* 27 */ 103, 0 },
{ /* 28 */ 120, 0 },
{ /* 29 */ 119, 0 },
{ /* 30 */ 4, 0 },
{ /* 31 */ 7, 0 },
{ /* 32 */ 15, 0 },
{ /* 33 */ 16, 0 },
{ /* 34 */ 18, 0 },
{ /* 35 */ 20, 0 },
{ /* 36 */ 17, 0 },
{ /* 37 */ 11, 0 },
{ /* 38 */ 12, 0 },
{ /* 39 */ 14, 0 },
{ /* 40 */ 13, 0 }
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcb_sf.h,v 1.7 2007/11/01 12:34:11 menno Exp $
**/
/* Binary search huffman table HCB_SF */
static uint8_t hcb_sf[][2] = {
{ /* 0 */ 1, 2 },
{ /* 1 */ 60, 0 },
{ /* 2 */ 1, 2 },
{ /* 3 */ 2, 3 },
{ /* 4 */ 3, 4 },
{ /* 5 */ 59, 0 },
{ /* 6 */ 3, 4 },
{ /* 7 */ 4, 5 },
{ /* 8 */ 5, 6 },
{ /* 9 */ 61, 0 },
{ /* 10 */ 58, 0 },
{ /* 11 */ 62, 0 },
{ /* 12 */ 3, 4 },
{ /* 13 */ 4, 5 },
{ /* 14 */ 5, 6 },
{ /* 15 */ 57, 0 },
{ /* 16 */ 63, 0 },
{ /* 17 */ 4, 5 },
{ /* 18 */ 5, 6 },
{ /* 19 */ 6, 7 },
{ /* 20 */ 7, 8 },
{ /* 21 */ 56, 0 },
{ /* 22 */ 64, 0 },
{ /* 23 */ 55, 0 },
{ /* 24 */ 65, 0 },
{ /* 25 */ 4, 5 },
{ /* 26 */ 5, 6 },
{ /* 27 */ 6, 7 },
{ /* 28 */ 7, 8 },
{ /* 29 */ 66, 0 },
{ /* 30 */ 54, 0 },
{ /* 31 */ 67, 0 },
{ /* 32 */ 5, 6 },
{ /* 33 */ 6, 7 },
{ /* 34 */ 7, 8 },
{ /* 35 */ 8, 9 },
{ /* 36 */ 9, 10 },
{ /* 37 */ 53, 0 },
{ /* 38 */ 68, 0 },
{ /* 39 */ 52, 0 },
{ /* 40 */ 69, 0 },
{ /* 41 */ 51, 0 },
{ /* 42 */ 5, 6 },
{ /* 43 */ 6, 7 },
{ /* 44 */ 7, 8 },
{ /* 45 */ 8, 9 },
{ /* 46 */ 9, 10 },
{ /* 47 */ 70, 0 },
{ /* 48 */ 50, 0 },
{ /* 49 */ 49, 0 },
{ /* 50 */ 71, 0 },
{ /* 51 */ 6, 7 },
{ /* 52 */ 7, 8 },
{ /* 53 */ 8, 9 },
{ /* 54 */ 9, 10 },
{ /* 55 */ 10, 11 },
{ /* 56 */ 11, 12 },
{ /* 57 */ 72, 0 },
{ /* 58 */ 48, 0 },
{ /* 59 */ 73, 0 },
{ /* 60 */ 47, 0 },
{ /* 61 */ 74, 0 },
{ /* 62 */ 46, 0 },
{ /* 63 */ 6, 7 },
{ /* 64 */ 7, 8 },
{ /* 65 */ 8, 9 },
{ /* 66 */ 9, 10 },
{ /* 67 */ 10, 11 },
{ /* 68 */ 11, 12 },
{ /* 69 */ 76, 0 },
{ /* 70 */ 75, 0 },
{ /* 71 */ 77, 0 },
{ /* 72 */ 78, 0 },
{ /* 73 */ 45, 0 },
{ /* 74 */ 43, 0 },
{ /* 75 */ 6, 7 },
{ /* 76 */ 7, 8 },
{ /* 77 */ 8, 9 },
{ /* 78 */ 9, 10 },
{ /* 79 */ 10, 11 },
{ /* 80 */ 11, 12 },
{ /* 81 */ 44, 0 },
{ /* 82 */ 79, 0 },
{ /* 83 */ 42, 0 },
{ /* 84 */ 41, 0 },
{ /* 85 */ 80, 0 },
{ /* 86 */ 40, 0 },
{ /* 87 */ 6, 7 },
{ /* 88 */ 7, 8 },
{ /* 89 */ 8, 9 },
{ /* 90 */ 9, 10 },
{ /* 91 */ 10, 11 },
{ /* 92 */ 11, 12 },
{ /* 93 */ 81, 0 },
{ /* 94 */ 39, 0 },
{ /* 95 */ 82, 0 },
{ /* 96 */ 38, 0 },
{ /* 97 */ 83, 0 },
{ /* 98 */ 7, 8 },
{ /* 99 */ 8, 9 },
{ /* 00 */ 9, 10 },
{ /* 01 */ 10, 11 },
{ /* 02 */ 11, 12 },
{ /* 03 */ 12, 13 },
{ /* 04 */ 13, 14 },
{ /* 05 */ 37, 0 },
{ /* 06 */ 35, 0 },
{ /* 07 */ 85, 0 },
{ /* 08 */ 33, 0 },
{ /* 09 */ 36, 0 },
{ /* 10 */ 34, 0 },
{ /* 11 */ 84, 0 },
{ /* 12 */ 32, 0 },
{ /* 13 */ 6, 7 },
{ /* 14 */ 7, 8 },
{ /* 15 */ 8, 9 },
{ /* 16 */ 9, 10 },
{ /* 17 */ 10, 11 },
{ /* 18 */ 11, 12 },
{ /* 19 */ 87, 0 },
{ /* 20 */ 89, 0 },
{ /* 21 */ 30, 0 },
{ /* 22 */ 31, 0 },
{ /* 23 */ 8, 9 },
{ /* 24 */ 9, 10 },
{ /* 25 */ 10, 11 },
{ /* 26 */ 11, 12 },
{ /* 27 */ 12, 13 },
{ /* 28 */ 13, 14 },
{ /* 29 */ 14, 15 },
{ /* 30 */ 15, 16 },
{ /* 31 */ 86, 0 },
{ /* 32 */ 29, 0 },
{ /* 33 */ 26, 0 },
{ /* 34 */ 27, 0 },
{ /* 35 */ 28, 0 },
{ /* 36 */ 24, 0 },
{ /* 37 */ 88, 0 },
{ /* 38 */ 9, 10 },
{ /* 39 */ 10, 11 },
{ /* 40 */ 11, 12 },
{ /* 41 */ 12, 13 },
{ /* 42 */ 13, 14 },
{ /* 43 */ 14, 15 },
{ /* 44 */ 15, 16 },
{ /* 45 */ 16, 17 },
{ /* 46 */ 17, 18 },
{ /* 47 */ 25, 0 },
{ /* 48 */ 22, 0 },
{ /* 49 */ 23, 0 },
{ /* 50 */ 15, 16 },
{ /* 51 */ 16, 17 },
{ /* 52 */ 17, 18 },
{ /* 53 */ 18, 19 },
{ /* 54 */ 19, 20 },
{ /* 55 */ 20, 21 },
{ /* 56 */ 21, 22 },
{ /* 57 */ 22, 23 },
{ /* 58 */ 23, 24 },
{ /* 59 */ 24, 25 },
{ /* 60 */ 25, 26 },
{ /* 61 */ 26, 27 },
{ /* 62 */ 27, 28 },
{ /* 63 */ 28, 29 },
{ /* 64 */ 29, 30 },
{ /* 65 */ 90, 0 },
{ /* 66 */ 21, 0 },
{ /* 67 */ 19, 0 },
{ /* 68 */ 3, 0 },
{ /* 69 */ 1, 0 },
{ /* 70 */ 2, 0 },
{ /* 71 */ 0, 0 },
{ /* 72 */ 23, 24 },
{ /* 73 */ 24, 25 },
{ /* 74 */ 25, 26 },
{ /* 75 */ 26, 27 },
{ /* 76 */ 27, 28 },
{ /* 77 */ 28, 29 },
{ /* 78 */ 29, 30 },
{ /* 79 */ 30, 31 },
{ /* 80 */ 31, 32 },
{ /* 81 */ 32, 33 },
{ /* 82 */ 33, 34 },
{ /* 83 */ 34, 35 },
{ /* 84 */ 35, 36 },
{ /* 85 */ 36, 37 },
{ /* 86 */ 37, 38 },
{ /* 87 */ 38, 39 },
{ /* 88 */ 39, 40 },
{ /* 89 */ 40, 41 },
{ /* 90 */ 41, 42 },
{ /* 91 */ 42, 43 },
{ /* 92 */ 43, 44 },
{ /* 93 */ 44, 45 },
{ /* 94 */ 45, 46 },
{ /* 95 */ 98, 0 },
{ /* 96 */ 99, 0 },
{ /* 97 */ 100, 0 },
{ /* 98 */ 101, 0 },
{ /* 99 */ 102, 0 },
{ /* 00 */ 117, 0 },
{ /* 01 */ 97, 0 },
{ /* 02 */ 91, 0 },
{ /* 03 */ 92, 0 },
{ /* 04 */ 93, 0 },
{ /* 05 */ 94, 0 },
{ /* 06 */ 95, 0 },
{ /* 07 */ 96, 0 },
{ /* 08 */ 104, 0 },
{ /* 09 */ 111, 0 },
{ /* 10 */ 112, 0 },
{ /* 11 */ 113, 0 },
{ /* 12 */ 114, 0 },
{ /* 13 */ 115, 0 },
{ /* 14 */ 116, 0 },
{ /* 15 */ 110, 0 },
{ /* 16 */ 105, 0 },
{ /* 17 */ 106, 0 },
{ /* 18 */ 107, 0 },
{ /* 19 */ 108, 0 },
{ /* 20 */ 109, 0 },
{ /* 21 */ 118, 0 },
{ /* 22 */ 6, 0 },
{ /* 23 */ 8, 0 },
{ /* 24 */ 9, 0 },
{ /* 25 */ 10, 0 },
{ /* 26 */ 5, 0 },
{ /* 27 */ 103, 0 },
{ /* 28 */ 120, 0 },
{ /* 29 */ 119, 0 },
{ /* 30 */ 4, 0 },
{ /* 31 */ 7, 0 },
{ /* 32 */ 15, 0 },
{ /* 33 */ 16, 0 },
{ /* 34 */ 18, 0 },
{ /* 35 */ 20, 0 },
{ /* 36 */ 17, 0 },
{ /* 37 */ 11, 0 },
{ /* 38 */ 12, 0 },
{ /* 39 */ 14, 0 },
{ /* 40 */ 13, 0 }
};

826
src/contrib/aacdecoder/libfaad/common.c Normal file → Executable file
View File

@ -1,304 +1,522 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: common.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
/* just some common functions that could be used anywhere */
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include "syntax.h"
#ifdef USE_SSE
__declspec(naked) static int32_t __fastcall test_cpuid(void)
{
__asm
{
pushf
pop eax
mov ecx,eax
xor eax,(1<<21)
push eax
popf
pushf
pop eax
push ecx
popf
cmp eax,ecx
mov eax,0
setne al
ret
}
}
__declspec(naked) static void __fastcall run_cpuid(int32_t param, int32_t out[4])
{
__asm
{
pushad
push edx
mov eax,ecx
cpuid
pop edi
mov [edi+0],eax
mov [edi+4],ebx
mov [edi+8],ecx
mov [edi+12],edx
popad
ret
}
}
uint8_t cpu_has_sse()
{
int32_t features[4];
if (test_cpuid())
{
run_cpuid(1, features);
}
/* check for SSE */
if (features[3] & 0x02000000)
return 1;
return 0;
}
#else
uint8_t cpu_has_sse()
{
return 0;
}
#endif
/* Returns the sample rate index based on the samplerate */
uint8_t get_sr_index(const uint32_t samplerate)
{
if (92017 <= samplerate) return 0;
if (75132 <= samplerate) return 1;
if (55426 <= samplerate) return 2;
if (46009 <= samplerate) return 3;
if (37566 <= samplerate) return 4;
if (27713 <= samplerate) return 5;
if (23004 <= samplerate) return 6;
if (18783 <= samplerate) return 7;
if (13856 <= samplerate) return 8;
if (11502 <= samplerate) return 9;
if (9391 <= samplerate) return 10;
if (16428320 <= samplerate) return 11;
return 11;
}
/* Returns the sample rate based on the sample rate index */
uint32_t get_sample_rate(const uint8_t sr_index)
{
static const uint32_t sample_rates[] =
{
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000
};
if (sr_index < 12)
return sample_rates[sr_index];
return 0;
}
uint8_t max_pred_sfb(const uint8_t sr_index)
{
static const uint8_t pred_sfb_max[] =
{
33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34
};
if (sr_index < 12)
return pred_sfb_max[sr_index];
return 0;
}
uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
const uint8_t is_short)
{
/* entry for each sampling rate
* 1 Main/LC long window
* 2 Main/LC short window
* 3 SSR long window
* 4 SSR short window
*/
static const uint8_t tns_sbf_max[][4] =
{
{31, 9, 28, 7}, /* 96000 */
{31, 9, 28, 7}, /* 88200 */
{34, 10, 27, 7}, /* 64000 */
{40, 14, 26, 6}, /* 48000 */
{42, 14, 26, 6}, /* 44100 */
{51, 14, 26, 6}, /* 32000 */
{46, 14, 29, 7}, /* 24000 */
{46, 14, 29, 7}, /* 22050 */
{42, 14, 23, 8}, /* 16000 */
{42, 14, 23, 8}, /* 12000 */
{42, 14, 23, 8}, /* 11025 */
{39, 14, 19, 7}, /* 8000 */
{39, 14, 19, 7}, /* 7350 */
{0,0,0,0},
{0,0,0,0},
{0,0,0,0}
};
uint8_t i = 0;
if (is_short) i++;
if (object_type == SSR) i += 2;
return tns_sbf_max[sr_index][i];
}
/* Returns 0 if an object type is decodable, otherwise returns -1 */
int8_t can_decode_ot(const uint8_t object_type)
{
switch (object_type)
{
case LC:
return 0;
case MAIN:
#ifdef MAIN_DEC
return 0;
#else
return -1;
#endif
case SSR:
#ifdef SSR_DEC
return 0;
#else
return -1;
#endif
case LTP:
#ifdef LTP_DEC
return 0;
#else
return -1;
#endif
/* ER object types */
#ifdef ERROR_RESILIENCE
case ER_LC:
#ifdef DRM
case DRM_ER_LC:
#endif
return 0;
case ER_LTP:
#ifdef LTP_DEC
return 0;
#else
return -1;
#endif
case LD:
#ifdef LD_DEC
return 0;
#else
return -1;
#endif
#endif
}
return -1;
}
/* common malloc function */
void *faad_malloc(int32_t size)
{
#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
return _aligned_malloc(size, 16);
#else
return malloc(size);
#endif
}
/* common free function */
void faad_free(void *b)
{
#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
_aligned_free(b);
#else
free(b);
#endif
}
static const uint8_t Parity [256] = { // parity
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
};
static uint32_t __r1 = 1;
static uint32_t __r2 = 1;
/*
* This is a simple random number generator with good quality for audio purposes.
* It consists of two polycounters with opposite rotation direction and different
* periods. The periods are coprime, so the total period is the product of both.
*
* -------------------------------------------------------------------------------------------------
* +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0|
* | -------------------------------------------------------------------------------------------------
* | | | | | | |
* | +--+--+--+-XOR-+--------+
* | |
* +--------------------------------------------------------------------------------------+
*
* -------------------------------------------------------------------------------------------------
* |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+
* ------------------------------------------------------------------------------------------------- |
* | | | | |
* +--+----XOR----+--+ |
* | |
* +----------------------------------------------------------------------------------------+
*
*
* The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481,
* which gives a period of 18.410.713.077.675.721.215. The result is the
* XORed values of both generators.
*/
uint32_t random_int(void)
{
uint32_t t1, t2, t3, t4;
t3 = t1 = __r1; t4 = t2 = __r2; // Parity calculation is done via table lookup, this is also available
t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable
t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations.
t1 <<= 31; t2 = Parity [t2];
return (__r1 = (t3 >> 1) | t1 ) ^ (__r2 = (t4 + t4) | t2 );
}
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: common.c,v 1.27 2008/03/23 23:03:28 menno Exp $
**/
/* just some common functions that could be used anywhere */
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include "syntax.h"
/* Returns the sample rate index based on the samplerate */
uint8_t get_sr_index(const uint32_t samplerate)
{
if (92017 <= samplerate) return 0;
if (75132 <= samplerate) return 1;
if (55426 <= samplerate) return 2;
if (46009 <= samplerate) return 3;
if (37566 <= samplerate) return 4;
if (27713 <= samplerate) return 5;
if (23004 <= samplerate) return 6;
if (18783 <= samplerate) return 7;
if (13856 <= samplerate) return 8;
if (11502 <= samplerate) return 9;
if (9391 <= samplerate) return 10;
if (16428320 <= samplerate) return 11;
return 11;
}
/* Returns the sample rate based on the sample rate index */
uint32_t get_sample_rate(const uint8_t sr_index)
{
static const uint32_t sample_rates[] =
{
96000, 88200, 64000, 48000, 44100, 32000,
24000, 22050, 16000, 12000, 11025, 8000
};
if (sr_index < 12)
return sample_rates[sr_index];
return 0;
}
uint8_t max_pred_sfb(const uint8_t sr_index)
{
static const uint8_t pred_sfb_max[] =
{
33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34
};
if (sr_index < 12)
return pred_sfb_max[sr_index];
return 0;
}
uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
const uint8_t is_short)
{
/* entry for each sampling rate
* 1 Main/LC long window
* 2 Main/LC short window
* 3 SSR long window
* 4 SSR short window
*/
static const uint8_t tns_sbf_max[][4] =
{
{31, 9, 28, 7}, /* 96000 */
{31, 9, 28, 7}, /* 88200 */
{34, 10, 27, 7}, /* 64000 */
{40, 14, 26, 6}, /* 48000 */
{42, 14, 26, 6}, /* 44100 */
{51, 14, 26, 6}, /* 32000 */
{46, 14, 29, 7}, /* 24000 */
{46, 14, 29, 7}, /* 22050 */
{42, 14, 23, 8}, /* 16000 */
{42, 14, 23, 8}, /* 12000 */
{42, 14, 23, 8}, /* 11025 */
{39, 14, 19, 7}, /* 8000 */
{39, 14, 19, 7}, /* 7350 */
{0,0,0,0},
{0,0,0,0},
{0,0,0,0}
};
uint8_t i = 0;
if (is_short) i++;
if (object_type == SSR) i += 2;
return tns_sbf_max[sr_index][i];
}
/* Returns 0 if an object type is decodable, otherwise returns -1 */
int8_t can_decode_ot(const uint8_t object_type)
{
switch (object_type)
{
case LC:
return 0;
case MAIN:
#ifdef MAIN_DEC
return 0;
#else
return -1;
#endif
case SSR:
#ifdef SSR_DEC
return 0;
#else
return -1;
#endif
case LTP:
#ifdef LTP_DEC
return 0;
#else
return -1;
#endif
/* ER object types */
#ifdef ERROR_RESILIENCE
case ER_LC:
#ifdef DRM
case DRM_ER_LC:
#endif
return 0;
case ER_LTP:
#ifdef LTP_DEC
return 0;
#else
return -1;
#endif
case LD:
#ifdef LD_DEC
return 0;
#else
return -1;
#endif
#endif
}
return -1;
}
void *faad_malloc(size_t size)
{
#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
return _aligned_malloc(size, 16);
#else // #ifdef 0
return malloc(size);
#endif // #ifdef 0
}
/* common free function */
void faad_free(void *b)
{
#if 0 // defined(_WIN32) && !defined(_WIN32_WCE)
_aligned_free(b);
#else
free(b);
}
#endif
static const uint8_t Parity [256] = { // parity
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,
1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0
};
static uint32_t __r1 = 1;
static uint32_t __r2 = 1;
/*
* This is a simple random number generator with good quality for audio purposes.
* It consists of two polycounters with opposite rotation direction and different
* periods. The periods are coprime, so the total period is the product of both.
*
* -------------------------------------------------------------------------------------------------
* +-> |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0|
* | -------------------------------------------------------------------------------------------------
* | | | | | | |
* | +--+--+--+-XOR-+--------+
* | |
* +--------------------------------------------------------------------------------------+
*
* -------------------------------------------------------------------------------------------------
* |31:30:29:28:27:26:25:24:23:22:21:20:19:18:17:16:15:14:13:12:11:10: 9: 8: 7: 6: 5: 4: 3: 2: 1: 0| <-+
* ------------------------------------------------------------------------------------------------- |
* | | | | |
* +--+----XOR----+--+ |
* | |
* +----------------------------------------------------------------------------------------+
*
*
* The first has an period of 3*5*17*257*65537, the second of 7*47*73*178481,
* which gives a period of 18.410.713.077.675.721.215. The result is the
* XORed values of both generators.
*/
uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2)
{
uint32_t t1, t2, t3, t4;
t3 = t1 = *__r1; t4 = t2 = *__r2; // Parity calculation is done via table lookup, this is also available
t1 &= 0xF5; t2 >>= 25; // on CPUs without parity, can be implemented in C and avoid unpredictable
t1 = Parity [t1]; t2 &= 0x63; // jumps and slow rotate through the carry flag operations.
t1 <<= 31; t2 = Parity [t2];
return (*__r1 = (t3 >> 1) | t1 ) ^ (*__r2 = (t4 + t4) | t2 );
}
static uint32_t ones32(uint32_t x)
{
x -= ((x >> 1) & 0x55555555);
x = (((x >> 2) & 0x33333333) + (x & 0x33333333));
x = (((x >> 4) + x) & 0x0f0f0f0f);
x += (x >> 8);
x += (x >> 16);
return (x & 0x0000003f);
}
static uint32_t floor_log2(uint32_t x)
{
#if 1
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
return (ones32(x) - 1);
#else
uint32_t count = 0;
while (x >>= 1)
count++;
return count;
#endif
}
/* returns position of first bit that is not 0 from msb,
* starting count at lsb */
uint32_t wl_min_lzc(uint32_t x)
{
#if 1
x |= (x >> 1);
x |= (x >> 2);
x |= (x >> 4);
x |= (x >> 8);
x |= (x >> 16);
return (ones32(x));
#else
uint32_t count = 0;
while (x >>= 1)
count++;
return (count + 1);
#endif
}
#ifdef FIXED_POINT
#define TABLE_BITS 6
/* just take the maximum number of bits for interpolation */
#define INTERP_BITS (REAL_BITS-TABLE_BITS)
static const real_t pow2_tab[] = {
REAL_CONST(1.000000000000000), REAL_CONST(1.010889286051701), REAL_CONST(1.021897148654117),
REAL_CONST(1.033024879021228), REAL_CONST(1.044273782427414), REAL_CONST(1.055645178360557),
REAL_CONST(1.067140400676824), REAL_CONST(1.078760797757120), REAL_CONST(1.090507732665258),
REAL_CONST(1.102382583307841), REAL_CONST(1.114386742595892), REAL_CONST(1.126521618608242),
REAL_CONST(1.138788634756692), REAL_CONST(1.151189229952983), REAL_CONST(1.163724858777578),
REAL_CONST(1.176396991650281), REAL_CONST(1.189207115002721), REAL_CONST(1.202156731452703),
REAL_CONST(1.215247359980469), REAL_CONST(1.228480536106870), REAL_CONST(1.241857812073484),
REAL_CONST(1.255380757024691), REAL_CONST(1.269050957191733), REAL_CONST(1.282870016078778),
REAL_CONST(1.296839554651010), REAL_CONST(1.310961211524764), REAL_CONST(1.325236643159741),
REAL_CONST(1.339667524053303), REAL_CONST(1.354255546936893), REAL_CONST(1.369002422974591),
REAL_CONST(1.383909881963832), REAL_CONST(1.398979672538311), REAL_CONST(1.414213562373095),
REAL_CONST(1.429613338391970), REAL_CONST(1.445180806977047), REAL_CONST(1.460917794180647),
REAL_CONST(1.476826145939499), REAL_CONST(1.492907728291265), REAL_CONST(1.509164427593423),
REAL_CONST(1.525598150744538), REAL_CONST(1.542210825407941), REAL_CONST(1.559004400237837),
REAL_CONST(1.575980845107887), REAL_CONST(1.593142151342267), REAL_CONST(1.610490331949254),
REAL_CONST(1.628027421857348), REAL_CONST(1.645755478153965), REAL_CONST(1.663676580326736),
REAL_CONST(1.681792830507429), REAL_CONST(1.700106353718524), REAL_CONST(1.718619298122478),
REAL_CONST(1.737333835273706), REAL_CONST(1.756252160373300), REAL_CONST(1.775376492526521),
REAL_CONST(1.794709075003107), REAL_CONST(1.814252175500399), REAL_CONST(1.834008086409342),
REAL_CONST(1.853979125083386), REAL_CONST(1.874167634110300), REAL_CONST(1.894575981586966),
REAL_CONST(1.915206561397147), REAL_CONST(1.936061793492294), REAL_CONST(1.957144124175400),
REAL_CONST(1.978456026387951), REAL_CONST(2.000000000000000)
};
static const real_t log2_tab[] = {
REAL_CONST(0.000000000000000), REAL_CONST(0.022367813028455), REAL_CONST(0.044394119358453),
REAL_CONST(0.066089190457772), REAL_CONST(0.087462841250339), REAL_CONST(0.108524456778169),
REAL_CONST(0.129283016944966), REAL_CONST(0.149747119504682), REAL_CONST(0.169925001442312),
REAL_CONST(0.189824558880017), REAL_CONST(0.209453365628950), REAL_CONST(0.228818690495881),
REAL_CONST(0.247927513443585), REAL_CONST(0.266786540694901), REAL_CONST(0.285402218862248),
REAL_CONST(0.303780748177103), REAL_CONST(0.321928094887362), REAL_CONST(0.339850002884625),
REAL_CONST(0.357552004618084), REAL_CONST(0.375039431346925), REAL_CONST(0.392317422778760),
REAL_CONST(0.409390936137702), REAL_CONST(0.426264754702098), REAL_CONST(0.442943495848728),
REAL_CONST(0.459431618637297), REAL_CONST(0.475733430966398), REAL_CONST(0.491853096329675),
REAL_CONST(0.507794640198696), REAL_CONST(0.523561956057013), REAL_CONST(0.539158811108031),
REAL_CONST(0.554588851677637), REAL_CONST(0.569855608330948), REAL_CONST(0.584962500721156),
REAL_CONST(0.599912842187128), REAL_CONST(0.614709844115208), REAL_CONST(0.629356620079610),
REAL_CONST(0.643856189774725), REAL_CONST(0.658211482751795), REAL_CONST(0.672425341971496),
REAL_CONST(0.686500527183218), REAL_CONST(0.700439718141092), REAL_CONST(0.714245517666123),
REAL_CONST(0.727920454563199), REAL_CONST(0.741466986401147), REAL_CONST(0.754887502163469),
REAL_CONST(0.768184324776926), REAL_CONST(0.781359713524660), REAL_CONST(0.794415866350106),
REAL_CONST(0.807354922057604), REAL_CONST(0.820178962415188), REAL_CONST(0.832890014164742),
REAL_CONST(0.845490050944375), REAL_CONST(0.857980995127572), REAL_CONST(0.870364719583405),
REAL_CONST(0.882643049361841), REAL_CONST(0.894817763307943), REAL_CONST(0.906890595608519),
REAL_CONST(0.918863237274595), REAL_CONST(0.930737337562886), REAL_CONST(0.942514505339240),
REAL_CONST(0.954196310386875), REAL_CONST(0.965784284662087), REAL_CONST(0.977279923499917),
REAL_CONST(0.988684686772166), REAL_CONST(1.000000000000000)
};
real_t pow2_fix(real_t val)
{
uint32_t x1, x2;
uint32_t errcorr;
uint32_t index_frac;
real_t retval;
int32_t whole = (val >> REAL_BITS);
/* rest = [0..1] */
int32_t rest = val - (whole << REAL_BITS);
/* index into pow2_tab */
int32_t index = rest >> (REAL_BITS-TABLE_BITS);
if (val == 0)
return (1<<REAL_BITS);
/* leave INTERP_BITS bits */
index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
index_frac = index_frac & ((1<<INTERP_BITS)-1);
if (whole > 0)
{
retval = 1 << whole;
} else {
retval = REAL_CONST(1) >> -whole;
}
x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
if (whole > 0)
{
retval = retval * (errcorr + x1);
} else {
retval = MUL_R(retval, (errcorr + x1));
}
return retval;
}
int32_t pow2_int(real_t val)
{
uint32_t x1, x2;
uint32_t errcorr;
uint32_t index_frac;
real_t retval;
int32_t whole = (val >> REAL_BITS);
/* rest = [0..1] */
int32_t rest = val - (whole << REAL_BITS);
/* index into pow2_tab */
int32_t index = rest >> (REAL_BITS-TABLE_BITS);
if (val == 0)
return 1;
/* leave INTERP_BITS bits */
index_frac = rest >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
index_frac = index_frac & ((1<<INTERP_BITS)-1);
if (whole > 0)
retval = 1 << whole;
else
retval = 0;
x1 = pow2_tab[index & ((1<<TABLE_BITS)-1)];
x2 = pow2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
errcorr = ( (index_frac*(x2-x1))) >> INTERP_BITS;
retval = MUL_R(retval, (errcorr + x1));
return retval;
}
/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
int32_t log2_int(uint32_t val)
{
uint32_t frac;
uint32_t whole = (val);
int32_t exp = 0;
uint32_t index;
uint32_t index_frac;
uint32_t x1, x2;
uint32_t errcorr;
/* error */
if (val == 0)
return -10000;
exp = floor_log2(val);
exp -= REAL_BITS;
/* frac = [1..2] */
if (exp >= 0)
frac = val >> exp;
else
frac = val << -exp;
/* index in the log2 table */
index = frac >> (REAL_BITS-TABLE_BITS);
/* leftover part for linear interpolation */
index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
/* leave INTERP_BITS bits */
index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
/* linear interpolation */
/* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
return ((exp+REAL_BITS) << REAL_BITS) + errcorr + x1;
}
/* ld(x) = ld(x*y/y) = ld(x/y) + ld(y), with y=2^N and [1 <= (x/y) < 2] */
real_t log2_fix(uint32_t val)
{
uint32_t frac;
uint32_t whole = (val >> REAL_BITS);
int8_t exp = 0;
uint32_t index;
uint32_t index_frac;
uint32_t x1, x2;
uint32_t errcorr;
/* error */
if (val == 0)
return -100000;
exp = floor_log2(val);
exp -= REAL_BITS;
/* frac = [1..2] */
if (exp >= 0)
frac = val >> exp;
else
frac = val << -exp;
/* index in the log2 table */
index = frac >> (REAL_BITS-TABLE_BITS);
/* leftover part for linear interpolation */
index_frac = frac & ((1<<(REAL_BITS-TABLE_BITS))-1);
/* leave INTERP_BITS bits */
index_frac = index_frac >> (REAL_BITS-TABLE_BITS-INTERP_BITS);
x1 = log2_tab[index & ((1<<TABLE_BITS)-1)];
x2 = log2_tab[(index & ((1<<TABLE_BITS)-1)) + 1];
/* linear interpolation */
/* retval = exp + ((index_frac)*x2 + (1-index_frac)*x1) */
errcorr = (index_frac * (x2-x1)) >> INTERP_BITS;
return (exp << REAL_BITS) + errcorr + x1;
}
#endif

842
src/contrib/aacdecoder/libfaad/common.h Normal file → Executable file
View File

@ -1,393 +1,449 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: common.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __COMMON_H__
#define __COMMON_H__
#ifdef __cplusplus
extern "C" {
#endif
#define INLINE __inline
#if defined(_WIN32) && !defined(_WIN32_WCE)
#define ALIGN __declspec(align(16))
#else
#define ALIGN
#endif
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
/* COMPILE TIME DEFINITIONS */
/* use double precision */
/* #define USE_DOUBLE_PRECISION */
/* use fixed point reals */
//#define FIXED_POINT
#ifdef _WIN32_WCE
#define FIXED_POINT
#endif
#define ERROR_RESILIENCE
/* Allow decoding of MAIN profile AAC */
#define MAIN_DEC
/* Allow decoding of SSR profile AAC */
//#define SSR_DEC
/* Allow decoding of LTP profile AAC */
#define LTP_DEC
/* Allow decoding of LD profile AAC */
#define LD_DEC
/* Allow decoding of scalable profiles */
//#define SCALABLE_DEC
/* Allow decoding of Digital Radio Mondiale (DRM) */
//#define DRM
//#define DRM_PS
/* LD can't do without LTP */
#ifdef LD_DEC
#ifndef ERROR_RESILIENCE
#define ERROR_RESILIENCE
#endif
#ifndef LTP_DEC
#define LTP_DEC
#endif
#endif
#define ALLOW_SMALL_FRAMELENGTH
// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC)
//#define LC_ONLY_DECODER
#ifdef LC_ONLY_DECODER
#undef LTP_DEC
#undef MAIN_DEC
#undef SSR_DEC
#undef DRM
#undef ALLOW_SMALL_FRAMELENGTH
#undef ERROR_RESILIENCE
#endif
#define SBR_DEC
//#define SBR_LOW_POWER
//#define PS_DEC
/* FIXED POINT: No MAIN decoding, no SBR decoding */
#ifdef FIXED_POINT
# ifdef MAIN_DEC
# undef MAIN_DEC
# endif
//# ifndef SBR_LOW_POWER
//# define SBR_LOW_POWER
//# endif
# ifdef SBR_DEC
# undef SBR_DEC
# endif
#endif // FIXED_POINT
#ifdef DRM
# ifndef SCALABLE_DEC
# define SCALABLE_DEC
# endif
#endif
#if ((defined(_WIN32) && !defined(_WIN32_WCE)) /* || ((__GNUC__ >= 3) && defined(__i386__)) */ )
#ifndef FIXED_POINT
/* includes <xmmintrin.h> to enable SSE intrinsics */
//#define USE_SSE
#endif
#endif
#ifdef FIXED_POINT
#define SBR_DIV(A, B) (((int64_t)A << REAL_BITS)/B)
#else
#define SBR_DIV(A, B) ((A)/(B))
#endif
#ifndef SBR_LOW_POWER
#define qmf_t complex_t
#define QMF_RE(A) RE(A)
#define QMF_IM(A) IM(A)
#else
#define qmf_t real_t
#define QMF_RE(A) (A)
#define QMF_IM(A)
#endif
/* END COMPILE TIME DEFINITIONS */
#if defined(_WIN32)
typedef unsigned __int64 uint64_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int8 uint8_t;
typedef __int64 int64_t;
typedef __int32 int32_t;
typedef __int16 int16_t;
typedef __int8 int8_t;
typedef float float32_t;
#else
#ifdef HAVE_CONFIG_H
# include "../config.h"
#endif
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if HAVE_STDINT_H
# include <stdint.h>
# else
/* we need these... */
typedef unsigned long long uint64_t;
typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
typedef long long int64_t;
typedef long int32_t;
typedef short int16_t;
typedef char int8_t;
# endif
#endif
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifndef HAVE_FLOAT32_T
typedef float float32_t;
#endif
#if STDC_HEADERS
# include <string.h>
#else
# if !HAVE_STRCHR
# define strchr index
# define strrchr rindex
# endif
char *strchr(), *strrchr();
# if !HAVE_MEMCPY
# define memcpy(d, s, n) bcopy((s), (d), (n))
# define memmove(d, s, n) bcopy((s), (d), (n))
# endif
#endif
#endif
#ifdef WORDS_BIGENDIAN
#define ARCH_IS_BIG_ENDIAN
#endif
/* FIXED_POINT doesn't work with MAIN and SSR yet */
#ifdef FIXED_POINT
#undef MAIN_DEC
#undef SSR_DEC
#endif
#if defined(FIXED_POINT)
#include "fixed.h"
#elif defined(USE_DOUBLE_PRECISION)
typedef double real_t;
#include <math.h>
#define MUL_R(A,B) ((A)*(B))
#define MUL_C(A,B) ((A)*(B))
#define MUL_F(A,B) ((A)*(B))
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
*y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
}
#define REAL_CONST(A) ((real_t)(A))
#define COEF_CONST(A) ((real_t)(A))
#define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
#else /* Normal floating point operation */
typedef float real_t;
#ifdef USE_SSE
# include <xmmintrin.h>
#endif
#define MUL_R(A,B) ((A)*(B))
#define MUL_C(A,B) ((A)*(B))
#define MUL_F(A,B) ((A)*(B))
#define REAL_CONST(A) ((real_t)(A))
#define COEF_CONST(A) ((real_t)(A))
#define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
*y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
}
#ifdef __ICL /* only Intel C compiler has fmath ??? */
#include <mathf.h>
#define sin sinf
#define cos cosf
#define log logf
#define floor floorf
#define ceil ceilf
#define sqrt sqrtf
#else
#ifdef HAVE_LRINTF
# define HAS_LRINTF
# define _ISOC9X_SOURCE 1
# define _ISOC99_SOURCE 1
# define __USE_ISOC9X 1
# define __USE_ISOC99 1
#endif
#include <math.h>
#ifdef HAVE_SINF
# define sin sinf
#error
#endif
#ifdef HAVE_COSF
# define cos cosf
#endif
#ifdef HAVE_LOGF
# define log logf
#endif
#ifdef HAVE_EXPF
# define exp expf
#endif
#ifdef HAVE_FLOORF
# define floor floorf
#endif
#ifdef HAVE_CEILF
# define ceil ceilf
#endif
#ifdef HAVE_SQRTF
# define sqrt sqrtf
#endif
#endif
#endif
#ifndef HAS_LRINTF
/* standard cast */
#define lrintf(f) ((int32_t)(f))
#endif
typedef real_t complex_t[2];
#define RE(A) A[0]
#define IM(A) A[1]
/* common functions */
uint8_t cpu_has_sse(void);
uint32_t random_int(void);
uint8_t get_sr_index(const uint32_t samplerate);
uint8_t max_pred_sfb(const uint8_t sr_index);
uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
const uint8_t is_short);
uint32_t get_sample_rate(const uint8_t sr_index);
int8_t can_decode_ot(const uint8_t object_type);
void *faad_malloc(int32_t size);
void faad_free(void *b);
//#define PROFILE
#ifdef PROFILE
static int64_t faad_get_ts()
{
__asm
{
rdtsc
}
}
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_PI_2 /* PI/2 */
#define M_PI_2 1.57079632679489661923
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: common.h,v 1.77 2009/02/05 00:51:03 menno Exp $
**/
#ifndef __COMMON_H__
#define __COMMON_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef HAVE_CONFIG_H
# include "../config.h"
#endif
#include "neaacdec.h"
#if 1
#define INLINE __inline
#else
#define INLINE inline
#endif
#if 0 //defined(_WIN32) && !defined(_WIN32_WCE)
#define ALIGN __declspec(align(16))
#else
#define ALIGN
#endif
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
/* COMPILE TIME DEFINITIONS */
/* use double precision */
/* #define USE_DOUBLE_PRECISION */
/* use fixed point reals */
//#define FIXED_POINT
//#define BIG_IQ_TABLE
/* Use if target platform has address generators with autoincrement */
//#define PREFER_POINTERS
#ifdef _WIN32_WCE
#define FIXED_POINT
#endif
#ifdef __BFIN__
#define FIXED_POINT
#endif
#define ERROR_RESILIENCE
/* Allow decoding of MAIN profile AAC */
#define MAIN_DEC
/* Allow decoding of SSR profile AAC */
//#define SSR_DEC
/* Allow decoding of LTP profile AAC */
#define LTP_DEC
/* Allow decoding of LD profile AAC */
#define LD_DEC
/* Allow decoding of Digital Radio Mondiale (DRM) */
//#define DRM
//#define DRM_PS
/* LD can't do without LTP */
#ifdef LD_DEC
#ifndef ERROR_RESILIENCE
#define ERROR_RESILIENCE
#endif
#ifndef LTP_DEC
#define LTP_DEC
#endif
#endif
#define ALLOW_SMALL_FRAMELENGTH
// Define LC_ONLY_DECODER if you want a pure AAC LC decoder (independant of SBR_DEC and PS_DEC)
//#define LC_ONLY_DECODER
#ifdef LC_ONLY_DECODER
#undef LD_DEC
#undef LTP_DEC
#undef MAIN_DEC
#undef SSR_DEC
#undef DRM
#undef ALLOW_SMALL_FRAMELENGTH
#undef ERROR_RESILIENCE
#endif
#define SBR_DEC
//#define SBR_LOW_POWER
#define PS_DEC
#ifdef SBR_LOW_POWER
#undef PS_DEC
#endif
/* FIXED POINT: No MAIN decoding */
#ifdef FIXED_POINT
# ifdef MAIN_DEC
# undef MAIN_DEC
# endif
#endif // FIXED_POINT
#ifdef DRM
# ifndef ALLOW_SMALL_FRAMELENGTH
# define ALLOW_SMALL_FRAMELENGTH
# endif
# undef LD_DEC
# undef LTP_DEC
# undef MAIN_DEC
# undef SSR_DEC
#endif
#ifdef FIXED_POINT
#define DIV_R(A, B) (((int64_t)A << REAL_BITS)/B)
#define DIV_C(A, B) (((int64_t)A << COEF_BITS)/B)
#else
#define DIV_R(A, B) ((A)/(B))
#define DIV_C(A, B) ((A)/(B))
#endif
#ifndef SBR_LOW_POWER
#define qmf_t complex_t
#define QMF_RE(A) RE(A)
#define QMF_IM(A) IM(A)
#else
#define qmf_t real_t
#define QMF_RE(A) (A)
#define QMF_IM(A)
#endif
/* END COMPILE TIME DEFINITIONS */
#if defined(_WIN32) && !defined(__MINGW32__)
#include <stdlib.h>
#include <stdint.h>
//typedef unsigned __int64 uint64_t;
//typedef unsigned __int32 uint32_t;
//typedef unsigned __int16 uint16_t;
//typedef unsigned __int8 uint8_t;
//typedef signed __int64 int64_t;
//typedef signed __int32 int32_t;
//typedef signed __int16 int16_t;
//typedef signed __int8 int8_t;
typedef float float32_t;
#else
#include <stdio.h>
#if HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#if HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
#if STDC_HEADERS
# include <stdlib.h>
# include <stddef.h>
#else
# if HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#if HAVE_STRING_H
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
# include <string.h>
#endif
#if HAVE_STRINGS_H
# include <strings.h>
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if HAVE_STDINT_H
# include <stdint.h>
# else
/* we need these... */
#ifndef __TCS__
typedef unsigned long long uint64_t;
typedef signed long long int64_t;
#else
typedef unsigned long uint64_t;
typedef signed long int64_t;
#endif
typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
typedef unsigned char uint8_t;
typedef signed long int32_t;
typedef signed short int16_t;
typedef signed char int8_t;
# endif
#endif
#if HAVE_UNISTD_H
//# include <unistd.h>
#endif
#ifndef HAVE_FLOAT32_T
typedef float float32_t;
#endif
#if STDC_HEADERS
# include <string.h>
#else
# if !HAVE_STRCHR
# define strchr index
# define strrchr rindex
# endif
char *strchr(), *strrchr();
# if !HAVE_MEMCPY
# define memcpy(d, s, n) bcopy((s), (d), (n))
# define memmove(d, s, n) bcopy((s), (d), (n))
# endif
#endif
#endif
#ifdef WORDS_BIGENDIAN
#define ARCH_IS_BIG_ENDIAN
#endif
/* FIXED_POINT doesn't work with MAIN and SSR yet */
#ifdef FIXED_POINT
#undef MAIN_DEC
#undef SSR_DEC
#endif
#if defined(FIXED_POINT)
#include "fixed.h"
#elif defined(USE_DOUBLE_PRECISION)
typedef double real_t;
#include <math.h>
#define MUL_R(A,B) ((A)*(B))
#define MUL_C(A,B) ((A)*(B))
#define MUL_F(A,B) ((A)*(B))
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
*y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
}
#define REAL_CONST(A) ((real_t)(A))
#define COEF_CONST(A) ((real_t)(A))
#define Q2_CONST(A) ((real_t)(A))
#define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
#else /* Normal floating point operation */
typedef float real_t;
#define MUL_R(A,B) ((A)*(B))
#define MUL_C(A,B) ((A)*(B))
#define MUL_F(A,B) ((A)*(B))
#define REAL_CONST(A) ((real_t)(A))
#define COEF_CONST(A) ((real_t)(A))
#define Q2_CONST(A) ((real_t)(A))
#define FRAC_CONST(A) ((real_t)(A)) /* pure fractional part */
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
*y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
}
#if defined(_WIN32) && !defined(__MINGW32__)
#define HAS_LRINTF
static INLINE int lrintf(float f)
{
int i;
__asm
{
fld f
fistp i
}
return i;
}
#elif (defined(__i386__) && defined(__GNUC__) && \
!defined(__CYGWIN__) && !defined(__MINGW32__))
#ifndef HAVE_LRINTF
#define HAS_LRINTF
// from http://www.stereopsis.com/FPU.html
static INLINE int lrintf(float f)
{
int i;
__asm__ __volatile__ (
"flds %1 \n\t"
"fistpl %0 \n\t"
: "=m" (i)
: "m" (f));
return i;
}
#endif /* HAVE_LRINTF */
#endif
#ifdef __ICL /* only Intel C compiler has fmath ??? */
#include <mathf.h>
#define sin sinf
#define cos cosf
#define log logf
#define floor floorf
#define ceil ceilf
#define sqrt sqrtf
#else
#ifdef HAVE_LRINTF
# define HAS_LRINTF
# define _ISOC9X_SOURCE 1
# define _ISOC99_SOURCE 1
# define __USE_ISOC9X 1
# define __USE_ISOC99 1
#endif
#include <math.h>
#ifdef HAVE_SINF
# define sin sinf
#error
#endif
#ifdef HAVE_COSF
# define cos cosf
#endif
#ifdef HAVE_LOGF
# define log logf
#endif
#ifdef HAVE_EXPF
# define exp expf
#endif
#ifdef HAVE_FLOORF
# define floor floorf
#endif
#ifdef HAVE_CEILF
# define ceil ceilf
#endif
#ifdef HAVE_SQRTF
# define sqrt sqrtf
#endif
#endif
#endif
#ifndef HAS_LRINTF
/* standard cast */
#define lrintf(f) ((int32_t)(f))
#endif
typedef real_t complex_t[2];
#define RE(A) A[0]
#define IM(A) A[1]
/* common functions */
uint8_t cpu_has_sse(void);
uint32_t ne_rng(uint32_t *__r1, uint32_t *__r2);
uint32_t wl_min_lzc(uint32_t x);
#ifdef FIXED_POINT
#define LOG2_MIN_INF REAL_CONST(-10000)
int32_t log2_int(uint32_t val);
int32_t log2_fix(uint32_t val);
int32_t pow2_int(real_t val);
real_t pow2_fix(real_t val);
#endif
uint8_t get_sr_index(const uint32_t samplerate);
uint8_t max_pred_sfb(const uint8_t sr_index);
uint8_t max_tns_sfb(const uint8_t sr_index, const uint8_t object_type,
const uint8_t is_short);
uint32_t get_sample_rate(const uint8_t sr_index);
int8_t can_decode_ot(const uint8_t object_type);
void *faad_malloc(size_t size);
void faad_free(void *b);
//#define PROFILE
#ifdef PROFILE
static int64_t faad_get_ts()
{
__asm
{
rdtsc
}
}
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef M_PI_2 /* PI/2 */
#define M_PI_2 1.57079632679489661923
#endif
#ifdef __cplusplus
}
#endif
#endif

2195
src/contrib/aacdecoder/libfaad/decoder.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1,122 +0,0 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: decoder.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __DECODER_H__
#define __DECODER_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
#pragma pack(push, 8)
#ifndef FAADAPI
#define FAADAPI __cdecl
#endif
#else
#ifndef FAADAPI
#define FAADAPI
#endif
#endif
#include "bits.h"
#include "syntax.h"
#include "drc.h"
#include "specrec.h"
#include "filtbank.h"
#include "ic_predict.h"
/* library output formats */
#define FAAD_FMT_16BIT 1
#define FAAD_FMT_24BIT 2
#define FAAD_FMT_32BIT 3
#define FAAD_FMT_FLOAT 4
#define FAAD_FMT_DOUBLE 5
#define LC_DEC_CAP (1<<0)
#define MAIN_DEC_CAP (1<<1)
#define LTP_DEC_CAP (1<<2)
#define LD_DEC_CAP (1<<3)
#define ERROR_RESILIENCE_CAP (1<<4)
#define FIXED_POINT_CAP (1<<5)
#define FRONT_CHANNEL_CENTER (1)
#define FRONT_CHANNEL_LEFT (2)
#define FRONT_CHANNEL_RIGHT (3)
#define SIDE_CHANNEL_LEFT (4)
#define SIDE_CHANNEL_RIGHT (5)
#define BACK_CHANNEL_LEFT (6)
#define BACK_CHANNEL_RIGHT (7)
#define BACK_CHANNEL_CENTER (8)
#define LFE_CHANNEL (9)
#define UNKNOWN_CHANNEL (0)
int8_t* FAADAPI faacDecGetErrorMessage(uint8_t errcode);
uint32_t FAADAPI faacDecGetCapabilities(void);
faacDecHandle FAADAPI faacDecOpen(void);
faacDecConfigurationPtr FAADAPI faacDecGetCurrentConfiguration(faacDecHandle hDecoder);
uint8_t FAADAPI faacDecSetConfiguration(faacDecHandle hDecoder,
faacDecConfigurationPtr config);
/* Init the library based on info from the AAC file (ADTS/ADIF) */
int32_t FAADAPI faacDecInit(faacDecHandle hDecoder,
uint8_t *buffer,
uint32_t buffer_size,
uint32_t *samplerate,
uint8_t *channels);
/* Init the library using a DecoderSpecificInfo */
int8_t FAADAPI faacDecInit2(faacDecHandle hDecoder, uint8_t *pBuffer,
uint32_t SizeOfDecoderSpecificInfo,
uint32_t *samplerate, uint8_t *channels);
/* Init the library for DRM */
int8_t FAADAPI faacDecInitDRM(faacDecHandle hDecoder, uint32_t samplerate,
uint8_t channels);
void FAADAPI faacDecClose(faacDecHandle hDecoder);
void FAADAPI faacDecPostSeekReset(faacDecHandle hDecoder, int32_t frame);
void* FAADAPI faacDecDecode(faacDecHandle hDecoder,
faacDecFrameInfo *hInfo,
uint8_t *buffer,
uint32_t buffer_size);
#ifdef _WIN32
#pragma pack(pop)
#endif
#ifdef __cplusplus
}
#endif
#endif

343
src/contrib/aacdecoder/libfaad/drc.c Normal file → Executable file
View File

@ -1,170 +1,173 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: drc.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#include "syntax.h"
#include "drc.h"
drc_info *drc_init(real_t cut, real_t boost)
{
drc_info *drc = (drc_info*)faad_malloc(sizeof(drc_info));
memset(drc, 0, sizeof(drc_info));
drc->ctrl1 = cut;
drc->ctrl2 = boost;
drc->num_bands = 1;
drc->band_top[0] = 1024/4 - 1;
drc->dyn_rng_sgn[0] = 1;
drc->dyn_rng_ctl[0] = 0;
return drc;
}
void drc_end(drc_info *drc)
{
if (drc) faad_free(drc);
}
#ifdef FIXED_POINT
static real_t drc_pow2_table[] =
{
COEF_CONST(0.5146511183),
COEF_CONST(0.5297315472),
COEF_CONST(0.5452538663),
COEF_CONST(0.5612310242),
COEF_CONST(0.5776763484),
COEF_CONST(0.5946035575),
COEF_CONST(0.6120267717),
COEF_CONST(0.6299605249),
COEF_CONST(0.6484197773),
COEF_CONST(0.6674199271),
COEF_CONST(0.6869768237),
COEF_CONST(0.7071067812),
COEF_CONST(0.7278265914),
COEF_CONST(0.7491535384),
COEF_CONST(0.7711054127),
COEF_CONST(0.7937005260),
COEF_CONST(0.8169577266),
COEF_CONST(0.8408964153),
COEF_CONST(0.8655365610),
COEF_CONST(0.8908987181),
COEF_CONST(0.9170040432),
COEF_CONST(0.9438743127),
COEF_CONST(0.9715319412),
COEF_CONST(1.0000000000),
COEF_CONST(1.0293022366),
COEF_CONST(1.0594630944),
COEF_CONST(1.0905077327),
COEF_CONST(1.1224620483),
COEF_CONST(1.1553526969),
COEF_CONST(1.1892071150),
COEF_CONST(1.2240535433),
COEF_CONST(1.2599210499),
COEF_CONST(1.2968395547),
COEF_CONST(1.3348398542),
COEF_CONST(1.3739536475),
COEF_CONST(1.4142135624),
COEF_CONST(1.4556531828),
COEF_CONST(1.4983070769),
COEF_CONST(1.5422108254),
COEF_CONST(1.5874010520),
COEF_CONST(1.6339154532),
COEF_CONST(1.6817928305),
COEF_CONST(1.7310731220),
COEF_CONST(1.7817974363),
COEF_CONST(1.8340080864),
COEF_CONST(1.8877486254),
COEF_CONST(1.9430638823)
};
#endif
void drc_decode(drc_info *drc, real_t *spec)
{
uint16_t i, bd, top;
#ifdef FIXED_POINT
int32_t exp, frac;
#else
real_t factor, exp;
#endif
uint16_t bottom = 0;
if (drc->num_bands == 1)
drc->band_top[0] = 1024/4 - 1;
for (bd = 0; bd < drc->num_bands; bd++)
{
top = 4 * (drc->band_top[bd] + 1);
#ifndef FIXED_POINT
/* Decode DRC gain factor */
if (drc->dyn_rng_sgn[bd]) /* compress */
exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
else /* boost */
exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
factor = (real_t)pow(2.0, exp);
/* Apply gain factor */
for (i = bottom; i < top; i++)
spec[i] *= factor;
#else
/* Decode DRC gain factor */
if (drc->dyn_rng_sgn[bd]) /* compress */
{
exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
} else { /* boost */
exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
}
/* Apply gain factor */
if (exp < 0)
{
for (i = bottom; i < top; i++)
{
spec[i] >>= -exp;
if (frac)
spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
}
} else {
for (i = bottom; i < top; i++)
{
spec[i] <<= exp;
if (frac)
spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
}
}
#endif
bottom = top;
}
}
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: drc.c,v 1.28 2007/11/01 12:33:30 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#include "syntax.h"
#include "drc.h"
drc_info *drc_init(real_t cut, real_t boost)
{
drc_info *drc = (drc_info*)faad_malloc(sizeof(drc_info));
memset(drc, 0, sizeof(drc_info));
drc->ctrl1 = cut;
drc->ctrl2 = boost;
drc->num_bands = 1;
drc->band_top[0] = 1024/4 - 1;
drc->dyn_rng_sgn[0] = 1;
drc->dyn_rng_ctl[0] = 0;
return drc;
}
void drc_end(drc_info *drc)
{
if (drc) faad_free(drc);
}
#ifdef FIXED_POINT
static real_t drc_pow2_table[] =
{
COEF_CONST(0.5146511183),
COEF_CONST(0.5297315472),
COEF_CONST(0.5452538663),
COEF_CONST(0.5612310242),
COEF_CONST(0.5776763484),
COEF_CONST(0.5946035575),
COEF_CONST(0.6120267717),
COEF_CONST(0.6299605249),
COEF_CONST(0.6484197773),
COEF_CONST(0.6674199271),
COEF_CONST(0.6869768237),
COEF_CONST(0.7071067812),
COEF_CONST(0.7278265914),
COEF_CONST(0.7491535384),
COEF_CONST(0.7711054127),
COEF_CONST(0.7937005260),
COEF_CONST(0.8169577266),
COEF_CONST(0.8408964153),
COEF_CONST(0.8655365610),
COEF_CONST(0.8908987181),
COEF_CONST(0.9170040432),
COEF_CONST(0.9438743127),
COEF_CONST(0.9715319412),
COEF_CONST(1.0000000000),
COEF_CONST(1.0293022366),
COEF_CONST(1.0594630944),
COEF_CONST(1.0905077327),
COEF_CONST(1.1224620483),
COEF_CONST(1.1553526969),
COEF_CONST(1.1892071150),
COEF_CONST(1.2240535433),
COEF_CONST(1.2599210499),
COEF_CONST(1.2968395547),
COEF_CONST(1.3348398542),
COEF_CONST(1.3739536475),
COEF_CONST(1.4142135624),
COEF_CONST(1.4556531828),
COEF_CONST(1.4983070769),
COEF_CONST(1.5422108254),
COEF_CONST(1.5874010520),
COEF_CONST(1.6339154532),
COEF_CONST(1.6817928305),
COEF_CONST(1.7310731220),
COEF_CONST(1.7817974363),
COEF_CONST(1.8340080864),
COEF_CONST(1.8877486254),
COEF_CONST(1.9430638823)
};
#endif
void drc_decode(drc_info *drc, real_t *spec)
{
uint16_t i, bd, top;
#ifdef FIXED_POINT
int32_t exp, frac;
#else
real_t factor, exp;
#endif
uint16_t bottom = 0;
if (drc->num_bands == 1)
drc->band_top[0] = 1024/4 - 1;
for (bd = 0; bd < drc->num_bands; bd++)
{
top = 4 * (drc->band_top[bd] + 1);
#ifndef FIXED_POINT
/* Decode DRC gain factor */
if (drc->dyn_rng_sgn[bd]) /* compress */
exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
else /* boost */
exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
factor = (real_t)pow(2.0, exp);
/* Apply gain factor */
for (i = bottom; i < top; i++)
spec[i] *= factor;
#else
/* Decode DRC gain factor */
if (drc->dyn_rng_sgn[bd]) /* compress */
{
exp = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
frac = -1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
} else { /* boost */
exp = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/ 24;
frac = (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level)) % 24;
}
/* Apply gain factor */
if (exp < 0)
{
for (i = bottom; i < top; i++)
{
spec[i] >>= -exp;
if (frac)
spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
}
} else {
for (i = bottom; i < top; i++)
{
spec[i] <<= exp;
if (frac)
spec[i] = MUL_R(spec[i],drc_pow2_table[frac+23]);
}
}
#endif
bottom = top;
}
}

95
src/contrib/aacdecoder/libfaad/drc.h Normal file → Executable file
View File

@ -1,46 +1,49 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: drc.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __DRC_H__
#define __DRC_H__
#ifdef __cplusplus
extern "C" {
#endif
#define DRC_REF_LEVEL 20*4 /* -20 dB */
drc_info *drc_init(real_t cut, real_t boost);
void drc_end(drc_info *drc);
void drc_decode(drc_info *drc, real_t *spec);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: drc.h,v 1.22 2007/11/01 12:33:30 menno Exp $
**/
#ifndef __DRC_H__
#define __DRC_H__
#ifdef __cplusplus
extern "C" {
#endif
#define DRC_REF_LEVEL 20*4 /* -20 dB */
drc_info *drc_init(real_t cut, real_t boost);
void drc_end(drc_info *drc);
void drc_decode(drc_info *drc, real_t *spec);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,965 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: drm_dec.c,v 1.9 2007/11/01 12:33:30 menno Exp $
**/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "common.h"
#ifdef DRM
#include "sbr_dec.h"
#include "drm_dec.h"
#include "bits.h"
/* constants */
#define DECAY_CUTOFF 3
#define DECAY_SLOPE 0.05f
/* type definitaions */
typedef const int8_t (*drm_ps_huff_tab)[2];
/* binary search huffman tables */
static const int8_t f_huffman_sa[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 1x */
{ /*7*/ -8, 4 }, /* index 2: 3 bits: 10x */
{ 5, 6 }, /* index 3: 3 bits: 11x */
{ /*1*/ -14, /*-1*/ -16 }, /* index 4: 4 bits: 101x */
{ /*-2*/ -17, 7 }, /* index 5: 4 bits: 110x */
{ 8, 9 }, /* index 6: 4 bits: 111x */
{ /*2*/ -13, /*-3*/ -18 }, /* index 7: 5 bits: 1101x */
{ /*3*/ -12, 10 }, /* index 8: 5 bits: 1110x */
{ 11, 12 }, /* index 9: 5 bits: 1111x */
{ /*4*/ -11, /*5*/ -10 }, /* index 10: 6 bits: 11101x */
{ /*-4*/ -19, /*-5*/ -20 }, /* index 11: 6 bits: 11110x */
{ /*6*/ -9, 13 }, /* index 12: 6 bits: 11111x */
{ /*-7*/ -22, /*-6*/ -21 } /* index 13: 7 bits: 111111x */
};
static const int8_t t_huffman_sa[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 1x */
{ /*-1*/ -16, /*1*/ -14 }, /* index 2: 3 bits: 10x */
{ 4, 5 }, /* index 3: 3 bits: 11x */
{ /*-2*/ -17, /*2*/ -13 }, /* index 4: 4 bits: 110x */
{ 6, 7 }, /* index 5: 4 bits: 111x */
{ /*-3*/ -18, /*3*/ -12 }, /* index 6: 5 bits: 1110x */
{ 8, 9 }, /* index 7: 5 bits: 1111x */
{ /*-4*/ -19, /*4*/ -11 }, /* index 8: 6 bits: 11110x */
{ 10, 11 }, /* index 9: 6 bits: 11111x */
{ /*-5*/ -20, /*5*/ -10 }, /* index 10: 7 bits: 111110x */
{ /*-6*/ -21, 12 }, /* index 11: 7 bits: 111111x */
{ /*-7*/ -22, 13 }, /* index 12: 8 bits: 1111111x */
{ /*6*/ -9, /*7*/ -8 } /* index 13: 9 bits: 11111111x */
};
static const int8_t f_huffman_pan[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */
{ /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */
{ 4, 5 }, /* index 3: 4 bits: 111x */
{ /*-2*/ -17, /*2*/ -13 }, /* index 4: 5 bits: 1110x */
{ 6, 7 }, /* index 5: 5 bits: 1111x */
{ /*-3*/ -18, /*3*/ -12 }, /* index 6: 6 bits: 11110x */
{ 8, 9 }, /* index 7: 6 bits: 11111x */
{ /*-4*/ -19, /*4*/ -11 }, /* index 8: 7 bits: 111110x */
{ 10, 11 }, /* index 9: 7 bits: 111111x */
{ /*-5*/ -20, /*5*/ -10 }, /* index 10: 8 bits: 1111110x */
{ 12, 13 }, /* index 11: 8 bits: 1111111x */
{ /*-6*/ -21, /*6*/ -9 }, /* index 12: 9 bits: 11111110x */
{ /*-7*/ -22, 14 }, /* index 13: 9 bits: 11111111x */
{ /*7*/ -8, 15 }, /* index 14: 10 bits: 111111111x */
{ 16, 17 }, /* index 15: 11 bits: 1111111111x */
{ /*-8*/ -23, /*8*/ -7 }, /* index 16: 12 bits: 11111111110x */
{ 18, 19 }, /* index 17: 12 bits: 11111111111x */
{ /*-10*/ -25, 20 }, /* index 18: 13 bits: 111111111110x */
{ 21, 22 }, /* index 19: 13 bits: 111111111111x */
{ /*-9*/ -24, /*9*/ -6 }, /* index 20: 14 bits: 1111111111101x */
{ /*10*/ -5, 23 }, /* index 21: 14 bits: 1111111111110x */
{ 24, 25 }, /* index 22: 14 bits: 1111111111111x */
{ /*-13*/ -28, /*-11*/ -26 }, /* index 23: 15 bits: 11111111111101x */
{ /*11*/ -4, /*13*/ -2 }, /* index 24: 15 bits: 11111111111110x */
{ 26, 27 }, /* index 25: 15 bits: 11111111111111x */
{ /*-14*/ -29, /*-12*/ -27 }, /* index 26: 16 bits: 111111111111110x */
{ /*12*/ -3, /*14*/ -1 } /* index 27: 16 bits: 111111111111111x */
};
static const int8_t t_huffman_pan[][2] =
{
{ /*0*/ -15, 1 }, /* index 0: 1 bits: x */
{ /*-1*/ -16, 2 }, /* index 1: 2 bits: 1x */
{ /*1*/ -14, 3 }, /* index 2: 3 bits: 11x */
{ /*-2*/ -17, 4 }, /* index 3: 4 bits: 111x */
{ /*2*/ -13, 5 }, /* index 4: 5 bits: 1111x */
{ /*-3*/ -18, 6 }, /* index 5: 6 bits: 11111x */
{ /*3*/ -12, 7 }, /* index 6: 7 bits: 111111x */
{ /*-4*/ -19, 8 }, /* index 7: 8 bits: 1111111x */
{ /*4*/ -11, 9 }, /* index 8: 9 bits: 11111111x */
{ 10, 11 }, /* index 9: 10 bits: 111111111x */
{ /*-5*/ -20, /*5*/ -10 }, /* index 10: 11 bits: 1111111110x */
{ 12, 13 }, /* index 11: 11 bits: 1111111111x */
{ /*-6*/ -21, /*6*/ -9 }, /* index 12: 12 bits: 11111111110x */
{ 14, 15 }, /* index 13: 12 bits: 11111111111x */
{ /*-7*/ -22, /*7*/ -8 }, /* index 14: 13 bits: 111111111110x */
{ 16, 17 }, /* index 15: 13 bits: 111111111111x */
{ /*-8*/ -23, /*8*/ -7 }, /* index 16: 14 bits: 1111111111110x */
{ 18, 19 }, /* index 17: 14 bits: 1111111111111x */
{ /*-10*/ -25, /*10*/ -5 }, /* index 18: 15 bits: 11111111111110x */
{ 20, 21 }, /* index 19: 15 bits: 11111111111111x */
{ /*-9*/ -24, /*9*/ -6 }, /* index 20: 16 bits: 111111111111110x */
{ 22, 23 }, /* index 21: 16 bits: 111111111111111x */
{ 24, 25 }, /* index 22: 17 bits: 1111111111111110x */
{ 26, 27 }, /* index 23: 17 bits: 1111111111111111x */
{ /*-14*/ -29, /*-13*/ -28 }, /* index 24: 18 bits: 11111111111111100x */
{ /*-12*/ -27, /*-11*/ -26 }, /* index 25: 18 bits: 11111111111111101x */
{ /*11*/ -4, /*12*/ -3 }, /* index 26: 18 bits: 11111111111111110x */
{ /*13*/ -2, /*14*/ -1 } /* index 27: 18 bits: 11111111111111111x */
};
/* There are 3 classes in the standard but the last 2 are identical */
static const real_t sa_quant[8][2] =
{
{ FRAC_CONST(0.0000), FRAC_CONST(0.0000) },
{ FRAC_CONST(0.0501), FRAC_CONST(0.1778) },
{ FRAC_CONST(0.0706), FRAC_CONST(0.2818) },
{ FRAC_CONST(0.0995), FRAC_CONST(0.4467) },
{ FRAC_CONST(0.1399), FRAC_CONST(0.5623) },
{ FRAC_CONST(0.1957), FRAC_CONST(0.7079) },
{ FRAC_CONST(0.2713), FRAC_CONST(0.8913) },
{ FRAC_CONST(0.3699), FRAC_CONST(1.0000) },
};
/* We don't need the actual quantizer values */
#if 0
static const real_t pan_quant[8][5] =
{
{ COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000), COEF_CONST(0.0000) },
{ COEF_CONST(0.1661), COEF_CONST(0.1661), COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.3322) },
{ COEF_CONST(0.3322), COEF_CONST(0.3322), COEF_CONST(0.6644), COEF_CONST(0.8305), COEF_CONST(0.8305) },
{ COEF_CONST(0.4983), COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(1.6610) },
{ COEF_CONST(0.6644), COEF_CONST(0.9966), COEF_CONST(1.4949), COEF_CONST(2.1593), COEF_CONST(2.4914) },
{ COEF_CONST(0.8305), COEF_CONST(1.3288), COEF_CONST(2.1593), COEF_CONST(2.9897), COEF_CONST(3.4880) },
{ COEF_CONST(0.9966), COEF_CONST(1.8271), COEF_CONST(2.8236), COEF_CONST(3.8202), COEF_CONST(4.6507) },
{ COEF_CONST(1.3288), COEF_CONST(2.3253), COEF_CONST(3.4880), COEF_CONST(4.6507), COEF_CONST(5.8134) },
};
#endif
/* 2^(pan_quant[x][y] */
static const real_t pan_pow_2_pos[8][5] = {
{ REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000), REAL_CONST(1.0000000) },
{ REAL_CONST(1.1220021), REAL_CONST(1.1220021), REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.2589312) },
{ REAL_CONST(1.2589312), REAL_CONST(1.2589312), REAL_CONST(1.5849090), REAL_CONST(1.7783016), REAL_CONST(1.7783016) },
{ REAL_CONST(1.4125481), REAL_CONST(1.5849090), REAL_CONST(1.9952921), REAL_CONST(2.8184461), REAL_CONST(3.1623565) },
{ REAL_CONST(1.5849090), REAL_CONST(1.9952922), REAL_CONST(2.8184461), REAL_CONST(4.4669806), REAL_CONST(5.6232337) },
{ REAL_CONST(1.7783016), REAL_CONST(2.5119365), REAL_CONST(4.4669806), REAL_CONST(7.9430881), REAL_CONST(11.219994) },
{ REAL_CONST(1.9952921), REAL_CONST(3.5482312), REAL_CONST(7.0792671), REAL_CONST(14.125206), REAL_CONST(25.118876) },
{ REAL_CONST(2.5119365), REAL_CONST(5.0116998), REAL_CONST(11.219994), REAL_CONST(25.118876), REAL_CONST(56.235140) }
};
/* 2^(-pan_quant[x][y] */
static const real_t pan_pow_2_neg[8][5] = {
{ REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1), REAL_CONST(1) },
{ REAL_CONST(0.8912487), REAL_CONST(0.8912487), REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.7943242) },
{ REAL_CONST(0.7943242), REAL_CONST(0.7943242), REAL_CONST(0.6309511), REAL_CONST(0.5623344), REAL_CONST(0.5623344) },
{ REAL_CONST(0.7079405), REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.3162199) },
{ REAL_CONST(0.6309511), REAL_CONST(0.5011797), REAL_CONST(0.3548054), REAL_CONST(0.2238649), REAL_CONST(0.1778336) },
{ REAL_CONST(0.5623343), REAL_CONST(0.3980992), REAL_CONST(0.2238649), REAL_CONST(0.1258956), REAL_CONST(0.0891266) },
{ REAL_CONST(0.5011797), REAL_CONST(0.2818306), REAL_CONST(0.1412576), REAL_CONST(0.0707954), REAL_CONST(0.0398107) },
{ REAL_CONST(0.3980992), REAL_CONST(0.1995331), REAL_CONST(0.0891267), REAL_CONST(0.0398107), REAL_CONST(0.0177825) }
};
/* 2^(pan_quant[x][y]/30) */
static const real_t pan_pow_2_30_pos[8][5] = {
{ COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) },
{ COEF_CONST(1.003845098), COEF_CONST(1.003845098), COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.007704982) },
{ COEF_CONST(1.007704982), COEF_CONST(1.007704982), COEF_CONST(1.01546933), COEF_CONST(1.019373909), COEF_CONST(1.019373909) },
{ COEF_CONST(1.011579706), COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.039123167) },
{ COEF_CONST(1.01546933), COEF_CONST(1.023293502), COEF_CONST(1.035142941), COEF_CONST(1.051155908), COEF_CONST(1.059252598) },
{ COEF_CONST(1.019373909), COEF_CONST(1.03117796), COEF_CONST(1.051155908), COEF_CONST(1.071518432), COEF_CONST(1.0839263) },
{ COEF_CONST(1.023293502), COEF_CONST(1.043118698), COEF_CONST(1.067414119), COEF_CONST(1.092277933), COEF_CONST(1.113439626) },
{ COEF_CONST(1.03117796), COEF_CONST(1.055195268), COEF_CONST(1.0839263), COEF_CONST(1.113439626), COEF_CONST(1.143756546) }
};
/* 2^(-pan_quant[x][y]/30) */
static const real_t pan_pow_2_30_neg[8][5] = {
{ COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1), COEF_CONST(1) },
{ COEF_CONST(0.99616963), COEF_CONST(0.99616963), COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.99235393) },
{ COEF_CONST(0.992353931), COEF_CONST(0.992353931), COEF_CONST(0.984766325), COEF_CONST(0.980994305), COEF_CONST(0.980994305) },
{ COEF_CONST(0.988552848), COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.962349827) },
{ COEF_CONST(0.984766325), COEF_CONST(0.977236734), COEF_CONST(0.966050157), COEF_CONST(0.951333663), COEF_CONST(0.944061881) },
{ COEF_CONST(0.980994305), COEF_CONST(0.969764715), COEF_CONST(0.951333663), COEF_CONST(0.933255062), COEF_CONST(0.922571949) },
{ COEF_CONST(0.977236734), COEF_CONST(0.958663671), COEF_CONST(0.936843519), COEF_CONST(0.915517901), COEF_CONST(0.898117847) },
{ COEF_CONST(0.969764715), COEF_CONST(0.947691892), COEF_CONST(0.922571949), COEF_CONST(0.898117847), COEF_CONST(0.874311936) }
};
static const real_t g_decayslope[MAX_SA_BAND] = {
FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.95),FRAC_CONST(0.9), FRAC_CONST(0.85), FRAC_CONST(0.8),
FRAC_CONST(0.75),FRAC_CONST(0.7), FRAC_CONST(0.65),FRAC_CONST(0.6), FRAC_CONST(0.55),FRAC_CONST(0.5), FRAC_CONST(0.45),
FRAC_CONST(0.4), FRAC_CONST(0.35),FRAC_CONST(0.3), FRAC_CONST(0.25),FRAC_CONST(0.2), FRAC_CONST(0.15), FRAC_CONST(0.1),
FRAC_CONST(0.05),FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0),
FRAC_CONST(0), FRAC_CONST(0), FRAC_CONST(0)
};
static const real_t sa_sqrt_1_minus[8][2] = {
{ FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.998744206), FRAC_CONST(0.984066644) },
{ FRAC_CONST(0.997504707), FRAC_CONST(0.959473168) },
{ FRAC_CONST(0.995037562), FRAC_CONST(0.894683804) },
{ FRAC_CONST(0.990165638), FRAC_CONST(0.826933317) },
{ FRAC_CONST(0.980663811), FRAC_CONST(0.706312672) },
{ FRAC_CONST(0.962494836), FRAC_CONST(0.45341406) },
{ FRAC_CONST(0.929071574), FRAC_CONST(0) }
};
static const uint8_t sa_freq_scale[9] =
{
0, 1, 2, 3, 5, 7, 10, 13, 23
};
static const uint8_t pan_freq_scale[21] =
{
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 18, 22, 26, 32, 64
};
static const uint8_t pan_quant_class[20] =
{
0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 3, 3, 3, 4, 4, 4
};
/* Inverse mapping lookup */
static const uint8_t pan_inv_freq[64] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19
};
static const uint8_t sa_inv_freq[MAX_SA_BAND] = {
0, 1, 2, 3, 3, 4, 4, 5, 5, 5, 6, 6, 6,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
7, 7, 7, 7, 7, 7, 7
};
static const real_t filter_coeff[] =
{
FRAC_CONST(0.65143905754106),
FRAC_CONST(0.56471812200776),
FRAC_CONST(0.48954165955695)
};
static const uint8_t delay_length[3] =
{
3, 4, 5
};
static const real_t delay_fraction[] =
{
FRAC_CONST(0.43), FRAC_CONST(0.75), FRAC_CONST(0.347)
};
static const real_t peak_decay = FRAC_CONST(0.76592833836465);
static const real_t smooth_coeff = FRAC_CONST(0.25);
/* Please note that these are the same tables as in plain PS */
static const complex_t Q_Fract_allpass_Qmf[][3] = {
{ { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } },
{ { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } },
{ { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } },
{ { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } },
{ { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } },
{ { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } },
{ { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } },
{ { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } },
{ { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } },
{ { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } },
{ { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } },
{ { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } },
{ { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } },
{ { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } },
{ { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } },
{ { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } },
{ { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } },
{ { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } },
{ { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } },
{ { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } },
{ { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } },
{ { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } },
{ { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } },
{ { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } },
{ { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } },
{ { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } },
{ { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } },
{ { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } },
{ { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } },
{ { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } },
{ { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } },
{ { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } },
{ { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } },
{ { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } },
{ { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } },
{ { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } },
{ { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } },
{ { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } },
{ { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } },
{ { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } },
{ { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } },
{ { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } },
{ { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } },
{ { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } },
{ { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } },
{ { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } },
{ { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } },
{ { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } },
{ { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } },
{ { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } },
{ { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } },
{ { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } },
{ { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } },
{ { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } },
{ { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } },
{ { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } },
{ { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } },
{ { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } },
{ { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } },
{ { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } },
{ { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } },
{ { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } },
{ { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } },
{ { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } }
};
static const complex_t Phi_Fract_Qmf[] = {
{ FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) },
{ FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) },
{ FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) },
{ FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) },
{ FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) },
{ FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) },
{ FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) },
{ FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) },
{ FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) },
{ FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) },
{ FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) },
{ FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) },
{ FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) },
{ FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) },
{ FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) },
{ FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) },
{ FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) },
{ FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) },
{ FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) },
{ FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) },
{ FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) },
{ FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) },
{ FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) },
{ FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) },
{ FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) },
{ FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) },
{ FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) },
{ FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) },
{ FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) },
{ FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) },
{ FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) },
{ FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) },
{ FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) },
{ FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) },
{ FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) },
{ FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) },
{ FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) },
{ FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) },
{ FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) },
{ FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) },
{ FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) },
{ FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) },
{ FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) },
{ FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) },
{ FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) },
{ FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) },
{ FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) },
{ FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) },
{ FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) },
{ FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) },
{ FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) },
{ FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) },
{ FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) },
{ FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) },
{ FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) },
{ FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) },
{ FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) },
{ FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) },
{ FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) },
{ FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) },
{ FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) },
{ FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) },
{ FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) },
{ FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) }
};
/* static function declarations */
static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld);
static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld);
static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff);
uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld)
{
uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
ps->drm_ps_data_available = 1;
ps->bs_enable_sa = faad_get1bit(ld);
ps->bs_enable_pan = faad_get1bit(ld);
if (ps->bs_enable_sa)
{
drm_ps_sa_element(ps, ld);
}
if (ps->bs_enable_pan)
{
drm_ps_pan_element(ps, ld);
}
bits = (uint16_t)faad_get_processed_bits(ld) - bits;
return bits;
}
static void drm_ps_sa_element(drm_ps_info *ps, bitfile *ld)
{
drm_ps_huff_tab huff;
uint8_t band;
ps->bs_sa_dt_flag = faad_get1bit(ld);
if (ps->bs_sa_dt_flag)
{
huff = t_huffman_sa;
} else {
huff = f_huffman_sa;
}
for (band = 0; band < DRM_NUM_SA_BANDS; band++)
{
ps->bs_sa_data[band] = huff_dec(ld, huff);
}
}
static void drm_ps_pan_element(drm_ps_info *ps, bitfile *ld)
{
drm_ps_huff_tab huff;
uint8_t band;
ps->bs_pan_dt_flag = faad_get1bit(ld);
if (ps->bs_pan_dt_flag)
{
huff = t_huffman_pan;
} else {
huff = f_huffman_pan;
}
for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
{
ps->bs_pan_data[band] = huff_dec(ld, huff);
}
}
/* binary search huffman decoding */
static int8_t huff_dec(bitfile *ld, drm_ps_huff_tab huff)
{
uint8_t bit;
int16_t index = 0;
while (index >= 0)
{
bit = (uint8_t)faad_get1bit(ld);
index = huff[index][bit];
}
return index + 15;
}
static int8_t sa_delta_clip(drm_ps_info *ps, int8_t i)
{
if (i < 0) {
/* printf(" SAminclip %d", i); */
ps->sa_decode_error = 1;
return 0;
} else if (i > 7) {
/* printf(" SAmaxclip %d", i); */
ps->sa_decode_error = 1;
return 7;
} else
return i;
}
static int8_t pan_delta_clip(drm_ps_info *ps, int8_t i)
{
if (i < -7) {
/* printf(" PANminclip %d", i); */
ps->pan_decode_error = 1;
return -7;
} else if (i > 7) {
/* printf(" PANmaxclip %d", i); */
ps->pan_decode_error = 1;
return 7;
} else
return i;
}
static void drm_ps_delta_decode(drm_ps_info *ps)
{
uint8_t band;
if (ps->bs_enable_sa)
{
if (ps->bs_sa_dt_flag && !ps->g_last_had_sa)
{
/* wait until we get a DT frame */
ps->bs_enable_sa = 0;
} else if (ps->bs_sa_dt_flag) {
/* DT frame, we have a last frame, so we can decode */
ps->g_sa_index[0] = sa_delta_clip(ps, ps->g_prev_sa_index[0]+ps->bs_sa_data[0]);
} else {
/* DF always decodable */
ps->g_sa_index[0] = sa_delta_clip(ps,ps->bs_sa_data[0]);
}
for (band = 1; band < DRM_NUM_SA_BANDS; band++)
{
if (ps->bs_sa_dt_flag && ps->g_last_had_sa)
{
ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_prev_sa_index[band] + ps->bs_sa_data[band]);
} else if (!ps->bs_sa_dt_flag) {
ps->g_sa_index[band] = sa_delta_clip(ps, ps->g_sa_index[band-1] + ps->bs_sa_data[band]);
}
}
}
/* An error during SA decoding implies PAN data will be undecodable, too */
/* Also, we don't like on/off switching in PS, so we force to last settings */
if (ps->sa_decode_error) {
ps->pan_decode_error = 1;
ps->bs_enable_pan = ps->g_last_had_pan;
ps->bs_enable_sa = ps->g_last_had_sa;
}
if (ps->bs_enable_sa)
{
if (ps->sa_decode_error) {
for (band = 0; band < DRM_NUM_SA_BANDS; band++)
{
ps->g_sa_index[band] = ps->g_last_good_sa_index[band];
}
} else {
for (band = 0; band < DRM_NUM_SA_BANDS; band++)
{
ps->g_last_good_sa_index[band] = ps->g_sa_index[band];
}
}
}
if (ps->bs_enable_pan)
{
if (ps->bs_pan_dt_flag && !ps->g_last_had_pan)
{
ps->bs_enable_pan = 0;
} else if (ps->bs_pan_dt_flag) {
ps->g_pan_index[0] = pan_delta_clip(ps, ps->g_prev_pan_index[0]+ps->bs_pan_data[0]);
} else {
ps->g_pan_index[0] = pan_delta_clip(ps, ps->bs_pan_data[0]);
}
for (band = 1; band < DRM_NUM_PAN_BANDS; band++)
{
if (ps->bs_pan_dt_flag && ps->g_last_had_pan)
{
ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_prev_pan_index[band] + ps->bs_pan_data[band]);
} else if (!ps->bs_pan_dt_flag) {
ps->g_pan_index[band] = pan_delta_clip(ps, ps->g_pan_index[band-1] + ps->bs_pan_data[band]);
}
}
if (ps->pan_decode_error) {
for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
{
ps->g_pan_index[band] = ps->g_last_good_pan_index[band];
}
} else {
for (band = 0; band < DRM_NUM_PAN_BANDS; band++)
{
ps->g_last_good_pan_index[band] = ps->g_pan_index[band];
}
}
}
}
static void drm_calc_sa_side_signal(drm_ps_info *ps, qmf_t X[38][64])
{
uint8_t s, b, k;
complex_t qfrac, tmp0, tmp, in, R0;
real_t peakdiff;
real_t nrg;
real_t power;
real_t transratio;
real_t new_delay_slopes[NUM_OF_LINKS];
uint8_t temp_delay_ser[NUM_OF_LINKS];
complex_t Phi_Fract;
#ifdef FIXED_POINT
uint32_t in_re, in_im;
#endif
for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
{
/* set delay indices */
for (k = 0; k < NUM_OF_LINKS; k++)
temp_delay_ser[k] = ps->delay_buf_index_ser[k];
RE(Phi_Fract) = RE(Phi_Fract_Qmf[b]);
IM(Phi_Fract) = IM(Phi_Fract_Qmf[b]);
for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
const real_t gamma = REAL_CONST(1.5);
const real_t sigma = REAL_CONST(1.5625);
RE(in) = QMF_RE(X[s][b]);
IM(in) = QMF_IM(X[s][b]);
#ifdef FIXED_POINT
/* NOTE: all input is scaled by 2^(-5) because of fixed point QMF
* meaning that P will be scaled by 2^(-10) compared to floating point version
*/
in_re = ((abs(RE(in))+(1<<(REAL_BITS-1)))>>REAL_BITS);
in_im = ((abs(IM(in))+(1<<(REAL_BITS-1)))>>REAL_BITS);
power = in_re*in_re + in_im*in_im;
#else
power = MUL_R(RE(in),RE(in)) + MUL_R(IM(in),IM(in));
#endif
ps->peakdecay_fast[b] = MUL_F(ps->peakdecay_fast[b], peak_decay);
if (ps->peakdecay_fast[b] < power)
ps->peakdecay_fast[b] = power;
peakdiff = ps->prev_peakdiff[b];
peakdiff += MUL_F((ps->peakdecay_fast[b] - power - ps->prev_peakdiff[b]), smooth_coeff);
ps->prev_peakdiff[b] = peakdiff;
nrg = ps->prev_nrg[b];
nrg += MUL_F((power - ps->prev_nrg[b]), smooth_coeff);
ps->prev_nrg[b] = nrg;
if (MUL_R(peakdiff, gamma) <= nrg) {
transratio = sigma;
} else {
transratio = MUL_R(DIV_R(nrg, MUL_R(peakdiff, gamma)), sigma);
}
for (k = 0; k < NUM_OF_LINKS; k++)
{
new_delay_slopes[k] = MUL_F(g_decayslope[b], filter_coeff[k]);
}
RE(tmp0) = RE(ps->d_buff[0][b]);
IM(tmp0) = IM(ps->d_buff[0][b]);
RE(ps->d_buff[0][b]) = RE(ps->d_buff[1][b]);
IM(ps->d_buff[0][b]) = IM(ps->d_buff[1][b]);
RE(ps->d_buff[1][b]) = RE(in);
IM(ps->d_buff[1][b]) = IM(in);
ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(Phi_Fract), IM(Phi_Fract));
RE(R0) = RE(tmp);
IM(R0) = IM(tmp);
for (k = 0; k < NUM_OF_LINKS; k++)
{
RE(qfrac) = RE(Q_Fract_allpass_Qmf[b][k]);
IM(qfrac) = IM(Q_Fract_allpass_Qmf[b][k]);
RE(tmp0) = RE(ps->d2_buff[k][temp_delay_ser[k]][b]);
IM(tmp0) = IM(ps->d2_buff[k][temp_delay_ser[k]][b]);
ComplexMult(&RE(tmp), &IM(tmp), RE(tmp0), IM(tmp0), RE(qfrac), IM(qfrac));
RE(tmp) += -MUL_F(new_delay_slopes[k], RE(R0));
IM(tmp) += -MUL_F(new_delay_slopes[k], IM(R0));
RE(ps->d2_buff[k][temp_delay_ser[k]][b]) = RE(R0) + MUL_F(new_delay_slopes[k], RE(tmp));
IM(ps->d2_buff[k][temp_delay_ser[k]][b]) = IM(R0) + MUL_F(new_delay_slopes[k], IM(tmp));
RE(R0) = RE(tmp);
IM(R0) = IM(tmp);
}
QMF_RE(ps->SA[s][b]) = MUL_R(RE(R0), transratio);
QMF_IM(ps->SA[s][b]) = MUL_R(IM(R0), transratio);
for (k = 0; k < NUM_OF_LINKS; k++)
{
if (++temp_delay_ser[k] >= delay_length[k])
temp_delay_ser[k] = 0;
}
}
}
for (k = 0; k < NUM_OF_LINKS; k++)
ps->delay_buf_index_ser[k] = temp_delay_ser[k];
}
static void drm_add_ambiance(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
{
uint8_t s, b, ifreq, qclass;
real_t sa_map[MAX_SA_BAND], sa_dir_map[MAX_SA_BAND], k_sa_map[MAX_SA_BAND], k_sa_dir_map[MAX_SA_BAND];
real_t new_dir_map, new_sa_map;
if (ps->bs_enable_sa)
{
/* Instead of dequantization and mapping, we use an inverse mapping
to look up all the values we need */
for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
{
const real_t inv_f_num_of_subsamples = FRAC_CONST(0.03333333333);
ifreq = sa_inv_freq[b];
qclass = (b != 0);
sa_map[b] = sa_quant[ps->g_prev_sa_index[ifreq]][qclass];
new_sa_map = sa_quant[ps->g_sa_index[ifreq]][qclass];
k_sa_map[b] = MUL_F(inv_f_num_of_subsamples, (new_sa_map - sa_map[b]));
sa_dir_map[b] = sa_sqrt_1_minus[ps->g_prev_sa_index[ifreq]][qclass];
new_dir_map = sa_sqrt_1_minus[ps->g_sa_index[ifreq]][qclass];
k_sa_dir_map[b] = MUL_F(inv_f_num_of_subsamples, (new_dir_map - sa_dir_map[b]));
}
for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
for (b = 0; b < sa_freq_scale[DRM_NUM_SA_BANDS]; b++)
{
QMF_RE(X_right[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]);
QMF_IM(X_right[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) - MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]);
QMF_RE(X_left[s][b]) = MUL_F(QMF_RE(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_RE(ps->SA[s][b]), sa_map[b]);
QMF_IM(X_left[s][b]) = MUL_F(QMF_IM(X_left[s][b]), sa_dir_map[b]) + MUL_F(QMF_IM(ps->SA[s][b]), sa_map[b]);
sa_map[b] += k_sa_map[b];
sa_dir_map[b] += k_sa_dir_map[b];
}
for (b = sa_freq_scale[DRM_NUM_SA_BANDS]; b < NUM_OF_QMF_CHANNELS; b++)
{
QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]);
QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]);
}
}
}
else {
for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
{
QMF_RE(X_right[s][b]) = QMF_RE(X_left[s][b]);
QMF_IM(X_right[s][b]) = QMF_IM(X_left[s][b]);
}
}
}
}
static void drm_add_pan(drm_ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64])
{
uint8_t s, b, qclass, ifreq;
real_t tmp, coeff1, coeff2;
real_t pan_base[MAX_PAN_BAND];
real_t pan_delta[MAX_PAN_BAND];
qmf_t temp_l, temp_r;
if (ps->bs_enable_pan)
{
for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
{
/* Instead of dequantization, 20->64 mapping and 2^G(x,y) we do an
inverse mapping 64->20 and look up the 2^G(x,y) values directly */
ifreq = pan_inv_freq[b];
qclass = pan_quant_class[ifreq];
if (ps->g_prev_pan_index[ifreq] >= 0)
{
pan_base[b] = pan_pow_2_pos[ps->g_prev_pan_index[ifreq]][qclass];
} else {
pan_base[b] = pan_pow_2_neg[-ps->g_prev_pan_index[ifreq]][qclass];
}
/* 2^((a-b)/30) = 2^(a/30) * 1/(2^(b/30)) */
/* a en b can be negative so we may need to inverse parts */
if (ps->g_pan_index[ifreq] >= 0)
{
if (ps->g_prev_pan_index[ifreq] >= 0)
{
pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]);
} else {
pan_delta[b] = MUL_C(pan_pow_2_30_pos[ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]);
}
} else {
if (ps->g_prev_pan_index[ifreq] >= 0)
{
pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_neg[ps->g_prev_pan_index[ifreq]][qclass]);
} else {
pan_delta[b] = MUL_C(pan_pow_2_30_neg[-ps->g_pan_index[ifreq]][qclass],
pan_pow_2_30_pos[-ps->g_prev_pan_index[ifreq]][qclass]);
}
}
}
for (s = 0; s < NUM_OF_SUBSAMPLES; s++)
{
/* PAN always uses all 64 channels */
for (b = 0; b < NUM_OF_QMF_CHANNELS; b++)
{
tmp = pan_base[b];
coeff2 = DIV_R(REAL_CONST(2.0), (REAL_CONST(1.0) + tmp));
coeff1 = MUL_R(coeff2, tmp);
QMF_RE(temp_l) = QMF_RE(X_left[s][b]);
QMF_IM(temp_l) = QMF_IM(X_left[s][b]);
QMF_RE(temp_r) = QMF_RE(X_right[s][b]);
QMF_IM(temp_r) = QMF_IM(X_right[s][b]);
QMF_RE(X_left[s][b]) = MUL_R(QMF_RE(temp_l), coeff1);
QMF_IM(X_left[s][b]) = MUL_R(QMF_IM(temp_l), coeff1);
QMF_RE(X_right[s][b]) = MUL_R(QMF_RE(temp_r), coeff2);
QMF_IM(X_right[s][b]) = MUL_R(QMF_IM(temp_r), coeff2);
/* 2^(a+k*b) = 2^a * 2^b * ... * 2^b */
/* ^^^^^^^^^^^^^^^ k times */
pan_base[b] = MUL_C(pan_base[b], pan_delta[b]);
}
}
}
}
drm_ps_info *drm_ps_init(void)
{
drm_ps_info *ps = (drm_ps_info*)faad_malloc(sizeof(drm_ps_info));
memset(ps, 0, sizeof(drm_ps_info));
return ps;
}
void drm_ps_free(drm_ps_info *ps)
{
faad_free(ps);
}
/* main DRM PS decoding function */
uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64])
{
if (ps == NULL)
{
memcpy(X_right, X_left, sizeof(qmf_t)*30*64);
return 0;
}
if (!ps->drm_ps_data_available && !guess)
{
memcpy(X_right, X_left, sizeof(qmf_t)*30*64);
memset(ps->g_prev_sa_index, 0, sizeof(ps->g_prev_sa_index));
memset(ps->g_prev_pan_index, 0, sizeof(ps->g_prev_pan_index));
return 0;
}
/* if SBR CRC doesn't match out, we can assume decode errors to start with,
and we'll guess what the parameters should be */
if (!guess)
{
ps->sa_decode_error = 0;
ps->pan_decode_error = 0;
drm_ps_delta_decode(ps);
} else
{
ps->sa_decode_error = 1;
ps->pan_decode_error = 1;
/* don't even bother decoding */
}
ps->drm_ps_data_available = 0;
drm_calc_sa_side_signal(ps, X_left);
drm_add_ambiance(ps, X_left, X_right);
if (ps->bs_enable_sa)
{
ps->g_last_had_sa = 1;
memcpy(ps->g_prev_sa_index, ps->g_sa_index, sizeof(int8_t) * DRM_NUM_SA_BANDS);
} else {
ps->g_last_had_sa = 0;
}
if (ps->bs_enable_pan)
{
drm_add_pan(ps, X_left, X_right);
ps->g_last_had_pan = 1;
memcpy(ps->g_prev_pan_index, ps->g_pan_index, sizeof(int8_t) * DRM_NUM_PAN_BANDS);
} else {
ps->g_last_had_pan = 0;
}
return 0;
}
#endif

View File

@ -0,0 +1,100 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: drm_dec.h,v 1.8 2007/11/01 12:33:30 menno Exp $
**/
#ifndef __DRM_DEC_H__
#define __DRM_DEC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "bits.h"
#define DRM_PARAMETRIC_STEREO 0
#define DRM_NUM_SA_BANDS 8
#define DRM_NUM_PAN_BANDS 20
#define NUM_OF_LINKS 3
#define NUM_OF_QMF_CHANNELS 64
#define NUM_OF_SUBSAMPLES 30
#define MAX_SA_BAND 46
#define MAX_PAN_BAND 64
#define MAX_DELAY 5
typedef struct
{
uint8_t drm_ps_data_available;
uint8_t bs_enable_sa;
uint8_t bs_enable_pan;
uint8_t bs_sa_dt_flag;
uint8_t bs_pan_dt_flag;
uint8_t g_last_had_sa;
uint8_t g_last_had_pan;
int8_t bs_sa_data[DRM_NUM_SA_BANDS];
int8_t bs_pan_data[DRM_NUM_PAN_BANDS];
int8_t g_sa_index[DRM_NUM_SA_BANDS];
int8_t g_pan_index[DRM_NUM_PAN_BANDS];
int8_t g_prev_sa_index[DRM_NUM_SA_BANDS];
int8_t g_prev_pan_index[DRM_NUM_PAN_BANDS];
int8_t sa_decode_error;
int8_t pan_decode_error;
int8_t g_last_good_sa_index[DRM_NUM_SA_BANDS];
int8_t g_last_good_pan_index[DRM_NUM_PAN_BANDS];
qmf_t SA[NUM_OF_SUBSAMPLES][MAX_SA_BAND];
complex_t d_buff[2][MAX_SA_BAND];
complex_t d2_buff[NUM_OF_LINKS][MAX_DELAY][MAX_SA_BAND];
uint8_t delay_buf_index_ser[NUM_OF_LINKS];
real_t prev_nrg[MAX_SA_BAND];
real_t prev_peakdiff[MAX_SA_BAND];
real_t peakdecay_fast[MAX_SA_BAND];
} drm_ps_info;
uint16_t drm_ps_data(drm_ps_info *ps, bitfile *ld);
drm_ps_info *drm_ps_init(void);
void drm_ps_free(drm_ps_info *ps);
uint8_t drm_ps_decode(drm_ps_info *ps, uint8_t guess, qmf_t X_left[38][64], qmf_t X_right[38][64]);
#ifdef __cplusplus
}
#endif
#endif

129
src/contrib/aacdecoder/libfaad/error.c Normal file → Executable file
View File

@ -1,59 +1,70 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: error.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "error.h"
int8_t *err_msg[] = {
"No error",
"Gain control not yet implemented",
"Pulse coding not allowed in short blocks",
"Invalid huffman codebook",
"Negative scalefactor found, should be impossible",
"Unable to find ADTS syncword",
"Channel coupling not yet implemented",
"Channel configuration not allowed in error resilient frame",
"Bit error in error resilient scalefactor decoding",
"Error decoding huffman scalefactor (bitstream error)",
"Error decoding huffman codeword (bitstream error)",
"Non existent huffman codebook number found",
"Invalid number of channels",
"Maximum number of bitstream elements exceeded",
"Input data buffer too small",
"Array index out of range",
"Maximum number of scalefactor bands exceeded",
"Quantised value out of range",
"LTP lag out of range",
"Invalid SBR parameter decoded",
"SBR called without being initialised",
"Unexpected channel configuration change",
"Error in program_config_element",
"First SBR frame is not the same as first AAC frame",
"Unexpected fill element with SBR data",
"Not all elements were provided with SBR data"
};
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: error.c,v 1.33 2008/09/19 23:31:39 menno Exp $
**/
#include "common.h"
#include "error.h"
char *err_msg[] = {
"No error",
"Gain control not yet implemented",
"Pulse coding not allowed in short blocks",
"Invalid huffman codebook",
"Scalefactor out of range",
"Unable to find ADTS syncword",
"Channel coupling not yet implemented",
"Channel configuration not allowed in error resilient frame",
"Bit error in error resilient scalefactor decoding",
"Error decoding huffman scalefactor (bitstream error)",
"Error decoding huffman codeword (bitstream error)",
"Non existent huffman codebook number found",
"Invalid number of channels",
"Maximum number of bitstream elements exceeded",
"Input data buffer too small",
"Array index out of range",
"Maximum number of scalefactor bands exceeded",
"Quantised value out of range",
"LTP lag out of range",
"Invalid SBR parameter decoded",
"SBR called without being initialised",
"Unexpected channel configuration change",
"Error in program_config_element",
"First SBR frame is not the same as first AAC frame",
"Unexpected fill element with SBR data",
"Not all elements were provided with SBR data",
"LTP decoding not available",
"Output data buffer too small",
"CRC error in DRM data",
"PNS not allowed in DRM data stream",
"No standard extension payload allowed in DRM",
"PCE shall be the first element in a frame",
"Bitstream value not allowed by specification",
"MAIN prediction not initialised"
};

85
src/contrib/aacdecoder/libfaad/error.h Normal file → Executable file
View File

@ -1,41 +1,44 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: error.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __ERROR_H__
#define __ERROR_H__
#ifdef __cplusplus
extern "C" {
#endif
#define NUM_ERROR_MESSAGES 26
extern int8_t *err_msg[];
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: error.h,v 1.27 2008/09/19 23:31:40 menno Exp $
**/
#ifndef __ERROR_H__
#define __ERROR_H__
#ifdef __cplusplus
extern "C" {
#endif
#define NUM_ERROR_MESSAGES 34
extern char *err_msg[];
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,35 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: faad.h,v 1.51 2007/11/01 12:33:29 menno Exp $
**/
/* warn people for update */
#pragma message("please update faad2 include filename and function names!")
/* Backwards compatible link */
#include "neaacdec.h"

1129
src/contrib/aacdecoder/libfaad/filtbank.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

125
src/contrib/aacdecoder/libfaad/filtbank.h Normal file → Executable file
View File

@ -1,64 +1,61 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: filtbank.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __FILTBANK_H__
#define __FILTBANK_H__
#ifdef __cplusplus
extern "C" {
#endif
fb_info *filter_bank_init(uint16_t frame_len);
void filter_bank_end(fb_info *fb);
#ifdef LTP_DEC
void filter_bank_ltp(fb_info *fb,
uint8_t window_sequence,
uint8_t window_shape,
uint8_t window_shape_prev,
real_t *in_data,
real_t *out_mdct,
uint8_t object_type,
uint16_t frame_len);
#endif
void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
uint8_t window_shape_prev, real_t *freq_in,
real_t *time_out, real_t *overlap,
uint8_t object_type, uint16_t frame_len);
#ifdef USE_SSE
void ifilter_bank_sse(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
uint8_t window_shape_prev, real_t *freq_in,
real_t *time_out, uint8_t object_type, uint16_t frame_len);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: filtbank.h,v 1.27 2007/11/01 12:33:30 menno Exp $
**/
#ifndef __FILTBANK_H__
#define __FILTBANK_H__
#ifdef __cplusplus
extern "C" {
#endif
fb_info *filter_bank_init(uint16_t frame_len);
void filter_bank_end(fb_info *fb);
#ifdef LTP_DEC
void filter_bank_ltp(fb_info *fb,
uint8_t window_sequence,
uint8_t window_shape,
uint8_t window_shape_prev,
real_t *in_data,
real_t *out_mdct,
uint8_t object_type,
uint16_t frame_len);
#endif
void ifilter_bank(fb_info *fb, uint8_t window_sequence, uint8_t window_shape,
uint8_t window_shape_prev, real_t *freq_in,
real_t *time_out, real_t *overlap,
uint8_t object_type, uint16_t frame_len);
#ifdef __cplusplus
}
#endif
#endif

483
src/contrib/aacdecoder/libfaad/fixed.h Normal file → Executable file
View File

@ -1,196 +1,287 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: fixed.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __FIXED_H__
#define __FIXED_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32_WCE
#include <cmnintrin.h>
#endif
#define COEF_BITS 28
#define COEF_PRECISION (1 << COEF_BITS)
#define REAL_BITS 14 // MAXIMUM OF 14 FOR FIXED POINT SBR
#define REAL_PRECISION (1 << REAL_BITS)
/* FRAC is the fractional only part of the fixed point number [0.0..1.0) */
#define FRAC_SIZE 32 /* frac is a 32 bit integer */
#define FRAC_BITS 31
#define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS))
#define FRAC_MAX 0x7FFFFFFF
typedef int32_t real_t;
#define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5)))
#define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5)))
#define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))))
#if defined(_WIN32) && !defined(_WIN32_WCE)
/* multiply with real shift */
static INLINE real_t MUL_R(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,REAL_BITS
}
}
/* multiply with coef shift */
static INLINE real_t MUL_C(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,COEF_BITS
}
}
static INLINE real_t _MulHigh(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
mov eax,edx
}
}
/* multiply with fractional shift */
static INLINE real_t MUL_F(real_t A, real_t B)
{
return _MulHigh(A,B) << (FRAC_SIZE-FRAC_BITS);
}
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
*y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
}
#elif defined(__GNUC__) && defined (__arm__)
/* taken from MAD */
#define arm_mul(x, y, SCALEBITS) \
({ \
uint32_t __hi; \
uint32_t __lo; \
uint32_t __result; \
asm("smull %0, %1, %3, %4\n\t" \
"movs %0, %0, lsr %5\n\t" \
"adc %2, %0, %1, lsl %6" \
: "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
: "%r" (x), "r" (y), \
"M" (SCALEBITS), "M" (32 - (SCALEBITS)) \
: "cc"); \
__result; \
})
static INLINE real_t MUL_R(real_t A, real_t B)
{
return arm_mul(A, B, REAL_BITS);
}
static INLINE real_t MUL_C(real_t A, real_t B)
{
return arm_mul(A, B, COEF_BITS);
}
static INLINE real_t _MulHigh(real_t x, real_t y)
{
uint32_t __lo;
uint32_t __hi;
asm("smull\t%0, %1, %2, %3"
: "=&r"(__lo),"=&r"(__hi)
: "%r"(x),"r"(y)
: "cc");
return __hi;
}
static INLINE real_t MUL_F(real_t A, real_t B)
{
return _MulHigh(A, B) << (FRAC_SIZE-FRAC_BITS);
}
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
int32_t tmp, yt1, yt2;
asm("smull %0, %1, %4, %6\n\t"
"smlal %0, %1, %5, %7\n\t"
"rsb %3, %4, #0\n\t"
"smull %0, %2, %5, %6\n\t"
"smlal %0, %2, %3, %7"
: "=&r" (tmp), "=&r" (yt1), "=&r" (yt2), "=r" (x1)
: "3" (x1), "r" (x2), "r" (c1), "r" (c2)
: "cc" );
*y1 = yt1 << (FRAC_SIZE-FRAC_BITS);
*y2 = yt2 << (FRAC_SIZE-FRAC_BITS);
}
#else
/* multiply with real shift */
#define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS)
/* multiply with coef shift */
#define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
/* multiply with fractional shift */
#ifndef _WIN32_WCE
#define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
#define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
#else
/* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */
static INLINE real_t MUL_F(real_t A, real_t B)
{
return _MulHigh(A,B) << (32-FRAC_BITS);
}
#endif
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
*y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
}
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: fixed.h,v 1.32 2007/11/01 12:33:30 menno Exp $
**/
#ifndef __FIXED_H__
#define __FIXED_H__
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32_WCE) && defined(_ARM_)
#include <cmnintrin.h>
#endif
#define COEF_BITS 28
#define COEF_PRECISION (1 << COEF_BITS)
#define REAL_BITS 14 // MAXIMUM OF 14 FOR FIXED POINT SBR
#define REAL_PRECISION (1 << REAL_BITS)
/* FRAC is the fractional only part of the fixed point number [0.0..1.0) */
#define FRAC_SIZE 32 /* frac is a 32 bit integer */
#define FRAC_BITS 31
#define FRAC_PRECISION ((uint32_t)(1 << FRAC_BITS))
#define FRAC_MAX 0x7FFFFFFF
typedef int32_t real_t;
#define REAL_CONST(A) (((A) >= 0) ? ((real_t)((A)*(REAL_PRECISION)+0.5)) : ((real_t)((A)*(REAL_PRECISION)-0.5)))
#define COEF_CONST(A) (((A) >= 0) ? ((real_t)((A)*(COEF_PRECISION)+0.5)) : ((real_t)((A)*(COEF_PRECISION)-0.5)))
#define FRAC_CONST(A) (((A) == 1.00) ? ((real_t)FRAC_MAX) : (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5))))
//#define FRAC_CONST(A) (((A) >= 0) ? ((real_t)((A)*(FRAC_PRECISION)+0.5)) : ((real_t)((A)*(FRAC_PRECISION)-0.5)))
#define Q2_BITS 22
#define Q2_PRECISION (1 << Q2_BITS)
#define Q2_CONST(A) (((A) >= 0) ? ((real_t)((A)*(Q2_PRECISION)+0.5)) : ((real_t)((A)*(Q2_PRECISION)-0.5)))
#if defined(_WIN32) && !defined(_WIN32_WCE)
/* multiply with real shift */
static INLINE real_t MUL_R(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,REAL_BITS
}
}
/* multiply with coef shift */
static INLINE real_t MUL_C(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,COEF_BITS
}
}
static INLINE real_t MUL_Q2(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,Q2_BITS
}
}
static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,6
}
}
static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,23
}
}
#if 1
static INLINE real_t _MulHigh(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
mov eax,edx
}
}
/* multiply with fractional shift */
static INLINE real_t MUL_F(real_t A, real_t B)
{
return _MulHigh(A,B) << (FRAC_SIZE-FRAC_BITS);
}
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
*y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
}
#else
static INLINE real_t MUL_F(real_t A, real_t B)
{
_asm {
mov eax,A
imul B
shrd eax,edx,FRAC_BITS
}
}
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = MUL_F(x1, c1) + MUL_F(x2, c2);
*y2 = MUL_F(x2, c1) - MUL_F(x1, c2);
}
#endif
#elif defined(__GNUC__) && defined (__arm__)
/* taken from MAD */
#define arm_mul(x, y, SCALEBITS) \
({ \
uint32_t __hi; \
uint32_t __lo; \
uint32_t __result; \
asm("smull %0, %1, %3, %4\n\t" \
"movs %0, %0, lsr %5\n\t" \
"adc %2, %0, %1, lsl %6" \
: "=&r" (__lo), "=&r" (__hi), "=r" (__result) \
: "%r" (x), "r" (y), \
"M" (SCALEBITS), "M" (32 - (SCALEBITS)) \
: "cc"); \
__result; \
})
static INLINE real_t MUL_R(real_t A, real_t B)
{
return arm_mul(A, B, REAL_BITS);
}
static INLINE real_t MUL_C(real_t A, real_t B)
{
return arm_mul(A, B, COEF_BITS);
}
static INLINE real_t MUL_Q2(real_t A, real_t B)
{
return arm_mul(A, B, Q2_BITS);
}
static INLINE real_t MUL_SHIFT6(real_t A, real_t B)
{
return arm_mul(A, B, 6);
}
static INLINE real_t MUL_SHIFT23(real_t A, real_t B)
{
return arm_mul(A, B, 23);
}
static INLINE real_t _MulHigh(real_t x, real_t y)
{
uint32_t __lo;
uint32_t __hi;
asm("smull\t%0, %1, %2, %3"
: "=&r"(__lo),"=&r"(__hi)
: "%r"(x),"r"(y)
: "cc");
return __hi;
}
static INLINE real_t MUL_F(real_t A, real_t B)
{
return _MulHigh(A, B) << (FRAC_SIZE-FRAC_BITS);
}
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
int32_t tmp, yt1, yt2;
asm("smull %0, %1, %4, %6\n\t"
"smlal %0, %1, %5, %7\n\t"
"rsb %3, %4, #0\n\t"
"smull %0, %2, %5, %6\n\t"
"smlal %0, %2, %3, %7"
: "=&r" (tmp), "=&r" (yt1), "=&r" (yt2), "=r" (x1)
: "3" (x1), "r" (x2), "r" (c1), "r" (c2)
: "cc" );
*y1 = yt1 << (FRAC_SIZE-FRAC_BITS);
*y2 = yt2 << (FRAC_SIZE-FRAC_BITS);
}
#else
/* multiply with real shift */
#define MUL_R(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (REAL_BITS-1))) >> REAL_BITS)
/* multiply with coef shift */
#define MUL_C(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (COEF_BITS-1))) >> COEF_BITS)
/* multiply with fractional shift */
#if defined(_WIN32_WCE) && defined(_ARM_)
/* eVC for PocketPC has an intrinsic function that returns only the high 32 bits of a 32x32 bit multiply */
static INLINE real_t MUL_F(real_t A, real_t B)
{
return _MulHigh(A,B) << (32-FRAC_BITS);
}
#else
#ifdef __BFIN__
#define _MulHigh(X,Y) ({ int __xxo; \
asm ( \
"a1 = %2.H * %1.L (IS,M);\n\t" \
"a0 = %1.H * %2.H, a1+= %1.H * %2.L (IS,M);\n\t"\
"a1 = a1 >>> 16;\n\t" \
"%0 = (a0 += a1);\n\t" \
: "=d" (__xxo) : "d" (X), "d" (Y) : "A0","A1"); __xxo; })
#define MUL_F(X,Y) ({ int __xxo; \
asm ( \
"a1 = %2.H * %1.L (M);\n\t" \
"a0 = %1.H * %2.H, a1+= %1.H * %2.L (M);\n\t" \
"a1 = a1 >>> 16;\n\t" \
"%0 = (a0 += a1);\n\t" \
: "=d" (__xxo) : "d" (X), "d" (Y) : "A0","A1"); __xxo; })
#else
#define _MulHigh(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_SIZE-1))) >> FRAC_SIZE)
#define MUL_F(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (FRAC_BITS-1))) >> FRAC_BITS)
#endif
#endif
#define MUL_Q2(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (Q2_BITS-1))) >> Q2_BITS)
#define MUL_SHIFT6(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (6-1))) >> 6)
#define MUL_SHIFT23(A,B) (real_t)(((int64_t)(A)*(int64_t)(B)+(1 << (23-1))) >> 23)
/* Complex multiplication */
static INLINE void ComplexMult(real_t *y1, real_t *y2,
real_t x1, real_t x2, real_t c1, real_t c2)
{
*y1 = (_MulHigh(x1, c1) + _MulHigh(x2, c2))<<(FRAC_SIZE-FRAC_BITS);
*y2 = (_MulHigh(x2, c1) - _MulHigh(x1, c2))<<(FRAC_SIZE-FRAC_BITS);
}
#endif
#ifdef __cplusplus
}
#endif
#endif

844
src/contrib/aacdecoder/libfaad/hcr.c Normal file → Executable file
View File

@ -1,412 +1,432 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2002-2004 A. Kurpiers
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: hcr.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#include "syntax.h"
#include "specrec.h"
#include "bits.h"
#include "pulse.h"
#include "analysis.h"
#include "bits.h"
#include "huffman.h"
/* Implements the HCR11 tool as described in ISO/IEC 14496-3/Amd.1, 8.5.3.3 */
#ifdef ERROR_RESILIENCE
/* rewind len (max. 32) bits so that the MSB becomes LSB */
static uint32_t rewind_word( uint32_t W, uint8_t len)
{
uint8_t i;
uint32_t tmp_W=0;
for ( i=0; i<len; i++ )
{
tmp_W<<=1;
if (W & (1<<i)) tmp_W |= 1;
}
return tmp_W;
}
static void rewind_lword( uint32_t *highW, uint32_t *lowW, uint8_t len)
{
uint32_t tmp_lW=0;
if (len > 32)
{
tmp_lW = rewind_word( (*highW << (64-len)) | (*lowW >> (len-32)), 32);
*highW = rewind_word( *lowW << (64-len) , 32);
*lowW = tmp_lW;
} else {
*highW = 0;
*lowW = rewind_word( *lowW, len);
}
}
/* Takes a codeword as stored in r, rewinds the remaining bits and stores it back */
static void rewind_bits(bits_t * r)
{
uint32_t hw, lw;
if (r->len == 0) return;
if (r->len >32)
{
lw = r->bufa;
hw = r->bufb & (0xFFFFFFFF >> (64 - r->len));
rewind_lword( &hw, &lw, r->len );
r->bufa = lw;
r->bufb = hw;
} else {
lw = showbits_hcr(r, r->len );
r->bufa = rewind_word( lw, r->len);
r->bufb = 0;
}
}
/* takes codewords from a and b, concatenate them and store them in b */
static void concat_bits( bits_t * a, bits_t * b)
{
uint32_t hwa, lwa, hwb, lwb;
if (a->len == 0) return;
if (a->len >32)
{
lwa = a->bufa;
hwa = a->bufb & (0xFFFFFFFF >> (64 - a->len));
} else {
lwa = showbits_hcr(a, a->len );
hwa = 0;
}
if (b->len >=32) {
lwb = b->bufa;
hwb = (b->bufb & (0xFFFFFFFF >> (64 - b->len)) ) | ( lwa << (b->len - 32));
} else {
lwb = showbits_hcr(b, b->len ) | (lwa << (b->len));
hwb = (lwa >> (32 - b->len)) | (hwa << (b->len));
}
b->bufa = lwb;
b->bufb = hwb;
b->len += a->len;
}
/* 8.5.3.3.1 */
static const uint8_t PresortedCodebook_VCB11[] = { 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
static const uint8_t PresortedCodebook[] = { 11, 9, 7, 5, 3, 1};
static const uint8_t maxCwLen[32] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
typedef struct
{
bits_t bits;
uint8_t decoded;
uint16_t sp_offset;
uint8_t cb;
} codeword_state;
#define segmentWidth( codebook ) min( maxCwLen[codebook], ics->length_of_longest_codeword )
uint8_t reordered_spectral_data(faacDecHandle hDecoder, ic_stream *ics, bitfile *ld,
int16_t *spectral_data)
{
uint16_t sp_offset[8];
uint16_t g,i, presort;
uint16_t NrCodeWords=0, numberOfSegments=0, BitsRead=0;
uint8_t numberOfSets, set;
codeword_state Codewords[ 1024 ]; // FIXME max length? PCWs are not stored, so index is Codewordnr - numberOfSegments!, maybe malloc()?
bits_t Segment[ 512 ];
uint8_t PCW_decoded=0;
uint16_t nshort = hDecoder->frameLength/8;
/*memset (spectral_data, 0, hDecoder->frameLength*sizeof(uint16_t));*/
if (ics->length_of_reordered_spectral_data == 0)
return 0; /* nothing to do */
/* if we have a corrupted bitstream this can happen... */
if ((ics->length_of_longest_codeword == 0) ||
(ics->length_of_reordered_spectral_data <
ics->length_of_longest_codeword) ||
(ics->max_sfb == 0))
{
return 10; /* this is not good... */
}
/* store the offset into the spectral data for all the window groups because we can't do it later */
sp_offset[0] = 0;
for (g=1; g < ics->num_window_groups; g++)
{
sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1];
}
/* All data is sorted according to the codebook used */
for (presort = 0; presort < (hDecoder->aacSectionDataResilienceFlag ? 22 : 6); presort++)
{
uint8_t sfb;
/* next codebook that has to be processed according to presorting */
uint8_t nextCB = hDecoder->aacSectionDataResilienceFlag ? PresortedCodebook_VCB11[ presort ] : PresortedCodebook[ presort ];
/* Data belonging to the same spectral unit and having the same codebook comes in consecutive codewords.
This is done by scanning all sfbs for possible codewords. For sfbs with more than 4 elements this has to be
repeated */
for (sfb=0; sfb<ics->max_sfb; sfb ++)
{
uint8_t sect_cb, w;
for (w=0; w< (ics->swb_offset[sfb+1] - ics->swb_offset[sfb]); w+=4)
{
for(g = 0; g < ics->num_window_groups; g++)
{
for (i = 0; i < ics->num_sec[g]; i++)
{
sect_cb = ics->sect_cb[g][i];
if (
/* process only sections that are due now */
(( sect_cb == nextCB ) || (( nextCB < ESC_HCB ) && ( sect_cb == nextCB+1)) ) &&
/* process only sfb's that are due now */
((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
)
{
if ((sect_cb != ZERO_HCB) &&
(sect_cb != NOISE_HCB) &&
(sect_cb != INTENSITY_HCB) &&
(sect_cb != INTENSITY_HCB2))
{
uint8_t inc = (sect_cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN;
uint16_t k;
uint32_t hw, lw;
for (k=0; (k < (4/inc)*ics->window_group_length[g]) &&
( (k+w*ics->window_group_length[g]/inc) < (ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb])); k++)
{
uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc*(k+w*ics->window_group_length[g]/inc);
if (!PCW_decoded)
{
/* if we haven't yet read until the end of the buffer, we can directly decode the so-called PCWs */
if ((BitsRead + segmentWidth( sect_cb ))<= ics->length_of_reordered_spectral_data)
{
Segment[ numberOfSegments ].len = segmentWidth( sect_cb );
if (segmentWidth( sect_cb ) > 32)
{
Segment[ numberOfSegments ].bufb = faad_showbits(ld, segmentWidth( sect_cb ) - 32);
faad_flushbits(ld, segmentWidth( sect_cb) - 32);
Segment[ numberOfSegments ].bufa = faad_showbits(ld, 32),
faad_flushbits(ld, 32 );
} else {
Segment[ numberOfSegments ].bufa = faad_showbits(ld, segmentWidth( sect_cb ));
Segment[ numberOfSegments ].bufb = 0;
faad_flushbits(ld, segmentWidth( sect_cb) );
}
huffman_spectral_data_2(sect_cb, &Segment[ numberOfSegments ], &spectral_data[sp]);
BitsRead += segmentWidth( sect_cb );
/* skip to next segment, but store left bits in new buffer */
rewind_bits( &Segment[ numberOfSegments ]);
numberOfSegments++;
} else {
/* the last segment is extended until length_of_reordered_spectral_data */
if (BitsRead < ics->length_of_reordered_spectral_data)
{
uint8_t additional_bits = (ics->length_of_reordered_spectral_data - BitsRead);
if ( additional_bits > 32)
{
hw = faad_showbits(ld, additional_bits - 32);
faad_flushbits(ld, additional_bits - 32);
lw = faad_showbits(ld, 32);
faad_flushbits(ld, 32 );
} else {
lw = faad_showbits(ld, additional_bits);
hw = 0;
faad_flushbits(ld, additional_bits );
}
rewind_lword( &hw, &lw, additional_bits + Segment[ numberOfSegments-1 ].len );
if (Segment[ numberOfSegments-1 ].len > 32)
{
Segment[ numberOfSegments-1 ].bufb = hw +
showbits_hcr(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len - 32);
Segment[ numberOfSegments-1 ].bufa = lw +
showbits_hcr(&Segment[ numberOfSegments-1 ], 32);
} else {
Segment[ numberOfSegments-1 ].bufa = lw +
showbits_hcr(&Segment[ numberOfSegments-1 ], Segment[ numberOfSegments-1 ].len);
Segment[ numberOfSegments-1 ].bufb = hw;
}
Segment[ numberOfSegments-1 ].len += additional_bits;
}
BitsRead = ics->length_of_reordered_spectral_data;
PCW_decoded = 1;
Codewords[ 0 ].sp_offset = sp;
Codewords[ 0 ].cb = sect_cb;
Codewords[ 0 ].decoded = 0;
Codewords[ 0 ].bits.len = 0;
}
} else {
Codewords[ NrCodeWords - numberOfSegments ].sp_offset = sp;
Codewords[ NrCodeWords - numberOfSegments ].cb = sect_cb;
Codewords[ NrCodeWords - numberOfSegments ].decoded = 0;
Codewords[ NrCodeWords - numberOfSegments ].bits.len = 0;
} /* PCW decoded */
NrCodeWords++;
} /* of k */
}
}
} /* of i */
} /* of g */
} /* of w */
} /* of sfb */
} /* of presort */
/* Avoid divide by zero */
if (numberOfSegments == 0)
return 10; /* this is not good... */
numberOfSets = NrCodeWords / numberOfSegments;
/* second step: decode nonPCWs */
for (set = 1; set <= numberOfSets; set++)
{
uint16_t trial;
for (trial = 0; trial < numberOfSegments; trial++)
{
uint16_t codewordBase;
uint16_t set_decoded=numberOfSegments;
if (set == numberOfSets)
set_decoded = NrCodeWords - set*numberOfSegments; /* last set is shorter than the rest */
for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++)
{
uint16_t segment_index = (trial + codewordBase) % numberOfSegments;
uint16_t codeword_index = codewordBase + set*numberOfSegments - numberOfSegments;
if ((codeword_index + numberOfSegments) >= NrCodeWords)
break;
if (!Codewords[ codeword_index ].decoded)
{
if ( Segment[ segment_index ].len > 0)
{
uint8_t tmplen;
if (Codewords[ codeword_index ].bits.len != 0)
{
/* on the first trial the data is only stored in Segment[], not in Codewords[].
On next trials first collect the data stored for this codeword and
concatenate the new data from Segment[] */
concat_bits( &Codewords[ codeword_index ].bits, &Segment[ segment_index ]);
/* Now everthing is stored in Segment[] */
}
tmplen = Segment[ segment_index ].len;
if ( huffman_spectral_data_2(Codewords[ codeword_index ].cb, &Segment[ segment_index ],
&spectral_data[ Codewords[ codeword_index ].sp_offset ]) >=0)
{
/* CW did fit into segment */
Codewords[ codeword_index ].decoded = 1;
set_decoded--;
} else {
/* CW did not fit, so store for later use */
Codewords[ codeword_index ].bits.len = tmplen;
Codewords[ codeword_index ].bits.bufa = Segment[ segment_index ].bufa;
Codewords[ codeword_index ].bits.bufb = Segment[ segment_index ].bufb;
}
}
}
} /* of codewordBase */
if (set_decoded == 0) break; /* no undecoded codewords left in this set */
} /* of trial */
/* rewind all bits in remaining segments with len>0 */
for (i=0; i < numberOfSegments; i++)
rewind_bits( &Segment[ i ] );
}
#if 0
{
int i, r=0, c=0;
for (i=0; i< numberOfSegments; i++)
r += Segment[ i ].len;
if (r != 0)
{
printf("reordered_spectral_data: %d bits remaining!\n", r);
}
for (i=0; i< NrCodeWords - numberOfSegments; i++)
{
if (Codewords[ i ].decoded == 0)
{
c++;
}
}
if (c != 0)
{
printf("reordered_spectral_data: %d Undecoded Codewords remaining!\n",c );
}
if ((r !=0) || (c!=0)) return 10;
}
#endif
return 0;
}
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: hcr.c,v 1.26 2009/01/26 23:51:15 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#include "specrec.h"
#include "huffman.h"
/* ISO/IEC 14496-3/Amd.1
* 8.5.3.3: Huffman Codeword Reordering for AAC spectral data (HCR)
*
* HCR devides the spectral data in known fixed size segments, and
* sorts it by the importance of the data. The importance is firstly
* the (lower) position in the spectrum, and secondly the largest
* value in the used codebook.
* The most important data is written at the start of each segment
* (at known positions), the remaining data is interleaved inbetween,
* with the writing direction alternating.
* Data length is not increased.
*/
#ifdef ERROR_RESILIENCE
/* 8.5.3.3.1 Pre-sorting */
#define NUM_CB 6
#define NUM_CB_ER 22
#define MAX_CB 32
#define VCB11_FIRST 16
#define VCB11_LAST 31
static const uint8_t PreSortCB_STD[NUM_CB] =
{ 11, 9, 7, 5, 3, 1};
static const uint8_t PreSortCB_ER[NUM_CB_ER] =
{ 11, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 9, 7, 5, 3, 1};
/* 8.5.3.3.2 Derivation of segment width */
static const uint8_t maxCwLen[MAX_CB] = {0, 11, 9, 20, 16, 13, 11, 14, 12, 17, 14, 49,
0, 0, 0, 0, 14, 17, 21, 21, 25, 25, 29, 29, 29, 29, 33, 33, 33, 37, 37, 41};
#define segmentWidth(cb) min(maxCwLen[cb], ics->length_of_longest_codeword)
/* bit-twiddling helpers */
static const uint8_t S[] = {1, 2, 4, 8, 16};
static const uint32_t B[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF};
typedef struct
{
uint8_t cb;
uint8_t decoded;
uint16_t sp_offset;
bits_t bits;
} codeword_t;
/* rewind and reverse */
/* 32 bit version */
static uint32_t rewrev_word(uint32_t v, const uint8_t len)
{
/* 32 bit reverse */
v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
/* shift off low bits */
v >>= (32 - len);
return v;
}
/* 64 bit version */
static void rewrev_lword(uint32_t *hi, uint32_t *lo, const uint8_t len)
{
if (len <= 32) {
*hi = 0;
*lo = rewrev_word(*lo, len);
} else
{
uint32_t t = *hi, v = *lo;
/* double 32 bit reverse */
v = ((v >> S[0]) & B[0]) | ((v << S[0]) & ~B[0]);
t = ((t >> S[0]) & B[0]) | ((t << S[0]) & ~B[0]);
v = ((v >> S[1]) & B[1]) | ((v << S[1]) & ~B[1]);
t = ((t >> S[1]) & B[1]) | ((t << S[1]) & ~B[1]);
v = ((v >> S[2]) & B[2]) | ((v << S[2]) & ~B[2]);
t = ((t >> S[2]) & B[2]) | ((t << S[2]) & ~B[2]);
v = ((v >> S[3]) & B[3]) | ((v << S[3]) & ~B[3]);
t = ((t >> S[3]) & B[3]) | ((t << S[3]) & ~B[3]);
v = ((v >> S[4]) & B[4]) | ((v << S[4]) & ~B[4]);
t = ((t >> S[4]) & B[4]) | ((t << S[4]) & ~B[4]);
/* last 32<>32 bit swap is implicit below */
/* shift off low bits (this is really only one 64 bit shift) */
*lo = (t >> (64 - len)) | (v << (len - 32));
*hi = v >> (64 - len);
}
}
/* bits_t version */
static void rewrev_bits(bits_t *bits)
{
if (bits->len == 0) return;
rewrev_lword(&bits->bufb, &bits->bufa, bits->len);
}
/* merge bits of a to b */
static void concat_bits(bits_t *b, bits_t *a)
{
uint32_t bl, bh, al, ah;
if (a->len == 0) return;
al = a->bufa;
ah = a->bufb;
if (b->len > 32)
{
/* maskoff superfluous high b bits */
bl = b->bufa;
bh = b->bufb & ((1 << (b->len-32)) - 1);
/* left shift a b->len bits */
ah = al << (b->len - 32);
al = 0;
} else {
bl = b->bufa & ((1 << (b->len)) - 1);
bh = 0;
ah = (ah << (b->len)) | (al >> (32 - b->len));
al = al << b->len;
}
/* merge */
b->bufa = bl | al;
b->bufb = bh | ah;
b->len += a->len;
}
static uint8_t is_good_cb(uint8_t this_CB, uint8_t this_sec_CB)
{
/* only want spectral data CB's */
if ((this_sec_CB > ZERO_HCB && this_sec_CB <= ESC_HCB) || (this_sec_CB >= VCB11_FIRST && this_sec_CB <= VCB11_LAST))
{
if (this_CB < ESC_HCB)
{
/* normal codebook pairs */
return ((this_sec_CB == this_CB) || (this_sec_CB == this_CB + 1));
} else
{
/* escape codebook */
return (this_sec_CB == this_CB);
}
}
return 0;
}
static void read_segment(bits_t *segment, uint8_t segwidth, bitfile *ld)
{
segment->len = segwidth;
if (segwidth > 32)
{
segment->bufb = faad_getbits(ld, segwidth - 32);
segment->bufa = faad_getbits(ld, 32);
} else {
segment->bufa = faad_getbits(ld, segwidth);
segment->bufb = 0;
}
}
static void fill_in_codeword(codeword_t *codeword, uint16_t index, uint16_t sp, uint8_t cb)
{
codeword[index].sp_offset = sp;
codeword[index].cb = cb;
codeword[index].decoded = 0;
codeword[index].bits.len = 0;
}
uint8_t reordered_spectral_data(NeAACDecStruct *hDecoder, ic_stream *ics,
bitfile *ld, int16_t *spectral_data)
{
uint16_t PCWs_done;
uint16_t numberOfSegments, numberOfSets, numberOfCodewords;
codeword_t codeword[512];
bits_t segment[512];
uint16_t sp_offset[8];
uint16_t g, i, sortloop, set, bitsread;
uint16_t bitsleft, codewordsleft;
uint8_t w_idx, sfb, this_CB, last_CB, this_sec_CB;
const uint16_t nshort = hDecoder->frameLength/8;
const uint16_t sp_data_len = ics->length_of_reordered_spectral_data;
const uint8_t *PreSortCb;
/* no data (e.g. silence) */
if (sp_data_len == 0)
return 0;
/* since there is spectral data, at least one codeword has nonzero length */
if (ics->length_of_longest_codeword == 0)
return 10;
if (sp_data_len < ics->length_of_longest_codeword)
return 10;
sp_offset[0] = 0;
for (g = 1; g < ics->num_window_groups; g++)
{
sp_offset[g] = sp_offset[g-1] + nshort*ics->window_group_length[g-1];
}
PCWs_done = 0;
numberOfSegments = 0;
numberOfCodewords = 0;
bitsread = 0;
/* VCB11 code books in use */
if (hDecoder->aacSectionDataResilienceFlag)
{
PreSortCb = PreSortCB_ER;
last_CB = NUM_CB_ER;
} else
{
PreSortCb = PreSortCB_STD;
last_CB = NUM_CB;
}
/* step 1: decode PCW's (set 0), and stuff data in easier-to-use format */
for (sortloop = 0; sortloop < last_CB; sortloop++)
{
/* select codebook to process this pass */
this_CB = PreSortCb[sortloop];
/* loop over sfbs */
for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
/* loop over all in this sfb, 4 lines per loop */
for (w_idx = 0; 4*w_idx < (min(ics->swb_offset[sfb+1], ics->swb_offset_max) - ics->swb_offset[sfb]); w_idx++)
{
for(g = 0; g < ics->num_window_groups; g++)
{
for (i = 0; i < ics->num_sec[g]; i++)
{
/* check whether sfb used here is the one we want to process */
if ((ics->sect_start[g][i] <= sfb) && (ics->sect_end[g][i] > sfb))
{
/* check whether codebook used here is the one we want to process */
this_sec_CB = ics->sect_cb[g][i];
if (is_good_cb(this_CB, this_sec_CB))
{
/* precalculate some stuff */
uint16_t sect_sfb_size = ics->sect_sfb_offset[g][sfb+1] - ics->sect_sfb_offset[g][sfb];
uint8_t inc = (this_sec_CB < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN;
uint16_t group_cws_count = (4*ics->window_group_length[g])/inc;
uint8_t segwidth = segmentWidth(this_sec_CB);
uint16_t cws;
/* read codewords until end of sfb or end of window group (shouldn't only 1 trigger?) */
for (cws = 0; (cws < group_cws_count) && ((cws + w_idx*group_cws_count) < sect_sfb_size); cws++)
{
uint16_t sp = sp_offset[g] + ics->sect_sfb_offset[g][sfb] + inc * (cws + w_idx*group_cws_count);
/* read and decode PCW */
if (!PCWs_done)
{
/* read in normal segments */
if (bitsread + segwidth <= sp_data_len)
{
read_segment(&segment[numberOfSegments], segwidth, ld);
bitsread += segwidth;
huffman_spectral_data_2(this_sec_CB, &segment[numberOfSegments], &spectral_data[sp]);
/* keep leftover bits */
rewrev_bits(&segment[numberOfSegments]);
numberOfSegments++;
} else {
/* remaining stuff after last segment, we unfortunately couldn't read
this in earlier because it might not fit in 64 bits. since we already
decoded (and removed) the PCW it is now guaranteed to fit */
if (bitsread < sp_data_len)
{
const uint8_t additional_bits = sp_data_len - bitsread;
read_segment(&segment[numberOfSegments], additional_bits, ld);
segment[numberOfSegments].len += segment[numberOfSegments-1].len;
rewrev_bits(&segment[numberOfSegments]);
if (segment[numberOfSegments-1].len > 32)
{
segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb +
showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len - 32);
segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
showbits_hcr(&segment[numberOfSegments-1], 32);
} else {
segment[numberOfSegments-1].bufa = segment[numberOfSegments].bufa +
showbits_hcr(&segment[numberOfSegments-1], segment[numberOfSegments-1].len);
segment[numberOfSegments-1].bufb = segment[numberOfSegments].bufb;
}
segment[numberOfSegments-1].len += additional_bits;
}
bitsread = sp_data_len;
PCWs_done = 1;
fill_in_codeword(codeword, 0, sp, this_sec_CB);
}
} else {
fill_in_codeword(codeword, numberOfCodewords - numberOfSegments, sp, this_sec_CB);
}
numberOfCodewords++;
}
}
}
}
}
}
}
}
if (numberOfSegments == 0)
return 10;
numberOfSets = numberOfCodewords / numberOfSegments;
/* step 2: decode nonPCWs */
for (set = 1; set <= numberOfSets; set++)
{
uint16_t trial;
for (trial = 0; trial < numberOfSegments; trial++)
{
uint16_t codewordBase;
for (codewordBase = 0; codewordBase < numberOfSegments; codewordBase++)
{
const uint16_t segment_idx = (trial + codewordBase) % numberOfSegments;
const uint16_t codeword_idx = codewordBase + set*numberOfSegments - numberOfSegments;
/* data up */
if (codeword_idx >= numberOfCodewords - numberOfSegments) break;
if (!codeword[codeword_idx].decoded && segment[segment_idx].len > 0)
{
uint8_t tmplen;
if (codeword[codeword_idx].bits.len != 0)
concat_bits(&segment[segment_idx], &codeword[codeword_idx].bits);
tmplen = segment[segment_idx].len;
if (huffman_spectral_data_2(codeword[codeword_idx].cb, &segment[segment_idx],
&spectral_data[codeword[codeword_idx].sp_offset]) >= 0)
{
codeword[codeword_idx].decoded = 1;
} else
{
codeword[codeword_idx].bits = segment[segment_idx];
codeword[codeword_idx].bits.len = tmplen;
}
}
}
}
for (i = 0; i < numberOfSegments; i++)
rewrev_bits(&segment[i]);
}
#if 0 // Seems to give false errors
bitsleft = 0;
for (i = 0; i < numberOfSegments && !bitsleft; i++)
bitsleft += segment[i].len;
if (bitsleft) return 10;
codewordsleft = 0;
for (i = 0; (i < numberOfCodewords - numberOfSegments) && (!codewordsleft); i++)
if (!codeword[i].decoded)
codewordsleft++;
if (codewordsleft) return 10;
#endif
return 0;
}
#endif

1074
src/contrib/aacdecoder/libfaad/huffman.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

91
src/contrib/aacdecoder/libfaad/huffman.h Normal file → Executable file
View File

@ -1,44 +1,47 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: huffman.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __HUFFMAN_H__
#define __HUFFMAN_H__
#ifdef __cplusplus
extern "C" {
#endif
int8_t huffman_scale_factor(bitfile *ld);
uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp);
#ifdef ERROR_RESILIENCE
int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: huffman.h,v 1.28 2007/11/01 12:33:30 menno Exp $
**/
#ifndef __HUFFMAN_H__
#define __HUFFMAN_H__
#ifdef __cplusplus
extern "C" {
#endif
int8_t huffman_scale_factor(bitfile *ld);
uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp);
#ifdef ERROR_RESILIENCE
int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp);
#endif
#ifdef __cplusplus
}
#endif
#endif

538
src/contrib/aacdecoder/libfaad/ic_predict.c Normal file → Executable file
View File

@ -1,267 +1,271 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ic_predict.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef MAIN_DEC
#include "syntax.h"
#include "ic_predict.h"
#include "pns.h"
static void flt_round(float32_t *pf)
{
int32_t flg;
uint32_t tmp, tmp1, tmp2;
tmp = *(uint32_t*)pf;
flg = tmp & (uint32_t)0x00008000;
tmp &= (uint32_t)0xffff0000;
tmp1 = tmp;
/* round 1/2 lsb toward infinity */
if (flg)
{
tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
tmp |= (uint32_t)0x00010000; /* insert 1 lsb */
tmp2 = tmp; /* add 1 lsb and elided one */
tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
*pf = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp;
} else {
*pf = *(float32_t*)&tmp;
}
}
static int16_t quant_pred(float32_t x)
{
int16_t q;
uint32_t *tmp = (uint32_t*)&x;
q = (int16_t)(*tmp>>16);
return q;
}
static float32_t inv_quant_pred(int16_t q)
{
float32_t x;
uint32_t *tmp = (uint32_t*)&x;
*tmp = ((uint32_t)q)<<16;
return x;
}
static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred)
{
uint16_t tmp;
int16_t i, j;
real_t dr1, predictedvalue;
real_t e0, e1;
real_t k1, k2;
real_t r[2];
real_t COR[2];
real_t VAR[2];
r[0] = inv_quant_pred(state->r[0]);
r[1] = inv_quant_pred(state->r[1]);
COR[0] = inv_quant_pred(state->COR[0]);
COR[1] = inv_quant_pred(state->COR[1]);
VAR[0] = inv_quant_pred(state->VAR[0]);
VAR[1] = inv_quant_pred(state->VAR[1]);
#if 1
tmp = state->VAR[0];
j = (tmp >> 7);
i = tmp & 0x7f;
if (j >= 128)
{
j -= 128;
k1 = COR[0] * exp_table[j] * mnt_table[i];
} else {
k1 = REAL_CONST(0);
}
#else
{
#define B 0.953125
real_t c = COR[0];
real_t v = VAR[0];
real_t tmp;
if (c == 0 || v <= 1)
{
k1 = 0;
} else {
tmp = B / v;
flt_round(&tmp);
k1 = c * tmp;
}
}
#endif
if (pred)
{
#if 1
tmp = state->VAR[1];
j = (tmp >> 7);
i = tmp & 0x7f;
if (j >= 128)
{
j -= 128;
k2 = COR[1] * exp_table[j] * mnt_table[i];
} else {
k2 = REAL_CONST(0);
}
#else
#define B 0.953125
real_t c = COR[1];
real_t v = VAR[1];
real_t tmp;
if (c == 0 || v <= 1)
{
k2 = 0;
} else {
tmp = B / v;
flt_round(&tmp);
k2 = c * tmp;
}
#endif
predictedvalue = k1*r[0] + k2*r[1];
flt_round(&predictedvalue);
*output = input + predictedvalue;
}
/* calculate new state data */
e0 = *output;
e1 = e0 - k1*r[0];
dr1 = k1*e0;
VAR[0] = ALPHA*VAR[0] + 0.5f * (r[0]*r[0] + e0*e0);
COR[0] = ALPHA*COR[0] + r[0]*e0;
VAR[1] = ALPHA*VAR[1] + 0.5f * (r[1]*r[1] + e1*e1);
COR[1] = ALPHA*COR[1] + r[1]*e1;
r[1] = A * (r[0]-dr1);
r[0] = A * e0;
state->r[0] = quant_pred(r[0]);
state->r[1] = quant_pred(r[1]);
state->COR[0] = quant_pred(COR[0]);
state->COR[1] = quant_pred(COR[1]);
state->VAR[0] = quant_pred(VAR[0]);
state->VAR[1] = quant_pred(VAR[1]);
}
static void reset_pred_state(pred_state *state)
{
state->r[0] = 0;
state->r[1] = 0;
state->COR[0] = 0;
state->COR[1] = 0;
state->VAR[0] = 0x3F80;
state->VAR[1] = 0x3F80;
}
void pns_reset_pred_state(ic_stream *ics, pred_state *state)
{
uint8_t sfb, g, b;
uint16_t i, offs, offs2;
/* prediction only for long blocks */
if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
return;
for (g = 0; g < ics->num_window_groups; g++)
{
for (b = 0; b < ics->window_group_length[g]; b++)
{
for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
if (is_noise(ics, g, sfb))
{
offs = ics->swb_offset[sfb];
offs2 = ics->swb_offset[sfb+1];
for (i = offs; i < offs2; i++)
reset_pred_state(&state[i]);
}
}
}
}
}
void reset_all_predictors(pred_state *state, uint16_t frame_len)
{
uint16_t i;
for (i = 0; i < frame_len; i++)
reset_pred_state(&state[i]);
}
/* intra channel prediction */
void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
uint16_t frame_len, uint8_t sf_index)
{
uint8_t sfb;
uint16_t bin;
if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
{
reset_all_predictors(state, frame_len);
} else {
for (sfb = 0; sfb < max_pred_sfb(sf_index); sfb++)
{
uint16_t low = ics->swb_offset[sfb];
uint16_t high = ics->swb_offset[sfb+1];
for (bin = low; bin < high; bin++)
{
ic_predict(&state[bin], spec[bin], &spec[bin],
(ics->predictor_data_present && ics->pred.prediction_used[sfb]));
}
}
if (ics->predictor_data_present)
{
if (ics->pred.predictor_reset)
{
for (bin = ics->pred.predictor_reset_group_number - 1;
bin < frame_len; bin += 30)
{
reset_pred_state(&state[bin]);
}
}
}
}
}
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: ic_predict.c,v 1.28 2007/11/01 12:33:31 menno Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef MAIN_DEC
#include "syntax.h"
#include "ic_predict.h"
#include "pns.h"
static void flt_round(float32_t *pf)
{
int32_t flg;
uint32_t tmp, tmp1, tmp2;
tmp = *(uint32_t*)pf;
flg = tmp & (uint32_t)0x00008000;
tmp &= (uint32_t)0xffff0000;
tmp1 = tmp;
/* round 1/2 lsb toward infinity */
if (flg)
{
tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
tmp |= (uint32_t)0x00010000; /* insert 1 lsb */
tmp2 = tmp; /* add 1 lsb and elided one */
tmp &= (uint32_t)0xff800000; /* extract exponent and sign */
*pf = *(float32_t*)&tmp1 + *(float32_t*)&tmp2 - *(float32_t*)&tmp;
} else {
*pf = *(float32_t*)&tmp;
}
}
static int16_t quant_pred(float32_t x)
{
int16_t q;
uint32_t *tmp = (uint32_t*)&x;
q = (int16_t)(*tmp>>16);
return q;
}
static float32_t inv_quant_pred(int16_t q)
{
float32_t x;
uint32_t *tmp = (uint32_t*)&x;
*tmp = ((uint32_t)q)<<16;
return x;
}
static void ic_predict(pred_state *state, real_t input, real_t *output, uint8_t pred)
{
uint16_t tmp;
int16_t i, j;
real_t dr1;
float32_t predictedvalue;
real_t e0, e1;
real_t k1, k2;
real_t r[2];
real_t COR[2];
real_t VAR[2];
r[0] = inv_quant_pred(state->r[0]);
r[1] = inv_quant_pred(state->r[1]);
COR[0] = inv_quant_pred(state->COR[0]);
COR[1] = inv_quant_pred(state->COR[1]);
VAR[0] = inv_quant_pred(state->VAR[0]);
VAR[1] = inv_quant_pred(state->VAR[1]);
#if 1
tmp = state->VAR[0];
j = (tmp >> 7);
i = tmp & 0x7f;
if (j >= 128)
{
j -= 128;
k1 = COR[0] * exp_table[j] * mnt_table[i];
} else {
k1 = REAL_CONST(0);
}
#else
{
#define B 0.953125
real_t c = COR[0];
real_t v = VAR[0];
float32_t tmp;
if (c == 0 || v <= 1)
{
k1 = 0;
} else {
tmp = B / v;
flt_round(&tmp);
k1 = c * tmp;
}
}
#endif
if (pred)
{
#if 1
tmp = state->VAR[1];
j = (tmp >> 7);
i = tmp & 0x7f;
if (j >= 128)
{
j -= 128;
k2 = COR[1] * exp_table[j] * mnt_table[i];
} else {
k2 = REAL_CONST(0);
}
#else
#define B 0.953125
real_t c = COR[1];
real_t v = VAR[1];
float32_t tmp;
if (c == 0 || v <= 1)
{
k2 = 0;
} else {
tmp = B / v;
flt_round(&tmp);
k2 = c * tmp;
}
#endif
predictedvalue = k1*r[0] + k2*r[1];
flt_round(&predictedvalue);
*output = input + predictedvalue;
}
/* calculate new state data */
e0 = *output;
e1 = e0 - k1*r[0];
dr1 = k1*e0;
VAR[0] = ALPHA*VAR[0] + 0.5f * (r[0]*r[0] + e0*e0);
COR[0] = ALPHA*COR[0] + r[0]*e0;
VAR[1] = ALPHA*VAR[1] + 0.5f * (r[1]*r[1] + e1*e1);
COR[1] = ALPHA*COR[1] + r[1]*e1;
r[1] = A * (r[0]-dr1);
r[0] = A * e0;
state->r[0] = quant_pred(r[0]);
state->r[1] = quant_pred(r[1]);
state->COR[0] = quant_pred(COR[0]);
state->COR[1] = quant_pred(COR[1]);
state->VAR[0] = quant_pred(VAR[0]);
state->VAR[1] = quant_pred(VAR[1]);
}
static void reset_pred_state(pred_state *state)
{
state->r[0] = 0;
state->r[1] = 0;
state->COR[0] = 0;
state->COR[1] = 0;
state->VAR[0] = 0x3F80;
state->VAR[1] = 0x3F80;
}
void pns_reset_pred_state(ic_stream *ics, pred_state *state)
{
uint8_t sfb, g, b;
uint16_t i, offs, offs2;
/* prediction only for long blocks */
if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
return;
for (g = 0; g < ics->num_window_groups; g++)
{
for (b = 0; b < ics->window_group_length[g]; b++)
{
for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
if (is_noise(ics, g, sfb))
{
offs = ics->swb_offset[sfb];
offs2 = min(ics->swb_offset[sfb+1], ics->swb_offset_max);
for (i = offs; i < offs2; i++)
reset_pred_state(&state[i]);
}
}
}
}
}
void reset_all_predictors(pred_state *state, uint16_t frame_len)
{
uint16_t i;
for (i = 0; i < frame_len; i++)
reset_pred_state(&state[i]);
}
/* intra channel prediction */
void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
uint16_t frame_len, uint8_t sf_index)
{
uint8_t sfb;
uint16_t bin;
if (ics->window_sequence == EIGHT_SHORT_SEQUENCE)
{
reset_all_predictors(state, frame_len);
} else {
for (sfb = 0; sfb < max_pred_sfb(sf_index); sfb++)
{
uint16_t low = ics->swb_offset[sfb];
uint16_t high = min(ics->swb_offset[sfb+1], ics->swb_offset_max);
for (bin = low; bin < high; bin++)
{
ic_predict(&state[bin], spec[bin], &spec[bin],
(ics->predictor_data_present && ics->pred.prediction_used[sfb]));
}
}
if (ics->predictor_data_present)
{
if (ics->pred.predictor_reset)
{
for (bin = ics->pred.predictor_reset_group_number - 1;
bin < frame_len; bin += 30)
{
reset_pred_state(&state[bin]);
}
}
}
}
}
#endif

501
src/contrib/aacdecoder/libfaad/ic_predict.h Normal file → Executable file
View File

@ -1,249 +1,252 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ic_predict.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifdef MAIN_DEC
#ifndef __IC_PREDICT_H__
#define __IC_PREDICT_H__
#ifdef __cplusplus
extern "C" {
#endif
#define ALPHA REAL_CONST(0.90625)
#define A REAL_CONST(0.953125)
void pns_reset_pred_state(ic_stream *ics, pred_state *state);
void reset_all_predictors(pred_state *state, uint16_t frame_len);
void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
uint16_t frame_len, uint8_t sf_index);
ALIGN static const real_t mnt_table[128] = {
COEF_CONST(0.9531250000), COEF_CONST(0.9453125000),
COEF_CONST(0.9375000000), COEF_CONST(0.9296875000),
COEF_CONST(0.9257812500), COEF_CONST(0.9179687500),
COEF_CONST(0.9101562500), COEF_CONST(0.9023437500),
COEF_CONST(0.8984375000), COEF_CONST(0.8906250000),
COEF_CONST(0.8828125000), COEF_CONST(0.8789062500),
COEF_CONST(0.8710937500), COEF_CONST(0.8671875000),
COEF_CONST(0.8593750000), COEF_CONST(0.8515625000),
COEF_CONST(0.8476562500), COEF_CONST(0.8398437500),
COEF_CONST(0.8359375000), COEF_CONST(0.8281250000),
COEF_CONST(0.8242187500), COEF_CONST(0.8203125000),
COEF_CONST(0.8125000000), COEF_CONST(0.8085937500),
COEF_CONST(0.8007812500), COEF_CONST(0.7968750000),
COEF_CONST(0.7929687500), COEF_CONST(0.7851562500),
COEF_CONST(0.7812500000), COEF_CONST(0.7773437500),
COEF_CONST(0.7734375000), COEF_CONST(0.7656250000),
COEF_CONST(0.7617187500), COEF_CONST(0.7578125000),
COEF_CONST(0.7539062500), COEF_CONST(0.7500000000),
COEF_CONST(0.7421875000), COEF_CONST(0.7382812500),
COEF_CONST(0.7343750000), COEF_CONST(0.7304687500),
COEF_CONST(0.7265625000), COEF_CONST(0.7226562500),
COEF_CONST(0.7187500000), COEF_CONST(0.7148437500),
COEF_CONST(0.7109375000), COEF_CONST(0.7070312500),
COEF_CONST(0.6992187500), COEF_CONST(0.6953125000),
COEF_CONST(0.6914062500), COEF_CONST(0.6875000000),
COEF_CONST(0.6835937500), COEF_CONST(0.6796875000),
COEF_CONST(0.6796875000), COEF_CONST(0.6757812500),
COEF_CONST(0.6718750000), COEF_CONST(0.6679687500),
COEF_CONST(0.6640625000), COEF_CONST(0.6601562500),
COEF_CONST(0.6562500000), COEF_CONST(0.6523437500),
COEF_CONST(0.6484375000), COEF_CONST(0.6445312500),
COEF_CONST(0.6406250000), COEF_CONST(0.6406250000),
COEF_CONST(0.6367187500), COEF_CONST(0.6328125000),
COEF_CONST(0.6289062500), COEF_CONST(0.6250000000),
COEF_CONST(0.6210937500), COEF_CONST(0.6210937500),
COEF_CONST(0.6171875000), COEF_CONST(0.6132812500),
COEF_CONST(0.6093750000), COEF_CONST(0.6054687500),
COEF_CONST(0.6054687500), COEF_CONST(0.6015625000),
COEF_CONST(0.5976562500), COEF_CONST(0.5937500000),
COEF_CONST(0.5937500000), COEF_CONST(0.5898437500),
COEF_CONST(0.5859375000), COEF_CONST(0.5820312500),
COEF_CONST(0.5820312500), COEF_CONST(0.5781250000),
COEF_CONST(0.5742187500), COEF_CONST(0.5742187500),
COEF_CONST(0.5703125000), COEF_CONST(0.5664062500),
COEF_CONST(0.5664062500), COEF_CONST(0.5625000000),
COEF_CONST(0.5585937500), COEF_CONST(0.5585937500),
COEF_CONST(0.5546875000), COEF_CONST(0.5507812500),
COEF_CONST(0.5507812500), COEF_CONST(0.5468750000),
COEF_CONST(0.5429687500), COEF_CONST(0.5429687500),
COEF_CONST(0.5390625000), COEF_CONST(0.5390625000),
COEF_CONST(0.5351562500), COEF_CONST(0.5312500000),
COEF_CONST(0.5312500000), COEF_CONST(0.5273437500),
COEF_CONST(0.5273437500), COEF_CONST(0.5234375000),
COEF_CONST(0.5195312500), COEF_CONST(0.5195312500),
COEF_CONST(0.5156250000), COEF_CONST(0.5156250000),
COEF_CONST(0.5117187500), COEF_CONST(0.5117187500),
COEF_CONST(0.5078125000), COEF_CONST(0.5078125000),
COEF_CONST(0.5039062500), COEF_CONST(0.5039062500),
COEF_CONST(0.5000000000), COEF_CONST(0.4980468750),
COEF_CONST(0.4960937500), COEF_CONST(0.4941406250),
COEF_CONST(0.4921875000), COEF_CONST(0.4902343750),
COEF_CONST(0.4882812500), COEF_CONST(0.4863281250),
COEF_CONST(0.4843750000), COEF_CONST(0.4824218750),
COEF_CONST(0.4804687500), COEF_CONST(0.4785156250)
};
ALIGN static const real_t exp_table[128] = {
COEF_CONST(0.50000000000000000000000000000000000000000000000000),
COEF_CONST(0.25000000000000000000000000000000000000000000000000),
COEF_CONST(0.12500000000000000000000000000000000000000000000000),
COEF_CONST(0.06250000000000000000000000000000000000000000000000),
COEF_CONST(0.03125000000000000000000000000000000000000000000000),
COEF_CONST(0.01562500000000000000000000000000000000000000000000),
COEF_CONST(0.00781250000000000000000000000000000000000000000000),
COEF_CONST(0.00390625000000000000000000000000000000000000000000),
COEF_CONST(0.00195312500000000000000000000000000000000000000000),
COEF_CONST(0.00097656250000000000000000000000000000000000000000),
COEF_CONST(0.00048828125000000000000000000000000000000000000000),
COEF_CONST(0.00024414062500000000000000000000000000000000000000),
COEF_CONST(0.00012207031250000000000000000000000000000000000000),
COEF_CONST(0.00006103515625000000000000000000000000000000000000),
COEF_CONST(0.00003051757812500000000000000000000000000000000000),
COEF_CONST(0.00001525878906250000000000000000000000000000000000),
COEF_CONST(0.00000762939453125000000000000000000000000000000000),
COEF_CONST(0.00000381469726562500000000000000000000000000000000),
COEF_CONST(0.00000190734863281250000000000000000000000000000000),
COEF_CONST(0.00000095367431640625000000000000000000000000000000),
COEF_CONST(0.00000047683715820312500000000000000000000000000000),
COEF_CONST(0.00000023841857910156250000000000000000000000000000),
COEF_CONST(0.00000011920928955078125000000000000000000000000000),
COEF_CONST(0.00000005960464477539062500000000000000000000000000),
COEF_CONST(0.00000002980232238769531300000000000000000000000000),
COEF_CONST(0.00000001490116119384765600000000000000000000000000),
COEF_CONST(0.00000000745058059692382810000000000000000000000000),
COEF_CONST(0.00000000372529029846191410000000000000000000000000),
COEF_CONST(0.00000000186264514923095700000000000000000000000000),
COEF_CONST(0.00000000093132257461547852000000000000000000000000),
COEF_CONST(0.00000000046566128730773926000000000000000000000000),
COEF_CONST(0.00000000023283064365386963000000000000000000000000),
COEF_CONST(0.00000000011641532182693481000000000000000000000000),
COEF_CONST(0.00000000005820766091346740700000000000000000000000),
COEF_CONST(0.00000000002910383045673370400000000000000000000000),
COEF_CONST(0.00000000001455191522836685200000000000000000000000),
COEF_CONST(0.00000000000727595761418342590000000000000000000000),
COEF_CONST(0.00000000000363797880709171300000000000000000000000),
COEF_CONST(0.00000000000181898940354585650000000000000000000000),
COEF_CONST(0.00000000000090949470177292824000000000000000000000),
COEF_CONST(0.00000000000045474735088646412000000000000000000000),
COEF_CONST(0.00000000000022737367544323206000000000000000000000),
COEF_CONST(0.00000000000011368683772161603000000000000000000000),
COEF_CONST(0.00000000000005684341886080801500000000000000000000),
COEF_CONST(0.00000000000002842170943040400700000000000000000000),
COEF_CONST(0.00000000000001421085471520200400000000000000000000),
COEF_CONST(0.00000000000000710542735760100190000000000000000000),
COEF_CONST(0.00000000000000355271367880050090000000000000000000),
COEF_CONST(0.00000000000000177635683940025050000000000000000000),
COEF_CONST(0.00000000000000088817841970012523000000000000000000),
COEF_CONST(0.00000000000000044408920985006262000000000000000000),
COEF_CONST(0.00000000000000022204460492503131000000000000000000),
COEF_CONST(0.00000000000000011102230246251565000000000000000000),
COEF_CONST(0.00000000000000005551115123125782700000000000000000),
COEF_CONST(0.00000000000000002775557561562891400000000000000000),
COEF_CONST(0.00000000000000001387778780781445700000000000000000),
COEF_CONST(0.00000000000000000693889390390722840000000000000000),
COEF_CONST(0.00000000000000000346944695195361420000000000000000),
COEF_CONST(0.00000000000000000173472347597680710000000000000000),
COEF_CONST(0.00000000000000000086736173798840355000000000000000),
COEF_CONST(0.00000000000000000043368086899420177000000000000000),
COEF_CONST(0.00000000000000000021684043449710089000000000000000),
COEF_CONST(0.00000000000000000010842021724855044000000000000000),
COEF_CONST(0.00000000000000000005421010862427522200000000000000),
COEF_CONST(0.00000000000000000002710505431213761100000000000000),
COEF_CONST(0.00000000000000000001355252715606880500000000000000),
COEF_CONST(0.00000000000000000000677626357803440270000000000000),
COEF_CONST(0.00000000000000000000338813178901720140000000000000),
COEF_CONST(0.00000000000000000000169406589450860070000000000000),
COEF_CONST(0.00000000000000000000084703294725430034000000000000),
COEF_CONST(0.00000000000000000000042351647362715017000000000000),
COEF_CONST(0.00000000000000000000021175823681357508000000000000),
COEF_CONST(0.00000000000000000000010587911840678754000000000000),
COEF_CONST(0.00000000000000000000005293955920339377100000000000),
COEF_CONST(0.00000000000000000000002646977960169688600000000000),
COEF_CONST(0.00000000000000000000001323488980084844300000000000),
COEF_CONST(0.00000000000000000000000661744490042422140000000000),
COEF_CONST(0.00000000000000000000000330872245021211070000000000),
COEF_CONST(0.00000000000000000000000165436122510605530000000000),
COEF_CONST(0.00000000000000000000000082718061255302767000000000),
COEF_CONST(0.00000000000000000000000041359030627651384000000000),
COEF_CONST(0.00000000000000000000000020679515313825692000000000),
COEF_CONST(0.00000000000000000000000010339757656912846000000000),
COEF_CONST(0.00000000000000000000000005169878828456423000000000),
COEF_CONST(0.00000000000000000000000002584939414228211500000000),
COEF_CONST(0.00000000000000000000000001292469707114105700000000),
COEF_CONST(0.00000000000000000000000000646234853557052870000000),
COEF_CONST(0.00000000000000000000000000323117426778526440000000),
COEF_CONST(0.00000000000000000000000000161558713389263220000000),
COEF_CONST(0.00000000000000000000000000080779356694631609000000),
COEF_CONST(0.00000000000000000000000000040389678347315804000000),
COEF_CONST(0.00000000000000000000000000020194839173657902000000),
COEF_CONST(0.00000000000000000000000000010097419586828951000000),
COEF_CONST(0.00000000000000000000000000005048709793414475600000),
COEF_CONST(0.00000000000000000000000000002524354896707237800000),
COEF_CONST(0.00000000000000000000000000001262177448353618900000),
COEF_CONST(0.00000000000000000000000000000631088724176809440000),
COEF_CONST(0.00000000000000000000000000000315544362088404720000),
COEF_CONST(0.00000000000000000000000000000157772181044202360000),
COEF_CONST(0.00000000000000000000000000000078886090522101181000),
COEF_CONST(0.00000000000000000000000000000039443045261050590000),
COEF_CONST(0.00000000000000000000000000000019721522630525295000),
COEF_CONST(0.00000000000000000000000000000009860761315262647600),
COEF_CONST(0.00000000000000000000000000000004930380657631323800),
COEF_CONST(0.00000000000000000000000000000002465190328815661900),
COEF_CONST(0.00000000000000000000000000000001232595164407830900),
COEF_CONST(0.00000000000000000000000000000000616297582203915470),
COEF_CONST(0.00000000000000000000000000000000308148791101957740),
COEF_CONST(0.00000000000000000000000000000000154074395550978870),
COEF_CONST(0.00000000000000000000000000000000077037197775489434),
COEF_CONST(0.00000000000000000000000000000000038518598887744717),
COEF_CONST(0.00000000000000000000000000000000019259299443872359),
COEF_CONST(0.00000000000000000000000000000000009629649721936179),
COEF_CONST(0.00000000000000000000000000000000004814824860968090),
COEF_CONST(0.00000000000000000000000000000000002407412430484045),
COEF_CONST(0.00000000000000000000000000000000001203706215242022),
COEF_CONST(0.00000000000000000000000000000000000601853107621011),
COEF_CONST(0.00000000000000000000000000000000000300926553810506),
COEF_CONST(0.00000000000000000000000000000000000150463276905253),
COEF_CONST(0.00000000000000000000000000000000000075231638452626),
COEF_CONST(0.00000000000000000000000000000000000037615819226313),
COEF_CONST(0.00000000000000000000000000000000000018807909613157),
COEF_CONST(0.00000000000000000000000000000000000009403954806578),
COEF_CONST(0.00000000000000000000000000000000000004701977403289),
COEF_CONST(0.00000000000000000000000000000000000002350988701645),
COEF_CONST(0.00000000000000000000000000000000000001175494350822),
COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */),
COEF_CONST(0.0)
};
#ifdef __cplusplus
}
#endif
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: ic_predict.h,v 1.23 2007/11/01 12:33:31 menno Exp $
**/
#ifdef MAIN_DEC
#ifndef __IC_PREDICT_H__
#define __IC_PREDICT_H__
#ifdef __cplusplus
extern "C" {
#endif
#define ALPHA REAL_CONST(0.90625)
#define A REAL_CONST(0.953125)
void pns_reset_pred_state(ic_stream *ics, pred_state *state);
void reset_all_predictors(pred_state *state, uint16_t frame_len);
void ic_prediction(ic_stream *ics, real_t *spec, pred_state *state,
uint16_t frame_len, uint8_t sf_index);
ALIGN static const real_t mnt_table[128] = {
COEF_CONST(0.9531250000), COEF_CONST(0.9453125000),
COEF_CONST(0.9375000000), COEF_CONST(0.9296875000),
COEF_CONST(0.9257812500), COEF_CONST(0.9179687500),
COEF_CONST(0.9101562500), COEF_CONST(0.9023437500),
COEF_CONST(0.8984375000), COEF_CONST(0.8906250000),
COEF_CONST(0.8828125000), COEF_CONST(0.8789062500),
COEF_CONST(0.8710937500), COEF_CONST(0.8671875000),
COEF_CONST(0.8593750000), COEF_CONST(0.8515625000),
COEF_CONST(0.8476562500), COEF_CONST(0.8398437500),
COEF_CONST(0.8359375000), COEF_CONST(0.8281250000),
COEF_CONST(0.8242187500), COEF_CONST(0.8203125000),
COEF_CONST(0.8125000000), COEF_CONST(0.8085937500),
COEF_CONST(0.8007812500), COEF_CONST(0.7968750000),
COEF_CONST(0.7929687500), COEF_CONST(0.7851562500),
COEF_CONST(0.7812500000), COEF_CONST(0.7773437500),
COEF_CONST(0.7734375000), COEF_CONST(0.7656250000),
COEF_CONST(0.7617187500), COEF_CONST(0.7578125000),
COEF_CONST(0.7539062500), COEF_CONST(0.7500000000),
COEF_CONST(0.7421875000), COEF_CONST(0.7382812500),
COEF_CONST(0.7343750000), COEF_CONST(0.7304687500),
COEF_CONST(0.7265625000), COEF_CONST(0.7226562500),
COEF_CONST(0.7187500000), COEF_CONST(0.7148437500),
COEF_CONST(0.7109375000), COEF_CONST(0.7070312500),
COEF_CONST(0.6992187500), COEF_CONST(0.6953125000),
COEF_CONST(0.6914062500), COEF_CONST(0.6875000000),
COEF_CONST(0.6835937500), COEF_CONST(0.6796875000),
COEF_CONST(0.6796875000), COEF_CONST(0.6757812500),
COEF_CONST(0.6718750000), COEF_CONST(0.6679687500),
COEF_CONST(0.6640625000), COEF_CONST(0.6601562500),
COEF_CONST(0.6562500000), COEF_CONST(0.6523437500),
COEF_CONST(0.6484375000), COEF_CONST(0.6445312500),
COEF_CONST(0.6406250000), COEF_CONST(0.6406250000),
COEF_CONST(0.6367187500), COEF_CONST(0.6328125000),
COEF_CONST(0.6289062500), COEF_CONST(0.6250000000),
COEF_CONST(0.6210937500), COEF_CONST(0.6210937500),
COEF_CONST(0.6171875000), COEF_CONST(0.6132812500),
COEF_CONST(0.6093750000), COEF_CONST(0.6054687500),
COEF_CONST(0.6054687500), COEF_CONST(0.6015625000),
COEF_CONST(0.5976562500), COEF_CONST(0.5937500000),
COEF_CONST(0.5937500000), COEF_CONST(0.5898437500),
COEF_CONST(0.5859375000), COEF_CONST(0.5820312500),
COEF_CONST(0.5820312500), COEF_CONST(0.5781250000),
COEF_CONST(0.5742187500), COEF_CONST(0.5742187500),
COEF_CONST(0.5703125000), COEF_CONST(0.5664062500),
COEF_CONST(0.5664062500), COEF_CONST(0.5625000000),
COEF_CONST(0.5585937500), COEF_CONST(0.5585937500),
COEF_CONST(0.5546875000), COEF_CONST(0.5507812500),
COEF_CONST(0.5507812500), COEF_CONST(0.5468750000),
COEF_CONST(0.5429687500), COEF_CONST(0.5429687500),
COEF_CONST(0.5390625000), COEF_CONST(0.5390625000),
COEF_CONST(0.5351562500), COEF_CONST(0.5312500000),
COEF_CONST(0.5312500000), COEF_CONST(0.5273437500),
COEF_CONST(0.5273437500), COEF_CONST(0.5234375000),
COEF_CONST(0.5195312500), COEF_CONST(0.5195312500),
COEF_CONST(0.5156250000), COEF_CONST(0.5156250000),
COEF_CONST(0.5117187500), COEF_CONST(0.5117187500),
COEF_CONST(0.5078125000), COEF_CONST(0.5078125000),
COEF_CONST(0.5039062500), COEF_CONST(0.5039062500),
COEF_CONST(0.5000000000), COEF_CONST(0.4980468750),
COEF_CONST(0.4960937500), COEF_CONST(0.4941406250),
COEF_CONST(0.4921875000), COEF_CONST(0.4902343750),
COEF_CONST(0.4882812500), COEF_CONST(0.4863281250),
COEF_CONST(0.4843750000), COEF_CONST(0.4824218750),
COEF_CONST(0.4804687500), COEF_CONST(0.4785156250)
};
ALIGN static const real_t exp_table[128] = {
COEF_CONST(0.50000000000000000000000000000000000000000000000000),
COEF_CONST(0.25000000000000000000000000000000000000000000000000),
COEF_CONST(0.12500000000000000000000000000000000000000000000000),
COEF_CONST(0.06250000000000000000000000000000000000000000000000),
COEF_CONST(0.03125000000000000000000000000000000000000000000000),
COEF_CONST(0.01562500000000000000000000000000000000000000000000),
COEF_CONST(0.00781250000000000000000000000000000000000000000000),
COEF_CONST(0.00390625000000000000000000000000000000000000000000),
COEF_CONST(0.00195312500000000000000000000000000000000000000000),
COEF_CONST(0.00097656250000000000000000000000000000000000000000),
COEF_CONST(0.00048828125000000000000000000000000000000000000000),
COEF_CONST(0.00024414062500000000000000000000000000000000000000),
COEF_CONST(0.00012207031250000000000000000000000000000000000000),
COEF_CONST(0.00006103515625000000000000000000000000000000000000),
COEF_CONST(0.00003051757812500000000000000000000000000000000000),
COEF_CONST(0.00001525878906250000000000000000000000000000000000),
COEF_CONST(0.00000762939453125000000000000000000000000000000000),
COEF_CONST(0.00000381469726562500000000000000000000000000000000),
COEF_CONST(0.00000190734863281250000000000000000000000000000000),
COEF_CONST(0.00000095367431640625000000000000000000000000000000),
COEF_CONST(0.00000047683715820312500000000000000000000000000000),
COEF_CONST(0.00000023841857910156250000000000000000000000000000),
COEF_CONST(0.00000011920928955078125000000000000000000000000000),
COEF_CONST(0.00000005960464477539062500000000000000000000000000),
COEF_CONST(0.00000002980232238769531300000000000000000000000000),
COEF_CONST(0.00000001490116119384765600000000000000000000000000),
COEF_CONST(0.00000000745058059692382810000000000000000000000000),
COEF_CONST(0.00000000372529029846191410000000000000000000000000),
COEF_CONST(0.00000000186264514923095700000000000000000000000000),
COEF_CONST(0.00000000093132257461547852000000000000000000000000),
COEF_CONST(0.00000000046566128730773926000000000000000000000000),
COEF_CONST(0.00000000023283064365386963000000000000000000000000),
COEF_CONST(0.00000000011641532182693481000000000000000000000000),
COEF_CONST(0.00000000005820766091346740700000000000000000000000),
COEF_CONST(0.00000000002910383045673370400000000000000000000000),
COEF_CONST(0.00000000001455191522836685200000000000000000000000),
COEF_CONST(0.00000000000727595761418342590000000000000000000000),
COEF_CONST(0.00000000000363797880709171300000000000000000000000),
COEF_CONST(0.00000000000181898940354585650000000000000000000000),
COEF_CONST(0.00000000000090949470177292824000000000000000000000),
COEF_CONST(0.00000000000045474735088646412000000000000000000000),
COEF_CONST(0.00000000000022737367544323206000000000000000000000),
COEF_CONST(0.00000000000011368683772161603000000000000000000000),
COEF_CONST(0.00000000000005684341886080801500000000000000000000),
COEF_CONST(0.00000000000002842170943040400700000000000000000000),
COEF_CONST(0.00000000000001421085471520200400000000000000000000),
COEF_CONST(0.00000000000000710542735760100190000000000000000000),
COEF_CONST(0.00000000000000355271367880050090000000000000000000),
COEF_CONST(0.00000000000000177635683940025050000000000000000000),
COEF_CONST(0.00000000000000088817841970012523000000000000000000),
COEF_CONST(0.00000000000000044408920985006262000000000000000000),
COEF_CONST(0.00000000000000022204460492503131000000000000000000),
COEF_CONST(0.00000000000000011102230246251565000000000000000000),
COEF_CONST(0.00000000000000005551115123125782700000000000000000),
COEF_CONST(0.00000000000000002775557561562891400000000000000000),
COEF_CONST(0.00000000000000001387778780781445700000000000000000),
COEF_CONST(0.00000000000000000693889390390722840000000000000000),
COEF_CONST(0.00000000000000000346944695195361420000000000000000),
COEF_CONST(0.00000000000000000173472347597680710000000000000000),
COEF_CONST(0.00000000000000000086736173798840355000000000000000),
COEF_CONST(0.00000000000000000043368086899420177000000000000000),
COEF_CONST(0.00000000000000000021684043449710089000000000000000),
COEF_CONST(0.00000000000000000010842021724855044000000000000000),
COEF_CONST(0.00000000000000000005421010862427522200000000000000),
COEF_CONST(0.00000000000000000002710505431213761100000000000000),
COEF_CONST(0.00000000000000000001355252715606880500000000000000),
COEF_CONST(0.00000000000000000000677626357803440270000000000000),
COEF_CONST(0.00000000000000000000338813178901720140000000000000),
COEF_CONST(0.00000000000000000000169406589450860070000000000000),
COEF_CONST(0.00000000000000000000084703294725430034000000000000),
COEF_CONST(0.00000000000000000000042351647362715017000000000000),
COEF_CONST(0.00000000000000000000021175823681357508000000000000),
COEF_CONST(0.00000000000000000000010587911840678754000000000000),
COEF_CONST(0.00000000000000000000005293955920339377100000000000),
COEF_CONST(0.00000000000000000000002646977960169688600000000000),
COEF_CONST(0.00000000000000000000001323488980084844300000000000),
COEF_CONST(0.00000000000000000000000661744490042422140000000000),
COEF_CONST(0.00000000000000000000000330872245021211070000000000),
COEF_CONST(0.00000000000000000000000165436122510605530000000000),
COEF_CONST(0.00000000000000000000000082718061255302767000000000),
COEF_CONST(0.00000000000000000000000041359030627651384000000000),
COEF_CONST(0.00000000000000000000000020679515313825692000000000),
COEF_CONST(0.00000000000000000000000010339757656912846000000000),
COEF_CONST(0.00000000000000000000000005169878828456423000000000),
COEF_CONST(0.00000000000000000000000002584939414228211500000000),
COEF_CONST(0.00000000000000000000000001292469707114105700000000),
COEF_CONST(0.00000000000000000000000000646234853557052870000000),
COEF_CONST(0.00000000000000000000000000323117426778526440000000),
COEF_CONST(0.00000000000000000000000000161558713389263220000000),
COEF_CONST(0.00000000000000000000000000080779356694631609000000),
COEF_CONST(0.00000000000000000000000000040389678347315804000000),
COEF_CONST(0.00000000000000000000000000020194839173657902000000),
COEF_CONST(0.00000000000000000000000000010097419586828951000000),
COEF_CONST(0.00000000000000000000000000005048709793414475600000),
COEF_CONST(0.00000000000000000000000000002524354896707237800000),
COEF_CONST(0.00000000000000000000000000001262177448353618900000),
COEF_CONST(0.00000000000000000000000000000631088724176809440000),
COEF_CONST(0.00000000000000000000000000000315544362088404720000),
COEF_CONST(0.00000000000000000000000000000157772181044202360000),
COEF_CONST(0.00000000000000000000000000000078886090522101181000),
COEF_CONST(0.00000000000000000000000000000039443045261050590000),
COEF_CONST(0.00000000000000000000000000000019721522630525295000),
COEF_CONST(0.00000000000000000000000000000009860761315262647600),
COEF_CONST(0.00000000000000000000000000000004930380657631323800),
COEF_CONST(0.00000000000000000000000000000002465190328815661900),
COEF_CONST(0.00000000000000000000000000000001232595164407830900),
COEF_CONST(0.00000000000000000000000000000000616297582203915470),
COEF_CONST(0.00000000000000000000000000000000308148791101957740),
COEF_CONST(0.00000000000000000000000000000000154074395550978870),
COEF_CONST(0.00000000000000000000000000000000077037197775489434),
COEF_CONST(0.00000000000000000000000000000000038518598887744717),
COEF_CONST(0.00000000000000000000000000000000019259299443872359),
COEF_CONST(0.00000000000000000000000000000000009629649721936179),
COEF_CONST(0.00000000000000000000000000000000004814824860968090),
COEF_CONST(0.00000000000000000000000000000000002407412430484045),
COEF_CONST(0.00000000000000000000000000000000001203706215242022),
COEF_CONST(0.00000000000000000000000000000000000601853107621011),
COEF_CONST(0.00000000000000000000000000000000000300926553810506),
COEF_CONST(0.00000000000000000000000000000000000150463276905253),
COEF_CONST(0.00000000000000000000000000000000000075231638452626),
COEF_CONST(0.00000000000000000000000000000000000037615819226313),
COEF_CONST(0.00000000000000000000000000000000000018807909613157),
COEF_CONST(0.00000000000000000000000000000000000009403954806578),
COEF_CONST(0.00000000000000000000000000000000000004701977403289),
COEF_CONST(0.00000000000000000000000000000000000002350988701645),
COEF_CONST(0.00000000000000000000000000000000000001175494350822),
COEF_CONST(0.0 /* 0000000000000000000000000000000000000587747175411 "floating point underflow" */),
COEF_CONST(0.0)
};
#ifdef __cplusplus
}
#endif
#endif
#endif

25741
src/contrib/aacdecoder/libfaad/iq_table.h Normal file → Executable file

File diff suppressed because it is too large Load Diff

213
src/contrib/aacdecoder/libfaad/is.c Normal file → Executable file
View File

@ -1,104 +1,109 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: is.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#include "syntax.h"
#include "is.h"
#ifdef FIXED_POINT
static real_t pow05_table[] = {
COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */
COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */
COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */
COEF_CONST(1.0), /* 0.5^( 0/4) */
COEF_CONST(0.84089641525371), /* 0.5^(+1/4) */
COEF_CONST(0.70710678118655), /* 0.5^(+2/4) */
COEF_CONST(0.59460355750136) /* 0.5^(+3/4) */
};
#endif
void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len)
{
uint8_t g, sfb, b;
uint16_t i;
#ifndef FIXED_POINT
real_t scale;
#else
int32_t exp, frac;
#endif
uint16_t nshort = frame_len/8;
uint8_t group = 0;
for (g = 0; g < icsr->num_window_groups; g++)
{
/* Do intensity stereo decoding */
for (b = 0; b < icsr->window_group_length[g]; b++)
{
for (sfb = 0; sfb < icsr->max_sfb; sfb++)
{
if (is_intensity(icsr, g, sfb))
{
/* For scalefactor bands coded in intensity stereo the
corresponding predictors in the right channel are
switched to "off".
*/
ics->pred.prediction_used[sfb] = 0;
icsr->pred.prediction_used[sfb] = 0;
#ifndef FIXED_POINT
scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb]));
#else
exp = icsr->scale_factors[g][sfb] >> 2;
frac = icsr->scale_factors[g][sfb] & 3;
#endif
/* Scale from left to right channel,
do not touch left channel */
for (i = icsr->swb_offset[sfb]; i < icsr->swb_offset[sfb+1]; i++)
{
#ifndef FIXED_POINT
r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale);
#else
if (exp < 0)
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp;
else
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp;
r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]);
#endif
if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i];
}
}
}
group++;
}
}
}
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: is.c,v 1.28 2007/11/01 12:33:31 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include "syntax.h"
#include "is.h"
#ifdef FIXED_POINT
static real_t pow05_table[] = {
COEF_CONST(1.68179283050743), /* 0.5^(-3/4) */
COEF_CONST(1.41421356237310), /* 0.5^(-2/4) */
COEF_CONST(1.18920711500272), /* 0.5^(-1/4) */
COEF_CONST(1.0), /* 0.5^( 0/4) */
COEF_CONST(0.84089641525371), /* 0.5^(+1/4) */
COEF_CONST(0.70710678118655), /* 0.5^(+2/4) */
COEF_CONST(0.59460355750136) /* 0.5^(+3/4) */
};
#endif
void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len)
{
uint8_t g, sfb, b;
uint16_t i;
#ifndef FIXED_POINT
real_t scale;
#else
int32_t exp, frac;
#endif
uint16_t nshort = frame_len/8;
uint8_t group = 0;
for (g = 0; g < icsr->num_window_groups; g++)
{
/* Do intensity stereo decoding */
for (b = 0; b < icsr->window_group_length[g]; b++)
{
for (sfb = 0; sfb < icsr->max_sfb; sfb++)
{
if (is_intensity(icsr, g, sfb))
{
#ifdef MAIN_DEC
/* For scalefactor bands coded in intensity stereo the
corresponding predictors in the right channel are
switched to "off".
*/
ics->pred.prediction_used[sfb] = 0;
icsr->pred.prediction_used[sfb] = 0;
#endif
#ifndef FIXED_POINT
scale = (real_t)pow(0.5, (0.25*icsr->scale_factors[g][sfb]));
#else
exp = icsr->scale_factors[g][sfb] >> 2;
frac = icsr->scale_factors[g][sfb] & 3;
#endif
/* Scale from left to right channel,
do not touch left channel */
for (i = icsr->swb_offset[sfb]; i < min(icsr->swb_offset[sfb+1], ics->swb_offset_max); i++)
{
#ifndef FIXED_POINT
r_spec[(group*nshort)+i] = MUL_R(l_spec[(group*nshort)+i], scale);
#else
if (exp < 0)
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] << -exp;
else
r_spec[(group*nshort)+i] = l_spec[(group*nshort)+i] >> exp;
r_spec[(group*nshort)+i] = MUL_C(r_spec[(group*nshort)+i], pow05_table[frac + 3]);
#endif
if (is_intensity(icsr, g, sfb) != invert_intensity(ics, g, sfb))
r_spec[(group*nshort)+i] = -r_spec[(group*nshort)+i];
}
}
}
group++;
}
}
}

131
src/contrib/aacdecoder/libfaad/is.h Normal file → Executable file
View File

@ -1,64 +1,67 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: is.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __IS_H__
#define __IS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "syntax.h"
void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len);
static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
{
switch (ics->sfb_cb[group][sfb])
{
case INTENSITY_HCB:
return 1;
case INTENSITY_HCB2:
return -1;
default:
return 0;
}
}
static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
{
if (ics->ms_mask_present == 1)
return (1-2*ics->ms_used[group][sfb]);
return 1;
}
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: is.h,v 1.20 2007/11/01 12:33:31 menno Exp $
**/
#ifndef __IS_H__
#define __IS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "syntax.h"
void is_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len);
static INLINE int8_t is_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
{
switch (ics->sfb_cb[group][sfb])
{
case INTENSITY_HCB:
return 1;
case INTENSITY_HCB2:
return -1;
default:
return 0;
}
}
static INLINE int8_t invert_intensity(ic_stream *ics, uint8_t group, uint8_t sfb)
{
if (ics->ms_mask_present == 1)
return (1-2*ics->ms_used[group][sfb]);
return 1;
}
#ifdef __cplusplus
}
#endif
#endif

4591
src/contrib/aacdecoder/libfaad/kbd_win.h Normal file → Executable file

File diff suppressed because it is too large Load Diff

430
src/contrib/aacdecoder/libfaad/lt_predict.c Normal file → Executable file
View File

@ -1,215 +1,215 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: lt_predict.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef LTP_DEC
#include <stdlib.h>
#include "syntax.h"
#include "lt_predict.h"
#include "filtbank.h"
#include "tns.h"
/* static function declarations */
static int16_t real_to_int16(real_t sig_in);
/* check if the object type is an object type that can have LTP */
uint8_t is_ltp_ot(uint8_t object_type)
{
#ifdef LTP_DEC
if ((object_type == LTP)
#ifdef ERROR_RESILIENCE
|| (object_type == ER_LTP)
#endif
#ifdef LD_DEC
|| (object_type == LD)
#endif
#ifdef SCALABLE_DEC
|| (object_type == 6) /* TODO */
#endif
)
{
return 1;
}
#endif
return 0;
}
ALIGN static const real_t codebook[8] =
{
REAL_CONST(0.570829),
REAL_CONST(0.696616),
REAL_CONST(0.813004),
REAL_CONST(0.911304),
REAL_CONST(0.984900),
REAL_CONST(1.067894),
REAL_CONST(1.194601),
REAL_CONST(1.369533)
};
void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape,
uint8_t win_shape_prev, uint8_t sr_index,
uint8_t object_type, uint16_t frame_len)
{
uint8_t sfb;
uint16_t bin, i, num_samples;
ALIGN real_t x_est[2048];
ALIGN real_t X_est[2048];
if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
{
if (ltp->data_present)
{
num_samples = frame_len << 1;
for(i = 0; i < num_samples; i++)
{
/* The extra lookback M (N/2 for LD, 0 for LTP) is handled
in the buffer updating */
#if 0
x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag],
codebook[ltp->coef]);
#else
/* lt_pred_stat is a 16 bit int, multiplied with the fixed point real
this gives a real for x_est
*/
x_est[i] = (real_t)lt_pred_stat[num_samples + i - ltp->lag] * codebook[ltp->coef];
#endif
}
filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev,
x_est, X_est, object_type, frame_len);
tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est,
frame_len);
for (sfb = 0; sfb < ltp->last_band; sfb++)
{
if (ltp->long_used[sfb])
{
uint16_t low = ics->swb_offset[sfb];
uint16_t high = ics->swb_offset[sfb+1];
for (bin = low; bin < high; bin++)
{
spec[bin] += X_est[bin];
}
}
}
}
}
}
#ifdef FIXED_POINT
static INLINE int16_t real_to_int16(real_t sig_in)
{
if (sig_in >= 0)
{
sig_in += (1 << (REAL_BITS-1));
if (sig_in >= REAL_CONST(32768))
return 32767;
} else {
sig_in += -(1 << (REAL_BITS-1));
if (sig_in <= REAL_CONST(-32768))
return -32768;
}
return (sig_in >> REAL_BITS);
}
#else
static INLINE int16_t real_to_int16(real_t sig_in)
{
if (sig_in >= 0)
{
#ifndef HAS_LRINTF
sig_in += 0.5f;
#endif
if (sig_in >= 32768.0f)
return 32767;
} else {
#ifndef HAS_LRINTF
sig_in += -0.5f;
#endif
if (sig_in <= -32768.0f)
return -32768;
}
return lrintf(sig_in);
}
#endif
void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap,
uint16_t frame_len, uint8_t object_type)
{
uint16_t i;
/*
* The reference point for index i and the content of the buffer
* lt_pred_stat are arranged so that lt_pred_stat(0 ... N/2 - 1) contains the
* last aliased half window from the IMDCT, and lt_pred_stat(N/2 ... N-1)
* is always all zeros. The rest of lt_pred_stat (i<0) contains the previous
* fully reconstructed time domain samples, i.e., output of the decoder.
*
* These values are shifted up by N*2 to avoid (i<0)
*
* For the LD object type an extra 512 samples lookback is accomodated here.
*/
#ifdef LD_DEC
if (object_type == LD)
{
for (i = 0; i < frame_len; i++)
{
lt_pred_stat[i] /* extra 512 */ = lt_pred_stat[i + frame_len];
lt_pred_stat[frame_len + i] = lt_pred_stat[i + (frame_len * 2)];
lt_pred_stat[(frame_len * 2) + i] = real_to_int16(time[i]);
lt_pred_stat[(frame_len * 3) + i] = real_to_int16(overlap[i]);
}
} else {
#endif
for (i = 0; i < frame_len; i++)
{
lt_pred_stat[i] = lt_pred_stat[i + frame_len];
lt_pred_stat[frame_len + i] = real_to_int16(time[i]);
lt_pred_stat[(frame_len * 2) + i] = real_to_int16(overlap[i]);
#if 0 /* set to zero once upon initialisation */
lt_pred_stat[(frame_len * 3) + i] = 0;
#endif
}
#ifdef LD_DEC
}
#endif
}
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: lt_predict.c,v 1.27 2007/11/01 12:33:31 menno Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef LTP_DEC
#include <stdlib.h>
#include "syntax.h"
#include "lt_predict.h"
#include "filtbank.h"
#include "tns.h"
/* static function declarations */
static int16_t real_to_int16(real_t sig_in);
/* check if the object type is an object type that can have LTP */
uint8_t is_ltp_ot(uint8_t object_type)
{
#ifdef LTP_DEC
if ((object_type == LTP)
#ifdef ERROR_RESILIENCE
|| (object_type == ER_LTP)
#endif
#ifdef LD_DEC
|| (object_type == LD)
#endif
)
{
return 1;
}
#endif
return 0;
}
ALIGN static const real_t codebook[8] =
{
REAL_CONST(0.570829),
REAL_CONST(0.696616),
REAL_CONST(0.813004),
REAL_CONST(0.911304),
REAL_CONST(0.984900),
REAL_CONST(1.067894),
REAL_CONST(1.194601),
REAL_CONST(1.369533)
};
void lt_prediction(ic_stream *ics, ltp_info *ltp, real_t *spec,
int16_t *lt_pred_stat, fb_info *fb, uint8_t win_shape,
uint8_t win_shape_prev, uint8_t sr_index,
uint8_t object_type, uint16_t frame_len)
{
uint8_t sfb;
uint16_t bin, i, num_samples;
ALIGN real_t x_est[2048];
ALIGN real_t X_est[2048];
if (ics->window_sequence != EIGHT_SHORT_SEQUENCE)
{
if (ltp->data_present)
{
num_samples = frame_len << 1;
for(i = 0; i < num_samples; i++)
{
/* The extra lookback M (N/2 for LD, 0 for LTP) is handled
in the buffer updating */
#if 0
x_est[i] = MUL_R_C(lt_pred_stat[num_samples + i - ltp->lag],
codebook[ltp->coef]);
#else
/* lt_pred_stat is a 16 bit int, multiplied with the fixed point real
this gives a real for x_est
*/
x_est[i] = (real_t)lt_pred_stat[num_samples + i - ltp->lag] * codebook[ltp->coef];
#endif
}
filter_bank_ltp(fb, ics->window_sequence, win_shape, win_shape_prev,
x_est, X_est, object_type, frame_len);
tns_encode_frame(ics, &(ics->tns), sr_index, object_type, X_est,
frame_len);
for (sfb = 0; sfb < ltp->last_band; sfb++)
{
if (ltp->long_used[sfb])
{
uint16_t low = ics->swb_offset[sfb];
uint16_t high = min(ics->swb_offset[sfb+1], ics->swb_offset_max);
for (bin = low; bin < high; bin++)
{
spec[bin] += X_est[bin];
}
}
}
}
}
}
#ifdef FIXED_POINT
static INLINE int16_t real_to_int16(real_t sig_in)
{
if (sig_in >= 0)
{
sig_in += (1 << (REAL_BITS-1));
if (sig_in >= REAL_CONST(32768))
return 32767;
} else {
sig_in += -(1 << (REAL_BITS-1));
if (sig_in <= REAL_CONST(-32768))
return -32768;
}
return (sig_in >> REAL_BITS);
}
#else
static INLINE int16_t real_to_int16(real_t sig_in)
{
if (sig_in >= 0)
{
#ifndef HAS_LRINTF
sig_in += 0.5f;
#endif
if (sig_in >= 32768.0f)
return 32767;
} else {
#ifndef HAS_LRINTF
sig_in += -0.5f;
#endif
if (sig_in <= -32768.0f)
return -32768;
}
return lrintf(sig_in);
}
#endif
void lt_update_state(int16_t *lt_pred_stat, real_t *time, real_t *overlap,
uint16_t frame_len, uint8_t object_type)
{
uint16_t i;
/*
* The reference point for index i and the content of the buffer
* lt_pred_stat are arranged so that lt_pred_stat(0 ... N/2 - 1) contains the
* last aliased half window from the IMDCT, and lt_pred_stat(N/2 ... N-1)
* is always all zeros. The rest of lt_pred_stat (i<0) contains the previous
* fully reconstructed time domain samples, i.e., output of the decoder.
*
* These values are shifted up by N*2 to avoid (i<0)
*
* For the LD object type an extra 512 samples lookback is accomodated here.
*/
#ifdef LD_DEC
if (object_type == LD)
{
for (i = 0; i < frame_len; i++)
{
lt_pred_stat[i] /* extra 512 */ = lt_pred_stat[i + frame_len];
lt_pred_stat[frame_len + i] = lt_pred_stat[i + (frame_len * 2)];
lt_pred_stat[(frame_len * 2) + i] = real_to_int16(time[i]);
lt_pred_stat[(frame_len * 3) + i] = real_to_int16(overlap[i]);
}
} else {
#endif
for (i = 0; i < frame_len; i++)
{
lt_pred_stat[i] = lt_pred_stat[i + frame_len];
lt_pred_stat[frame_len + i] = real_to_int16(time[i]);
lt_pred_stat[(frame_len * 2) + i] = real_to_int16(overlap[i]);
#if 0 /* set to zero once upon initialisation */
lt_pred_stat[(frame_len * 3) + i] = 0;
#endif
}
#ifdef LD_DEC
}
#endif
}
#endif

129
src/contrib/aacdecoder/libfaad/lt_predict.h Normal file → Executable file
View File

@ -1,63 +1,66 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: lt_predict.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifdef LTP_DEC
#ifndef __LT_PREDICT_H__
#define __LT_PREDICT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "filtbank.h"
uint8_t is_ltp_ot(uint8_t object_type);
void lt_prediction(ic_stream *ics,
ltp_info *ltp,
real_t *spec,
int16_t *lt_pred_stat,
fb_info *fb,
uint8_t win_shape,
uint8_t win_shape_prev,
uint8_t sr_index,
uint8_t object_type,
uint16_t frame_len);
void lt_update_state(int16_t *lt_pred_stat,
real_t *time,
real_t *overlap,
uint16_t frame_len,
uint8_t object_type);
#ifdef __cplusplus
}
#endif
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: lt_predict.h,v 1.20 2007/11/01 12:33:31 menno Exp $
**/
#ifdef LTP_DEC
#ifndef __LT_PREDICT_H__
#define __LT_PREDICT_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "filtbank.h"
uint8_t is_ltp_ot(uint8_t object_type);
void lt_prediction(ic_stream *ics,
ltp_info *ltp,
real_t *spec,
int16_t *lt_pred_stat,
fb_info *fb,
uint8_t win_shape,
uint8_t win_shape_prev,
uint8_t sr_index,
uint8_t object_type,
uint16_t frame_len);
void lt_update_state(int16_t *lt_pred_stat,
real_t *time,
real_t *overlap,
uint16_t frame_len,
uint8_t object_type);
#ifdef __cplusplus
}
#endif
#endif
#endif

819
src/contrib/aacdecoder/libfaad/mdct.c Normal file → Executable file
View File

@ -1,518 +1,301 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mdct.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
/*
* Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform)
* and consists of three steps: pre-(I)FFT complex multiplication, complex
* (I)FFT, post-(I)FFT complex multiplication,
*
* As described in:
* P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the
* Implementation of Filter Banks Based on 'Time Domain Aliasing
* Cancellation," IEEE Proc. on ICASSP91, 1991, pp. 2209-2212.
*
*
* As of April 6th 2002 completely rewritten.
* This (I)MDCT can now be used for any data size n, where n is divisible by 8.
*
*/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#ifdef _WIN32_WCE
#define assert(x)
#else
#include <assert.h>
#endif
#include "cfft.h"
#include "mdct.h"
/* const_tab[]:
0: sqrt(2 / N)
1: cos(2 * PI / N)
2: sin(2 * PI / N)
3: cos(2 * PI * (1/8) / N)
4: sin(2 * PI * (1/8) / N)
*/
#ifdef FIXED_POINT
real_t const_tab[][5] =
{
{ /* 2048 */
COEF_CONST(1),
FRAC_CONST(0.99999529380957619),
FRAC_CONST(0.0030679567629659761),
FRAC_CONST(0.99999992646571789),
FRAC_CONST(0.00038349518757139556)
}, { /* 1920 */
COEF_CONST(/* sqrt(1024/960) */ 1.0327955589886444),
FRAC_CONST(0.99999464540169647),
FRAC_CONST(0.0032724865065266251),
FRAC_CONST(0.99999991633432805),
FRAC_CONST(0.00040906153202803459)
}, { /* 1024 */
COEF_CONST(1),
FRAC_CONST(0.99998117528260111),
FRAC_CONST(0.0061358846491544753),
FRAC_CONST(0.99999970586288223),
FRAC_CONST(0.00076699031874270449)
}, { /* 960 */
COEF_CONST(/* sqrt(512/480) */ 1.0327955589886444),
FRAC_CONST(0.99997858166412923),
FRAC_CONST(0.0065449379673518581),
FRAC_CONST(0.99999966533732598),
FRAC_CONST(0.00081812299560725323)
}, { /* 256 */
COEF_CONST(1),
FRAC_CONST(0.99969881869620425),
FRAC_CONST(0.024541228522912288),
FRAC_CONST(0.99999529380957619),
FRAC_CONST(0.0030679567629659761)
}, { /* 240 */
COEF_CONST(/* sqrt(256/240) */ 1.0327955589886444),
FRAC_CONST(0.99965732497555726),
FRAC_CONST(0.026176948307873149),
FRAC_CONST(0.99999464540169647),
FRAC_CONST(0.0032724865065266251)
}
#ifdef SSR_DEC
,{ /* 512 */
COEF_CONST(1),
FRAC_CONST(0.9999247018391445),
FRAC_CONST(0.012271538285719925),
FRAC_CONST(0.99999882345170188),
FRAC_CONST(0.0015339801862847655)
}, { /* 64 */
COEF_CONST(1),
FRAC_CONST(0.99518472667219693),
FRAC_CONST(0.098017140329560604),
FRAC_CONST(0.9999247018391445),
FRAC_CONST(0.012271538285719925)
}
#endif
};
#endif
#ifdef FIXED_POINT
static uint8_t map_N_to_idx(uint16_t N)
{
/* gives an index into const_tab above */
/* for normal AAC deocding (eg. no scalable profile) only */
/* index 0 and 4 will be used */
switch(N)
{
case 2048: return 0;
case 1920: return 1;
case 1024: return 2;
case 960: return 3;
case 256: return 4;
case 240: return 5;
#ifdef SSR_DEC
case 512: return 6;
case 64: return 7;
#endif
}
return 0;
}
#endif
mdct_info *faad_mdct_init(uint16_t N)
{
uint16_t k;
#ifdef FIXED_POINT
uint16_t N_idx;
real_t cangle, sangle, c, s, cold;
#endif
real_t scale;
mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info));
assert(N % 8 == 0);
mdct->N = N;
mdct->sincos = (complex_t*)faad_malloc(N/4*sizeof(complex_t));
#ifdef FIXED_POINT
N_idx = map_N_to_idx(N);
scale = const_tab[N_idx][0];
cangle = const_tab[N_idx][1];
sangle = const_tab[N_idx][2];
c = const_tab[N_idx][3];
s = const_tab[N_idx][4];
#else
scale = (real_t)sqrt(2.0 / (real_t)N);
#endif
/* (co)sine table build using recurrence relations */
/* this can also be done using static table lookup or */
/* some form of interpolation */
for (k = 0; k < N/4; k++)
{
#ifdef FIXED_POINT
RE(mdct->sincos[k]) = c; //MUL_C_C(c,scale);
IM(mdct->sincos[k]) = s; //MUL_C_C(s,scale);
cold = c;
c = MUL_F(c,cangle) - MUL_F(s,sangle);
s = MUL_F(s,cangle) + MUL_F(cold,sangle);
#else
/* no recurrence, just sines */
RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N));
#endif
}
/* initialise fft */
mdct->cfft = cffti(N/4);
#ifdef PROFILE
mdct->cycles = 0;
mdct->fft_cycles = 0;
#endif
return mdct;
}
void faad_mdct_end(mdct_info *mdct)
{
if (mdct != NULL)
{
#ifdef PROFILE
printf("MDCT[%.4d]: %I64d cycles\n", mdct->N, mdct->cycles);
printf("CFFT[%.4d]: %I64d cycles\n", mdct->N/4, mdct->fft_cycles);
#endif
cfftu(mdct->cfft);
if (mdct->sincos) faad_free(mdct->sincos);
faad_free(mdct);
}
}
void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
{
uint16_t k;
complex_t x;
ALIGN complex_t Z1[512];
complex_t *sincos = mdct->sincos;
uint16_t N = mdct->N;
uint16_t N2 = N >> 1;
uint16_t N4 = N >> 2;
uint16_t N8 = N >> 3;
#ifdef PROFILE
int64_t count1, count2 = faad_get_ts();
#endif
/* pre-IFFT complex multiplication */
for (k = 0; k < N4; k++)
{
ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k]));
}
#ifdef PROFILE
count1 = faad_get_ts();
#endif
/* complex IFFT, any non-scaling FFT can be used here */
cfftb(mdct->cfft, Z1);
#ifdef PROFILE
count1 = faad_get_ts() - count1;
#endif
/* post-IFFT complex multiplication */
for (k = 0; k < N4; k++)
{
RE(x) = RE(Z1[k]);
IM(x) = IM(Z1[k]);
ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
}
/* reordering */
for (k = 0; k < N8; k+=2)
{
X_out[ 2*k] = IM(Z1[N8 + k]);
X_out[ 2 + 2*k] = IM(Z1[N8 + 1 + k]);
X_out[ 1 + 2*k] = -RE(Z1[N8 - 1 - k]);
X_out[ 3 + 2*k] = -RE(Z1[N8 - 2 - k]);
X_out[N4 + 2*k] = RE(Z1[ k]);
X_out[N4 + + 2 + 2*k] = RE(Z1[ 1 + k]);
X_out[N4 + 1 + 2*k] = -IM(Z1[N4 - 1 - k]);
X_out[N4 + 3 + 2*k] = -IM(Z1[N4 - 2 - k]);
X_out[N2 + 2*k] = RE(Z1[N8 + k]);
X_out[N2 + + 2 + 2*k] = RE(Z1[N8 + 1 + k]);
X_out[N2 + 1 + 2*k] = -IM(Z1[N8 - 1 - k]);
X_out[N2 + 3 + 2*k] = -IM(Z1[N8 - 2 - k]);
X_out[N2 + N4 + 2*k] = -IM(Z1[ k]);
X_out[N2 + N4 + 2 + 2*k] = -IM(Z1[ 1 + k]);
X_out[N2 + N4 + 1 + 2*k] = RE(Z1[N4 - 1 - k]);
X_out[N2 + N4 + 3 + 2*k] = RE(Z1[N4 - 2 - k]);
}
#ifdef PROFILE
count2 = faad_get_ts() - count2;
mdct->fft_cycles += count1;
mdct->cycles += (count2 - count1);
#endif
}
#ifdef USE_SSE
void faad_imdct_sse(mdct_info *mdct, real_t *X_in, real_t *X_out)
{
uint16_t k;
ALIGN complex_t Z1[512];
complex_t *sincos = mdct->sincos;
uint16_t N = mdct->N;
uint16_t N2 = N >> 1;
uint16_t N4 = N >> 2;
uint16_t N8 = N >> 3;
#ifdef PROFILE
int64_t count1, count2 = faad_get_ts();
#endif
/* pre-IFFT complex multiplication */
for (k = 0; k < N4; k+=4)
{
__m128 m12, m13, m14, m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11;
__m128 n12, n13, n14, n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11;
n12 = _mm_load_ps(&X_in[N2 - 2*k - 8]);
m12 = _mm_load_ps(&X_in[N2 - 2*k - 4]);
m13 = _mm_load_ps(&X_in[2*k]);
n13 = _mm_load_ps(&X_in[2*k + 4]);
m1 = _mm_load_ps(&RE(sincos[k]));
n1 = _mm_load_ps(&RE(sincos[k+2]));
m0 = _mm_shuffle_ps(m12, m13, _MM_SHUFFLE(2,0,1,3));
m2 = _mm_shuffle_ps(m1, m1, _MM_SHUFFLE(2,3,0,1));
m14 = _mm_shuffle_ps(m0, m0, _MM_SHUFFLE(3,1,2,0));
n0 = _mm_shuffle_ps(n12, n13, _MM_SHUFFLE(2,0,1,3));
n2 = _mm_shuffle_ps(n1, n1, _MM_SHUFFLE(2,3,0,1));
n14 = _mm_shuffle_ps(n0, n0, _MM_SHUFFLE(3,1,2,0));
m3 = _mm_mul_ps(m14, m1);
n3 = _mm_mul_ps(n14, n1);
m4 = _mm_mul_ps(m14, m2);
n4 = _mm_mul_ps(n14, n2);
m5 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(2,0,2,0));
n5 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(2,0,2,0));
m6 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(3,1,3,1));
n6 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(3,1,3,1));
m7 = _mm_add_ps(m5, m6);
n7 = _mm_add_ps(n5, n6);
m8 = _mm_sub_ps(m5, m6);
n8 = _mm_sub_ps(n5, n6);
m9 = _mm_shuffle_ps(m7, m7, _MM_SHUFFLE(3,2,3,2));
n9 = _mm_shuffle_ps(n7, n7, _MM_SHUFFLE(3,2,3,2));
m10 = _mm_shuffle_ps(m8, m8, _MM_SHUFFLE(1,0,1,0));
n10 = _mm_shuffle_ps(n8, n8, _MM_SHUFFLE(1,0,1,0));
m11 = _mm_unpacklo_ps(m10, m9);
n11 = _mm_unpacklo_ps(n10, n9);
_mm_store_ps(&RE(Z1[k]), m11);
_mm_store_ps(&RE(Z1[k+2]), n11);
}
#ifdef PROFILE
count1 = faad_get_ts();
#endif
/* complex IFFT, any non-scaling FFT can be used here */
cfftb_sse(mdct->cfft, Z1);
#ifdef PROFILE
count1 = faad_get_ts() - count1;
#endif
/* post-IFFT complex multiplication */
for (k = 0; k < N4; k+=4)
{
__m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11;
__m128 n0, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11;
m0 = _mm_load_ps(&RE(Z1[k]));
n0 = _mm_load_ps(&RE(Z1[k+2]));
m1 = _mm_load_ps(&RE(sincos[k]));
n1 = _mm_load_ps(&RE(sincos[k+2]));
m2 = _mm_shuffle_ps(m1, m1, _MM_SHUFFLE(2,3,0,1));
n2 = _mm_shuffle_ps(n1, n1, _MM_SHUFFLE(2,3,0,1));
m3 = _mm_mul_ps(m0, m1);
n3 = _mm_mul_ps(n0, n1);
m4 = _mm_mul_ps(m0, m2);
n4 = _mm_mul_ps(n0, n2);
m5 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(2,0,2,0));
n5 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(2,0,2,0));
m6 = _mm_shuffle_ps(m3, m4, _MM_SHUFFLE(3,1,3,1));
n6 = _mm_shuffle_ps(n3, n4, _MM_SHUFFLE(3,1,3,1));
m7 = _mm_add_ps(m5, m6);
n7 = _mm_add_ps(n5, n6);
m8 = _mm_sub_ps(m5, m6);
n8 = _mm_sub_ps(n5, n6);
m9 = _mm_shuffle_ps(m7, m7, _MM_SHUFFLE(3,2,3,2));
n9 = _mm_shuffle_ps(n7, n7, _MM_SHUFFLE(3,2,3,2));
m10 = _mm_shuffle_ps(m8, m8, _MM_SHUFFLE(1,0,1,0));
n10 = _mm_shuffle_ps(n8, n8, _MM_SHUFFLE(1,0,1,0));
m11 = _mm_unpacklo_ps(m10, m9);
n11 = _mm_unpacklo_ps(n10, n9);
_mm_store_ps(&RE(Z1[k]), m11);
_mm_store_ps(&RE(Z1[k+2]), n11);
}
/* reordering */
for (k = 0; k < N8; k+=2)
{
__m128 m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m13;
__m128 n4, n5, n6, n7, n8, n9;
__m128 neg1 = _mm_set_ps(-1.0, 1.0, -1.0, 1.0);
__m128 neg2 = _mm_set_ps(-1.0, -1.0, -1.0, -1.0);
m0 = _mm_load_ps(&RE(Z1[k]));
m1 = _mm_load_ps(&RE(Z1[N8 - 2 - k]));
m2 = _mm_load_ps(&RE(Z1[N8 + k]));
m3 = _mm_load_ps(&RE(Z1[N4 - 2 - k]));
m10 = _mm_mul_ps(m0, neg1);
m11 = _mm_mul_ps(m1, neg2);
m13 = _mm_mul_ps(m3, neg1);
m5 = _mm_shuffle_ps(m2, m2, _MM_SHUFFLE(3,1,2,0));
n4 = _mm_shuffle_ps(m10, m10, _MM_SHUFFLE(3,1,2,0));
m4 = _mm_shuffle_ps(m11, m11, _MM_SHUFFLE(3,1,2,0));
n5 = _mm_shuffle_ps(m13, m13, _MM_SHUFFLE(3,1,2,0));
m6 = _mm_shuffle_ps(m4, m5, _MM_SHUFFLE(3,2,1,0));
n6 = _mm_shuffle_ps(n4, n5, _MM_SHUFFLE(3,2,1,0));
m7 = _mm_shuffle_ps(m5, m4, _MM_SHUFFLE(3,2,1,0));
n7 = _mm_shuffle_ps(n5, n4, _MM_SHUFFLE(3,2,1,0));
m8 = _mm_shuffle_ps(m6, m6, _MM_SHUFFLE(0,3,1,2));
n8 = _mm_shuffle_ps(n6, n6, _MM_SHUFFLE(2,1,3,0));
m9 = _mm_shuffle_ps(m7, m7, _MM_SHUFFLE(2,1,3,0));
n9 = _mm_shuffle_ps(n7, n7, _MM_SHUFFLE(0,3,1,2));
_mm_store_ps(&X_out[2*k], m8);
_mm_store_ps(&X_out[N4 + 2*k], n8);
_mm_store_ps(&X_out[N2 + 2*k], m9);
_mm_store_ps(&X_out[N2 + N4 + 2*k], n9);
}
#ifdef PROFILE
count2 = faad_get_ts() - count2;
mdct->fft_cycles += count1;
mdct->cycles += (count2 - count1);
#endif
}
#endif
#ifdef LTP_DEC
void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
{
uint16_t k;
complex_t x;
ALIGN complex_t Z1[512];
complex_t *sincos = mdct->sincos;
uint16_t N = mdct->N;
uint16_t N2 = N >> 1;
uint16_t N4 = N >> 2;
uint16_t N8 = N >> 3;
#ifndef FIXED_POINT
real_t scale = REAL_CONST(N);
#else
real_t scale = REAL_CONST(4.0/N);
#endif
/* pre-FFT complex multiplication */
for (k = 0; k < N8; k++)
{
uint16_t n = k << 1;
RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n];
IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n];
ComplexMult(&RE(Z1[k]), &IM(Z1[k]),
RE(x), IM(x), RE(sincos[k]), IM(sincos[k]));
RE(Z1[k]) = MUL_R(RE(Z1[k]), scale);
IM(Z1[k]) = MUL_R(IM(Z1[k]), scale);
RE(x) = X_in[N2 - 1 - n] - X_in[ n];
IM(x) = X_in[N2 + n] + X_in[N - 1 - n];
ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]),
RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8]));
RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale);
IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale);
}
/* complex FFT, any non-scaling FFT can be used here */
cfftf(mdct->cfft, Z1);
/* post-FFT complex multiplication */
for (k = 0; k < N4; k++)
{
uint16_t n = k << 1;
ComplexMult(&RE(x), &IM(x),
RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k]));
X_out[ n] = -RE(x);
X_out[N2 - 1 - n] = IM(x);
X_out[N2 + n] = -IM(x);
X_out[N - 1 - n] = RE(x);
}
}
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: mdct.c,v 1.47 2007/11/01 12:33:31 menno Exp $
**/
/*
* Fast (I)MDCT Implementation using (I)FFT ((Inverse) Fast Fourier Transform)
* and consists of three steps: pre-(I)FFT complex multiplication, complex
* (I)FFT, post-(I)FFT complex multiplication,
*
* As described in:
* P. Duhamel, Y. Mahieux, and J.P. Petit, "A Fast Algorithm for the
* Implementation of Filter Banks Based on 'Time Domain Aliasing
* Cancellation," IEEE Proc. on ICASSP91, 1991, pp. 2209-2212.
*
*
* As of April 6th 2002 completely rewritten.
* This (I)MDCT can now be used for any data size n, where n is divisible by 8.
*
*/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#ifdef _WIN32_WCE
#define assert(x)
#else
#include <assert.h>
#endif
#include "cfft.h"
#include "mdct.h"
#include "mdct_tab.h"
mdct_info *faad_mdct_init(uint16_t N)
{
mdct_info *mdct = (mdct_info*)faad_malloc(sizeof(mdct_info));
assert(N % 8 == 0);
mdct->N = N;
/* NOTE: For "small framelengths" in FIXED_POINT the coefficients need to be
* scaled by sqrt("(nearest power of 2) > N" / N) */
/* RE(mdct->sincos[k]) = scale*(real_t)(cos(2.0*M_PI*(k+1./8.) / (real_t)N));
* IM(mdct->sincos[k]) = scale*(real_t)(sin(2.0*M_PI*(k+1./8.) / (real_t)N)); */
/* scale is 1 for fixed point, sqrt(N) for floating point */
switch (N)
{
case 2048: mdct->sincos = (complex_t*)mdct_tab_2048; break;
case 256: mdct->sincos = (complex_t*)mdct_tab_256; break;
#ifdef LD_DEC
case 1024: mdct->sincos = (complex_t*)mdct_tab_1024; break;
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
case 1920: mdct->sincos = (complex_t*)mdct_tab_1920; break;
case 240: mdct->sincos = (complex_t*)mdct_tab_240; break;
#ifdef LD_DEC
case 960: mdct->sincos = (complex_t*)mdct_tab_960; break;
#endif
#endif
#ifdef SSR_DEC
case 512: mdct->sincos = (complex_t*)mdct_tab_512; break;
case 64: mdct->sincos = (complex_t*)mdct_tab_64; break;
#endif
}
/* initialise fft */
mdct->cfft = cffti(N/4);
#ifdef PROFILE
mdct->cycles = 0;
mdct->fft_cycles = 0;
#endif
return mdct;
}
void faad_mdct_end(mdct_info *mdct)
{
if (mdct != NULL)
{
#ifdef PROFILE
printf("MDCT[%.4d]: %I64d cycles\n", mdct->N, mdct->cycles);
printf("CFFT[%.4d]: %I64d cycles\n", mdct->N/4, mdct->fft_cycles);
#endif
cfftu(mdct->cfft);
faad_free(mdct);
}
}
void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
{
uint16_t k;
complex_t x;
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
real_t scale, b_scale = 0;
#endif
#endif
ALIGN complex_t Z1[512];
complex_t *sincos = mdct->sincos;
uint16_t N = mdct->N;
uint16_t N2 = N >> 1;
uint16_t N4 = N >> 2;
uint16_t N8 = N >> 3;
#ifdef PROFILE
int64_t count1, count2 = faad_get_ts();
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
/* detect non-power of 2 */
if (N & (N-1))
{
/* adjust scale for non-power of 2 MDCT */
/* 2048/1920 */
b_scale = 1;
scale = COEF_CONST(1.0666666666666667);
}
#endif
#endif
/* pre-IFFT complex multiplication */
for (k = 0; k < N4; k++)
{
ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
X_in[2*k], X_in[N2 - 1 - 2*k], RE(sincos[k]), IM(sincos[k]));
}
#ifdef PROFILE
count1 = faad_get_ts();
#endif
/* complex IFFT, any non-scaling FFT can be used here */
cfftb(mdct->cfft, Z1);
#ifdef PROFILE
count1 = faad_get_ts() - count1;
#endif
/* post-IFFT complex multiplication */
for (k = 0; k < N4; k++)
{
RE(x) = RE(Z1[k]);
IM(x) = IM(Z1[k]);
ComplexMult(&IM(Z1[k]), &RE(Z1[k]),
IM(x), RE(x), RE(sincos[k]), IM(sincos[k]));
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
/* non-power of 2 MDCT scaling */
if (b_scale)
{
RE(Z1[k]) = MUL_C(RE(Z1[k]), scale);
IM(Z1[k]) = MUL_C(IM(Z1[k]), scale);
}
#endif
#endif
}
/* reordering */
for (k = 0; k < N8; k+=2)
{
X_out[ 2*k] = IM(Z1[N8 + k]);
X_out[ 2 + 2*k] = IM(Z1[N8 + 1 + k]);
X_out[ 1 + 2*k] = -RE(Z1[N8 - 1 - k]);
X_out[ 3 + 2*k] = -RE(Z1[N8 - 2 - k]);
X_out[N4 + 2*k] = RE(Z1[ k]);
X_out[N4 + + 2 + 2*k] = RE(Z1[ 1 + k]);
X_out[N4 + 1 + 2*k] = -IM(Z1[N4 - 1 - k]);
X_out[N4 + 3 + 2*k] = -IM(Z1[N4 - 2 - k]);
X_out[N2 + 2*k] = RE(Z1[N8 + k]);
X_out[N2 + + 2 + 2*k] = RE(Z1[N8 + 1 + k]);
X_out[N2 + 1 + 2*k] = -IM(Z1[N8 - 1 - k]);
X_out[N2 + 3 + 2*k] = -IM(Z1[N8 - 2 - k]);
X_out[N2 + N4 + 2*k] = -IM(Z1[ k]);
X_out[N2 + N4 + 2 + 2*k] = -IM(Z1[ 1 + k]);
X_out[N2 + N4 + 1 + 2*k] = RE(Z1[N4 - 1 - k]);
X_out[N2 + N4 + 3 + 2*k] = RE(Z1[N4 - 2 - k]);
}
#ifdef PROFILE
count2 = faad_get_ts() - count2;
mdct->fft_cycles += count1;
mdct->cycles += (count2 - count1);
#endif
}
#ifdef LTP_DEC
void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out)
{
uint16_t k;
complex_t x;
ALIGN complex_t Z1[512];
complex_t *sincos = mdct->sincos;
uint16_t N = mdct->N;
uint16_t N2 = N >> 1;
uint16_t N4 = N >> 2;
uint16_t N8 = N >> 3;
#ifndef FIXED_POINT
real_t scale = REAL_CONST(N);
#else
real_t scale = REAL_CONST(4.0/N);
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
#ifdef FIXED_POINT
/* detect non-power of 2 */
if (N & (N-1))
{
/* adjust scale for non-power of 2 MDCT */
/* *= sqrt(2048/1920) */
scale = MUL_C(scale, COEF_CONST(1.0327955589886444));
}
#endif
#endif
/* pre-FFT complex multiplication */
for (k = 0; k < N8; k++)
{
uint16_t n = k << 1;
RE(x) = X_in[N - N4 - 1 - n] + X_in[N - N4 + n];
IM(x) = X_in[ N4 + n] - X_in[ N4 - 1 - n];
ComplexMult(&RE(Z1[k]), &IM(Z1[k]),
RE(x), IM(x), RE(sincos[k]), IM(sincos[k]));
RE(Z1[k]) = MUL_R(RE(Z1[k]), scale);
IM(Z1[k]) = MUL_R(IM(Z1[k]), scale);
RE(x) = X_in[N2 - 1 - n] - X_in[ n];
IM(x) = X_in[N2 + n] + X_in[N - 1 - n];
ComplexMult(&RE(Z1[k + N8]), &IM(Z1[k + N8]),
RE(x), IM(x), RE(sincos[k + N8]), IM(sincos[k + N8]));
RE(Z1[k + N8]) = MUL_R(RE(Z1[k + N8]), scale);
IM(Z1[k + N8]) = MUL_R(IM(Z1[k + N8]), scale);
}
/* complex FFT, any non-scaling FFT can be used here */
cfftf(mdct->cfft, Z1);
/* post-FFT complex multiplication */
for (k = 0; k < N4; k++)
{
uint16_t n = k << 1;
ComplexMult(&RE(x), &IM(x),
RE(Z1[k]), IM(Z1[k]), RE(sincos[k]), IM(sincos[k]));
X_out[ n] = -RE(x);
X_out[N2 - 1 - n] = IM(x);
X_out[N2 + n] = -IM(x);
X_out[N - 1 - n] = RE(x);
}
}
#endif

96
src/contrib/aacdecoder/libfaad/mdct.h Normal file → Executable file
View File

@ -1,48 +1,48 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mdct.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __MDCT_H__
#define __MDCT_H__
#ifdef __cplusplus
extern "C" {
#endif
mdct_info *faad_mdct_init(uint16_t N);
void faad_mdct_end(mdct_info *mdct);
void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
#ifdef USE_SSE
void faad_imdct_sse(mdct_info *mdct, real_t *X_in, real_t *X_out);
#endif
void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: mdct.h,v 1.30 2007/11/01 12:33:31 menno Exp $
**/
#ifndef __MDCT_H__
#define __MDCT_H__
#ifdef __cplusplus
extern "C" {
#endif
mdct_info *faad_mdct_init(uint16_t N);
void faad_mdct_end(mdct_info *mdct);
void faad_imdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
void faad_mdct(mdct_info *mdct, real_t *X_in, real_t *X_out);
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

584
src/contrib/aacdecoder/libfaad/mp4.c Normal file → Executable file
View File

@ -1,275 +1,309 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include "bits.h"
#include "mp4.h"
#include "syntax.h"
/* defines if an object type can be decoded by this library or not */
static uint8_t ObjectTypesTable[32] = {
0, /* 0 NULL */
#ifdef MAIN_DEC
1, /* 1 AAC Main */
#else
0, /* 1 AAC Main */
#endif
1, /* 2 AAC LC */
#ifdef SSR_DEC
1, /* 3 AAC SSR */
#else
0, /* 3 AAC SSR */
#endif
#ifdef LTP_DEC
1, /* 4 AAC LTP */
#else
0, /* 4 AAC LTP */
#endif
#ifdef SBR_DEC
1, /* 5 SBR */
#else
0, /* 5 SBR */
#endif
#ifdef SCALABLE_DEC
1, /* 6 AAC Scalable */
#else
0, /* 6 AAC Scalable */
#endif
0, /* 7 TwinVQ */
0, /* 8 CELP */
0, /* 9 HVXC */
0, /* 10 Reserved */
0, /* 11 Reserved */
0, /* 12 TTSI */
0, /* 13 Main synthetic */
0, /* 14 Wavetable synthesis */
0, /* 15 General MIDI */
0, /* 16 Algorithmic Synthesis and Audio FX */
/* MPEG-4 Version 2 */
#ifdef ERROR_RESILIENCE
1, /* 17 ER AAC LC */
0, /* 18 (Reserved) */
#ifdef LTP_DEC
1, /* 19 ER AAC LTP */
#else
0, /* 19 ER AAC LTP */
#endif
#ifdef SCALABLE_DEC
1, /* 20 ER AAC scalable */
#else
0, /* 20 ER AAC scalable */
#endif
0, /* 21 ER TwinVQ */
0, /* 22 ER BSAC */
#ifdef LD_DEC
1, /* 23 ER AAC LD */
#else
0, /* 23 ER AAC LD */
#endif
0, /* 24 ER CELP */
0, /* 25 ER HVXC */
0, /* 26 ER HILN */
0, /* 27 ER Parametric */
#else /* No ER defined */
0, /* 17 ER AAC LC */
0, /* 18 (Reserved) */
0, /* 19 ER AAC LTP */
0, /* 20 ER AAC scalable */
0, /* 21 ER TwinVQ */
0, /* 22 ER BSAC */
0, /* 23 ER AAC LD */
0, /* 24 ER CELP */
0, /* 25 ER HVXC */
0, /* 26 ER HILN */
0, /* 27 ER Parametric */
#endif
0, /* 28 (Reserved) */
0, /* 29 (Reserved) */
0, /* 30 (Reserved) */
0 /* 31 (Reserved) */
};
/* Table 1.6.1 */
int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC)
{
return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL);
}
int8_t FAADAPI AudioSpecificConfig2(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC,
program_config *pce)
{
bitfile ld;
int8_t result = 0;
#ifdef SBR_DEC
int8_t bits_to_decode = 0;
#endif
if (pBuffer == NULL)
return -7;
if (mp4ASC == NULL)
return -8;
memset(mp4ASC, 0, sizeof(mp4AudioSpecificConfig));
faad_initbits(&ld, pBuffer, buffer_size);
faad_byte_align(&ld);
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
DEBUGVAR(1,1,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
DEBUGVAR(1,2,"parse_audio_decoder_specific_info(): SamplingFrequencyIndex"));
mp4ASC->channelsConfiguration = (uint8_t)faad_getbits(&ld, 4
DEBUGVAR(1,3,"parse_audio_decoder_specific_info(): ChannelsConfiguration"));
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
if (ObjectTypesTable[mp4ASC->objectTypeIndex] != 1)
{
faad_endbits(&ld);
return -1;
}
if (mp4ASC->samplingFrequency == 0)
{
faad_endbits(&ld);
return -2;
}
if (mp4ASC->channelsConfiguration > 7)
{
faad_endbits(&ld);
return -3;
}
#ifdef SBR_DEC
mp4ASC->sbr_present_flag = -1;
if (mp4ASC->objectTypeIndex == 5)
{
mp4ASC->sbr_present_flag = 1;
mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
if (mp4ASC->samplingFrequencyIndex == 15)
{
mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
DEBUGVAR(1,6,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
} else {
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
}
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
DEBUGVAR(1,7,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
}
#endif
/* get GASpecificConfig */
if (mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 ||
mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 ||
mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7)
{
result = GASpecificConfig(&ld, mp4ASC, pce);
#ifdef ERROR_RESILIENCE
} else if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { /* ER */
result = GASpecificConfig(&ld, mp4ASC, pce);
mp4ASC->epConfig = (uint8_t)faad_getbits(&ld, 2
DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig"));
if (mp4ASC->epConfig != 0)
result = -5;
#endif
} else {
result = -4;
}
#ifdef SSR_DEC
/* shorter frames not allowed for SSR */
if ((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag)
return -6;
#endif
#ifdef SBR_DEC
bits_to_decode = (int8_t)(buffer_size*8 - faad_get_processed_bits(&ld));
if ((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16))
{
int16_t syncExtensionType = (int16_t)faad_getbits(&ld, 11
DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType"));
if (syncExtensionType == 0x2b7)
{
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(&ld, 5
DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType"));
if (mp4ASC->objectTypeIndex == 5)
{
mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(&ld
DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag"));
if (mp4ASC->sbr_present_flag)
{
mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(&ld, 4
DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
if (mp4ASC->samplingFrequencyIndex == 15)
{
mp4ASC->samplingFrequency = (uint32_t)faad_getbits(&ld, 24
DEBUGVAR(1,13,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
} else {
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
}
}
}
}
}
/* no SBR signalled, this could mean either implicit signalling or no SBR in this file */
/* MPEG specification states: assume SBR on files with samplerate <= 24000 Hz */
if (mp4ASC->sbr_present_flag == -1)
{
if (mp4ASC->samplingFrequency <= 24000)
{
mp4ASC->samplingFrequency *= 2;
mp4ASC->forceUpSampling = 1;
}
}
#endif
faad_endbits(&ld);
return result;
}
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: mp4.c,v 1.40 2009/02/06 03:39:58 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include "bits.h"
#include "mp4.h"
#include "syntax.h"
/* defines if an object type can be decoded by this library or not */
static uint8_t ObjectTypesTable[32] = {
0, /* 0 NULL */
#ifdef MAIN_DEC
1, /* 1 AAC Main */
#else
0, /* 1 AAC Main */
#endif
1, /* 2 AAC LC */
#ifdef SSR_DEC
1, /* 3 AAC SSR */
#else
0, /* 3 AAC SSR */
#endif
#ifdef LTP_DEC
1, /* 4 AAC LTP */
#else
0, /* 4 AAC LTP */
#endif
#ifdef SBR_DEC
1, /* 5 SBR */
#else
0, /* 5 SBR */
#endif
0, /* 6 AAC Scalable */
0, /* 7 TwinVQ */
0, /* 8 CELP */
0, /* 9 HVXC */
0, /* 10 Reserved */
0, /* 11 Reserved */
0, /* 12 TTSI */
0, /* 13 Main synthetic */
0, /* 14 Wavetable synthesis */
0, /* 15 General MIDI */
0, /* 16 Algorithmic Synthesis and Audio FX */
/* MPEG-4 Version 2 */
#ifdef ERROR_RESILIENCE
1, /* 17 ER AAC LC */
0, /* 18 (Reserved) */
#ifdef LTP_DEC
1, /* 19 ER AAC LTP */
#else
0, /* 19 ER AAC LTP */
#endif
0, /* 20 ER AAC scalable */
0, /* 21 ER TwinVQ */
0, /* 22 ER BSAC */
#ifdef LD_DEC
1, /* 23 ER AAC LD */
#else
0, /* 23 ER AAC LD */
#endif
0, /* 24 ER CELP */
0, /* 25 ER HVXC */
0, /* 26 ER HILN */
0, /* 27 ER Parametric */
#else /* No ER defined */
0, /* 17 ER AAC LC */
0, /* 18 (Reserved) */
0, /* 19 ER AAC LTP */
0, /* 20 ER AAC scalable */
0, /* 21 ER TwinVQ */
0, /* 22 ER BSAC */
0, /* 23 ER AAC LD */
0, /* 24 ER CELP */
0, /* 25 ER HVXC */
0, /* 26 ER HILN */
0, /* 27 ER Parametric */
#endif
0, /* 28 (Reserved) */
0, /* 29 (Reserved) */
0, /* 30 (Reserved) */
0 /* 31 (Reserved) */
};
/* Table 1.6.1 */
char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
unsigned long buffer_size,
mp4AudioSpecificConfig *mp4ASC)
{
return AudioSpecificConfig2(pBuffer, buffer_size, mp4ASC, NULL, 0);
}
int8_t AudioSpecificConfigFromBitfile(bitfile *ld,
mp4AudioSpecificConfig *mp4ASC,
program_config *pce, uint32_t buffer_size, uint8_t short_form)
{
int8_t result = 0;
uint32_t startpos = faad_get_processed_bits(ld);
#ifdef SBR_DEC
int8_t bits_to_decode = 0;
#endif
if (mp4ASC == NULL)
return -8;
memset(mp4ASC, 0, sizeof(mp4AudioSpecificConfig));
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(ld, 5
DEBUGVAR(1,1,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
mp4ASC->samplingFrequencyIndex = (uint8_t)faad_getbits(ld, 4
DEBUGVAR(1,2,"parse_audio_decoder_specific_info(): SamplingFrequencyIndex"));
if(mp4ASC->samplingFrequencyIndex==0x0f)
faad_getbits(ld, 24);
mp4ASC->channelsConfiguration = (uint8_t)faad_getbits(ld, 4
DEBUGVAR(1,3,"parse_audio_decoder_specific_info(): ChannelsConfiguration"));
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
if (ObjectTypesTable[mp4ASC->objectTypeIndex] != 1)
{
return -1;
}
if (mp4ASC->samplingFrequency == 0)
{
return -2;
}
if (mp4ASC->channelsConfiguration > 7)
{
return -3;
}
#if (defined(PS_DEC) || defined(DRM_PS))
/* check if we have a mono file */
if (mp4ASC->channelsConfiguration == 1)
{
/* upMatrix to 2 channels for implicit signalling of PS */
mp4ASC->channelsConfiguration = 2;
}
#endif
#ifdef SBR_DEC
mp4ASC->sbr_present_flag = -1;
if (mp4ASC->objectTypeIndex == 5)
{
uint8_t tmp;
mp4ASC->sbr_present_flag = 1;
tmp = (uint8_t)faad_getbits(ld, 4
DEBUGVAR(1,5,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
/* check for downsampled SBR */
if (tmp == mp4ASC->samplingFrequencyIndex)
mp4ASC->downSampledSBR = 1;
mp4ASC->samplingFrequencyIndex = tmp;
if (mp4ASC->samplingFrequencyIndex == 15)
{
mp4ASC->samplingFrequency = (uint32_t)faad_getbits(ld, 24
DEBUGVAR(1,6,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
} else {
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
}
mp4ASC->objectTypeIndex = (uint8_t)faad_getbits(ld, 5
DEBUGVAR(1,7,"parse_audio_decoder_specific_info(): ObjectTypeIndex"));
}
#endif
/* get GASpecificConfig */
if (mp4ASC->objectTypeIndex == 1 || mp4ASC->objectTypeIndex == 2 ||
mp4ASC->objectTypeIndex == 3 || mp4ASC->objectTypeIndex == 4 ||
mp4ASC->objectTypeIndex == 6 || mp4ASC->objectTypeIndex == 7)
{
result = GASpecificConfig(ld, mp4ASC, pce);
#ifdef ERROR_RESILIENCE
} else if (mp4ASC->objectTypeIndex >= ER_OBJECT_START) { /* ER */
result = GASpecificConfig(ld, mp4ASC, pce);
mp4ASC->epConfig = (uint8_t)faad_getbits(ld, 2
DEBUGVAR(1,143,"parse_audio_decoder_specific_info(): epConfig"));
if (mp4ASC->epConfig != 0)
result = -5;
#endif
} else {
result = -4;
}
#ifdef SSR_DEC
/* shorter frames not allowed for SSR */
if ((mp4ASC->objectTypeIndex == 4) && mp4ASC->frameLengthFlag)
return -6;
#endif
#ifdef SBR_DEC
if(short_form)
bits_to_decode = 0;
else
bits_to_decode = (int8_t)(buffer_size*8 - (startpos-faad_get_processed_bits(ld)));
if ((mp4ASC->objectTypeIndex != 5) && (bits_to_decode >= 16))
{
int16_t syncExtensionType = (int16_t)faad_getbits(ld, 11
DEBUGVAR(1,9,"parse_audio_decoder_specific_info(): syncExtensionType"));
if (syncExtensionType == 0x2b7)
{
uint8_t tmp_OTi = (uint8_t)faad_getbits(ld, 5
DEBUGVAR(1,10,"parse_audio_decoder_specific_info(): extensionAudioObjectType"));
if (tmp_OTi == 5)
{
mp4ASC->sbr_present_flag = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,11,"parse_audio_decoder_specific_info(): sbr_present_flag"));
if (mp4ASC->sbr_present_flag)
{
uint8_t tmp;
/* Don't set OT to SBR until checked that it is actually there */
mp4ASC->objectTypeIndex = tmp_OTi;
tmp = (uint8_t)faad_getbits(ld, 4
DEBUGVAR(1,12,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
/* check for downsampled SBR */
if (tmp == mp4ASC->samplingFrequencyIndex)
mp4ASC->downSampledSBR = 1;
mp4ASC->samplingFrequencyIndex = tmp;
if (mp4ASC->samplingFrequencyIndex == 15)
{
mp4ASC->samplingFrequency = (uint32_t)faad_getbits(ld, 24
DEBUGVAR(1,13,"parse_audio_decoder_specific_info(): extensionSamplingFrequencyIndex"));
} else {
mp4ASC->samplingFrequency = get_sample_rate(mp4ASC->samplingFrequencyIndex);
}
}
}
}
}
/* no SBR signalled, this could mean either implicit signalling or no SBR in this file */
/* MPEG specification states: assume SBR on files with samplerate <= 24000 Hz */
if (mp4ASC->sbr_present_flag == -1)
{
if (mp4ASC->samplingFrequency <= 24000)
{
mp4ASC->samplingFrequency *= 2;
mp4ASC->forceUpSampling = 1;
} else /* > 24000*/ {
mp4ASC->downSampledSBR = 1;
}
}
#endif
faad_endbits(ld);
return result;
}
int8_t AudioSpecificConfig2(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC,
program_config *pce,
uint8_t short_form)
{
uint8_t ret = 0;
bitfile ld;
faad_initbits(&ld, pBuffer, buffer_size);
faad_byte_align(&ld);
ret = AudioSpecificConfigFromBitfile(&ld, mp4ASC, pce, buffer_size, short_form);
faad_endbits(&ld);
return ret;
}

101
src/contrib/aacdecoder/libfaad/mp4.h Normal file → Executable file
View File

@ -1,49 +1,52 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: mp4.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __MP4_H__
#define __MP4_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "decoder.h"
int8_t FAADAPI AudioSpecificConfig(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC);
int8_t FAADAPI AudioSpecificConfig2(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC,
program_config *pce);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: mp4.h,v 1.28 2009/02/05 00:51:03 menno Exp $
**/
#ifndef __MP4_H__
#define __MP4_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "neaacdec.h"
int8_t AudioSpecificConfig2(uint8_t *pBuffer,
uint32_t buffer_size,
mp4AudioSpecificConfig *mp4ASC,
program_config *pce, uint8_t short_form);
int8_t AudioSpecificConfigFromBitfile(bitfile *ld,
mp4AudioSpecificConfig *mp4ASC,
program_config *pce, uint32_t bsize, uint8_t short_form);
#ifdef __cplusplus
}
#endif
#endif

151
src/contrib/aacdecoder/libfaad/ms.c Normal file → Executable file
View File

@ -1,74 +1,77 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ms.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#include "syntax.h"
#include "ms.h"
#include "is.h"
#include "pns.h"
void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len)
{
uint8_t g, b, sfb;
uint8_t group = 0;
uint16_t nshort = frame_len/8;
uint16_t i, k;
real_t tmp;
if (ics->ms_mask_present >= 1)
{
for (g = 0; g < ics->num_window_groups; g++)
{
for (b = 0; b < ics->window_group_length[g]; b++)
{
for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
/* If intensity stereo coding or noise substitution is on
for a particular scalefactor band, no M/S stereo decoding
is carried out.
*/
if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
!is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
{
for (i = ics->swb_offset[sfb]; i < ics->swb_offset[sfb+1]; i++)
{
k = (group*nshort) + i;
tmp = l_spec[k] - r_spec[k];
l_spec[k] = l_spec[k] + r_spec[k];
r_spec[k] = tmp;
}
}
}
group++;
}
}
}
}
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: ms.c,v 1.21 2007/11/01 12:33:32 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include "syntax.h"
#include "ms.h"
#include "is.h"
#include "pns.h"
void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len)
{
uint8_t g, b, sfb;
uint8_t group = 0;
uint16_t nshort = frame_len/8;
uint16_t i, k;
real_t tmp;
if (ics->ms_mask_present >= 1)
{
for (g = 0; g < ics->num_window_groups; g++)
{
for (b = 0; b < ics->window_group_length[g]; b++)
{
for (sfb = 0; sfb < ics->max_sfb; sfb++)
{
/* If intensity stereo coding or noise substitution is on
for a particular scalefactor band, no M/S stereo decoding
is carried out.
*/
if ((ics->ms_used[g][sfb] || ics->ms_mask_present == 2) &&
!is_intensity(icsr, g, sfb) && !is_noise(ics, g, sfb))
{
for (i = ics->swb_offset[sfb]; i < min(ics->swb_offset[sfb+1], ics->swb_offset_max); i++)
{
k = (group*nshort) + i;
tmp = l_spec[k] - r_spec[k];
l_spec[k] = l_spec[k] + r_spec[k];
r_spec[k] = tmp;
}
}
}
group++;
}
}
}
}

85
src/contrib/aacdecoder/libfaad/ms.h Normal file → Executable file
View File

@ -1,41 +1,44 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ms.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __MS_H__
#define __MS_H__
#ifdef __cplusplus
extern "C" {
#endif
void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: ms.h,v 1.19 2007/11/01 12:33:32 menno Exp $
**/
#ifndef __MS_H__
#define __MS_H__
#ifdef __cplusplus
extern "C" {
#endif
void ms_decode(ic_stream *ics, ic_stream *icsr, real_t *l_spec, real_t *r_spec,
uint16_t frame_len);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,258 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: neaacdec.h,v 1.13 2009/01/26 23:51:15 menno Exp $
**/
#ifndef __NEAACDEC_H__
#define __NEAACDEC_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if 1
/* MACROS FOR BACKWARDS COMPATIBILITY */
/* structs */
#define faacDecHandle NeAACDecHandle
#define faacDecConfiguration NeAACDecConfiguration
#define faacDecConfigurationPtr NeAACDecConfigurationPtr
#define faacDecFrameInfo NeAACDecFrameInfo
/* functions */
#define faacDecGetErrorMessage NeAACDecGetErrorMessage
#define faacDecSetConfiguration NeAACDecSetConfiguration
#define faacDecGetCurrentConfiguration NeAACDecGetCurrentConfiguration
#define faacDecInit NeAACDecInit
#define faacDecInit2 NeAACDecInit2
#define faacDecInitDRM NeAACDecInitDRM
#define faacDecPostSeekReset NeAACDecPostSeekReset
#define faacDecOpen NeAACDecOpen
#define faacDecClose NeAACDecClose
#define faacDecDecode NeAACDecDecode
#define AudioSpecificConfig NeAACDecAudioSpecificConfig
#endif
#ifdef _WIN32
#pragma pack(push, 8)
#ifndef NEAACDECAPI
#define NEAACDECAPI __cdecl
#endif
#else
#ifndef NEAACDECAPI
#define NEAACDECAPI
#endif
#endif
#define FAAD2_VERSION "2.7"
/* object types for AAC */
#define MAIN 1
#define LC 2
#define SSR 3
#define LTP 4
#define HE_AAC 5
#define ER_LC 17
#define ER_LTP 19
#define LD 23
#define DRM_ER_LC 27 /* special object type for DRM */
/* header types */
#define RAW 0
#define ADIF 1
#define ADTS 2
#define LATM 3
/* SBR signalling */
#define NO_SBR 0
#define SBR_UPSAMPLED 1
#define SBR_DOWNSAMPLED 2
#define NO_SBR_UPSAMPLED 3
/* library output formats */
#define FAAD_FMT_16BIT 1
#define FAAD_FMT_24BIT 2
#define FAAD_FMT_32BIT 3
#define FAAD_FMT_FLOAT 4
#define FAAD_FMT_FIXED FAAD_FMT_FLOAT
#define FAAD_FMT_DOUBLE 5
/* Capabilities */
#define LC_DEC_CAP (1<<0) /* Can decode LC */
#define MAIN_DEC_CAP (1<<1) /* Can decode MAIN */
#define LTP_DEC_CAP (1<<2) /* Can decode LTP */
#define LD_DEC_CAP (1<<3) /* Can decode LD */
#define ERROR_RESILIENCE_CAP (1<<4) /* Can decode ER */
#define FIXED_POINT_CAP (1<<5) /* Fixed point */
/* Channel definitions */
#define FRONT_CHANNEL_CENTER (1)
#define FRONT_CHANNEL_LEFT (2)
#define FRONT_CHANNEL_RIGHT (3)
#define SIDE_CHANNEL_LEFT (4)
#define SIDE_CHANNEL_RIGHT (5)
#define BACK_CHANNEL_LEFT (6)
#define BACK_CHANNEL_RIGHT (7)
#define BACK_CHANNEL_CENTER (8)
#define LFE_CHANNEL (9)
#define UNKNOWN_CHANNEL (0)
/* DRM channel definitions */
#define DRMCH_MONO 1
#define DRMCH_STEREO 2
#define DRMCH_SBR_MONO 3
#define DRMCH_SBR_STEREO 4
#define DRMCH_SBR_PS_STEREO 5
/* A decode call can eat up to FAAD_MIN_STREAMSIZE bytes per decoded channel,
so at least so much bytes per channel should be available in this stream */
#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
typedef void *NeAACDecHandle;
typedef struct mp4AudioSpecificConfig
{
/* Audio Specific Info */
unsigned char objectTypeIndex;
unsigned char samplingFrequencyIndex;
unsigned long samplingFrequency;
unsigned char channelsConfiguration;
/* GA Specific Info */
unsigned char frameLengthFlag;
unsigned char dependsOnCoreCoder;
unsigned short coreCoderDelay;
unsigned char extensionFlag;
unsigned char aacSectionDataResilienceFlag;
unsigned char aacScalefactorDataResilienceFlag;
unsigned char aacSpectralDataResilienceFlag;
unsigned char epConfig;
char sbr_present_flag;
char forceUpSampling;
char downSampledSBR;
} mp4AudioSpecificConfig;
typedef struct NeAACDecConfiguration
{
unsigned char defObjectType;
unsigned long defSampleRate;
unsigned char outputFormat;
unsigned char downMatrix;
unsigned char useOldADTSFormat;
unsigned char dontUpSampleImplicitSBR;
} NeAACDecConfiguration, *NeAACDecConfigurationPtr;
typedef struct NeAACDecFrameInfo
{
unsigned long bytesconsumed;
unsigned long samples;
unsigned char channels;
unsigned char error;
unsigned long samplerate;
/* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
unsigned char sbr;
/* MPEG-4 ObjectType */
unsigned char object_type;
/* AAC header type; MP4 will be signalled as RAW also */
unsigned char header_type;
/* multichannel configuration */
unsigned char num_front_channels;
unsigned char num_side_channels;
unsigned char num_back_channels;
unsigned char num_lfe_channels;
unsigned char channel_position[64];
/* PS: 0: off, 1: on */
unsigned char ps;
} NeAACDecFrameInfo;
char* NEAACDECAPI NeAACDecGetErrorMessage(unsigned char errcode);
unsigned long NEAACDECAPI NeAACDecGetCapabilities(void);
NeAACDecHandle NEAACDECAPI NeAACDecOpen(void);
NeAACDecConfigurationPtr NEAACDECAPI NeAACDecGetCurrentConfiguration(NeAACDecHandle hDecoder);
unsigned char NEAACDECAPI NeAACDecSetConfiguration(NeAACDecHandle hDecoder,
NeAACDecConfigurationPtr config);
/* Init the library based on info from the AAC file (ADTS/ADIF) */
long NEAACDECAPI NeAACDecInit(NeAACDecHandle hDecoder,
unsigned char *buffer,
unsigned long buffer_size,
unsigned long *samplerate,
unsigned char *channels);
/* Init the library using a DecoderSpecificInfo */
char NEAACDECAPI NeAACDecInit2(NeAACDecHandle hDecoder,
unsigned char *pBuffer,
unsigned long SizeOfDecoderSpecificInfo,
unsigned long *samplerate,
unsigned char *channels);
/* Init the library for DRM */
char NEAACDECAPI NeAACDecInitDRM(NeAACDecHandle *hDecoder, unsigned long samplerate,
unsigned char channels);
void NEAACDECAPI NeAACDecPostSeekReset(NeAACDecHandle hDecoder, long frame);
void NEAACDECAPI NeAACDecClose(NeAACDecHandle hDecoder);
void* NEAACDECAPI NeAACDecDecode(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size);
void* NEAACDECAPI NeAACDecDecode2(NeAACDecHandle hDecoder,
NeAACDecFrameInfo *hInfo,
unsigned char *buffer,
unsigned long buffer_size,
void **sample_buffer,
unsigned long sample_buffer_size);
char NEAACDECAPI NeAACDecAudioSpecificConfig(unsigned char *pBuffer,
unsigned long buffer_size,
mp4AudioSpecificConfig *mp4ASC);
#ifdef _WIN32
#pragma pack(pop)
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

1038
src/contrib/aacdecoder/libfaad/output.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

93
src/contrib/aacdecoder/libfaad/output.h Normal file → Executable file
View File

@ -1,45 +1,48 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: output.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __OUTPUT_H__
#define __OUTPUT_H__
#ifdef __cplusplus
extern "C" {
#endif
void* output_to_PCM(faacDecHandle hDecoder,
real_t **input,
void *samplebuffer,
uint8_t channels,
uint16_t frame_len,
uint8_t format);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: output.h,v 1.26 2009/01/26 23:51:15 menno Exp $
**/
#ifndef __OUTPUT_H__
#define __OUTPUT_H__
#ifdef __cplusplus
extern "C" {
#endif
void* output_to_PCM(NeAACDecStruct *hDecoder,
real_t **input,
void *samplebuffer,
uint8_t channels,
uint16_t frame_len,
uint8_t format);
#ifdef __cplusplus
}
#endif
#endif

531
src/contrib/aacdecoder/libfaad/pns.c Normal file → Executable file
View File

@ -1,260 +1,271 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: pns.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#include "pns.h"
/* static function declarations */
static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
uint8_t sub);
#ifdef FIXED_POINT
#define DIV(A, B) (((int64_t)A << REAL_BITS)/B)
#define step(shift) \
if ((0x40000000l >> shift) + root <= value) \
{ \
value -= (0x40000000l >> shift) + root; \
root = (root >> 1) | (0x40000000l >> shift); \
} else { \
root = root >> 1; \
}
/* fixed point square root approximation */
/* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */
real_t fp_sqrt(real_t value)
{
real_t root = 0;
step( 0); step( 2); step( 4); step( 6);
step( 8); step(10); step(12); step(14);
step(16); step(18); step(20); step(22);
step(24); step(26); step(28); step(30);
if (root < value)
++root;
root <<= (REAL_BITS/2);
return root;
}
static real_t pow2_table[] =
{
COEF_CONST(0.59460355750136),
COEF_CONST(0.70710678118655),
COEF_CONST(0.84089641525371),
COEF_CONST(1.0),
COEF_CONST(1.18920711500272),
COEF_CONST(1.41421356237310),
COEF_CONST(1.68179283050743)
};
#endif
/* The function gen_rand_vector(addr, size) generates a vector of length
<size> with signed random values of average energy MEAN_NRG per random
value. A suitable random number generator can be realized using one
multiplication/accumulation per random value.
*/
static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
uint8_t sub)
{
#ifndef FIXED_POINT
uint16_t i;
real_t energy = 0.0;
real_t scale = (real_t)1.0/(real_t)size;
for (i = 0; i < size; i++)
{
real_t tmp = scale*(real_t)(int32_t)random_int();
spec[i] = tmp;
energy += tmp*tmp;
}
scale = (real_t)1.0/(real_t)sqrt(energy);
scale *= (real_t)pow(2.0, 0.25 * scale_factor);
for (i = 0; i < size; i++)
{
spec[i] *= scale;
}
#else
uint16_t i;
real_t energy = 0, scale;
int32_t exp, frac;
for (i = 0; i < size; i++)
{
/* this can be replaced by a 16 bit random generator!!!! */
real_t tmp = (int32_t)random_int();
if (tmp < 0)
tmp = -(tmp & ((1<<(REAL_BITS-1))-1));
else
tmp = (tmp & ((1<<(REAL_BITS-1))-1));
energy += MUL_R(tmp,tmp);
spec[i] = tmp;
}
energy = fp_sqrt(energy);
if (energy > 0)
{
scale = DIV(REAL_CONST(1),energy);
exp = scale_factor / 4;
frac = scale_factor % 4;
/* IMDCT pre-scaling */
exp -= sub;
if (exp < 0)
scale >>= -exp;
else
scale <<= exp;
if (frac)
scale = MUL_C(scale, pow2_table[frac + 3]);
for (i = 0; i < size; i++)
{
spec[i] = MUL_R(spec[i], scale);
}
}
#endif
}
void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
real_t *spec_left, real_t *spec_right, uint16_t frame_len,
uint8_t channel_pair, uint8_t object_type)
{
uint8_t g, sfb, b;
uint16_t size, offs;
uint8_t group = 0;
uint16_t nshort = frame_len >> 3;
uint8_t sub = 0;
#ifdef FIXED_POINT
/* IMDCT scaling */
if (object_type == LD)
{
sub = 9 /*9*/;
} else {
if (ics_left->window_sequence == EIGHT_SHORT_SEQUENCE)
sub = 7 /*7*/;
else
sub = 10 /*10*/;
}
#endif
for (g = 0; g < ics_left->num_window_groups; g++)
{
/* Do perceptual noise substitution decoding */
for (b = 0; b < ics_left->window_group_length[g]; b++)
{
for (sfb = 0; sfb < ics_left->max_sfb; sfb++)
{
if (is_noise(ics_left, g, sfb))
{
/* Simultaneous use of LTP and PNS is not prevented in the
syntax. If both LTP, and PNS are enabled on the same
scalefactor band, PNS takes precedence, and no prediction
is applied to this band.
*/
ics_left->ltp.long_used[sfb] = 0;
ics_left->ltp2.long_used[sfb] = 0;
/* For scalefactor bands coded using PNS the corresponding
predictors are switched to "off".
*/
ics_left->pred.prediction_used[sfb] = 0;
offs = ics_left->swb_offset[sfb];
size = ics_left->swb_offset[sfb+1] - offs;
/* Generate random vector */
gen_rand_vector(&spec_left[(group*nshort)+offs],
ics_left->scale_factors[g][sfb], size, sub);
}
/* From the spec:
If the same scalefactor band and group is coded by perceptual noise
substitution in both channels of a channel pair, the correlation of
the noise signal can be controlled by means of the ms_used field: While
the default noise generation process works independently for each channel
(separate generation of random vectors), the same random vector is used
for both channels if ms_used[] is set for a particular scalefactor band
and group. In this case, no M/S stereo coding is carried out (because M/S
stereo coding and noise substitution coding are mutually exclusive).
If the same scalefactor band and group is coded by perceptual noise
substitution in only one channel of a channel pair the setting of ms_used[]
is not evaluated.
*/
if (channel_pair)
{
if (is_noise(ics_right, g, sfb))
{
if (((ics_left->ms_mask_present == 1) &&
(ics_left->ms_used[g][sfb])) ||
(ics_left->ms_mask_present == 2))
{
uint16_t c;
offs = ics_right->swb_offset[sfb];
size = ics_right->swb_offset[sfb+1] - offs;
for (c = 0; c < size; c++)
{
spec_right[(group*nshort) + offs + c] =
spec_left[(group*nshort) + offs + c];
}
} else /*if (ics_left->ms_mask_present == 0)*/ {
ics_right->ltp.long_used[sfb] = 0;
ics_right->ltp2.long_used[sfb] = 0;
ics_right->pred.prediction_used[sfb] = 0;
offs = ics_right->swb_offset[sfb];
size = ics_right->swb_offset[sfb+1] - offs;
/* Generate random vector */
gen_rand_vector(&spec_right[(group*nshort)+offs],
ics_right->scale_factors[g][sfb], size, sub);
}
}
}
} /* sfb */
group++;
} /* b */
} /* g */
}
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: pns.c,v 1.38 2007/11/01 12:33:32 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include "pns.h"
/* static function declarations */
static void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
uint8_t sub,
/* RNG states */ uint32_t *__r1, uint32_t *__r2);
#ifdef FIXED_POINT
#define DIV(A, B) (((int64_t)A << REAL_BITS)/B)
#define step(shift) \
if ((0x40000000l >> shift) + root <= value) \
{ \
value -= (0x40000000l >> shift) + root; \
root = (root >> 1) | (0x40000000l >> shift); \
} else { \
root = root >> 1; \
}
/* fixed point square root approximation */
/* !!!! ONLY WORKS FOR EVEN %REAL_BITS% !!!! */
real_t fp_sqrt(real_t value)
{
real_t root = 0;
step( 0); step( 2); step( 4); step( 6);
step( 8); step(10); step(12); step(14);
step(16); step(18); step(20); step(22);
step(24); step(26); step(28); step(30);
if (root < value)
++root;
root <<= (REAL_BITS/2);
return root;
}
static real_t const pow2_table[] =
{
COEF_CONST(1.0),
COEF_CONST(1.18920711500272),
COEF_CONST(1.41421356237310),
COEF_CONST(1.68179283050743)
};
#endif
/* The function gen_rand_vector(addr, size) generates a vector of length
<size> with signed random values of average energy MEAN_NRG per random
value. A suitable random number generator can be realized using one
multiplication/accumulation per random value.
*/
static INLINE void gen_rand_vector(real_t *spec, int16_t scale_factor, uint16_t size,
uint8_t sub,
/* RNG states */ uint32_t *__r1, uint32_t *__r2)
{
#ifndef FIXED_POINT
uint16_t i;
real_t energy = 0.0;
real_t scale = (real_t)1.0/(real_t)size;
for (i = 0; i < size; i++)
{
real_t tmp = scale*(real_t)(int32_t)ne_rng(__r1, __r2);
spec[i] = tmp;
energy += tmp*tmp;
}
scale = (real_t)1.0/(real_t)sqrt(energy);
scale *= (real_t)pow(2.0, 0.25 * scale_factor);
for (i = 0; i < size; i++)
{
spec[i] *= scale;
}
#else
uint16_t i;
real_t energy = 0, scale;
int32_t exp, frac;
for (i = 0; i < size; i++)
{
/* this can be replaced by a 16 bit random generator!!!! */
real_t tmp = (int32_t)ne_rng(__r1, __r2);
if (tmp < 0)
tmp = -(tmp & ((1<<(REAL_BITS-1))-1));
else
tmp = (tmp & ((1<<(REAL_BITS-1))-1));
energy += MUL_R(tmp,tmp);
spec[i] = tmp;
}
energy = fp_sqrt(energy);
if (energy > 0)
{
scale = DIV(REAL_CONST(1),energy);
exp = scale_factor >> 2;
frac = scale_factor & 3;
/* IMDCT pre-scaling */
exp -= sub;
if (exp < 0)
scale >>= -exp;
else
scale <<= exp;
if (frac)
scale = MUL_C(scale, pow2_table[frac]);
for (i = 0; i < size; i++)
{
spec[i] = MUL_R(spec[i], scale);
}
}
#endif
}
void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
real_t *spec_left, real_t *spec_right, uint16_t frame_len,
uint8_t channel_pair, uint8_t object_type,
/* RNG states */ uint32_t *__r1, uint32_t *__r2)
{
uint8_t g, sfb, b;
uint16_t size, offs;
uint8_t group = 0;
uint16_t nshort = frame_len >> 3;
uint8_t sub = 0;
#ifdef FIXED_POINT
/* IMDCT scaling */
if (object_type == LD)
{
sub = 9 /*9*/;
} else {
if (ics_left->window_sequence == EIGHT_SHORT_SEQUENCE)
sub = 7 /*7*/;
else
sub = 10 /*10*/;
}
#endif
for (g = 0; g < ics_left->num_window_groups; g++)
{
/* Do perceptual noise substitution decoding */
for (b = 0; b < ics_left->window_group_length[g]; b++)
{
for (sfb = 0; sfb < ics_left->max_sfb; sfb++)
{
if (is_noise(ics_left, g, sfb))
{
#ifdef LTP_DEC
/* Simultaneous use of LTP and PNS is not prevented in the
syntax. If both LTP, and PNS are enabled on the same
scalefactor band, PNS takes precedence, and no prediction
is applied to this band.
*/
ics_left->ltp.long_used[sfb] = 0;
ics_left->ltp2.long_used[sfb] = 0;
#endif
#ifdef MAIN_DEC
/* For scalefactor bands coded using PNS the corresponding
predictors are switched to "off".
*/
ics_left->pred.prediction_used[sfb] = 0;
#endif
offs = ics_left->swb_offset[sfb];
size = min(ics_left->swb_offset[sfb+1], ics_left->swb_offset_max) - offs;
/* Generate random vector */
gen_rand_vector(&spec_left[(group*nshort)+offs],
ics_left->scale_factors[g][sfb], size, sub, __r1, __r2);
}
/* From the spec:
If the same scalefactor band and group is coded by perceptual noise
substitution in both channels of a channel pair, the correlation of
the noise signal can be controlled by means of the ms_used field: While
the default noise generation process works independently for each channel
(separate generation of random vectors), the same random vector is used
for both channels if ms_used[] is set for a particular scalefactor band
and group. In this case, no M/S stereo coding is carried out (because M/S
stereo coding and noise substitution coding are mutually exclusive).
If the same scalefactor band and group is coded by perceptual noise
substitution in only one channel of a channel pair the setting of ms_used[]
is not evaluated.
*/
if (channel_pair)
{
if (is_noise(ics_right, g, sfb))
{
if (((ics_left->ms_mask_present == 1) &&
(ics_left->ms_used[g][sfb])) ||
(ics_left->ms_mask_present == 2))
{
uint16_t c;
offs = ics_right->swb_offset[sfb];
size = min(ics_right->swb_offset[sfb+1], ics_right->swb_offset_max) - offs;
for (c = 0; c < size; c++)
{
spec_right[(group*nshort) + offs + c] =
spec_left[(group*nshort) + offs + c];
}
} else /*if (ics_left->ms_mask_present == 0)*/ {
#ifdef LTP_DEC
ics_right->ltp.long_used[sfb] = 0;
ics_right->ltp2.long_used[sfb] = 0;
#endif
#ifdef MAIN_DEC
ics_right->pred.prediction_used[sfb] = 0;
#endif
offs = ics_right->swb_offset[sfb];
size = min(ics_right->swb_offset[sfb+1], ics_right->swb_offset_max) - offs;
/* Generate random vector */
gen_rand_vector(&spec_right[(group*nshort)+offs],
ics_right->scale_factors[g][sfb], size, sub, __r1, __r2);
}
}
}
} /* sfb */
group++;
} /* b */
} /* g */
}

112
src/contrib/aacdecoder/libfaad/pns.h Normal file → Executable file
View File

@ -1,55 +1,57 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: pns.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __PNS_H__
#define __PNS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "common.h"
#include "syntax.h"
#define NOISE_OFFSET 90
void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
real_t *spec_left, real_t *spec_right, uint16_t frame_len,
uint8_t channel_pair, uint8_t object_type);
static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb)
{
if (ics->sfb_cb[group][sfb] == NOISE_HCB)
return 1;
return 0;
}
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: pns.h,v 1.27 2007/11/01 12:33:33 menno Exp $
**/
#ifndef __PNS_H__
#define __PNS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "syntax.h"
#define NOISE_OFFSET 90
void pns_decode(ic_stream *ics_left, ic_stream *ics_right,
real_t *spec_left, real_t *spec_right, uint16_t frame_len,
uint8_t channel_pair, uint8_t object_type,
/* RNG states */ uint32_t *__r1, uint32_t *__r2);
static INLINE uint8_t is_noise(ic_stream *ics, uint8_t group, uint8_t sfb)
{
if (ics->sfb_cb[group][sfb] == NOISE_HCB)
return 1;
return 0;
}
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,152 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: ps_dec.h,v 1.13 2009/01/26 22:32:31 menno Exp $
**/
#ifndef __PS_DEC_H__
#define __PS_DEC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "bits.h"
#define EXTENSION_ID_PS 2
#define MAX_PS_ENVELOPES 5
#define NO_ALLPASS_LINKS 3
typedef struct
{
/* bitstream parameters */
uint8_t enable_iid;
uint8_t enable_icc;
uint8_t enable_ext;
uint8_t iid_mode;
uint8_t icc_mode;
uint8_t nr_iid_par;
uint8_t nr_ipdopd_par;
uint8_t nr_icc_par;
uint8_t frame_class;
uint8_t num_env;
uint8_t border_position[MAX_PS_ENVELOPES+1];
uint8_t iid_dt[MAX_PS_ENVELOPES];
uint8_t icc_dt[MAX_PS_ENVELOPES];
uint8_t enable_ipdopd;
uint8_t ipd_mode;
uint8_t ipd_dt[MAX_PS_ENVELOPES];
uint8_t opd_dt[MAX_PS_ENVELOPES];
/* indices */
int8_t iid_index_prev[34];
int8_t icc_index_prev[34];
int8_t ipd_index_prev[17];
int8_t opd_index_prev[17];
int8_t iid_index[MAX_PS_ENVELOPES][34];
int8_t icc_index[MAX_PS_ENVELOPES][34];
int8_t ipd_index[MAX_PS_ENVELOPES][17];
int8_t opd_index[MAX_PS_ENVELOPES][17];
int8_t ipd_index_1[17];
int8_t opd_index_1[17];
int8_t ipd_index_2[17];
int8_t opd_index_2[17];
/* ps data was correctly read */
uint8_t ps_data_available;
/* a header has been read */
uint8_t header_read;
/* hybrid filterbank parameters */
void *hyb;
uint8_t use34hybrid_bands;
uint8_t numTimeSlotsRate;
/**/
uint8_t num_groups;
uint8_t num_hybrid_groups;
uint8_t nr_par_bands;
uint8_t nr_allpass_bands;
uint8_t decay_cutoff;
uint8_t *group_border;
uint16_t *map_group2bk;
/* filter delay handling */
uint8_t saved_delay;
uint8_t delay_buf_index_ser[NO_ALLPASS_LINKS];
uint8_t num_sample_delay_ser[NO_ALLPASS_LINKS];
uint8_t delay_D[64];
uint8_t delay_buf_index_delay[64];
complex_t delay_Qmf[14][64]; /* 14 samples delay max, 64 QMF channels */
complex_t delay_SubQmf[2][32]; /* 2 samples delay max (SubQmf is always allpass filtered) */
complex_t delay_Qmf_ser[NO_ALLPASS_LINKS][5][64]; /* 5 samples delay max (table 8.34), 64 QMF channels */
complex_t delay_SubQmf_ser[NO_ALLPASS_LINKS][5][32]; /* 5 samples delay max (table 8.34) */
/* transients */
real_t alpha_decay;
real_t alpha_smooth;
real_t P_PeakDecayNrg[34];
real_t P_prev[34];
real_t P_SmoothPeakDecayDiffNrg_prev[34];
/* mixing and phase */
complex_t h11_prev[50];
complex_t h12_prev[50];
complex_t h21_prev[50];
complex_t h22_prev[50];
uint8_t phase_hist;
complex_t ipd_prev[20][2];
complex_t opd_prev[20][2];
} ps_info;
/* ps_syntax.c */
uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header);
/* ps_dec.c */
ps_info *ps_init(uint8_t sr_index, uint8_t numTimeSlotsRate);
void ps_free(ps_info *ps);
uint8_t ps_decode(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64]);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,551 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: ps_syntax.c,v 1.11 2007/11/01 12:33:33 menno Exp $
**/
#include "common.h"
#ifdef PS_DEC
#include "bits.h"
#include "ps_dec.h"
/* type definitaions */
typedef const int8_t (*ps_huff_tab)[2];
/* static data tables */
static const uint8_t nr_iid_par_tab[] = {
10, 20, 34, 10, 20, 34, 0, 0
};
static const uint8_t nr_ipdopd_par_tab[] = {
5, 11, 17, 5, 11, 17, 0, 0
};
static const uint8_t nr_icc_par_tab[] = {
10, 20, 34, 10, 20, 34, 0, 0
};
static const uint8_t num_env_tab[][4] = {
{ 0, 1, 2, 4 },
{ 1, 2, 3, 4 }
};
/* binary lookup huffman tables */
static const int8_t f_huff_iid_def[][2] = {
{ /*0*/ -31, 1 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 1x */
{ /*1*/ -30, /*-1*/ -32 }, /* index 2: 3 bits: 10x */
{ 4, 5 }, /* index 3: 3 bits: 11x */
{ /*2*/ -29, /*-2*/ -33 }, /* index 4: 4 bits: 110x */
{ 6, 7 }, /* index 5: 4 bits: 111x */
{ /*3*/ -28, /*-3*/ -34 }, /* index 6: 5 bits: 1110x */
{ 8, 9 }, /* index 7: 5 bits: 1111x */
{ /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 11110x */
{ /*5*/ -26, 10 }, /* index 9: 6 bits: 11111x */
{ /*-5*/ -36, 11 }, /* index 10: 7 bits: 111111x */
{ /*6*/ -25, 12 }, /* index 11: 8 bits: 1111111x */
{ /*-6*/ -37, 13 }, /* index 12: 9 bits: 11111111x */
{ /*-7*/ -38, 14 }, /* index 13: 10 bits: 111111111x */
{ /*7*/ -24, 15 }, /* index 14: 11 bits: 1111111111x */
{ 16, 17 }, /* index 15: 12 bits: 11111111111x */
{ /*8*/ -23, /*-8*/ -39 }, /* index 16: 13 bits: 111111111110x */
{ 18, 19 }, /* index 17: 13 bits: 111111111111x */
{ /*9*/ -22, /*10*/ -21 }, /* index 18: 14 bits: 1111111111110x */
{ 20, 21 }, /* index 19: 14 bits: 1111111111111x */
{ /*-9*/ -40, /*11*/ -20 }, /* index 20: 15 bits: 11111111111110x */
{ 22, 23 }, /* index 21: 15 bits: 11111111111111x */
{ /*-10*/ -41, 24 }, /* index 22: 16 bits: 111111111111110x */
{ 25, 26 }, /* index 23: 16 bits: 111111111111111x */
{ /*-11*/ -42, /*-14*/ -45 }, /* index 24: 17 bits: 1111111111111101x */
{ /*-13*/ -44, /*-12*/ -43 }, /* index 25: 17 bits: 1111111111111110x */
{ /*12*/ -19, 27 }, /* index 26: 17 bits: 1111111111111111x */
{ /*13*/ -18, /*14*/ -17 } /* index 27: 18 bits: 11111111111111111x */
};
static const int8_t t_huff_iid_def[][2] = {
{ /*0*/ -31, 1 }, /* index 0: 1 bits: x */
{ /*-1*/ -32, 2 }, /* index 1: 2 bits: 1x */
{ /*1*/ -30, 3 }, /* index 2: 3 bits: 11x */
{ /*-2*/ -33, 4 }, /* index 3: 4 bits: 111x */
{ /*2*/ -29, 5 }, /* index 4: 5 bits: 1111x */
{ /*-3*/ -34, 6 }, /* index 5: 6 bits: 11111x */
{ /*3*/ -28, 7 }, /* index 6: 7 bits: 111111x */
{ /*-4*/ -35, 8 }, /* index 7: 8 bits: 1111111x */
{ /*4*/ -27, 9 }, /* index 8: 9 bits: 11111111x */
{ /*-5*/ -36, 10 }, /* index 9: 10 bits: 111111111x */
{ /*5*/ -26, 11 }, /* index 10: 11 bits: 1111111111x */
{ /*-6*/ -37, 12 }, /* index 11: 12 bits: 11111111111x */
{ /*6*/ -25, 13 }, /* index 12: 13 bits: 111111111111x */
{ /*7*/ -24, 14 }, /* index 13: 14 bits: 1111111111111x */
{ /*-7*/ -38, 15 }, /* index 14: 15 bits: 11111111111111x */
{ 16, 17 }, /* index 15: 16 bits: 111111111111111x */
{ /*8*/ -23, /*-8*/ -39 }, /* index 16: 17 bits: 1111111111111110x */
{ 18, 19 }, /* index 17: 17 bits: 1111111111111111x */
{ 20, 21 }, /* index 18: 18 bits: 11111111111111110x */
{ 22, 23 }, /* index 19: 18 bits: 11111111111111111x */
{ /*9*/ -22, /*-14*/ -45 }, /* index 20: 19 bits: 111111111111111100x */
{ /*-13*/ -44, /*-12*/ -43 }, /* index 21: 19 bits: 111111111111111101x */
{ 24, 25 }, /* index 22: 19 bits: 111111111111111110x */
{ 26, 27 }, /* index 23: 19 bits: 111111111111111111x */
{ /*-11*/ -42, /*-10*/ -41 }, /* index 24: 20 bits: 1111111111111111100x */
{ /*-9*/ -40, /*10*/ -21 }, /* index 25: 20 bits: 1111111111111111101x */
{ /*11*/ -20, /*12*/ -19 }, /* index 26: 20 bits: 1111111111111111110x */
{ /*13*/ -18, /*14*/ -17 } /* index 27: 20 bits: 1111111111111111111x */
};
static const int8_t f_huff_iid_fine[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ 4, /*-1*/ -32 }, /* index 2: 3 bits: 00x */
{ /*1*/ -30, 5 }, /* index 3: 3 bits: 01x */
{ /*-2*/ -33, /*2*/ -29 }, /* index 4: 4 bits: 000x */
{ 6, 7 }, /* index 5: 4 bits: 011x */
{ /*-3*/ -34, /*3*/ -28 }, /* index 6: 5 bits: 0110x */
{ 8, 9 }, /* index 7: 5 bits: 0111x */
{ /*-4*/ -35, /*4*/ -27 }, /* index 8: 6 bits: 01110x */
{ 10, 11 }, /* index 9: 6 bits: 01111x */
{ /*-5*/ -36, /*5*/ -26 }, /* index 10: 7 bits: 011110x */
{ 12, 13 }, /* index 11: 7 bits: 011111x */
{ /*-6*/ -37, /*6*/ -25 }, /* index 12: 8 bits: 0111110x */
{ 14, 15 }, /* index 13: 8 bits: 0111111x */
{ /*7*/ -24, 16 }, /* index 14: 9 bits: 01111110x */
{ 17, 18 }, /* index 15: 9 bits: 01111111x */
{ 19, /*-8*/ -39 }, /* index 16: 10 bits: 011111101x */
{ /*8*/ -23, 20 }, /* index 17: 10 bits: 011111110x */
{ 21, /*-7*/ -38 }, /* index 18: 10 bits: 011111111x */
{ /*10*/ -21, 22 }, /* index 19: 11 bits: 0111111010x */
{ 23, /*-9*/ -40 }, /* index 20: 11 bits: 0111111101x */
{ /*9*/ -22, 24 }, /* index 21: 11 bits: 0111111110x */
{ /*-11*/ -42, /*11*/ -20 }, /* index 22: 12 bits: 01111110101x */
{ 25, 26 }, /* index 23: 12 bits: 01111111010x */
{ 27, /*-10*/ -41 }, /* index 24: 12 bits: 01111111101x */
{ 28, /*-12*/ -43 }, /* index 25: 13 bits: 011111110100x */
{ /*12*/ -19, 29 }, /* index 26: 13 bits: 011111110101x */
{ 30, 31 }, /* index 27: 13 bits: 011111111010x */
{ 32, /*-14*/ -45 }, /* index 28: 14 bits: 0111111101000x */
{ /*14*/ -17, 33 }, /* index 29: 14 bits: 0111111101011x */
{ 34, /*-13*/ -44 }, /* index 30: 14 bits: 0111111110100x */
{ /*13*/ -18, 35 }, /* index 31: 14 bits: 0111111110101x */
{ 36, 37 }, /* index 32: 15 bits: 01111111010000x */
{ 38, /*-15*/ -46 }, /* index 33: 15 bits: 01111111010111x */
{ /*15*/ -16, 39 }, /* index 34: 15 bits: 01111111101000x */
{ 40, 41 }, /* index 35: 15 bits: 01111111101011x */
{ 42, 43 }, /* index 36: 16 bits: 011111110100000x */
{ /*-17*/ -48, /*17*/ -14 }, /* index 37: 16 bits: 011111110100001x */
{ 44, 45 }, /* index 38: 16 bits: 011111110101110x */
{ 46, 47 }, /* index 39: 16 bits: 011111111010001x */
{ 48, 49 }, /* index 40: 16 bits: 011111111010110x */
{ /*-16*/ -47, /*16*/ -15 }, /* index 41: 16 bits: 011111111010111x */
{ /*-21*/ -52, /*21*/ -10 }, /* index 42: 17 bits: 0111111101000000x */
{ /*-19*/ -50, /*19*/ -12 }, /* index 43: 17 bits: 0111111101000001x */
{ /*-18*/ -49, /*18*/ -13 }, /* index 44: 17 bits: 0111111101011100x */
{ 50, 51 }, /* index 45: 17 bits: 0111111101011101x */
{ 52, 53 }, /* index 46: 17 bits: 0111111110100010x */
{ 54, 55 }, /* index 47: 17 bits: 0111111110100011x */
{ 56, 57 }, /* index 48: 17 bits: 0111111110101100x */
{ 58, 59 }, /* index 49: 17 bits: 0111111110101101x */
{ /*-26*/ -57, /*-25*/ -56 }, /* index 50: 18 bits: 01111111010111010x */
{ /*-28*/ -59, /*-27*/ -58 }, /* index 51: 18 bits: 01111111010111011x */
{ /*-22*/ -53, /*22*/ -9 }, /* index 52: 18 bits: 01111111101000100x */
{ /*-24*/ -55, /*-23*/ -54 }, /* index 53: 18 bits: 01111111101000101x */
{ /*25*/ -6, /*26*/ -5 }, /* index 54: 18 bits: 01111111101000110x */
{ /*23*/ -8, /*24*/ -7 }, /* index 55: 18 bits: 01111111101000111x */
{ /*29*/ -2, /*30*/ -1 }, /* index 56: 18 bits: 01111111101011000x */
{ /*27*/ -4, /*28*/ -3 }, /* index 57: 18 bits: 01111111101011001x */
{ /*-30*/ -61, /*-29*/ -60 }, /* index 58: 18 bits: 01111111101011010x */
{ /*-20*/ -51, /*20*/ -11 } /* index 59: 18 bits: 01111111101011011x */
};
static const int8_t t_huff_iid_fine[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ /*1*/ -30, 2 }, /* index 1: 2 bits: 0x */
{ 3, /*-1*/ -32 }, /* index 2: 3 bits: 01x */
{ 4, 5 }, /* index 3: 4 bits: 010x */
{ 6, 7 }, /* index 4: 5 bits: 0100x */
{ /*-2*/ -33, /*2*/ -29 }, /* index 5: 5 bits: 0101x */
{ 8, /*-3*/ -34 }, /* index 6: 6 bits: 01000x */
{ /*3*/ -28, 9 }, /* index 7: 6 bits: 01001x */
{ /*-4*/ -35, /*4*/ -27 }, /* index 8: 7 bits: 010000x */
{ 10, 11 }, /* index 9: 7 bits: 010011x */
{ /*5*/ -26, 12 }, /* index 10: 8 bits: 0100110x */
{ 13, 14 }, /* index 11: 8 bits: 0100111x */
{ /*-6*/ -37, /*6*/ -25 }, /* index 12: 9 bits: 01001101x */
{ 15, 16 }, /* index 13: 9 bits: 01001110x */
{ 17, /*-5*/ -36 }, /* index 14: 9 bits: 01001111x */
{ 18, /*-7*/ -38 }, /* index 15: 10 bits: 010011100x */
{ /*7*/ -24, 19 }, /* index 16: 10 bits: 010011101x */
{ 20, 21 }, /* index 17: 10 bits: 010011110x */
{ /*9*/ -22, 22 }, /* index 18: 11 bits: 0100111000x */
{ 23, 24 }, /* index 19: 11 bits: 0100111011x */
{ /*-8*/ -39, /*8*/ -23 }, /* index 20: 11 bits: 0100111100x */
{ 25, 26 }, /* index 21: 11 bits: 0100111101x */
{ /*11*/ -20, 27 }, /* index 22: 12 bits: 01001110001x */
{ 28, 29 }, /* index 23: 12 bits: 01001110110x */
{ /*-10*/ -41, /*10*/ -21 }, /* index 24: 12 bits: 01001110111x */
{ 30, 31 }, /* index 25: 12 bits: 01001111010x */
{ 32, /*-9*/ -40 }, /* index 26: 12 bits: 01001111011x */
{ 33, /*-13*/ -44 }, /* index 27: 13 bits: 010011100011x */
{ /*13*/ -18, 34 }, /* index 28: 13 bits: 010011101100x */
{ 35, 36 }, /* index 29: 13 bits: 010011101101x */
{ 37, /*-12*/ -43 }, /* index 30: 13 bits: 010011110100x */
{ /*12*/ -19, 38 }, /* index 31: 13 bits: 010011110101x */
{ 39, /*-11*/ -42 }, /* index 32: 13 bits: 010011110110x */
{ 40, 41 }, /* index 33: 14 bits: 0100111000110x */
{ 42, 43 }, /* index 34: 14 bits: 0100111011001x */
{ 44, 45 }, /* index 35: 14 bits: 0100111011010x */
{ 46, /*-15*/ -46 }, /* index 36: 14 bits: 0100111011011x */
{ /*15*/ -16, 47 }, /* index 37: 14 bits: 0100111101000x */
{ /*-14*/ -45, /*14*/ -17 }, /* index 38: 14 bits: 0100111101011x */
{ 48, 49 }, /* index 39: 14 bits: 0100111101100x */
{ /*-21*/ -52, /*-20*/ -51 }, /* index 40: 15 bits: 01001110001100x */
{ /*18*/ -13, /*19*/ -12 }, /* index 41: 15 bits: 01001110001101x */
{ /*-19*/ -50, /*-18*/ -49 }, /* index 42: 15 bits: 01001110110010x */
{ 50, 51 }, /* index 43: 15 bits: 01001110110011x */
{ 52, 53 }, /* index 44: 15 bits: 01001110110100x */
{ 54, 55 }, /* index 45: 15 bits: 01001110110101x */
{ 56, /*-17*/ -48 }, /* index 46: 15 bits: 01001110110110x */
{ /*17*/ -14, 57 }, /* index 47: 15 bits: 01001111010001x */
{ 58, /*-16*/ -47 }, /* index 48: 15 bits: 01001111011000x */
{ /*16*/ -15, 59 }, /* index 49: 15 bits: 01001111011001x */
{ /*-26*/ -57, /*26*/ -5 }, /* index 50: 16 bits: 010011101100110x */
{ /*-28*/ -59, /*-27*/ -58 }, /* index 51: 16 bits: 010011101100111x */
{ /*29*/ -2, /*30*/ -1 }, /* index 52: 16 bits: 010011101101000x */
{ /*27*/ -4, /*28*/ -3 }, /* index 53: 16 bits: 010011101101001x */
{ /*-30*/ -61, /*-29*/ -60 }, /* index 54: 16 bits: 010011101101010x */
{ /*-25*/ -56, /*25*/ -6 }, /* index 55: 16 bits: 010011101101011x */
{ /*-24*/ -55, /*24*/ -7 }, /* index 56: 16 bits: 010011101101100x */
{ /*-23*/ -54, /*23*/ -8 }, /* index 57: 16 bits: 010011110100011x */
{ /*-22*/ -53, /*22*/ -9 }, /* index 58: 16 bits: 010011110110000x */
{ /*20*/ -11, /*21*/ -10 } /* index 59: 16 bits: 010011110110011x */
};
static const int8_t f_huff_icc[][2] = {
{ /*0*/ -31, 1 }, /* index 0: 1 bits: x */
{ /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */
{ /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */
{ /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */
{ /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */
{ /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */
{ /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */
{ /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */
{ /*5*/ -26, 9 }, /* index 8: 9 bits: 11111111x */
{ /*-4*/ -35, 10 }, /* index 9: 10 bits: 111111111x */
{ /*6*/ -25, 11 }, /* index 10: 11 bits: 1111111111x */
{ /*-5*/ -36, 12 }, /* index 11: 12 bits: 11111111111x */
{ /*7*/ -24, 13 }, /* index 12: 13 bits: 111111111111x */
{ /*-6*/ -37, /*-7*/ -38 } /* index 13: 14 bits: 1111111111111x */
};
static const int8_t t_huff_icc[][2] = {
{ /*0*/ -31, 1 }, /* index 0: 1 bits: x */
{ /*1*/ -30, 2 }, /* index 1: 2 bits: 1x */
{ /*-1*/ -32, 3 }, /* index 2: 3 bits: 11x */
{ /*2*/ -29, 4 }, /* index 3: 4 bits: 111x */
{ /*-2*/ -33, 5 }, /* index 4: 5 bits: 1111x */
{ /*3*/ -28, 6 }, /* index 5: 6 bits: 11111x */
{ /*-3*/ -34, 7 }, /* index 6: 7 bits: 111111x */
{ /*4*/ -27, 8 }, /* index 7: 8 bits: 1111111x */
{ /*-4*/ -35, 9 }, /* index 8: 9 bits: 11111111x */
{ /*5*/ -26, 10 }, /* index 9: 10 bits: 111111111x */
{ /*-5*/ -36, 11 }, /* index 10: 11 bits: 1111111111x */
{ /*6*/ -25, 12 }, /* index 11: 12 bits: 11111111111x */
{ /*-6*/ -37, 13 }, /* index 12: 13 bits: 111111111111x */
{ /*-7*/ -38, /*7*/ -24 } /* index 13: 14 bits: 1111111111111x */
};
static const int8_t f_huff_ipd[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ /*1*/ -30, 4 }, /* index 2: 3 bits: 00x */
{ 5, 6 }, /* index 3: 3 bits: 01x */
{ /*4*/ -27, /*5*/ -26 }, /* index 4: 4 bits: 001x */
{ /*3*/ -28, /*6*/ -25 }, /* index 5: 4 bits: 010x */
{ /*2*/ -29, /*7*/ -24 } /* index 6: 4 bits: 011x */
};
static const int8_t t_huff_ipd[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ 4, 5 }, /* index 2: 3 bits: 00x */
{ /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */
{ /*5*/ -26, 6 }, /* index 4: 4 bits: 000x */
{ /*2*/ -29, /*6*/ -25 }, /* index 5: 4 bits: 001x */
{ /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0001x */
};
static const int8_t f_huff_opd[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ /*7*/ -24, /*1*/ -30 }, /* index 2: 3 bits: 00x */
{ 4, 5 }, /* index 3: 3 bits: 01x */
{ /*3*/ -28, /*6*/ -25 }, /* index 4: 4 bits: 010x */
{ /*2*/ -29, 6 }, /* index 5: 4 bits: 011x */
{ /*5*/ -26, /*4*/ -27 } /* index 6: 5 bits: 0111x */
};
static const int8_t t_huff_opd[][2] = {
{ 1, /*0*/ -31 }, /* index 0: 1 bits: x */
{ 2, 3 }, /* index 1: 2 bits: 0x */
{ 4, 5 }, /* index 2: 3 bits: 00x */
{ /*1*/ -30, /*7*/ -24 }, /* index 3: 3 bits: 01x */
{ /*5*/ -26, /*2*/ -29 }, /* index 4: 4 bits: 000x */
{ /*6*/ -25, 6 }, /* index 5: 4 bits: 001x */
{ /*4*/ -27, /*3*/ -28 } /* index 6: 5 bits: 0011x */
};
/* static function declarations */
static uint16_t ps_extension(ps_info *ps, bitfile *ld,
const uint8_t ps_extension_id,
const uint16_t num_bits_left);
static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par,
ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par);
static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff);
uint16_t ps_data(ps_info *ps, bitfile *ld, uint8_t *header)
{
uint8_t tmp, n;
uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
*header = 0;
/* check for new PS header */
if (faad_get1bit(ld
DEBUGVAR(1,1000,"ps_data(): enable_ps_header")))
{
*header = 1;
ps->header_read = 1;
ps->use34hybrid_bands = 0;
/* Inter-channel Intensity Difference (IID) parameters enabled */
ps->enable_iid = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,1001,"ps_data(): enable_iid"));
if (ps->enable_iid)
{
ps->iid_mode = (uint8_t)faad_getbits(ld, 3
DEBUGVAR(1,1002,"ps_data(): iid_mode"));
ps->nr_iid_par = nr_iid_par_tab[ps->iid_mode];
ps->nr_ipdopd_par = nr_ipdopd_par_tab[ps->iid_mode];
if (ps->iid_mode == 2 || ps->iid_mode == 5)
ps->use34hybrid_bands = 1;
/* IPD freq res equal to IID freq res */
ps->ipd_mode = ps->iid_mode;
}
/* Inter-channel Coherence (ICC) parameters enabled */
ps->enable_icc = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,1003,"ps_data(): enable_icc"));
if (ps->enable_icc)
{
ps->icc_mode = (uint8_t)faad_getbits(ld, 3
DEBUGVAR(1,1004,"ps_data(): icc_mode"));
ps->nr_icc_par = nr_icc_par_tab[ps->icc_mode];
if (ps->icc_mode == 2 || ps->icc_mode == 5)
ps->use34hybrid_bands = 1;
}
/* PS extension layer enabled */
ps->enable_ext = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,1005,"ps_data(): enable_ext"));
}
/* we are here, but no header has been read yet */
if (ps->header_read == 0)
{
ps->ps_data_available = 0;
return 1;
}
ps->frame_class = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,1006,"ps_data(): frame_class"));
tmp = (uint8_t)faad_getbits(ld, 2
DEBUGVAR(1,1007,"ps_data(): num_env_idx"));
ps->num_env = num_env_tab[ps->frame_class][tmp];
if (ps->frame_class)
{
for (n = 1; n < ps->num_env+1; n++)
{
ps->border_position[n] = (uint8_t)faad_getbits(ld, 5
DEBUGVAR(1,1008,"ps_data(): border_position")) + 1;
}
}
if (ps->enable_iid)
{
for (n = 0; n < ps->num_env; n++)
{
ps->iid_dt[n] = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,1009,"ps_data(): iid_dt"));
/* iid_data */
if (ps->iid_mode < 3)
{
huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_def,
f_huff_iid_def, ps->iid_index[n]);
} else {
huff_data(ld, ps->iid_dt[n], ps->nr_iid_par, t_huff_iid_fine,
f_huff_iid_fine, ps->iid_index[n]);
}
}
}
if (ps->enable_icc)
{
for (n = 0; n < ps->num_env; n++)
{
ps->icc_dt[n] = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,1010,"ps_data(): icc_dt"));
/* icc_data */
huff_data(ld, ps->icc_dt[n], ps->nr_icc_par, t_huff_icc,
f_huff_icc, ps->icc_index[n]);
}
}
if (ps->enable_ext)
{
uint16_t num_bits_left;
uint16_t cnt = (uint16_t)faad_getbits(ld, 4
DEBUGVAR(1,1011,"ps_data(): ps_extension_size"));
if (cnt == 15)
{
cnt += (uint16_t)faad_getbits(ld, 8
DEBUGVAR(1,1012,"ps_data(): esc_count"));
}
num_bits_left = 8 * cnt;
while (num_bits_left > 7)
{
uint8_t ps_extension_id = (uint8_t)faad_getbits(ld, 2
DEBUGVAR(1,1013,"ps_data(): ps_extension_size"));
num_bits_left -= 2;
num_bits_left -= ps_extension(ps, ld, ps_extension_id, num_bits_left);
}
faad_getbits(ld, num_bits_left
DEBUGVAR(1,1014,"ps_data(): fill_bits"));
}
bits = (uint16_t)faad_get_processed_bits(ld) - bits;
ps->ps_data_available = 1;
return bits;
}
static uint16_t ps_extension(ps_info *ps, bitfile *ld,
const uint8_t ps_extension_id,
const uint16_t num_bits_left)
{
uint8_t n;
uint16_t bits = (uint16_t)faad_get_processed_bits(ld);
if (ps_extension_id == 0)
{
ps->enable_ipdopd = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,1015,"ps_extension(): enable_ipdopd"));
if (ps->enable_ipdopd)
{
for (n = 0; n < ps->num_env; n++)
{
ps->ipd_dt[n] = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,1016,"ps_extension(): ipd_dt"));
/* ipd_data */
huff_data(ld, ps->ipd_dt[n], ps->nr_ipdopd_par, t_huff_ipd,
f_huff_ipd, ps->ipd_index[n]);
ps->opd_dt[n] = (uint8_t)faad_get1bit(ld
DEBUGVAR(1,1017,"ps_extension(): opd_dt"));
/* opd_data */
huff_data(ld, ps->opd_dt[n], ps->nr_ipdopd_par, t_huff_opd,
f_huff_opd, ps->opd_index[n]);
}
}
faad_get1bit(ld
DEBUGVAR(1,1018,"ps_extension(): reserved_ps"));
}
/* return number of bits read */
bits = (uint16_t)faad_get_processed_bits(ld) - bits;
return bits;
}
/* read huffman data coded in either the frequency or the time direction */
static void huff_data(bitfile *ld, const uint8_t dt, const uint8_t nr_par,
ps_huff_tab t_huff, ps_huff_tab f_huff, int8_t *par)
{
uint8_t n;
if (dt)
{
/* coded in time direction */
for (n = 0; n < nr_par; n++)
{
par[n] = ps_huff_dec(ld, t_huff);
}
} else {
/* coded in frequency direction */
par[0] = ps_huff_dec(ld, f_huff);
for (n = 1; n < nr_par; n++)
{
par[n] = ps_huff_dec(ld, f_huff);
}
}
}
/* binary search huffman decoding */
static INLINE int8_t ps_huff_dec(bitfile *ld, ps_huff_tab t_huff)
{
uint8_t bit;
int16_t index = 0;
while (index >= 0)
{
bit = (uint8_t)faad_get1bit(ld);
index = t_huff[index][bit];
}
return index + 31;
}
#endif

View File

@ -0,0 +1,550 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: ps_tables.h,v 1.8 2007/11/01 12:33:33 menno Exp $
**/
#ifndef __PS_TABLES_H__
#define __PS_TABLES_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MSC_VER
#pragma warning(disable:4305)
#pragma warning(disable:4244)
#endif
#if 0
#if 0
float f_center_20[12] = {
0.5/4, 1.5/4, 2.5/4, 3.5/4,
4.5/4*0, 5.5/4*0, -1.5/4, -0.5/4,
3.5/2, 2.5/2, 4.5/2, 5.5/2
};
#else
float f_center_20[12] = {
0.5/8, 1.5/8, 2.5/8, 3.5/8,
4.5/8*0, 5.5/8*0, -1.5/8, -0.5/8,
3.5/4, 2.5/4, 4.5/4, 5.5/4
};
#endif
float f_center_34[32] = {
1/12, 3/12, 5/12, 7/12,
9/12, 11/12, 13/12, 15/12,
17/12, -5/12, -3/12, -1/12,
17/8, 19/8, 5/8, 7/8,
9/8, 11/8, 13/8, 15/8,
9/4, 11/4, 13/4, 7/4,
17/4, 11/4, 13/4, 15/4,
17/4, 19/4, 21/4, 15/4
};
static const real_t frac_delay_q[] = {
FRAC_CONST(0.43),
FRAC_CONST(0.75),
FRAC_CONST(0.347)
};
#endif
/* RE(ps->Phi_Fract_Qmf[j]) = (float)cos(M_PI*(j+0.5)*(0.39)); */
/* IM(ps->Phi_Fract_Qmf[j]) = (float)sin(M_PI*(j+0.5)*(0.39)); */
static const complex_t Phi_Fract_Qmf[] = {
{ FRAC_CONST(0.8181497455), FRAC_CONST(0.5750052333) },
{ FRAC_CONST(-0.2638730407), FRAC_CONST(0.9645574093) },
{ FRAC_CONST(-0.9969173074), FRAC_CONST(0.0784590989) },
{ FRAC_CONST(-0.4115143716), FRAC_CONST(-0.9114032984) },
{ FRAC_CONST(0.7181262970), FRAC_CONST(-0.6959127784) },
{ FRAC_CONST(0.8980275989), FRAC_CONST(0.4399391711) },
{ FRAC_CONST(-0.1097343117), FRAC_CONST(0.9939609766) },
{ FRAC_CONST(-0.9723699093), FRAC_CONST(0.2334453613) },
{ FRAC_CONST(-0.5490227938), FRAC_CONST(-0.8358073831) },
{ FRAC_CONST(0.6004202366), FRAC_CONST(-0.7996846437) },
{ FRAC_CONST(0.9557930231), FRAC_CONST(0.2940403223) },
{ FRAC_CONST(0.0471064523), FRAC_CONST(0.9988898635) },
{ FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) },
{ FRAC_CONST(-0.6730124950), FRAC_CONST(-0.7396311164) },
{ FRAC_CONST(0.4679298103), FRAC_CONST(-0.8837656379) },
{ FRAC_CONST(0.9900236726), FRAC_CONST(0.1409012377) },
{ FRAC_CONST(0.2027872950), FRAC_CONST(0.9792228341) },
{ FRAC_CONST(-0.8526401520), FRAC_CONST(0.5224985480) },
{ FRAC_CONST(-0.7804304361), FRAC_CONST(-0.6252426505) },
{ FRAC_CONST(0.3239174187), FRAC_CONST(-0.9460853338) },
{ FRAC_CONST(0.9998766184), FRAC_CONST(-0.0157073177) },
{ FRAC_CONST(0.3534748554), FRAC_CONST(0.9354440570) },
{ FRAC_CONST(-0.7604059577), FRAC_CONST(0.6494480371) },
{ FRAC_CONST(-0.8686315417), FRAC_CONST(-0.4954586625) },
{ FRAC_CONST(0.1719291061), FRAC_CONST(-0.9851093292) },
{ FRAC_CONST(0.9851093292), FRAC_CONST(-0.1719291061) },
{ FRAC_CONST(0.4954586625), FRAC_CONST(0.8686315417) },
{ FRAC_CONST(-0.6494480371), FRAC_CONST(0.7604059577) },
{ FRAC_CONST(-0.9354440570), FRAC_CONST(-0.3534748554) },
{ FRAC_CONST(0.0157073177), FRAC_CONST(-0.9998766184) },
{ FRAC_CONST(0.9460853338), FRAC_CONST(-0.3239174187) },
{ FRAC_CONST(0.6252426505), FRAC_CONST(0.7804304361) },
{ FRAC_CONST(-0.5224985480), FRAC_CONST(0.8526401520) },
{ FRAC_CONST(-0.9792228341), FRAC_CONST(-0.2027872950) },
{ FRAC_CONST(-0.1409012377), FRAC_CONST(-0.9900236726) },
{ FRAC_CONST(0.8837656379), FRAC_CONST(-0.4679298103) },
{ FRAC_CONST(0.7396311164), FRAC_CONST(0.6730124950) },
{ FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) },
{ FRAC_CONST(-0.9988898635), FRAC_CONST(-0.0471064523) },
{ FRAC_CONST(-0.2940403223), FRAC_CONST(-0.9557930231) },
{ FRAC_CONST(0.7996846437), FRAC_CONST(-0.6004202366) },
{ FRAC_CONST(0.8358073831), FRAC_CONST(0.5490227938) },
{ FRAC_CONST(-0.2334453613), FRAC_CONST(0.9723699093) },
{ FRAC_CONST(-0.9939609766), FRAC_CONST(0.1097343117) },
{ FRAC_CONST(-0.4399391711), FRAC_CONST(-0.8980275989) },
{ FRAC_CONST(0.6959127784), FRAC_CONST(-0.7181262970) },
{ FRAC_CONST(0.9114032984), FRAC_CONST(0.4115143716) },
{ FRAC_CONST(-0.0784590989), FRAC_CONST(0.9969173074) },
{ FRAC_CONST(-0.9645574093), FRAC_CONST(0.2638730407) },
{ FRAC_CONST(-0.5750052333), FRAC_CONST(-0.8181497455) },
{ FRAC_CONST(0.5750052333), FRAC_CONST(-0.8181497455) },
{ FRAC_CONST(0.9645574093), FRAC_CONST(0.2638730407) },
{ FRAC_CONST(0.0784590989), FRAC_CONST(0.9969173074) },
{ FRAC_CONST(-0.9114032984), FRAC_CONST(0.4115143716) },
{ FRAC_CONST(-0.6959127784), FRAC_CONST(-0.7181262970) },
{ FRAC_CONST(0.4399391711), FRAC_CONST(-0.8980275989) },
{ FRAC_CONST(0.9939609766), FRAC_CONST(0.1097343117) },
{ FRAC_CONST(0.2334453613), FRAC_CONST(0.9723699093) },
{ FRAC_CONST(-0.8358073831), FRAC_CONST(0.5490227938) },
{ FRAC_CONST(-0.7996846437), FRAC_CONST(-0.6004202366) },
{ FRAC_CONST(0.2940403223), FRAC_CONST(-0.9557930231) },
{ FRAC_CONST(0.9988898635), FRAC_CONST(-0.0471064523) },
{ FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) },
{ FRAC_CONST(-0.7396311164), FRAC_CONST(0.6730124950) }
};
/* RE(Phi_Fract_SubQmf20[j]) = (float)cos(M_PI*f_center_20[j]*0.39); */
/* IM(Phi_Fract_SubQmf20[j]) = (float)sin(M_PI*f_center_20[j]*0.39); */
static const complex_t Phi_Fract_SubQmf20[] = {
{ FRAC_CONST(0.9882950187), FRAC_CONST(0.1525546312) },
{ FRAC_CONST(0.8962930441), FRAC_CONST(0.4434623122) },
{ FRAC_CONST(0.7208535671), FRAC_CONST(0.6930873394) },
{ FRAC_CONST(0.4783087075), FRAC_CONST(0.8781917691) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(0.8962930441), FRAC_CONST(-0.4434623122) },
{ FRAC_CONST(0.9882950187), FRAC_CONST(-0.1525546312) },
{ FRAC_CONST(-0.5424415469), FRAC_CONST(0.8400935531) },
{ FRAC_CONST(0.0392598175), FRAC_CONST(0.9992290139) },
{ FRAC_CONST(-0.9268565774), FRAC_CONST(0.3754155636) },
{ FRAC_CONST(-0.9741733670), FRAC_CONST(-0.2258012742) }
};
/* RE(Phi_Fract_SubQmf34[j]) = (float)cos(M_PI*f_center_34[j]*0.39); */
/* IM(Phi_Fract_SubQmf34[j]) = (float)sin(M_PI*f_center_34[j]*0.39); */
static const complex_t Phi_Fract_SubQmf34[] = {
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
{ FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
{ FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
{ FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) },
{ FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
{ FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
{ FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
{ FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
{ FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
{ FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
{ FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
{ FRAC_CONST(0.3387379348), FRAC_CONST(0.9408807755) },
{ FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
{ FRAC_CONST(-0.7705132365), FRAC_CONST(0.6374239922) },
{ FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
{ FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) },
{ FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
{ FRAC_CONST(0.1873813123), FRAC_CONST(-0.9822872281) },
{ FRAC_CONST(0.9876883626), FRAC_CONST(-0.1564344615) },
{ FRAC_CONST(-0.8607420325), FRAC_CONST(-0.5090414286) }
};
/* RE(Q_Fract_allpass_Qmf[j][i]) = (float)cos(M_PI*(j+0.5)*(frac_delay_q[i])); */
/* IM(Q_Fract_allpass_Qmf[j][i]) = (float)sin(M_PI*(j+0.5)*(frac_delay_q[i])); */
static const complex_t Q_Fract_allpass_Qmf[][3] = {
{ { FRAC_CONST(0.7804303765), FRAC_CONST(0.6252426505) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.8550928831), FRAC_CONST(0.5184748173) } },
{ { FRAC_CONST(-0.4399392009), FRAC_CONST(0.8980275393) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.0643581524), FRAC_CONST(0.9979268909) } },
{ { FRAC_CONST(-0.9723699093), FRAC_CONST(-0.2334454209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.9146071672), FRAC_CONST(0.4043435752) } },
{ { FRAC_CONST(0.0157073960), FRAC_CONST(-0.9998766184) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7814115286), FRAC_CONST(-0.6240159869) } },
{ { FRAC_CONST(0.9792228341), FRAC_CONST(-0.2027871907) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.1920081824), FRAC_CONST(-0.9813933372) } },
{ { FRAC_CONST(0.4115142524), FRAC_CONST(0.9114032984) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9589683414), FRAC_CONST(-0.2835132182) } },
{ { FRAC_CONST(-0.7996847630), FRAC_CONST(0.6004201174) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.6947838664), FRAC_CONST(0.7192186117) } },
{ { FRAC_CONST(-0.7604058385), FRAC_CONST(-0.6494481564) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3164770305), FRAC_CONST(0.9486001730) } },
{ { FRAC_CONST(0.4679299891), FRAC_CONST(-0.8837655187) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9874414206), FRAC_CONST(0.1579856575) } },
{ { FRAC_CONST(0.9645573497), FRAC_CONST(0.2638732493) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.5966450572), FRAC_CONST(-0.8025052547) } },
{ { FRAC_CONST(-0.0471066870), FRAC_CONST(0.9988898635) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.4357025325), FRAC_CONST(-0.9000906944) } },
{ { FRAC_CONST(-0.9851093888), FRAC_CONST(0.1719288528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9995546937), FRAC_CONST(-0.0298405960) } },
{ { FRAC_CONST(-0.3826831877), FRAC_CONST(-0.9238796234) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.4886211455), FRAC_CONST(0.8724960685) } },
{ { FRAC_CONST(0.8181498647), FRAC_CONST(-0.5750049949) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.5477093458), FRAC_CONST(0.8366686702) } },
{ { FRAC_CONST(0.7396308780), FRAC_CONST(0.6730127335) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9951074123), FRAC_CONST(-0.0987988561) } },
{ { FRAC_CONST(-0.4954589605), FRAC_CONST(0.8686313629) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.3725017905), FRAC_CONST(-0.9280315042) } },
{ { FRAC_CONST(-0.9557929039), FRAC_CONST(-0.2940406799) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.6506417990), FRAC_CONST(-0.7593847513) } },
{ { FRAC_CONST(0.0784594864), FRAC_CONST(-0.9969173074) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9741733670), FRAC_CONST(0.2258014232) } },
{ { FRAC_CONST(0.9900237322), FRAC_CONST(-0.1409008205) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.2502108514), FRAC_CONST(0.9681913853) } },
{ { FRAC_CONST(0.3534744382), FRAC_CONST(0.9354441762) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.7427945137), FRAC_CONST(0.6695194840) } },
{ { FRAC_CONST(-0.8358076215), FRAC_CONST(0.5490224361) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9370992780), FRAC_CONST(-0.3490629196) } },
{ { FRAC_CONST(-0.7181259394), FRAC_CONST(-0.6959131360) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.1237744763), FRAC_CONST(-0.9923103452) } },
{ { FRAC_CONST(0.5224990249), FRAC_CONST(-0.8526399136) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.8226406574), FRAC_CONST(-0.5685616732) } },
{ { FRAC_CONST(0.9460852146), FRAC_CONST(0.3239179254) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.8844994903), FRAC_CONST(0.4665412009) } },
{ { FRAC_CONST(-0.1097348556), FRAC_CONST(0.9939609170) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.0047125919), FRAC_CONST(0.9999889135) } },
{ { FRAC_CONST(-0.9939610362), FRAC_CONST(0.1097337380) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8888573647), FRAC_CONST(0.4581840038) } },
{ { FRAC_CONST(-0.3239168525), FRAC_CONST(-0.9460855722) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8172453642), FRAC_CONST(-0.5762898922) } },
{ { FRAC_CONST(0.8526405096), FRAC_CONST(-0.5224980116) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.1331215799), FRAC_CONST(-0.9910997152) } },
{ { FRAC_CONST(0.6959123611), FRAC_CONST(0.7181267142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9403476119), FRAC_CONST(-0.3402152061) } },
{ { FRAC_CONST(-0.5490233898), FRAC_CONST(0.8358070254) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7364512086), FRAC_CONST(0.6764906645) } },
{ { FRAC_CONST(-0.9354437590), FRAC_CONST(-0.3534754813) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2593250275), FRAC_CONST(0.9657900929) } },
{ { FRAC_CONST(0.1409019381), FRAC_CONST(-0.9900235534) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9762582779), FRAC_CONST(0.2166097313) } },
{ { FRAC_CONST(0.9969173670), FRAC_CONST(-0.0784583688) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.6434556246), FRAC_CONST(-0.7654833794) } },
{ { FRAC_CONST(0.2940396070), FRAC_CONST(0.9557932615) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3812320232), FRAC_CONST(-0.9244794250) } },
{ { FRAC_CONST(-0.8686318994), FRAC_CONST(0.4954580069) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9959943891), FRAC_CONST(-0.0894154981) } },
{ { FRAC_CONST(-0.6730118990), FRAC_CONST(-0.7396316528) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.5397993922), FRAC_CONST(0.8417937160) } },
{ { FRAC_CONST(0.5750059485), FRAC_CONST(-0.8181492686) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.4968227744), FRAC_CONST(0.8678520322) } },
{ { FRAC_CONST(0.9238792062), FRAC_CONST(0.3826842010) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9992290139), FRAC_CONST(-0.0392601527) } },
{ { FRAC_CONST(-0.1719299555), FRAC_CONST(0.9851091504) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4271997511), FRAC_CONST(-0.9041572809) } },
{ { FRAC_CONST(-0.9988899231), FRAC_CONST(0.0471055657) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.6041822433), FRAC_CONST(-0.7968461514) } },
{ { FRAC_CONST(-0.2638721764), FRAC_CONST(-0.9645576477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9859085083), FRAC_CONST(0.1672853529) } },
{ { FRAC_CONST(0.8837660551), FRAC_CONST(-0.4679289758) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.3075223565), FRAC_CONST(0.9515408874) } },
{ { FRAC_CONST(0.6494473219), FRAC_CONST(0.7604066133) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.7015317082), FRAC_CONST(0.7126382589) } },
{ { FRAC_CONST(-0.6004210114), FRAC_CONST(0.7996840477) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.9562535882), FRAC_CONST(-0.2925389707) } },
{ { FRAC_CONST(-0.9114028811), FRAC_CONST(-0.4115152657) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.1827499419), FRAC_CONST(-0.9831594229) } },
{ { FRAC_CONST(0.2027882934), FRAC_CONST(-0.9792225957) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.7872582674), FRAC_CONST(-0.6166234016) } },
{ { FRAC_CONST(0.9998766780), FRAC_CONST(-0.0157062728) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.9107555747), FRAC_CONST(0.4129458666) } },
{ { FRAC_CONST(0.2334443331), FRAC_CONST(0.9723701477) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.0549497530), FRAC_CONST(0.9984891415) } },
{ { FRAC_CONST(-0.8980280757), FRAC_CONST(0.4399381876) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.8599416018), FRAC_CONST(0.5103924870) } },
{ { FRAC_CONST(-0.6252418160), FRAC_CONST(-0.7804310918) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(-0.8501682281), FRAC_CONST(-0.5265110731) } },
{ { FRAC_CONST(0.6252435446), FRAC_CONST(-0.7804297209) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.0737608299), FRAC_CONST(-0.9972759485) } },
{ { FRAC_CONST(0.8980270624), FRAC_CONST(0.4399402142) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.9183775187), FRAC_CONST(-0.3957053721) } },
{ { FRAC_CONST(-0.2334465086), FRAC_CONST(0.9723696709) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.7754954696), FRAC_CONST(0.6313531399) } },
{ { FRAC_CONST(-0.9998766184), FRAC_CONST(-0.0157085191) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.2012493610), FRAC_CONST(0.9795400500) } },
{ { FRAC_CONST(-0.2027861029), FRAC_CONST(-0.9792230725) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.9615978599), FRAC_CONST(0.2744622827) } },
{ { FRAC_CONST(0.9114037752), FRAC_CONST(-0.4115132093) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.6879743338), FRAC_CONST(-0.7257350087) } },
{ { FRAC_CONST(0.6004192233), FRAC_CONST(0.7996854186) }, { FRAC_CONST(0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(0.3254036009), FRAC_CONST(-0.9455752373) } },
{ { FRAC_CONST(-0.6494490504), FRAC_CONST(0.7604051232) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.9888865948), FRAC_CONST(-0.1486719251) } },
{ { FRAC_CONST(-0.8837650418), FRAC_CONST(-0.4679309726) }, { FRAC_CONST(0.9238795042), FRAC_CONST(-0.3826834261) }, { FRAC_CONST(0.5890548825), FRAC_CONST(0.8080930114) } },
{ { FRAC_CONST(0.2638743520), FRAC_CONST(-0.9645570517) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(0.9238795042) }, { FRAC_CONST(-0.4441666007), FRAC_CONST(0.8959442377) } },
{ { FRAC_CONST(0.9988898039), FRAC_CONST(0.0471078083) }, { FRAC_CONST(-0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(-0.9997915030), FRAC_CONST(0.0204183888) } },
{ { FRAC_CONST(0.1719277352), FRAC_CONST(0.9851095676) }, { FRAC_CONST(0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(-0.4803760946), FRAC_CONST(-0.8770626187) } },
{ { FRAC_CONST(-0.9238800406), FRAC_CONST(0.3826821446) }, { FRAC_CONST(-0.9238795042), FRAC_CONST(0.3826834261) }, { FRAC_CONST(0.5555707216), FRAC_CONST(-0.8314692974) } },
{ { FRAC_CONST(-0.5750041008), FRAC_CONST(-0.8181505203) }, { FRAC_CONST(0.3826834261), FRAC_CONST(-0.9238795042) }, { FRAC_CONST(0.9941320419), FRAC_CONST(0.1081734300) } }
};
/* RE(Q_Fract_allpass_SubQmf20[j][i]) = (float)cos(M_PI*f_center_20[j]*frac_delay_q[i]); */
/* IM(Q_Fract_allpass_SubQmf20[j][i]) = (float)sin(M_PI*f_center_20[j]*frac_delay_q[i]); */
static const complex_t Q_Fract_allpass_SubQmf20[][3] = {
{ { FRAC_CONST(0.9857769012), FRAC_CONST(0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(0.1358452588) } },
{ { FRAC_CONST(0.8744080663), FRAC_CONST(0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(0.3975082636) } },
{ { FRAC_CONST(0.6642524004), FRAC_CONST(0.7475083470) }, { FRAC_CONST(0.0980171412), FRAC_CONST(0.9951847196) }, { FRAC_CONST(0.7767338753), FRAC_CONST(0.6298289299) } },
{ { FRAC_CONST(0.3790524006), FRAC_CONST(0.9253752232) }, { FRAC_CONST(-0.4713967443), FRAC_CONST(0.8819212914) }, { FRAC_CONST(0.5785340071), FRAC_CONST(0.8156582713) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(0.8744080663), FRAC_CONST(-0.4851911962) }, { FRAC_CONST(0.6343932748), FRAC_CONST(-0.7730104327) }, { FRAC_CONST(0.9175986052), FRAC_CONST(-0.3975082636) } },
{ { FRAC_CONST(0.9857769012), FRAC_CONST(-0.1680592746) }, { FRAC_CONST(0.9569403529), FRAC_CONST(-0.2902846634) }, { FRAC_CONST(0.9907300472), FRAC_CONST(-0.1358452588) } },
{ { FRAC_CONST(-0.7126385570), FRAC_CONST(0.7015314102) }, { FRAC_CONST(-0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.3305967748), FRAC_CONST(0.9437720776) } },
{ { FRAC_CONST(-0.1175374240), FRAC_CONST(0.9930684566) }, { FRAC_CONST(-0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(0.2066311091), FRAC_CONST(0.9784189463) } },
{ { FRAC_CONST(-0.9947921634), FRAC_CONST(0.1019244045) }, { FRAC_CONST(0.5555702448), FRAC_CONST(-0.8314695954) }, { FRAC_CONST(-0.7720130086), FRAC_CONST(0.6356067061) } },
{ { FRAC_CONST(-0.8400934935), FRAC_CONST(-0.5424416065) }, { FRAC_CONST(0.9807852507), FRAC_CONST(0.1950903237) }, { FRAC_CONST(-0.9896889329), FRAC_CONST(0.1432335079) } }
};
/* RE(Q_Fract_allpass_SubQmf34[j][i]) = (float)cos(M_PI*f_center_34[j]*frac_delay_q[i]); */
/* IM(Q_Fract_allpass_SubQmf34[j][i]) = (float)sin(M_PI*f_center_34[j]*frac_delay_q[i]); */
static const complex_t Q_Fract_allpass_SubQmf34[][3] = {
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
{ { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
{ { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
{ { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(1.0000000000), FRAC_CONST(0.0000000000) } },
{ { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
{ { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
{ { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
{ { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
{ { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
{ { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
{ { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
{ { FRAC_CONST(0.2181432247), FRAC_CONST(0.9759167433) }, { FRAC_CONST(-0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(0.4623677433), FRAC_CONST(0.8866882324) } },
{ { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
{ { FRAC_CONST(-0.9048270583), FRAC_CONST(0.4257792532) }, { FRAC_CONST(-0.0000000000), FRAC_CONST(-1.0000000000) }, { FRAC_CONST(-0.5724321604), FRAC_CONST(0.8199520707) } },
{ { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
{ { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } },
{ { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
{ { FRAC_CONST(0.6374240518), FRAC_CONST(-0.7705131769) }, { FRAC_CONST(-1.0000000000), FRAC_CONST(0.0000000000) }, { FRAC_CONST(-0.3446428776), FRAC_CONST(-0.9387338758) } },
{ { FRAC_CONST(0.8910064697), FRAC_CONST(0.4539906085) }, { FRAC_CONST(0.7071067691), FRAC_CONST(-0.7071067691) }, { FRAC_CONST(0.6730125546), FRAC_CONST(-0.7396310568) } },
{ { FRAC_CONST(-0.6129069924), FRAC_CONST(-0.7901550531) }, { FRAC_CONST(0.7071067691), FRAC_CONST(0.7071067691) }, { FRAC_CONST(-0.9917160273), FRAC_CONST(-0.1284494549) } }
};
#if 0
static float quant_rho[8] =
{
FRAC_CONST(1.0), FRAC_CONST(0.937), FRAC_CONST(0.84118), FRAC_CONST(0.60092),
FRAC_CONST(0.36764), FRAC_CONST(0.0), FRAC_CONST(-0.589), FRAC_CONST(-1.0)
};
static const uint8_t quant_iid_normal[7] =
{
2, 4, 7, 10, 14, 18, 25
};
static const uint8_t quant_iid_fine[15] =
{
2, 4, 6, 8, 10, 13, 16, 19, 22, 25, 30, 35, 40, 45, 50
};
#endif
static const real_t cos_alphas[] = {
COEF_CONST(1.0000000000), COEF_CONST(0.9841239700), COEF_CONST(0.9594738210),
COEF_CONST(0.8946843079), COEF_CONST(0.8269340931), COEF_CONST(0.7071067812),
COEF_CONST(0.4533210856), COEF_CONST(0.0000000000)
};
static const real_t sin_alphas[] = {
COEF_CONST(0.0000000000), COEF_CONST(0.1774824264), COEF_CONST(0.2817977763),
COEF_CONST(0.4466989918), COEF_CONST(0.5622988580), COEF_CONST(0.7071067812),
COEF_CONST(0.8913472911), COEF_CONST(1.0000000000)
};
static const real_t cos_betas_normal[][8] = {
{ COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9959398908), COEF_CONST(0.9896038018), COEF_CONST(0.9727589768), COEF_CONST(0.9548355329), COEF_CONST(0.9223070404), COEF_CONST(0.8494349490), COEF_CONST(0.7013005535) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9902068095), COEF_CONST(0.9749613872), COEF_CONST(0.9346538534), COEF_CONST(0.8921231300), COEF_CONST(0.8158851259), COEF_CONST(0.6495964302), COEF_CONST(0.3313370772) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9880510933), COEF_CONST(0.9694670261), COEF_CONST(0.9204347876), COEF_CONST(0.8688622825), COEF_CONST(0.7768516704), COEF_CONST(0.5782161800), COEF_CONST(0.2069970356) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) }
};
static const real_t sin_betas_normal[][8] = {
{ COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.0900207420), COEF_CONST(-0.1438204281), COEF_CONST(-0.2318188366), COEF_CONST(-0.2971348264), COEF_CONST(-0.3864579191), COEF_CONST(-0.5276933461), COEF_CONST(-0.7128657193) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1396082894), COEF_CONST(-0.2223742196), COEF_CONST(-0.3555589603), COEF_CONST(-0.4517923427), COEF_CONST(-0.5782140273), COEF_CONST(-0.7602792104), COEF_CONST(-0.9435124489) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1541266914), COEF_CONST(-0.2452217065), COEF_CONST(-0.3908961522), COEF_CONST(-0.4950538699), COEF_CONST(-0.6296836366), COEF_CONST(-0.8158836002), COEF_CONST(-0.9783415698) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) }
};
static const real_t cos_betas_fine[][8] = {
{ COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000), COEF_CONST(1.0000000000) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9995871699), COEF_CONST(0.9989419133), COEF_CONST(0.9972204583), COEF_CONST(0.9953790839), COEF_CONST(0.9920112747), COEF_CONST(0.9843408180), COEF_CONST(0.9681727381) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9984497744), COEF_CONST(0.9960279377), COEF_CONST(0.9895738413), COEF_CONST(0.9826814632), COEF_CONST(0.9701058164), COEF_CONST(0.9416098832), COEF_CONST(0.8822105900) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9968361371), COEF_CONST(0.9918968104), COEF_CONST(0.9787540479), COEF_CONST(0.9647515190), COEF_CONST(0.9392903010), COEF_CONST(0.8820167114), COEF_CONST(0.7645325390) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9950262915), COEF_CONST(0.9872675041), COEF_CONST(0.9666584578), COEF_CONST(0.9447588606), COEF_CONST(0.9050918405), COEF_CONST(0.8165997379), COEF_CONST(0.6383824796) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9932417400), COEF_CONST(0.9827071856), COEF_CONST(0.9547730996), COEF_CONST(0.9251668930), COEF_CONST(0.8717461589), COEF_CONST(0.7535520592), COEF_CONST(0.5198827312) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9908827998), COEF_CONST(0.9766855904), COEF_CONST(0.9391249214), COEF_CONST(0.8994531782), COEF_CONST(0.8282352693), COEF_CONST(0.6723983174), COEF_CONST(0.3719473225) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9890240165), COEF_CONST(0.9719459866), COEF_CONST(0.9268448110), COEF_CONST(0.8793388536), COEF_CONST(0.7944023271), COEF_CONST(0.6101812098), COEF_CONST(0.2621501145) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9876350461), COEF_CONST(0.9684073447), COEF_CONST(0.9176973944), COEF_CONST(0.8643930070), COEF_CONST(0.7693796058), COEF_CONST(0.5646720713), COEF_CONST(0.1838899556) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9866247085), COEF_CONST(0.9658349704), COEF_CONST(0.9110590761), COEF_CONST(0.8535668048), COEF_CONST(0.7513165426), COEF_CONST(0.5320914819), COEF_CONST(0.1289530943) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9858996945), COEF_CONST(0.9639898866), COEF_CONST(0.9063034786), COEF_CONST(0.8458214608), COEF_CONST(0.7384262300), COEF_CONST(0.5089811277), COEF_CONST(0.0905465944) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9851245614), COEF_CONST(0.9620180268), COEF_CONST(0.9012265590), COEF_CONST(0.8375623272), COEF_CONST(0.7247108045), COEF_CONST(0.4845204297), COEF_CONST(0.0504115003) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9846869856), COEF_CONST(0.9609052357), COEF_CONST(0.8983639533), COEF_CONST(0.8329098386), COEF_CONST(0.7169983441), COEF_CONST(0.4708245354), COEF_CONST(0.0281732509) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9844406325), COEF_CONST(0.9602788522), COEF_CONST(0.8967533934), COEF_CONST(0.8302936455), COEF_CONST(0.7126658102), COEF_CONST(0.4631492839), COEF_CONST(0.0157851140) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9843020502), COEF_CONST(0.9599265269), COEF_CONST(0.8958477331), COEF_CONST(0.8288229094), COEF_CONST(0.7102315840), COEF_CONST(0.4588429315), COEF_CONST(0.0088578059) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9842241136), COEF_CONST(0.9597283916), COEF_CONST(0.8953385094), COEF_CONST(0.8279961409), COEF_CONST(0.7088635748), COEF_CONST(0.4564246834), COEF_CONST(0.0049751355) }
};
static const real_t sin_betas_fine[][8] = {
{ COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000), COEF_CONST(0.0000000000) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.0287313368), COEF_CONST(-0.0459897147), COEF_CONST(-0.0745074328), COEF_CONST(-0.0960233266), COEF_CONST(-0.1261492408), COEF_CONST(-0.1762757894), COEF_CONST(-0.2502829383) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.0556601118), COEF_CONST(-0.0890412670), COEF_CONST(-0.1440264301), COEF_CONST(-0.1853028382), COEF_CONST(-0.2426823129), COEF_CONST(-0.3367058477), COEF_CONST(-0.4708550466) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.0794840594), COEF_CONST(-0.1270461238), COEF_CONST(-0.2050378347), COEF_CONST(-0.2631625097), COEF_CONST(-0.3431234916), COEF_CONST(-0.4712181245), COEF_CONST(-0.6445851354) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.0996126459), COEF_CONST(-0.1590687758), COEF_CONST(-0.2560691819), COEF_CONST(-0.3277662204), COEF_CONST(-0.4252161335), COEF_CONST(-0.5772043556), COEF_CONST(-0.7697193058) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1160639735), COEF_CONST(-0.1851663774), COEF_CONST(-0.2973353800), COEF_CONST(-0.3795605619), COEF_CONST(-0.4899577884), COEF_CONST(-0.6573882369), COEF_CONST(-0.8542376401) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1347266752), COEF_CONST(-0.2146747714), COEF_CONST(-0.3435758752), COEF_CONST(-0.4370171396), COEF_CONST(-0.5603805303), COEF_CONST(-0.7401895046), COEF_CONST(-0.9282538388) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1477548470), COEF_CONST(-0.2352041647), COEF_CONST(-0.3754446647), COEF_CONST(-0.4761965776), COEF_CONST(-0.6073919186), COEF_CONST(-0.7922618830), COEF_CONST(-0.9650271071) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1567705832), COEF_CONST(-0.2493736450), COEF_CONST(-0.3972801182), COEF_CONST(-0.5028167951), COEF_CONST(-0.6387918458), COEF_CONST(-0.8253153651), COEF_CONST(-0.9829468369) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1630082348), COEF_CONST(-0.2591578860), COEF_CONST(-0.4122758299), COEF_CONST(-0.5209834064), COEF_CONST(-0.6599420072), COEF_CONST(-0.8466868694), COEF_CONST(-0.9916506943) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1673373610), COEF_CONST(-0.2659389001), COEF_CONST(-0.4226275012), COEF_CONST(-0.5334660781), COEF_CONST(-0.6743342664), COEF_CONST(-0.8607776784), COEF_CONST(-0.9958922202) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1718417832), COEF_CONST(-0.2729859267), COEF_CONST(-0.4333482310), COEF_CONST(-0.5463417868), COEF_CONST(-0.6890531546), COEF_CONST(-0.8747799456), COEF_CONST(-0.9987285320) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1743316967), COEF_CONST(-0.2768774604), COEF_CONST(-0.4392518725), COEF_CONST(-0.5534087104), COEF_CONST(-0.6970748701), COEF_CONST(-0.8822268738), COEF_CONST(-0.9996030552) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1757175038), COEF_CONST(-0.2790421580), COEF_CONST(-0.4425306221), COEF_CONST(-0.5573261722), COEF_CONST(-0.7015037013), COEF_CONST(-0.8862802834), COEF_CONST(-0.9998754073) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1764921355), COEF_CONST(-0.2802517850), COEF_CONST(-0.4443611583), COEF_CONST(-0.5595110229), COEF_CONST(-0.7039681080), COEF_CONST(-0.8885173967), COEF_CONST(-0.9999607689) },
{ COEF_CONST(0.0000000000), COEF_CONST(-0.1769262394), COEF_CONST(-0.2809295540), COEF_CONST(-0.4453862969), COEF_CONST(-0.5607337966), COEF_CONST(-0.7053456119), COEF_CONST(-0.8897620516), COEF_CONST(-0.9999876239) }
};
static const real_t sincos_alphas_B_normal[][8] = {
{ COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) },
{ COEF_CONST(0.1249065138), COEF_CONST(0.1173697697), COEF_CONST(0.1057888284), COEF_CONST(0.0761985131), COEF_CONST(0.0468732723), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103), COEF_CONST(0.0063956103) },
{ COEF_CONST(0.1956693050), COEF_CONST(0.1846090179), COEF_CONST(0.1673645109), COEF_CONST(0.1220621836), COEF_CONST(0.0757362479), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630), COEF_CONST(0.0103882630) },
{ COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) },
{ COEF_CONST(0.4078449476), COEF_CONST(0.3929852420), COEF_CONST(0.3680589270), COEF_CONST(0.2911029124), COEF_CONST(0.1934512363), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716), COEF_CONST(0.0278686716) },
{ COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) },
{ COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) },
{ COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) },
{ COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) },
{ COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) },
{ COEF_CONST(0.9130511848), COEF_CONST(0.9195447612), COEF_CONST(0.9298024282), COEF_CONST(0.9566917233), COEF_CONST(0.9811098801), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928), COEF_CONST(0.9996115928) },
{ COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) },
{ COEF_CONST(0.9806699215), COEF_CONST(0.9828120260), COEF_CONST(0.9858950861), COEF_CONST(0.9925224431), COEF_CONST(0.9971278825), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406), COEF_CONST(0.9999460406) },
{ COEF_CONST(0.9921685024), COEF_CONST(0.9930882705), COEF_CONST(0.9943886135), COEF_CONST(0.9970926648), COEF_CONST(0.9989008403), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479), COEF_CONST(0.9999795479) },
{ COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) }
};
static const real_t sincos_alphas_B_fine[][8] = {
{ COEF_CONST(0.0031622158), COEF_CONST(0.0029630181), COEF_CONST(0.0026599892), COEF_CONST(0.0019002704), COEF_CONST(0.0011626042), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278), COEF_CONST(0.0001580278) },
{ COEF_CONST(0.0056232673), COEF_CONST(0.0052689825), COEF_CONST(0.0047302825), COEF_CONST(0.0033791756), COEF_CONST(0.0020674015), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710), COEF_CONST(0.0002811710) },
{ COEF_CONST(0.0099994225), COEF_CONST(0.0093696693), COEF_CONST(0.0084117414), COEF_CONST(0.0060093796), COEF_CONST(0.0036766009), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392), COEF_CONST(0.0005000392) },
{ COEF_CONST(0.0177799194), COEF_CONST(0.0166607102), COEF_CONST(0.0149581377), COEF_CONST(0.0106875809), COEF_CONST(0.0065392545), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767), COEF_CONST(0.0008893767) },
{ COEF_CONST(0.0316069684), COEF_CONST(0.0296211579), COEF_CONST(0.0265987295), COEF_CONST(0.0190113813), COEF_CONST(0.0116349973), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974), COEF_CONST(0.0015826974) },
{ COEF_CONST(0.0561454100), COEF_CONST(0.0526385859), COEF_CONST(0.0472937334), COEF_CONST(0.0338410641), COEF_CONST(0.0207261065), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635), COEF_CONST(0.0028205635) },
{ COEF_CONST(0.0791834041), COEF_CONST(0.0742798103), COEF_CONST(0.0667907269), COEF_CONST(0.0478705292), COEF_CONST(0.0293500747), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755), COEF_CONST(0.0039966755) },
{ COEF_CONST(0.1115021177), COEF_CONST(0.1047141985), COEF_CONST(0.0943053154), COEF_CONST(0.0678120561), COEF_CONST(0.0416669150), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213), COEF_CONST(0.0056813213) },
{ COEF_CONST(0.1565355066), COEF_CONST(0.1473258371), COEF_CONST(0.1330924027), COEF_CONST(0.0963282233), COEF_CONST(0.0594509113), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946), COEF_CONST(0.0081277946) },
{ COEF_CONST(0.2184643682), COEF_CONST(0.2064579524), COEF_CONST(0.1876265439), COEF_CONST(0.1375744167), COEF_CONST(0.0856896681), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338), COEF_CONST(0.0117817338) },
{ COEF_CONST(0.3015113269), COEF_CONST(0.2870525790), COEF_CONST(0.2637738799), COEF_CONST(0.1984573949), COEF_CONST(0.1260749909), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126), COEF_CONST(0.0175600126) },
{ COEF_CONST(0.3698741335), COEF_CONST(0.3547727297), COEF_CONST(0.3298252076), COEF_CONST(0.2556265829), COEF_CONST(0.1665990017), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541), COEF_CONST(0.0236344541) },
{ COEF_CONST(0.4480623975), COEF_CONST(0.4339410024), COEF_CONST(0.4098613774), COEF_CONST(0.3322709108), COEF_CONST(0.2266784729), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131), COEF_CONST(0.0334094131) },
{ COEF_CONST(0.5336171261), COEF_CONST(0.5226637762), COEF_CONST(0.5033652606), COEF_CONST(0.4349162672), COEF_CONST(0.3224682122), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036), COEF_CONST(0.0521999036) },
{ COEF_CONST(0.6219832023), COEF_CONST(0.6161847276), COEF_CONST(0.6057251063), COEF_CONST(0.5654342668), COEF_CONST(0.4826149915), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758), COEF_CONST(0.1058044758) },
{ COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657), COEF_CONST(0.7071067657) },
{ COEF_CONST(0.7830305572), COEF_CONST(0.7876016373), COEF_CONST(0.7956739618), COEF_CONST(0.8247933372), COEF_CONST(0.8758325942), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542), COEF_CONST(0.9943869542) },
{ COEF_CONST(0.8457261833), COEF_CONST(0.8525388778), COEF_CONST(0.8640737401), COEF_CONST(0.9004708933), COEF_CONST(0.9465802987), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532), COEF_CONST(0.9986366532) },
{ COEF_CONST(0.8940022267), COEF_CONST(0.9009412572), COEF_CONST(0.9121477564), COEF_CONST(0.9431839770), COEF_CONST(0.9739696219), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480), COEF_CONST(0.9994417480) },
{ COEF_CONST(0.9290818561), COEF_CONST(0.9349525662), COEF_CONST(0.9440420138), COEF_CONST(0.9667755833), COEF_CONST(0.9860247275), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664), COEF_CONST(0.9997206664) },
{ COEF_CONST(0.9534625907), COEF_CONST(0.9579148236), COEF_CONST(0.9645845234), COEF_CONST(0.9801095128), COEF_CONST(0.9920207064), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099), COEF_CONST(0.9998458099) },
{ COEF_CONST(0.9758449068), COEF_CONST(0.9784554646), COEF_CONST(0.9822404252), COEF_CONST(0.9904914275), COEF_CONST(0.9963218730), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926), COEF_CONST(0.9999305926) },
{ COEF_CONST(0.9876723320), COEF_CONST(0.9890880155), COEF_CONST(0.9911036356), COEF_CONST(0.9953496173), COEF_CONST(0.9982312259), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685), COEF_CONST(0.9999669685) },
{ COEF_CONST(0.9937641889), COEF_CONST(0.9945023501), COEF_CONST(0.9955433130), COEF_CONST(0.9976981117), COEF_CONST(0.9991315558), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610), COEF_CONST(0.9999838610) },
{ COEF_CONST(0.9968600642), COEF_CONST(0.9972374385), COEF_CONST(0.9977670024), COEF_CONST(0.9988535464), COEF_CONST(0.9995691924), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129), COEF_CONST(0.9999920129) },
{ COEF_CONST(0.9984226014), COEF_CONST(0.9986136287), COEF_CONST(0.9988810254), COEF_CONST(0.9994272242), COEF_CONST(0.9997851906), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221), COEF_CONST(0.9999960221) },
{ COEF_CONST(0.9995003746), COEF_CONST(0.9995611974), COEF_CONST(0.9996461891), COEF_CONST(0.9998192657), COEF_CONST(0.9999323103), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475), COEF_CONST(0.9999987475) },
{ COEF_CONST(0.9998419236), COEF_CONST(0.9998611991), COEF_CONST(0.9998881193), COEF_CONST(0.9999428861), COEF_CONST(0.9999786185), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045), COEF_CONST(0.9999996045) },
{ COEF_CONST(0.9999500038), COEF_CONST(0.9999561034), COEF_CONST(0.9999646206), COEF_CONST(0.9999819429), COEF_CONST(0.9999932409), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750), COEF_CONST(0.9999998750) },
{ COEF_CONST(0.9999841890), COEF_CONST(0.9999861183), COEF_CONST(0.9999888121), COEF_CONST(0.9999942902), COEF_CONST(0.9999978628), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605), COEF_CONST(0.9999999605) },
{ COEF_CONST(0.9999950000), COEF_CONST(0.9999956102), COEF_CONST(0.9999964621), COEF_CONST(0.9999981945), COEF_CONST(0.9999993242), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875), COEF_CONST(0.9999999875) }
};
static const real_t cos_gammas_normal[][8] = {
{ COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9913533967), COEF_CONST(0.9786000177), COEF_CONST(0.9496063381), COEF_CONST(0.9277157252), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077), COEF_CONST(0.9133354077) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9977406278), COEF_CONST(0.9945423840), COEF_CONST(0.9878736667), COEF_CONST(0.9833980494), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440), COEF_CONST(0.9807207440) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9990607067), COEF_CONST(0.9977417734), COEF_CONST(0.9950323970), COEF_CONST(0.9932453273), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740), COEF_CONST(0.9921884740) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) }
};
static const real_t cos_gammas_fine[][8] = {
{ COEF_CONST(1.0000000000), COEF_CONST(0.9841239707), COEF_CONST(0.9594738226), COEF_CONST(0.8946843024), COEF_CONST(0.8269341029), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486), COEF_CONST(0.7245688486) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9849690570), COEF_CONST(0.9617776789), COEF_CONST(0.9020941550), COEF_CONST(0.8436830391), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804), COEF_CONST(0.7846832804) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9871656089), COEF_CONST(0.9676774734), COEF_CONST(0.9199102884), COEF_CONST(0.8785067015), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214), COEF_CONST(0.8464232214) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9899597309), COEF_CONST(0.9750098690), COEF_CONST(0.9402333855), COEF_CONST(0.9129698759), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944), COEF_CONST(0.8943765944) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9926607607), COEF_CONST(0.9819295710), COEF_CONST(0.9580160104), COEF_CONST(0.9404993670), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472), COEF_CONST(0.9293004472) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9948924435), COEF_CONST(0.9875319180), COEF_CONST(0.9716329849), COEF_CONST(0.9604805241), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574), COEF_CONST(0.9535949574) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9972074644), COEF_CONST(0.9932414270), COEF_CONST(0.9849197629), COEF_CONST(0.9792926592), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525), COEF_CONST(0.9759092525) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9985361982), COEF_CONST(0.9964742028), COEF_CONST(0.9922136306), COEF_CONST(0.9893845420), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371), COEF_CONST(0.9877041371) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9992494366), COEF_CONST(0.9981967170), COEF_CONST(0.9960386625), COEF_CONST(0.9946185834), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239), COEF_CONST(0.9937800239) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9996194722), COEF_CONST(0.9990869422), COEF_CONST(0.9979996269), COEF_CONST(0.9972873651), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747), COEF_CONST(0.9968679747) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9998081748), COEF_CONST(0.9995400312), COEF_CONST(0.9989936459), COEF_CONST(0.9986365356), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591), COEF_CONST(0.9984265591) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9999390971), COEF_CONST(0.9998540271), COEF_CONST(0.9996809352), COEF_CONST(0.9995679735), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284), COEF_CONST(0.9995016284) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9999807170), COEF_CONST(0.9999537862), COEF_CONST(0.9998990191), COEF_CONST(0.9998632947), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208), COEF_CONST(0.9998423208) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9999938979), COEF_CONST(0.9999853814), COEF_CONST(0.9999680568), COEF_CONST(0.9999567596), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270), COEF_CONST(0.9999501270) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9999980703), COEF_CONST(0.9999953731), COEF_CONST(0.9999898968), COEF_CONST(0.9999863277), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265), COEF_CONST(0.9999842265) },
{ COEF_CONST(1.0000000000), COEF_CONST(0.9999993891), COEF_CONST(0.9999985397), COEF_CONST(0.9999968037), COEF_CONST(0.9999956786), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155), COEF_CONST(0.9999950155) }
};
static const real_t sin_gammas_normal[][8] = {
{ COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.1312190642), COEF_CONST(0.2057717310), COEF_CONST(0.3134450552), COEF_CONST(0.3732874674), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955), COEF_CONST(0.4072080955) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0671836269), COEF_CONST(0.1043333428), COEF_CONST(0.1552598422), COEF_CONST(0.1814615013), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885), COEF_CONST(0.1954144885) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0433324862), COEF_CONST(0.0671666110), COEF_CONST(0.0995516398), COEF_CONST(0.1160332699), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739), COEF_CONST(0.1247478739) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) }
};
static const real_t sin_gammas_fine[][8] = {
{ COEF_CONST(0.0000000000), COEF_CONST(0.1774824223), COEF_CONST(0.2817977711), COEF_CONST(0.4466990028), COEF_CONST(0.5622988435), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258), COEF_CONST(0.6892024258) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.1727308798), COEF_CONST(0.2738315110), COEF_CONST(0.4315392630), COEF_CONST(0.5368416242), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861), COEF_CONST(0.6198968861) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.1596999079), COEF_CONST(0.2521910140), COEF_CONST(0.3921288836), COEF_CONST(0.4777300236), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795), COEF_CONST(0.5325107795) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.1413496768), COEF_CONST(0.2221615526), COEF_CONST(0.3405307340), COEF_CONST(0.4080269669), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744), COEF_CONST(0.4473147744) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.1209322714), COEF_CONST(0.1892467110), COEF_CONST(0.2867147079), COEF_CONST(0.3397954394), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252), COEF_CONST(0.3693246252) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.1009407043), COEF_CONST(0.1574189028), COEF_CONST(0.2364938532), COEF_CONST(0.2783471983), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396), COEF_CONST(0.3010924396) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0746811420), COEF_CONST(0.1160666523), COEF_CONST(0.1730117353), COEF_CONST(0.2024497161), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341), COEF_CONST(0.2181768341) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0540875291), COEF_CONST(0.0838997203), COEF_CONST(0.1245476266), COEF_CONST(0.1453211203), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972), COEF_CONST(0.1563346972) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0387371058), COEF_CONST(0.0600276114), COEF_CONST(0.0889212171), COEF_CONST(0.1036044086), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634), COEF_CONST(0.1113609634) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0275846110), COEF_CONST(0.0427233177), COEF_CONST(0.0632198125), COEF_CONST(0.0736064637), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596), COEF_CONST(0.0790837596) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0195860576), COEF_CONST(0.0303269852), COEF_CONST(0.0448519274), COEF_CONST(0.0522022017), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040), COEF_CONST(0.0560750040) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0110363955), COEF_CONST(0.0170857974), COEF_CONST(0.0252592108), COEF_CONST(0.0293916021), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054), COEF_CONST(0.0315673054) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0062101284), COEF_CONST(0.0096138203), COEF_CONST(0.0142109649), COEF_CONST(0.0165345659), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316), COEF_CONST(0.0177576316) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0034934509), COEF_CONST(0.0054071189), COEF_CONST(0.0079928316), COEF_CONST(0.0092994041), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631), COEF_CONST(0.0099871631) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0019645397), COEF_CONST(0.0030419905), COEF_CONST(0.0044951511), COEF_CONST(0.0052291853), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498), COEF_CONST(0.0056166498) },
{ COEF_CONST(0.0000000000), COEF_CONST(0.0011053943), COEF_CONST(0.0017089869), COEF_CONST(0.0025283670), COEF_CONST(0.0029398552), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685), COEF_CONST(0.0031573685) }
};
static const real_t sf_iid_normal[] = {
COEF_CONST(1.4119827747), COEF_CONST(1.4031381607), COEF_CONST(1.3868767023),
COEF_CONST(1.3483997583), COEF_CONST(1.2912493944), COEF_CONST(1.1960374117),
COEF_CONST(1.1073724031), COEF_CONST(1.0000000000), COEF_CONST(0.8796171546),
COEF_CONST(0.7546485662), COEF_CONST(0.5767799020), COEF_CONST(0.4264014363),
COEF_CONST(0.2767182887), COEF_CONST(0.1766446233), COEF_CONST(0.0794016272)
};
static const real_t sf_iid_fine[] = {
COEF_CONST(1.4142065048), COEF_CONST(1.4141912460), COEF_CONST(1.4141428471),
COEF_CONST(1.4139900208), COEF_CONST(1.4135069847), COEF_CONST(1.4119827747),
COEF_CONST(1.4097729921), COEF_CONST(1.4053947926), COEF_CONST(1.3967796564),
COEF_CONST(1.3800530434), COEF_CONST(1.3483997583), COEF_CONST(1.3139201403),
COEF_CONST(1.2643101215), COEF_CONST(1.1960374117), COEF_CONST(1.1073724031),
COEF_CONST(1.0000000000), COEF_CONST(0.8796171546), COEF_CONST(0.7546485662),
COEF_CONST(0.6336560845), COEF_CONST(0.5230810642), COEF_CONST(0.4264014363),
COEF_CONST(0.3089554012), COEF_CONST(0.2213746458), COEF_CONST(0.1576878875),
COEF_CONST(0.1119822487), COEF_CONST(0.0794016272), COEF_CONST(0.0446990170),
COEF_CONST(0.0251446925), COEF_CONST(0.0141414283), COEF_CONST(0.0079525812),
COEF_CONST(0.0044721137)
};
#ifdef __cplusplus
}
#endif
#endif

113
src/contrib/aacdecoder/libfaad/pulse.c Normal file → Executable file
View File

@ -1,55 +1,58 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: pulse.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#include "syntax.h"
#include "pulse.h"
uint8_t pulse_decode(ic_stream *ics, int16_t *spec_data, uint16_t framelen)
{
uint8_t i;
uint16_t k;
pulse_info *pul = &(ics->pul);
k = ics->swb_offset[pul->pulse_start_sfb];
for(i = 0; i <= pul->number_pulse; i++) {
k += pul->pulse_offset[i];
if (k >= framelen)
return 15; /* should not be possible */
if (spec_data[k] > 0)
spec_data[k] += pul->pulse_amp[i];
else
spec_data[k] -= pul->pulse_amp[i];
}
return 0;
}
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: pulse.c,v 1.21 2007/11/01 12:33:34 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include "syntax.h"
#include "pulse.h"
uint8_t pulse_decode(ic_stream *ics, int16_t *spec_data, uint16_t framelen)
{
uint8_t i;
uint16_t k;
pulse_info *pul = &(ics->pul);
k = min(ics->swb_offset[pul->pulse_start_sfb], ics->swb_offset_max);
for (i = 0; i <= pul->number_pulse; i++)
{
k += pul->pulse_offset[i];
if (k >= framelen)
return 15; /* should not be possible */
if (spec_data[k] > 0)
spec_data[k] += pul->pulse_amp[i];
else
spec_data[k] -= pul->pulse_amp[i];
}
return 0;
}

83
src/contrib/aacdecoder/libfaad/pulse.h Normal file → Executable file
View File

@ -1,40 +1,43 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: pulse.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __PULSE_H__
#define __PULSE_H__
#ifdef __cplusplus
extern "C" {
#endif
uint8_t pulse_decode(ic_stream *ics, int16_t *spec_coef, uint16_t framelen);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: pulse.h,v 1.20 2007/11/01 12:33:34 menno Exp $
**/
#ifndef __PULSE_H__
#define __PULSE_H__
#ifdef __cplusplus
extern "C" {
#endif
uint8_t pulse_decode(ic_stream *ics, int16_t *spec_coef, uint16_t framelen);
#ifdef __cplusplus
}
#endif
#endif

1063
src/contrib/aacdecoder/libfaad/rvlc.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

109
src/contrib/aacdecoder/libfaad/rvlc.h Normal file → Executable file
View File

@ -1,53 +1,56 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: rvlc.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __RVLC_SCF_H__
#define __RVLC_SCF_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
int8_t index;
uint8_t len;
uint32_t cw;
} rvlc_huff_table;
#define ESC_VAL 7
uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld);
uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: rvlc.h,v 1.17 2007/11/01 12:33:34 menno Exp $
**/
#ifndef __RVLC_SCF_H__
#define __RVLC_SCF_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
int8_t index;
uint8_t len;
uint32_t cw;
} rvlc_huff_table;
#define ESC_VAL 7
uint8_t rvlc_scale_factor_data(ic_stream *ics, bitfile *ld);
uint8_t rvlc_decode_scale_factors(ic_stream *ics, bitfile *ld);
#ifdef __cplusplus
}
#endif
#endif

5090
src/contrib/aacdecoder/libfaad/sbr_dct.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

98
src/contrib/aacdecoder/libfaad/sbr_dct.h Normal file → Executable file
View File

@ -1,46 +1,52 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_dct.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_DCT_H__
#define __SBR_DCT_H__
#ifdef __cplusplus
extern "C" {
#endif
void DCT3_32_unscaled(real_t *y, real_t *x);
void DCT2_64_unscaled(real_t *y, real_t *x);
void DST2_64_unscaled(real_t *y, real_t *x);
void DCT4_64(real_t *y, real_t *x);
void DCT4_64_kernel(real_t *y, real_t *t2);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_dct.h,v 1.19 2007/11/01 12:33:34 menno Exp $
**/
#ifndef __SBR_DCT_H__
#define __SBR_DCT_H__
#ifdef __cplusplus
extern "C" {
#endif
void dct4_kernel(real_t * in_real, real_t * in_imag, real_t * out_real, real_t * out_imag);
void DCT3_32_unscaled(real_t *y, real_t *x);
void DCT4_32(real_t *y, real_t *x);
void DST4_32(real_t *y, real_t *x);
void DCT2_32_unscaled(real_t *y, real_t *x);
void DCT4_16(real_t *y, real_t *x);
void DCT2_16_unscaled(real_t *y, real_t *x);
#ifdef __cplusplus
}
#endif
#endif

1169
src/contrib/aacdecoder/libfaad/sbr_dec.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

493
src/contrib/aacdecoder/libfaad/sbr_dec.h Normal file → Executable file
View File

@ -1,239 +1,254 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_dec.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_DEC_H__
#define __SBR_DEC_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef PS_DEC
#include "ps_dec.h"
#endif
#ifdef DRM_PS
#include "drm_dec.h"
#endif
/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */
#define MAX_NTSRHFG 40
#define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
typedef struct {
real_t *x;
uint8_t channels;
} qmfa_info;
typedef struct {
real_t *v[2];
uint8_t v_index;
uint8_t channels;
#ifdef USE_SSE
void (*qmf_func)(void *a, void *b, void *c, void *d);
#endif
} qmfs_info;
typedef struct
{
uint32_t sample_rate;
uint8_t rate;
uint8_t just_seeked;
uint8_t ret;
uint8_t amp_res[2];
uint8_t k0;
uint8_t kx;
uint8_t M;
uint8_t N_master;
uint8_t N_high;
uint8_t N_low;
uint8_t N_Q;
uint8_t N_L[4];
uint8_t n[2];
uint8_t f_master[64];
uint8_t f_table_res[2][64];
uint8_t f_table_noise[64];
uint8_t f_table_lim[4][64];
#ifdef SBR_LOW_POWER
uint8_t f_group[5][64];
uint8_t N_G[5];
#endif
uint8_t table_map_k_to_g[64];
uint8_t abs_bord_lead[2];
uint8_t abs_bord_trail[2];
uint8_t n_rel_lead[2];
uint8_t n_rel_trail[2];
uint8_t L_E[2];
uint8_t L_E_prev[2];
uint8_t L_Q[2];
uint8_t t_E[2][6];
uint8_t t_Q[2][3];
uint8_t f[2][6];
uint8_t f_prev[2];
real_t *G_temp_prev[2][5];
real_t *Q_temp_prev[2][5];
int16_t E[2][64][5];
int16_t E_prev[2][64];
real_t E_orig[2][64][5];
real_t E_curr[2][64][5];
int32_t Q[2][64][2];
int32_t Q_prev[2][64];
real_t Q_orig[2][64][2];
int8_t l_A[2];
int8_t l_A_prev[2];
uint8_t bs_invf_mode[2][5];
uint8_t bs_invf_mode_prev[2][5];
real_t bwArray[2][64];
real_t bwArray_prev[2][64];
uint8_t noPatches;
uint8_t patchNoSubbands[64];
uint8_t patchStartSubband[64];
uint8_t bs_add_harmonic[2][64];
uint8_t bs_add_harmonic_prev[2][64];
uint16_t index_noise_prev[2];
uint8_t psi_is_prev[2];
uint8_t bs_start_freq_prev;
uint8_t bs_stop_freq_prev;
uint8_t bs_xover_band_prev;
uint8_t bs_freq_scale_prev;
uint8_t bs_alter_scale_prev;
uint8_t bs_noise_bands_prev;
int8_t prevEnvIsShort[2];
int8_t kx_prev;
uint8_t Reset;
uint32_t frame;
uint32_t header_count;
uint8_t id_aac;
qmfa_info *qmfa[2];
qmfs_info *qmfs[2];
qmf_t Xsbr[2][MAX_NTSRHFG][64];
qmf_t Xcodec[2][MAX_NTSRHFG][32];
#ifdef DRM
int8_t lcstereo_flag;
uint8_t bs_dataextra;
uint8_t Is_DRM_SBR;
#ifdef DRM_PS
drm_ps_info drm_ps;
#endif
#endif
uint8_t numTimeSlotsRate;
uint8_t numTimeSlots;
uint8_t tHFGen;
uint8_t tHFAdj;
#ifdef PS_DEC
ps_info ps;
#endif
#if (defined(PS_DEC) || defined(DRM_PS))
uint8_t ps_used;
#endif
/* to get it compiling */
/* we'll see during the coding of all the tools, whether
these are all used or not.
*/
uint8_t bs_header_flag;
uint8_t bs_crc_flag;
uint16_t bs_sbr_crc_bits;
uint8_t bs_protocol_version;
uint8_t bs_amp_res;
uint8_t bs_start_freq;
uint8_t bs_stop_freq;
uint8_t bs_xover_band;
uint8_t bs_freq_scale;
uint8_t bs_alter_scale;
uint8_t bs_noise_bands;
uint8_t bs_limiter_bands;
uint8_t bs_limiter_gains;
uint8_t bs_interpol_freq;
uint8_t bs_smoothing_mode;
uint8_t bs_samplerate_mode;
uint8_t bs_add_harmonic_flag[2];
uint8_t bs_add_harmonic_flag_prev[2];
uint8_t bs_extended_data;
uint8_t bs_extension_id;
uint8_t bs_extension_data;
uint8_t bs_coupling;
uint8_t bs_frame_class[2];
uint8_t bs_rel_bord[2][9];
uint8_t bs_rel_bord_0[2][9];
uint8_t bs_rel_bord_1[2][9];
uint8_t bs_pointer[2];
uint8_t bs_abs_bord_0[2];
uint8_t bs_abs_bord_1[2];
uint8_t bs_num_rel_0[2];
uint8_t bs_num_rel_1[2];
uint8_t bs_df_env[2][9];
uint8_t bs_df_noise[2][3];
} sbr_info;
sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
uint32_t sample_rate
#ifdef DRM
, uint8_t IsDRM
#endif
);
void sbrDecodeEnd(sbr_info *sbr);
uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
const uint8_t just_seeked, const uint8_t upsample_only);
uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
const uint8_t just_seeked, const uint8_t upsample_only);
#if (defined(PS_DEC) || defined(DRM_PS))
uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
const uint8_t just_seeked, const uint8_t upsample_only);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_dec.h,v 1.39 2007/11/01 12:33:34 menno Exp $
**/
#ifndef __SBR_DEC_H__
#define __SBR_DEC_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef PS_DEC
#include "ps_dec.h"
#endif
#ifdef DRM_PS
#include "drm_dec.h"
#endif
/* MAX_NTSRHFG: maximum of number_time_slots * rate + HFGen. 16*2+8 */
#define MAX_NTSRHFG 40
#define MAX_NTSR 32 /* max number_time_slots * rate, ok for DRM and not DRM mode */
/* MAX_M: maximum value for M */
#define MAX_M 49
/* MAX_L_E: maximum value for L_E */
#define MAX_L_E 5
typedef struct {
real_t *x;
int16_t x_index;
uint8_t channels;
} qmfa_info;
typedef struct {
real_t *v;
int16_t v_index;
uint8_t channels;
} qmfs_info;
typedef struct
{
uint32_t sample_rate;
uint32_t maxAACLine;
uint8_t rate;
uint8_t just_seeked;
uint8_t ret;
uint8_t amp_res[2];
uint8_t k0;
uint8_t kx;
uint8_t M;
uint8_t N_master;
uint8_t N_high;
uint8_t N_low;
uint8_t N_Q;
uint8_t N_L[4];
uint8_t n[2];
uint8_t f_master[64];
uint8_t f_table_res[2][64];
uint8_t f_table_noise[64];
uint8_t f_table_lim[4][64];
#ifdef SBR_LOW_POWER
uint8_t f_group[5][64];
uint8_t N_G[5];
#endif
uint8_t table_map_k_to_g[64];
uint8_t abs_bord_lead[2];
uint8_t abs_bord_trail[2];
uint8_t n_rel_lead[2];
uint8_t n_rel_trail[2];
uint8_t L_E[2];
uint8_t L_E_prev[2];
uint8_t L_Q[2];
uint8_t t_E[2][MAX_L_E+1];
uint8_t t_Q[2][3];
uint8_t f[2][MAX_L_E+1];
uint8_t f_prev[2];
real_t *G_temp_prev[2][5];
real_t *Q_temp_prev[2][5];
int8_t GQ_ringbuf_index[2];
int16_t E[2][64][MAX_L_E];
int16_t E_prev[2][64];
#ifndef FIXED_POINT
real_t E_orig[2][64][MAX_L_E];
#endif
real_t E_curr[2][64][MAX_L_E];
int32_t Q[2][64][2];
#ifndef FIXED_POINT
real_t Q_div[2][64][2];
real_t Q_div2[2][64][2];
#endif
int32_t Q_prev[2][64];
int8_t l_A[2];
int8_t l_A_prev[2];
uint8_t bs_invf_mode[2][MAX_L_E];
uint8_t bs_invf_mode_prev[2][MAX_L_E];
real_t bwArray[2][64];
real_t bwArray_prev[2][64];
uint8_t noPatches;
uint8_t patchNoSubbands[64];
uint8_t patchStartSubband[64];
uint8_t bs_add_harmonic[2][64];
uint8_t bs_add_harmonic_prev[2][64];
uint16_t index_noise_prev[2];
uint8_t psi_is_prev[2];
uint8_t bs_start_freq_prev;
uint8_t bs_stop_freq_prev;
uint8_t bs_xover_band_prev;
uint8_t bs_freq_scale_prev;
uint8_t bs_alter_scale_prev;
uint8_t bs_noise_bands_prev;
int8_t prevEnvIsShort[2];
int8_t kx_prev;
uint8_t bsco;
uint8_t bsco_prev;
uint8_t M_prev;
uint16_t frame_len;
uint8_t Reset;
uint32_t frame;
uint32_t header_count;
uint8_t id_aac;
qmfa_info *qmfa[2];
qmfs_info *qmfs[2];
qmf_t Xsbr[2][MAX_NTSRHFG][64];
#ifdef DRM
uint8_t Is_DRM_SBR;
#ifdef DRM_PS
drm_ps_info *drm_ps;
#endif
#endif
uint8_t numTimeSlotsRate;
uint8_t numTimeSlots;
uint8_t tHFGen;
uint8_t tHFAdj;
#ifdef PS_DEC
ps_info *ps;
#endif
#if (defined(PS_DEC) || defined(DRM_PS))
uint8_t ps_used;
uint8_t psResetFlag;
#endif
/* to get it compiling */
/* we'll see during the coding of all the tools, whether
these are all used or not.
*/
uint8_t bs_header_flag;
uint8_t bs_crc_flag;
uint16_t bs_sbr_crc_bits;
uint8_t bs_protocol_version;
uint8_t bs_amp_res;
uint8_t bs_start_freq;
uint8_t bs_stop_freq;
uint8_t bs_xover_band;
uint8_t bs_freq_scale;
uint8_t bs_alter_scale;
uint8_t bs_noise_bands;
uint8_t bs_limiter_bands;
uint8_t bs_limiter_gains;
uint8_t bs_interpol_freq;
uint8_t bs_smoothing_mode;
uint8_t bs_samplerate_mode;
uint8_t bs_add_harmonic_flag[2];
uint8_t bs_add_harmonic_flag_prev[2];
uint8_t bs_extended_data;
uint8_t bs_extension_id;
uint8_t bs_extension_data;
uint8_t bs_coupling;
uint8_t bs_frame_class[2];
uint8_t bs_rel_bord[2][9];
uint8_t bs_rel_bord_0[2][9];
uint8_t bs_rel_bord_1[2][9];
uint8_t bs_pointer[2];
uint8_t bs_abs_bord_0[2];
uint8_t bs_abs_bord_1[2];
uint8_t bs_num_rel_0[2];
uint8_t bs_num_rel_1[2];
uint8_t bs_df_env[2][9];
uint8_t bs_df_noise[2][3];
} sbr_info;
sbr_info *sbrDecodeInit(uint16_t framelength, uint8_t id_aac,
uint32_t sample_rate, uint8_t downSampledSBR
#ifdef DRM
, uint8_t IsDRM
#endif
);
void sbrDecodeEnd(sbr_info *sbr);
void sbrReset(sbr_info *sbr);
uint8_t sbrDecodeCoupleFrame(sbr_info *sbr, real_t *left_chan, real_t *right_chan,
const uint8_t just_seeked, const uint8_t downSampledSBR);
uint8_t sbrDecodeSingleFrame(sbr_info *sbr, real_t *channel,
const uint8_t just_seeked, const uint8_t downSampledSBR);
#if (defined(PS_DEC) || defined(DRM_PS))
uint8_t sbrDecodeSingleFramePS(sbr_info *sbr, real_t *left_channel, real_t *right_channel,
const uint8_t just_seeked, const uint8_t downSampledSBR);
#endif
#ifdef __cplusplus
}
#endif
#endif

860
src/contrib/aacdecoder/libfaad/sbr_e_nf.c Normal file → Executable file
View File

@ -1,350 +1,510 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_e_nf.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef SBR_DEC
#include <stdlib.h>
#include "sbr_syntax.h"
#include "sbr_e_nf.h"
ALIGN static const real_t pow2deq[] = {
REAL_CONST(2.9103830456733704E-011), REAL_CONST(5.8207660913467407E-011),
REAL_CONST(1.1641532182693481E-010), REAL_CONST(2.3283064365386963E-010),
REAL_CONST(4.6566128730773926E-010), REAL_CONST(9.3132257461547852E-010),
REAL_CONST(1.862645149230957E-009), REAL_CONST(3.7252902984619141E-009),
REAL_CONST(7.4505805969238281E-009), REAL_CONST(1.4901161193847656E-008),
REAL_CONST(2.9802322387695313E-008), REAL_CONST(5.9604644775390625E-008),
REAL_CONST(1.1920928955078125E-007), REAL_CONST(2.384185791015625E-007),
REAL_CONST(4.76837158203125E-007), REAL_CONST(9.5367431640625E-007),
REAL_CONST(1.9073486328125E-006), REAL_CONST(3.814697265625E-006),
REAL_CONST(7.62939453125E-006), REAL_CONST(1.52587890625E-005),
REAL_CONST(3.0517578125E-005), REAL_CONST(6.103515625E-005),
REAL_CONST(0.0001220703125), REAL_CONST(0.000244140625),
REAL_CONST(0.00048828125), REAL_CONST(0.0009765625),
REAL_CONST(0.001953125), REAL_CONST(0.00390625),
REAL_CONST(0.0078125), REAL_CONST(0.015625),
REAL_CONST(0.03125), REAL_CONST(0.0625),
REAL_CONST(0.125), REAL_CONST(0.25),
REAL_CONST(0.5), REAL_CONST(1.0),
REAL_CONST(2.0), REAL_CONST(4.0),
REAL_CONST(8.0), REAL_CONST(16.0),
REAL_CONST(32.0), REAL_CONST(64.0),
REAL_CONST(128.0), REAL_CONST(256.0),
REAL_CONST(512.0), REAL_CONST(1024.0),
REAL_CONST(2048.0), REAL_CONST(4096.0),
REAL_CONST(8192.0), REAL_CONST(16384.0),
REAL_CONST(32768.0), REAL_CONST(65536.0),
REAL_CONST(131072.0), REAL_CONST(262144.0),
REAL_CONST(524288.0), REAL_CONST(1048576.0),
REAL_CONST(2097152.0), REAL_CONST(4194304.0),
REAL_CONST(8388608.0), REAL_CONST(16777216.0),
REAL_CONST(33554432.0), REAL_CONST(67108864.0),
REAL_CONST(134217728.0), REAL_CONST(268435456.0),
REAL_CONST(536870912.0), REAL_CONST(1073741824.0),
REAL_CONST(2147483648.0), REAL_CONST(4294967296.0),
REAL_CONST(8589934592.0), REAL_CONST(17179869184.0),
REAL_CONST(34359738368.0), REAL_CONST(68719476736.0),
REAL_CONST(137438953472.0), REAL_CONST(274877906944.0),
REAL_CONST(549755813888.0), REAL_CONST(1099511627776.0),
REAL_CONST(2199023255552.0), REAL_CONST(4398046511104.0),
REAL_CONST(8796093022208.0), REAL_CONST(17592186044416.0),
REAL_CONST(35184372088832.0), REAL_CONST(70368744177664.0),
REAL_CONST(140737488355328.0), REAL_CONST(281474976710656.0),
REAL_CONST(562949953421312.0), REAL_CONST(1125899906842624.0),
REAL_CONST(2251799813685248.0), REAL_CONST(4503599627370496.0),
REAL_CONST(9007199254740992.0), REAL_CONST(18014398509481984.0),
REAL_CONST(36028797018963968.0), REAL_CONST(72057594037927936.0),
REAL_CONST(144115188075855870.0), REAL_CONST(288230376151711740.0),
REAL_CONST(576460752303423490.0), REAL_CONST(1152921504606847000.0),
REAL_CONST(2305843009213694000.0), REAL_CONST(4611686018427387900.0),
REAL_CONST(9223372036854775800.0), REAL_CONST(1.8446744073709552E+019),
REAL_CONST(3.6893488147419103E+019), REAL_CONST(7.3786976294838206E+019),
REAL_CONST(1.4757395258967641E+020), REAL_CONST(2.9514790517935283E+020),
REAL_CONST(5.9029581035870565E+020), REAL_CONST(1.1805916207174113E+021),
REAL_CONST(2.3611832414348226E+021), REAL_CONST(4.7223664828696452E+021),
REAL_CONST(9.4447329657392904E+021), REAL_CONST(1.8889465931478581E+022),
REAL_CONST(3.7778931862957162E+022), REAL_CONST(7.5557863725914323E+022),
REAL_CONST(1.5111572745182865E+023), REAL_CONST(3.0223145490365729E+023),
REAL_CONST(6.0446290980731459E+023), REAL_CONST(1.2089258196146292E+024),
REAL_CONST(2.4178516392292583E+024), REAL_CONST(4.8357032784585167E+024),
REAL_CONST(9.6714065569170334E+024), REAL_CONST(1.9342813113834067E+025),
REAL_CONST(3.8685626227668134E+025), REAL_CONST(7.7371252455336267E+025),
REAL_CONST(1.5474250491067253E+026), REAL_CONST(3.0948500982134507E+026),
REAL_CONST(6.1897001964269014E+026), REAL_CONST(1.2379400392853803E+027),
REAL_CONST(2.4758800785707605E+027)
};
/* 1.0 / (1.0 + pow(2.0, x - 12) */
ALIGN static const real_t pow2deq_rcp[] = {
FRAC_CONST(0.99975591896509641),
FRAC_CONST(0.99951195705222062),
FRAC_CONST(0.99902439024390244),
FRAC_CONST(0.99805068226120852),
FRAC_CONST(0.99610894941634243),
FRAC_CONST(0.99224806201550386),
FRAC_CONST(0.98461538461538467),
FRAC_CONST(0.96969696969696972),
FRAC_CONST(0.94117647058823528),
FRAC_CONST(0.88888888888888884),
FRAC_CONST(0.80000000000000004),
FRAC_CONST(0.66666666666666663),
FRAC_CONST(0.5),
FRAC_CONST(0.33333333333333331),
FRAC_CONST(0.20000000000000001),
FRAC_CONST(0.1111111111111111),
FRAC_CONST(0.058823529411764705),
FRAC_CONST(0.030303030303030304),
FRAC_CONST(0.015384615384615385),
FRAC_CONST(0.0077519379844961239),
FRAC_CONST(0.0038910505836575876),
FRAC_CONST(0.0019493177387914229),
FRAC_CONST(0.00097560975609756097),
FRAC_CONST(0.0004880429477794046),
FRAC_CONST(0.00024408103490358799),
FRAC_CONST(0.00012205541315757354),
FRAC_CONST(6.1031431187061336E-005),
FRAC_CONST(3.0516646830846227E-005),
FRAC_CONST(1.5258556235409006E-005),
FRAC_CONST(7.6293363240331724E-006),
FRAC_CONST(3.8146827137652828E-006),
FRAC_CONST(1.9073449948406318E-006),
FRAC_CONST(9.5367340691241559E-007)
};
void extract_envelope_data(sbr_info *sbr, uint8_t ch)
{
uint8_t l, k;
for (l = 0; l < sbr->L_E[ch]; l++)
{
if (sbr->bs_df_env[ch][l] == 0)
{
for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++)
{
sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l];
}
} else { /* bs_df_env == 1 */
uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1];
int16_t E_prev;
if (sbr->f[ch][l] == g)
{
for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
if (l == 0)
E_prev = sbr->E_prev[ch][k];
else
E_prev = sbr->E[ch][k][l - 1];
sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
}
} else if ((g == 1) && (sbr->f[ch][l] == 0)) {
uint8_t i;
for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
for (i = 0; i < sbr->N_high; i++)
{
if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k])
{
if (l == 0)
E_prev = sbr->E_prev[ch][i];
else
E_prev = sbr->E[ch][i][l - 1];
sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
}
}
}
} else if ((g == 0) && (sbr->f[ch][l] == 1)) {
uint8_t i;
for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
for (i = 0; i < sbr->N_low; i++)
{
if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) &&
(sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1]))
{
if (l == 0)
E_prev = sbr->E_prev[ch][i];
else
E_prev = sbr->E[ch][i][l - 1];
sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
}
}
}
}
}
}
}
void extract_noise_floor_data(sbr_info *sbr, uint8_t ch)
{
uint8_t l, k;
for (l = 0; l < sbr->L_Q[ch]; l++)
{
if (sbr->bs_df_noise[ch][l] == 0)
{
for (k = 1; k < sbr->N_Q; k++)
{
sbr->Q[ch][k][l] = sbr->Q[ch][k][l] + sbr->Q[ch][k-1][l];
}
} else {
if (l == 0)
{
for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0];
}
} else {
for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q[ch][k][l] = sbr->Q[ch][k][l - 1] + sbr->Q[ch][k][l];
}
}
}
}
}
void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
{
if (sbr->bs_coupling == 0)
{
int16_t exp;
uint8_t l, k;
uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
for (l = 0; l < sbr->L_E[ch]; l++)
{
for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
/* +6 for the *64 and -10 for the /32 in the synthesis QMF
* since this is a energy value: (x/32)^2 = (x^2)/1024
*/
exp = (sbr->E[ch][k][l] >> amp) + 6;
if ((exp < -P2_TABLE_OFFSET) || (exp > P2_TABLE_MAX))
{
sbr->E_orig[ch][k][l] = 0;
} else {
/* FIXED POINT TODO: E_orig: INTEGER!! */
sbr->E_orig[ch][k][l] = pow2deq[exp + P2_TABLE_OFFSET];
/* save half the table size at the cost of 1 multiply */
if (amp && (sbr->E[ch][k][l] & 1))
{
sbr->E_orig[ch][k][l] = MUL_R(sbr->E_orig[ch][k][l], REAL_CONST(1.414213562));
}
}
}
}
for (l = 0; l < sbr->L_Q[ch]; l++)
{
for (k = 0; k < sbr->N_Q; k++)
{
if (sbr->Q[ch][k][l] < 0 || sbr->Q[ch][k][l] > 30)
{
sbr->Q_orig[ch][k][l] = 0;
} else {
exp = NOISE_FLOOR_OFFSET - sbr->Q[ch][k][l];
sbr->Q_orig[ch][k][l] = pow2deq[exp + P2_TABLE_OFFSET];
}
}
}
}
}
void unmap_envelope_noise(sbr_info *sbr)
{
real_t tmp;
int16_t exp0, exp1;
uint8_t l, k;
uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
for (l = 0; l < sbr->L_E[0]; l++)
{
for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
{
/* +6: * 64 ; +1: * 2 ; -10: /1024 QMF */
exp0 = (sbr->E[0][k][l] >> amp0) + 7;
/* UN_MAP removed: (x / 4096) same as (x >> 12) */
/* E[1] is always even so no need for compensating the divide by 2 with
* an extra multiplication
*/
exp1 = (sbr->E[1][k][l] >> amp1) - 12;
if ((exp0 < -P2_TABLE_OFFSET) || (exp0 > P2_TABLE_MAX) ||
(exp1 < -P2_TABLE_RCP_OFFSET) || (exp1 > P2_TABLE_RCP_MAX))
{
sbr->E_orig[1][k][l] = 0;
sbr->E_orig[0][k][l] = 0;
} else {
tmp = pow2deq[exp0 + P2_TABLE_OFFSET];
if (amp0 && (sbr->E[0][k][l] & 1))
tmp = MUL_R(tmp, REAL_CONST(1.414213562));
/* FIXED POINT TODO: E_orig: INTEGER!! */
sbr->E_orig[1][k][l] = MUL_F(tmp, pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
sbr->E_orig[0][k][l] = MUL_R(sbr->E_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
}
}
}
for (l = 0; l < sbr->L_Q[0]; l++)
{
for (k = 0; k < sbr->N_Q; k++)
{
if ((sbr->Q[0][k][l] < 0 || sbr->Q[0][k][l] > 30) ||
(sbr->Q[1][k][l] < 0 || sbr->Q[1][k][l] > 24 /* 2*panOffset(1) */))
{
sbr->Q_orig[0][k][l] = 0;
sbr->Q_orig[1][k][l] = 0;
} else {
exp0 = NOISE_FLOOR_OFFSET - sbr->Q[0][k][l] + 1;
exp1 = sbr->Q[1][k][l] - 12;
sbr->Q_orig[1][k][l] = MUL_F(pow2deq[exp0 + P2_TABLE_OFFSET], pow2deq_rcp[exp1 + P2_TABLE_RCP_OFFSET]);
sbr->Q_orig[0][k][l] = MUL_R(sbr->Q_orig[1][k][l], pow2deq[exp1 + P2_TABLE_OFFSET]);
}
}
}
}
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_e_nf.c,v 1.22 2008/03/23 23:03:29 menno Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef SBR_DEC
#include <stdlib.h>
#include "sbr_syntax.h"
#include "sbr_e_nf.h"
void extract_envelope_data(sbr_info *sbr, uint8_t ch)
{
uint8_t l, k;
for (l = 0; l < sbr->L_E[ch]; l++)
{
if (sbr->bs_df_env[ch][l] == 0)
{
for (k = 1; k < sbr->n[sbr->f[ch][l]]; k++)
{
sbr->E[ch][k][l] = sbr->E[ch][k - 1][l] + sbr->E[ch][k][l];
if (sbr->E[ch][k][l] < 0)
sbr->E[ch][k][l] = 0;
}
} else { /* bs_df_env == 1 */
uint8_t g = (l == 0) ? sbr->f_prev[ch] : sbr->f[ch][l-1];
int16_t E_prev;
if (sbr->f[ch][l] == g)
{
for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
if (l == 0)
E_prev = sbr->E_prev[ch][k];
else
E_prev = sbr->E[ch][k][l - 1];
sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
}
} else if ((g == 1) && (sbr->f[ch][l] == 0)) {
uint8_t i;
for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
for (i = 0; i < sbr->N_high; i++)
{
if (sbr->f_table_res[HI_RES][i] == sbr->f_table_res[LO_RES][k])
{
if (l == 0)
E_prev = sbr->E_prev[ch][i];
else
E_prev = sbr->E[ch][i][l - 1];
sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
}
}
}
} else if ((g == 0) && (sbr->f[ch][l] == 1)) {
uint8_t i;
for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
for (i = 0; i < sbr->N_low; i++)
{
if ((sbr->f_table_res[LO_RES][i] <= sbr->f_table_res[HI_RES][k]) &&
(sbr->f_table_res[HI_RES][k] < sbr->f_table_res[LO_RES][i + 1]))
{
if (l == 0)
E_prev = sbr->E_prev[ch][i];
else
E_prev = sbr->E[ch][i][l - 1];
sbr->E[ch][k][l] = E_prev + sbr->E[ch][k][l];
}
}
}
}
}
}
}
void extract_noise_floor_data(sbr_info *sbr, uint8_t ch)
{
uint8_t l, k;
for (l = 0; l < sbr->L_Q[ch]; l++)
{
if (sbr->bs_df_noise[ch][l] == 0)
{
for (k = 1; k < sbr->N_Q; k++)
{
sbr->Q[ch][k][l] = sbr->Q[ch][k][l] + sbr->Q[ch][k-1][l];
}
} else {
if (l == 0)
{
for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q[ch][k][l] = sbr->Q_prev[ch][k] + sbr->Q[ch][k][0];
}
} else {
for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q[ch][k][l] = sbr->Q[ch][k][l - 1] + sbr->Q[ch][k][l];
}
}
}
}
}
#ifndef FIXED_POINT
/* table for Q_div values when no coupling */
static const real_t Q_div_tab[31] = {
FRAC_CONST(0.0153846), FRAC_CONST(0.030303),
FRAC_CONST(0.0588235), FRAC_CONST(0.111111),
FRAC_CONST(0.2), FRAC_CONST(0.333333),
FRAC_CONST(0.5), FRAC_CONST(0.666667),
FRAC_CONST(0.8), FRAC_CONST(0.888889),
FRAC_CONST(0.941176), FRAC_CONST(0.969697),
FRAC_CONST(0.984615), FRAC_CONST(0.992248),
FRAC_CONST(0.996109), FRAC_CONST(0.998051),
FRAC_CONST(0.999024), FRAC_CONST(0.999512),
FRAC_CONST(0.999756), FRAC_CONST(0.999878),
FRAC_CONST(0.999939), FRAC_CONST(0.999969),
FRAC_CONST(0.999985), FRAC_CONST(0.999992),
FRAC_CONST(0.999996), FRAC_CONST(0.999998),
FRAC_CONST(0.999999), FRAC_CONST(1),
FRAC_CONST(1), FRAC_CONST(1),
FRAC_CONST(1)
};
static const real_t Q_div_tab_left[31][13] = {
{ FRAC_CONST(0.969704), FRAC_CONST(0.888985), FRAC_CONST(0.667532), FRAC_CONST(0.336788), FRAC_CONST(0.117241), FRAC_CONST(0.037594), FRAC_CONST(0.0153846), FRAC_CONST(0.00967118), FRAC_CONST(0.00823245), FRAC_CONST(0.00787211), FRAC_CONST(0.00778198), FRAC_CONST(0.00775945), FRAC_CONST(0.00775382) },
{ FRAC_CONST(0.984619), FRAC_CONST(0.94123), FRAC_CONST(0.800623), FRAC_CONST(0.503876), FRAC_CONST(0.209877), FRAC_CONST(0.0724638), FRAC_CONST(0.030303), FRAC_CONST(0.0191571), FRAC_CONST(0.0163305), FRAC_CONST(0.0156212), FRAC_CONST(0.0154438), FRAC_CONST(0.0153994), FRAC_CONST(0.0153883) },
{ FRAC_CONST(0.99225), FRAC_CONST(0.969726), FRAC_CONST(0.889273), FRAC_CONST(0.670103), FRAC_CONST(0.346939), FRAC_CONST(0.135135), FRAC_CONST(0.0588235), FRAC_CONST(0.037594), FRAC_CONST(0.0321361), FRAC_CONST(0.0307619), FRAC_CONST(0.0304178), FRAC_CONST(0.0303317), FRAC_CONST(0.0303102) },
{ FRAC_CONST(0.99611), FRAC_CONST(0.98463), FRAC_CONST(0.941392), FRAC_CONST(0.802469), FRAC_CONST(0.515152), FRAC_CONST(0.238095), FRAC_CONST(0.111111), FRAC_CONST(0.0724638), FRAC_CONST(0.0622711), FRAC_CONST(0.0596878), FRAC_CONST(0.0590397), FRAC_CONST(0.0588776), FRAC_CONST(0.058837) },
{ FRAC_CONST(0.998051), FRAC_CONST(0.992256), FRAC_CONST(0.969811), FRAC_CONST(0.890411), FRAC_CONST(0.68), FRAC_CONST(0.384615), FRAC_CONST(0.2), FRAC_CONST(0.135135), FRAC_CONST(0.117241), FRAC_CONST(0.112652), FRAC_CONST(0.111497), FRAC_CONST(0.111208), FRAC_CONST(0.111135) },
{ FRAC_CONST(0.999025), FRAC_CONST(0.996113), FRAC_CONST(0.984674), FRAC_CONST(0.942029), FRAC_CONST(0.809524), FRAC_CONST(0.555556), FRAC_CONST(0.333333), FRAC_CONST(0.238095), FRAC_CONST(0.209877), FRAC_CONST(0.202492), FRAC_CONST(0.200625), FRAC_CONST(0.200156), FRAC_CONST(0.200039) },
{ FRAC_CONST(0.999512), FRAC_CONST(0.998053), FRAC_CONST(0.992278), FRAC_CONST(0.970149), FRAC_CONST(0.894737), FRAC_CONST(0.714286), FRAC_CONST(0.5), FRAC_CONST(0.384615), FRAC_CONST(0.346939), FRAC_CONST(0.336788), FRAC_CONST(0.3342), FRAC_CONST(0.33355), FRAC_CONST(0.333388) },
{ FRAC_CONST(0.999756), FRAC_CONST(0.999025), FRAC_CONST(0.996124), FRAC_CONST(0.984848), FRAC_CONST(0.944444), FRAC_CONST(0.833333), FRAC_CONST(0.666667), FRAC_CONST(0.555556), FRAC_CONST(0.515152), FRAC_CONST(0.503876), FRAC_CONST(0.500975), FRAC_CONST(0.500244), FRAC_CONST(0.500061) },
{ FRAC_CONST(0.999878), FRAC_CONST(0.999512), FRAC_CONST(0.998058), FRAC_CONST(0.992366), FRAC_CONST(0.971429), FRAC_CONST(0.909091), FRAC_CONST(0.8), FRAC_CONST(0.714286), FRAC_CONST(0.68), FRAC_CONST(0.670103), FRAC_CONST(0.667532), FRAC_CONST(0.666884), FRAC_CONST(0.666721) },
{ FRAC_CONST(0.999939), FRAC_CONST(0.999756), FRAC_CONST(0.999028), FRAC_CONST(0.996169), FRAC_CONST(0.985507), FRAC_CONST(0.952381), FRAC_CONST(0.888889), FRAC_CONST(0.833333), FRAC_CONST(0.809524), FRAC_CONST(0.802469), FRAC_CONST(0.800623), FRAC_CONST(0.800156), FRAC_CONST(0.800039) },
{ FRAC_CONST(0.999969), FRAC_CONST(0.999878), FRAC_CONST(0.999514), FRAC_CONST(0.998081), FRAC_CONST(0.992701), FRAC_CONST(0.97561), FRAC_CONST(0.941176), FRAC_CONST(0.909091), FRAC_CONST(0.894737), FRAC_CONST(0.890411), FRAC_CONST(0.889273), FRAC_CONST(0.888985), FRAC_CONST(0.888913) },
{ FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.999757), FRAC_CONST(0.999039), FRAC_CONST(0.996337), FRAC_CONST(0.987654), FRAC_CONST(0.969697), FRAC_CONST(0.952381), FRAC_CONST(0.944444), FRAC_CONST(0.942029), FRAC_CONST(0.941392), FRAC_CONST(0.94123), FRAC_CONST(0.94119) },
{ FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999878), FRAC_CONST(0.999519), FRAC_CONST(0.998165), FRAC_CONST(0.993789), FRAC_CONST(0.984615), FRAC_CONST(0.97561), FRAC_CONST(0.971429), FRAC_CONST(0.970149), FRAC_CONST(0.969811), FRAC_CONST(0.969726), FRAC_CONST(0.969704) },
{ FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999939), FRAC_CONST(0.99976), FRAC_CONST(0.999082), FRAC_CONST(0.996885), FRAC_CONST(0.992248), FRAC_CONST(0.987654), FRAC_CONST(0.985507), FRAC_CONST(0.984848), FRAC_CONST(0.984674), FRAC_CONST(0.98463), FRAC_CONST(0.984619) },
{ FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.99988), FRAC_CONST(0.999541), FRAC_CONST(0.99844), FRAC_CONST(0.996109), FRAC_CONST(0.993789), FRAC_CONST(0.992701), FRAC_CONST(0.992366), FRAC_CONST(0.992278), FRAC_CONST(0.992256), FRAC_CONST(0.99225) },
{ FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.99994), FRAC_CONST(0.99977), FRAC_CONST(0.999219), FRAC_CONST(0.998051), FRAC_CONST(0.996885), FRAC_CONST(0.996337), FRAC_CONST(0.996169), FRAC_CONST(0.996124), FRAC_CONST(0.996113), FRAC_CONST(0.99611) },
{ FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.99997), FRAC_CONST(0.999885), FRAC_CONST(0.99961), FRAC_CONST(0.999024), FRAC_CONST(0.99844), FRAC_CONST(0.998165), FRAC_CONST(0.998081), FRAC_CONST(0.998058), FRAC_CONST(0.998053), FRAC_CONST(0.998051) },
{ FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999985), FRAC_CONST(0.999943), FRAC_CONST(0.999805), FRAC_CONST(0.999512), FRAC_CONST(0.999219), FRAC_CONST(0.999082), FRAC_CONST(0.999039), FRAC_CONST(0.999028), FRAC_CONST(0.999025), FRAC_CONST(0.999025) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999992), FRAC_CONST(0.999971), FRAC_CONST(0.999902), FRAC_CONST(0.999756), FRAC_CONST(0.99961), FRAC_CONST(0.999541), FRAC_CONST(0.999519), FRAC_CONST(0.999514), FRAC_CONST(0.999512), FRAC_CONST(0.999512) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999986), FRAC_CONST(0.999951), FRAC_CONST(0.999878), FRAC_CONST(0.999805), FRAC_CONST(0.99977), FRAC_CONST(0.99976), FRAC_CONST(0.999757), FRAC_CONST(0.999756), FRAC_CONST(0.999756) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999993), FRAC_CONST(0.999976), FRAC_CONST(0.999939), FRAC_CONST(0.999902), FRAC_CONST(0.999885), FRAC_CONST(0.99988), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999996), FRAC_CONST(0.999988), FRAC_CONST(0.999969), FRAC_CONST(0.999951), FRAC_CONST(0.999943), FRAC_CONST(0.99994), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999994), FRAC_CONST(0.999985), FRAC_CONST(0.999976), FRAC_CONST(0.999971), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999969) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999997), FRAC_CONST(0.999992), FRAC_CONST(0.999988), FRAC_CONST(0.999986), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999998), FRAC_CONST(0.999996), FRAC_CONST(0.999994), FRAC_CONST(0.999993), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999997), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }
};
static const real_t Q_div_tab_right[31][13] = {
{ FRAC_CONST(0.00775382), FRAC_CONST(0.00775945), FRAC_CONST(0.00778198), FRAC_CONST(0.00787211), FRAC_CONST(0.00823245), FRAC_CONST(0.00967118), FRAC_CONST(0.0153846), FRAC_CONST(0.037594), FRAC_CONST(0.117241), FRAC_CONST(0.336788), FRAC_CONST(0.667532), FRAC_CONST(0.888985), FRAC_CONST(0.969704) },
{ FRAC_CONST(0.0153883), FRAC_CONST(0.0153994), FRAC_CONST(0.0154438), FRAC_CONST(0.0156212), FRAC_CONST(0.0163305), FRAC_CONST(0.0191571), FRAC_CONST(0.030303), FRAC_CONST(0.0724638), FRAC_CONST(0.209877), FRAC_CONST(0.503876), FRAC_CONST(0.800623), FRAC_CONST(0.94123), FRAC_CONST(0.984619) },
{ FRAC_CONST(0.0303102), FRAC_CONST(0.0303317), FRAC_CONST(0.0304178), FRAC_CONST(0.0307619), FRAC_CONST(0.0321361), FRAC_CONST(0.037594), FRAC_CONST(0.0588235), FRAC_CONST(0.135135), FRAC_CONST(0.346939), FRAC_CONST(0.670103), FRAC_CONST(0.889273), FRAC_CONST(0.969726), FRAC_CONST(0.99225) },
{ FRAC_CONST(0.058837), FRAC_CONST(0.0588776), FRAC_CONST(0.0590397), FRAC_CONST(0.0596878), FRAC_CONST(0.0622711), FRAC_CONST(0.0724638), FRAC_CONST(0.111111), FRAC_CONST(0.238095), FRAC_CONST(0.515152), FRAC_CONST(0.802469), FRAC_CONST(0.941392), FRAC_CONST(0.98463), FRAC_CONST(0.99611) },
{ FRAC_CONST(0.111135), FRAC_CONST(0.111208), FRAC_CONST(0.111497), FRAC_CONST(0.112652), FRAC_CONST(0.117241), FRAC_CONST(0.135135), FRAC_CONST(0.2), FRAC_CONST(0.384615), FRAC_CONST(0.68), FRAC_CONST(0.890411), FRAC_CONST(0.969811), FRAC_CONST(0.992256), FRAC_CONST(0.998051) },
{ FRAC_CONST(0.200039), FRAC_CONST(0.200156), FRAC_CONST(0.200625), FRAC_CONST(0.202492), FRAC_CONST(0.209877), FRAC_CONST(0.238095), FRAC_CONST(0.333333), FRAC_CONST(0.555556), FRAC_CONST(0.809524), FRAC_CONST(0.942029), FRAC_CONST(0.984674), FRAC_CONST(0.996113), FRAC_CONST(0.999025) },
{ FRAC_CONST(0.333388), FRAC_CONST(0.33355), FRAC_CONST(0.3342), FRAC_CONST(0.336788), FRAC_CONST(0.346939), FRAC_CONST(0.384615), FRAC_CONST(0.5), FRAC_CONST(0.714286), FRAC_CONST(0.894737), FRAC_CONST(0.970149), FRAC_CONST(0.992278), FRAC_CONST(0.998053), FRAC_CONST(0.999512) },
{ FRAC_CONST(0.500061), FRAC_CONST(0.500244), FRAC_CONST(0.500975), FRAC_CONST(0.503876), FRAC_CONST(0.515152), FRAC_CONST(0.555556), FRAC_CONST(0.666667), FRAC_CONST(0.833333), FRAC_CONST(0.944444), FRAC_CONST(0.984848), FRAC_CONST(0.996124), FRAC_CONST(0.999025), FRAC_CONST(0.999756) },
{ FRAC_CONST(0.666721), FRAC_CONST(0.666884), FRAC_CONST(0.667532), FRAC_CONST(0.670103), FRAC_CONST(0.68), FRAC_CONST(0.714286), FRAC_CONST(0.8), FRAC_CONST(0.909091), FRAC_CONST(0.971429), FRAC_CONST(0.992366), FRAC_CONST(0.998058), FRAC_CONST(0.999512), FRAC_CONST(0.999878) },
{ FRAC_CONST(0.800039), FRAC_CONST(0.800156), FRAC_CONST(0.800623), FRAC_CONST(0.802469), FRAC_CONST(0.809524), FRAC_CONST(0.833333), FRAC_CONST(0.888889), FRAC_CONST(0.952381), FRAC_CONST(0.985507), FRAC_CONST(0.996169), FRAC_CONST(0.999028), FRAC_CONST(0.999756), FRAC_CONST(0.999939) },
{ FRAC_CONST(0.888913), FRAC_CONST(0.888985), FRAC_CONST(0.889273), FRAC_CONST(0.890411), FRAC_CONST(0.894737), FRAC_CONST(0.909091), FRAC_CONST(0.941176), FRAC_CONST(0.97561), FRAC_CONST(0.992701), FRAC_CONST(0.998081), FRAC_CONST(0.999514), FRAC_CONST(0.999878), FRAC_CONST(0.999969) },
{ FRAC_CONST(0.94119), FRAC_CONST(0.94123), FRAC_CONST(0.941392), FRAC_CONST(0.942029), FRAC_CONST(0.944444), FRAC_CONST(0.952381), FRAC_CONST(0.969697), FRAC_CONST(0.987654), FRAC_CONST(0.996337), FRAC_CONST(0.999039), FRAC_CONST(0.999757), FRAC_CONST(0.999939), FRAC_CONST(0.999985) },
{ FRAC_CONST(0.969704), FRAC_CONST(0.969726), FRAC_CONST(0.969811), FRAC_CONST(0.970149), FRAC_CONST(0.971429), FRAC_CONST(0.97561), FRAC_CONST(0.984615), FRAC_CONST(0.993789), FRAC_CONST(0.998165), FRAC_CONST(0.999519), FRAC_CONST(0.999878), FRAC_CONST(0.99997), FRAC_CONST(0.999992) },
{ FRAC_CONST(0.984619), FRAC_CONST(0.98463), FRAC_CONST(0.984674), FRAC_CONST(0.984848), FRAC_CONST(0.985507), FRAC_CONST(0.987654), FRAC_CONST(0.992248), FRAC_CONST(0.996885), FRAC_CONST(0.999082), FRAC_CONST(0.99976), FRAC_CONST(0.999939), FRAC_CONST(0.999985), FRAC_CONST(0.999996) },
{ FRAC_CONST(0.99225), FRAC_CONST(0.992256), FRAC_CONST(0.992278), FRAC_CONST(0.992366), FRAC_CONST(0.992701), FRAC_CONST(0.993789), FRAC_CONST(0.996109), FRAC_CONST(0.99844), FRAC_CONST(0.999541), FRAC_CONST(0.99988), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998) },
{ FRAC_CONST(0.99611), FRAC_CONST(0.996113), FRAC_CONST(0.996124), FRAC_CONST(0.996169), FRAC_CONST(0.996337), FRAC_CONST(0.996885), FRAC_CONST(0.998051), FRAC_CONST(0.999219), FRAC_CONST(0.99977), FRAC_CONST(0.99994), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999) },
{ FRAC_CONST(0.998051), FRAC_CONST(0.998053), FRAC_CONST(0.998058), FRAC_CONST(0.998081), FRAC_CONST(0.998165), FRAC_CONST(0.99844), FRAC_CONST(0.999024), FRAC_CONST(0.99961), FRAC_CONST(0.999885), FRAC_CONST(0.99997), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1) },
{ FRAC_CONST(0.999025), FRAC_CONST(0.999025), FRAC_CONST(0.999028), FRAC_CONST(0.999039), FRAC_CONST(0.999082), FRAC_CONST(0.999219), FRAC_CONST(0.999512), FRAC_CONST(0.999805), FRAC_CONST(0.999943), FRAC_CONST(0.999985), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1) },
{ FRAC_CONST(0.999512), FRAC_CONST(0.999512), FRAC_CONST(0.999514), FRAC_CONST(0.999519), FRAC_CONST(0.999541), FRAC_CONST(0.99961), FRAC_CONST(0.999756), FRAC_CONST(0.999902), FRAC_CONST(0.999971), FRAC_CONST(0.999992), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.999756), FRAC_CONST(0.999756), FRAC_CONST(0.999757), FRAC_CONST(0.99976), FRAC_CONST(0.99977), FRAC_CONST(0.999805), FRAC_CONST(0.999878), FRAC_CONST(0.999951), FRAC_CONST(0.999986), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.999878), FRAC_CONST(0.99988), FRAC_CONST(0.999885), FRAC_CONST(0.999902), FRAC_CONST(0.999939), FRAC_CONST(0.999976), FRAC_CONST(0.999993), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.999939), FRAC_CONST(0.99994), FRAC_CONST(0.999943), FRAC_CONST(0.999951), FRAC_CONST(0.999969), FRAC_CONST(0.999988), FRAC_CONST(0.999996), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.999969), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.99997), FRAC_CONST(0.999971), FRAC_CONST(0.999976), FRAC_CONST(0.999985), FRAC_CONST(0.999994), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999985), FRAC_CONST(0.999986), FRAC_CONST(0.999988), FRAC_CONST(0.999992), FRAC_CONST(0.999997), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999992), FRAC_CONST(0.999993), FRAC_CONST(0.999994), FRAC_CONST(0.999996), FRAC_CONST(0.999998), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999996), FRAC_CONST(0.999997), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999998), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(0.999999), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) },
{ FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1), FRAC_CONST(1) }
};
/* calculates 1/(1+Q) */
/* [0..1] */
static real_t calc_Q_div(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
{
if (sbr->bs_coupling)
{
/* left channel */
if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
(sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
{
return 0;
} else {
/* the pan parameter is always even */
if (ch == 0)
{
return Q_div_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
} else {
return Q_div_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
}
}
} else {
/* no coupling */
if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
{
return 0;
} else {
return Q_div_tab[sbr->Q[ch][m][l]];
}
}
}
/* table for Q_div2 values when no coupling */
static const real_t Q_div2_tab[31] = {
FRAC_CONST(0.984615), FRAC_CONST(0.969697),
FRAC_CONST(0.941176), FRAC_CONST(0.888889),
FRAC_CONST(0.8), FRAC_CONST(0.666667),
FRAC_CONST(0.5), FRAC_CONST(0.333333),
FRAC_CONST(0.2), FRAC_CONST(0.111111),
FRAC_CONST(0.0588235), FRAC_CONST(0.030303),
FRAC_CONST(0.0153846), FRAC_CONST(0.00775194),
FRAC_CONST(0.00389105), FRAC_CONST(0.00194932),
FRAC_CONST(0.00097561), FRAC_CONST(0.000488043),
FRAC_CONST(0.000244081), FRAC_CONST(0.000122055),
FRAC_CONST(6.10314E-005), FRAC_CONST(3.05166E-005),
FRAC_CONST(1.52586E-005), FRAC_CONST(7.62934E-006),
FRAC_CONST(3.81468E-006), FRAC_CONST(1.90734E-006),
FRAC_CONST(9.53673E-007), FRAC_CONST(4.76837E-007),
FRAC_CONST(2.38419E-007), FRAC_CONST(1.19209E-007),
FRAC_CONST(5.96046E-008)
};
static const real_t Q_div2_tab_left[31][13] = {
{ FRAC_CONST(0.0302959), FRAC_CONST(0.111015), FRAC_CONST(0.332468), FRAC_CONST(0.663212), FRAC_CONST(0.882759), FRAC_CONST(0.962406), FRAC_CONST(0.984615), FRAC_CONST(0.990329), FRAC_CONST(0.991768), FRAC_CONST(0.992128), FRAC_CONST(0.992218), FRAC_CONST(0.992241), FRAC_CONST(0.992246) },
{ FRAC_CONST(0.0153809), FRAC_CONST(0.0587695), FRAC_CONST(0.199377), FRAC_CONST(0.496124), FRAC_CONST(0.790123), FRAC_CONST(0.927536), FRAC_CONST(0.969697), FRAC_CONST(0.980843), FRAC_CONST(0.98367), FRAC_CONST(0.984379), FRAC_CONST(0.984556), FRAC_CONST(0.984601), FRAC_CONST(0.984612) },
{ FRAC_CONST(0.00775006), FRAC_CONST(0.0302744), FRAC_CONST(0.110727), FRAC_CONST(0.329897), FRAC_CONST(0.653061), FRAC_CONST(0.864865), FRAC_CONST(0.941176), FRAC_CONST(0.962406), FRAC_CONST(0.967864), FRAC_CONST(0.969238), FRAC_CONST(0.969582), FRAC_CONST(0.969668), FRAC_CONST(0.96969) },
{ FRAC_CONST(0.0038901), FRAC_CONST(0.0153698), FRAC_CONST(0.0586081), FRAC_CONST(0.197531), FRAC_CONST(0.484848), FRAC_CONST(0.761905), FRAC_CONST(0.888889), FRAC_CONST(0.927536), FRAC_CONST(0.937729), FRAC_CONST(0.940312), FRAC_CONST(0.94096), FRAC_CONST(0.941122), FRAC_CONST(0.941163) },
{ FRAC_CONST(0.00194884), FRAC_CONST(0.00774443), FRAC_CONST(0.0301887), FRAC_CONST(0.109589), FRAC_CONST(0.32), FRAC_CONST(0.615385), FRAC_CONST(0.8), FRAC_CONST(0.864865), FRAC_CONST(0.882759), FRAC_CONST(0.887348), FRAC_CONST(0.888503), FRAC_CONST(0.888792), FRAC_CONST(0.888865) },
{ FRAC_CONST(0.000975372), FRAC_CONST(0.00388727), FRAC_CONST(0.0153257), FRAC_CONST(0.057971), FRAC_CONST(0.190476), FRAC_CONST(0.444444), FRAC_CONST(0.666667), FRAC_CONST(0.761905), FRAC_CONST(0.790123), FRAC_CONST(0.797508), FRAC_CONST(0.799375), FRAC_CONST(0.799844), FRAC_CONST(0.799961) },
{ FRAC_CONST(0.000487924), FRAC_CONST(0.00194742), FRAC_CONST(0.00772201), FRAC_CONST(0.0298507), FRAC_CONST(0.105263), FRAC_CONST(0.285714), FRAC_CONST(0.5), FRAC_CONST(0.615385), FRAC_CONST(0.653061), FRAC_CONST(0.663212), FRAC_CONST(0.6658), FRAC_CONST(0.66645), FRAC_CONST(0.666612) },
{ FRAC_CONST(0.000244021), FRAC_CONST(0.000974659), FRAC_CONST(0.00387597), FRAC_CONST(0.0151515), FRAC_CONST(0.0555556), FRAC_CONST(0.166667), FRAC_CONST(0.333333), FRAC_CONST(0.444444), FRAC_CONST(0.484848), FRAC_CONST(0.496124), FRAC_CONST(0.499025), FRAC_CONST(0.499756), FRAC_CONST(0.499939) },
{ FRAC_CONST(0.000122026), FRAC_CONST(0.000487567), FRAC_CONST(0.00194175), FRAC_CONST(0.00763359), FRAC_CONST(0.0285714), FRAC_CONST(0.0909091), FRAC_CONST(0.2), FRAC_CONST(0.285714), FRAC_CONST(0.32), FRAC_CONST(0.329897), FRAC_CONST(0.332468), FRAC_CONST(0.333116), FRAC_CONST(0.333279) },
{ FRAC_CONST(6.10165E-005), FRAC_CONST(0.000243843), FRAC_CONST(0.000971817), FRAC_CONST(0.00383142), FRAC_CONST(0.0144928), FRAC_CONST(0.047619), FRAC_CONST(0.111111), FRAC_CONST(0.166667), FRAC_CONST(0.190476), FRAC_CONST(0.197531), FRAC_CONST(0.199377), FRAC_CONST(0.199844), FRAC_CONST(0.199961) },
{ FRAC_CONST(3.05092E-005), FRAC_CONST(0.000121936), FRAC_CONST(0.000486145), FRAC_CONST(0.00191939), FRAC_CONST(0.00729927), FRAC_CONST(0.0243902), FRAC_CONST(0.0588235), FRAC_CONST(0.0909091), FRAC_CONST(0.105263), FRAC_CONST(0.109589), FRAC_CONST(0.110727), FRAC_CONST(0.111015), FRAC_CONST(0.111087) },
{ FRAC_CONST(1.52548E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(0.000243132), FRAC_CONST(0.000960615), FRAC_CONST(0.003663), FRAC_CONST(0.0123457), FRAC_CONST(0.030303), FRAC_CONST(0.047619), FRAC_CONST(0.0555556), FRAC_CONST(0.057971), FRAC_CONST(0.0586081), FRAC_CONST(0.0587695), FRAC_CONST(0.05881) },
{ FRAC_CONST(7.62747E-006), FRAC_CONST(3.04869E-005), FRAC_CONST(0.000121581), FRAC_CONST(0.000480538), FRAC_CONST(0.00183486), FRAC_CONST(0.00621118), FRAC_CONST(0.0153846), FRAC_CONST(0.0243902), FRAC_CONST(0.0285714), FRAC_CONST(0.0298507), FRAC_CONST(0.0301887), FRAC_CONST(0.0302744), FRAC_CONST(0.0302959) },
{ FRAC_CONST(3.81375E-006), FRAC_CONST(1.52437E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(0.000240327), FRAC_CONST(0.000918274), FRAC_CONST(0.00311526), FRAC_CONST(0.00775194), FRAC_CONST(0.0123457), FRAC_CONST(0.0144928), FRAC_CONST(0.0151515), FRAC_CONST(0.0153257), FRAC_CONST(0.0153698), FRAC_CONST(0.0153809) },
{ FRAC_CONST(1.90688E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(3.03979E-005), FRAC_CONST(0.000120178), FRAC_CONST(0.000459348), FRAC_CONST(0.00156006), FRAC_CONST(0.00389105), FRAC_CONST(0.00621118), FRAC_CONST(0.00729927), FRAC_CONST(0.00763359), FRAC_CONST(0.00772201), FRAC_CONST(0.00774443), FRAC_CONST(0.00775006) },
{ FRAC_CONST(9.53441E-007), FRAC_CONST(3.81096E-006), FRAC_CONST(1.51992E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(0.000229727), FRAC_CONST(0.00078064), FRAC_CONST(0.00194932), FRAC_CONST(0.00311526), FRAC_CONST(0.003663), FRAC_CONST(0.00383142), FRAC_CONST(0.00387597), FRAC_CONST(0.00388727), FRAC_CONST(0.0038901) },
{ FRAC_CONST(4.76721E-007), FRAC_CONST(1.90548E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(3.00472E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000390472), FRAC_CONST(0.00097561), FRAC_CONST(0.00156006), FRAC_CONST(0.00183486), FRAC_CONST(0.00191939), FRAC_CONST(0.00194175), FRAC_CONST(0.00194742), FRAC_CONST(0.00194884) },
{ FRAC_CONST(2.3836E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(3.79984E-006), FRAC_CONST(1.50238E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(0.000195274), FRAC_CONST(0.000488043), FRAC_CONST(0.00078064), FRAC_CONST(0.000918274), FRAC_CONST(0.000960615), FRAC_CONST(0.000971817), FRAC_CONST(0.000974659), FRAC_CONST(0.000975372) },
{ FRAC_CONST(1.1918E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(1.89992E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(2.87216E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000244081), FRAC_CONST(0.000390472), FRAC_CONST(0.000459348), FRAC_CONST(0.000480538), FRAC_CONST(0.000486145), FRAC_CONST(0.000487567), FRAC_CONST(0.000487924) },
{ FRAC_CONST(5.95901E-008), FRAC_CONST(2.38186E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(3.756E-006), FRAC_CONST(1.4361E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(0.000122055), FRAC_CONST(0.000195274), FRAC_CONST(0.000229727), FRAC_CONST(0.000240327), FRAC_CONST(0.000243132), FRAC_CONST(0.000243843), FRAC_CONST(0.000244021) },
{ FRAC_CONST(2.9795E-008), FRAC_CONST(1.19093E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(1.878E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(2.44135E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(9.76467E-005), FRAC_CONST(0.000114877), FRAC_CONST(0.000120178), FRAC_CONST(0.000121581), FRAC_CONST(0.000121936), FRAC_CONST(0.000122026) },
{ FRAC_CONST(1.48975E-008), FRAC_CONST(5.95465E-008), FRAC_CONST(2.37491E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(3.59029E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.10165E-005) },
{ FRAC_CONST(7.44876E-009), FRAC_CONST(2.97732E-008), FRAC_CONST(1.18745E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(1.79515E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(1.52586E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.05092E-005) },
{ FRAC_CONST(3.72438E-009), FRAC_CONST(1.48866E-008), FRAC_CONST(5.93727E-008), FRAC_CONST(2.34751E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(3.05175E-006), FRAC_CONST(7.62934E-006), FRAC_CONST(1.22069E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.52548E-005) },
{ FRAC_CONST(1.86219E-009), FRAC_CONST(7.44331E-009), FRAC_CONST(2.96864E-008), FRAC_CONST(1.17375E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.62747E-006) },
{ FRAC_CONST(9.31095E-010), FRAC_CONST(3.72166E-009), FRAC_CONST(1.48432E-008), FRAC_CONST(5.86876E-008), FRAC_CONST(2.24394E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(1.90734E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.81375E-006) },
{ FRAC_CONST(4.65548E-010), FRAC_CONST(1.86083E-009), FRAC_CONST(7.42159E-009), FRAC_CONST(2.93438E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(9.53673E-007), FRAC_CONST(1.52588E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.90688E-006) },
{ FRAC_CONST(2.32774E-010), FRAC_CONST(9.30414E-010), FRAC_CONST(3.71079E-009), FRAC_CONST(1.46719E-008), FRAC_CONST(5.60985E-008), FRAC_CONST(1.90735E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.53441E-007) },
{ FRAC_CONST(1.16387E-010), FRAC_CONST(4.65207E-010), FRAC_CONST(1.8554E-009), FRAC_CONST(7.33596E-009), FRAC_CONST(2.80492E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(2.38419E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.76721E-007) },
{ FRAC_CONST(5.81935E-011), FRAC_CONST(2.32603E-010), FRAC_CONST(9.27699E-010), FRAC_CONST(3.66798E-009), FRAC_CONST(1.40246E-008), FRAC_CONST(4.76837E-008), FRAC_CONST(1.19209E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.3836E-007) },
{ FRAC_CONST(2.90967E-011), FRAC_CONST(1.16302E-010), FRAC_CONST(4.63849E-010), FRAC_CONST(1.83399E-009), FRAC_CONST(7.01231E-009), FRAC_CONST(2.38419E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(9.53674E-008), FRAC_CONST(1.12197E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.1918E-007) }
};
static const real_t Q_div2_tab_right[31][13] = {
{ FRAC_CONST(0.992246), FRAC_CONST(0.992241), FRAC_CONST(0.992218), FRAC_CONST(0.992128), FRAC_CONST(0.991768), FRAC_CONST(0.990329), FRAC_CONST(0.984615), FRAC_CONST(0.962406), FRAC_CONST(0.882759), FRAC_CONST(0.663212), FRAC_CONST(0.332468), FRAC_CONST(0.111015), FRAC_CONST(0.0302959) },
{ FRAC_CONST(0.984612), FRAC_CONST(0.984601), FRAC_CONST(0.984556), FRAC_CONST(0.984379), FRAC_CONST(0.98367), FRAC_CONST(0.980843), FRAC_CONST(0.969697), FRAC_CONST(0.927536), FRAC_CONST(0.790123), FRAC_CONST(0.496124), FRAC_CONST(0.199377), FRAC_CONST(0.0587695), FRAC_CONST(0.0153809) },
{ FRAC_CONST(0.96969), FRAC_CONST(0.969668), FRAC_CONST(0.969582), FRAC_CONST(0.969238), FRAC_CONST(0.967864), FRAC_CONST(0.962406), FRAC_CONST(0.941176), FRAC_CONST(0.864865), FRAC_CONST(0.653061), FRAC_CONST(0.329897), FRAC_CONST(0.110727), FRAC_CONST(0.0302744), FRAC_CONST(0.00775006) },
{ FRAC_CONST(0.941163), FRAC_CONST(0.941122), FRAC_CONST(0.94096), FRAC_CONST(0.940312), FRAC_CONST(0.937729), FRAC_CONST(0.927536), FRAC_CONST(0.888889), FRAC_CONST(0.761905), FRAC_CONST(0.484848), FRAC_CONST(0.197531), FRAC_CONST(0.0586081), FRAC_CONST(0.0153698), FRAC_CONST(0.0038901) },
{ FRAC_CONST(0.888865), FRAC_CONST(0.888792), FRAC_CONST(0.888503), FRAC_CONST(0.887348), FRAC_CONST(0.882759), FRAC_CONST(0.864865), FRAC_CONST(0.8), FRAC_CONST(0.615385), FRAC_CONST(0.32), FRAC_CONST(0.109589), FRAC_CONST(0.0301887), FRAC_CONST(0.00774443), FRAC_CONST(0.00194884) },
{ FRAC_CONST(0.799961), FRAC_CONST(0.799844), FRAC_CONST(0.799375), FRAC_CONST(0.797508), FRAC_CONST(0.790123), FRAC_CONST(0.761905), FRAC_CONST(0.666667), FRAC_CONST(0.444444), FRAC_CONST(0.190476), FRAC_CONST(0.057971), FRAC_CONST(0.0153257), FRAC_CONST(0.00388727), FRAC_CONST(0.000975372) },
{ FRAC_CONST(0.666612), FRAC_CONST(0.66645), FRAC_CONST(0.6658), FRAC_CONST(0.663212), FRAC_CONST(0.653061), FRAC_CONST(0.615385), FRAC_CONST(0.5), FRAC_CONST(0.285714), FRAC_CONST(0.105263), FRAC_CONST(0.0298507), FRAC_CONST(0.00772201), FRAC_CONST(0.00194742), FRAC_CONST(0.000487924) },
{ FRAC_CONST(0.499939), FRAC_CONST(0.499756), FRAC_CONST(0.499025), FRAC_CONST(0.496124), FRAC_CONST(0.484848), FRAC_CONST(0.444444), FRAC_CONST(0.333333), FRAC_CONST(0.166667), FRAC_CONST(0.0555556), FRAC_CONST(0.0151515), FRAC_CONST(0.00387597), FRAC_CONST(0.000974659), FRAC_CONST(0.000244021) },
{ FRAC_CONST(0.333279), FRAC_CONST(0.333116), FRAC_CONST(0.332468), FRAC_CONST(0.329897), FRAC_CONST(0.32), FRAC_CONST(0.285714), FRAC_CONST(0.2), FRAC_CONST(0.0909091), FRAC_CONST(0.0285714), FRAC_CONST(0.00763359), FRAC_CONST(0.00194175), FRAC_CONST(0.000487567), FRAC_CONST(0.000122026) },
{ FRAC_CONST(0.199961), FRAC_CONST(0.199844), FRAC_CONST(0.199377), FRAC_CONST(0.197531), FRAC_CONST(0.190476), FRAC_CONST(0.166667), FRAC_CONST(0.111111), FRAC_CONST(0.047619), FRAC_CONST(0.0144928), FRAC_CONST(0.00383142), FRAC_CONST(0.000971817), FRAC_CONST(0.000243843), FRAC_CONST(6.10165E-005) },
{ FRAC_CONST(0.111087), FRAC_CONST(0.111015), FRAC_CONST(0.110727), FRAC_CONST(0.109589), FRAC_CONST(0.105263), FRAC_CONST(0.0909091), FRAC_CONST(0.0588235), FRAC_CONST(0.0243902), FRAC_CONST(0.00729927), FRAC_CONST(0.00191939), FRAC_CONST(0.000486145), FRAC_CONST(0.000121936), FRAC_CONST(3.05092E-005) },
{ FRAC_CONST(0.05881), FRAC_CONST(0.0587695), FRAC_CONST(0.0586081), FRAC_CONST(0.057971), FRAC_CONST(0.0555556), FRAC_CONST(0.047619), FRAC_CONST(0.030303), FRAC_CONST(0.0123457), FRAC_CONST(0.003663), FRAC_CONST(0.000960615), FRAC_CONST(0.000243132), FRAC_CONST(6.09719E-005), FRAC_CONST(1.52548E-005) },
{ FRAC_CONST(0.0302959), FRAC_CONST(0.0302744), FRAC_CONST(0.0301887), FRAC_CONST(0.0298507), FRAC_CONST(0.0285714), FRAC_CONST(0.0243902), FRAC_CONST(0.0153846), FRAC_CONST(0.00621118), FRAC_CONST(0.00183486), FRAC_CONST(0.000480538), FRAC_CONST(0.000121581), FRAC_CONST(3.04869E-005), FRAC_CONST(7.62747E-006) },
{ FRAC_CONST(0.0153809), FRAC_CONST(0.0153698), FRAC_CONST(0.0153257), FRAC_CONST(0.0151515), FRAC_CONST(0.0144928), FRAC_CONST(0.0123457), FRAC_CONST(0.00775194), FRAC_CONST(0.00311526), FRAC_CONST(0.000918274), FRAC_CONST(0.000240327), FRAC_CONST(6.0794E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(3.81375E-006) },
{ FRAC_CONST(0.00775006), FRAC_CONST(0.00774443), FRAC_CONST(0.00772201), FRAC_CONST(0.00763359), FRAC_CONST(0.00729927), FRAC_CONST(0.00621118), FRAC_CONST(0.00389105), FRAC_CONST(0.00156006), FRAC_CONST(0.000459348), FRAC_CONST(0.000120178), FRAC_CONST(3.03979E-005), FRAC_CONST(7.62189E-006), FRAC_CONST(1.90688E-006) },
{ FRAC_CONST(0.0038901), FRAC_CONST(0.00388727), FRAC_CONST(0.00387597), FRAC_CONST(0.00383142), FRAC_CONST(0.003663), FRAC_CONST(0.00311526), FRAC_CONST(0.00194932), FRAC_CONST(0.00078064), FRAC_CONST(0.000229727), FRAC_CONST(6.00925E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(3.81096E-006), FRAC_CONST(9.53441E-007) },
{ FRAC_CONST(0.00194884), FRAC_CONST(0.00194742), FRAC_CONST(0.00194175), FRAC_CONST(0.00191939), FRAC_CONST(0.00183486), FRAC_CONST(0.00156006), FRAC_CONST(0.00097561), FRAC_CONST(0.000390472), FRAC_CONST(0.000114877), FRAC_CONST(3.00472E-005), FRAC_CONST(7.59965E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(4.76721E-007) },
{ FRAC_CONST(0.000975372), FRAC_CONST(0.000974659), FRAC_CONST(0.000971817), FRAC_CONST(0.000960615), FRAC_CONST(0.000918274), FRAC_CONST(0.00078064), FRAC_CONST(0.000488043), FRAC_CONST(0.000195274), FRAC_CONST(5.74416E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(3.79984E-006), FRAC_CONST(9.52743E-007), FRAC_CONST(2.3836E-007) },
{ FRAC_CONST(0.000487924), FRAC_CONST(0.000487567), FRAC_CONST(0.000486145), FRAC_CONST(0.000480538), FRAC_CONST(0.000459348), FRAC_CONST(0.000390472), FRAC_CONST(0.000244081), FRAC_CONST(9.76467E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(7.51196E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(4.76372E-007), FRAC_CONST(1.1918E-007) },
{ FRAC_CONST(0.000244021), FRAC_CONST(0.000243843), FRAC_CONST(0.000243132), FRAC_CONST(0.000240327), FRAC_CONST(0.000229727), FRAC_CONST(0.000195274), FRAC_CONST(0.000122055), FRAC_CONST(4.88257E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(3.756E-006), FRAC_CONST(9.49963E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(5.95901E-008) },
{ FRAC_CONST(0.000122026), FRAC_CONST(0.000121936), FRAC_CONST(0.000121581), FRAC_CONST(0.000120178), FRAC_CONST(0.000114877), FRAC_CONST(9.76467E-005), FRAC_CONST(6.10314E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(7.18056E-006), FRAC_CONST(1.878E-006), FRAC_CONST(4.74982E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(2.9795E-008) },
{ FRAC_CONST(6.10165E-005), FRAC_CONST(6.09719E-005), FRAC_CONST(6.0794E-005), FRAC_CONST(6.00925E-005), FRAC_CONST(5.74416E-005), FRAC_CONST(4.88257E-005), FRAC_CONST(3.05166E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(3.59029E-006), FRAC_CONST(9.39002E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(5.95465E-008), FRAC_CONST(1.48975E-008) },
{ FRAC_CONST(3.05092E-005), FRAC_CONST(3.04869E-005), FRAC_CONST(3.03979E-005), FRAC_CONST(3.00472E-005), FRAC_CONST(2.87216E-005), FRAC_CONST(2.44135E-005), FRAC_CONST(1.52586E-005), FRAC_CONST(6.10348E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(4.69501E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(2.97732E-008), FRAC_CONST(7.44876E-009) },
{ FRAC_CONST(1.52548E-005), FRAC_CONST(1.52437E-005), FRAC_CONST(1.51992E-005), FRAC_CONST(1.50238E-005), FRAC_CONST(1.4361E-005), FRAC_CONST(1.22069E-005), FRAC_CONST(7.62934E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(8.97575E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(5.93727E-008), FRAC_CONST(1.48866E-008), FRAC_CONST(3.72438E-009) },
{ FRAC_CONST(7.62747E-006), FRAC_CONST(7.62189E-006), FRAC_CONST(7.59965E-006), FRAC_CONST(7.51196E-006), FRAC_CONST(7.18056E-006), FRAC_CONST(6.10348E-006), FRAC_CONST(3.81468E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(4.48788E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(2.96864E-008), FRAC_CONST(7.44331E-009), FRAC_CONST(1.86219E-009) },
{ FRAC_CONST(3.81375E-006), FRAC_CONST(3.81096E-006), FRAC_CONST(3.79984E-006), FRAC_CONST(3.756E-006), FRAC_CONST(3.59029E-006), FRAC_CONST(3.05175E-006), FRAC_CONST(1.90734E-006), FRAC_CONST(7.62939E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(5.86876E-008), FRAC_CONST(1.48432E-008), FRAC_CONST(3.72166E-009), FRAC_CONST(9.31095E-010) },
{ FRAC_CONST(1.90688E-006), FRAC_CONST(1.90548E-006), FRAC_CONST(1.89992E-006), FRAC_CONST(1.878E-006), FRAC_CONST(1.79515E-006), FRAC_CONST(1.52588E-006), FRAC_CONST(9.53673E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(2.93438E-008), FRAC_CONST(7.42159E-009), FRAC_CONST(1.86083E-009), FRAC_CONST(4.65548E-010) },
{ FRAC_CONST(9.53441E-007), FRAC_CONST(9.52743E-007), FRAC_CONST(9.49963E-007), FRAC_CONST(9.39002E-007), FRAC_CONST(8.97575E-007), FRAC_CONST(7.62939E-007), FRAC_CONST(4.76837E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(5.60985E-008), FRAC_CONST(1.46719E-008), FRAC_CONST(3.71079E-009), FRAC_CONST(9.30414E-010), FRAC_CONST(2.32774E-010) },
{ FRAC_CONST(4.76721E-007), FRAC_CONST(4.76372E-007), FRAC_CONST(4.74982E-007), FRAC_CONST(4.69501E-007), FRAC_CONST(4.48788E-007), FRAC_CONST(3.8147E-007), FRAC_CONST(2.38419E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(2.80492E-008), FRAC_CONST(7.33596E-009), FRAC_CONST(1.8554E-009), FRAC_CONST(4.65207E-010), FRAC_CONST(1.16387E-010) },
{ FRAC_CONST(2.3836E-007), FRAC_CONST(2.38186E-007), FRAC_CONST(2.37491E-007), FRAC_CONST(2.34751E-007), FRAC_CONST(2.24394E-007), FRAC_CONST(1.90735E-007), FRAC_CONST(1.19209E-007), FRAC_CONST(4.76837E-008), FRAC_CONST(1.40246E-008), FRAC_CONST(3.66798E-009), FRAC_CONST(9.27699E-010), FRAC_CONST(2.32603E-010), FRAC_CONST(5.81935E-011) },
{ FRAC_CONST(1.1918E-007), FRAC_CONST(1.19093E-007), FRAC_CONST(1.18745E-007), FRAC_CONST(1.17375E-007), FRAC_CONST(1.12197E-007), FRAC_CONST(9.53674E-008), FRAC_CONST(5.96046E-008), FRAC_CONST(2.38419E-008), FRAC_CONST(7.01231E-009), FRAC_CONST(1.83399E-009), FRAC_CONST(4.63849E-010), FRAC_CONST(1.16302E-010), FRAC_CONST(2.90967E-011) }
};
/* calculates Q/(1+Q) */
/* [0..1] */
static real_t calc_Q_div2(sbr_info *sbr, uint8_t ch, uint8_t m, uint8_t l)
{
if (sbr->bs_coupling)
{
if ((sbr->Q[0][m][l] < 0 || sbr->Q[0][m][l] > 30) ||
(sbr->Q[1][m][l] < 0 || sbr->Q[1][m][l] > 24 /* 2*panOffset(1) */))
{
return 0;
} else {
/* the pan parameter is always even */
if (ch == 0)
{
return Q_div2_tab_left[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
} else {
return Q_div2_tab_right[sbr->Q[0][m][l]][sbr->Q[1][m][l] >> 1];
}
}
} else {
/* no coupling */
if (sbr->Q[ch][m][l] < 0 || sbr->Q[ch][m][l] > 30)
{
return 0;
} else {
return Q_div2_tab[sbr->Q[ch][m][l]];
}
}
}
static const real_t E_deq_tab[64] = {
64.0f, 128.0f, 256.0f, 512.0f, 1024.0f, 2048.0f, 4096.0f, 8192.0f,
16384.0f, 32768.0f, 65536.0f, 131072.0f, 262144.0f, 524288.0f, 1.04858E+006f, 2.09715E+006f,
4.1943E+006f, 8.38861E+006f, 1.67772E+007f, 3.35544E+007f, 6.71089E+007f, 1.34218E+008f, 2.68435E+008f, 5.36871E+008f,
1.07374E+009f, 2.14748E+009f, 4.29497E+009f, 8.58993E+009f, 1.71799E+010f, 3.43597E+010f, 6.87195E+010f, 1.37439E+011f,
2.74878E+011f, 5.49756E+011f, 1.09951E+012f, 2.19902E+012f, 4.39805E+012f, 8.79609E+012f, 1.75922E+013f, 3.51844E+013f,
7.03687E+013f, 1.40737E+014f, 2.81475E+014f, 5.6295E+014f, 1.1259E+015f, 2.2518E+015f, 4.5036E+015f, 9.0072E+015f,
1.80144E+016f, 3.60288E+016f, 7.20576E+016f, 1.44115E+017f, 2.8823E+017f, 5.76461E+017f, 1.15292E+018f, 2.30584E+018f,
4.61169E+018f, 9.22337E+018f, 1.84467E+019f, 3.68935E+019f, 7.3787E+019f, 1.47574E+020f, 2.95148E+020f, 5.90296E+020f
};
void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch)
{
if (sbr->bs_coupling == 0)
{
int16_t exp;
uint8_t l, k;
uint8_t amp = (sbr->amp_res[ch]) ? 0 : 1;
for (l = 0; l < sbr->L_E[ch]; l++)
{
for (k = 0; k < sbr->n[sbr->f[ch][l]]; k++)
{
/* +6 for the *64 and -10 for the /32 in the synthesis QMF (fixed)
* since this is a energy value: (x/32)^2 = (x^2)/1024
*/
/* exp = (sbr->E[ch][k][l] >> amp) + 6; */
exp = (sbr->E[ch][k][l] >> amp);
if ((exp < 0) || (exp >= 64))
{
sbr->E_orig[ch][k][l] = 0;
} else {
sbr->E_orig[ch][k][l] = E_deq_tab[exp];
/* save half the table size at the cost of 1 multiply */
if (amp && (sbr->E[ch][k][l] & 1))
{
sbr->E_orig[ch][k][l] = MUL_C(sbr->E_orig[ch][k][l], COEF_CONST(1.414213562));
}
}
}
}
for (l = 0; l < sbr->L_Q[ch]; l++)
{
for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q_div[ch][k][l] = calc_Q_div(sbr, ch, k, l);
sbr->Q_div2[ch][k][l] = calc_Q_div2(sbr, ch, k, l);
}
}
}
}
static const real_t E_pan_tab[25] = {
FRAC_CONST(0.000244081), FRAC_CONST(0.000488043),
FRAC_CONST(0.00097561), FRAC_CONST(0.00194932),
FRAC_CONST(0.00389105), FRAC_CONST(0.00775194),
FRAC_CONST(0.0153846), FRAC_CONST(0.030303),
FRAC_CONST(0.0588235), FRAC_CONST(0.111111),
FRAC_CONST(0.2), FRAC_CONST(0.333333),
FRAC_CONST(0.5), FRAC_CONST(0.666667),
FRAC_CONST(0.8), FRAC_CONST(0.888889),
FRAC_CONST(0.941176), FRAC_CONST(0.969697),
FRAC_CONST(0.984615), FRAC_CONST(0.992248),
FRAC_CONST(0.996109), FRAC_CONST(0.998051),
FRAC_CONST(0.999024), FRAC_CONST(0.999512),
FRAC_CONST(0.999756)
};
void unmap_envelope_noise(sbr_info *sbr)
{
real_t tmp;
int16_t exp0, exp1;
uint8_t l, k;
uint8_t amp0 = (sbr->amp_res[0]) ? 0 : 1;
uint8_t amp1 = (sbr->amp_res[1]) ? 0 : 1;
for (l = 0; l < sbr->L_E[0]; l++)
{
for (k = 0; k < sbr->n[sbr->f[0][l]]; k++)
{
/* +6: * 64 ; +1: * 2 ; */
exp0 = (sbr->E[0][k][l] >> amp0) + 1;
/* UN_MAP removed: (x / 4096) same as (x >> 12) */
/* E[1] is always even so no need for compensating the divide by 2 with
* an extra multiplication
*/
/* exp1 = (sbr->E[1][k][l] >> amp1) - 12; */
exp1 = (sbr->E[1][k][l] >> amp1);
if ((exp0 < 0) || (exp0 >= 64) ||
(exp1 < 0) || (exp1 > 24))
{
sbr->E_orig[1][k][l] = 0;
sbr->E_orig[0][k][l] = 0;
} else {
tmp = E_deq_tab[exp0];
if (amp0 && (sbr->E[0][k][l] & 1))
{
tmp = MUL_C(tmp, COEF_CONST(1.414213562));
}
/* panning */
sbr->E_orig[0][k][l] = MUL_F(tmp, E_pan_tab[exp1]);
sbr->E_orig[1][k][l] = MUL_F(tmp, E_pan_tab[24 - exp1]);
}
}
}
for (l = 0; l < sbr->L_Q[0]; l++)
{
for (k = 0; k < sbr->N_Q; k++)
{
sbr->Q_div[0][k][l] = calc_Q_div(sbr, 0, k, l);
sbr->Q_div[1][k][l] = calc_Q_div(sbr, 1, k, l);
sbr->Q_div2[0][k][l] = calc_Q_div2(sbr, 0, k, l);
sbr->Q_div2[1][k][l] = calc_Q_div2(sbr, 1, k, l);
}
}
}
#endif
#endif

108
src/contrib/aacdecoder/libfaad/sbr_e_nf.h Normal file → Executable file
View File

@ -1,58 +1,50 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_e_nf.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_E_NF_H__
#define __SBR_E_NF_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifndef FIXED_POINT
#define P2_TABLE_OFFSET 35
#define P2_TABLE_MAX 91
#else
#define P2Q_TABLE_OFFSET 24
#define P2Q_TABLE_MAX 7
#define P2_TABLE_OFFSET 0
#define P2_TABLE_MAX 31
#endif
#define P2_TABLE_RCP_OFFSET 12
#define P2_TABLE_RCP_MAX 21
void extract_envelope_data(sbr_info *sbr, uint8_t ch);
void extract_noise_floor_data(sbr_info *sbr, uint8_t ch);
void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch);
void unmap_envelope_noise(sbr_info *sbr);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_e_nf.h,v 1.18 2007/11/01 12:33:35 menno Exp $
**/
#ifndef __SBR_E_NF_H__
#define __SBR_E_NF_H__
#ifdef __cplusplus
extern "C" {
#endif
void extract_envelope_data(sbr_info *sbr, uint8_t ch);
void extract_noise_floor_data(sbr_info *sbr, uint8_t ch);
#ifndef FIXED_POINT
void envelope_noise_dequantisation(sbr_info *sbr, uint8_t ch);
void unmap_envelope_noise(sbr_info *sbr);
#endif
#ifdef __cplusplus
}
#endif
#endif

1504
src/contrib/aacdecoder/libfaad/sbr_fbt.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

107
src/contrib/aacdecoder/libfaad/sbr_fbt.h Normal file → Executable file
View File

@ -1,52 +1,55 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_fbt.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_FBT_H__
#define __SBR_FBT_H__
#ifdef __cplusplus
extern "C" {
#endif
uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
uint32_t sample_rate);
uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
uint8_t k0);
uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
uint8_t bs_alter_scale);
uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
uint8_t bs_freq_scale, uint8_t bs_alter_scale);
uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
uint8_t k2);
void limiter_frequency_table(sbr_info *sbr);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_fbt.h,v 1.18 2007/11/01 12:33:35 menno Exp $
**/
#ifndef __SBR_FBT_H__
#define __SBR_FBT_H__
#ifdef __cplusplus
extern "C" {
#endif
uint8_t qmf_start_channel(uint8_t bs_start_freq, uint8_t bs_samplerate_mode,
uint32_t sample_rate);
uint8_t qmf_stop_channel(uint8_t bs_stop_freq, uint32_t sample_rate,
uint8_t k0);
uint8_t master_frequency_table_fs0(sbr_info *sbr, uint8_t k0, uint8_t k2,
uint8_t bs_alter_scale);
uint8_t master_frequency_table(sbr_info *sbr, uint8_t k0, uint8_t k2,
uint8_t bs_freq_scale, uint8_t bs_alter_scale);
uint8_t derived_frequency_table(sbr_info *sbr, uint8_t bs_xover_band,
uint8_t k2);
void limiter_frequency_table(sbr_info *sbr);
#ifdef __cplusplus
}
#endif
#endif

2434
src/contrib/aacdecoder/libfaad/sbr_hfadj.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

117
src/contrib/aacdecoder/libfaad/sbr_hfadj.h Normal file → Executable file
View File

@ -1,60 +1,57 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_hfadj.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_HFADJ_H__
#define __SBR_HFADJ_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
real_t Q_mapped[64][5];
uint8_t S_index_mapped[64][5];
uint8_t S_mapped[64][5];
real_t G_lim_boost[5][64];
real_t Q_M_lim_boost[5][64];
real_t S_M_boost[5][64];
} sbr_hfadj_info;
void hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
,real_t *deg
#endif
,uint8_t ch);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_hfadj.h,v 1.19 2007/11/01 12:33:35 menno Exp $
**/
#ifndef __SBR_HFADJ_H__
#define __SBR_HFADJ_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
real_t G_lim_boost[MAX_L_E][MAX_M];
real_t Q_M_lim_boost[MAX_L_E][MAX_M];
real_t S_M_boost[MAX_L_E][MAX_M];
} sbr_hfadj_info;
uint8_t hf_adjustment(sbr_info *sbr, qmf_t Xsbr[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
,real_t *deg
#endif
,uint8_t ch);
#ifdef __cplusplus
}
#endif
#endif

1162
src/contrib/aacdecoder/libfaad/sbr_hfgen.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

95
src/contrib/aacdecoder/libfaad/sbr_hfgen.h Normal file → Executable file
View File

@ -1,46 +1,49 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_hfgen.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_HFGEN_H__
#define __SBR_HFGEN_H__
#ifdef __cplusplus
extern "C" {
#endif
void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][32],
qmf_t Xhigh[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
,real_t *deg
#endif
,uint8_t ch);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_hfgen.h,v 1.20 2007/11/01 12:33:35 menno Exp $
**/
#ifndef __SBR_HFGEN_H__
#define __SBR_HFGEN_H__
#ifdef __cplusplus
extern "C" {
#endif
void hf_generation(sbr_info *sbr, qmf_t Xlow[MAX_NTSRHFG][64],
qmf_t Xhigh[MAX_NTSRHFG][64]
#ifdef SBR_LOW_POWER
,real_t *deg
#endif
,uint8_t ch);
#ifdef __cplusplus
}
#endif
#endif

718
src/contrib/aacdecoder/libfaad/sbr_huff.c Normal file → Executable file
View File

@ -1,358 +1,360 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_huff.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef SBR_DEC
#include "sbr_syntax.h"
#include "bits.h"
#include "sbr_huff.h"
#include "sbr_e_nf.h"
typedef const int8_t (*sbr_huff_tab)[2];
static const int8_t t_huffman_env_1_5dB[120][2] = {
{ 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
{ 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 },
{ 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
{ 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 },
{ 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 },
{ -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 },
{ -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 },
{ -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 },
{ -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 },
{ 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 },
{ 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 },
{ -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 },
{-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 },
{-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 },
{-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 },
{ 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 },
{ 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 },
{ 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 },
{ -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 },
{ 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 },
{ -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 },
{ -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 },
{ -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
{ 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 },
{ -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 },
{ -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 },
{ -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 },
{ -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 },
{ -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 },
{ -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
};
static const int8_t f_huffman_env_1_5dB[120][2] = {
{ 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
{ 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 },
{ 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 },
{ -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 },
{ 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 },
{ 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 },
{ 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 },
{ 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 },
{ 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 },
{ 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 },
{ -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 },
{ 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 },
{ 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 },
{ -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 },
{ 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 },
{ 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 },
{-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 },
{ 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 },
{ 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 },
{ 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 },
{-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 },
{-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 },
{-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
{ 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 },
{ -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 },
{ -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 },
{ -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 },
{ -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 },
{ -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 },
{ -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
};
static const int8_t t_huffman_env_bal_1_5dB[48][2] = {
{ -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 },
{ -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 },
{ -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 },
{ -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 },
{ -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 },
{ -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 },
{ -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 },
{ 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 },
{ -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 },
{ 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 },
{ -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 },
{ -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 }
};
static const int8_t f_huffman_env_bal_1_5dB[48][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 },
{ -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 },
{ -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 },
{ -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 },
{ -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 },
{ -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 },
{ 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 },
{ -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 },
{ 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 },
{ 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 }
};
static const int8_t t_huffman_env_3_0dB[62][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 },
{ -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 },
{ -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 },
{ -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 },
{ -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 },
{ -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 },
{ 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 },
{ -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 },
{ 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 },
{ 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 },
{ 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 },
{ 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 },
{ 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 },
{ -36, -35 }, { -34, -33 }
};
static const int8_t f_huffman_env_3_0dB[62][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
{ 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
{ 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 },
{ 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 },
{ 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 },
{ 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 },
{ -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 },
{ 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 },
{ -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 },
{ 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 },
{ 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 },
{ 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 },
{ 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 },
{ 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 },
{ -36, -35 }, { -34, -33 }
};
static const int8_t t_huffman_env_bal_3_0dB[24][2] = {
{ -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
{ -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 },
{ -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 },
{ 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 },
{ 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 }
};
static const int8_t f_huffman_env_bal_3_0dB[24][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 },
{ -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 },
{ -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 },
{ -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 }
};
static const int8_t t_huffman_noise_3_0dB[62][2] = {
{ -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
{ -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
{ 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 },
{ 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 },
{ 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 },
{ 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 },
{ 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 },
{ -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 },
{ 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 },
{ 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 },
{ 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 },
{ -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 },
{ 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 },
{ -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 },
{ -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 },
{ -35, 61 }, { -34, -33 }
};
static const int8_t t_huffman_noise_bal_3_0dB[24][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 },
{ -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 },
{ -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 },
{ -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 },
{ -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 },
{ -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 }
};
static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
{
uint8_t bit;
int16_t index = 0;
while (index >= 0)
{
bit = (uint8_t)faad_getbits(ld, 1);
index = t_huff[index][bit];
}
return index + 64;
}
/* table 10 */
void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch)
{
uint8_t env, band;
int8_t delta = 0;
sbr_huff_tab t_huff, f_huff;
if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX))
sbr->amp_res[ch] = 0;
else
sbr->amp_res[ch] = sbr->bs_amp_res;
if ((sbr->bs_coupling) && (ch == 1))
{
delta = 1;
if (sbr->amp_res[ch])
{
t_huff = t_huffman_env_bal_3_0dB;
f_huff = f_huffman_env_bal_3_0dB;
} else {
t_huff = t_huffman_env_bal_1_5dB;
f_huff = f_huffman_env_bal_1_5dB;
}
} else {
delta = 0;
if (sbr->amp_res[ch])
{
t_huff = t_huffman_env_3_0dB;
f_huff = f_huffman_env_3_0dB;
} else {
t_huff = t_huffman_env_1_5dB;
f_huff = f_huffman_env_1_5dB;
}
}
for (env = 0; env < sbr->L_E[ch]; env++)
{
if (sbr->bs_df_env[ch][env] == 0)
{
if ((sbr->bs_coupling == 1) && (ch == 1))
{
if (sbr->amp_res[ch])
{
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5
DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta);
} else {
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta);
}
} else {
if (sbr->amp_res[ch])
{
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta);
} else {
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7
DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta);
}
}
for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++)
{
sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta);
}
} else {
for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++)
{
sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta);
}
}
}
extract_envelope_data(sbr, ch);
}
/* table 11 */
void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch)
{
uint8_t noise, band;
int8_t delta = 0;
sbr_huff_tab t_huff, f_huff;
if ((sbr->bs_coupling == 1) && (ch == 1))
{
delta = 1;
t_huff = t_huffman_noise_bal_3_0dB;
f_huff = f_huffman_env_bal_3_0dB;
} else {
delta = 0;
t_huff = t_huffman_noise_3_0dB;
f_huff = f_huffman_env_3_0dB;
}
for (noise = 0; noise < sbr->L_Q[ch]; noise++)
{
if(sbr->bs_df_noise[ch][noise] == 0)
{
if ((sbr->bs_coupling == 1) && (ch == 1))
{
sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta);
} else {
sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta);
}
for (band = 1; band < sbr->N_Q; band++)
{
sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta);
}
} else {
for (band = 0; band < sbr->N_Q; band++)
{
sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta);
}
}
}
extract_noise_floor_data(sbr, ch);
}
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_huff.c,v 1.21 2007/11/01 12:33:35 menno Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef SBR_DEC
#include "sbr_syntax.h"
#include "bits.h"
#include "sbr_huff.h"
#include "sbr_e_nf.h"
typedef const int8_t (*sbr_huff_tab)[2];
static const int8_t t_huffman_env_1_5dB[120][2] = {
{ 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
{ 5, 6 }, { -62, -67 }, { 7, 8 }, { -61, -68 },
{ 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
{ 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 },
{ 17, 18 }, { -73, -56 }, { 19, 21 }, { -74, 20 },
{ -55, -75 }, { 22, 26 }, { 23, 24 }, { -54, -76 },
{ -77, 25 }, { -53, -78 }, { 27, 34 }, { 28, 29 },
{ -52, -79 }, { 30, 31 }, { -80, -51 }, { 32, 33 },
{ -83, -82 }, { -81, -50 }, { 35, 57 }, { 36, 40 },
{ 37, 38 }, { -88, -84 }, { -48, 39 }, { -90, -85 },
{ 41, 46 }, { 42, 43 }, { -49, -87 }, { 44, 45 },
{ -89, -86 }, {-124,-123 }, { 47, 50 }, { 48, 49 },
{-122,-121 }, {-120,-119 }, { 51, 54 }, { 52, 53 },
{-118,-117 }, {-116,-115 }, { 55, 56 }, {-114,-113 },
{-112,-111 }, { 58, 89 }, { 59, 74 }, { 60, 67 },
{ 61, 64 }, { 62, 63 }, {-110,-109 }, {-108,-107 },
{ 65, 66 }, {-106,-105 }, {-104,-103 }, { 68, 71 },
{ 69, 70 }, {-102,-101 }, {-100, -99 }, { 72, 73 },
{ -98, -97 }, { -96, -95 }, { 75, 82 }, { 76, 79 },
{ 77, 78 }, { -94, -93 }, { -92, -91 }, { 80, 81 },
{ -47, -46 }, { -45, -44 }, { 83, 86 }, { 84, 85 },
{ -43, -42 }, { -41, -40 }, { 87, 88 }, { -39, -38 },
{ -37, -36 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
{ 93, 94 }, { -35, -34 }, { -33, -32 }, { 96, 97 },
{ -31, -30 }, { -29, -28 }, { 99, 102 }, { 100, 101 },
{ -27, -26 }, { -25, -24 }, { 103, 104 }, { -23, -22 },
{ -21, -20 }, { 106, 113 }, { 107, 110 }, { 108, 109 },
{ -19, -18 }, { -17, -16 }, { 111, 112 }, { -15, -14 },
{ -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 },
{ -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
};
static const int8_t f_huffman_env_1_5dB[120][2] = {
{ 1, 2 }, { -64, -65 }, { 3, 4 }, { -63, -66 },
{ 5, 6 }, { -67, -62 }, { 7, 8 }, { -68, -61 },
{ 9, 10 }, { -69, -60 }, { 11, 13 }, { -70, 12 },
{ -59, -71 }, { 14, 16 }, { -58, 15 }, { -72, -57 },
{ 17, 19 }, { -73, 18 }, { -56, -74 }, { 20, 23 },
{ 21, 22 }, { -55, -75 }, { -54, -53 }, { 24, 27 },
{ 25, 26 }, { -76, -52 }, { -77, -51 }, { 28, 31 },
{ 29, 30 }, { -50, -78 }, { -79, -49 }, { 32, 36 },
{ 33, 34 }, { -48, -47 }, { -80, 35 }, { -81, -82 },
{ 37, 47 }, { 38, 41 }, { 39, 40 }, { -83, -46 },
{ -45, -84 }, { 42, 44 }, { -85, 43 }, { -44, -43 },
{ 45, 46 }, { -88, -87 }, { -86, -90 }, { 48, 66 },
{ 49, 56 }, { 50, 53 }, { 51, 52 }, { -92, -42 },
{ -41, -39 }, { 54, 55 }, {-105, -89 }, { -38, -37 },
{ 57, 60 }, { 58, 59 }, { -94, -91 }, { -40, -36 },
{ 61, 63 }, { -20, 62 }, {-115,-110 }, { 64, 65 },
{-108,-107 }, {-101, -97 }, { 67, 89 }, { 68, 75 },
{ 69, 72 }, { 70, 71 }, { -95, -93 }, { -34, -27 },
{ 73, 74 }, { -22, -17 }, { -16,-124 }, { 76, 82 },
{ 77, 79 }, {-123, 78 }, {-122,-121 }, { 80, 81 },
{-120,-119 }, {-118,-117 }, { 83, 86 }, { 84, 85 },
{-116,-114 }, {-113,-112 }, { 87, 88 }, {-111,-109 },
{-106,-104 }, { 90, 105 }, { 91, 98 }, { 92, 95 },
{ 93, 94 }, {-103,-102 }, {-100, -99 }, { 96, 97 },
{ -98, -96 }, { -35, -33 }, { 99, 102 }, { 100, 101 },
{ -32, -31 }, { -30, -29 }, { 103, 104 }, { -28, -26 },
{ -25, -24 }, { 106, 113 }, { 107, 110 }, { 108, 109 },
{ -23, -21 }, { -19, -18 }, { 111, 112 }, { -15, -14 },
{ -13, -12 }, { 114, 117 }, { 115, 116 }, { -11, -10 },
{ -9, -8 }, { 118, 119 }, { -7, -6 }, { -5, -4 }
};
static const int8_t t_huffman_env_bal_1_5dB[48][2] = {
{ -64, 1 }, { -63, 2 }, { -65, 3 }, { -62, 4 },
{ -66, 5 }, { -61, 6 }, { -67, 7 }, { -60, 8 },
{ -68, 9 }, { 10, 11 }, { -69, -59 }, { 12, 13 },
{ -70, -58 }, { 14, 28 }, { 15, 21 }, { 16, 18 },
{ -57, 17 }, { -71, -56 }, { 19, 20 }, { -88, -87 },
{ -86, -85 }, { 22, 25 }, { 23, 24 }, { -84, -83 },
{ -82, -81 }, { 26, 27 }, { -80, -79 }, { -78, -77 },
{ 29, 36 }, { 30, 33 }, { 31, 32 }, { -76, -75 },
{ -74, -73 }, { 34, 35 }, { -72, -55 }, { -54, -53 },
{ 37, 41 }, { 38, 39 }, { -52, -51 }, { -50, 40 },
{ -49, -48 }, { 42, 45 }, { 43, 44 }, { -47, -46 },
{ -45, -44 }, { 46, 47 }, { -43, -42 }, { -41, -40 }
};
static const int8_t f_huffman_env_bal_1_5dB[48][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 11 }, { -69, -59 }, { -70, 12 },
{ -58, 13 }, { 14, 17 }, { -71, 15 }, { -57, 16 },
{ -56, -73 }, { 18, 32 }, { 19, 25 }, { 20, 22 },
{ -72, 21 }, { -88, -87 }, { 23, 24 }, { -86, -85 },
{ -84, -83 }, { 26, 29 }, { 27, 28 }, { -82, -81 },
{ -80, -79 }, { 30, 31 }, { -78, -77 }, { -76, -75 },
{ 33, 40 }, { 34, 37 }, { 35, 36 }, { -74, -55 },
{ -54, -53 }, { 38, 39 }, { -52, -51 }, { -50, -49 },
{ 41, 44 }, { 42, 43 }, { -48, -47 }, { -46, -45 },
{ 45, 46 }, { -44, -43 }, { -42, 47 }, { -41, -40 }
};
static const int8_t t_huffman_env_3_0dB[62][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -67, 6 }, { -61, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 11 }, { -69, -59 }, { 12, 14 },
{ -70, 13 }, { -71, -58 }, { 15, 18 }, { 16, 17 },
{ -72, -57 }, { -73, -74 }, { 19, 22 }, { -56, 20 },
{ -55, 21 }, { -54, -77 }, { 23, 31 }, { 24, 25 },
{ -75, -76 }, { 26, 27 }, { -78, -53 }, { 28, 29 },
{ -52, -95 }, { -94, 30 }, { -93, -92 }, { 32, 47 },
{ 33, 40 }, { 34, 37 }, { 35, 36 }, { -91, -90 },
{ -89, -88 }, { 38, 39 }, { -87, -86 }, { -85, -84 },
{ 41, 44 }, { 42, 43 }, { -83, -82 }, { -81, -80 },
{ 45, 46 }, { -79, -51 }, { -50, -49 }, { 48, 55 },
{ 49, 52 }, { 50, 51 }, { -48, -47 }, { -46, -45 },
{ 53, 54 }, { -44, -43 }, { -42, -41 }, { 56, 59 },
{ 57, 58 }, { -40, -39 }, { -38, -37 }, { 60, 61 },
{ -36, -35 }, { -34, -33 }
};
static const int8_t f_huffman_env_3_0dB[62][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
{ 9, 10 }, { -60, -69 }, { 11, 12 }, { -59, -70 },
{ 13, 14 }, { -58, -71 }, { 15, 16 }, { -57, -72 },
{ 17, 19 }, { -56, 18 }, { -55, -73 }, { 20, 24 },
{ 21, 22 }, { -74, -54 }, { -53, 23 }, { -75, -76 },
{ 25, 30 }, { 26, 27 }, { -52, -51 }, { 28, 29 },
{ -77, -79 }, { -50, -49 }, { 31, 39 }, { 32, 35 },
{ 33, 34 }, { -78, -46 }, { -82, -88 }, { 36, 37 },
{ -83, -48 }, { -47, 38 }, { -86, -85 }, { 40, 47 },
{ 41, 44 }, { 42, 43 }, { -80, -44 }, { -43, -42 },
{ 45, 46 }, { -39, -87 }, { -84, -40 }, { 48, 55 },
{ 49, 52 }, { 50, 51 }, { -95, -94 }, { -93, -92 },
{ 53, 54 }, { -91, -90 }, { -89, -81 }, { 56, 59 },
{ 57, 58 }, { -45, -41 }, { -38, -37 }, { 60, 61 },
{ -36, -35 }, { -34, -33 }
};
static const int8_t t_huffman_env_bal_3_0dB[24][2] = {
{ -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
{ -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 16 }, { 11, 13 }, { -69, 12 },
{ -76, -75 }, { 14, 15 }, { -74, -73 }, { -72, -71 },
{ 17, 20 }, { 18, 19 }, { -70, -59 }, { -58, -57 },
{ 21, 22 }, { -56, -55 }, { -54, 23 }, { -53, -52 }
};
static const int8_t f_huffman_env_bal_3_0dB[24][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { -66, 4 },
{ -62, 5 }, { -61, 6 }, { -67, 7 }, { -68, 8 },
{ -60, 9 }, { 10, 13 }, { -69, 11 }, { -59, 12 },
{ -58, -76 }, { 14, 17 }, { 15, 16 }, { -75, -74 },
{ -73, -72 }, { 18, 21 }, { 19, 20 }, { -71, -70 },
{ -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 }
};
static const int8_t t_huffman_noise_3_0dB[62][2] = {
{ -64, 1 }, { -63, 2 }, { -65, 3 }, { -66, 4 },
{ -62, 5 }, { -67, 6 }, { 7, 8 }, { -61, -68 },
{ 9, 30 }, { 10, 15 }, { -60, 11 }, { -69, 12 },
{ 13, 14 }, { -59, -53 }, { -95, -94 }, { 16, 23 },
{ 17, 20 }, { 18, 19 }, { -93, -92 }, { -91, -90 },
{ 21, 22 }, { -89, -88 }, { -87, -86 }, { 24, 27 },
{ 25, 26 }, { -85, -84 }, { -83, -82 }, { 28, 29 },
{ -81, -80 }, { -79, -78 }, { 31, 46 }, { 32, 39 },
{ 33, 36 }, { 34, 35 }, { -77, -76 }, { -75, -74 },
{ 37, 38 }, { -73, -72 }, { -71, -70 }, { 40, 43 },
{ 41, 42 }, { -58, -57 }, { -56, -55 }, { 44, 45 },
{ -54, -52 }, { -51, -50 }, { 47, 54 }, { 48, 51 },
{ 49, 50 }, { -49, -48 }, { -47, -46 }, { 52, 53 },
{ -45, -44 }, { -43, -42 }, { 55, 58 }, { 56, 57 },
{ -41, -40 }, { -39, -38 }, { 59, 60 }, { -37, -36 },
{ -35, 61 }, { -34, -33 }
};
static const int8_t t_huffman_noise_bal_3_0dB[24][2] = {
{ -64, 1 }, { -65, 2 }, { -63, 3 }, { 4, 9 },
{ -66, 5 }, { -62, 6 }, { 7, 8 }, { -76, -75 },
{ -74, -73 }, { 10, 17 }, { 11, 14 }, { 12, 13 },
{ -72, -71 }, { -70, -69 }, { 15, 16 }, { -68, -67 },
{ -61, -60 }, { 18, 21 }, { 19, 20 }, { -59, -58 },
{ -57, -56 }, { 22, 23 }, { -55, -54 }, { -53, -52 }
};
static INLINE int16_t sbr_huff_dec(bitfile *ld, sbr_huff_tab t_huff)
{
uint8_t bit;
int16_t index = 0;
while (index >= 0)
{
bit = (uint8_t)faad_get1bit(ld);
index = t_huff[index][bit];
}
return index + 64;
}
/* table 10 */
void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch)
{
uint8_t env, band;
int8_t delta = 0;
sbr_huff_tab t_huff, f_huff;
if ((sbr->L_E[ch] == 1) && (sbr->bs_frame_class[ch] == FIXFIX))
sbr->amp_res[ch] = 0;
else
sbr->amp_res[ch] = sbr->bs_amp_res;
if ((sbr->bs_coupling) && (ch == 1))
{
delta = 1;
if (sbr->amp_res[ch])
{
t_huff = t_huffman_env_bal_3_0dB;
f_huff = f_huffman_env_bal_3_0dB;
} else {
t_huff = t_huffman_env_bal_1_5dB;
f_huff = f_huffman_env_bal_1_5dB;
}
} else {
delta = 0;
if (sbr->amp_res[ch])
{
t_huff = t_huffman_env_3_0dB;
f_huff = f_huffman_env_3_0dB;
} else {
t_huff = t_huffman_env_1_5dB;
f_huff = f_huffman_env_1_5dB;
}
}
for (env = 0; env < sbr->L_E[ch]; env++)
{
if (sbr->bs_df_env[ch][env] == 0)
{
if ((sbr->bs_coupling == 1) && (ch == 1))
{
if (sbr->amp_res[ch])
{
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 5
DEBUGVAR(1,272,"sbr_envelope(): bs_data_env")) << delta);
} else {
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
DEBUGVAR(1,273,"sbr_envelope(): bs_data_env")) << delta);
}
} else {
if (sbr->amp_res[ch])
{
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 6
DEBUGVAR(1,274,"sbr_envelope(): bs_data_env")) << delta);
} else {
sbr->E[ch][0][env] = (uint16_t)(faad_getbits(ld, 7
DEBUGVAR(1,275,"sbr_envelope(): bs_data_env")) << delta);
}
}
for (band = 1; band < sbr->n[sbr->f[ch][env]]; band++)
{
sbr->E[ch][band][env] = (sbr_huff_dec(ld, f_huff) << delta);
}
} else {
for (band = 0; band < sbr->n[sbr->f[ch][env]]; band++)
{
sbr->E[ch][band][env] = (sbr_huff_dec(ld, t_huff) << delta);
}
}
}
extract_envelope_data(sbr, ch);
}
/* table 11 */
void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch)
{
uint8_t noise, band;
int8_t delta = 0;
sbr_huff_tab t_huff, f_huff;
if ((sbr->bs_coupling == 1) && (ch == 1))
{
delta = 1;
t_huff = t_huffman_noise_bal_3_0dB;
f_huff = f_huffman_env_bal_3_0dB;
} else {
delta = 0;
t_huff = t_huffman_noise_3_0dB;
f_huff = f_huffman_env_3_0dB;
}
for (noise = 0; noise < sbr->L_Q[ch]; noise++)
{
if(sbr->bs_df_noise[ch][noise] == 0)
{
if ((sbr->bs_coupling == 1) && (ch == 1))
{
sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
DEBUGVAR(1,276,"sbr_noise(): bs_data_noise")) << delta);
} else {
sbr->Q[ch][0][noise] = (faad_getbits(ld, 5
DEBUGVAR(1,277,"sbr_noise(): bs_data_noise")) << delta);
}
for (band = 1; band < sbr->N_Q; band++)
{
sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, f_huff) << delta);
}
} else {
for (band = 0; band < sbr->N_Q; band++)
{
sbr->Q[ch][band][noise] = (sbr_huff_dec(ld, t_huff) << delta);
}
}
}
extract_noise_floor_data(sbr, ch);
}
#endif

89
src/contrib/aacdecoder/libfaad/sbr_huff.h Normal file → Executable file
View File

@ -1,43 +1,46 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_huff.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_HUFF_H__
#define __SBR_HUFF_H__
#ifdef __cplusplus
extern "C" {
#endif
void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch);
void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_huff.h,v 1.21 2007/11/01 12:33:35 menno Exp $
**/
#ifndef __SBR_HUFF_H__
#define __SBR_HUFF_H__
#ifdef __cplusplus
extern "C" {
#endif
void sbr_envelope(bitfile *ld, sbr_info *sbr, uint8_t ch);
void sbr_noise(bitfile *ld, sbr_info *sbr, uint8_t ch);
#ifdef __cplusplus
}
#endif
#endif

1125
src/contrib/aacdecoder/libfaad/sbr_noise.h Normal file → Executable file

File diff suppressed because it is too large Load Diff

1196
src/contrib/aacdecoder/libfaad/sbr_qmf.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

109
src/contrib/aacdecoder/libfaad/sbr_qmf.h Normal file → Executable file
View File

@ -1,54 +1,55 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_qmf.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_QMF_H__
#define __SBR_QMF_H__
#ifdef __cplusplus
extern "C" {
#endif
qmfa_info *qmfa_init(uint8_t channels);
void qmfa_end(qmfa_info *qmfa);
qmfs_info *qmfs_init(uint8_t channels);
void qmfs_end(qmfs_info *qmfs);
void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
qmf_t X[MAX_NTSRHFG][32], uint8_t offset, uint8_t kx);
void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output);
#ifdef USE_SSE
void sbr_qmf_synthesis_64_sse(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output);
#endif
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_qmf.h,v 1.25 2007/11/01 12:33:36 menno Exp $
**/
#ifndef __SBR_QMF_H__
#define __SBR_QMF_H__
#ifdef __cplusplus
extern "C" {
#endif
qmfa_info *qmfa_init(uint8_t channels);
void qmfa_end(qmfa_info *qmfa);
qmfs_info *qmfs_init(uint8_t channels);
void qmfs_end(qmfs_info *qmfs);
void sbr_qmf_analysis_32(sbr_info *sbr, qmfa_info *qmfa, const real_t *input,
qmf_t X[MAX_NTSRHFG][64], uint8_t offset, uint8_t kx);
void sbr_qmf_synthesis_32(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output);
void sbr_qmf_synthesis_64(sbr_info *sbr, qmfs_info *qmfs, qmf_t X[MAX_NTSRHFG][64],
real_t *output);
#ifdef __cplusplus
}
#endif
#endif

733
src/contrib/aacdecoder/libfaad/sbr_qmf_c.h Normal file → Executable file
View File

@ -1,365 +1,368 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_qmf_c.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_QMF_C_H__
#define __SBR_QMF_C_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MSC_VER
#pragma warning(disable:4305)
#pragma warning(disable:4244)
#endif
ALIGN static const real_t qmf_c[640] = {
FRAC_CONST(0), FRAC_CONST(-0.00055252865047),
FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896),
FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498),
FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972),
FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613),
FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938),
FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621),
FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273),
FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222),
FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532),
FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949),
FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927),
FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257),
FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757),
FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525),
FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372),
FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025),
FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906),
FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803),
FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756),
FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344),
FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005),
FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274),
FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041),
FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952),
FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865),
FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015),
FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475),
FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471),
FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224),
FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557),
FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126),
FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465),
FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525),
FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828),
FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104),
FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935),
FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781),
FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118),
FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745),
FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032),
FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982),
FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507),
FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045),
FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164),
FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932),
FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394),
FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897),
FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514),
FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906),
FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447),
FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246),
FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098),
FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321),
FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768),
FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248),
FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664),
FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893),
FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839),
FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624),
FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685),
FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726),
FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986),
FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508),
FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792),
FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989),
FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698),
FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535),
FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285),
FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329),
FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279),
FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337),
FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542),
FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745),
FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367),
FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413),
FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672),
FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216),
FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589),
FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299),
FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761),
FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172),
FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438),
FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228),
FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127),
FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102),
FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803),
FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194),
FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584),
FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119),
FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964),
FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746),
FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536),
FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287),
FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762),
FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903),
FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951),
FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508),
FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387),
FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867),
FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366),
FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701),
FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127),
FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691),
FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909),
FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228),
FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617),
FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304),
FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558),
FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064),
FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822),
FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934),
FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359),
FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279),
FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914),
FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773),
FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878),
FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187),
FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669),
FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142),
FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103),
FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149),
FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974),
FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603),
FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085),
FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916),
FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105),
FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931),
FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061),
FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675),
FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409),
FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665),
FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757),
FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099),
FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434),
FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855),
FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061),
FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923),
FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496),
FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291),
FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286),
FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671),
FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712),
FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032),
FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095),
FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994),
FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488),
FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242),
FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327),
FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392),
FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377),
FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491),
FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468),
FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336),
FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402),
FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722),
FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206),
FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268),
FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147),
FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107),
FRAC_CONST(0.85373856005937), FRAC_CONST(0.85357205739107),
FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147),
FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268),
FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206),
FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722),
FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402),
FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336),
FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468),
FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491),
FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377),
FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392),
FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327),
FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242),
FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488),
FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994),
FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095),
FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032),
FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712),
FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671),
FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286),
FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291),
FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496),
FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923),
FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061),
FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855),
FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434),
FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099),
FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757),
FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665),
FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409),
FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675),
FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061),
FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931),
FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105),
FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916),
FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085),
FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603),
FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974),
FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149),
FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103),
FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142),
FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669),
FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187),
FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878),
FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773),
FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914),
FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279),
FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359),
FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934),
FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822),
FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064),
FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558),
FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304),
FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617),
FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228),
FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909),
FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691),
FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127),
FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701),
FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366),
FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867),
FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387),
FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508),
FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951),
FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903),
FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762),
FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287),
FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536),
FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746),
FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964),
FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119),
FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584),
FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194),
FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803),
FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102),
FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127),
FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228),
FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438),
FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172),
FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761),
FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299),
FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589),
FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216),
FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672),
FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413),
FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367),
FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745),
FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542),
FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337),
FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279),
FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329),
FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285),
FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535),
FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698),
FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989),
FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792),
FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508),
FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986),
FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726),
FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685),
FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624),
FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839),
FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893),
FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664),
FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248),
FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768),
FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321),
FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098),
FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246),
FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447),
FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906),
FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514),
FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897),
FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394),
FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932),
FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164),
FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045),
FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507),
FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982),
FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032),
FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745),
FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118),
FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781),
FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935),
FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104),
FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828),
FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525),
FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465),
FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126),
FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557),
FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224),
FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471),
FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475),
FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015),
FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865),
FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952),
FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041),
FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274),
FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005),
FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344),
FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756),
FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803),
FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906),
FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025),
FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372),
FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525),
FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757),
FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257),
FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927),
FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949),
FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532),
FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222),
FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273),
FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621),
FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938),
FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613),
FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972),
FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498),
FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896),
FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047)
};
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_qmf_c.h,v 1.17 2007/11/01 12:33:36 menno Exp $
**/
#ifndef __SBR_QMF_C_H__
#define __SBR_QMF_C_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MSC_VER
#pragma warning(disable:4305)
#pragma warning(disable:4244)
#endif
ALIGN static const real_t qmf_c[640] = {
FRAC_CONST(0), FRAC_CONST(-0.00055252865047),
FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00049475180896),
FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00048937912498),
FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00052265642972),
FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00056778025613),
FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00061327473938),
FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00065403333621),
FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00069416146273),
FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00072550431222),
FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00074905980532),
FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00077248485949),
FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077798694927),
FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00078014496257),
FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00076307935757),
FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00073193571525),
FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00069179375372),
FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00063415949025),
FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00055645763906),
FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00046063254803),
FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00035011758756),
FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.0002098337344),
FRAC_CONST(-0.00014463809349), FRAC_CONST(-6.173344072E-005),
FRAC_CONST(1.349497418E-005), FRAC_CONST(0.00010943831274),
FRAC_CONST(0.00020430170688), FRAC_CONST(0.00029495311041),
FRAC_CONST(0.0004026540216), FRAC_CONST(0.00051073884952),
FRAC_CONST(0.00062393761391), FRAC_CONST(0.00074580258865),
FRAC_CONST(0.00086084433262), FRAC_CONST(0.00098859883015),
FRAC_CONST(0.00112501551307), FRAC_CONST(0.00125778846475),
FRAC_CONST(0.00139024948272), FRAC_CONST(0.00154432198471),
FRAC_CONST(0.00168680832531), FRAC_CONST(0.00183482654224),
FRAC_CONST(0.00198411407369), FRAC_CONST(0.00214615835557),
FRAC_CONST(0.00230172547746), FRAC_CONST(0.00246256169126),
FRAC_CONST(0.00262017586902), FRAC_CONST(0.00278704643465),
FRAC_CONST(0.00294694477165), FRAC_CONST(0.00311254206525),
FRAC_CONST(0.00327396134847), FRAC_CONST(0.00344188741828),
FRAC_CONST(0.00360082681231), FRAC_CONST(0.00376039229104),
FRAC_CONST(0.00392074323703), FRAC_CONST(0.00408197531935),
FRAC_CONST(0.0042264269227), FRAC_CONST(0.00437307196781),
FRAC_CONST(0.00452098527825), FRAC_CONST(0.00466064606118),
FRAC_CONST(0.00479325608498), FRAC_CONST(0.00491376035745),
FRAC_CONST(0.00503930226013), FRAC_CONST(0.00514073539032),
FRAC_CONST(0.00524611661324), FRAC_CONST(0.00534716811982),
FRAC_CONST(0.00541967759307), FRAC_CONST(0.00548760401507),
FRAC_CONST(0.00554757145088), FRAC_CONST(0.00559380230045),
FRAC_CONST(0.00562206432097), FRAC_CONST(0.00564551969164),
FRAC_CONST(0.00563891995151), FRAC_CONST(0.00562661141932),
FRAC_CONST(0.0055917128663), FRAC_CONST(0.005540436394),
FRAC_CONST(0.0054753783077), FRAC_CONST(0.0053838975897),
FRAC_CONST(0.00527157587272), FRAC_CONST(0.00513822754514),
FRAC_CONST(0.00498396877629), FRAC_CONST(0.004810946906),
FRAC_CONST(0.00460395301471), FRAC_CONST(0.00438018617447),
FRAC_CONST(0.0041251642327), FRAC_CONST(0.00384564081246),
FRAC_CONST(0.00354012465507), FRAC_CONST(0.00320918858098),
FRAC_CONST(0.00284467578623), FRAC_CONST(0.00245085400321),
FRAC_CONST(0.0020274176185), FRAC_CONST(0.00157846825768),
FRAC_CONST(0.00109023290512), FRAC_CONST(0.0005832264248),
FRAC_CONST(2.760451905E-005), FRAC_CONST(-0.00054642808664),
FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00180394725893),
FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.003193377839),
FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.004722259624),
FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.00637922932685),
FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00817982333726),
FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.01011502154986),
FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01218499959508),
FRAC_CONST(0.01327182200351), FRAC_CONST(0.01439046660792),
FRAC_CONST(0.01554055533423), FRAC_CONST(0.01673247129989),
FRAC_CONST(0.01794333813443), FRAC_CONST(0.01918724313698),
FRAC_CONST(0.02045317933555), FRAC_CONST(0.02174675502535),
FRAC_CONST(0.02306801692862), FRAC_CONST(0.02441609920285),
FRAC_CONST(0.02578758475467), FRAC_CONST(0.02718594296329),
FRAC_CONST(0.02860721736385), FRAC_CONST(0.03005026574279),
FRAC_CONST(0.03150176087389), FRAC_CONST(0.03297540810337),
FRAC_CONST(0.03446209487686), FRAC_CONST(0.03596975605542),
FRAC_CONST(0.03748128504252), FRAC_CONST(0.03900536794745),
FRAC_CONST(0.04053491705584), FRAC_CONST(0.04206490946367),
FRAC_CONST(0.04360975421304), FRAC_CONST(0.04514884056413),
FRAC_CONST(0.04668430272642), FRAC_CONST(0.04821657200672),
FRAC_CONST(0.04973857556014), FRAC_CONST(0.05125561555216),
FRAC_CONST(0.05276307465207), FRAC_CONST(0.05424527683589),
FRAC_CONST(0.05571736482138), FRAC_CONST(0.05716164501299),
FRAC_CONST(0.0585915683626), FRAC_CONST(0.05998374801761),
FRAC_CONST(0.06134551717207), FRAC_CONST(0.06268578081172),
FRAC_CONST(0.06397158980681), FRAC_CONST(0.0652247106438),
FRAC_CONST(0.06643675122104), FRAC_CONST(0.06760759851228),
FRAC_CONST(0.06870438283512), FRAC_CONST(0.06976302447127),
FRAC_CONST(0.07076287107266), FRAC_CONST(0.07170026731102),
FRAC_CONST(0.07256825833083), FRAC_CONST(0.07336202550803),
FRAC_CONST(0.07410036424342), FRAC_CONST(0.07474525581194),
FRAC_CONST(0.07531373362019), FRAC_CONST(0.07580083586584),
FRAC_CONST(0.07619924793396), FRAC_CONST(0.07649921704119),
FRAC_CONST(0.07670934904245), FRAC_CONST(0.07681739756964),
FRAC_CONST(0.07682300113923), FRAC_CONST(0.07672049241746),
FRAC_CONST(0.07650507183194), FRAC_CONST(0.07617483218536),
FRAC_CONST(0.07573057565061), FRAC_CONST(0.0751576255287),
FRAC_CONST(0.07446643947564), FRAC_CONST(0.0736406005762),
FRAC_CONST(0.07267746427299), FRAC_CONST(0.07158263647903),
FRAC_CONST(0.07035330735093), FRAC_CONST(0.06896640131951),
FRAC_CONST(0.06745250215166), FRAC_CONST(0.06576906686508),
FRAC_CONST(0.06394448059633), FRAC_CONST(0.06196027790387),
FRAC_CONST(0.0598166570809), FRAC_CONST(0.05751526919867),
FRAC_CONST(0.05504600343009), FRAC_CONST(0.05240938217366),
FRAC_CONST(0.04959786763445), FRAC_CONST(0.04663033051701),
FRAC_CONST(0.04347687821958), FRAC_CONST(0.04014582784127),
FRAC_CONST(0.03664181168133), FRAC_CONST(0.03295839306691),
FRAC_CONST(0.02908240060125), FRAC_CONST(0.02503075618909),
FRAC_CONST(0.02079970728622), FRAC_CONST(0.01637012582228),
FRAC_CONST(0.01176238327857), FRAC_CONST(0.00696368621617),
FRAC_CONST(0.00197656014503), FRAC_CONST(-0.00320868968304),
FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.01412888273558),
FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.02582272888064),
FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.03827765720822),
FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.05148041767934),
FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.06544098531359),
FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.08013729344279),
FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.09555333528914),
FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.1116826931773),
FRAC_CONST(-0.120007798468), FRAC_CONST(-0.12850028503878),
FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.1459766491187),
FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.16409588556669),
FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.18281725485142),
FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.20212501768103),
FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.22196526964149),
FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.24230168845974),
FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.26310532994603),
FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.28432141891085),
FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.30590985751916),
FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.32781137272105),
FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.3499914122931),
FRAC_CONST(0.36115899031355), FRAC_CONST(0.37237955463061),
FRAC_CONST(0.38363500139043), FRAC_CONST(0.39492117615675),
FRAC_CONST(0.40623176767625), FRAC_CONST(0.41756968968409),
FRAC_CONST(0.42891199207373), FRAC_CONST(0.44025537543665),
FRAC_CONST(0.45159965356824), FRAC_CONST(0.46293080852757),
FRAC_CONST(0.47424532146115), FRAC_CONST(0.48552530911099),
FRAC_CONST(0.49677082545707), FRAC_CONST(0.50798175000434),
FRAC_CONST(0.51912349702391), FRAC_CONST(0.53022408956855),
FRAC_CONST(0.54125534487322), FRAC_CONST(0.55220512585061),
FRAC_CONST(0.5630789140137), FRAC_CONST(0.57385241316923),
FRAC_CONST(0.58454032354679), FRAC_CONST(0.59511230862496),
FRAC_CONST(0.6055783538918), FRAC_CONST(0.61591099320291),
FRAC_CONST(0.62612426956055), FRAC_CONST(0.63619801077286),
FRAC_CONST(0.64612696959461), FRAC_CONST(0.65590163024671),
FRAC_CONST(0.66551398801627), FRAC_CONST(0.67496631901712),
FRAC_CONST(0.68423532934598), FRAC_CONST(0.69332823767032),
FRAC_CONST(0.70223887193539), FRAC_CONST(0.71094104263095),
FRAC_CONST(0.71944626349561), FRAC_CONST(0.72774489002994),
FRAC_CONST(0.73582117582769), FRAC_CONST(0.74368278636488),
FRAC_CONST(0.75131374561237), FRAC_CONST(0.75870807608242),
FRAC_CONST(0.76586748650939), FRAC_CONST(0.77277808813327),
FRAC_CONST(0.77942875190216), FRAC_CONST(0.7858353120392),
FRAC_CONST(0.79197358416424), FRAC_CONST(0.797846641377),
FRAC_CONST(0.80344857518505), FRAC_CONST(0.80876950044491),
FRAC_CONST(0.81381912706217), FRAC_CONST(0.81857760046468),
FRAC_CONST(0.82304198905409), FRAC_CONST(0.8272275347336),
FRAC_CONST(0.8311038457152), FRAC_CONST(0.83469373618402),
FRAC_CONST(0.83797173378865), FRAC_CONST(0.84095413924722),
FRAC_CONST(0.84362382812005), FRAC_CONST(0.84598184698206),
FRAC_CONST(0.84803157770763), FRAC_CONST(0.84978051984268),
FRAC_CONST(0.85119715249343), FRAC_CONST(0.85230470352147),
FRAC_CONST(0.85310209497017), FRAC_CONST(0.85357205739107),
FRAC_CONST(0.85373856005937 /*max*/), FRAC_CONST(0.85357205739107),
FRAC_CONST(0.85310209497017), FRAC_CONST(0.85230470352147),
FRAC_CONST(0.85119715249343), FRAC_CONST(0.84978051984268),
FRAC_CONST(0.84803157770763), FRAC_CONST(0.84598184698206),
FRAC_CONST(0.84362382812005), FRAC_CONST(0.84095413924722),
FRAC_CONST(0.83797173378865), FRAC_CONST(0.83469373618402),
FRAC_CONST(0.8311038457152), FRAC_CONST(0.8272275347336),
FRAC_CONST(0.82304198905409), FRAC_CONST(0.81857760046468),
FRAC_CONST(0.81381912706217), FRAC_CONST(0.80876950044491),
FRAC_CONST(0.80344857518505), FRAC_CONST(0.797846641377),
FRAC_CONST(0.79197358416424), FRAC_CONST(0.7858353120392),
FRAC_CONST(0.77942875190216), FRAC_CONST(0.77277808813327),
FRAC_CONST(0.76586748650939), FRAC_CONST(0.75870807608242),
FRAC_CONST(0.75131374561237), FRAC_CONST(0.74368278636488),
FRAC_CONST(0.73582117582769), FRAC_CONST(0.72774489002994),
FRAC_CONST(0.71944626349561), FRAC_CONST(0.71094104263095),
FRAC_CONST(0.70223887193539), FRAC_CONST(0.69332823767032),
FRAC_CONST(0.68423532934598), FRAC_CONST(0.67496631901712),
FRAC_CONST(0.66551398801627), FRAC_CONST(0.65590163024671),
FRAC_CONST(0.64612696959461), FRAC_CONST(0.63619801077286),
FRAC_CONST(0.62612426956055), FRAC_CONST(0.61591099320291),
FRAC_CONST(0.6055783538918), FRAC_CONST(0.59511230862496),
FRAC_CONST(0.58454032354679), FRAC_CONST(0.57385241316923),
FRAC_CONST(0.5630789140137), FRAC_CONST(0.55220512585061),
FRAC_CONST(0.54125534487322), FRAC_CONST(0.53022408956855),
FRAC_CONST(0.51912349702391), FRAC_CONST(0.50798175000434),
FRAC_CONST(0.49677082545707), FRAC_CONST(0.48552530911099),
FRAC_CONST(0.47424532146115), FRAC_CONST(0.46293080852757),
FRAC_CONST(0.45159965356824), FRAC_CONST(0.44025537543665),
FRAC_CONST(0.42891199207373), FRAC_CONST(0.41756968968409),
FRAC_CONST(0.40623176767625), FRAC_CONST(0.39492117615675),
FRAC_CONST(0.38363500139043), FRAC_CONST(0.37237955463061),
FRAC_CONST(-0.36115899031355), FRAC_CONST(-0.3499914122931),
FRAC_CONST(-0.33887226938665), FRAC_CONST(-0.32781137272105),
FRAC_CONST(-0.31682789136456), FRAC_CONST(-0.30590985751916),
FRAC_CONST(-0.29507167170646), FRAC_CONST(-0.28432141891085),
FRAC_CONST(-0.27366340405625), FRAC_CONST(-0.26310532994603),
FRAC_CONST(-0.25264803095722), FRAC_CONST(-0.24230168845974),
FRAC_CONST(-0.23206908706791), FRAC_CONST(-0.22196526964149),
FRAC_CONST(-0.21197358538056), FRAC_CONST(-0.20212501768103),
FRAC_CONST(-0.19239667457267), FRAC_CONST(-0.18281725485142),
FRAC_CONST(-0.17338081721706), FRAC_CONST(-0.16409588556669),
FRAC_CONST(-0.15496070710605), FRAC_CONST(-0.1459766491187),
FRAC_CONST(-0.13715517611934), FRAC_CONST(-0.12850028503878),
FRAC_CONST(-0.120007798468), FRAC_CONST(-0.1116826931773),
FRAC_CONST(-0.10353295311463), FRAC_CONST(-0.09555333528914),
FRAC_CONST(-0.08775475365593), FRAC_CONST(-0.08013729344279),
FRAC_CONST(-0.07269433008129), FRAC_CONST(-0.06544098531359),
FRAC_CONST(-0.05837053268336), FRAC_CONST(-0.05148041767934),
FRAC_CONST(-0.04478068215856), FRAC_CONST(-0.03827765720822),
FRAC_CONST(-0.03195312745332), FRAC_CONST(-0.02582272888064),
FRAC_CONST(-0.01988341292573), FRAC_CONST(-0.01412888273558),
FRAC_CONST(-0.00857117491366), FRAC_CONST(-0.00320868968304),
FRAC_CONST(0.00197656014503), FRAC_CONST(0.00696368621617),
FRAC_CONST(0.01176238327857), FRAC_CONST(0.01637012582228),
FRAC_CONST(0.02079970728622), FRAC_CONST(0.02503075618909),
FRAC_CONST(0.02908240060125), FRAC_CONST(0.03295839306691),
FRAC_CONST(0.03664181168133), FRAC_CONST(0.04014582784127),
FRAC_CONST(0.04347687821958), FRAC_CONST(0.04663033051701),
FRAC_CONST(0.04959786763445), FRAC_CONST(0.05240938217366),
FRAC_CONST(0.05504600343009), FRAC_CONST(0.05751526919867),
FRAC_CONST(0.0598166570809), FRAC_CONST(0.06196027790387),
FRAC_CONST(0.06394448059633), FRAC_CONST(0.06576906686508),
FRAC_CONST(0.06745250215166), FRAC_CONST(0.06896640131951),
FRAC_CONST(0.07035330735093), FRAC_CONST(0.07158263647903),
FRAC_CONST(0.07267746427299), FRAC_CONST(0.0736406005762),
FRAC_CONST(0.07446643947564), FRAC_CONST(0.0751576255287),
FRAC_CONST(0.07573057565061), FRAC_CONST(0.07617483218536),
FRAC_CONST(0.07650507183194), FRAC_CONST(0.07672049241746),
FRAC_CONST(0.07682300113923), FRAC_CONST(0.07681739756964),
FRAC_CONST(0.07670934904245), FRAC_CONST(0.07649921704119),
FRAC_CONST(0.07619924793396), FRAC_CONST(0.07580083586584),
FRAC_CONST(0.07531373362019), FRAC_CONST(0.07474525581194),
FRAC_CONST(0.07410036424342), FRAC_CONST(0.07336202550803),
FRAC_CONST(0.07256825833083), FRAC_CONST(0.07170026731102),
FRAC_CONST(0.07076287107266), FRAC_CONST(0.06976302447127),
FRAC_CONST(0.06870438283512), FRAC_CONST(0.06760759851228),
FRAC_CONST(0.06643675122104), FRAC_CONST(0.0652247106438),
FRAC_CONST(0.06397158980681), FRAC_CONST(0.06268578081172),
FRAC_CONST(0.06134551717207), FRAC_CONST(0.05998374801761),
FRAC_CONST(0.0585915683626), FRAC_CONST(0.05716164501299),
FRAC_CONST(0.05571736482138), FRAC_CONST(0.05424527683589),
FRAC_CONST(0.05276307465207), FRAC_CONST(0.05125561555216),
FRAC_CONST(0.04973857556014), FRAC_CONST(0.04821657200672),
FRAC_CONST(0.04668430272642), FRAC_CONST(0.04514884056413),
FRAC_CONST(0.04360975421304), FRAC_CONST(0.04206490946367),
FRAC_CONST(0.04053491705584), FRAC_CONST(0.03900536794745),
FRAC_CONST(0.03748128504252), FRAC_CONST(0.03596975605542),
FRAC_CONST(0.03446209487686), FRAC_CONST(0.03297540810337),
FRAC_CONST(0.03150176087389), FRAC_CONST(0.03005026574279),
FRAC_CONST(0.02860721736385), FRAC_CONST(0.02718594296329),
FRAC_CONST(0.02578758475467), FRAC_CONST(0.02441609920285),
FRAC_CONST(0.02306801692862), FRAC_CONST(0.02174675502535),
FRAC_CONST(0.02045317933555), FRAC_CONST(0.01918724313698),
FRAC_CONST(0.01794333813443), FRAC_CONST(0.01673247129989),
FRAC_CONST(0.01554055533423), FRAC_CONST(0.01439046660792),
FRAC_CONST(-0.01327182200351), FRAC_CONST(-0.01218499959508),
FRAC_CONST(-0.01113155480321), FRAC_CONST(-0.01011502154986),
FRAC_CONST(-0.00913253296085), FRAC_CONST(-0.00817982333726),
FRAC_CONST(-0.00726158168517), FRAC_CONST(-0.00637922932685),
FRAC_CONST(-0.00553372111088), FRAC_CONST(-0.004722259624),
FRAC_CONST(-0.00394011240522), FRAC_CONST(-0.003193377839),
FRAC_CONST(-0.00248267236449), FRAC_CONST(-0.00180394725893),
FRAC_CONST(-0.00115681355227), FRAC_CONST(-0.00054642808664),
FRAC_CONST(2.760451905E-005), FRAC_CONST(0.0005832264248),
FRAC_CONST(0.00109023290512), FRAC_CONST(0.00157846825768),
FRAC_CONST(0.0020274176185), FRAC_CONST(0.00245085400321),
FRAC_CONST(0.00284467578623), FRAC_CONST(0.00320918858098),
FRAC_CONST(0.00354012465507), FRAC_CONST(0.00384564081246),
FRAC_CONST(0.0041251642327), FRAC_CONST(0.00438018617447),
FRAC_CONST(0.00460395301471), FRAC_CONST(0.004810946906),
FRAC_CONST(0.00498396877629), FRAC_CONST(0.00513822754514),
FRAC_CONST(0.00527157587272), FRAC_CONST(0.0053838975897),
FRAC_CONST(0.0054753783077), FRAC_CONST(0.005540436394),
FRAC_CONST(0.0055917128663), FRAC_CONST(0.00562661141932),
FRAC_CONST(0.00563891995151), FRAC_CONST(0.00564551969164),
FRAC_CONST(0.00562206432097), FRAC_CONST(0.00559380230045),
FRAC_CONST(0.00554757145088), FRAC_CONST(0.00548760401507),
FRAC_CONST(0.00541967759307), FRAC_CONST(0.00534716811982),
FRAC_CONST(0.00524611661324), FRAC_CONST(0.00514073539032),
FRAC_CONST(0.00503930226013), FRAC_CONST(0.00491376035745),
FRAC_CONST(0.00479325608498), FRAC_CONST(0.00466064606118),
FRAC_CONST(0.00452098527825), FRAC_CONST(0.00437307196781),
FRAC_CONST(0.0042264269227), FRAC_CONST(0.00408197531935),
FRAC_CONST(0.00392074323703), FRAC_CONST(0.00376039229104),
FRAC_CONST(0.00360082681231), FRAC_CONST(0.00344188741828),
FRAC_CONST(0.00327396134847), FRAC_CONST(0.00311254206525),
FRAC_CONST(0.00294694477165), FRAC_CONST(0.00278704643465),
FRAC_CONST(0.00262017586902), FRAC_CONST(0.00246256169126),
FRAC_CONST(0.00230172547746), FRAC_CONST(0.00214615835557),
FRAC_CONST(0.00198411407369), FRAC_CONST(0.00183482654224),
FRAC_CONST(0.00168680832531), FRAC_CONST(0.00154432198471),
FRAC_CONST(0.00139024948272), FRAC_CONST(0.00125778846475),
FRAC_CONST(0.00112501551307), FRAC_CONST(0.00098859883015),
FRAC_CONST(0.00086084433262), FRAC_CONST(0.00074580258865),
FRAC_CONST(0.00062393761391), FRAC_CONST(0.00051073884952),
FRAC_CONST(0.0004026540216), FRAC_CONST(0.00029495311041),
FRAC_CONST(0.00020430170688), FRAC_CONST(0.00010943831274),
FRAC_CONST(1.349497418E-005), FRAC_CONST(-6.173344072E-005),
FRAC_CONST(-0.00014463809349), FRAC_CONST(-0.0002098337344),
FRAC_CONST(-0.00028969811748), FRAC_CONST(-0.00035011758756),
FRAC_CONST(-0.00040951214522), FRAC_CONST(-0.00046063254803),
FRAC_CONST(-0.00051455722108), FRAC_CONST(-0.00055645763906),
FRAC_CONST(-0.0005946118933), FRAC_CONST(-0.00063415949025),
FRAC_CONST(-0.00066504150893), FRAC_CONST(-0.00069179375372),
FRAC_CONST(-0.00072153919876), FRAC_CONST(-0.00073193571525),
FRAC_CONST(-0.00075300014201), FRAC_CONST(-0.00076307935757),
FRAC_CONST(-0.0007757977331), FRAC_CONST(-0.00078014496257),
FRAC_CONST(-0.000780366471), FRAC_CONST(-0.00077798694927),
FRAC_CONST(-0.00078343322877), FRAC_CONST(-0.00077248485949),
FRAC_CONST(-0.0007681371927), FRAC_CONST(-0.00074905980532),
FRAC_CONST(-0.00074409418541), FRAC_CONST(-0.00072550431222),
FRAC_CONST(-0.00071577364744), FRAC_CONST(-0.00069416146273),
FRAC_CONST(-0.00067776907764), FRAC_CONST(-0.00065403333621),
FRAC_CONST(-0.00063124935319), FRAC_CONST(-0.00061327473938),
FRAC_CONST(-0.00058709304852), FRAC_CONST(-0.00056778025613),
FRAC_CONST(-0.00054665656337), FRAC_CONST(-0.00052265642972),
FRAC_CONST(-0.00050407143497), FRAC_CONST(-0.00048937912498),
FRAC_CONST(-0.00048752279712), FRAC_CONST(-0.00049475180896),
FRAC_CONST(-0.00056176925738), FRAC_CONST(-0.00055252865047)
};
#endif

1634
src/contrib/aacdecoder/libfaad/sbr_syntax.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

132
src/contrib/aacdecoder/libfaad/sbr_syntax.h Normal file → Executable file
View File

@ -1,64 +1,68 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_syntax.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_SYNTAX_H__
#define __SBR_SYNTAX_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "bits.h"
#define T_HFGEN 8
#define T_HFADJ 2
#define EXT_SBR_DATA 13
#define EXT_SBR_DATA_CRC 14
#define FIXFIX 0
#define FIXVAR 1
#define VARFIX 2
#define VARVAR 3
#define LO_RES 0
#define HI_RES 1
#define NO_TIME_SLOTS_960 15
#define NO_TIME_SLOTS 16
#define RATE 2
#define NOISE_FLOOR_OFFSET 6
uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt);
#ifdef __cplusplus
}
#endif
#endif /* __SBR_SYNTAX_H__ */
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_syntax.h,v 1.23 2007/11/01 12:33:36 menno Exp $
**/
#ifndef __SBR_SYNTAX_H__
#define __SBR_SYNTAX_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "bits.h"
#define T_HFGEN 8
#define T_HFADJ 2
#define EXT_SBR_DATA 13
#define EXT_SBR_DATA_CRC 14
#define FIXFIX 0
#define FIXVAR 1
#define VARFIX 2
#define VARVAR 3
#define LO_RES 0
#define HI_RES 1
#define NO_TIME_SLOTS_960 15
#define NO_TIME_SLOTS 16
#define RATE 2
#define NOISE_FLOOR_OFFSET 6
uint8_t sbr_extension_data(bitfile *ld, sbr_info *sbr, uint16_t cnt,
uint8_t resetFlag);
#ifdef __cplusplus
}
#endif
#endif /* __SBR_SYNTAX_H__ */

515
src/contrib/aacdecoder/libfaad/sbr_tf_grid.c Normal file → Executable file
View File

@ -1,254 +1,261 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_tf_grid.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
/* Time/Frequency grid */
#include "common.h"
#include "structs.h"
#ifdef SBR_DEC
#include <stdlib.h>
#include "sbr_syntax.h"
#include "sbr_tf_grid.h"
/* static function declarations */
#if 0
static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l);
static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l);
#endif
static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
{
uint8_t l, border, temp;
for (l = 0; l <= sbr->L_E[ch]; l++)
{
sbr->t_E[ch][l] = 0;
}
sbr->t_E[ch][0] = sbr->rate * sbr->abs_bord_lead[ch];
sbr->t_E[ch][sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
switch (sbr->L_E[ch])
{
case 4:
temp = (int) (sbr->numTimeSlots / 4);
sbr->t_E[ch][3] = sbr->rate * 3 * temp;
sbr->t_E[ch][2] = sbr->rate * 2 * temp;
sbr->t_E[ch][1] = sbr->rate * temp;
break;
case 2:
sbr->t_E[ch][1] = sbr->rate * (int) (sbr->numTimeSlots / 2);
break;
default:
break;
}
break;
case FIXVAR:
if (sbr->L_E[ch] > 1)
{
int8_t i = sbr->L_E[ch];
border = sbr->abs_bord_trail[ch];
for (l = 0; l < (sbr->L_E[ch] - 1); l++)
{
if (border < sbr->bs_rel_bord[ch][l])
return 1;
border -= sbr->bs_rel_bord[ch][l];
sbr->t_E[ch][--i] = sbr->rate * border;
}
}
break;
case VARFIX:
if (sbr->L_E[ch] > 1)
{
int8_t i = 1;
border = sbr->abs_bord_lead[ch];
for (l = 0; l < (sbr->L_E[ch] - 1); l++)
{
border += sbr->bs_rel_bord[ch][l];
if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
return 1;
sbr->t_E[ch][i++] = sbr->rate * border;
}
}
break;
case VARVAR:
if (sbr->bs_num_rel_0[ch])
{
int8_t i = 1;
border = sbr->abs_bord_lead[ch];
for (l = 0; l < sbr->bs_num_rel_0[ch]; l++)
{
border += sbr->bs_rel_bord_0[ch][l];
if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
return 1;
sbr->t_E[ch][i++] = sbr->rate * border;
}
}
if (sbr->bs_num_rel_1[ch])
{
int8_t i = sbr->L_E[ch];
border = sbr->abs_bord_trail[ch];
for (l = 0; l < sbr->bs_num_rel_1[ch]; l++)
{
if (border < sbr->bs_rel_bord_1[ch][l])
return 1;
border -= sbr->bs_rel_bord_1[ch][l];
sbr->t_E[ch][--i] = sbr->rate * border;
}
}
break;
}
return 0;
}
void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
{
sbr->t_Q[ch][0] = sbr->t_E[ch][0];
if (sbr->L_E[ch] == 1)
{
sbr->t_Q[ch][1] = sbr->t_E[ch][1];
sbr->t_Q[ch][2] = 0;
} else {
uint8_t index = middleBorder(sbr, ch);
sbr->t_Q[ch][1] = sbr->t_E[ch][index];
sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]];
}
}
#if 0
static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
{
uint8_t i;
int16_t acc = 0;
switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
return sbr->numTimeSlots/sbr->L_E[ch];
case FIXVAR:
return 0;
case VARFIX:
for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord[ch][i];
}
return acc;
case VARVAR:
for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord_0[ch][i];
}
return acc;
}
return 0;
}
static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
{
uint8_t i;
int16_t acc = 0;
switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
case VARFIX:
return 0;
case FIXVAR:
for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord[ch][i];
}
return acc;
case VARVAR:
for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord_1[ch][i];
}
return acc;
}
return 0;
}
#endif
static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
{
int8_t retval = 0;
switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
retval = sbr->L_E[ch]/2;
break;
case VARFIX:
if (sbr->bs_pointer[ch] == 0)
retval = 1;
else if (sbr->bs_pointer[ch] == 1)
retval = sbr->L_E[ch] - 1;
else
retval = sbr->bs_pointer[ch] - 1;
break;
case FIXVAR:
case VARVAR:
if (sbr->bs_pointer[ch] > 1)
retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
else
retval = sbr->L_E[ch] - 1;
break;
}
return (retval > 0) ? retval : 0;
}
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_tf_grid.c,v 1.20 2008/09/19 22:50:20 menno Exp $
**/
/* Time/Frequency grid */
#include "common.h"
#include "structs.h"
#ifdef SBR_DEC
#include <stdlib.h>
#include "sbr_syntax.h"
#include "sbr_tf_grid.h"
/* static function declarations */
#if 0
static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l);
static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l);
#endif
static uint8_t middleBorder(sbr_info *sbr, uint8_t ch);
/* function constructs new time border vector */
/* first build into temp vector to be able to use previous vector on error */
uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch)
{
uint8_t l, border, temp;
uint8_t t_E_temp[6] = {0};
t_E_temp[0] = sbr->rate * sbr->abs_bord_lead[ch];
t_E_temp[sbr->L_E[ch]] = sbr->rate * sbr->abs_bord_trail[ch];
switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
switch (sbr->L_E[ch])
{
case 4:
temp = (sbr->numTimeSlots / 4);
t_E_temp[3] = sbr->rate * 3 * temp;
t_E_temp[2] = sbr->rate * 2 * temp;
t_E_temp[1] = sbr->rate * temp;
break;
case 2:
t_E_temp[1] = sbr->rate * (sbr->numTimeSlots / 2);
break;
default:
break;
}
break;
case FIXVAR:
if (sbr->L_E[ch] > 1)
{
int8_t i = sbr->L_E[ch];
border = sbr->abs_bord_trail[ch];
for (l = 0; l < (sbr->L_E[ch] - 1); l++)
{
if (border < sbr->bs_rel_bord[ch][l])
return 1;
border -= sbr->bs_rel_bord[ch][l];
t_E_temp[--i] = sbr->rate * border;
}
}
break;
case VARFIX:
if (sbr->L_E[ch] > 1)
{
int8_t i = 1;
border = sbr->abs_bord_lead[ch];
for (l = 0; l < (sbr->L_E[ch] - 1); l++)
{
border += sbr->bs_rel_bord[ch][l];
if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
return 1;
t_E_temp[i++] = sbr->rate * border;
}
}
break;
case VARVAR:
if (sbr->bs_num_rel_0[ch])
{
int8_t i = 1;
border = sbr->abs_bord_lead[ch];
for (l = 0; l < sbr->bs_num_rel_0[ch]; l++)
{
border += sbr->bs_rel_bord_0[ch][l];
if (sbr->rate * border + sbr->tHFAdj > sbr->numTimeSlotsRate+sbr->tHFGen)
return 1;
t_E_temp[i++] = sbr->rate * border;
}
}
if (sbr->bs_num_rel_1[ch])
{
int8_t i = sbr->L_E[ch];
border = sbr->abs_bord_trail[ch];
for (l = 0; l < sbr->bs_num_rel_1[ch]; l++)
{
if (border < sbr->bs_rel_bord_1[ch][l])
return 1;
border -= sbr->bs_rel_bord_1[ch][l];
t_E_temp[--i] = sbr->rate * border;
}
}
break;
}
/* no error occured, we can safely use this t_E vector */
for (l = 0; l < 6; l++)
{
sbr->t_E[ch][l] = t_E_temp[l];
}
return 0;
}
void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch)
{
sbr->t_Q[ch][0] = sbr->t_E[ch][0];
if (sbr->L_E[ch] == 1)
{
sbr->t_Q[ch][1] = sbr->t_E[ch][1];
sbr->t_Q[ch][2] = 0;
} else {
uint8_t index = middleBorder(sbr, ch);
sbr->t_Q[ch][1] = sbr->t_E[ch][index];
sbr->t_Q[ch][2] = sbr->t_E[ch][sbr->L_E[ch]];
}
}
#if 0
static int16_t rel_bord_lead(sbr_info *sbr, uint8_t ch, uint8_t l)
{
uint8_t i;
int16_t acc = 0;
switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
return sbr->numTimeSlots/sbr->L_E[ch];
case FIXVAR:
return 0;
case VARFIX:
for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord[ch][i];
}
return acc;
case VARVAR:
for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord_0[ch][i];
}
return acc;
}
return 0;
}
static int16_t rel_bord_trail(sbr_info *sbr, uint8_t ch, uint8_t l)
{
uint8_t i;
int16_t acc = 0;
switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
case VARFIX:
return 0;
case FIXVAR:
for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord[ch][i];
}
return acc;
case VARVAR:
for (i = 0; i < l; i++)
{
acc += sbr->bs_rel_bord_1[ch][i];
}
return acc;
}
return 0;
}
#endif
static uint8_t middleBorder(sbr_info *sbr, uint8_t ch)
{
int8_t retval = 0;
switch (sbr->bs_frame_class[ch])
{
case FIXFIX:
retval = sbr->L_E[ch]/2;
break;
case VARFIX:
if (sbr->bs_pointer[ch] == 0)
retval = 1;
else if (sbr->bs_pointer[ch] == 1)
retval = sbr->L_E[ch] - 1;
else
retval = sbr->bs_pointer[ch] - 1;
break;
case FIXVAR:
case VARVAR:
if (sbr->bs_pointer[ch] > 1)
retval = sbr->L_E[ch] + 1 - sbr->bs_pointer[ch];
else
retval = sbr->L_E[ch] - 1;
break;
}
return (retval > 0) ? retval : 0;
}
#endif

91
src/contrib/aacdecoder/libfaad/sbr_tf_grid.h Normal file → Executable file
View File

@ -1,44 +1,47 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_tf_grid.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SBR_TF_GRID_H__
#define __SBR_TF_GRID_H__
#ifdef __cplusplus
extern "C" {
#endif
uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch);
void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: sbr_tf_grid.h,v 1.17 2007/11/01 12:33:36 menno Exp $
**/
#ifndef __SBR_TF_GRID_H__
#define __SBR_TF_GRID_H__
#ifdef __cplusplus
extern "C" {
#endif
uint8_t envelope_time_border_vector(sbr_info *sbr, uint8_t ch);
void noise_floor_time_border_vector(sbr_info *sbr, uint8_t ch);
#ifdef __cplusplus
}
#endif
#endif

8605
src/contrib/aacdecoder/libfaad/sine_win.h Normal file → Executable file

File diff suppressed because it is too large Load Diff

2612
src/contrib/aacdecoder/libfaad/specrec.c Normal file → Executable file

File diff suppressed because it is too large Load Diff

101
src/contrib/aacdecoder/libfaad/specrec.h Normal file → Executable file
View File

@ -1,52 +1,49 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: specrec.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SPECREC_H__
#define __SPECREC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "syntax.h"
uint8_t window_grouping_info(faacDecHandle hDecoder, ic_stream *ics);
void apply_scalefactors(faacDecHandle hDecoder, ic_stream *ics, real_t *x_invquant,
uint16_t frame_len);
#ifdef USE_SSE
void apply_scalefactors_sse(faacDecHandle hDecoder, ic_stream *ics, real_t *x_invquant,
uint16_t frame_len);
#endif
uint8_t reconstruct_channel_pair(faacDecHandle hDecoder, ic_stream *ics1, ic_stream *ics2,
element *cpe, int16_t *spec_data1, int16_t *spec_data2);
uint8_t reconstruct_single_channel(faacDecHandle hDecoder, ic_stream *ics, element *sce,
int16_t *spec_data);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: specrec.h,v 1.33 2009/01/26 23:51:15 menno Exp $
**/
#ifndef __SPECREC_H__
#define __SPECREC_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "syntax.h"
uint8_t window_grouping_info(NeAACDecStruct *hDecoder, ic_stream *ics);
uint8_t reconstruct_channel_pair(NeAACDecStruct *hDecoder, ic_stream *ics1, ic_stream *ics2,
element *cpe, int16_t *spec_data1, int16_t *spec_data2);
uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics, element *sce,
int16_t *spec_data);
#ifdef __cplusplus
}
#endif
#endif

347
src/contrib/aacdecoder/libfaad/ssr.c Normal file → Executable file
View File

@ -1,172 +1,175 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ssr.c,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef SSR_DEC
#include "syntax.h"
#include "filtbank.h"
#include "ssr.h"
#include "ssr_fb.h"
void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
uint8_t window_shape, uint8_t window_shape_prev,
real_t *freq_in, real_t *time_out, real_t *overlap,
real_t ipqf_buffer[SSR_BANDS][96/4],
real_t *prev_fmd, uint16_t frame_len)
{
uint8_t band;
uint16_t ssr_frame_len = frame_len/SSR_BANDS;
real_t time_tmp[2048] = {0};
real_t output[1024] = {0};
for (band = 0; band < SSR_BANDS; band++)
{
int16_t j;
/* uneven bands have inverted frequency scale */
if (band == 1 || band == 3)
{
for (j = 0; j < ssr_frame_len/2; j++)
{
real_t tmp;
tmp = freq_in[j + ssr_frame_len*band];
freq_in[j + ssr_frame_len*band] =
freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band];
freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band] = tmp;
}
}
/* non-overlapping inverse filterbank for SSR */
ssr_ifilter_bank(fb, window_sequence, window_shape, window_shape_prev,
freq_in + band*ssr_frame_len, time_tmp + band*ssr_frame_len,
ssr_frame_len);
/* gain control */
ssr_gain_control(ssr, time_tmp, output, overlap, prev_fmd,
band, window_sequence, ssr_frame_len);
}
/* inverse pqf to bring subbands together again */
ssr_ipqf(ssr, output, time_out, ipqf_buffer, frame_len, SSR_BANDS);
}
static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
real_t *overlap, real_t *prev_fmd, uint8_t band,
uint8_t window_sequence, uint16_t frame_len)
{
uint16_t i;
real_t gc_function[2*1024/SSR_BANDS];
if (window_sequence != EIGHT_SHORT_SEQUENCE)
{
ssr_gc_function(ssr, &prev_fmd[band * frame_len*2],
gc_function, window_sequence, band, frame_len);
for (i = 0; i < frame_len*2; i++)
data[band * frame_len*2 + i] *= gc_function[i];
for (i = 0; i < frame_len; i++)
{
output[band*frame_len + i] = overlap[band*frame_len + i] +
data[band*frame_len*2 + i];
}
for (i = 0; i < frame_len; i++)
{
overlap[band*frame_len + i] =
data[band*frame_len*2 + frame_len + i];
}
} else {
uint8_t w;
for (w = 0; w < 8; w++)
{
uint16_t frame_len8 = frame_len/8;
uint16_t frame_len16 = frame_len/16;
ssr_gc_function(ssr, &prev_fmd[band*frame_len*2 + w*frame_len*2/8],
gc_function, window_sequence, frame_len);
for (i = 0; i < frame_len8*2; i++)
data[band*frame_len*2 + w*frame_len8*2+i] *= gc_function[i];
for (i = 0; i < frame_len8; i++)
{
overlap[band*frame_len + i + 7*frame_len16 + w*frame_len8] +=
data[band*frame_len*2 + 2*w*frame_len8 + i];
}
for (i = 0; i < frame_len8; i++)
{
overlap[band*frame_len + i + 7*frame_len16 + (w+1)*frame_len8] =
data[band*frame_len*2 + 2*w*frame_len8 + frame_len8 + i];
}
}
for (i = 0; i < frame_len; i++)
output[band*frame_len + i] = overlap[band*frame_len + i];
for (i = 0; i < frame_len; i++)
overlap[band*frame_len + i] = overlap[band*frame_len + i + frame_len];
}
}
static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
real_t *gc_function, uint8_t window_sequence,
uint8_t band, uint16_t frame_len)
{
uint16_t i;
uint16_t len_area1, len_area2;
int32_t aloc[10];
real_t alev[10];
switch (window_sequence)
{
case ONLY_LONG_SEQUENCE:
len_area1 = frame_len/SSR_BANDS;
len_area2 = 0;
break;
case LONG_START_SEQUENCE:
len_area1 = (frame_len/SSR_BANDS)*7/32;
len_area2 = (frame_len/SSR_BANDS)/16;
break;
case EIGHT_SHORT_SEQUENCE:
len_area1 = (frame_len/8)/SSR_BANDS;
len_area2 = 0;
break;
case LONG_STOP_SEQUENCE:
len_area1 = (frame_len/SSR_BANDS);
len_area2 = 0;
break;
}
/* decode bitstream information */
/* build array M */
for (i = 0; i < frame_len*2; i++)
gc_function[i] = 1;
}
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: ssr.c,v 1.19 2007/11/01 12:33:36 menno Exp $
**/
#include "common.h"
#include "structs.h"
#ifdef SSR_DEC
#include "syntax.h"
#include "filtbank.h"
#include "ssr.h"
#include "ssr_fb.h"
void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
uint8_t window_shape, uint8_t window_shape_prev,
real_t *freq_in, real_t *time_out, real_t *overlap,
real_t ipqf_buffer[SSR_BANDS][96/4],
real_t *prev_fmd, uint16_t frame_len)
{
uint8_t band;
uint16_t ssr_frame_len = frame_len/SSR_BANDS;
real_t time_tmp[2048] = {0};
real_t output[1024] = {0};
for (band = 0; band < SSR_BANDS; band++)
{
int16_t j;
/* uneven bands have inverted frequency scale */
if (band == 1 || band == 3)
{
for (j = 0; j < ssr_frame_len/2; j++)
{
real_t tmp;
tmp = freq_in[j + ssr_frame_len*band];
freq_in[j + ssr_frame_len*band] =
freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band];
freq_in[ssr_frame_len - j - 1 + ssr_frame_len*band] = tmp;
}
}
/* non-overlapping inverse filterbank for SSR */
ssr_ifilter_bank(fb, window_sequence, window_shape, window_shape_prev,
freq_in + band*ssr_frame_len, time_tmp + band*ssr_frame_len,
ssr_frame_len);
/* gain control */
ssr_gain_control(ssr, time_tmp, output, overlap, prev_fmd,
band, window_sequence, ssr_frame_len);
}
/* inverse pqf to bring subbands together again */
ssr_ipqf(ssr, output, time_out, ipqf_buffer, frame_len, SSR_BANDS);
}
static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
real_t *overlap, real_t *prev_fmd, uint8_t band,
uint8_t window_sequence, uint16_t frame_len)
{
uint16_t i;
real_t gc_function[2*1024/SSR_BANDS];
if (window_sequence != EIGHT_SHORT_SEQUENCE)
{
ssr_gc_function(ssr, &prev_fmd[band * frame_len*2],
gc_function, window_sequence, band, frame_len);
for (i = 0; i < frame_len*2; i++)
data[band * frame_len*2 + i] *= gc_function[i];
for (i = 0; i < frame_len; i++)
{
output[band*frame_len + i] = overlap[band*frame_len + i] +
data[band*frame_len*2 + i];
}
for (i = 0; i < frame_len; i++)
{
overlap[band*frame_len + i] =
data[band*frame_len*2 + frame_len + i];
}
} else {
uint8_t w;
for (w = 0; w < 8; w++)
{
uint16_t frame_len8 = frame_len/8;
uint16_t frame_len16 = frame_len/16;
ssr_gc_function(ssr, &prev_fmd[band*frame_len*2 + w*frame_len*2/8],
gc_function, window_sequence, frame_len);
for (i = 0; i < frame_len8*2; i++)
data[band*frame_len*2 + w*frame_len8*2+i] *= gc_function[i];
for (i = 0; i < frame_len8; i++)
{
overlap[band*frame_len + i + 7*frame_len16 + w*frame_len8] +=
data[band*frame_len*2 + 2*w*frame_len8 + i];
}
for (i = 0; i < frame_len8; i++)
{
overlap[band*frame_len + i + 7*frame_len16 + (w+1)*frame_len8] =
data[band*frame_len*2 + 2*w*frame_len8 + frame_len8 + i];
}
}
for (i = 0; i < frame_len; i++)
output[band*frame_len + i] = overlap[band*frame_len + i];
for (i = 0; i < frame_len; i++)
overlap[band*frame_len + i] = overlap[band*frame_len + i + frame_len];
}
}
static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
real_t *gc_function, uint8_t window_sequence,
uint8_t band, uint16_t frame_len)
{
uint16_t i;
uint16_t len_area1, len_area2;
int32_t aloc[10];
real_t alev[10];
switch (window_sequence)
{
case ONLY_LONG_SEQUENCE:
len_area1 = frame_len/SSR_BANDS;
len_area2 = 0;
break;
case LONG_START_SEQUENCE:
len_area1 = (frame_len/SSR_BANDS)*7/32;
len_area2 = (frame_len/SSR_BANDS)/16;
break;
case EIGHT_SHORT_SEQUENCE:
len_area1 = (frame_len/8)/SSR_BANDS;
len_area2 = 0;
break;
case LONG_STOP_SEQUENCE:
len_area1 = (frame_len/SSR_BANDS);
len_area2 = 0;
break;
}
/* decode bitstream information */
/* build array M */
for (i = 0; i < frame_len*2; i++)
gc_function[i] = 1;
}
#endif

115
src/contrib/aacdecoder/libfaad/ssr.h Normal file → Executable file
View File

@ -1,56 +1,59 @@
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2004 M. Bakker, Ahead Software AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
**
** $Id: ssr.h,v 1.1 2005/11/27 01:00:36 tonymillion Exp $
**/
#ifndef __SSR_H__
#define __SSR_H__
#ifdef __cplusplus
extern "C" {
#endif
#define SSR_BANDS 4
#define PQFTAPS 96
void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
uint8_t window_shape, uint8_t window_shape_prev,
real_t *freq_in, real_t *time_out, real_t *overlap,
real_t ipqf_buffer[SSR_BANDS][96/4],
real_t *prev_fmd, uint16_t frame_len);
static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
real_t *overlap, real_t *prev_fmd, uint8_t band,
uint8_t window_sequence, uint16_t frame_len);
static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
real_t *gc_function, uint8_t window_sequence,
uint16_t frame_len);
#ifdef __cplusplus
}
#endif
#endif
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** 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.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: ssr.h,v 1.19 2007/11/01 12:33:36 menno Exp $
**/
#ifndef __SSR_H__
#define __SSR_H__
#ifdef __cplusplus
extern "C" {
#endif
#define SSR_BANDS 4
#define PQFTAPS 96
void ssr_decode(ssr_info *ssr, fb_info *fb, uint8_t window_sequence,
uint8_t window_shape, uint8_t window_shape_prev,
real_t *freq_in, real_t *time_out, real_t *overlap,
real_t ipqf_buffer[SSR_BANDS][96/4],
real_t *prev_fmd, uint16_t frame_len);
static void ssr_gain_control(ssr_info *ssr, real_t *data, real_t *output,
real_t *overlap, real_t *prev_fmd, uint8_t band,
uint8_t window_sequence, uint16_t frame_len);
static void ssr_gc_function(ssr_info *ssr, real_t *prev_fmd,
real_t *gc_function, uint8_t window_sequence,
uint16_t frame_len);
#ifdef __cplusplus
}
#endif
#endif

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