Remove unused / out of date plugins.

This commit is contained in:
casey langen 2022-02-07 16:57:47 -08:00
parent 3ec0dfe9fa
commit 41228f82b0
248 changed files with 0 additions and 112427 deletions

View File

@ -1,25 +0,0 @@
set ( dsp_example_echo_SOURCES
dsp_echo_plugin.cpp
DSPEcho.cpp
pch.cpp
)
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-DWIN32)
if(NOT DEFINED MINGW)
endif(NOT DEFINED MINGW)
else(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -fpermissive)
endif(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(
-DXML_STATIC
-D_CRT_SECURE_NO_DEPRECATE
-D_DEBUG
)
add_library( dsp_example_echo SHARED ${dsp_example_echo_SOURCES} )
target_link_libraries( dsp_example_echo ${musikCube_LINK_LIBS})

View File

@ -1,102 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
// Copyright 2007, Daniel Önnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "pch.h"
#include "DSPEcho.h"
DSPEcho::DSPEcho()
:internalBuffer(NULL)
,channels(0)
,bufferSampleSize(0)
,bufferPosition(0)
,sampleRate(0)
{
}
DSPEcho::~DSPEcho(){
delete this->internalBuffer;
}
void DSPEcho::Destroy(){
delete this;
}
void DSPEcho::SetBuffer(const IBuffer *inputBuffer){
if(inputBuffer->Channels()!=this->channels || inputBuffer->SampleRate()!=this->sampleRate){
this->channels = inputBuffer->Channels();
this->sampleRate = inputBuffer->SampleRate();
this->bufferSampleSize = this->sampleRate; // 1 second
delete this->internalBuffer;
this->internalBuffer = new float[this->channels*this->bufferSampleSize];
// empty the internal buffer
for(long i=0;i<this->channels*this->bufferSampleSize;++i){
this->internalBuffer[i] = 0.0f;
}
}
}
bool DSPEcho::ProcessBuffers(const IBuffer *inputBuffer,IBuffer *outputBuffer){
this->SetBuffer(inputBuffer);
// loop though the buffer and apply echo
long bufferLength( this->channels*inputBuffer->Samples() );
float *inBuffer = inputBuffer->BufferPointer();
float *outBuffer = outputBuffer->BufferPointer();
long internalBufferSize(this->channels*this->bufferSampleSize);
long echo1distance(internalBufferSize-((long)(0.3*(double)this->sampleRate))*this->channels);
long echo2distance(internalBufferSize-((long)(0.2*(double)this->sampleRate))*this->channels);
for(long i(0);i<bufferLength;++i){
float inSample(inBuffer[i]);
float outSample(inSample);
//add a 0.5 of 0.3 seconds away
//outSample += 0.5f*this->internalBuffer[(this->bufferPosition+echo1distance)%internalBufferSize];
//add a 0.2 of 0.6 seconds away
outSample += 0.2f*this->internalBuffer[(this->bufferPosition+echo2distance)%internalBufferSize];
// set the out buffer
outBuffer[i] = outSample;
// Save the insample to internal buffer
this->internalBuffer[this->bufferPosition] = outSample;
this->bufferPosition = (this->bufferPosition+1)%internalBufferSize;
}
return true;
}

View File

@ -1,55 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
// Copyright 2007, Daniel <20>nnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <musikcore/audio/IDSP.h>
using namespace musik::core::audio;
class DSPEcho : public IDSP{
public:
DSPEcho();
~DSPEcho();
virtual void Destroy();
virtual bool ProcessBuffers(const IBuffer *inputBuffer,IBuffer *outputBuffer);
private:
void SetBuffer(const IBuffer *inputBuffer);
float *internalBuffer;
long bufferSampleSize;
long bufferPosition;
int channels;
long sampleRate;
};

View File

@ -1,66 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// License Agreement:
//
// The following are Copyright <20> 2008, Daniel <20>nnerby
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "pch.h"
#include <musikcore/IPlugin.h>
#include "DSPEcho.h"
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
return true;
}
class DSPEchoPlugin : public musik::core::IPlugin
{
void Destroy() { delete this; };
const utfchar* Name() { return TEXT("DSP echo example"); };
const utfchar* Version() { return TEXT("1"); };
const utfchar* Author() { return TEXT("Daniel <20>nnerby"); };
};
extern "C" __declspec(dllexport) musik::core::IPlugin* GetPlugin()
{
return new DSPEchoPlugin();
}
extern "C" __declspec(dllexport) musik::core::audio::IDSP* GetDSP()
{
return new DSPEcho();
}

View File

@ -1,207 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="dsp_example_echo"
ProjectGUID="{2BCB82E5-B163-4812-8C29-17335FF45A2B}"
RootNamespace="dsp_example_echo"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)/bin/$(ConfigurationName)/plugins"
IntermediateDirectory="./obj/$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../..;../../3rdparty/include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
AdditionalLibraryDirectories="../../3rdparty/lib"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)/bin/$(ConfigurationName)/plugins"
IntermediateDirectory="./obj/$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../..;../../3rdparty/include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalLibraryDirectories="../../3rdparty/lib"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="plugin"
Filter="h;hpp;hxx;hm;inl;inc;xsd;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\dsp_echo_plugin.cpp"
>
</File>
<File
RelativePath=".\DSPEcho.cpp"
>
</File>
<File
RelativePath=".\DSPEcho.h"
>
</File>
<File
RelativePath=".\pch.cpp"
>
</File>
<File
RelativePath=".\pch.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

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

View File

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

View File

@ -1,20 +0,0 @@
set (flacdecoder_SOURCES
stdafx.cpp
flacdecoder_plugin.cpp
FlacDecoderFactory.cpp
FlacDecoder.cpp
)
ensure_library_exists(FLAC)
add_library(flacdecoder SHARED ${flacdecoder_SOURCES})
# prefer static libraries on mac to make redist easier
if (${LINK_STATICALLY} MATCHES "true")
ensure_library_exists(libFLAC.a)
find_library(FLACLIB NAMES libFLAC.a FLAC)
find_library(OGGLIB NAMES libogg.a ogg)
target_link_libraries(flacdecoder ${musikcube_LINK_LIBS} ${FLACLIB} ${OGGLIB})
else()
target_link_libraries(flacdecoder ${musikcube_LINK_LIBS} FLAC ogg)
endif()

View File

@ -1,254 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2021 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "FlacDecoder.h"
#include <complex>
#include <iostream>
#include <cstring>
FlacDecoder::FlacDecoder()
: decoder(nullptr)
, outputBufferSize(0)
, outputBufferUsed(0)
, outputBuffer(nullptr)
, channels(0)
, sampleRate(0)
, bitsPerSample(0)
, totalSamples(0)
, duration(-1.0f)
, exhausted(false) {
this->decoder = FLAC__stream_decoder_new();
}
FlacDecoder::~FlacDecoder() {
if (this->decoder) {
FLAC__stream_decoder_delete(this->decoder);
this->decoder = nullptr;
}
delete this->outputBuffer;
this->outputBuffer = nullptr;
}
FLAC__StreamDecoderReadStatus FlacDecoder::FlacRead(
const FLAC__StreamDecoder *dec,
FLAC__byte buffer[],
size_t *bytes,
void *clientData)
{
auto decoder = (FlacDecoder*) clientData;
size_t readBytes = (size_t) decoder->stream->Read(buffer,(long)(*bytes));
*bytes = readBytes;
if (readBytes == 0) {
decoder->exhausted = true;
return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
}
else if (readBytes == (size_t) -1) {
decoder->exhausted = true;
return FLAC__STREAM_DECODER_READ_STATUS_ABORT;
}
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
}
FLAC__bool FlacDecoder::FlacEof(const FLAC__StreamDecoder *decoder, void *clientData) {
return ((FlacDecoder*) clientData)->stream->Eof() ? 1 : 0;
}
FLAC__StreamDecoderSeekStatus FlacDecoder::FlacSeek(
const FLAC__StreamDecoder *decoder,
FLAC__uint64 absolute_byte_offset,
void *clientData)
{
if(((FlacDecoder*) clientData)->stream->SetPosition((long) absolute_byte_offset)) {
return FLAC__STREAM_DECODER_SEEK_STATUS_OK;
}
return FLAC__STREAM_DECODER_SEEK_STATUS_ERROR;
}
FLAC__StreamDecoderTellStatus FlacDecoder::FlacTell(
const FLAC__StreamDecoder *decoder,
FLAC__uint64 *absolute_byte_offset,
void *clientData)
{
*absolute_byte_offset = (FLAC__uint64)((FlacDecoder*) clientData)->stream->Position();
if(*absolute_byte_offset == (FLAC__uint64) -1) {
return FLAC__STREAM_DECODER_TELL_STATUS_ERROR;
}
return FLAC__STREAM_DECODER_TELL_STATUS_OK;
}
FLAC__StreamDecoderLengthStatus FlacDecoder::FlacFileSize(
const FLAC__StreamDecoder *decoder,
FLAC__uint64 *stream_length,
void *clientData)
{
*stream_length = (FLAC__uint64)((FlacDecoder*) clientData)->stream->Length();
if(*stream_length <= 0) {
return FLAC__STREAM_DECODER_LENGTH_STATUS_ERROR;
}
return FLAC__STREAM_DECODER_LENGTH_STATUS_OK;
}
bool FlacDecoder::Open(musik::core::sdk::IDataStream *stream){
this->stream = stream;
FLAC__StreamDecoderInitStatus init_status =
FLAC__stream_decoder_init_stream(
this->decoder,
FlacDecoder::FlacRead,
FlacDecoder::FlacSeek,
FlacDecoder::FlacTell,
FlacDecoder::FlacFileSize,
FlacDecoder::FlacEof,
FlacDecoder::FlacWrite,
FlacDecoder::FlacMetadata,
FlacDecoder::FlacError,
this);
if (init_status == FLAC__STREAM_DECODER_INIT_STATUS_OK) {
FLAC__stream_decoder_process_until_end_of_metadata(this->decoder);
return true;
}
return false;
}
void FlacDecoder::FlacError(
const FLAC__StreamDecoder *decoder,
FLAC__StreamDecoderErrorStatus status,
void *clientData)
{
/* nothing for us to do here... */
}
void FlacDecoder::FlacMetadata(
const FLAC__StreamDecoder *decoder,
const FLAC__StreamMetadata *metadata,
void *clientData)
{
FlacDecoder *fdec = (FlacDecoder*)clientData;
if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) {
fdec->totalSamples = metadata->data.stream_info.total_samples;
fdec->sampleRate = metadata->data.stream_info.sample_rate;
fdec->channels = metadata->data.stream_info.channels;
fdec->bitsPerSample = metadata->data.stream_info.bits_per_sample;
fdec->duration = (double)fdec->totalSamples / fdec->sampleRate;
}
}
FLAC__StreamDecoderWriteStatus FlacDecoder::FlacWrite(
const FLAC__StreamDecoder *decoder,
const FLAC__Frame *frame,
const FLAC__int32 *const buffer[],
void *clientData)
{
FlacDecoder *fdec = (FlacDecoder*) clientData;
unsigned sampleCount = (unsigned) fdec->channels * frame->header.blocksize;
/* initialize the output buffer if it doesn't exist */
if (sampleCount > fdec->outputBufferSize) {
delete fdec->outputBuffer;
fdec->outputBuffer = nullptr;
fdec->outputBufferSize = sampleCount;
fdec->outputBuffer = new float[sampleCount];
}
/* we need to convert the fixed point samples to floating point samples. figure
out the maximum amplitude of the fixed point samples based on the resolution */
float maxAmplitude = pow(2.0f, (fdec->bitsPerSample - 1));
/* run the conversion */
fdec->outputBufferUsed = 0;
for (unsigned int i = 0; i < frame->header.blocksize; ++i) {
for (int j = 0; j < fdec->channels; ++j) {
fdec->outputBuffer[fdec->outputBufferUsed] = (((float) buffer[j][i]) / maxAmplitude);
fdec->outputBufferUsed++;
}
}
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
}
void FlacDecoder::Release() {
delete this;
}
double FlacDecoder::SetPosition(double seconds) {
FLAC__uint64 seekToSample = (FLAC__uint64)((double) this->sampleRate * seconds);
if (FLAC__stream_decoder_seek_absolute(this->decoder, seekToSample)) {
return seconds;
}
if (FLAC__stream_decoder_get_state(this->decoder) == FLAC__STREAM_DECODER_SEEK_ERROR) {
if (FLAC__stream_decoder_flush(this->decoder)) {
if (FLAC__stream_decoder_seek_absolute(this->decoder, seekToSample)) {
return seconds;
}
}
}
return -1;
}
double FlacDecoder::GetDuration() {
return this->duration;
}
bool FlacDecoder::GetBuffer(IBuffer *buffer) {
buffer->SetSampleRate(this->sampleRate);
buffer->SetChannels(this->channels);
/* read the next chunk */
if (FLAC__stream_decoder_process_single(this->decoder)) {
if (this->outputBuffer && this->outputBufferUsed > 0) {
buffer->SetSamples(this->outputBufferUsed);
memcpy(buffer->BufferPointer(), this->outputBuffer, this->outputBufferUsed * sizeof(float));
this->outputBufferUsed = 0; /* mark consumed */
return true;
}
}
this->exhausted = true;
return false;
}

View File

@ -1,114 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2021 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <musikcore/sdk/constants.h>
#include <musikcore/sdk/IDecoder.h>
#include <musikcore/sdk/IDataStream.h>
#include <FLAC/stream_decoder.h>
#include <stddef.h>
using namespace musik::core::sdk;
class FlacDecoder: public musik::core::sdk::IDecoder {
public:
FlacDecoder();
~FlacDecoder();
void Release() override;
double SetPosition(double seconds) override;
bool GetBuffer(IBuffer *buffer) override;
double GetDuration() override;
bool Open(musik::core::sdk::IDataStream *stream) override;
bool Exhausted() override { return this->exhausted; }
void SetPreferredSampleRate(int rate) override { }
private:
static FLAC__StreamDecoderReadStatus FlacRead(
const FLAC__StreamDecoder *decoder,
FLAC__byte buffer[],
size_t *bytes,
void *clientData);
static FLAC__StreamDecoderSeekStatus FlacSeek(
const FLAC__StreamDecoder *decoder,
FLAC__uint64 absolute_byte_offset,
void *clientData);
static FLAC__StreamDecoderTellStatus FlacTell(
const FLAC__StreamDecoder *decoder,
FLAC__uint64 *absolute_byte_offset,
void *clientData);
static FLAC__bool FlacEof(
const FLAC__StreamDecoder *decoder,
void *clientData);
static FLAC__StreamDecoderLengthStatus FlacFileSize(
const FLAC__StreamDecoder *decoder,
FLAC__uint64 *stream_length,
void *clientData);
static FLAC__StreamDecoderWriteStatus FlacWrite(
const FLAC__StreamDecoder *decoder,
const FLAC__Frame *frame,
const FLAC__int32 *const buffer[],
void *clientData);
static void FlacMetadata(
const FLAC__StreamDecoder *decoder,
const FLAC__StreamMetadata *metadata,
void *clientData);
static void FlacError(
const FLAC__StreamDecoder *decoder,
FLAC__StreamDecoderErrorStatus status,
void *clientData);
private:
musik::core::sdk::IDataStream *stream;
FLAC__StreamDecoder *decoder;
long channels;
long sampleRate;
uint64_t totalSamples;
int bitsPerSample;
double duration;
bool exhausted;
float *outputBuffer;
unsigned long outputBufferSize;
unsigned long outputBufferUsed;
};

View File

@ -1,72 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2021 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include <cctype>
#include <algorithm>
#include <string>
#include "FlacDecoderFactory.h"
#include "FlacDecoder.h"
using namespace musik::core::sdk;
inline bool endsWith(const std::string& s, const std::string& suffix) {
return
s.size() >= suffix.size() &&
s.rfind(suffix) == (s.size() - suffix.size());
}
FlacDecoderFactory::FlacDecoderFactory() {
}
FlacDecoderFactory::~FlacDecoderFactory() {
}
void FlacDecoderFactory::Release() {
delete this;
}
IDecoder* FlacDecoderFactory::CreateDecoder() {
return new FlacDecoder();
}
bool FlacDecoderFactory::CanHandle(const char* type) const {
std::string str(type);
std::transform(str.begin(), str.end(), str.begin(), tolower);
return
endsWith(type, ".flac") ||
str.find("audio/flac") != std::string::npos;
}

View File

@ -1,46 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2021 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <musikcore/sdk/IDecoderFactory.h>
class FlacDecoderFactory : public musik::core::sdk::IDecoderFactory {
public:
FlacDecoderFactory();
~FlacDecoderFactory();
virtual musik::core::sdk::IDecoder* CreateDecoder();
virtual void Release();
virtual bool CanHandle(const char* type) const;
};

View File

