Commit 1b674a6a by ziyue

播放器新增支持音频:#945

parent 66f28f52
......@@ -71,9 +71,9 @@ if(ENABLE_HLS)
aux_source_directory(${MediaServer_Root}/libmpeg/source src_mpeg)
include_directories(${MediaServer_Root}/libmpeg/include)
add_library(mpeg STATIC ${src_mpeg})
if(WIN32)
if(MSVC)
set_target_properties(mpeg PROPERTIES COMPILE_FLAGS ${VS_FALGS} )
endif(WIN32)
endif()
endif()
if(ENABLE_MP4)
......@@ -85,9 +85,9 @@ if(ENABLE_MP4)
include_directories(${MediaServer_Root}/libflv/include)
add_library(mov STATIC ${src_mov})
add_library(flv STATIC ${src_flv})
if(WIN32)
if(MSVC)
set_target_properties(mov flv PROPERTIES COMPILE_FLAGS ${VS_FALGS} )
endif(WIN32)
endif()
endif()
......
......@@ -56,6 +56,7 @@ option(ENABLE_SERVER "Enable Server" true)
option(ENABLE_MEM_DEBUG "Enable Memory Debug" false)
option(ENABLE_ASAN "Enable Address Sanitize" false)
option(ENABLE_WEBRTC "Enable WebRTC" false)
option(ENABLE_PLAYER "Enable Player" true)
# 添加git版本信息
set(COMMIT_HASH "Git_NotFound_Unkown_commit")
......@@ -174,9 +175,9 @@ if (ENABLE_HLS)
list(APPEND LINK_LIB_LIST mpeg)
list(APPEND CXX_API_TARGETS mpeg)
if (WIN32)
if (MSVC)
set_target_properties(mpeg PROPERTIES COMPILE_FLAGS ${VS_FALGS})
endif (WIN32)
endif ()
endif ()
#添加mov、flv库用于MP4录制
......@@ -198,9 +199,9 @@ if (ENABLE_MP4)
list(APPEND LINK_LIB_LIST mov flv)
list(APPEND CXX_API_TARGETS mov flv)
if (WIN32)
if (MSVC)
set_target_properties(mov flv PROPERTIES COMPILE_FLAGS ${VS_FALGS})
endif (WIN32)
endif ()
endif ()
#添加rtp库用于rtp转ps/ts
......@@ -249,8 +250,10 @@ endif ()
if (WIN32)
list(APPEND LINK_LIB_LIST WS2_32 Iphlpapi shlwapi)
set_target_properties(zltoolkit PROPERTIES COMPILE_FLAGS ${VS_FALGS})
set_target_properties(zlmediakit PROPERTIES COMPILE_FLAGS ${VS_FALGS})
if (MSVC)
set_target_properties(zltoolkit PROPERTIES COMPILE_FLAGS ${VS_FALGS})
set_target_properties(zlmediakit PROPERTIES COMPILE_FLAGS ${VS_FALGS})
endif ()
elseif (NOT ANDROID OR IOS)
list(APPEND LINK_LIB_LIST pthread)
endif ()
......@@ -291,4 +294,9 @@ if (NOT IOS)
if (ENABLE_SERVER)
add_subdirectory(server)
endif ()
#播放器
if (ENABLE_PLAYER)
add_subdirectory(player)
endif ()
endif ()
......@@ -5,9 +5,9 @@ foreach(TEST_SRC ${TEST_SRC_LIST})
set(exe_name api_tester_${TEST_EXE_NAME})
add_executable(${exe_name} ${TEST_SRC})
if(WIN32)
if(MSVC)
set_target_properties(${exe_name} PROPERTIES COMPILE_FLAGS ${VS_FALGS} )
endif(WIN32)
endif()
target_link_libraries(${exe_name} mk_api)
endforeach()
......
find_path(SWRESAMPLE_INCLUDE_DIR
NAMES libswresample/swresample.h)
find_library(SWRESAMPLE_LIBRARY
NAMES swresample)
set(SWRESAMPLE_LIBRARIES ${SWRESAMPLE_LIBRARY})
set(SWRESAMPLE_INCLUDE_DIRS ${SWRESAMPLE_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SWRESAMPLE DEFAULT_MSG SWRESAMPLE_LIBRARY SWRESAMPLE_INCLUDE_DIR)
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#include "Util/logger.h"
#include "AudioSRC.h"
#include "SDLAudioDevice.h"
using namespace std;
using namespace toolkit;
AudioSRC::AudioSRC(AudioSRCDelegate *del) {
_delegate = del;
}
AudioSRC::~AudioSRC() {}
void AudioSRC::setOutputAudioConfig(const SDL_AudioSpec &cfg) {
int freq = _delegate->getPCMSampleRate();
int format = _delegate->getPCMFormat();
int channels = _delegate->getPCMChannel();
if (-1 == SDL_BuildAudioCVT(&_audio_cvt, format, channels, freq, cfg.format, cfg.channels, cfg.freq)) {
throw std::runtime_error("the format conversion is not supported");
}
InfoL << "audio cvt origin format, freq:" << freq << ", format:" << hex << format << dec << ", channels:" << channels;
InfoL << "audio cvt info, "
<< "needed:" << _audio_cvt.needed
<< ", src_format:" << hex << _audio_cvt.src_format
<< ", dst_format:" << _audio_cvt.dst_format << dec
<< ", rate_incr:" << _audio_cvt.rate_incr
<< ", len_mult:" << _audio_cvt.len_mult
<< ", len_ratio:" << _audio_cvt.len_ratio;
}
void AudioSRC::setEnableMix(bool flag) {
_enabled = flag;
}
int AudioSRC::getPCMData(char *buf, int size) {
if (!_enabled) {
return 0;
}
if (!_audio_cvt.needed) {
//获取原始数据,不需要频率转换
return _delegate->getPCMData(buf, size);
}
if ((int)(size / _audio_cvt.len_ratio) != _origin_size) {
_origin_size = size / _audio_cvt.len_ratio;
_origin_buf.reset(new char[std::max(_origin_size, size)], [](char *ptr) {
delete[] ptr;
});
InfoL << "origin pcm buffer size is:" << _origin_size << ", target pcm buffer size is:" << size;
}
auto origin_size = _delegate->getPCMData(_origin_buf.get(), _origin_size);
if (!origin_size) {
//获取数据失败
TraceL << "get empty pcm data";
return 0;
}
_audio_cvt.buf = (Uint8 *) _origin_buf.get();
_audio_cvt.len = origin_size;
if (0 != SDL_ConvertAudio(&_audio_cvt)) {
WarnL << "SDL_ConvertAudio failed!";
_audio_cvt.len_cvt = 0;
}
if (_audio_cvt.len_cvt) {
_target_buf.append(_origin_buf.get(), _audio_cvt.len_cvt);
}
if (_target_buf.size() < size) {
return 0;
}
memcpy(buf, _target_buf.data(), size);
_target_buf.erase(0, size);
return size;
}
////////////////////////////////////////////////////////////////////////
AudioPlayer::AudioPlayer() : AudioSRC(this) {
_device = SDLAudioDevice::Instance().shared_from_this();
}
AudioPlayer::~AudioPlayer() {
_device->delChannel(this);
}
void AudioPlayer::setup(int sample_rate, int channel, SDL_AudioFormat format) {
_sample_rate = sample_rate;
_channel = channel;
_format = format;
_device->addChannel(this);
}
SDL_AudioFormat AudioPlayer::getPCMFormat() {
return _format;
}
int AudioPlayer::getPCMSampleRate() {
return _sample_rate;
}
int AudioPlayer::getPCMChannel() {
return _channel;
}
int AudioPlayer::getPCMData(char *buf, int size) {
if (_buffer.size() < size) {
return 0;
}
memcpy(buf, _buffer.data(), size);
_buffer.erase(0, size);
return size;
}
void AudioPlayer::inputFrame(const char *data, size_t size){
_buffer.append(data, size);
}
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#ifndef AUDIOSRC_H_
#define AUDIOSRC_H_
#include <memory>
#include <string>
#ifdef __cplusplus
extern "C" {
#endif
#include "SDL2/SDL.h"
#ifdef __cplusplus
}
#endif
#if defined(_WIN32)
#pragma comment(lib,"SDL2.lib")
#endif //defined(_WIN32)
#include "Network/Buffer.h"
#include "SDLAudioDevice.h"
#include "FFMpegDecoder.h"
using namespace std;
using namespace toolkit;
class AudioSRCDelegate {
public:
virtual ~AudioSRCDelegate() {};
virtual SDL_AudioFormat getPCMFormat() = 0;
virtual int getPCMSampleRate() = 0;
virtual int getPCMChannel() = 0;
virtual int getPCMData(char *buf, int size) = 0;
};
//该类实现pcm的重采样
class AudioSRC {
public:
typedef std::shared_ptr<AudioSRC> Ptr;
AudioSRC(AudioSRCDelegate *);
virtual ~AudioSRC();
void setEnableMix(bool flag);
void setOutputAudioConfig(const SDL_AudioSpec &cfg);
int getPCMData(char *buf, int size);
private:
bool _enabled = true;
int _origin_size = 0;
std::shared_ptr<char> _origin_buf;
AudioSRCDelegate *_delegate = nullptr;
BufferLikeString _target_buf;
SDL_AudioCVT _audio_cvt;
};
class AudioPlayer : public AudioSRC, private AudioSRCDelegate{
public:
AudioPlayer();
~AudioPlayer() override;
void setup(int sample_rate, int channel, SDL_AudioFormat format);
void inputFrame(const char *data, size_t size);
private:
SDL_AudioFormat getPCMFormat() override;
int getPCMSampleRate() override;
int getPCMChannel() override;
int getPCMData(char *buf, int size) override;
private:
int _sample_rate, _channel;
SDL_AudioFormat _format;
BufferLikeString _buffer;
SDLAudioDevice::Ptr _device;
};
#endif /* AUDIOSRC_H_ */
find_package(PkgConfig QUIET)
#查找SDL2是否安装
if (PKG_CONFIG_FOUND)
pkg_check_modules(SDL2 QUIET IMPORTED_TARGET sdl2)
if (SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIRS})
link_directories(${SDL2_LIBRARY_DIRS})
list(APPEND LINK_LIB_LIST ${SDL2_LIBRARIES})
message(STATUS "found library:${SDL2_LIBRARIES}")
endif ()
else ()
find_package(SDL2 QUIET)
if (SDL2_FOUND)
include_directories(${SDL2_INCLUDE_DIR})
list(APPEND LINK_LIB_LIST ${SDL2_LIBRARY})
message(STATUS "found library:${SDL2_LIBRARY}")
endif (SDL2_FOUND)
endif ()
#查找ffmpeg/libutil是否安装
if (PKG_CONFIG_FOUND)
pkg_check_modules(AVUTIL QUIET IMPORTED_TARGET libavutil)
if (AVUTIL_FOUND)
include_directories(${AVUTIL_INCLUDE_DIRS})
link_directories(${AVUTIL_LIBRARY_DIRS})
list(APPEND LINK_LIB_LIST ${AVUTIL_LIBRARIES})
message(STATUS "found library:${AVUTIL_LIBRARIES}")
endif ()
else ()
find_package(AVUTIL QUIET)
if (AVUTIL_FOUND)
include_directories(${AVUTIL_INCLUDE_DIR})
list(APPEND LINK_LIB_LIST ${AVUTIL_LIBRARIES})
message(STATUS "found library:${AVUTIL_LIBRARIES}")
endif ()
endif ()
#查找ffmpeg/libswresample是否安装
if (PKG_CONFIG_FOUND)
pkg_check_modules(SWRESAMPLE QUIET IMPORTED_TARGET libswresample)
if (SWRESAMPLE_FOUND)
include_directories(${SWRESAMPLE_INCLUDE_DIRS})
link_directories(${SWRESAMPLE_LIBRARY_DIRS})
list(APPEND LINK_LIB_LIST ${SWRESAMPLE_LIBRARIES})
message(STATUS "found library:${SWRESAMPLE_LIBRARIES}")
endif ()
else ()
find_package(SWRESAMPLE QUIET)
if (SWRESAMPLE_FOUND)
include_directories(${SWRESAMPLE_INCLUDE_DIR})
list(APPEND LINK_LIB_LIST ${SWRESAMPLE_LIBRARIES})
message(STATUS "found library:${SWRESAMPLE_LIBRARIES}")
endif ()
endif ()
#查找ffmpeg/libavcodec是否安装
if (PKG_CONFIG_FOUND)
pkg_check_modules(AVCODEC QUIET IMPORTED_TARGET libavcodec)
if (AVCODEC_FOUND)
include_directories(${AVCODEC_INCLUDE_DIRS})
link_directories(${AVCODEC_LIBRARY_DIRS})
list(APPEND LINK_LIB_LIST ${AVCODEC_LIBRARIES})
message(STATUS "found library:${AVCODEC_LIBRARIES}")
endif ()
else ()
find_package(AVCODEC QUIET)
if (AVCODEC_FOUND)
include_directories(${AVCODEC_INCLUDE_DIR})
list(APPEND LINK_LIB_LIST ${AVCODEC_LIBRARIES})
message(STATUS "found library:${AVCODEC_LIBRARIES}")
endif ()
endif ()
set(PLAYER_NAME "player")
#如果ffmpeg/libavcodec ffmpeg/libavcodec SDL 都安装了则编译播放器
if (SDL2_FOUND AND AVCODEC_FOUND AND AVUTIL_FOUND AND SWRESAMPLE_FOUND)
message(STATUS "${PLAYER_NAME} enabled")
else ()
message(STATUS "${PLAYER_NAME} disabled, please install sdl2 ffmpeg/libavcodec ffmpeg/libavutil ffmpeg/libswresample")
endif ()
aux_source_directory(. SRC_LIST)
add_executable(${PLAYER_NAME} ${SRC_LIST})
if (MSVC)
set_target_properties(${PLAYER_NAME} PROPERTIES COMPILE_FLAGS ${VS_FALGS})
set_target_properties(${PLAYER_NAME} PROPERTIES LINK_FLAGS "/SAFESEH:NO /SUBSYSTEM:WINDOWS")
endif ()
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
target_link_libraries(${PLAYER_NAME} -Wl,--start-group ${LINK_LIB_LIST} -Wl,--end-group)
else ()
target_link_libraries(${PLAYER_NAME} ${LINK_LIB_LIST})
endif ()
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#ifndef FFMpegDecoder_H_
#define FFMpegDecoder_H_
#include <string>
#include <memory>
#include <stdexcept>
#include "Extension/Frame.h"
#include "Extension/Track.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "libavcodec/avcodec.h"
#include "libswresample/swresample.h"
#ifdef __cplusplus
}
#endif
using namespace std;
using namespace mediakit;
class FFmpegFrame {
public:
using Ptr = std::shared_ptr<FFmpegFrame>;
FFmpegFrame(std::shared_ptr<AVFrame> frame = nullptr);
~FFmpegFrame();
AVFrame *get() const;
void fillPicture(AVPixelFormat target_format, int target_width, int target_height);
private:
char *_data = nullptr;
std::shared_ptr<AVFrame> _frame;
};
class FFmpegSwr{
public:
using Ptr = std::shared_ptr<FFmpegSwr>;
FFmpegSwr(AVSampleFormat output, int channel, int channel_layout, int samplerate);
~FFmpegSwr();
FFmpegFrame::Ptr inputFrame(const FFmpegFrame::Ptr &frame);
private:
int _target_channels;
int _target_channel_layout;
int _target_samplerate;
AVSampleFormat _target_format;
SwrContext *_ctx = nullptr;
ResourcePool<FFmpegFrame> _frame_pool;
};
class FFmpegDecoder : public FrameWriterInterface {
public:
using Ptr = std::shared_ptr<FFmpegDecoder>;
using onDec = function<void(const FFmpegFrame::Ptr &)>;
FFmpegDecoder(const Track::Ptr &track);
~FFmpegDecoder() {}
void inputFrame(const Frame::Ptr &frame) override;
void inputFrame(const char *data, size_t size, uint32_t dts, uint32_t pts);
void setOnDecode(onDec cb);
void flush();
const AVCodecContext *getContext() const;
private:
void onDecode(const FFmpegFrame::Ptr &frame);
private:
Ticker _ticker;
onDec _cb;
FFmpegSwr::Ptr _swr;
ResourcePool<FFmpegFrame> _frame_pool;
std::shared_ptr<AVCodecContext> _context;
};
#endif /* FFMpegDecoder_H_ */
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#include "Util/logger.h"
#include "AudioSRC.h"
#include "SDLAudioDevice.h"
using namespace std;
using namespace toolkit;
INSTANCE_IMP(SDLAudioDevice);
SDLAudioDevice::~SDLAudioDevice() {
SDL_CloseAudio();
}
SDLAudioDevice::SDLAudioDevice() {
SDL_AudioSpec wanted_spec;
wanted_spec.freq = DEFAULT_SAMPLERATE;
wanted_spec.format = DEFAULT_FORMAT;
wanted_spec.channels = DEFAULT_CHANNEL;
wanted_spec.silence = 0;
wanted_spec.samples = DEFAULT_SAMPLES;
wanted_spec.userdata = this;
wanted_spec.callback = [](void *userdata, Uint8 *stream, int len) {
SDLAudioDevice *_this = (SDLAudioDevice *) userdata;
_this->onReqPCM((char *) stream, len);
};
if (SDL_OpenAudio(&wanted_spec, &_audio_config) < 0) {
throw std::runtime_error("SDL_OpenAudio failed");
}
InfoL << "actual audioSpec, " << "freq:" << _audio_config.freq
<< ", format:" << hex << _audio_config.format << dec
<< ", channels:" << (int) _audio_config.channels
<< ", samples:" << _audio_config.samples
<< ", pcm size:" << _audio_config.size;
_play_buf.reset(new char[_audio_config.size], [](char *ptr) {
delete[] ptr;
});
}
void SDLAudioDevice::addChannel(AudioSRC *chn) {
lock_guard<recursive_mutex> lck(_channel_mtx);
if (_channels.empty()) {
SDL_PauseAudio(0);
}
chn->setOutputAudioConfig(_audio_config);
_channels.emplace(chn);
}
void SDLAudioDevice::delChannel(AudioSRC *chn) {
lock_guard<recursive_mutex> lck(_channel_mtx);
_channels.erase(chn);
if (_channels.empty()) {
SDL_PauseAudio(true);
}
}
void SDLAudioDevice::onReqPCM(char *stream, int len) {
lock_guard<recursive_mutex> lck(_channel_mtx);
int size;
int channel = 0;
for (auto &chn : _channels) {
if (channel == 0) {
size = chn->getPCMData(_play_buf.get(), len);
if (size) {
memcpy(stream, _play_buf.get(), size);
}
} else {
size = chn->getPCMData(_play_buf.get(), len);
if (size) {
SDL_MixAudio((Uint8 *) stream, (Uint8 *) _play_buf.get(), size, SDL_MIX_MAXVOLUME);
}
}
if (size) {
channel++;
}
}
if (!channel) {
memset(stream, 0, len);
}
}
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
* may be found in the AUTHORS file in the root of the source tree.
*/
#ifndef SDLAUDIOMIXER_SDLAUDIODEVICE_H_
#define SDLAUDIOMIXER_SDLAUDIODEVICE_H_
#include <mutex>
#include <memory>
#include <stdexcept>
#include <unordered_set>
#define DEFAULT_SAMPLERATE 48000
#define DEFAULT_FORMAT AUDIO_S16
#define DEFAULT_CHANNEL 2
#define DEFAULT_SAMPLES 1024
using namespace std;
class AudioSRC;
//该对象主要实现sdl混音与播放
class SDLAudioDevice : public std::enable_shared_from_this<SDLAudioDevice>{
public:
using Ptr = std::shared_ptr<SDLAudioDevice>;
~SDLAudioDevice();
static SDLAudioDevice &Instance();
void addChannel(AudioSRC *chn);
void delChannel(AudioSRC *chn);
private:
SDLAudioDevice();
void onReqPCM(char *stream, int len);
private:
std::shared_ptr<char> _play_buf;
SDL_AudioSpec _audio_config;
recursive_mutex _channel_mtx;
unordered_set<AudioSRC *> _channels;
};
#endif /* SDLAUDIOMIXER_SDLAUDIODEVICE_H_ */
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
......@@ -99,8 +99,9 @@ private:
class YuvDisplayer {
public:
YuvDisplayer(void *hwnd = nullptr,const char *title = "untitled"){
using Ptr = std::shared_ptr<YuvDisplayer>;
YuvDisplayer(void *hwnd = nullptr,const char *title = "untitled"){
static onceToken token([]() {
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO) == -1) {
string err = "初始化SDL失败:";
......
/*
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
*
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
*
* Use of this source code is governed by MIT license that can be found in the
* LICENSE file in the root of the source tree. All contributing project authors
......@@ -9,7 +9,6 @@
*/
#include <signal.h>
#include "Util/util.h"
#include "Util/logger.h"
#include <iostream>
#include "Rtsp/UDPServer.h"
......@@ -17,10 +16,7 @@
#include "Util/onceToken.h"
#include "FFMpegDecoder.h"
#include "YuvDisplayer.h"
#include "Extension/H265.h"
#include "Extension/AAC.h"
#include "Audio/AudioPlayer.h"
#include "AudioSRC.h"
using namespace std;
using namespace toolkit;
using namespace mediakit;
......@@ -49,9 +45,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstanc, LPSTR lpCmdLine,
#else
#include <unistd.h>
int main(int argc, char *argv[]) {
#endif
static char *url = argv[1];
//设置退出信号处理函数
signal(SIGINT, [](int) { SDLDisplayerHelper::Instance().shutdown(); });
......@@ -64,88 +58,57 @@ int main(int argc, char *argv[]) {
<< "例如:./test_player rtsp://admin:123456@127.0.0.1/live/0 0\r\n"
<< endl;
return 0;
}
MediaPlayer::Ptr player(new MediaPlayer());
auto player = std::make_shared<MediaPlayer>();
//sdl要求在main线程初始化
auto displayer = std::make_shared<YuvDisplayer>(nullptr, url);
weak_ptr<MediaPlayer> weakPlayer = player;
player->setOnPlayResult([weakPlayer](const SockException &ex) {
player->setOnPlayResult([weakPlayer, displayer](const SockException &ex) {
InfoL << "OnPlayResult:" << ex.what();
auto strongPlayer = weakPlayer.lock();
if (ex || !strongPlayer) {
return;
}
auto viedoTrack = strongPlayer->getTrack(TrackVideo, false);
if (!viedoTrack) {
WarnL << "没有视频!";
return;
}
auto audioTrack = strongPlayer->getTrack(TrackAudio,false);
if( !audioTrack){
WarnL << "没有音频!";
}
auto videoTrack = dynamic_pointer_cast<VideoTrack>(strongPlayer->getTrack(TrackVideo, false));
auto audioTrack = dynamic_pointer_cast<AudioTrack>(strongPlayer->getTrack(TrackAudio,false));
AnyStorage::Ptr storage(new AnyStorage);
viedoTrack->addDelegate(std::make_shared<FrameWriterInterfaceHelper>([storage](const Frame::Ptr &frame_in) {
auto frame = Frame::getCacheAbleFrame(frame_in);
SDLDisplayerHelper::Instance().doTask([frame,storage]() {
auto &decoder = (*storage)["decoder"];
auto &displayer = (*storage)["displayer"];
auto &merger = (*storage)["merger"];
if(!decoder){
decoder.set<FFMpegDecoder>(frame->getCodecId());
}
if(!displayer){
displayer.set<YuvDisplayer>(nullptr,url);
}
if(!merger){
merger.set<FrameMerger>(FrameMerger::h264_prefix);
}
merger.get<FrameMerger>().inputFrame(frame,[&](uint32_t dts,uint32_t pts,const Buffer::Ptr &buffer, bool have_idr){
AVFrame *pFrame = nullptr;
bool flag = decoder.get<FFMpegDecoder>().inputVideo((unsigned char *) buffer->data(), buffer->size(), dts, &pFrame);
if (flag) {
displayer.get<YuvDisplayer>().displayYUV(pFrame);
}
if (videoTrack) {
auto decoder = std::make_shared<FFmpegDecoder>(videoTrack);
decoder->setOnDecode([displayer](const FFmpegFrame::Ptr &yuv) {
SDLDisplayerHelper::Instance().doTask([yuv, displayer]() {
//sdl要求在main线程渲染
displayer->displayYUV(yuv->get());
return true;
});
return true;
});
}));
auto audio_delagate = std::make_shared<FrameWriterInterfaceHelper>([storage, audioTrack](const Frame::Ptr& frame_in) {
auto frame = Frame::getCacheAbleFrame(frame_in);
AACTrack::Ptr aacTrack = dynamic_pointer_cast<AACTrack>(audioTrack);
std::string codename = frame->getCodecName();
int out_sample_fmt = aacTrack->getAudioSampleBit();
int channelnum = aacTrack->getAudioChannel();
int sample_rate = aacTrack->getAudioSampleRate();
auto &audioplayer = (*storage)["audioplayer"];
if(!audioplayer){
audioplayer.set<AudioPlayer>(sample_rate,channelnum,out_sample_fmt);
}
audioplayer.get<AudioPlayer>().inputFrame( frame );
});
if( audioTrack ) {
audioTrack->addDelegate(audio_delagate);
auto merger = std::make_shared<FrameMerger>(FrameMerger::h264_prefix);
auto delegate = std::make_shared<FrameWriterInterfaceHelper>([decoder, merger](const Frame::Ptr &frame) {
merger->inputFrame(frame, [&](uint32_t dts, uint32_t pts, const Buffer::Ptr &buffer, bool have_idr) {
decoder->inputFrame(buffer->data(), buffer->size(), dts, pts);
});
});
videoTrack->addDelegate(delegate);
}
if (audioTrack) {
auto decoder = std::make_shared<FFmpegDecoder>(audioTrack);
auto audio_player = std::make_shared<AudioPlayer>();
//FFmpeg解码时已经统一转换为16位整型pcm
audio_player->setup(audioTrack->getAudioSampleRate(), audioTrack->getAudioChannel(), AUDIO_S16);
decoder->setOnDecode([audio_player](const FFmpegFrame::Ptr &pcm) {
audio_player->inputFrame((const char *) (pcm->get()->data[0]), pcm->get()->linesize[0]);
});
auto audio_delegate = std::make_shared<FrameWriterInterfaceHelper>( [decoder](const Frame::Ptr &frame) {
decoder->inputFrame(frame);
});
audioTrack->addDelegate(audio_delegate);
}
});
player->setOnShutdown([](const SockException &ex) {
ErrorL << "OnShutdown:" << ex.what();
});
(*player)[kRtpType] = atoi(argv[2]);
player->play(argv[1]);
SDLDisplayerHelper::Instance().runLoop();
return 0;
}
......
......@@ -5,7 +5,7 @@ file(GLOB MediaServer_src_list ./*.cpp ./*.h)
add_executable(MediaServer ${MediaServer_src_list})
if(WIN32)
if(MSVC)
set_target_properties(MediaServer PROPERTIES COMPILE_FLAGS ${VS_FALGS} )
else()
install(TARGETS MediaServer DESTINATION ${INSTALL_PATH_EXECUTABLE})
......
#include "AudioDecoder.h"
AudioDecoder::AudioDecoder():handle_(nullptr)
, samplerate_(0)
, channels_(2)
, samplebit_(16)
{
}
AudioDecoder::~AudioDecoder(){
}
bool AudioDecoder::init(unsigned char * ADTSHead ,int headLen ){
if( handle_ == nullptr ){
handle_ = NeAACDecOpen();
}
if( handle_ == nullptr ){
return false;
}
long err = NeAACDecInit( handle_ , ( unsigned char *)ADTSHead , headLen , &samplerate_, &channels_ );
if( err != 0 ){
return false;
}
return true;
}
int AudioDecoder::inputData( unsigned char * data,int len , unsigned char ** outBuffer ){
NeAACDecFrameInfo frameInfo;
*outBuffer = static_cast<unsigned char *>(NeAACDecDecode(handle_, &frameInfo, (unsigned char *) data, len));
if( frameInfo.error != 0){
//ErroL << NeAACDecGetErrorMessage(frameInfo.error) << endl;
return -1;
}
return frameInfo.samples*frameInfo.channels;
}
\ No newline at end of file
/*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef AUDIO_AUDIODECODER_H
#define AUDIO_AUDIODECODER_H
#include "libFaad/faad.h"
class AudioDecoder {
public:
AudioDecoder();
virtual ~AudioDecoder();
bool init(unsigned char * ADTSHead ,int headLen =7);
int inputData( unsigned char * data,int len , unsigned char ** outBuffer );
unsigned long getChannels() const { return channels_ ;}
unsigned long getSampleRate() const { return samplerate_ ; }
unsigned long getSampleBit() const { return samplebit_ ;}
private:
NeAACDecHandle handle_;
unsigned long samplerate_;
unsigned char channels_;
unsigned char samplebit_;
};
#endif //AUDIO_AUDIODECODER_H
#include "AudioPlayer.h"
#include "Util/util.h"
#include "Util/logger.h"
using namespace toolkit;
AudioPlayer::AudioPlayer( int sampleRate ,int channels ,int sampleBit):
sampleRate_(sampleRate)
,channels_(channels)
,sampleBit_(sampleBit)
{
}
AudioPlayer::~AudioPlayer(){
}
int AudioPlayer::getPCMData(char *buf, int bufsize) {
if( buffer_->IsEmpty() ){
WarnL << "Audio Data Not Ready!";
return 0;
}
PcmPacket pcm;
buffer_->Pop(pcm);
if( bufsize > pcm.data.size() ){
bufsize = pcm.data.size() ;
}
memcpy( buf , pcm.data.data() , bufsize );
return pcm.data.size();
}
bool AudioPlayer::inputFrame( Frame::Ptr frame ){
unsigned char *pSampleBuffer = nullptr ;
if( decoder_ == nullptr ){
decoder_ = new AudioDecoder;
bool ret = decoder_->init( (unsigned char *)frame->data() );
buffer_ = new xRingBuffer<PcmPacket> ( 16 );
}
if( audioSrc_ == nullptr ){
audioSrc_ = new AudioSRC(this) ;
SDLAudioDevice::Instance().addChannel( audioSrc_ );
}
int size = decoder_->inputData( (unsigned char *)frame->data() ,frame->size(), &pSampleBuffer );
if( size < 0 ){
ErrorL << "Audio Decode Error!!" << endl;
}else{
buf_.append((char*)pSampleBuffer , size);
}
size_t offset = 0 ;
int i = 0;
int ms = 1000 * reqSize_ / ( decoder_->getChannels()*decoder_->getSampleRate()*decoder_->getSampleBit() / 8);
while( buf_.size() - offset > reqSize_ ){
PcmPacket pcm;
pcm.data.assign( buf_.data() + offset , reqSize_ );
pcm.timeStmp = i*ms + frame->dts();
buffer_->Push(std::move(pcm));
++i;
offset += reqSize_;
}
if(offset){
buf_.erase(0,offset );
}
return true;
}
\ No newline at end of file
/* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef AUDIO_AUDIOPLAYER_H
#define AUDIO_AUDIOPLAYER_H
#include "SDLAudioMixer/AudioSRC.h"
#include "SDLAudioMixer/SDLAudioDevice.h"
#include "AudioDecoder.h"
#include "xRingBuffer.h"
#include "Extension/Frame.h"
using mediakit::Frame;
class PcmPacket{
public:
string data;
uint32_t timeStmp;
};
class AudioPlayer:public AudioSRCDelegate{
public:
AudioPlayer( int sampleRate ,int channels ,int sampleBit);
~AudioPlayer() override;
//audio
void setPCMBufferSize(int size) override{
InfoL << "setPCMBufferSize = " << size ;
reqSize_ = size;
}
int getPCMSampleBit() override{
return decoder_->getSampleBit();
}
int getPCMSampleRate() override{
return decoder_->getSampleRate();
}
int getPCMChannel() override{
return decoder_->getChannels();
}
int getPCMData(char *buf, int bufsize) override;
bool inputFrame( Frame::Ptr frame );
private:
int sampleRate_;
int channels_;
int sampleBit_;
string buf_;
int reqSize_ = 4096;
AudioDecoder* decoder_=nullptr;
xRingBuffer<PcmPacket>* buffer_ = nullptr;
AudioSRC * audioSrc_ = nullptr;
};
#endif //AUDIO_AUDIOPLAYER_H
INCLUDE_DIRECTORIES(./libFaad)
aux_source_directory(./libFaad AUDIO_SRC_LIST)
aux_source_directory(./SDLAudioMixer AUDIO_SRC_LIST)
aux_source_directory(. AUDIO_SRC_LIST)
add_definitions(-DHAVE_CONFIG_H)
add_library(audioPlayer ${AUDIO_SRC_LIST} )
message(STATUS "ADD AudioPlayer")
\ No newline at end of file
#ifdef __cplusplus
extern "C" {
#endif
#include "SDL2/SDL.h"
#include "libavcodec/avcodec.h"
#ifdef __cplusplus
}
#endif
#include "Util/logger.h"
#include "AudioSRC.h"
#include <stdexcept>
using namespace std;
using namespace toolkit;
AudioSRC::AudioSRC(AudioSRCDelegate *del) {
_delegate = del;
}
AudioSRC::~AudioSRC() {
}
void AudioSRC::setOutputAudioConfig(const SDL_AudioSpec& cfg) {
int freq = _delegate->getPCMSampleRate();
int format = _delegate->getPCMSampleBit() == 16 ? AUDIO_S16 : AUDIO_S8;
int channels = _delegate->getPCMChannel();
if(-1 == SDL_BuildAudioCVT(&_audioCvt,format,channels,freq,cfg.format,cfg.channels,cfg.freq)){
throw std::runtime_error("the format conversion is not supported");
}
InfoL << freq << " " << format << " " << channels ;
InfoL << _audioCvt.needed << " "
<< _audioCvt.src_format << " "
<< _audioCvt.dst_format << " "
<< _audioCvt.rate_incr << " "
<< _audioCvt.len_mult << " "
<< _audioCvt.len_ratio << " ";
}
void AudioSRC::setEnableMix(bool flag){
_enableMix = flag;
}
int AudioSRC::getPCMData(char* buf, int bufsize) {
if(!_enableMix){
return 0;
}
if(!_pcmSize){
_pcmSize = bufsize / _audioCvt.len_ratio;
_delegate->setPCMBufferSize(_pcmSize);
}
if(!_delegate->getPCMData(buf,_pcmSize)){
return 0;
}
_audioCvt.buf = (Uint8 *)buf;
_audioCvt.len = _pcmSize;
if(0 != SDL_ConvertAudio(&_audioCvt)){
_audioCvt.len_cvt = 0;
TraceL << "SDL_ConvertAudio falied";
}
//return _audioCvt.len_cvt;
if(_audioCvt.len_cvt == bufsize)
{
return bufsize;
}
if(_audioCvt.len_cvt){
_pcmBuf.append(buf,_audioCvt.len_cvt);
}
if(_pcmBuf.size() < bufsize){
return 0;
}
memcpy(buf,_pcmBuf.data(),bufsize);
_pcmBuf.erase(0,bufsize);
return bufsize;
}
/*
* MIT License
*
* Copyright (c) 2017 xiongziliang <771730766@qq.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef SDLAUDIOMIXER_AUDIOSRC_H_
#define SDLAUDIOMIXER_AUDIOSRC_H_
#include <memory>
#include <string>
#ifdef __cplusplus
extern "C" {
#endif
#include "SDL2/SDL.h"
#ifdef __cplusplus
}
#endif
#if defined(_WIN32)
#pragma comment(lib,"SDL2.lib")
#endif //defined(_WIN32)
using namespace std;
class AudioSRCDelegate{
public:
virtual ~AudioSRCDelegate(){};
virtual void setPCMBufferSize(int bufsize) = 0;
virtual int getPCMSampleBit() = 0;
virtual int getPCMSampleRate() = 0;
virtual int getPCMChannel() = 0;
virtual int getPCMData(char *buf, int bufsize) = 0;
};
class AudioSRC
{
public:
typedef std::shared_ptr<AudioSRC> Ptr;
AudioSRC(AudioSRCDelegate *);
virtual ~AudioSRC();
void setEnableMix(bool flag);
void setOutputAudioConfig(const SDL_AudioSpec &cfg);
//此处buf大小务必要比bufsize大的多
int getPCMData(char *buf, int bufsize);
private:
AudioSRCDelegate *_delegate;
SDL_AudioCVT _audioCvt;
bool _enableMix = true;
int _pcmSize = 0;
string _pcmBuf;
};
#endif /* SDLAUDIOMIXER_AUDIOSRC_H_ */
#include "SDLAudioDevice.h"
#include "Util/logger.h"
using namespace std;
using namespace toolkit;
SDLAudioDevice& SDLAudioDevice::Instance() {
static SDLAudioDevice *instance(new SDLAudioDevice);
return *instance;
}
SDLAudioDevice::SDLAudioDevice() {
SDL_AudioSpec wanted_spec;
wanted_spec.freq = DEFAULT_SAMPLERATE;
wanted_spec.format = DEFAULT_SAMPLEBIT == 16 ? AUDIO_S16 : AUDIO_S8;
wanted_spec.channels = DEFAULT_CHANNEL;
wanted_spec.silence = 0;
wanted_spec.samples = DEFAULT_PCMSIZE / (DEFAULT_CHANNEL * DEFAULT_SAMPLEBIT / 8) ;
wanted_spec.size = DEFAULT_PCMSIZE;
wanted_spec.callback = SDLAudioDevice::onReqPCM;
wanted_spec.userdata = this;
if (SDL_OpenAudio(&wanted_spec, &_audioConfig)<0) {
// throw std::runtime_error("SDL_OpenAudio failed");
InfoL << "SDL_OpenAudio failed";
}else{
InfoL << "actual audioSpec: " << "freq=" << _audioConfig.freq
<< ",format=" << hex<<_audioConfig.format<<dec
<< ",channels=" << _audioConfig.channels
<< ",samples=" << _audioConfig.samples
<< ",size=" << _audioConfig.size;
}
_pcmBuf.reset(new char[_audioConfig.size * 10],[](char *ptr){
delete [] ptr;
});
}
SDLAudioDevice::~SDLAudioDevice() {
}
void SDLAudioDevice::addChannel(AudioSRC* chn) {
lock_guard<recursive_mutex> lck(_mutexChannel);
if(_channelSet.empty()){
SDL_PauseAudio(0);
}
chn->setOutputAudioConfig(_audioConfig);
_channelSet.emplace(chn);
}
void SDLAudioDevice::delChannel(AudioSRC* chn) {
lock_guard<recursive_mutex> lck(_mutexChannel);
_channelSet.erase(chn);
if(_channelSet.empty()){
SDL_PauseAudio(true);
}
}
void SDLAudioDevice::onReqPCM(void* userdata, Uint8* stream, int len) {
SDLAudioDevice *_this = (SDLAudioDevice *)userdata;
_this->onReqPCM((char *)stream,len);
}
void SDLAudioDevice::onReqPCM(char* stream, int len) {
lock_guard<recursive_mutex> lck(_mutexChannel);
int size;
int channel = 0;
for(auto &chn : _channelSet){
if(channel ==0 ){
size = chn->getPCMData(_pcmBuf.get(),len);
if(size){
//InfoL << len << " " << size;
memcpy(stream,_pcmBuf.get(),size);
}
}else{
size = chn->getPCMData(_pcmBuf.get(),len);
if(size){
//InfoL << len << " " << size;
SDL_MixAudio((Uint8*)stream,(Uint8*)_pcmBuf.get(),size,SDL_MIX_MAXVOLUME);
}
}
if(size){
channel++;
}
}
if(!channel){
memset(stream,0,len);
}
}
/*
* MIT License
*
* Copyright (c) 2017 xiongziliang <771730766@qq.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef SDLAUDIOMIXER_SDLAUDIODEVICE_H_
#define SDLAUDIOMIXER_SDLAUDIODEVICE_H_
#include <mutex>
#include <memory>
#include <stdexcept>
#include <unordered_set>
#include "AudioSRC.h"
using namespace std;
#define DEFAULT_SAMPLERATE 48000
#define DEFAULT_SAMPLEBIT 16
#define DEFAULT_CHANNEL 2
#define DEFAULT_PCMSIZE 4096
class SDLAudioDevice{
public:
void addChannel(AudioSRC *chn);
void delChannel(AudioSRC *chn);
static SDLAudioDevice &Instance();
virtual ~SDLAudioDevice();
protected:
private:
SDLAudioDevice();
static void onReqPCM (void *userdata, Uint8 * stream,int len);
void onReqPCM (char * stream,int len);
unordered_set<AudioSRC *> _channelSet;
recursive_mutex _mutexChannel;
SDL_AudioSpec _audioConfig;
std::shared_ptr<char> _pcmBuf;
};
#endif /* SDLAUDIOMIXER_SDLAUDIODEVICE_H_ */
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: 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
/*
** 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 */
/*
** 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
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
** 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
/*
** 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 }
};
/*
** 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 }
};
/*
** 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 }
};
/*
** 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 */
};
/*
** 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 },
};
/*
** 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 } }
};
/*
** 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 }
};
/*
** 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 } }
};
/*
** 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 }
};
/*
** 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 }
};
/*
* config.h
*
* Created on: 2014-7-1
* Author: root
*/
#ifndef CONFIG_H_
#define CONFIG_H_
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.in by autoheader. */
/* Define if you want to use libfaad together with Digital Radio Mondiale
(DRM) */
/* #undef DRM */
/* Define if you want support for Digital Radio Mondiale (DRM) parametric
stereo */
/* #undef DRM_PS */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define if needed */
/* #undef HAVE_FLOAT32_T */
/* Define to 1 if you have the <float.h> header file. */
#define HAVE_FLOAT_H 1
/* Define to 1 if you have the `getpwuid' function. */
#define HAVE_GETPWUID 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define if you have the IOKit API */
/* #undef HAVE_IOKIT_IOKITLIB_H */
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have C99's lrintf function. */
#define HAVE_LRINTF 1
/* Define to 1 if you have the <mathf.h> header file. */
/* #undef HAVE_MATHF_H */
/* Define to 1 if you have the `memcpy' function. */
#define HAVE_MEMCPY 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `strchr' function. */
#define HAVE_STRCHR 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define to 1 if you have the `strsep' function. */
#define HAVE_STRSEP 1
/* Define to 1 if you have the <sysfs/libsysfs.h> header file. */
/* #undef HAVE_SYSFS_LIBSYSFS_H */
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Name of package */
#define PACKAGE "faad2"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT ""
/* Define to the full name of this package. */
#define PACKAGE_NAME ""
/* Define to the full name and version of this package. */
#define PACKAGE_STRING ""
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME ""
/* Define to the version of this package. */
#define PACKAGE_VERSION ""
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Version number of package */
#define VERSION "2.7.0"
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif
/* Define to `long int' if <sys/types.h> does not define. */
/* #undef off_t */
#endif /* CONFIG_H_ */
/*
** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
** Copyright (C) 2003-2005 M. Bakker, Nero AG, http://www.nero.com
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
** Any non-GPL usage of this software or parts of this software is strictly
** forbidden.
**
** The "appropriate copyright message" mentioned in section 2c of the GPLv2
** must read: "Code from FAAD2 is copyright (c) Nero AG, www.nero.com"
**
** Commercial non-GPL licensing of this software is possible.
** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
**
** $Id: 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;
}
}
/*
** 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
/*
** 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
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论