@ -1,401 +0,0 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Name="flacdecoder"
ProjectGUID="{465EF178-91C1-4068-BE1D-F9616ECCB6DE}"
RootNamespace="flacdecoder"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)/bin/$(ConfigurationName)/plugins"
IntermediateDirectory="./obj/$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;../..;../../3rdparty/include;./src/libFLAC/include;./include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FLAC__CPU_IA32;FLAC__NO_DLL;DEBUG;FLAC__OVERFLOW_DETECT"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/NODEFAULTLIB:LIBCMT&#x0D;&#x0A;"
AdditionalDependencies=""
AdditionalLibraryDirectories="./lib;../../3rdparty/lib"
GenerateDebugInformation="true"
SubSystem="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)/bin/$(ConfigurationName)/plugins"
IntermediateDirectory="./obj/$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;../..;../../3rdparty/include;./src/libFLAC/include;./include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FLAC__CPU_IA32;FLAC__NO_DLL;FLAC__OVERFLOW_DETECT"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies=""
AdditionalLibraryDirectories="./lib;../../3rdparty/lib"
SubSystem="2"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
<Filter
Name="plugin"
>
<File
RelativePath=".\FLACDecoder.cpp"
>
</File>
<File
RelativePath=".\FLACDecoder.h"
>
</File>
<File
RelativePath=".\flacdecoder_plugin.cpp"
>
</File>
<File
RelativePath=".\FLACSourceSupplier.cpp"
>
</File>
<File
RelativePath=".\FLACSourceSupplier.h"
>
</File>
<File
RelativePath=".\stdafx.cpp"
>
</File>
<File
RelativePath=".\stdafx.h"
>
</File>
</Filter>
<Filter
Name="flac"
>
<Filter
Name="headers"
>
<File
RelativePath=".\src\libFLAC\include\protected\all.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\all.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\bitmath.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\bitreader.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\bitwriter.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\cpu.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\crc.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\fixed.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\float.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\format.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\lpc.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\md5.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\memory.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\metadata.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\ogg_decoder_aspect.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\ogg_encoder_aspect.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\ogg_helper.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\ogg_mapping.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\protected\stream_decoder.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\protected\stream_encoder.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\stream_encoder_framing.h"
>
</File>
<File
RelativePath=".\src\libFLAC\include\private\window.h"
>
</File>
</Filter>
<Filter
Name="src"
>
<File
RelativePath=".\src\libFLAC\bitmath.c"
>
</File>
<File
RelativePath=".\src\libFLAC\bitreader.c"
>
</File>
<File
RelativePath=".\src\libFLAC\ia32\bitreader_asm.nasm"
>
</File>
<File
RelativePath=".\src\libFLAC\bitwriter.c"
>
</File>
<File
RelativePath=".\src\libFLAC\cpu.c"
>
</File>
<File
RelativePath=".\src\libFLAC\ia32\cpu_asm.nasm"
>
</File>
<File
RelativePath=".\src\libFLAC\crc.c"
>
</File>
<File
RelativePath=".\src\libFLAC\fixed.c"
>
</File>
<File
RelativePath=".\src\libFLAC\ia32\fixed_asm.nasm"
>
</File>
<File
RelativePath=".\src\libFLAC\float.c"
>
</File>
<File
RelativePath=".\src\libFLAC\format.c"
>
</File>
<File
RelativePath=".\src\libFLAC\lpc.c"
>
</File>
<File
RelativePath=".\src\libFLAC\ia32\lpc_asm.nasm"
>
</File>
<File
RelativePath=".\src\libFLAC\md5.c"
>
</File>
<File
RelativePath=".\src\libFLAC\memory.c"
>
</File>
<File
RelativePath=".\src\libFLAC\metadata_iterators.c"
>
</File>
<File
RelativePath=".\src\libFLAC\metadata_object.c"
>
</File>
<File
RelativePath=".\src\libFLAC\stream_decoder.c"
>
</File>
<File
RelativePath=".\src\libFLAC\stream_encoder.c"
>
</File>
<File
RelativePath=".\src\libFLAC\ia32\stream_encoder_asm.nasm"
>
</File>
<File
RelativePath=".\src\libFLAC\stream_encoder_framing.c"
>
</File>
<File
RelativePath=".\src\libFLAC\window.c"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -1,118 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{465EF178-91C1-4068-BE1D-F9616ECCB6DE}</ProjectGuid>
<RootNamespace>flacdecoder</RootNamespace>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_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>.;../..;../../3rdparty/include;./src/libFLAC/include;./include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FLAC__CPU_IA32;FLAC__NO_DLL;DEBUG;FLAC__OVERFLOW_DETECT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<Link>
<AdditionalOptions>/NODEFAULTLIB:LIBCMT
%(AdditionalOptions)</AdditionalOptions>
<AdditionalLibraryDirectories>./lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>libFLAC_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>.;../..;../../3rdparty/include;./src/libFLAC/include;./include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FLAC__CPU_IA32;FLAC__NO_DLL;FLAC__OVERFLOW_DETECT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PrecompiledHeader />
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>Full</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<ExceptionHandling>Sync</ExceptionHandling>
</ClCompile>
<Link>
<AdditionalLibraryDirectories>./lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>libFLAC_static.lib;%(AdditionalDependencies)</AdditionalDependencies>
<GenerateDebugInformation>false</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="FlacDecoder.cpp" />
<ClCompile Include="FlacDecoderFactory.cpp" />
<ClCompile Include="flacdecoder_plugin.cpp" />
<ClCompile Include="libflac\win_utf8_io.c" />
<ClCompile Include="libogg\bitwise.c" />
<ClCompile Include="libogg\framing.c" />
<ClCompile Include="stdafx.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="FlacDecoder.h" />
<ClInclude Include="FlacDecoderFactory.h" />
<ClInclude Include="stdafx.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Resource Files">
<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="plugin">
<UniqueIdentifier>{05a09b96-5c25-4e71-861c-c50fc7309b93}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="FlacDecoder.cpp">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="flacdecoder_plugin.cpp">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="FlacDecoderFactory.cpp">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="libogg\bitwise.c">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="libogg\framing.c">
<Filter>plugin</Filter>
</ClCompile>
<ClCompile Include="libflac\win_utf8_io.c">
<Filter>plugin</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
<Filter>plugin</Filter>
</ClInclude>
<ClInclude Include="FlacDecoderFactory.h">
<Filter>plugin</Filter>
</ClInclude>
<ClInclude Include="FlacDecoder.h">
<Filter>plugin</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,73 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2021 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include <musikcore/sdk/constants.h>
#include <musikcore/sdk/IPlugin.h>
#include "FlacDecoderFactory.h"
#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 FlacPlugin : public musik::core::sdk::IPlugin {
public:
virtual void Release() { delete this; };
virtual const char* Name() { return "FLAC IDecoder"; }
virtual const char* Version() { return "0.4.0"; }
virtual const char* Author() { return "Daniel Önnerby, clangen"; }
virtual const char* Guid() { return "f2acfbbc-b910-42ec-a568-6f4705d22b73"; }
virtual bool Configurable() { return false; }
virtual void Configure() { }
virtual void Reload() { }
virtual int SdkVersion() { return musik::core::sdk::SdkVersion; }
};
extern "C" DLLEXPORT musik::core::sdk::IPlugin* GetPlugin() {
return new FlacPlugin();
}
extern "C" DLLEXPORT musik::core::sdk::IDecoderFactory* GetDecoderFactory() {
return new FlacDecoderFactory();
}

View File

@ -1,43 +0,0 @@
# libFLAC - Free Lossless Audio Codec library
# Copyright (C) 2000-2009 Josh Coalson
# Copyright (C) 2011-2014 Xiph.Org Foundation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# - Neither the name of the Xiph.org Foundation nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
flaccincludedir = $(includedir)/FLAC
flaccinclude_HEADERS = \
all.h \
assert.h \
callback.h \
export.h \
format.h \
metadata.h \
ordinals.h \
stream_decoder.h \
stream_encoder.h

View File

@ -1,626 +0,0 @@
# Makefile.in generated by automake 1.14.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# libFLAC - Free Lossless Audio Codec library
# Copyright (C) 2000-2009 Josh Coalson
# Copyright (C) 2011-2014 Xiph.Org Foundation
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# - Neither the name of the Xiph.org Foundation nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = include/FLAC
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(flaccinclude_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/add_cflags.m4 \
$(top_srcdir)/m4/add_cxxflags.m4 $(top_srcdir)/m4/bswap.m4 \
$(top_srcdir)/m4/clang.m4 $(top_srcdir)/m4/codeset.m4 \
$(top_srcdir)/m4/gcc_version.m4 $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
$(top_srcdir)/m4/ogg.m4 $(top_srcdir)/m4/really_gcc.m4 \
$(top_srcdir)/m4/stack_protect.m4 $(top_srcdir)/m4/xmms.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
SOURCES =
DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(flaccincludedir)"
HEADERS = $(flaccinclude_HEADERS)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DOCBOOK_TO_MAN = @DOCBOOK_TO_MAN@
DOXYGEN = @DOXYGEN@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FLAC__TEST_LEVEL = @FLAC__TEST_LEVEL@
FLAC__TEST_WITH_VALGRIND = @FLAC__TEST_WITH_VALGRIND@
GCC_MAJOR_VERSION = @GCC_MAJOR_VERSION@
GCC_MINOR_VERSION = @GCC_MINOR_VERSION@
GCC_VERSION = @GCC_VERSION@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBICONV = @LIBICONV@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NASM = @NASM@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OBJ_FORMAT = @OBJ_FORMAT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
OGG_PACKAGE = @OGG_PACKAGE@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
XMMS_CFLAGS = @XMMS_CFLAGS@
XMMS_CONFIG = @XMMS_CONFIG@
XMMS_DATA_DIR = @XMMS_DATA_DIR@
XMMS_EFFECT_PLUGIN_DIR = @XMMS_EFFECT_PLUGIN_DIR@
XMMS_GENERAL_PLUGIN_DIR = @XMMS_GENERAL_PLUGIN_DIR@
XMMS_INPUT_PLUGIN_DIR = @XMMS_INPUT_PLUGIN_DIR@
XMMS_LIBS = @XMMS_LIBS@
XMMS_OUTPUT_PLUGIN_DIR = @XMMS_OUTPUT_PLUGIN_DIR@
XMMS_PLUGIN_DIR = @XMMS_PLUGIN_DIR@
XMMS_VERSION = @XMMS_VERSION@
XMMS_VISUALIZATION_PLUGIN_DIR = @XMMS_VISUALIZATION_PLUGIN_DIR@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
flaccincludedir = $(includedir)/FLAC
flaccinclude_HEADERS = \
all.h \
assert.h \
callback.h \
export.h \
format.h \
metadata.h \
ordinals.h \
stream_decoder.h \
stream_encoder.h
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/FLAC/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign include/FLAC/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-flaccincludeHEADERS: $(flaccinclude_HEADERS)
@$(NORMAL_INSTALL)
@list='$(flaccinclude_HEADERS)'; test -n "$(flaccincludedir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(flaccincludedir)'"; \
$(MKDIR_P) "$(DESTDIR)$(flaccincludedir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(flaccincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(flaccincludedir)" || exit $$?; \
done
uninstall-flaccincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(flaccinclude_HEADERS)'; test -n "$(flaccincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(flaccincludedir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(flaccincludedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-flaccincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-flaccincludeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool cscopelist-am ctags ctags-am distclean \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-flaccincludeHEADERS \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-am uninstall uninstall-am \
uninstall-flaccincludeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,371 +0,0 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__ALL_H
#define FLAC__ALL_H
#include "export.h"
#include "assert.h"
#include "callback.h"
#include "format.h"
#include "metadata.h"
#include "ordinals.h"
#include "stream_decoder.h"
#include "stream_encoder.h"
/** \mainpage
*
* \section intro Introduction
*
* This is the documentation for the FLAC C and C++ APIs. It is
* highly interconnected; this introduction should give you a top
* level idea of the structure and how to find the information you
* need. As a prerequisite you should have at least a basic
* knowledge of the FLAC format, documented
* <A HREF="../format.html">here</A>.
*
* \section c_api FLAC C API
*
* The FLAC C API is the interface to libFLAC, a set of structures
* describing the components of FLAC streams, and functions for
* encoding and decoding streams, as well as manipulating FLAC
* metadata in files. The public include files will be installed
* in your include area (for example /usr/include/FLAC/...).
*
* By writing a little code and linking against libFLAC, it is
* relatively easy to add FLAC support to another program. The
* library is licensed under <A HREF="../license.html">Xiph's BSD license</A>.
* Complete source code of libFLAC as well as the command-line
* encoder and plugins is available and is a useful source of
* examples.
*
* Aside from encoders and decoders, libFLAC provides a powerful
* metadata interface for manipulating metadata in FLAC files. It
* allows the user to add, delete, and modify FLAC metadata blocks
* and it can automatically take advantage of PADDING blocks to avoid
* rewriting the entire FLAC file when changing the size of the
* metadata.
*
* libFLAC usually only requires the standard C library and C math
* library. In particular, threading is not used so there is no
* dependency on a thread library. However, libFLAC does not use
* global variables and should be thread-safe.
*
* libFLAC also supports encoding to and decoding from Ogg FLAC.
* However the metadata editing interfaces currently have limited
* read-only support for Ogg FLAC files.
*
* \section cpp_api FLAC C++ API
*
* The FLAC C++ API is a set of classes that encapsulate the
* structures and functions in libFLAC. They provide slightly more
* functionality with respect to metadata but are otherwise
* equivalent. For the most part, they share the same usage as
* their counterparts in libFLAC, and the FLAC C API documentation
* can be used as a supplement. The public include files
* for the C++ API will be installed in your include area (for
* example /usr/include/FLAC++/...).
*
* libFLAC++ is also licensed under
* <A HREF="../license.html">Xiph's BSD license</A>.
*
* \section getting_started Getting Started
*
* A good starting point for learning the API is to browse through
* the <A HREF="modules.html">modules</A>. Modules are logical
* groupings of related functions or classes, which correspond roughly
* to header files or sections of header files. Each module includes a
* detailed description of the general usage of its functions or
* classes.
*
* From there you can go on to look at the documentation of
* individual functions. You can see different views of the individual
* functions through the links in top bar across this page.
*
* If you prefer a more hands-on approach, you can jump right to some
* <A HREF="../documentation_example_code.html">example code</A>.
*
* \section porting_guide Porting Guide
*
* Starting with FLAC 1.1.3 a \link porting Porting Guide \endlink
* has been introduced which gives detailed instructions on how to
* port your code to newer versions of FLAC.
*
* \section embedded_developers Embedded Developers
*
* libFLAC has grown larger over time as more functionality has been
* included, but much of it may be unnecessary for a particular embedded
* implementation. Unused parts may be pruned by some simple editing of
* src/libFLAC/Makefile.am. In general, the decoders, encoders, and
* metadata interface are all independent from each other.
*
* It is easiest to just describe the dependencies:
*
* - All modules depend on the \link flac_format Format \endlink module.
* - The decoders and encoders depend on the bitbuffer.
* - The decoder is independent of the encoder. The encoder uses the
* decoder because of the verify feature, but this can be removed if
* not needed.
* - Parts of the metadata interface require the stream decoder (but not
* the encoder).
* - Ogg support is selectable through the compile time macro
* \c FLAC__HAS_OGG.
*
* For example, if your application only requires the stream decoder, no
* encoder, and no metadata interface, you can remove the stream encoder
* and the metadata interface, which will greatly reduce the size of the
* library.
*
* Also, there are several places in the libFLAC code with comments marked
* with "OPT:" where a #define can be changed to enable code that might be
* faster on a specific platform. Experimenting with these can yield faster
* binaries.
*/
/** \defgroup porting Porting Guide for New Versions
*
* This module describes differences in the library interfaces from
* version to version. It assists in the porting of code that uses
* the libraries to newer versions of FLAC.
*
* One simple facility for making porting easier that has been added
* in FLAC 1.1.3 is a set of \c #defines in \c export.h of each
* library's includes (e.g. \c include/FLAC/export.h). The
* \c #defines mirror the libraries'
* <A HREF="http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning">libtool version numbers</A>,
* e.g. in libFLAC there are \c FLAC_API_VERSION_CURRENT,
* \c FLAC_API_VERSION_REVISION, and \c FLAC_API_VERSION_AGE.
* These can be used to support multiple versions of an API during the
* transition phase, e.g.
*
* \code
* #if !defined(FLAC_API_VERSION_CURRENT) || FLAC_API_VERSION_CURRENT <= 7
* legacy code
* #else
* new code
* #endif
* \endcode
*
* The the source will work for multiple versions and the legacy code can
* easily be removed when the transition is complete.
*
* Another available symbol is FLAC_API_SUPPORTS_OGG_FLAC (defined in
* include/FLAC/export.h), which can be used to determine whether or not
* the library has been compiled with support for Ogg FLAC. This is
* simpler than trying to call an Ogg init function and catching the
* error.
*/
/** \defgroup porting_1_1_2_to_1_1_3 Porting from FLAC 1.1.2 to 1.1.3
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.1.2 to FLAC 1.1.3.
*
* The main change between the APIs in 1.1.2 and 1.1.3 is that they have
* been simplified. First, libOggFLAC has been merged into libFLAC and
* libOggFLAC++ has been merged into libFLAC++. Second, both the three
* decoding layers and three encoding layers have been merged into a
* single stream decoder and stream encoder. That is, the functionality
* of FLAC__SeekableStreamDecoder and FLAC__FileDecoder has been merged
* into FLAC__StreamDecoder, and FLAC__SeekableStreamEncoder and
* FLAC__FileEncoder into FLAC__StreamEncoder. Only the
* FLAC__StreamDecoder and FLAC__StreamEncoder remain. What this means
* is there is now a single API that can be used to encode or decode
* streams to/from native FLAC or Ogg FLAC and the single API can work
* on both seekable and non-seekable streams.
*
* Instead of creating an encoder or decoder of a certain layer, now the
* client will always create a FLAC__StreamEncoder or
* FLAC__StreamDecoder. The old layers are now differentiated by the
* initialization function. For example, for the decoder,
* FLAC__stream_decoder_init() has been replaced by
* FLAC__stream_decoder_init_stream(). This init function takes
* callbacks for the I/O, and the seeking callbacks are optional. This
* allows the client to use the same object for seekable and
* non-seekable streams. For decoding a FLAC file directly, the client
* can use FLAC__stream_decoder_init_file() and pass just a filename
* and fewer callbacks; most of the other callbacks are supplied
* internally. For situations where fopen()ing by filename is not
* possible (e.g. Unicode filenames on Windows) the client can instead
* open the file itself and supply the FILE* to
* FLAC__stream_decoder_init_FILE(). The init functions now returns a
* FLAC__StreamDecoderInitStatus instead of FLAC__StreamDecoderState.
* Since the callbacks and client data are now passed to the init
* function, the FLAC__stream_decoder_set_*_callback() functions and
* FLAC__stream_decoder_set_client_data() are no longer needed. The
* rest of the calls to the decoder are the same as before.
*
* There are counterpart init functions for Ogg FLAC, e.g.
* FLAC__stream_decoder_init_ogg_stream(). All the rest of the calls
* and callbacks are the same as for native FLAC.
*
* As an example, in FLAC 1.1.2 a seekable stream decoder would have
* been set up like so:
*
* \code
* FLAC__SeekableStreamDecoder *decoder = FLAC__seekable_stream_decoder_new();
* if(decoder == NULL) do_something;
* FLAC__seekable_stream_decoder_set_md5_checking(decoder, true);
* [... other settings ...]
* FLAC__seekable_stream_decoder_set_read_callback(decoder, my_read_callback);
* FLAC__seekable_stream_decoder_set_seek_callback(decoder, my_seek_callback);
* FLAC__seekable_stream_decoder_set_tell_callback(decoder, my_tell_callback);
* FLAC__seekable_stream_decoder_set_length_callback(decoder, my_length_callback);
* FLAC__seekable_stream_decoder_set_eof_callback(decoder, my_eof_callback);
* FLAC__seekable_stream_decoder_set_write_callback(decoder, my_write_callback);
* FLAC__seekable_stream_decoder_set_metadata_callback(decoder, my_metadata_callback);
* FLAC__seekable_stream_decoder_set_error_callback(decoder, my_error_callback);
* FLAC__seekable_stream_decoder_set_client_data(decoder, my_client_data);
* if(FLAC__seekable_stream_decoder_init(decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK) do_something;
* \endcode
*
* In FLAC 1.1.3 it is like this:
*
* \code
* FLAC__StreamDecoder *decoder = FLAC__stream_decoder_new();
* if(decoder == NULL) do_something;
* FLAC__stream_decoder_set_md5_checking(decoder, true);
* [... other settings ...]
* if(FLAC__stream_decoder_init_stream(
* decoder,
* my_read_callback,
* my_seek_callback, // or NULL
* my_tell_callback, // or NULL
* my_length_callback, // or NULL
* my_eof_callback, // or NULL
* my_write_callback,
* my_metadata_callback, // or NULL
* my_error_callback,
* my_client_data
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
* \endcode
*
* or you could do;
*
* \code
* [...]
* FILE *file = fopen("somefile.flac","rb");
* if(file == NULL) do_somthing;
* if(FLAC__stream_decoder_init_FILE(
* decoder,
* file,
* my_write_callback,
* my_metadata_callback, // or NULL
* my_error_callback,
* my_client_data
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
* \endcode
*
* or just:
*
* \code
* [...]
* if(FLAC__stream_decoder_init_file(
* decoder,
* "somefile.flac",
* my_write_callback,
* my_metadata_callback, // or NULL
* my_error_callback,
* my_client_data
* ) != FLAC__STREAM_DECODER_INIT_STATUS_OK) do_something;
* \endcode
*
* Another small change to the decoder is in how it handles unparseable
* streams. Before, when the decoder found an unparseable stream
* (reserved for when the decoder encounters a stream from a future
* encoder that it can't parse), it changed the state to
* \c FLAC__STREAM_DECODER_UNPARSEABLE_STREAM. Now the decoder instead
* drops sync and calls the error callback with a new error code
* \c FLAC__STREAM_DECODER_ERROR_STATUS_UNPARSEABLE_STREAM. This is
* more robust. If your error callback does not discriminate on the the
* error state, your code does not need to be changed.
*
* The encoder now has a new setting:
* FLAC__stream_encoder_set_apodization(). This is for setting the
* method used to window the data before LPC analysis. You only need to
* add a call to this function if the default is not suitable. There
* are also two new convenience functions that may be useful:
* FLAC__metadata_object_cuesheet_calculate_cddb_id() and
* FLAC__metadata_get_cuesheet().
*
* The \a bytes parameter to FLAC__StreamDecoderReadCallback,
* FLAC__StreamEncoderReadCallback, and FLAC__StreamEncoderWriteCallback
* is now \c size_t instead of \c unsigned.
*/
/** \defgroup porting_1_1_3_to_1_1_4 Porting from FLAC 1.1.3 to 1.1.4
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.1.3 to FLAC 1.1.4.
*
* There were no changes to any of the interfaces from 1.1.3 to 1.1.4.
* There was a slight change in the implementation of
* FLAC__stream_encoder_set_metadata(); the function now makes a copy
* of the \a metadata array of pointers so the client no longer needs
* to maintain it after the call. The objects themselves that are
* pointed to by the array are still not copied though and must be
* maintained until the call to FLAC__stream_encoder_finish().
*/
/** \defgroup porting_1_1_4_to_1_2_0 Porting from FLAC 1.1.4 to 1.2.0
* \ingroup porting
*
* \brief
* This module describes porting from FLAC 1.1.4 to FLAC 1.2.0.
*
* There were only very minor changes to the interfaces from 1.1.4 to 1.2.0.
* In libFLAC, \c FLAC__format_sample_rate_is_subset() was added.
* In libFLAC++, \c FLAC::Decoder::Stream::get_decode_position() was added.
*
* Finally, value of the constant \c FLAC__FRAME_HEADER_RESERVED_LEN
* has changed to reflect the conversion of one of the reserved bits
* into active use. It used to be \c 2 and now is \c 1. However the
* FLAC frame header length has not changed, so to skip the proper
* number of bits, use \c FLAC__FRAME_HEADER_RESERVED_LEN +
* \c FLAC__FRAME_HEADER_BLOCKING_STRATEGY_LEN
*/
/** \defgroup flac FLAC C API
*
* The FLAC C API is the interface to libFLAC, a set of structures
* describing the components of FLAC streams, and functions for
* encoding and decoding streams, as well as manipulating FLAC
* metadata in files.
*
* You should start with the format components as all other modules
* are dependent on it.
*/
#endif

View File

@ -1,46 +0,0 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2001-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__ASSERT_H
#define FLAC__ASSERT_H
/* we need this since some compilers (like MSVC) leave assert()s on release code (and we don't want to use their ASSERT) */
#ifdef DEBUG
#include <assert.h>
#define FLAC__ASSERT(x) assert(x)
#define FLAC__ASSERT_DECLARATION(x) x
#else
#define FLAC__ASSERT(x)
#define FLAC__ASSERT_DECLARATION(x)
#endif
#endif

View File

@ -1,185 +0,0 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2004-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__CALLBACK_H
#define FLAC__CALLBACK_H
#include "ordinals.h"
#include <stdlib.h> /* for size_t */
/** \file include/FLAC/callback.h
*
* \brief
* This module defines the structures for describing I/O callbacks
* to the other FLAC interfaces.
*
* See the detailed documentation for callbacks in the
* \link flac_callbacks callbacks \endlink module.
*/
/** \defgroup flac_callbacks FLAC/callback.h: I/O callback structures
* \ingroup flac
*
* \brief
* This module defines the structures for describing I/O callbacks
* to the other FLAC interfaces.
*
* The purpose of the I/O callback functions is to create a common way
* for the metadata interfaces to handle I/O.
*
* Originally the metadata interfaces required filenames as the way of
* specifying FLAC files to operate on. This is problematic in some
* environments so there is an additional option to specify a set of
* callbacks for doing I/O on the FLAC file, instead of the filename.
*
* In addition to the callbacks, a FLAC__IOHandle type is defined as an
* opaque structure for a data source.
*
* The callback function prototypes are similar (but not identical) to the
* stdio functions fread, fwrite, fseek, ftell, feof, and fclose. If you use
* stdio streams to implement the callbacks, you can pass fread, fwrite, and
* fclose anywhere a FLAC__IOCallback_Read, FLAC__IOCallback_Write, or
* FLAC__IOCallback_Close is required, and a FILE* anywhere a FLAC__IOHandle
* is required. \warning You generally CANNOT directly use fseek or ftell
* for FLAC__IOCallback_Seek or FLAC__IOCallback_Tell since on most systems
* these use 32-bit offsets and FLAC requires 64-bit offsets to deal with
* large files. You will have to find an equivalent function (e.g. ftello),
* or write a wrapper. The same is true for feof() since this is usually
* implemented as a macro, not as a function whose address can be taken.
*
* \{
*/
#ifdef __cplusplus
extern "C" {
#endif
/** This is the opaque handle type used by the callbacks. Typically
* this is a \c FILE* or address of a file descriptor.
*/
typedef void* FLAC__IOHandle;
/** Signature for the read callback.
* The signature and semantics match POSIX fread() implementations
* and can generally be used interchangeably.
*
* \param ptr The address of the read buffer.
* \param size The size of the records to be read.
* \param nmemb The number of records to be read.
* \param handle The handle to the data source.
* \retval size_t
* The number of records read.
*/
typedef size_t (*FLAC__IOCallback_Read) (void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
/** Signature for the write callback.
* The signature and semantics match POSIX fwrite() implementations
* and can generally be used interchangeably.
*
* \param ptr The address of the write buffer.
* \param size The size of the records to be written.
* \param nmemb The number of records to be written.
* \param handle The handle to the data source.
* \retval size_t
* The number of records written.
*/
typedef size_t (*FLAC__IOCallback_Write) (const void *ptr, size_t size, size_t nmemb, FLAC__IOHandle handle);
/** Signature for the seek callback.
* The signature and semantics mostly match POSIX fseek() WITH ONE IMPORTANT
* EXCEPTION: the offset is a 64-bit type whereas fseek() is generally 'long'
* and 32-bits wide.
*
* \param handle The handle to the data source.
* \param offset The new position, relative to \a whence
* \param whence \c SEEK_SET, \c SEEK_CUR, or \c SEEK_END
* \retval int
* \c 0 on success, \c -1 on error.
*/
typedef int (*FLAC__IOCallback_Seek) (FLAC__IOHandle handle, FLAC__int64 offset, int whence);
/** Signature for the tell callback.
* The signature and semantics mostly match POSIX ftell() WITH ONE IMPORTANT
* EXCEPTION: the offset is a 64-bit type whereas ftell() is generally 'long'
* and 32-bits wide.
*
* \param handle The handle to the data source.
* \retval FLAC__int64
* The current position on success, \c -1 on error.
*/
typedef FLAC__int64 (*FLAC__IOCallback_Tell) (FLAC__IOHandle handle);
/** Signature for the EOF callback.
* The signature and semantics mostly match POSIX feof() but WATCHOUT:
* on many systems, feof() is a macro, so in this case a wrapper function
* must be provided instead.
*
* \param handle The handle to the data source.
* \retval int
* \c 0 if not at end of file, nonzero if at end of file.
*/
typedef int (*FLAC__IOCallback_Eof) (FLAC__IOHandle handle);
/** Signature for the close callback.
* The signature and semantics match POSIX fclose() implementations
* and can generally be used interchangeably.
*
* \param handle The handle to the data source.
* \retval int
* \c 0 on success, \c EOF on error.
*/
typedef int (*FLAC__IOCallback_Close) (FLAC__IOHandle handle);
/** A structure for holding a set of callbacks.
* Each FLAC interface that requires a FLAC__IOCallbacks structure will
* describe which of the callbacks are required. The ones that are not
* required may be set to NULL.
*
* If the seek requirement for an interface is optional, you can signify that
* a data sorce is not seekable by setting the \a seek field to \c NULL.
*/
typedef struct {
FLAC__IOCallback_Read read;
FLAC__IOCallback_Write write;
FLAC__IOCallback_Seek seek;
FLAC__IOCallback_Tell tell;
FLAC__IOCallback_Eof eof;
FLAC__IOCallback_Close close;
} FLAC__IOCallbacks;
/* \} */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,97 +0,0 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__EXPORT_H
#define FLAC__EXPORT_H
/** \file include/FLAC/export.h
*
* \brief
* This module contains #defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* See the \link flac_export export \endlink module.
*/
/** \defgroup flac_export FLAC/export.h: export symbols
* \ingroup flac
*
* \brief
* This module contains #defines and symbols for exporting function
* calls, and providing version information and compiled-in features.
*
* If you are compiling with MSVC and will link to the static library
* (libFLAC.lib) you should define FLAC__NO_DLL in your project to
* make sure the symbols are exported properly.
*
* \{
*/
#if defined(FLAC__NO_DLL)
#define FLAC_API
#elif defined(_MSC_VER)
#ifdef FLAC_API_EXPORTS
#define FLAC_API __declspec(dllexport)
#else
#define FLAC_API __declspec(dllimport)
#endif
#elif defined(FLAC__USE_VISIBILITY_ATTR)
#define FLAC_API __attribute__ ((visibility ("default")))
#else
#define FLAC_API
#endif
/** These #defines will mirror the libtool-based library version number, see
* http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
*/
#define FLAC_API_VERSION_CURRENT 11
#define FLAC_API_VERSION_REVISION 0 /**< see above */
#define FLAC_API_VERSION_AGE 3 /**< see above */
#ifdef __cplusplus
extern "C" {
#endif
/** \c 1 if the library has been compiled with support for Ogg FLAC, else \c 0. */
extern FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC;
#ifdef __cplusplus
}
#endif
/* \} */
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,86 +0,0 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2000-2009 Josh Coalson
* Copyright (C) 2011-2014 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FLAC__ORDINALS_H
#define FLAC__ORDINALS_H
#if defined(_MSC_VER) && _MSC_VER < 1600
/* Microsoft Visual Studio earlier than the 2010 version did not provide
* the 1999 ISO C Standard header file <stdint.h>.
*/
typedef __int8 FLAC__int8;
typedef unsigned __int8 FLAC__uint8;
typedef __int16 FLAC__int16;
typedef __int32 FLAC__int32;
typedef __int64 FLAC__int64;
typedef unsigned __int16 FLAC__uint16;
typedef unsigned __int32 FLAC__uint32;
typedef unsigned __int64 FLAC__uint64;
#else
/* For MSVC 2010 and everything else which provides <stdint.h>. */
#include <stdint.h>
typedef int8_t FLAC__int8;
typedef uint8_t FLAC__uint8;
typedef int16_t FLAC__int16;
typedef int32_t FLAC__int32;
typedef int64_t FLAC__int64;
typedef uint16_t FLAC__uint16;
typedef uint32_t FLAC__uint32;
typedef uint64_t FLAC__uint64;
#endif
typedef int FLAC__bool;
typedef FLAC__uint8 FLAC__byte;
#ifdef true
#undef true
#endif
#ifdef false
#undef false
#endif
#ifndef __cplusplus
#define true 1
#define false 0
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,210 +0,0 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: toplevel libogg include
last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $
********************************************************************/
#ifndef _OGG_H
#define _OGG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#include <ogg/os_types.h>
typedef struct {
void *iov_base;
size_t iov_len;
} ogg_iovec_t;
typedef struct {
long endbyte;
int endbit;
unsigned char *buffer;
unsigned char *ptr;
long storage;
} oggpack_buffer;
/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
typedef struct {
unsigned char *header;
long header_len;
unsigned char *body;
long body_len;
} ogg_page;
/* ogg_stream_state contains the current encode/decode state of a logical
Ogg bitstream **********************************************************/
typedef struct {
unsigned char *body_data; /* bytes from packet bodies */
long body_storage; /* storage elements allocated */
long body_fill; /* elements stored; fill mark */
long body_returned; /* elements of fill returned */
int *lacing_vals; /* The values that will go to the segment table */
ogg_int64_t *granule_vals; /* granulepos values for headers. Not compact
this way, but it is simple coupled to the
lacing fifo */
long lacing_storage;
long lacing_fill;
long lacing_packet;
long lacing_returned;
unsigned char header[282]; /* working space for header encode */
int header_fill;
int e_o_s; /* set when we have buffered the last packet in the
logical bitstream */
int b_o_s; /* set after we've written the initial page
of a logical bitstream */
long serialno;
long pageno;
ogg_int64_t packetno; /* sequence number for decode; the framing
knows where there's a hole in the data,
but we need coupling so that the codec
(which is in a separate abstraction
layer) also knows about the gap */
ogg_int64_t granulepos;
} ogg_stream_state;
/* ogg_packet is used to encapsulate the data and metadata belonging
to a single raw Ogg/Vorbis packet *************************************/
typedef struct {
unsigned char *packet;
long bytes;
long b_o_s;
long e_o_s;
ogg_int64_t granulepos;
ogg_int64_t packetno; /* sequence number for decode; the framing
knows where there's a hole in the data,
but we need coupling so that the codec
(which is in a separate abstraction
layer) also knows about the gap */
} ogg_packet;
typedef struct {
unsigned char *data;
int storage;
int fill;
int returned;
int unsynced;
int headerbytes;
int bodybytes;
} ogg_sync_state;
/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
extern void oggpack_writeinit(oggpack_buffer *b);
extern int oggpack_writecheck(oggpack_buffer *b);
extern void oggpack_writetrunc(oggpack_buffer *b,long bits);
extern void oggpack_writealign(oggpack_buffer *b);
extern void oggpack_writecopy(oggpack_buffer *b,void *source,long bits);
extern void oggpack_reset(oggpack_buffer *b);
extern void oggpack_writeclear(oggpack_buffer *b);
extern void oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
extern void oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
extern long oggpack_look(oggpack_buffer *b,int bits);
extern long oggpack_look1(oggpack_buffer *b);
extern void oggpack_adv(oggpack_buffer *b,int bits);
extern void oggpack_adv1(oggpack_buffer *b);
extern long oggpack_read(oggpack_buffer *b,int bits);
extern long oggpack_read1(oggpack_buffer *b);
extern long oggpack_bytes(oggpack_buffer *b);
extern long oggpack_bits(oggpack_buffer *b);
extern unsigned char *oggpack_get_buffer(oggpack_buffer *b);
extern void oggpackB_writeinit(oggpack_buffer *b);
extern int oggpackB_writecheck(oggpack_buffer *b);
extern void oggpackB_writetrunc(oggpack_buffer *b,long bits);
extern void oggpackB_writealign(oggpack_buffer *b);
extern void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits);
extern void oggpackB_reset(oggpack_buffer *b);
extern void oggpackB_writeclear(oggpack_buffer *b);
extern void oggpackB_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
extern void oggpackB_write(oggpack_buffer *b,unsigned long value,int bits);
extern long oggpackB_look(oggpack_buffer *b,int bits);
extern long oggpackB_look1(oggpack_buffer *b);
extern void oggpackB_adv(oggpack_buffer *b,int bits);
extern void oggpackB_adv1(oggpack_buffer *b);
extern long oggpackB_read(oggpack_buffer *b,int bits);
extern long oggpackB_read1(oggpack_buffer *b);
extern long oggpackB_bytes(oggpack_buffer *b);
extern long oggpackB_bits(oggpack_buffer *b);
extern unsigned char *oggpackB_get_buffer(oggpack_buffer *b);
/* Ogg BITSTREAM PRIMITIVES: encoding **************************/
extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov,
int count, long e_o_s, ogg_int64_t granulepos);
extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill);
extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
extern int ogg_stream_flush_fill(ogg_stream_state *os, ogg_page *og, int nfill);
/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
extern int ogg_sync_init(ogg_sync_state *oy);
extern int ogg_sync_clear(ogg_sync_state *oy);
extern int ogg_sync_reset(ogg_sync_state *oy);
extern int ogg_sync_destroy(ogg_sync_state *oy);
extern int ogg_sync_check(ogg_sync_state *oy);
extern char *ogg_sync_buffer(ogg_sync_state *oy, long size);
extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
/* Ogg BITSTREAM PRIMITIVES: general ***************************/
extern int ogg_stream_init(ogg_stream_state *os,int serialno);
extern int ogg_stream_clear(ogg_stream_state *os);
extern int ogg_stream_reset(ogg_stream_state *os);
extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
extern int ogg_stream_destroy(ogg_stream_state *os);
extern int ogg_stream_check(ogg_stream_state *os);
extern int ogg_stream_eos(ogg_stream_state *os);
extern void ogg_page_checksum_set(ogg_page *og);
extern int ogg_page_version(const ogg_page *og);
extern int ogg_page_continued(const ogg_page *og);
extern int ogg_page_bos(const ogg_page *og);
extern int ogg_page_eos(const ogg_page *og);
extern ogg_int64_t ogg_page_granulepos(const ogg_page *og);
extern int ogg_page_serialno(const ogg_page *og);
extern long ogg_page_pageno(const ogg_page *og);
extern int ogg_page_packets(const ogg_page *og);
extern void ogg_packet_clear(ogg_packet *op);
#ifdef __cplusplus
}
#endif
#endif /* _OGG_H */

View File

@ -1,147 +0,0 @@
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the Xiph.Org Foundation http://www.xiph.org/ *
* *
********************************************************************
function: #ifdef jail to whip a few platforms into the UNIX ideal.
last mod: $Id: os_types.h 19098 2014-02-26 19:06:45Z giles $
********************************************************************/
#ifndef _OS_TYPES_H
#define _OS_TYPES_H
/* make it easy on the folks that want to compile the libs with a
different malloc than stdlib */
#define _ogg_malloc malloc
#define _ogg_calloc calloc
#define _ogg_realloc realloc
#define _ogg_free free
#if defined(_WIN32)
# if defined(__CYGWIN__)
# include <stdint.h>
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
typedef uint64_t ogg_uint64_t;
# elif defined(__MINGW32__)
# include <sys/types.h>
typedef short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long ogg_int64_t;
typedef unsigned long long ogg_uint64_t;
# elif defined(__MWERKS__)
typedef long long ogg_int64_t;
typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
# else
/* MSVC/Borland */
typedef __int64 ogg_int64_t;
typedef __int32 ogg_int32_t;
typedef unsigned __int32 ogg_uint32_t;
typedef __int16 ogg_int16_t;
typedef unsigned __int16 ogg_uint16_t;
# endif
#elif defined(__MACOS__)
# include <sys/types.h>
typedef SInt16 ogg_int16_t;
typedef UInt16 ogg_uint16_t;
typedef SInt32 ogg_int32_t;
typedef UInt32 ogg_uint32_t;
typedef SInt64 ogg_int64_t;
#elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
# include <inttypes.h>
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
#elif defined(__HAIKU__)
/* Haiku */
# include <sys/types.h>
typedef short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long ogg_int64_t;
#elif defined(__BEOS__)
/* Be */
# include <inttypes.h>
typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;
#elif defined (__EMX__)
/* OS/2 GCC */
typedef short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long ogg_int64_t;
#elif defined (DJGPP)
/* DJGPP */
typedef short ogg_int16_t;
typedef int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long ogg_int64_t;
#elif defined(R5900)
/* PS2 EE */
typedef long ogg_int64_t;
typedef int ogg_int32_t;
typedef unsigned ogg_uint32_t;
typedef short ogg_int16_t;
#elif defined(__SYMBIAN32__)
/* Symbian GCC */
typedef signed short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
typedef signed int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long int ogg_int64_t;
#elif defined(__TMS320C6X__)
/* TI C64x compiler */
typedef signed short ogg_int16_t;
typedef unsigned short ogg_uint16_t;
typedef signed int ogg_int32_t;
typedef unsigned int ogg_uint32_t;
typedef long long int ogg_int64_t;
#else
# include <ogg/config_types.h>
#endif
#endif /* _OS_TYPES_H */

View File

@ -1,69 +0,0 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2014 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef _WIN32
#ifndef flac__win_utf8_io_h
#define flac__win_utf8_io_h
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <sys/stat.h>
#include <stdarg.h>
#include <windows.h>
int get_utf8_argv(int *argc, char ***argv);
int printf_utf8(const char *format, ...);
int fprintf_utf8(FILE *stream, const char *format, ...);
int vfprintf_utf8(FILE *stream, const char *format, va_list argptr);
FILE *fopen_utf8(const char *filename, const char *mode);
int stat_utf8(const char *path, struct stat *buffer);
int _stat64_utf8(const char *path, struct __stat64 *buffer);
int chmod_utf8(const char *filename, int pmode);
int utime_utf8(const char *filename, struct utimbuf *times);
int unlink_utf8(const char *filename);
int rename_utf8(const char *oldname, const char *newname);
size_t strlen_utf8(const char *str);
int win_get_console_width(void);
int print_console(FILE *stream, const wchar_t *text, size_t len);
HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif
#endif

View File

@ -1,373 +0,0 @@
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2013-2014 Xiph.Org Foundation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* - Neither the name of the Xiph.org Foundation nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <sys/stat.h>
#include <sys/utime.h>
#include <io.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h> /* for WideCharToMultiByte and MultiByteToWideChar */
#include <share/win_utf8_io.h>
#define UTF8_BUFFER_SIZE 32768
static
int local_vsnprintf(char *str, size_t size, const char *fmt, va_list va)
{
int rc;
#if defined _MSC_VER
if (size == 0)
return 1024;
rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va);
if (rc < 0)
rc = size - 1;
#elif defined __MINGW32__
rc = __mingw_vsnprintf (str, size, fmt, va);
#else
rc = vsnprintf (str, size, fmt, va);
#endif
return rc;
}
static UINT win_utf8_io_codepage = CP_ACP;
/* convert WCHAR stored Unicode string to UTF-8. Caller is responsible for freeing memory */
static
char *utf8_from_wchar(const wchar_t *wstr)
{
char *utf8str;
int len;
if (!wstr) return NULL;
if ((len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL)) == 0) return NULL;
if ((utf8str = (char *)malloc(++len)) == NULL) return NULL;
if (WideCharToMultiByte(CP_UTF8, 0, wstr, -1, utf8str, len, NULL, NULL) == 0) {
free(utf8str);
utf8str = NULL;
}
return utf8str;
}
/* convert UTF-8 back to WCHAR. Caller is responsible for freeing memory */
static
wchar_t *wchar_from_utf8(const char *str)
{
wchar_t *widestr;
int len;
if (!str) return NULL;
len=(int)strlen(str)+1;
if ((widestr = (wchar_t *)malloc(len*sizeof(wchar_t))) != NULL) {
if (MultiByteToWideChar(win_utf8_io_codepage, 0, str, len, widestr, len) == 0) {
if (MultiByteToWideChar(CP_ACP, 0, str, len, widestr, len) == 0) { /* try conversion from Ansi in case the initial UTF-8 conversion had failed */
free(widestr);
widestr = NULL;
}
}
}
return widestr;
}
/* retrieve WCHAR commandline, expand wildcards and convert everything to UTF-8 */
int get_utf8_argv(int *argc, char ***argv)
{
typedef int (__cdecl *wgetmainargs_t)(int*, wchar_t***, wchar_t***, int, int*);
wgetmainargs_t wgetmainargs;
HMODULE handle;
int wargc;
wchar_t **wargv;
wchar_t **wenv;
char **utf8argv;
int ret, i;
if ((handle = LoadLibrary("msvcrt.dll")) == NULL) return 1;
if ((wgetmainargs = (wgetmainargs_t)GetProcAddress(handle, "__wgetmainargs")) == NULL) return 1;
i = 0;
/* if __wgetmainargs expands wildcards then it also erroneously converts \\?\c:\path\to\file.flac to \\file.flac */
if (wgetmainargs(&wargc, &wargv, &wenv, 1, &i) != 0) return 1;
if ((utf8argv = (char **)calloc(wargc, sizeof(char*))) == NULL) return 1;
ret = 0;
for (i=0; i<wargc; i++) {
if ((utf8argv[i] = utf8_from_wchar(wargv[i])) == NULL) {
ret = 1;
break;
}
}
FreeLibrary(handle);
if (ret == 0) {
win_utf8_io_codepage = CP_UTF8;
*argc = wargc;
*argv = utf8argv;
} else {
for (i=0; i<wargc; i++)
free(utf8argv[i]);
free(utf8argv);
}
return ret;
}
/* return number of characters in the UTF-8 string */
size_t strlen_utf8(const char *str)
{
size_t len;
if ((len = MultiByteToWideChar(win_utf8_io_codepage, 0, str, -1, NULL, 0)) == 0)
len = strlen(str);
return len;
}
/* get the console width in characters */
int win_get_console_width(void)
{
int width = 80;
CONSOLE_SCREEN_BUFFER_INFO csbi;
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (GetConsoleScreenBufferInfo(hOut, &csbi) != 0) width = csbi.dwSize.X;
return width;
}
/* print functions */
int print_console(FILE *stream, const wchar_t *text, size_t len)
{
static HANDLE hOut;
static HANDLE hErr;
DWORD out;
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
hErr = GetStdHandle(STD_ERROR_HANDLE);
if (stream == stdout && hOut != INVALID_HANDLE_VALUE && GetFileType(hOut) == FILE_TYPE_CHAR) {
if (WriteConsoleW(hOut, text, len, &out, NULL) == 0) return -1;
return out;
} else if (stream == stderr && hErr != INVALID_HANDLE_VALUE && GetFileType(hErr) == FILE_TYPE_CHAR) {
if (WriteConsoleW(hErr, text, len, &out, NULL) == 0) return -1;
return out;
} else {
int ret = fputws(text, stream);
if (ret < 0) return ret;
return len;
}
}
int printf_utf8(const char *format, ...)
{
char *utmp = NULL;
wchar_t *wout = NULL;
int ret = -1;
while (1) {
va_list argptr;
if (!(utmp = (char *)malloc(UTF8_BUFFER_SIZE*sizeof(char)))) break;
va_start(argptr, format);
ret = local_vsnprintf(utmp, UTF8_BUFFER_SIZE, format, argptr);
va_end(argptr);
if (ret < 0) break;
if (!(wout = wchar_from_utf8(utmp))) {
ret = -1;
break;
}
ret = print_console(stdout, wout, wcslen(wout));
break;
}
if (utmp) free(utmp);
if (wout) free(wout);
return ret;
}
int fprintf_utf8(FILE *stream, const char *format, ...)
{
char *utmp = NULL;
wchar_t *wout = NULL;
int ret = -1;
while (1) {
va_list argptr;
if (!(utmp = (char *)malloc(UTF8_BUFFER_SIZE*sizeof(char)))) break;
va_start(argptr, format);
ret = local_vsnprintf(utmp, UTF8_BUFFER_SIZE, format, argptr);
va_end(argptr);
if (ret < 0) break;
if (!(wout = wchar_from_utf8(utmp))) {
ret = -1;
break;
}
ret = print_console(stream, wout, wcslen(wout));
break;
}
if (utmp) free(utmp);
if (wout) free(wout);
return ret;
}
int vfprintf_utf8(FILE *stream, const char *format, va_list argptr)
{
char *utmp = NULL;
wchar_t *wout = NULL;
int ret = -1;
while (1) {
if (!(utmp = (char *)malloc(UTF8_BUFFER_SIZE*sizeof(char)))) break;
if ((ret = local_vsnprintf(utmp, UTF8_BUFFER_SIZE, format, argptr)) < 0) break;
if (!(wout = wchar_from_utf8(utmp))) {
ret = -1;
break;
}
ret = print_console(stream, wout, wcslen(wout));
break;
}
if (utmp) free(utmp);
if (wout) free(wout);
return ret;
}
/* file functions */
FILE *fopen_utf8(const char *filename, const char *mode)
{
wchar_t *wname = NULL;
wchar_t *wmode = NULL;
FILE *f = NULL;
while (1) {
if (!(wname = wchar_from_utf8(filename))) break;
if (!(wmode = wchar_from_utf8(mode))) break;
f = _wfopen(wname, wmode);
break;
}
if (wname) free(wname);
if (wmode) free(wmode);
return f;
}
int _stat64_utf8(const char *path, struct __stat64 *buffer)
{
wchar_t *wpath;
int ret;
if (!(wpath = wchar_from_utf8(path))) return -1;
ret = _wstat64(wpath, buffer);
free(wpath);
return ret;
}
int chmod_utf8(const char *filename, int pmode)
{
wchar_t *wname;
int ret;
if (!(wname = wchar_from_utf8(filename))) return -1;
ret = _wchmod(wname, pmode);
free(wname);
return ret;
}
int utime_utf8(const char *filename, struct utimbuf *times)
{
wchar_t *wname;
struct __utimbuf64 ut;
int ret;
if (sizeof(*times) == sizeof(ut)) {
memcpy(&ut, times, sizeof(ut));
} else {
ut.actime = times->actime;
ut.modtime = times->modtime;
}
if (!(wname = wchar_from_utf8(filename))) return -1;
ret = _wutime64(wname, &ut);
free(wname);
return ret;
}
int unlink_utf8(const char *filename)
{
wchar_t *wname;
int ret;
if (!(wname = wchar_from_utf8(filename))) return -1;
ret = _wunlink(wname);
free(wname);
return ret;
}
int rename_utf8(const char *oldname, const char *newname)
{
wchar_t *wold = NULL;
wchar_t *wnew = NULL;
int ret = -1;
while (1) {
if (!(wold = wchar_from_utf8(oldname))) break;
if (!(wnew = wchar_from_utf8(newname))) break;
ret = _wrename(wold, wnew);
break;
}
if (wold) free(wold);
if (wnew) free(wnew);
return ret;
}
HANDLE WINAPI CreateFile_utf8(const char *lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
{
wchar_t *wname;
HANDLE handle = INVALID_HANDLE_VALUE;
if ((wname = wchar_from_utf8(lpFileName)) != NULL) {
handle = CreateFileW(wname, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile);
free(wname);
}
return handle;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

@ -1,31 +0,0 @@
set (m4adecoder_SOURCES
m4adecoder_plugin.cpp
M4aDecoderFactory.cpp
M4aDecoder.cpp
stdafx.cpp
mp4ff/mp4atom.c
mp4ff/mp4ff.c
mp4ff/mp4meta.c
mp4ff/mp4sample.c
mp4ff/mp4tagupdate.c
mp4ff/mp4util.c
)
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}/drms"
"${CMAKE_CURRENT_SOURCE_DIR}/mp4ff"
)
ensure_library_exists(faad)
add_library(m4adecoder SHARED ${m4adecoder_SOURCES})
# prefer static libraries on mac to make redist easier
if (${LINK_STATICALLY} MATCHES "true")
ensure_library_exists(libfaad.a)
find_library(FAADLIB NAMES libfaad.a faad)
target_link_libraries(m4adecoder ${musikcube_LINK_LIBS} ${FAADLIB})
else()
target_link_libraries(m4adecoder ${musikcube_LINK_LIBS} faad)
endif()

View File

@ -1,236 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2021 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "M4aDecoder.h"
#include <cstring>
#include <string>
#include <stdlib.h>
using musik::core::sdk::IDataStream;
using musik::core::sdk::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;
}
M4aDecoder::M4aDecoder() {
this->decoder = nullptr;
this->decoderFile = nullptr;
memset(&decoderCallbacks, 0, sizeof(this->decoderCallbacks));
this->duration = -1.0f;
this->exhausted = false;
}
M4aDecoder::~M4aDecoder() {
}
bool M4aDecoder::Open(musik::core::sdk::IDataStream *stream) {
decoder = NeAACDecOpen();
if (!decoder) {
this->exhausted = true;
return false;
}
NeAACDecConfigurationPtr config;
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) {
if ((audioTrackId = FindAacTrack(decoderFile)) >= 0) {
unsigned char* buffer = NULL;
unsigned int bufferSize = 0;
mp4ff_get_decoder_config(
decoderFile, audioTrackId, &buffer, &bufferSize);
const float scale =
(float) mp4ff_time_scale(decoderFile, audioTrackId);
const float duration =
(float) mp4ff_get_track_duration(decoderFile, audioTrackId);
if (scale > 0 && duration > 0) {
this->duration = duration / scale;
}
if (buffer) {
if (NeAACDecInit2(
decoder,
buffer,
bufferSize,
&this->sampleRate,
&this->channelCount) >= 0)
{
this->totalSamples = mp4ff_num_samples(decoderFile, audioTrackId);
this->decoderSampleId = 0;
free(buffer);
return true;
}
free(buffer);
}
}
}
return false;
}
void M4aDecoder::Release() {
mp4ff_close(decoderFile);
if (decoder) {
NeAACDecClose(decoder);
decoder = NULL;
}
delete this;
}
double M4aDecoder::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;
}
double M4aDecoder::GetDuration() {
return this->duration;
}
bool M4aDecoder::GetBuffer(IBuffer* target) {
if (this->decoderSampleId >= 0) {
void* sampleBuffer = NULL;
unsigned char* encodedData = NULL;
unsigned int encodedDataLength = 0;
NeAACDecFrameInfo frameInfo;
long duration = mp4ff_get_sample_duration(
decoderFile, audioTrackId, decoderSampleId);
if (duration > 0) {
/* read the raw data required */
int rc =
mp4ff_read_sample(
decoderFile,
audioTrackId,
decoderSampleId,
&encodedData,
&encodedDataLength);
decoderSampleId++;
if (rc == 0 || encodedData == NULL) {
this->exhausted = true;
return false;
}
sampleBuffer =
NeAACDecDecode(
decoder,
&frameInfo,
encodedData,
encodedDataLength);
free(encodedData);
if (sampleBuffer && frameInfo.error <= 0 && decoderSampleId <= this->totalSamples) {
target->SetSampleRate(frameInfo.samplerate);
target->SetChannels(frameInfo.channels);
target->SetSamples(frameInfo.samples);
memcpy(
static_cast<void*>(target->BufferPointer()),
static_cast<void*>(sampleBuffer),
sizeof(float) * frameInfo.samples);
return true;
}
}
}
this->exhausted = true;
return false;
}

View File

@ -1,65 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2021 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <musikcore/sdk/IDecoder.h>
#include <neaacdec.h>
#include <mp4ff.h>
class M4aDecoder : public musik::core::sdk::IDecoder {
public:
M4aDecoder();
~M4aDecoder();
void Release() override;
double SetPosition(double seconds) override;
bool GetBuffer(musik::core::sdk::IBuffer *buffer) override;
double GetDuration() override;
bool Open(musik::core::sdk::IDataStream *stream) override;
bool Exhausted() override { return this->exhausted; }
void SetPreferredSampleRate(int rate) override { }
private:
NeAACDecHandle decoder;
mp4ff_t* decoderFile;
mp4ff_callback_t decoderCallbacks;
int audioTrackId;
long totalSamples;
unsigned long sampleRate;
unsigned char channelCount;
long decoderSampleId;
double duration;
bool exhausted;
};

View File

@ -1,74 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2021 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "M4aDecoderFactory.h"
#include "M4aDecoder.h"
#include <algorithm>
#include <string>
using musik::core::sdk::IDecoder;
inline bool endsWith(const std::string& s, const std::string& suffix) {
return
s.size() >= suffix.size() &&
s.rfind(suffix) == (s.size() - suffix.size());
}
M4aDecoderFactory::M4aDecoderFactory() {
}
M4aDecoderFactory::~M4aDecoderFactory() {
}
void M4aDecoderFactory::Release() {
delete this;
}
IDecoder* M4aDecoderFactory::CreateDecoder() {
return new M4aDecoder();
}
bool M4aDecoderFactory::CanHandle(const char* type) const {
std::string str(type);
std::transform(str.begin(), str.end(), str.begin(), tolower);
return
endsWith(str, ".m4a") ||
str.find("audio/mp4") != std::string::npos;
}

View File

@ -1,46 +0,0 @@
//////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2004-2021 musikcube team
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <musikcore/sdk/IDecoderFactory.h>
class M4aDecoderFactory : public musik::core::sdk::IDecoderFactory {
public:
M4aDecoderFactory();
~M4aDecoderFactory();
virtual musik::core::sdk::IDecoder* CreateDecoder();
virtual void Release();
virtual bool CanHandle(const char* source) const;
};

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +0,0 @@
/*****************************************************************************
* drms.h : DRMS
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: drms.h,v 1.1 2005/07/22 01:14:52 twistedddx Exp $
*
* Author: Jon Lech Johansen <jon-vl@nanocrew.net>
*
* 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, USA.
*****************************************************************************/
extern void *drms_alloc( char *psz_homedir );
extern void drms_free( void *p_drms );
extern int drms_init( void *p_drms, uint32_t i_type,
uint8_t *p_info, uint32_t i_len );
extern void drms_decrypt( void *p_drms, uint32_t *p_buffer,
uint32_t i_len );

View File

@ -1,288 +0,0 @@
/*****************************************************************************
* drmstables.h : AES/Rijndael block cipher and miscellaneous tables
*****************************************************************************
* Copyright (C) 2004 VideoLAN
* $Id: drmstables.h,v 1.1 2005/07/22 01:14:52 twistedddx Exp $
*
* Author: Jon Lech Johansen <jon-vl@nanocrew.net>
*
* 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, USA.
*****************************************************************************/
#define AES_ROR( x, n ) (((x) << (32-(n))) | ((x) >> (n)))
#define AES_XOR_ROR( p_table, p_tmp ) \
( p_table[ (p_tmp[ t > 2 ? t - 3 : t + 1 ] >> 24) & 0xFF ] \
^ AES_ROR( p_table[ (p_tmp[ t > 1 ? t - 2 : t + 2 ] >> 16) & 0xFF ], 8 ) \
^ AES_ROR( p_table[ (p_tmp[ t > 0 ? t - 1 : t + 3 ] >> 8) & 0xFF ], 16 ) \
^ AES_ROR( p_table[ p_tmp[ t ] & 0xFF ], 24 ) )
#define AES_KEY_COUNT 10
static uint32_t const p_aes_table[ AES_KEY_COUNT ] =
{
0x00000001, 0x00000002, 0x00000004, 0x00000008, 0x00000010, 0x00000020,
0x00000040, 0x00000080, 0x0000001b, 0x00000036
};
static uint32_t const p_aes_encrypt[ 256 ] =
{
0x63000000, 0x7c000000, 0x77000000, 0x7b000000, 0xf2000000, 0x6b000000,
0x6f000000, 0xc5000000, 0x30000000, 0x01000000, 0x67000000, 0x2b000000,
0xfe000000, 0xd7000000, 0xab000000, 0x76000000, 0xca000000, 0x82000000,
0xc9000000, 0x7d000000, 0xfa000000, 0x59000000, 0x47000000, 0xf0000000,
0xad000000, 0xd4000000, 0xa2000000, 0xaf000000, 0x9c000000, 0xa4000000,
0x72000000, 0xc0000000, 0xb7000000, 0xfd000000, 0x93000000, 0x26000000,
0x36000000, 0x3f000000, 0xf7000000, 0xcc000000, 0x34000000, 0xa5000000,
0xe5000000, 0xf1000000, 0x71000000, 0xd8000000, 0x31000000, 0x15000000,
0x04000000, 0xc7000000, 0x23000000, 0xc3000000, 0x18000000, 0x96000000,
0x05000000, 0x9a000000, 0x07000000, 0x12000000, 0x80000000, 0xe2000000,
0xeb000000, 0x27000000, 0xb2000000, 0x75000000, 0x09000000, 0x83000000,
0x2c000000, 0x1a000000, 0x1b000000, 0x6e000000, 0x5a000000, 0xa0000000,
0x52000000, 0x3b000000, 0xd6000000, 0xb3000000, 0x29000000, 0xe3000000,
0x2f000000, 0x84000000, 0x53000000, 0xd1000000, 0x00000000, 0xed000000,
0x20000000, 0xfc000000, 0xb1000000, 0x5b000000, 0x6a000000, 0xcb000000,
0xbe000000, 0x39000000, 0x4a000000, 0x4c000000, 0x58000000, 0xcf000000,
0xd0000000, 0xef000000, 0xaa000000, 0xfb000000, 0x43000000, 0x4d000000,
0x33000000, 0x85000000, 0x45000000, 0xf9000000, 0x02000000, 0x7f000000,
0x50000000, 0x3c000000, 0x9f000000, 0xa8000000, 0x51000000, 0xa3000000,
0x40000000, 0x8f000000, 0x92000000, 0x9d000000, 0x38000000, 0xf5000000,
0xbc000000, 0xb6000000, 0xda000000, 0x21000000, 0x10000000, 0xff000000,
0xf3000000, 0xd2000000, 0xcd000000, 0x0c000000, 0x13000000, 0xec000000,
0x5f000000, 0x97000000, 0x44000000, 0x17000000, 0xc4000000, 0xa7000000,
0x7e000000, 0x3d000000, 0x64000000, 0x5d000000, 0x19000000, 0x73000000,
0x60000000, 0x81000000, 0x4f000000, 0xdc000000, 0x22000000, 0x2a000000,
0x90000000, 0x88000000, 0x46000000, 0xee000000, 0xb8000000, 0x14000000,
0xde000000, 0x5e000000, 0x0b000000, 0xdb000000, 0xe0000000, 0x32000000,
0x3a000000, 0x0a000000, 0x49000000, 0x06000000, 0x24000000, 0x5c000000,
0xc2000000, 0xd3000000, 0xac000000, 0x62000000, 0x91000000, 0x95000000,
0xe4000000, 0x79000000, 0xe7000000, 0xc8000000, 0x37000000, 0x6d000000,
0x8d000000, 0xd5000000, 0x4e000000, 0xa9000000, 0x6c000000, 0x56000000,
0xf4000000, 0xea000000, 0x65000000, 0x7a000000, 0xae000000, 0x08000000,
0xba000000, 0x78000000, 0x25000000, 0x2e000000, 0x1c000000, 0xa6000000,
0xb4000000, 0xc6000000, 0xe8000000, 0xdd000000, 0x74000000, 0x1f000000,
0x4b000000, 0xbd000000, 0x8b000000, 0x8a000000, 0x70000000, 0x3e000000,
0xb5000000, 0x66000000, 0x48000000, 0x03000000, 0xf6000000, 0x0e000000,
0x61000000, 0x35000000, 0x57000000, 0xb9000000, 0x86000000, 0xc1000000,
0x1d000000, 0x9e000000, 0xe1000000, 0xf8000000, 0x98000000, 0x11000000,
0x69000000, 0xd9000000, 0x8e000000, 0x94000000, 0x9b000000, 0x1e000000,
0x87000000, 0xe9000000, 0xce000000, 0x55000000, 0x28000000, 0xdf000000,
0x8c000000, 0xa1000000, 0x89000000, 0x0d000000, 0xbf000000, 0xe6000000,
0x42000000, 0x68000000, 0x41000000, 0x99000000, 0x2d000000, 0x0f000000,
0xb0000000, 0x54000000, 0xbb000000, 0x16000000
};
static uint32_t const p_aes_itable[ 256 ] =
{
0x5150a7f4, 0x7e536541, 0x1ac3a417, 0x3a965e27, 0x3bcb6bab, 0x1ff1459d,
0xacab58fa, 0x4b9303e3, 0x2055fa30, 0xadf66d76, 0x889176cc, 0xf5254c02,
0x4ffcd7e5, 0xc5d7cb2a, 0x26804435, 0xb58fa362, 0xde495ab1, 0x25671bba,
0x45980eea, 0x5de1c0fe, 0xc302752f, 0x8112f04c, 0x8da39746, 0x6bc6f9d3,
0x03e75f8f, 0x15959c92, 0xbfeb7a6d, 0x95da5952, 0xd42d83be, 0x58d32174,
0x492969e0, 0x8e44c8c9, 0x756a89c2, 0xf478798e, 0x996b3e58, 0x27dd71b9,
0xbeb64fe1, 0xf017ad88, 0xc966ac20, 0x7db43ace, 0x63184adf, 0xe582311a,
0x97603351, 0x62457f53, 0xb1e07764, 0xbb84ae6b, 0xfe1ca081, 0xf9942b08,
0x70586848, 0x8f19fd45, 0x94876cde, 0x52b7f87b, 0xab23d373, 0x72e2024b,
0xe3578f1f, 0x662aab55, 0xb20728eb, 0x2f03c2b5, 0x869a7bc5, 0xd3a50837,
0x30f28728, 0x23b2a5bf, 0x02ba6a03, 0xed5c8216, 0x8a2b1ccf, 0xa792b479,
0xf3f0f207, 0x4ea1e269, 0x65cdf4da, 0x06d5be05, 0xd11f6234, 0xc48afea6,
0x349d532e, 0xa2a055f3, 0x0532e18a, 0xa475ebf6, 0x0b39ec83, 0x40aaef60,
0x5e069f71, 0xbd51106e, 0x3ef98a21, 0x963d06dd, 0xddae053e, 0x4d46bde6,
0x91b58d54, 0x71055dc4, 0x046fd406, 0x60ff1550, 0x1924fb98, 0xd697e9bd,
0x89cc4340, 0x67779ed9, 0xb0bd42e8, 0x07888b89, 0xe7385b19, 0x79dbeec8,
0xa1470a7c, 0x7ce90f42, 0xf8c91e84, 0x00000000, 0x09838680, 0x3248ed2b,
0x1eac7011, 0x6c4e725a, 0xfdfbff0e, 0x0f563885, 0x3d1ed5ae, 0x3627392d,
0x0a64d90f, 0x6821a65c, 0x9bd1545b, 0x243a2e36, 0x0cb1670a, 0x930fe757,
0xb4d296ee, 0x1b9e919b, 0x804fc5c0, 0x61a220dc, 0x5a694b77, 0x1c161a12,
0xe20aba93, 0xc0e52aa0, 0x3c43e022, 0x121d171b, 0x0e0b0d09, 0xf2adc78b,
0x2db9a8b6, 0x14c8a91e, 0x578519f1, 0xaf4c0775, 0xeebbdd99, 0xa3fd607f,
0xf79f2601, 0x5cbcf572, 0x44c53b66, 0x5b347efb, 0x8b762943, 0xcbdcc623,
0xb668fced, 0xb863f1e4, 0xd7cadc31, 0x42108563, 0x13402297, 0x842011c6,
0x857d244a, 0xd2f83dbb, 0xae1132f9, 0xc76da129, 0x1d4b2f9e, 0xdcf330b2,
0x0dec5286, 0x77d0e3c1, 0x2b6c16b3, 0xa999b970, 0x11fa4894, 0x472264e9,
0xa8c48cfc, 0xa01a3ff0, 0x56d82c7d, 0x22ef9033, 0x87c74e49, 0xd9c1d138,
0x8cfea2ca, 0x98360bd4, 0xa6cf81f5, 0xa528de7a, 0xda268eb7, 0x3fa4bfad,
0x2ce49d3a, 0x500d9278, 0x6a9bcc5f, 0x5462467e, 0xf6c2138d, 0x90e8b8d8,
0x2e5ef739, 0x82f5afc3, 0x9fbe805d, 0x697c93d0, 0x6fa92dd5, 0xcfb31225,
0xc83b99ac, 0x10a77d18, 0xe86e639c, 0xdb7bbb3b, 0xcd097826, 0x6ef41859,
0xec01b79a, 0x83a89a4f, 0xe6656e95, 0xaa7ee6ff, 0x2108cfbc, 0xefe6e815,
0xbad99be7, 0x4ace366f, 0xead4099f, 0x29d67cb0, 0x31afb2a4, 0x2a31233f,
0xc63094a5, 0x35c066a2, 0x7437bc4e, 0xfca6ca82, 0xe0b0d090, 0x3315d8a7,
0xf14a9804, 0x41f7daec, 0x7f0e50cd, 0x172ff691, 0x768dd64d, 0x434db0ef,
0xcc544daa, 0xe4df0496, 0x9ee3b5d1, 0x4c1b886a, 0xc1b81f2c, 0x467f5165,
0x9d04ea5e, 0x015d358c, 0xfa737487, 0xfb2e410b, 0xb35a1d67, 0x9252d2db,
0xe9335610, 0x6d1347d6, 0x9a8c61d7, 0x377a0ca1, 0x598e14f8, 0xeb893c13,
0xceee27a9, 0xb735c961, 0xe1ede51c, 0x7a3cb147, 0x9c59dfd2, 0x553f73f2,
0x1879ce14, 0x73bf37c7, 0x53eacdf7, 0x5f5baafd, 0xdf146f3d, 0x7886db44,
0xca81f3af, 0xb93ec468, 0x382c3424, 0xc25f40a3, 0x1672c31d, 0xbc0c25e2,
0x288b493c, 0xff41950d, 0x397101a8, 0x08deb30c, 0xd89ce4b4, 0x6490c156,
0x7b6184cb, 0xd570b632, 0x48745c6c, 0xd04257b8
};
static uint32_t const p_aes_decrypt[ 256 ] =
{
0x52000000, 0x09000000, 0x6a000000, 0xd5000000, 0x30000000, 0x36000000,
0xa5000000, 0x38000000, 0xbf000000, 0x40000000, 0xa3000000, 0x9e000000,
0x81000000, 0xf3000000, 0xd7000000, 0xfb000000, 0x7c000000, 0xe3000000,
0x39000000, 0x82000000, 0x9b000000, 0x2f000000, 0xff000000, 0x87000000,
0x34000000, 0x8e000000, 0x43000000, 0x44000000, 0xc4000000, 0xde000000,
0xe9000000, 0xcb000000, 0x54000000, 0x7b000000, 0x94000000, 0x32000000,
0xa6000000, 0xc2000000, 0x23000000, 0x3d000000, 0xee000000, 0x4c000000,
0x95000000, 0x0b000000, 0x42000000, 0xfa000000, 0xc3000000, 0x4e000000,
0x08000000, 0x2e000000, 0xa1000000, 0x66000000, 0x28000000, 0xd9000000,
0x24000000, 0xb2000000, 0x76000000, 0x5b000000, 0xa2000000, 0x49000000,
0x6d000000, 0x8b000000, 0xd1000000, 0x25000000, 0x72000000, 0xf8000000,
0xf6000000, 0x64000000, 0x86000000, 0x68000000, 0x98000000, 0x16000000,
0xd4000000, 0xa4000000, 0x5c000000, 0xcc000000, 0x5d000000, 0x65000000,
0xb6000000, 0x92000000, 0x6c000000, 0x70000000, 0x48000000, 0x50000000,
0xfd000000, 0xed000000, 0xb9000000, 0xda000000, 0x5e000000, 0x15000000,
0x46000000, 0x57000000, 0xa7000000, 0x8d000000, 0x9d000000, 0x84000000,
0x90000000, 0xd8000000, 0xab000000, 0x00000000, 0x8c000000, 0xbc000000,
0xd3000000, 0x0a000000, 0xf7000000, 0xe4000000, 0x58000000, 0x05000000,
0xb8000000, 0xb3000000, 0x45000000, 0x06000000, 0xd0000000, 0x2c000000,
0x1e000000, 0x8f000000, 0xca000000, 0x3f000000, 0x0f000000, 0x02000000,
0xc1000000, 0xaf000000, 0xbd000000, 0x03000000, 0x01000000, 0x13000000,
0x8a000000, 0x6b000000, 0x3a000000, 0x91000000, 0x11000000, 0x41000000,
0x4f000000, 0x67000000, 0xdc000000, 0xea000000, 0x97000000, 0xf2000000,
0xcf000000, 0xce000000, 0xf0000000, 0xb4000000, 0xe6000000, 0x73000000,
0x96000000, 0xac000000, 0x74000000, 0x22000000, 0xe7000000, 0xad000000,
0x35000000, 0x85000000, 0xe2000000, 0xf9000000, 0x37000000, 0xe8000000,
0x1c000000, 0x75000000, 0xdf000000, 0x6e000000, 0x47000000, 0xf1000000,
0x1a000000, 0x71000000, 0x1d000000, 0x29000000, 0xc5000000, 0x89000000,
0x6f000000, 0xb7000000, 0x62000000, 0x0e000000, 0xaa000000, 0x18000000,
0xbe000000, 0x1b000000, 0xfc000000, 0x56000000, 0x3e000000, 0x4b000000,
0xc6000000, 0xd2000000, 0x79000000, 0x20000000, 0x9a000000, 0xdb000000,
0xc0000000, 0xfe000000, 0x78000000, 0xcd000000, 0x5a000000, 0xf4000000,
0x1f000000, 0xdd000000, 0xa8000000, 0x33000000, 0x88000000, 0x07000000,
0xc7000000, 0x31000000, 0xb1000000, 0x12000000, 0x10000000, 0x59000000,
0x27000000, 0x80000000, 0xec000000, 0x5f000000, 0x60000000, 0x51000000,
0x7f000000, 0xa9000000, 0x19000000, 0xb5000000, 0x4a000000, 0x0d000000,
0x2d000000, 0xe5000000, 0x7a000000, 0x9f000000, 0x93000000, 0xc9000000,
0x9c000000, 0xef000000, 0xa0000000, 0xe0000000, 0x3b000000, 0x4d000000,
0xae000000, 0x2a000000, 0xf5000000, 0xb0000000, 0xc8000000, 0xeb000000,
0xbb000000, 0x3c000000, 0x83000000, 0x53000000, 0x99000000, 0x61000000,
0x17000000, 0x2b000000, 0x04000000, 0x7e000000, 0xba000000, 0x77000000,
0xd6000000, 0x26000000, 0xe1000000, 0x69000000, 0x14000000, 0x63000000,
0x55000000, 0x21000000, 0x0c000000, 0x7d000000
};
static uint16_t const p_shuffle_xor[ 256 ] =
{
0x00d1, 0x0315, 0x1a32, 0x19ec, 0x1bbb, 0x1d6f, 0x14fe, 0x0e9e,
0x029e, 0x1b8f, 0x0b70, 0x033a, 0x188e, 0x1d18, 0x0bd8, 0x0edb,
0x0c64, 0x1c2b, 0x149c, 0x047b, 0x1064, 0x1c7c, 0x118d, 0x1355,
0x0ae5, 0x0f18, 0x016f, 0x17d6, 0x1595, 0x0084, 0x0616, 0x1ccd,
0x1d94, 0x0618, 0x182c, 0x195b, 0x196d, 0x0394, 0x07db, 0x0287,
0x1636, 0x0b81, 0x1519, 0x0df9, 0x1ba3, 0x1cc3, 0x0ee2, 0x1434,
0x1457, 0x0ced, 0x0f7d, 0x0d7b, 0x0b9e, 0x0d13, 0x13d7, 0x18d0,
0x1259, 0x1977, 0x0606, 0x1e80, 0x05f2, 0x06b8, 0x1f07, 0x1365,
0x0334, 0x0e30, 0x195f, 0x15f1, 0x058e, 0x0aa8, 0x045a, 0x0465,
0x0b3e, 0x071e, 0x0a36, 0x105c, 0x01ac, 0x1a1e, 0x04e4, 0x056b,
0x12bf, 0x0da2, 0x0b41, 0x0eaf, 0x034f, 0x0181, 0x04e2, 0x002b,
0x12e6, 0x01be, 0x10e8, 0x128f, 0x0eb2, 0x1369, 0x05be, 0x1a59,
0x117e, 0x047c, 0x1e86, 0x056a, 0x0da7, 0x0d61, 0x03fc, 0x1e6e,
0x1d0c, 0x1e6d, 0x14bf, 0x0c50, 0x063a, 0x1b47, 0x17ae, 0x1321,
0x041b, 0x0a24, 0x0d4d, 0x1f2b, 0x1cb6, 0x1bed, 0x1549, 0x03a7,
0x0254, 0x006c, 0x0c9e, 0x0f73, 0x006c, 0x0008, 0x11f9, 0x0dd5,
0x0bcf, 0x0af9, 0x1dfe, 0x0341, 0x0e49, 0x0d38, 0x17cb, 0x1513,
0x0e96, 0x00ed, 0x0556, 0x1b28, 0x100c, 0x19d8, 0x14fa, 0x028c,
0x1c60, 0x1232, 0x13d3, 0x0d00, 0x1534, 0x192c, 0x14b5, 0x1cf2,
0x0504, 0x0b5b, 0x1ecf, 0x0423, 0x183b, 0x06b0, 0x169e, 0x1066,
0x04cb, 0x08a2, 0x1b4a, 0x1254, 0x198d, 0x1044, 0x0236, 0x1bd8,
0x18a1, 0x03ff, 0x1a0d, 0x0277, 0x0c2d, 0x17c9, 0x007c, 0x116e,
0x048a, 0x1eaf, 0x0922, 0x0c45, 0x0766, 0x1e5f, 0x1a28, 0x0120,
0x1c15, 0x034c, 0x0508, 0x0e73, 0x0879, 0x0441, 0x09ae, 0x132f,
0x14fe, 0x0413, 0x0a9d, 0x1727, 0x01d7, 0x1a2b, 0x0474, 0x18f0,
0x1f3b, 0x14f5, 0x1071, 0x0895, 0x1071, 0x18ff, 0x18e3, 0x0eb9,
0x0ba9, 0x0961, 0x1599, 0x019e, 0x1d12, 0x1baa, 0x1e94, 0x1921,
0x14dc, 0x124e, 0x0a25, 0x03ab, 0x1cc0, 0x1ebb, 0x0b4b, 0x16e5,
0x11ea, 0x0d78, 0x1bb3, 0x1ba7, 0x1510, 0x1b7b, 0x0c64, 0x1995,
0x1a58, 0x1651, 0x1964, 0x147a, 0x15f2, 0x11bb, 0x1654, 0x166e,
0x0ea9, 0x1de1, 0x1443, 0x13c5, 0x00e1, 0x0b2f, 0x0b6f, 0x0a37,
0x18ac, 0x08e6, 0x06f0, 0x136e, 0x0853, 0x0b2e, 0x0813, 0x10d6
};
static uint16_t const p_shuffle_sub[ 256 ] =
{
0x067a, 0x0c7d, 0x0b4f, 0x127d, 0x0bd6, 0x04ac, 0x16e0, 0x1730,
0x0587, 0x0afb, 0x1ac3, 0x0120, 0x14b5, 0x0f67, 0x11de, 0x0961,
0x1127, 0x1a68, 0x07f0, 0x17d0, 0x1a6f, 0x1f3b, 0x01ef, 0x0919,
0x131e, 0x0f90, 0x19e9, 0x18a8, 0x0cb2, 0x1ad0, 0x0c66, 0x0378,
0x03b0, 0x01be, 0x1866, 0x1159, 0x197c, 0x1105, 0x010b, 0x0353,
0x1abb, 0x09a6, 0x028a, 0x1bad, 0x1b20, 0x0455, 0x0f57, 0x0588,
0x1491, 0x0a1d, 0x0f04, 0x0650, 0x191e, 0x1e0e, 0x174b, 0x016b,
0x051f, 0x0532, 0x00df, 0x1aea, 0x0005, 0x0e1b, 0x0ff6, 0x08d8,
0x14b4, 0x086a, 0x0c20, 0x0149, 0x1971, 0x0f26, 0x1852, 0x017d,
0x1228, 0x0352, 0x0a44, 0x1330, 0x18df, 0x1e38, 0x01bc, 0x0bac,
0x1a48, 0x021f, 0x02f7, 0x0c31, 0x0bc4, 0x1e75, 0x105c, 0x13e3,
0x0b20, 0x03a1, 0x1af3, 0x1a36, 0x0e34, 0x181f, 0x09bd, 0x122b,
0x0ee0, 0x163b, 0x0be7, 0x103d, 0x1075, 0x1e9d, 0x02af, 0x0ba2,
0x1daa, 0x0cf1, 0x04b6, 0x0598, 0x06a1, 0x0d33, 0x1cfe, 0x04ee,
0x1bad, 0x07c8, 0x1a48, 0x05e6, 0x031f, 0x0e0a, 0x0326, 0x1650,
0x0526, 0x0b4e, 0x08fc, 0x0e4d, 0x0832, 0x06ea, 0x09bf, 0x0993,
0x09eb, 0x0f31, 0x071b, 0x14d5, 0x11ca, 0x0722, 0x120d, 0x014c,
0x1993, 0x0ae4, 0x1ccb, 0x04e9, 0x0aee, 0x1708, 0x0c3d, 0x12f2,
0x1a19, 0x07c1, 0x05a7, 0x0744, 0x1606, 0x1a9b, 0x042d, 0x1bfc,
0x1841, 0x0c3c, 0x0ffe, 0x1ab1, 0x1416, 0x18a9, 0x0320, 0x1ec2,
0x0ae7, 0x11c6, 0x124a, 0x11df, 0x0f81, 0x06cf, 0x0ed9, 0x0253,
0x1d2b, 0x0349, 0x0805, 0x08b3, 0x1052, 0x12cf, 0x0a44, 0x0ea6,
0x03bf, 0x1d90, 0x0ef8, 0x0657, 0x156d, 0x0405, 0x10be, 0x091f,
0x1c82, 0x1725, 0x19ef, 0x0b8c, 0x04d9, 0x02c7, 0x025a, 0x1b89,
0x0f5c, 0x013d, 0x02f7, 0x12e3, 0x0bc5, 0x1b56, 0x0848, 0x0239,
0x0fcf, 0x03a4, 0x092d, 0x1354, 0x1d83, 0x01bd, 0x071a, 0x0af1,
0x0875, 0x0793, 0x1b41, 0x1782, 0x0def, 0x1d20, 0x13be, 0x0095,
0x1650, 0x19d4, 0x0de3, 0x0980, 0x18f2, 0x0ca3, 0x0098, 0x149a,
0x0b81, 0x0ad2, 0x1bba, 0x1a02, 0x027b, 0x1906, 0x07f5, 0x1cae,
0x0c3f, 0x02f6, 0x1298, 0x175e, 0x15b2, 0x13d8, 0x14cc, 0x161a,
0x0a42, 0x15f3, 0x0870, 0x1c1d, 0x1203, 0x18b1, 0x1738, 0x1954,
0x1143, 0x1ae8, 0x1d9d, 0x155b, 0x11e8, 0x0ed9, 0x06f7, 0x04ca
};
static uint16_t const p_shuffle_add[ 256 ] =
{
0x0706, 0x175a, 0x0def, 0x1e72, 0x0297, 0x1b0e, 0x1d5a, 0x15b8,
0x13e2, 0x1347, 0x10c6, 0x0b4f, 0x0629, 0x0a75, 0x0a9b, 0x0f55,
0x1a69, 0x09bf, 0x0ba6, 0x1582, 0x1086, 0x1921, 0x01cb, 0x1c6a,
0x0ff5, 0x00f7, 0x0a67, 0x0a1e, 0x1838, 0x0196, 0x10d6, 0x0c7a,
0x180e, 0x038d, 0x1add, 0x0684, 0x154a, 0x0ab0, 0x18a4, 0x0d73,
0x1641, 0x0ec6, 0x09f1, 0x1a62, 0x0414, 0x162a, 0x194e, 0x1ec9,
0x022f, 0x0296, 0x1104, 0x14fc, 0x096c, 0x1d02, 0x09bd, 0x027c,
0x080e, 0x1324, 0x128c, 0x0dc1, 0x00b9, 0x17f2, 0x0cbc, 0x0f97,
0x1b93, 0x1c3c, 0x0415, 0x0395, 0x0c7a, 0x06cc, 0x0d4b, 0x16e2,
0x04a2, 0x0dab, 0x1228, 0x012b, 0x0896, 0x0012, 0x1cd6, 0x1dac,
0x080d, 0x0446, 0x047a, 0x00ad, 0x029e, 0x0686, 0x17c3, 0x1466,
0x0d16, 0x1896, 0x076e, 0x00cd, 0x17dc, 0x1e9f, 0x1a7c, 0x02bb,
0x0d06, 0x112b, 0x14cb, 0x0a03, 0x1541, 0x1290, 0x0f6d, 0x1503,
0x084b, 0x0382, 0x1a3f, 0x0371, 0x1977, 0x0b67, 0x0cad, 0x1df8,
0x1ce3, 0x1306, 0x13f8, 0x1163, 0x1b0b, 0x00bd, 0x0bf0, 0x1a4f,
0x16f7, 0x0b4f, 0x0cf8, 0x1254, 0x0541, 0x100d, 0x0296, 0x0410,
0x1a2b, 0x1169, 0x17d9, 0x0819, 0x03d6, 0x0d03, 0x194d, 0x184a,
0x07ca, 0x1989, 0x0fad, 0x011c, 0x1c71, 0x0ef6, 0x0dc8, 0x0f2f,
0x0fa5, 0x11be, 0x0f3b, 0x1d52, 0x0de2, 0x016e, 0x1ad1, 0x0c4a,
0x1bc2, 0x0ac9, 0x1485, 0x1bee, 0x0949, 0x1a79, 0x1894, 0x12bb,
0x17b6, 0x14f5, 0x16b1, 0x142c, 0x1301, 0x03ef, 0x16ff, 0x0d37,
0x0d78, 0x01ff, 0x00d6, 0x1053, 0x1a2a, 0x0f61, 0x1352, 0x0c7f,
0x137f, 0x09c4, 0x1d96, 0x021d, 0x1037, 0x1b19, 0x10ef, 0x14e4,
0x02a0, 0x0236, 0x0a5d, 0x1519, 0x141c, 0x1399, 0x007e, 0x1e74,
0x0941, 0x1b3c, 0x0062, 0x0371, 0x09ad, 0x08e8, 0x0a24, 0x0b97,
0x1ed2, 0x0889, 0x136b, 0x0006, 0x1c4c, 0x0444, 0x06f8, 0x0dfb,
0x1d0f, 0x198d, 0x0700, 0x0afc, 0x1781, 0x12f3, 0x10da, 0x1f19,
0x1055, 0x0dc9, 0x1860, 0x012b, 0x05bf, 0x082d, 0x0c17, 0x1941,
0x0359, 0x1232, 0x104c, 0x0762, 0x0897, 0x1d6c, 0x030f, 0x1a36,
0x16b0, 0x094d, 0x1782, 0x036f, 0x0eea, 0x06e6, 0x0d00, 0x0187,
0x17e2, 0x05e5, 0x19fa, 0x1950, 0x146a, 0x0b2a, 0x0512, 0x0ee0,
0x1e27, 0x112d, 0x1df0, 0x0b13, 0x0378, 0x1dd0, 0x00c1, 0x01e6
};

View File

@ -1,52 +0,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: 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

View File

@ -1,271 +0,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 */

View File

@ -1,452 +0,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.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

File diff suppressed because it is too large Load Diff

View File

@ -1,56 +0,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: 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

File diff suppressed because it is too large Load Diff

View File

@ -1,145 +0,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.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

View File

@ -1,186 +0,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_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 }
};

View File

@ -1,312 +0,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_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 }
};

View File

@ -1,415 +0,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_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 }
};

View File

@ -1,185 +0,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_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 }
};

View File

@ -1,196 +0,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_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 */
};

View File

@ -1,199 +0,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_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 },
};

View File

@ -1,196 +0,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_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 } }
};

View File

@ -1,182 +0,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_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 }
};

View File

@ -1,162 +0,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_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 } }
};

View File

@ -1,173 +0,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_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 }
};

View File

@ -1,372 +0,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_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 } }
};

View File

@ -1,276 +0,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 }
};

View File

@ -1,522 +0,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: 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

View File

@ -1,449 +0,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: 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

File diff suppressed because it is too large Load Diff

View File

@ -1,173 +0,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: 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;
}
}

View File

@ -1,49 +0,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: 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

@ -1,965 +0,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: 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

@ -1,100 +0,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: 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

View File

@ -1,70 +0,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: 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"
};

View File

@ -1,44 +0,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: 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

@ -1,35 +0,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: 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"

View File

@ -1,406 +0,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: filtbank.c,v 1.46 2009/01/26 23:51:15 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32_WCE
#define assert(x)
#else
#include <assert.h>
#endif
#include "filtbank.h"
#include "syntax.h"
#include "kbd_win.h"
#include "sine_win.h"
#include "mdct.h"
fb_info *filter_bank_init(uint16_t frame_len)
{
uint16_t nshort = frame_len/8;
#ifdef LD_DEC
uint16_t frame_len_ld = frame_len/2;
#endif
fb_info *fb = (fb_info*)faad_malloc(sizeof(fb_info));
memset(fb, 0, sizeof(fb_info));
/* normal */
fb->mdct256 = faad_mdct_init(2*nshort);
fb->mdct2048 = faad_mdct_init(2*frame_len);
#ifdef LD_DEC
/* LD */
fb->mdct1024 = faad_mdct_init(2*frame_len_ld);
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
if (frame_len == 1024)
{
#endif
fb->long_window[0] = sine_long_1024;
fb->short_window[0] = sine_short_128;
fb->long_window[1] = kbd_long_1024;
fb->short_window[1] = kbd_short_128;
#ifdef LD_DEC
fb->ld_window[0] = sine_mid_512;
fb->ld_window[1] = ld_mid_512;
#endif
#ifdef ALLOW_SMALL_FRAMELENGTH
} else /* (frame_len == 960) */ {
fb->long_window[0] = sine_long_960;
fb->short_window[0] = sine_short_120;
fb->long_window[1] = kbd_long_960;
fb->short_window[1] = kbd_short_120;
#ifdef LD_DEC
fb->ld_window[0] = sine_mid_480;
fb->ld_window[1] = ld_mid_480;
#endif
}
#endif
return fb;
}
void filter_bank_end(fb_info *fb)
{
if (fb != NULL)
{
#ifdef PROFILE
printf("FB: %I64d cycles\n", fb->cycles);
#endif
faad_mdct_end(fb->mdct256);
faad_mdct_end(fb->mdct2048);
#ifdef LD_DEC
faad_mdct_end(fb->mdct1024);
#endif
faad_free(fb);
}
}
static INLINE void imdct_long(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
{
#ifdef LD_DEC
mdct_info *mdct = NULL;
switch (len)
{
case 2048:
case 1920:
mdct = fb->mdct2048;
break;
case 1024:
case 960:
mdct = fb->mdct1024;
break;
}
faad_imdct(mdct, in_data, out_data);
#else
faad_imdct(fb->mdct2048, in_data, out_data);
#endif
}
#ifdef LTP_DEC
static INLINE void mdct(fb_info *fb, real_t *in_data, real_t *out_data, uint16_t len)
{
mdct_info *mdct = NULL;
switch (len)
{
case 2048:
case 1920:
mdct = fb->mdct2048;
break;
case 256:
case 240:
mdct = fb->mdct256;
break;
#ifdef LD_DEC
case 1024:
case 960:
mdct = fb->mdct1024;
break;
#endif
}
faad_mdct(mdct, in_data, out_data);
}
#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)
{
int16_t i;
ALIGN real_t transf_buf[2*1024] = {0};
const real_t *window_long = NULL;
const real_t *window_long_prev = NULL;
const real_t *window_short = NULL;
const real_t *window_short_prev = NULL;
uint16_t nlong = frame_len;
uint16_t nshort = frame_len/8;
uint16_t trans = nshort/2;
uint16_t nflat_ls = (nlong-nshort)/2;
#ifdef PROFILE
int64_t count = faad_get_ts();
#endif
/* select windows of current frame and previous frame (Sine or KBD) */
#ifdef LD_DEC
if (object_type == LD)
{
window_long = fb->ld_window[window_shape];
window_long_prev = fb->ld_window[window_shape_prev];
} else {
#endif
window_long = fb->long_window[window_shape];
window_long_prev = fb->long_window[window_shape_prev];
window_short = fb->short_window[window_shape];
window_short_prev = fb->short_window[window_shape_prev];
#ifdef LD_DEC
}
#endif
#if 0
for (i = 0; i < 1024; i++)
{
printf("%d\n", freq_in[i]);
}
#endif
#if 0
printf("%d %d\n", window_sequence, window_shape);
#endif
switch (window_sequence)
{
case ONLY_LONG_SEQUENCE:
/* perform iMDCT */
imdct_long(fb, freq_in, transf_buf, 2*nlong);
/* add second half output of previous frame to windowed output of current frame */
for (i = 0; i < nlong; i+=4)
{
time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
}
/* window the second half and save as overlap for next frame */
for (i = 0; i < nlong; i+=4)
{
overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
overlap[i+1] = MUL_F(transf_buf[nlong+i+1],window_long[nlong-2-i]);
overlap[i+2] = MUL_F(transf_buf[nlong+i+2],window_long[nlong-3-i]);
overlap[i+3] = MUL_F(transf_buf[nlong+i+3],window_long[nlong-4-i]);
}
break;
case LONG_START_SEQUENCE:
/* perform iMDCT */
imdct_long(fb, freq_in, transf_buf, 2*nlong);
/* add second half output of previous frame to windowed output of current frame */
for (i = 0; i < nlong; i+=4)
{
time_out[i] = overlap[i] + MUL_F(transf_buf[i],window_long_prev[i]);
time_out[i+1] = overlap[i+1] + MUL_F(transf_buf[i+1],window_long_prev[i+1]);
time_out[i+2] = overlap[i+2] + MUL_F(transf_buf[i+2],window_long_prev[i+2]);
time_out[i+3] = overlap[i+3] + MUL_F(transf_buf[i+3],window_long_prev[i+3]);
}
/* window the second half and save as overlap for next frame */
/* construct second half window using padding with 1's and 0's */
for (i = 0; i < nflat_ls; i++)
overlap[i] = transf_buf[nlong+i];
for (i = 0; i < nshort; i++)
overlap[nflat_ls+i] = MUL_F(transf_buf[nlong+nflat_ls+i],window_short[nshort-i-1]);
for (i = 0; i < nflat_ls; i++)
overlap[nflat_ls+nshort+i] = 0;
break;
case EIGHT_SHORT_SEQUENCE:
/* perform iMDCT for each short block */
faad_imdct(fb->mdct256, freq_in+0*nshort, transf_buf+2*nshort*0);
faad_imdct(fb->mdct256, freq_in+1*nshort, transf_buf+2*nshort*1);
faad_imdct(fb->mdct256, freq_in+2*nshort, transf_buf+2*nshort*2);
faad_imdct(fb->mdct256, freq_in+3*nshort, transf_buf+2*nshort*3);
faad_imdct(fb->mdct256, freq_in+4*nshort, transf_buf+2*nshort*4);
faad_imdct(fb->mdct256, freq_in+5*nshort, transf_buf+2*nshort*5);
faad_imdct(fb->mdct256, freq_in+6*nshort, transf_buf+2*nshort*6);
faad_imdct(fb->mdct256, freq_in+7*nshort, transf_buf+2*nshort*7);
/* add second half output of previous frame to windowed output of current frame */
for (i = 0; i < nflat_ls; i++)
time_out[i] = overlap[i];
for(i = 0; i < nshort; i++)
{
time_out[nflat_ls+ i] = overlap[nflat_ls+ i] + MUL_F(transf_buf[nshort*0+i],window_short_prev[i]);
time_out[nflat_ls+1*nshort+i] = overlap[nflat_ls+nshort*1+i] + MUL_F(transf_buf[nshort*1+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*2+i],window_short[i]);
time_out[nflat_ls+2*nshort+i] = overlap[nflat_ls+nshort*2+i] + MUL_F(transf_buf[nshort*3+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*4+i],window_short[i]);
time_out[nflat_ls+3*nshort+i] = overlap[nflat_ls+nshort*3+i] + MUL_F(transf_buf[nshort*5+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*6+i],window_short[i]);
if (i < trans)
time_out[nflat_ls+4*nshort+i] = overlap[nflat_ls+nshort*4+i] + MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
}
/* window the second half and save as overlap for next frame */
for(i = 0; i < nshort; i++)
{
if (i >= trans)
overlap[nflat_ls+4*nshort+i-nlong] = MUL_F(transf_buf[nshort*7+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*8+i],window_short[i]);
overlap[nflat_ls+5*nshort+i-nlong] = MUL_F(transf_buf[nshort*9+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*10+i],window_short[i]);
overlap[nflat_ls+6*nshort+i-nlong] = MUL_F(transf_buf[nshort*11+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*12+i],window_short[i]);
overlap[nflat_ls+7*nshort+i-nlong] = MUL_F(transf_buf[nshort*13+i],window_short[nshort-1-i]) + MUL_F(transf_buf[nshort*14+i],window_short[i]);
overlap[nflat_ls+8*nshort+i-nlong] = MUL_F(transf_buf[nshort*15+i],window_short[nshort-1-i]);
}
for (i = 0; i < nflat_ls; i++)
overlap[nflat_ls+nshort+i] = 0;
break;
case LONG_STOP_SEQUENCE:
/* perform iMDCT */
imdct_long(fb, freq_in, transf_buf, 2*nlong);
/* add second half output of previous frame to windowed output of current frame */
/* construct first half window using padding with 1's and 0's */
for (i = 0; i < nflat_ls; i++)
time_out[i] = overlap[i];
for (i = 0; i < nshort; i++)
time_out[nflat_ls+i] = overlap[nflat_ls+i] + MUL_F(transf_buf[nflat_ls+i],window_short_prev[i]);
for (i = 0; i < nflat_ls; i++)
time_out[nflat_ls+nshort+i] = overlap[nflat_ls+nshort+i] + transf_buf[nflat_ls+nshort+i];
/* window the second half and save as overlap for next frame */
for (i = 0; i < nlong; i++)
overlap[i] = MUL_F(transf_buf[nlong+i],window_long[nlong-1-i]);
break;
}
#if 0
for (i = 0; i < 1024; i++)
{
printf("%d\n", time_out[i]);
//printf("0x%.8X\n", time_out[i]);
}
#endif
#ifdef PROFILE
count = faad_get_ts() - count;
fb->cycles += count;
#endif
}
#ifdef LTP_DEC
/* only works for LTP -> no overlapping, no short blocks */
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)
{
int16_t i;
ALIGN real_t windowed_buf[2*1024] = {0};
const real_t *window_long = NULL;
const real_t *window_long_prev = NULL;
const real_t *window_short = NULL;
const real_t *window_short_prev = NULL;
uint16_t nlong = frame_len;
uint16_t nshort = frame_len/8;
uint16_t nflat_ls = (nlong-nshort)/2;
assert(window_sequence != EIGHT_SHORT_SEQUENCE);
#ifdef LD_DEC
if (object_type == LD)
{
window_long = fb->ld_window[window_shape];
window_long_prev = fb->ld_window[window_shape_prev];
} else {
#endif
window_long = fb->long_window[window_shape];
window_long_prev = fb->long_window[window_shape_prev];
window_short = fb->short_window[window_shape];
window_short_prev = fb->short_window[window_shape_prev];
#ifdef LD_DEC
}
#endif
switch(window_sequence)
{
case ONLY_LONG_SEQUENCE:
for (i = nlong-1; i >= 0; i--)
{
windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
}
mdct(fb, windowed_buf, out_mdct, 2*nlong);
break;
case LONG_START_SEQUENCE:
for (i = 0; i < nlong; i++)
windowed_buf[i] = MUL_F(in_data[i], window_long_prev[i]);
for (i = 0; i < nflat_ls; i++)
windowed_buf[i+nlong] = in_data[i+nlong];
for (i = 0; i < nshort; i++)
windowed_buf[i+nlong+nflat_ls] = MUL_F(in_data[i+nlong+nflat_ls], window_short[nshort-1-i]);
for (i = 0; i < nflat_ls; i++)
windowed_buf[i+nlong+nflat_ls+nshort] = 0;
mdct(fb, windowed_buf, out_mdct, 2*nlong);
break;
case LONG_STOP_SEQUENCE:
for (i = 0; i < nflat_ls; i++)
windowed_buf[i] = 0;
for (i = 0; i < nshort; i++)
windowed_buf[i+nflat_ls] = MUL_F(in_data[i+nflat_ls], window_short_prev[i]);
for (i = 0; i < nflat_ls; i++)
windowed_buf[i+nflat_ls+nshort] = in_data[i+nflat_ls+nshort];
for (i = 0; i < nlong; i++)
windowed_buf[i+nlong] = MUL_F(in_data[i+nlong], window_long[nlong-1-i]);
mdct(fb, windowed_buf, out_mdct, 2*nlong);
break;
}
}
#endif

View File

@ -1,61 +0,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: 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

View File

@ -1,287 +0,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: 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

View File

@ -1,432 +0,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: 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

View File

@ -1,559 +0,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: huffman.c,v 1.26 2007/11/01 12:33:30 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include <stdlib.h>
#ifdef ANALYSIS
#include <stdio.h>
#endif
#include "bits.h"
#include "huffman.h"
#include "codebook/hcb.h"
/* static function declarations */
static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len);
static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp);
static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp);
static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp);
static int16_t huffman_codebook(uint8_t i);
static void vcb11_check_LAV(uint8_t cb, int16_t *sp);
int8_t huffman_scale_factor(bitfile *ld)
{
uint16_t offset = 0;
while (hcb_sf[offset][1])
{
uint8_t b = faad_get1bit(ld
DEBUGVAR(1,255,"huffman_scale_factor()"));
offset += hcb_sf[offset][b];
if (offset > 240)
{
/* printf("ERROR: offset into hcb_sf = %d >240!\n", offset); */
return -1;
}
}
return hcb_sf[offset][0];
}
hcb *hcb_table[] = {
0, hcb1_1, hcb2_1, 0, hcb4_1, 0, hcb6_1, 0, hcb8_1, 0, hcb10_1, hcb11_1
};
hcb_2_quad *hcb_2_quad_table[] = {
0, hcb1_2, hcb2_2, 0, hcb4_2, 0, 0, 0, 0, 0, 0, 0
};
hcb_2_pair *hcb_2_pair_table[] = {
0, 0, 0, 0, 0, 0, hcb6_2, 0, hcb8_2, 0, hcb10_2, hcb11_2
};
hcb_bin_pair *hcb_bin_table[] = {
0, 0, 0, 0, 0, hcb5, 0, hcb7, 0, hcb9, 0, 0
};
uint8_t hcbN[] = { 0, 5, 5, 0, 5, 0, 5, 0, 5, 0, 6, 5 };
/* defines whether a huffman codebook is unsigned or not */
/* Table 4.6.2 */
uint8_t unsigned_cb[] = { 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0,
/* codebook 16 to 31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
};
int hcb_2_quad_table_size[] = { 0, 114, 86, 0, 185, 0, 0, 0, 0, 0, 0, 0 };
int hcb_2_pair_table_size[] = { 0, 0, 0, 0, 0, 0, 126, 0, 83, 0, 210, 373 };
int hcb_bin_table_size[] = { 0, 0, 0, 161, 0, 161, 0, 127, 0, 337, 0, 0 };
static INLINE void huffman_sign_bits(bitfile *ld, int16_t *sp, uint8_t len)
{
uint8_t i;
for (i = 0; i < len; i++)
{
if(sp[i])
{
if(faad_get1bit(ld
DEBUGVAR(1,5,"huffman_sign_bits(): sign bit")) & 1)
{
sp[i] = -sp[i];
}
}
}
}
static INLINE int16_t huffman_getescape(bitfile *ld, int16_t sp)
{
uint8_t neg, i;
int16_t j;
int16_t off;
if (sp < 0)
{
if (sp != -16)
return sp;
neg = 1;
} else {
if (sp != 16)
return sp;
neg = 0;
}
for (i = 4; ; i++)
{
if (faad_get1bit(ld
DEBUGVAR(1,6,"huffman_getescape(): escape size")) == 0)
{
break;
}
}
off = (int16_t)faad_getbits(ld, i
DEBUGVAR(1,9,"huffman_getescape(): escape"));
j = off | (1<<i);
if (neg)
j = -j;
return j;
}
static uint8_t huffman_2step_quad(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint32_t cw;
uint16_t offset = 0;
uint8_t extra_bits;
cw = faad_showbits(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
faad_flushbits(ld, hcbN[cb]);
offset += (uint16_t)faad_showbits(ld, extra_bits);
faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]);
} else {
faad_flushbits(ld, hcb_2_quad_table[cb][offset].bits);
}
if (offset > hcb_2_quad_table_size[cb])
{
/* printf("ERROR: offset into hcb_2_quad_table = %d >%d!\n", offset,
hcb_2_quad_table_size[cb]); */
return 10;
}
sp[0] = hcb_2_quad_table[cb][offset].x;
sp[1] = hcb_2_quad_table[cb][offset].y;
sp[2] = hcb_2_quad_table[cb][offset].v;
sp[3] = hcb_2_quad_table[cb][offset].w;
return 0;
}
static uint8_t huffman_2step_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_2step_quad(cb, ld, sp);
huffman_sign_bits(ld, sp, QUAD_LEN);
return err;
}
static uint8_t huffman_2step_pair(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint32_t cw;
uint16_t offset = 0;
uint8_t extra_bits;
cw = faad_showbits(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
faad_flushbits(ld, hcbN[cb]);
offset += (uint16_t)faad_showbits(ld, extra_bits);
faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]);
} else {
faad_flushbits(ld, hcb_2_pair_table[cb][offset].bits);
}
if (offset > hcb_2_pair_table_size[cb])
{
/* printf("ERROR: offset into hcb_2_pair_table = %d >%d!\n", offset,
hcb_2_pair_table_size[cb]); */
return 10;
}
sp[0] = hcb_2_pair_table[cb][offset].x;
sp[1] = hcb_2_pair_table[cb][offset].y;
return 0;
}
static uint8_t huffman_2step_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_2step_pair(cb, ld, sp);
huffman_sign_bits(ld, sp, PAIR_LEN);
return err;
}
static uint8_t huffman_binary_quad(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint16_t offset = 0;
while (!hcb3[offset].is_leaf)
{
uint8_t b = faad_get1bit(ld
DEBUGVAR(1,255,"huffman_spectral_data():3"));
offset += hcb3[offset].data[b];
}
if (offset > hcb_bin_table_size[cb])
{
/* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
hcb_bin_table_size[cb]); */
return 10;
}
sp[0] = hcb3[offset].data[0];
sp[1] = hcb3[offset].data[1];
sp[2] = hcb3[offset].data[2];
sp[3] = hcb3[offset].data[3];
return 0;
}
static uint8_t huffman_binary_quad_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_binary_quad(cb, ld, sp);
huffman_sign_bits(ld, sp, QUAD_LEN);
return err;
}
static uint8_t huffman_binary_pair(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint16_t offset = 0;
while (!hcb_bin_table[cb][offset].is_leaf)
{
uint8_t b = faad_get1bit(ld
DEBUGVAR(1,255,"huffman_spectral_data():9"));
offset += hcb_bin_table[cb][offset].data[b];
}
if (offset > hcb_bin_table_size[cb])
{
/* printf("ERROR: offset into hcb_bin_table = %d >%d!\n", offset,
hcb_bin_table_size[cb]); */
return 10;
}
sp[0] = hcb_bin_table[cb][offset].data[0];
sp[1] = hcb_bin_table[cb][offset].data[1];
return 0;
}
static uint8_t huffman_binary_pair_sign(uint8_t cb, bitfile *ld, int16_t *sp)
{
uint8_t err = huffman_binary_pair(cb, ld, sp);
huffman_sign_bits(ld, sp, PAIR_LEN);
return err;
}
static int16_t huffman_codebook(uint8_t i)
{
static const uint32_t data = 16428320;
if (i == 0) return (int16_t)(data >> 16) & 0xFFFF;
else return (int16_t)data & 0xFFFF;
}
static void vcb11_check_LAV(uint8_t cb, int16_t *sp)
{
static const uint16_t vcb11_LAV_tab[] = {
16, 31, 47, 63, 95, 127, 159, 191, 223,
255, 319, 383, 511, 767, 1023, 2047
};
uint16_t max = 0;
if (cb < 16 || cb > 31)
return;
max = vcb11_LAV_tab[cb - 16];
if ((abs(sp[0]) > max) || (abs(sp[1]) > max))
{
sp[0] = 0;
sp[1] = 0;
}
}
uint8_t huffman_spectral_data(uint8_t cb, bitfile *ld, int16_t *sp)
{
switch (cb)
{
case 1: /* 2-step method for data quadruples */
case 2:
return huffman_2step_quad(cb, ld, sp);
case 3: /* binary search for data quadruples */
return huffman_binary_quad_sign(cb, ld, sp);
case 4: /* 2-step method for data quadruples */
return huffman_2step_quad_sign(cb, ld, sp);
case 5: /* binary search for data pairs */
return huffman_binary_pair(cb, ld, sp);
case 6: /* 2-step method for data pairs */
return huffman_2step_pair(cb, ld, sp);
case 7: /* binary search for data pairs */
case 9:
return huffman_binary_pair_sign(cb, ld, sp);
case 8: /* 2-step method for data pairs */
case 10:
return huffman_2step_pair_sign(cb, ld, sp);
case 12: {
uint8_t err = huffman_2step_pair(11, ld, sp);
sp[0] = huffman_codebook(0); sp[1] = huffman_codebook(1);
return err; }
case 11:
{
uint8_t err = huffman_2step_pair_sign(11, ld, sp);
sp[0] = huffman_getescape(ld, sp[0]);
sp[1] = huffman_getescape(ld, sp[1]);
return err;
}
#ifdef ERROR_RESILIENCE
/* VCB11 uses codebook 11 */
case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
{
uint8_t err = huffman_2step_pair_sign(11, ld, sp);
sp[0] = huffman_getescape(ld, sp[0]);
sp[1] = huffman_getescape(ld, sp[1]);
/* check LAV (Largest Absolute Value) */
/* this finds errors in the ESCAPE signal */
vcb11_check_LAV(cb, sp);
return err;
}
#endif
default:
/* Non existent codebook number, something went wrong */
return 11;
}
return 0;
}
#ifdef ERROR_RESILIENCE
/* Special version of huffman_spectral_data
Will not read from a bitfile but a bits_t structure.
Will keep track of the bits decoded and return the number of bits remaining.
Do not read more than ld->len, return -1 if codeword would be longer */
int8_t huffman_spectral_data_2(uint8_t cb, bits_t *ld, int16_t *sp)
{
uint32_t cw;
uint16_t offset = 0;
uint8_t extra_bits;
uint8_t i, vcb11 = 0;
switch (cb)
{
case 1: /* 2-step method for data quadruples */
case 2:
case 4:
cw = showbits_hcr(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
if ( flushbits_hcr(ld, hcbN[cb]) ) return -1;
offset += (uint16_t)showbits_hcr(ld, extra_bits);
if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits - hcbN[cb]) ) return -1;
} else {
if ( flushbits_hcr(ld, hcb_2_quad_table[cb][offset].bits) ) return -1;
}
sp[0] = hcb_2_quad_table[cb][offset].x;
sp[1] = hcb_2_quad_table[cb][offset].y;
sp[2] = hcb_2_quad_table[cb][offset].v;
sp[3] = hcb_2_quad_table[cb][offset].w;
break;
case 6: /* 2-step method for data pairs */
case 8:
case 10:
case 11:
/* VCB11 uses codebook 11 */
case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23:
case 24: case 25: case 26: case 27: case 28: case 29: case 30: case 31:
if (cb >= 16)
{
/* store the virtual codebook */
vcb11 = cb;
cb = 11;
}
cw = showbits_hcr(ld, hcbN[cb]);
offset = hcb_table[cb][cw].offset;
extra_bits = hcb_table[cb][cw].extra_bits;
if (extra_bits)
{
/* we know for sure it's more than hcbN[cb] bits long */
if ( flushbits_hcr(ld, hcbN[cb]) ) return -1;
offset += (uint16_t)showbits_hcr(ld, extra_bits);
if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits - hcbN[cb]) ) return -1;
} else {
if ( flushbits_hcr(ld, hcb_2_pair_table[cb][offset].bits) ) return -1;
}
sp[0] = hcb_2_pair_table[cb][offset].x;
sp[1] = hcb_2_pair_table[cb][offset].y;
break;
case 3: /* binary search for data quadruples */
while (!hcb3[offset].is_leaf)
{
uint8_t b;
if ( get1bit_hcr(ld, &b) ) return -1;
offset += hcb3[offset].data[b];
}
sp[0] = hcb3[offset].data[0];
sp[1] = hcb3[offset].data[1];
sp[2] = hcb3[offset].data[2];
sp[3] = hcb3[offset].data[3];
break;
case 5: /* binary search for data pairs */
case 7:
case 9:
while (!hcb_bin_table[cb][offset].is_leaf)
{
uint8_t b;
if (get1bit_hcr(ld, &b) ) return -1;
offset += hcb_bin_table[cb][offset].data[b];
}
sp[0] = hcb_bin_table[cb][offset].data[0];
sp[1] = hcb_bin_table[cb][offset].data[1];
break;
}
/* decode sign bits */
if (unsigned_cb[cb])
{
for(i = 0; i < ((cb < FIRST_PAIR_HCB) ? QUAD_LEN : PAIR_LEN); i++)
{
if(sp[i])
{
uint8_t b;
if ( get1bit_hcr(ld, &b) ) return -1;
if (b != 0) {
sp[i] = -sp[i];
}
}
}
}
/* decode huffman escape bits */
if ((cb == ESC_HCB) || (cb >= 16))
{
uint8_t k;
for (k = 0; k < 2; k++)
{
if ((sp[k] == 16) || (sp[k] == -16))
{
uint8_t neg, i;
int32_t j;
uint32_t off;
neg = (sp[k] < 0) ? 1 : 0;
for (i = 4; ; i++)
{
uint8_t b;
if (get1bit_hcr(ld, &b))
return -1;
if (b == 0)
break;
}
if (getbits_hcr(ld, i, &off))
return -1;
j = off + (1<<i);
sp[k] = (int16_t)((neg) ? -j : j);
}
}
if (vcb11 != 0)
{
/* check LAV (Largest Absolute Value) */
/* this finds errors in the ESCAPE signal */
vcb11_check_LAV(vcb11, sp);
}
}
return ld->len;
}
#endif

View File

@ -1,47 +0,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: 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

View File

@ -1,271 +0,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: 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

View File

@ -1,252 +0,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: 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

File diff suppressed because it is too large Load Diff

View File

@ -1,109 +0,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: 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++;
}
}
}

View File

@ -1,67 +0,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: 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

File diff suppressed because it is too large Load Diff

View File

@ -1,215 +0,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: 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

View File

@ -1,66 +0,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: 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

View File

@ -1,301 +0,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: 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

View File

@ -1,48 +0,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: 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

View File

@ -1,309 +0,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: 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;
}

View File

@ -1,52 +0,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: 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

View File

@ -1,77 +0,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: 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++;
}
}
}
}

View File

@ -1,44 +0,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: 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

@ -1,258 +0,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: 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

View File

@ -1,559 +0,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: output.c,v 1.47 2009/01/26 23:51:15 menno Exp $
**/
#include "common.h"
#include "structs.h"
#include "output.h"
#ifndef FIXED_POINT
#define FLOAT_SCALE (1.0f/(1<<15))
#define DM_MUL REAL_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2))
#define RSQRT2 REAL_CONST(0.7071067811865475244) // 1/sqrt(2)
static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
uint8_t down_matrix, uint8_t *internal_channel)
{
if (!down_matrix)
return input[internal_channel[channel]][sample];
if (channel == 0)
{
return DM_MUL * (input[internal_channel[1]][sample] +
input[internal_channel[0]][sample] * RSQRT2 +
input[internal_channel[3]][sample] * RSQRT2);
} else {
return DM_MUL * (input[internal_channel[2]][sample] +
input[internal_channel[0]][sample] * RSQRT2 +
input[internal_channel[4]][sample] * RSQRT2);
}
}
#ifndef HAS_LRINTF
#define CLIP(sample, max, min) \
if (sample >= 0.0f) \
{ \
sample += 0.5f; \
if (sample >= max) \
sample = max; \
} else { \
sample += -0.5f; \
if (sample <= min) \
sample = min; \
}
#else
#define CLIP(sample, max, min) \
if (sample >= 0.0f) \
{ \
if (sample >= max) \
sample = max; \
} else { \
if (sample <= min) \
sample = min; \
}
#endif
#define CONV(a,b) ((a<<1)|(b&0x1))
static void to_PCM_16bit(NeAACDecStruct *hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
int16_t **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
CLIP(inp, 32767.0f, -32768.0f);
(*sample_buffer)[i] = (int16_t)lrintf(inp);
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
CLIP(inp0, 32767.0f, -32768.0f);
(*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp0);
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
CLIP(inp0, 32767.0f, -32768.0f);
CLIP(inp1, 32767.0f, -32768.0f);
(*sample_buffer)[(i*2)+0] = (int16_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int16_t)lrintf(inp1);
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
CLIP(inp, 32767.0f, -32768.0f);
(*sample_buffer)[(i*channels)+ch] = (int16_t)lrintf(inp);
}
}
break;
}
}
static void to_PCM_24bit(NeAACDecStruct *hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
int32_t **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
inp *= 256.0f;
CLIP(inp, 8388607.0f, -8388608.0f);
(*sample_buffer)[i] = (int32_t)lrintf(inp);
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
inp0 *= 256.0f;
CLIP(inp0, 8388607.0f, -8388608.0f);
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
inp0 *= 256.0f;
inp1 *= 256.0f;
CLIP(inp0, 8388607.0f, -8388608.0f);
CLIP(inp1, 8388607.0f, -8388608.0f);
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
inp *= 256.0f;
CLIP(inp, 8388607.0f, -8388608.0f);
(*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
}
}
break;
}
}
static void to_PCM_32bit(NeAACDecStruct *hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
int32_t **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
inp *= 65536.0f;
CLIP(inp, 2147483647.0f, -2147483648.0f);
(*sample_buffer)[i] = (int32_t)lrintf(inp);
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
inp0 *= 65536.0f;
CLIP(inp0, 2147483647.0f, -2147483648.0f);
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp0);
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
inp0 *= 65536.0f;
inp1 *= 65536.0f;
CLIP(inp0, 2147483647.0f, -2147483648.0f);
CLIP(inp1, 2147483647.0f, -2147483648.0f);
(*sample_buffer)[(i*2)+0] = (int32_t)lrintf(inp0);
(*sample_buffer)[(i*2)+1] = (int32_t)lrintf(inp1);
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
inp *= 65536.0f;
CLIP(inp, 2147483647.0f, -2147483648.0f);
(*sample_buffer)[(i*channels)+ch] = (int32_t)lrintf(inp);
}
}
break;
}
}
static void to_PCM_float(NeAACDecStruct *hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
float32_t **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
(*sample_buffer)[i] = inp*FLOAT_SCALE;
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
(*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
(*sample_buffer)[(i*2)+1] = inp0*FLOAT_SCALE;
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
(*sample_buffer)[(i*2)+0] = inp0*FLOAT_SCALE;
(*sample_buffer)[(i*2)+1] = inp1*FLOAT_SCALE;
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
(*sample_buffer)[(i*channels)+ch] = inp*FLOAT_SCALE;
}
}
break;
}
}
static void to_PCM_double(NeAACDecStruct *hDecoder, real_t **input,
uint8_t channels, uint16_t frame_len,
double **sample_buffer)
{
uint8_t ch, ch1;
uint16_t i;
switch (CONV(channels,hDecoder->downMatrix))
{
case CONV(1,0):
case CONV(1,1):
for(i = 0; i < frame_len; i++)
{
real_t inp = input[hDecoder->internal_channel[0]][i];
(*sample_buffer)[i] = (double)inp*FLOAT_SCALE;
}
break;
case CONV(2,0):
if (hDecoder->upMatrix)
{
ch = hDecoder->internal_channel[0];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch][i];
(*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
(*sample_buffer)[(i*2)+1] = (double)inp0*FLOAT_SCALE;
}
} else {
ch = hDecoder->internal_channel[0];
ch1 = hDecoder->internal_channel[1];
for(i = 0; i < frame_len; i++)
{
real_t inp0 = input[ch ][i];
real_t inp1 = input[ch1][i];
(*sample_buffer)[(i*2)+0] = (double)inp0*FLOAT_SCALE;
(*sample_buffer)[(i*2)+1] = (double)inp1*FLOAT_SCALE;
}
}
break;
default:
for (ch = 0; ch < channels; ch++)
{
for(i = 0; i < frame_len; i++)
{
real_t inp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->internal_channel);
(*sample_buffer)[(i*channels)+ch] = (double)inp*FLOAT_SCALE;
}
}
break;
}
}
void *output_to_PCM(NeAACDecStruct *hDecoder,
real_t **input, void *sample_buffer, uint8_t channels,
uint16_t frame_len, uint8_t format)
{
int16_t *short_sample_buffer = (int16_t*)sample_buffer;
int32_t *int_sample_buffer = (int32_t*)sample_buffer;
float32_t *float_sample_buffer = (float32_t*)sample_buffer;
double *double_sample_buffer = (double*)sample_buffer;
#ifdef PROFILE
int64_t count = faad_get_ts();
#endif
/* Copy output to a standard PCM buffer */
switch (format)
{
case FAAD_FMT_16BIT:
to_PCM_16bit(hDecoder, input, channels, frame_len, &short_sample_buffer);
break;
case FAAD_FMT_24BIT:
to_PCM_24bit(hDecoder, input, channels, frame_len, &int_sample_buffer);
break;
case FAAD_FMT_32BIT:
to_PCM_32bit(hDecoder, input, channels, frame_len, &int_sample_buffer);
break;
case FAAD_FMT_FLOAT:
to_PCM_float(hDecoder, input, channels, frame_len, &float_sample_buffer);
break;
case FAAD_FMT_DOUBLE:
to_PCM_double(hDecoder, input, channels, frame_len, &double_sample_buffer);
break;
}
#ifdef PROFILE
count = faad_get_ts() - count;
hDecoder->output_cycles += count;
#endif
return sample_buffer;
}
#else
#define DM_MUL FRAC_CONST(0.3203772410170407) // 1/(1+sqrt(2) + 1/sqrt(2))
#define RSQRT2 FRAC_CONST(0.7071067811865475244) // 1/sqrt(2)
static INLINE real_t get_sample(real_t **input, uint8_t channel, uint16_t sample,
uint8_t down_matrix, uint8_t up_matrix,
uint8_t *internal_channel)
{
if (up_matrix == 1)
return input[internal_channel[0]][sample];
if (!down_matrix)
return input[internal_channel[channel]][sample];
if (channel == 0)
{
real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2);
real_t L_S = MUL_F(input[internal_channel[3]][sample], RSQRT2);
real_t cum = input[internal_channel[1]][sample] + C + L_S;
return MUL_F(cum, DM_MUL);
} else {
real_t C = MUL_F(input[internal_channel[0]][sample], RSQRT2);
real_t R_S = MUL_F(input[internal_channel[4]][sample], RSQRT2);
real_t cum = input[internal_channel[2]][sample] + C + R_S;
return MUL_F(cum, DM_MUL);
}
}
void* output_to_PCM(NeAACDecStruct *hDecoder,
real_t **input, void *sample_buffer, uint8_t channels,
uint16_t frame_len, uint8_t format)
{
uint8_t ch;
uint16_t i;
int16_t *short_sample_buffer = (int16_t*)sample_buffer;
int32_t *int_sample_buffer = (int32_t*)sample_buffer;
/* Copy output to a standard PCM buffer */
for (ch = 0; ch < channels; ch++)
{
switch (format)
{
case FAAD_FMT_16BIT:
for(i = 0; i < frame_len; i++)
{
int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
hDecoder->internal_channel);
if (tmp >= 0)
{
tmp += (1 << (REAL_BITS-1));
if (tmp >= REAL_CONST(32767))
{
tmp = REAL_CONST(32767);
}
} else {
tmp += -(1 << (REAL_BITS-1));
if (tmp <= REAL_CONST(-32768))
{
tmp = REAL_CONST(-32768);
}
}
tmp >>= REAL_BITS;
short_sample_buffer[(i*channels)+ch] = (int16_t)tmp;
}
break;
case FAAD_FMT_24BIT:
for(i = 0; i < frame_len; i++)
{
int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
hDecoder->internal_channel);
if (tmp >= 0)
{
tmp += (1 << (REAL_BITS-9));
tmp >>= (REAL_BITS-8);
if (tmp >= 8388607)
{
tmp = 8388607;
}
} else {
tmp += -(1 << (REAL_BITS-9));
tmp >>= (REAL_BITS-8);
if (tmp <= -8388608)
{
tmp = -8388608;
}
}
int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
}
break;
case FAAD_FMT_32BIT:
for(i = 0; i < frame_len; i++)
{
int32_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
hDecoder->internal_channel);
if (tmp >= 0)
{
tmp += (1 << (16-REAL_BITS-1));
tmp <<= (16-REAL_BITS);
} else {
tmp += -(1 << (16-REAL_BITS-1));
tmp <<= (16-REAL_BITS);
}
int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
}
break;
case FAAD_FMT_FIXED:
for(i = 0; i < frame_len; i++)
{
real_t tmp = get_sample(input, ch, i, hDecoder->downMatrix, hDecoder->upMatrix,
hDecoder->internal_channel);
int_sample_buffer[(i*channels)+ch] = (int32_t)tmp;
}
break;
}
}
return sample_buffer;
}
#endif

View File

@ -1,48 +0,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: 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

View File

@ -1,271 +0,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: 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 */
}

View File

@ -1,57 +0,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: 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

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