mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-16 09:04:38 +00:00
Updates livVorbis to v1.3.3
This commit is contained in:
parent
853b70255b
commit
44beb6210b
62 changed files with 32606 additions and 41208 deletions
|
|
@ -1,3 +1,92 @@
|
||||||
|
libvorbis 1.3.3 (2012-02-03) -- "Xiph.Org libVorbis I 20120203 (Omnipresent)"
|
||||||
|
|
||||||
|
* vorbis: additional proofing against invalid/malicious
|
||||||
|
streams in decode (see SVN for details).
|
||||||
|
* vorbis: fix a memory leak in vorbis_commentheader_out().
|
||||||
|
* updates, corrections and clarifications in the Vorbis I specification
|
||||||
|
document
|
||||||
|
* win32: fixed project configuration which referenced two CRT versions
|
||||||
|
in output binaries.
|
||||||
|
* build warning fixes
|
||||||
|
|
||||||
|
libvorbis 1.3.2 (2010-11-01) -- "Xiph.Org libVorbis I 20101101 (Schaufenugget)"
|
||||||
|
|
||||||
|
* vorbis: additional proofing against invalid/malicious
|
||||||
|
streams in floor, residue, and bos/eos packet trimming
|
||||||
|
code (see SVN for details).
|
||||||
|
* vorbis: Added programming documentation tree for the
|
||||||
|
low-level calls
|
||||||
|
* vorbisfile: Correct handling of serial numbers array
|
||||||
|
element [0] on non-seekable streams
|
||||||
|
* vorbisenc: Back out an [old] AoTuV HF weighting that was
|
||||||
|
first enabled in 1.3.0; there are a few samples where I
|
||||||
|
really don't like the effect it causes.
|
||||||
|
* vorbis: return correct timestamp for granule positions
|
||||||
|
with high bit set.
|
||||||
|
* vorbisfile: the [undocumented] half-rate decode api made no
|
||||||
|
attempt to keep the pcm offset tracking consistent in seeks.
|
||||||
|
Fix and add a testing mode to seeking_example.c to torture
|
||||||
|
test seeking in halfrate mode. Also remove requirement that
|
||||||
|
halfrate mode only work with seekable files.
|
||||||
|
* vorbisfile: Fix a chaining bug in raw_seeks where seeking
|
||||||
|
out of the current link would fail due to not
|
||||||
|
reinitializing the decode machinery.
|
||||||
|
* vorbisfile: improve seeking strategy. Reduces the
|
||||||
|
necessary number of seek callbacks in an open or seek
|
||||||
|
operation by well over 2/3.
|
||||||
|
|
||||||
|
libvorbis 1.3.1 (2010-02-26) -- "Xiph.Org libVorbis I 20100325 (Everywhere)"
|
||||||
|
|
||||||
|
* tweak + minor arithmetic fix in floor1 fit
|
||||||
|
* revert noise norm to conservative 1.2.3 behavior pending
|
||||||
|
more listening testing
|
||||||
|
|
||||||
|
libvorbis 1.3.0 (2010-02-25) -- unreleased staging snapshot
|
||||||
|
|
||||||
|
* Optimized surround support for 5.1 encoding at 44.1/48kHz
|
||||||
|
* Added encoder control call to disable channel coupling
|
||||||
|
* Correct an overflow bug in very low-bitrate encoding on 32 bit
|
||||||
|
machines that caused inflated bitrates
|
||||||
|
* Numerous API hardening, leak and build fixes
|
||||||
|
* Correct bug in 22kHz compand setup that could cause a crash
|
||||||
|
* Correct bug in 16kHz codebooks that could cause unstable pure
|
||||||
|
tones at high bitrates
|
||||||
|
|
||||||
|
libvorbis 1.2.3 (2009-07-09) -- "Xiph.Org libVorbis I 20090709"
|
||||||
|
|
||||||
|
* correct a vorbisfile bug that prevented proper playback of
|
||||||
|
Vorbis files where all audio in a logical stream is in a
|
||||||
|
single page
|
||||||
|
* Additional decode setup hardening against malicious streams
|
||||||
|
* Add 'OV_EXCLUDE_STATIC_CALLBACKS' define for developers who
|
||||||
|
wish to avoid unused symbol warnings from the static callbacks
|
||||||
|
defined in vorbisfile.h
|
||||||
|
|
||||||
|
libvorbis 1.2.2 (2009-06-24) -- "Xiph.Org libVorbis I 20090624"
|
||||||
|
|
||||||
|
* define VENDOR and ENCODER strings
|
||||||
|
* seek correctly in files bigger than 2 GB (Windows)
|
||||||
|
* fix regression from CVE-2008-1420; 1.0b1 files work again
|
||||||
|
* mark all tables as constant to reduce memory occupation
|
||||||
|
* additional decoder hardening against malicious streams
|
||||||
|
* substantially reduce amount of seeking performed by Vorbisfile
|
||||||
|
* Multichannel decode bugfix
|
||||||
|
* build system updates
|
||||||
|
* minor specification clarifications/fixes
|
||||||
|
|
||||||
|
libvorbis 1.2.1 (unreleased) -- "Xiph.Org libVorbis I 20080501"
|
||||||
|
|
||||||
|
* Improved robustness with corrupt streams.
|
||||||
|
* New ov_read_filter() vorbisfile call allows filtering decoded
|
||||||
|
audio as floats before converting to integer samples.
|
||||||
|
* Fix an encoder bug with multichannel streams.
|
||||||
|
* Replaced RTP payload format draft with RFC 5215.
|
||||||
|
* Bare bones self test under 'make check'.
|
||||||
|
* Fix a problem encoding some streams between 14 and 28 kHz.
|
||||||
|
* Fix a numerical instability in the edge extrapolation filter.
|
||||||
|
* Build system improvements.
|
||||||
|
* Specification correction.
|
||||||
|
|
||||||
libvorbis 1.2.0 (2007-07-25) -- "Xiph.Org libVorbis I 20070622"
|
libvorbis 1.2.0 (2007-07-25) -- "Xiph.Org libVorbis I 20070622"
|
||||||
|
|
||||||
* new ov_fopen() convenience call that avoids the common
|
* new ov_fopen() convenience call that avoids the common
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: libvorbis codec headers
|
function: libvorbis codec headers
|
||||||
last mod: $Id: codec.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -121,7 +121,7 @@ typedef struct vorbis_block{
|
||||||
|
|
||||||
/* vorbis_block is a single block of data to be processed as part of
|
/* vorbis_block is a single block of data to be processed as part of
|
||||||
the analysis/synthesis stream; it belongs to a specific logical
|
the analysis/synthesis stream; it belongs to a specific logical
|
||||||
bitstream, but is independant from other vorbis_blocks belonging to
|
bitstream, but is independent from other vorbis_blocks belonging to
|
||||||
that logical bitstream. *************************************************/
|
that logical bitstream. *************************************************/
|
||||||
|
|
||||||
struct alloc_chain{
|
struct alloc_chain{
|
||||||
|
|
@ -166,28 +166,30 @@ extern void vorbis_info_init(vorbis_info *vi);
|
||||||
extern void vorbis_info_clear(vorbis_info *vi);
|
extern void vorbis_info_clear(vorbis_info *vi);
|
||||||
extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
|
extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
|
||||||
extern void vorbis_comment_init(vorbis_comment *vc);
|
extern void vorbis_comment_init(vorbis_comment *vc);
|
||||||
extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
|
extern void vorbis_comment_add(vorbis_comment *vc, const char *comment);
|
||||||
extern void vorbis_comment_add_tag(vorbis_comment *vc,
|
extern void vorbis_comment_add_tag(vorbis_comment *vc,
|
||||||
char *tag, char *contents);
|
const char *tag, const char *contents);
|
||||||
extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
|
extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
|
||||||
extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);
|
extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
|
||||||
extern void vorbis_comment_clear(vorbis_comment *vc);
|
extern void vorbis_comment_clear(vorbis_comment *vc);
|
||||||
|
|
||||||
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
|
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
|
||||||
extern int vorbis_block_clear(vorbis_block *vb);
|
extern int vorbis_block_clear(vorbis_block *vb);
|
||||||
extern void vorbis_dsp_clear(vorbis_dsp_state *v);
|
extern void vorbis_dsp_clear(vorbis_dsp_state *v);
|
||||||
extern double vorbis_granule_time(vorbis_dsp_state *v,
|
extern double vorbis_granule_time(vorbis_dsp_state *v,
|
||||||
ogg_int64_t granulepos);
|
ogg_int64_t granulepos);
|
||||||
|
|
||||||
|
extern const char *vorbis_version_string(void);
|
||||||
|
|
||||||
/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
|
/* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
|
||||||
|
|
||||||
extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
extern int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
||||||
extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
|
extern int vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
|
||||||
extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
|
extern int vorbis_analysis_headerout(vorbis_dsp_state *v,
|
||||||
vorbis_comment *vc,
|
vorbis_comment *vc,
|
||||||
ogg_packet *op,
|
ogg_packet *op,
|
||||||
ogg_packet *op_comm,
|
ogg_packet *op_comm,
|
||||||
ogg_packet *op_code);
|
ogg_packet *op_code);
|
||||||
extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
|
extern float **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
|
||||||
extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
|
extern int vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
|
||||||
extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
|
extern int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
|
||||||
|
|
@ -195,12 +197,12 @@ extern int vorbis_analysis(vorbis_block *vb,ogg_packet *op);
|
||||||
|
|
||||||
extern int vorbis_bitrate_addblock(vorbis_block *vb);
|
extern int vorbis_bitrate_addblock(vorbis_block *vb);
|
||||||
extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
|
extern int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
|
||||||
ogg_packet *op);
|
ogg_packet *op);
|
||||||
|
|
||||||
/* Vorbis PRIMITIVES: synthesis layer *******************************/
|
/* Vorbis PRIMITIVES: synthesis layer *******************************/
|
||||||
extern int vorbis_synthesis_idheader(ogg_packet *op);
|
extern int vorbis_synthesis_idheader(ogg_packet *op);
|
||||||
extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
|
extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
|
||||||
ogg_packet *op);
|
ogg_packet *op);
|
||||||
|
|
||||||
extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
||||||
extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
|
extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,16 @@
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: vorbis encode-engine setup
|
function: vorbis encode-engine setup
|
||||||
last mod: $Id: vorbisenc.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: vorbisenc.h 17021 2010-03-24 09:29:41Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
/** \file
|
||||||
|
* Libvorbisenc is a convenient API for setting up an encoding
|
||||||
|
* environment using libvorbis. Libvorbisenc encapsulates the
|
||||||
|
* actions needed to set up the encoder properly.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef _OV_ENC_H_
|
#ifndef _OV_ENC_H_
|
||||||
#define _OV_ENC_H_
|
#define _OV_ENC_H_
|
||||||
|
|
||||||
|
|
@ -25,88 +31,406 @@ extern "C"
|
||||||
|
|
||||||
#include "codec.h"
|
#include "codec.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the primary function within libvorbisenc for setting up managed
|
||||||
|
* bitrate modes.
|
||||||
|
*
|
||||||
|
* Before this function is called, the \ref vorbis_info
|
||||||
|
* struct should be initialized by using vorbis_info_init() from the libvorbis
|
||||||
|
* API. After encoding, vorbis_info_clear() should be called.
|
||||||
|
*
|
||||||
|
* The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
|
||||||
|
* constraints for the encoded file. This function uses these settings to
|
||||||
|
* select the appropriate encoding mode and set it up.
|
||||||
|
*
|
||||||
|
* \param vi Pointer to an initialized \ref vorbis_info struct.
|
||||||
|
* \param channels The number of channels to be encoded.
|
||||||
|
* \param rate The sampling rate of the source audio.
|
||||||
|
* \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset.
|
||||||
|
* \param nominal_bitrate Desired average, or central, bitrate. -1 indicates unset.
|
||||||
|
* \param min_bitrate Desired minimum bitrate. -1 indicates unset.
|
||||||
|
*
|
||||||
|
* \return Zero for success, and negative values for failure.
|
||||||
|
*
|
||||||
|
* \retval 0 Success.
|
||||||
|
* \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
|
||||||
|
* \retval OV_EINVAL Invalid setup request, eg, out of range argument.
|
||||||
|
* \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request.
|
||||||
|
*/
|
||||||
extern int vorbis_encode_init(vorbis_info *vi,
|
extern int vorbis_encode_init(vorbis_info *vi,
|
||||||
long channels,
|
long channels,
|
||||||
long rate,
|
long rate,
|
||||||
|
|
||||||
long max_bitrate,
|
long max_bitrate,
|
||||||
long nominal_bitrate,
|
long nominal_bitrate,
|
||||||
long min_bitrate);
|
long min_bitrate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function performs step-one of a three-step bitrate-managed encode
|
||||||
|
* setup. It functions similarly to the one-step setup performed by \ref
|
||||||
|
* vorbis_encode_init but allows an application to make further encode setup
|
||||||
|
* tweaks using \ref vorbis_encode_ctl before finally calling \ref
|
||||||
|
* vorbis_encode_setup_init to complete the setup process.
|
||||||
|
*
|
||||||
|
* Before this function is called, the \ref vorbis_info struct should be
|
||||||
|
* initialized by using vorbis_info_init() from the libvorbis API. After
|
||||||
|
* encoding, vorbis_info_clear() should be called.
|
||||||
|
*
|
||||||
|
* The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
|
||||||
|
* constraints for the encoded file. This function uses these settings to
|
||||||
|
* select the appropriate encoding mode and set it up.
|
||||||
|
*
|
||||||
|
* \param vi Pointer to an initialized vorbis_info struct.
|
||||||
|
* \param channels The number of channels to be encoded.
|
||||||
|
* \param rate The sampling rate of the source audio.
|
||||||
|
* \param max_bitrate Desired maximum bitrate (limit). -1 indicates unset.
|
||||||
|
* \param nominal_bitrate Desired average, or central, bitrate. -1 indicates unset.
|
||||||
|
* \param min_bitrate Desired minimum bitrate. -1 indicates unset.
|
||||||
|
*
|
||||||
|
* \return Zero for success, and negative for failure.
|
||||||
|
*
|
||||||
|
* \retval 0 Success
|
||||||
|
* \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
|
||||||
|
* \retval OV_EINVAL Invalid setup request, eg, out of range argument.
|
||||||
|
* \retval OV_EIMPL Unimplemented mode; unable to comply with bitrate request.
|
||||||
|
*/
|
||||||
extern int vorbis_encode_setup_managed(vorbis_info *vi,
|
extern int vorbis_encode_setup_managed(vorbis_info *vi,
|
||||||
long channels,
|
long channels,
|
||||||
long rate,
|
long rate,
|
||||||
|
|
||||||
long max_bitrate,
|
long max_bitrate,
|
||||||
long nominal_bitrate,
|
long nominal_bitrate,
|
||||||
long min_bitrate);
|
long min_bitrate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function performs step-one of a three-step variable bitrate
|
||||||
|
* (quality-based) encode setup. It functions similarly to the one-step setup
|
||||||
|
* performed by \ref vorbis_encode_init_vbr() but allows an application to
|
||||||
|
* make further encode setup tweaks using \ref vorbis_encode_ctl() before
|
||||||
|
* finally calling \ref vorbis_encode_setup_init to complete the setup
|
||||||
|
* process.
|
||||||
|
*
|
||||||
|
* Before this function is called, the \ref vorbis_info struct should be
|
||||||
|
* initialized by using \ref vorbis_info_init() from the libvorbis API. After
|
||||||
|
* encoding, vorbis_info_clear() should be called.
|
||||||
|
*
|
||||||
|
* \param vi Pointer to an initialized vorbis_info struct.
|
||||||
|
* \param channels The number of channels to be encoded.
|
||||||
|
* \param rate The sampling rate of the source audio.
|
||||||
|
* \param quality Desired quality level, currently from -0.1 to 1.0 (lo to hi).
|
||||||
|
*
|
||||||
|
* \return Zero for success, and negative values for failure.
|
||||||
|
*
|
||||||
|
* \retval 0 Success
|
||||||
|
* \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
|
||||||
|
* \retval OV_EINVAL Invalid setup request, eg, out of range argument.
|
||||||
|
* \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request.
|
||||||
|
*/
|
||||||
extern int vorbis_encode_setup_vbr(vorbis_info *vi,
|
extern int vorbis_encode_setup_vbr(vorbis_info *vi,
|
||||||
long channels,
|
long channels,
|
||||||
long rate,
|
long rate,
|
||||||
|
|
||||||
float quality /* quality level from 0. (lo) to 1. (hi) */
|
float quality
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the primary function within libvorbisenc for setting up variable
|
||||||
|
* bitrate ("quality" based) modes.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Before this function is called, the vorbis_info struct should be
|
||||||
|
* initialized by using vorbis_info_init() from the libvorbis API. After
|
||||||
|
* encoding, vorbis_info_clear() should be called.
|
||||||
|
*
|
||||||
|
* \param vi Pointer to an initialized vorbis_info struct.
|
||||||
|
* \param channels The number of channels to be encoded.
|
||||||
|
* \param rate The sampling rate of the source audio.
|
||||||
|
* \param base_quality Desired quality level, currently from -0.1 to 1.0 (lo to hi).
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* \return Zero for success, or a negative number for failure.
|
||||||
|
*
|
||||||
|
* \retval 0 Success
|
||||||
|
* \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
|
||||||
|
* \retval OV_EINVAL Invalid setup request, eg, out of range argument.
|
||||||
|
* \retval OV_EIMPL Unimplemented mode; unable to comply with quality level request.
|
||||||
|
*/
|
||||||
extern int vorbis_encode_init_vbr(vorbis_info *vi,
|
extern int vorbis_encode_init_vbr(vorbis_info *vi,
|
||||||
long channels,
|
long channels,
|
||||||
long rate,
|
long rate,
|
||||||
|
|
||||||
float base_quality /* quality level from 0. (lo) to 1. (hi) */
|
float base_quality
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function performs the last stage of three-step encoding setup, as
|
||||||
|
* described in the API overview under managed bitrate modes.
|
||||||
|
*
|
||||||
|
* Before this function is called, the \ref vorbis_info struct should be
|
||||||
|
* initialized by using vorbis_info_init() from the libvorbis API, one of
|
||||||
|
* \ref vorbis_encode_setup_managed() or \ref vorbis_encode_setup_vbr() called to
|
||||||
|
* initialize the high-level encoding setup, and \ref vorbis_encode_ctl()
|
||||||
|
* called if necessary to make encoding setup changes.
|
||||||
|
* vorbis_encode_setup_init() finalizes the highlevel encoding structure into
|
||||||
|
* a complete encoding setup after which the application may make no further
|
||||||
|
* setup changes.
|
||||||
|
*
|
||||||
|
* After encoding, vorbis_info_clear() should be called.
|
||||||
|
*
|
||||||
|
* \param vi Pointer to an initialized \ref vorbis_info struct.
|
||||||
|
*
|
||||||
|
* \return Zero for success, and negative values for failure.
|
||||||
|
*
|
||||||
|
* \retval 0 Success.
|
||||||
|
* \retval OV_EFAULT Internal logic fault; indicates a bug or heap/stack corruption.
|
||||||
|
*
|
||||||
|
* \retval OV_EINVAL Attempt to use vorbis_encode_setup_init() without first
|
||||||
|
* calling one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr() to
|
||||||
|
* initialize the high-level encoding setup
|
||||||
|
*
|
||||||
|
*/
|
||||||
extern int vorbis_encode_setup_init(vorbis_info *vi);
|
extern int vorbis_encode_setup_init(vorbis_info *vi);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function implements a generic interface to miscellaneous encoder
|
||||||
|
* settings similar to the classic UNIX 'ioctl()' system call. Applications
|
||||||
|
* may use vorbis_encode_ctl() to query or set bitrate management or quality
|
||||||
|
* mode details by using one of several \e request arguments detailed below.
|
||||||
|
* vorbis_encode_ctl() must be called after one of
|
||||||
|
* vorbis_encode_setup_managed() or vorbis_encode_setup_vbr(). When used
|
||||||
|
* to modify settings, \ref vorbis_encode_ctl() must be called before \ref
|
||||||
|
* vorbis_encode_setup_init().
|
||||||
|
*
|
||||||
|
* \param vi Pointer to an initialized vorbis_info struct.
|
||||||
|
*
|
||||||
|
* \param number Specifies the desired action; See \ref encctlcodes "the list
|
||||||
|
* of available requests".
|
||||||
|
*
|
||||||
|
* \param arg void * pointing to a data structure matching the request
|
||||||
|
* argument.
|
||||||
|
*
|
||||||
|
* \retval 0 Success. Any further return information (such as the result of a
|
||||||
|
* query) is placed into the storage pointed to by *arg.
|
||||||
|
*
|
||||||
|
* \retval OV_EINVAL Invalid argument, or an attempt to modify a setting after
|
||||||
|
* calling vorbis_encode_setup_init().
|
||||||
|
*
|
||||||
|
* \retval OV_EIMPL Unimplemented or unknown request
|
||||||
|
*/
|
||||||
extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
|
extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
|
||||||
|
|
||||||
/* deprecated rate management supported only for compatability */
|
/**
|
||||||
#define OV_ECTL_RATEMANAGE_GET 0x10
|
* \deprecated This is a deprecated interface. Please use vorbis_encode_ctl()
|
||||||
#define OV_ECTL_RATEMANAGE_SET 0x11
|
* with the \ref ovectl_ratemanage2_arg struct and \ref
|
||||||
#define OV_ECTL_RATEMANAGE_AVG 0x12
|
* OV_ECTL_RATEMANAGE2_GET and \ref OV_ECTL_RATEMANAGE2_SET calls in new code.
|
||||||
#define OV_ECTL_RATEMANAGE_HARD 0x13
|
*
|
||||||
|
* The \ref ovectl_ratemanage_arg structure is used with vorbis_encode_ctl()
|
||||||
|
* and the \ref OV_ECTL_RATEMANAGE_GET, \ref OV_ECTL_RATEMANAGE_SET, \ref
|
||||||
|
* OV_ECTL_RATEMANAGE_AVG, \ref OV_ECTL_RATEMANAGE_HARD calls in order to
|
||||||
|
* query and modify specifics of the encoder's bitrate management
|
||||||
|
* configuration.
|
||||||
|
*/
|
||||||
struct ovectl_ratemanage_arg {
|
struct ovectl_ratemanage_arg {
|
||||||
int management_active;
|
int management_active; /**< nonzero if bitrate management is active*/
|
||||||
|
/** hard lower limit (in kilobits per second) below which the stream bitrate
|
||||||
|
will never be allowed for any given bitrate_hard_window seconds of time.*/
|
||||||
long bitrate_hard_min;
|
long bitrate_hard_min;
|
||||||
|
/** hard upper limit (in kilobits per second) above which the stream bitrate
|
||||||
|
will never be allowed for any given bitrate_hard_window seconds of time.*/
|
||||||
long bitrate_hard_max;
|
long bitrate_hard_max;
|
||||||
|
/** the window period (in seconds) used to regulate the hard bitrate minimum
|
||||||
|
and maximum*/
|
||||||
double bitrate_hard_window;
|
double bitrate_hard_window;
|
||||||
|
/** soft lower limit (in kilobits per second) below which the average bitrate
|
||||||
|
tracker will start nudging the bitrate higher.*/
|
||||||
long bitrate_av_lo;
|
long bitrate_av_lo;
|
||||||
|
/** soft upper limit (in kilobits per second) above which the average bitrate
|
||||||
|
tracker will start nudging the bitrate lower.*/
|
||||||
long bitrate_av_hi;
|
long bitrate_av_hi;
|
||||||
|
/** the window period (in seconds) used to regulate the average bitrate
|
||||||
|
minimum and maximum.*/
|
||||||
double bitrate_av_window;
|
double bitrate_av_window;
|
||||||
|
/** Regulates the relative centering of the average and hard windows; in
|
||||||
|
libvorbis 1.0 and 1.0.1, the hard window regulation overlapped but
|
||||||
|
followed the average window regulation. In libvorbis 1.1 a bit-reservoir
|
||||||
|
interface replaces the old windowing interface; the older windowing
|
||||||
|
interface is simulated and this field has no effect.*/
|
||||||
double bitrate_av_window_center;
|
double bitrate_av_window_center;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
/* new rate setup */
|
* \name struct ovectl_ratemanage2_arg
|
||||||
#define OV_ECTL_RATEMANAGE2_GET 0x14
|
*
|
||||||
#define OV_ECTL_RATEMANAGE2_SET 0x15
|
* The ovectl_ratemanage2_arg structure is used with vorbis_encode_ctl() and
|
||||||
|
* the OV_ECTL_RATEMANAGE2_GET and OV_ECTL_RATEMANAGE2_SET calls in order to
|
||||||
|
* query and modify specifics of the encoder's bitrate management
|
||||||
|
* configuration.
|
||||||
|
*
|
||||||
|
*/
|
||||||
struct ovectl_ratemanage2_arg {
|
struct ovectl_ratemanage2_arg {
|
||||||
int management_active;
|
int management_active; /**< nonzero if bitrate management is active */
|
||||||
|
/** Lower allowed bitrate limit in kilobits per second */
|
||||||
long bitrate_limit_min_kbps;
|
long bitrate_limit_min_kbps;
|
||||||
|
/** Upper allowed bitrate limit in kilobits per second */
|
||||||
long bitrate_limit_max_kbps;
|
long bitrate_limit_max_kbps;
|
||||||
long bitrate_limit_reservoir_bits;
|
long bitrate_limit_reservoir_bits; /**<Size of the bitrate reservoir in bits */
|
||||||
|
/** Regulates the bitrate reservoir's preferred fill level in a range from 0.0
|
||||||
|
* to 1.0; 0.0 tries to bank bits to buffer against future bitrate spikes, 1.0
|
||||||
|
* buffers against future sudden drops in instantaneous bitrate. Default is
|
||||||
|
* 0.1
|
||||||
|
*/
|
||||||
double bitrate_limit_reservoir_bias;
|
double bitrate_limit_reservoir_bias;
|
||||||
|
/** Average bitrate setting in kilobits per second */
|
||||||
long bitrate_average_kbps;
|
long bitrate_average_kbps;
|
||||||
|
/** Slew rate limit setting for average bitrate adjustment; sets the minimum
|
||||||
|
* time in seconds the bitrate tracker may swing from one extreme to the
|
||||||
|
* other when boosting or damping average bitrate.
|
||||||
|
*/
|
||||||
double bitrate_average_damping;
|
double bitrate_average_damping;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \name vorbis_encode_ctl() codes
|
||||||
|
*
|
||||||
|
* \anchor encctlcodes
|
||||||
|
*
|
||||||
|
* These values are passed as the \c number parameter of vorbis_encode_ctl().
|
||||||
|
* The type of the referent of that function's \c arg pointer depends on these
|
||||||
|
* codes.
|
||||||
|
*/
|
||||||
|
/*@{*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query the current encoder bitrate management setting.
|
||||||
|
*
|
||||||
|
*Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
|
||||||
|
*
|
||||||
|
* Used to query the current encoder bitrate management setting. Also used to
|
||||||
|
* initialize fields of an ovectl_ratemanage2_arg structure for use with
|
||||||
|
* \ref OV_ECTL_RATEMANAGE2_SET.
|
||||||
|
*/
|
||||||
|
#define OV_ECTL_RATEMANAGE2_GET 0x14
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current encoder bitrate management settings.
|
||||||
|
*
|
||||||
|
* Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
|
||||||
|
*
|
||||||
|
* Used to set the current encoder bitrate management settings to the values
|
||||||
|
* listed in the ovectl_ratemanage2_arg. Passing a NULL pointer will disable
|
||||||
|
* bitrate management.
|
||||||
|
*/
|
||||||
|
#define OV_ECTL_RATEMANAGE2_SET 0x15
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current encoder hard-lowpass setting (kHz) in the double
|
||||||
|
* pointed to by arg.
|
||||||
|
*
|
||||||
|
* Argument: <tt>double *</tt>
|
||||||
|
*/
|
||||||
#define OV_ECTL_LOWPASS_GET 0x20
|
#define OV_ECTL_LOWPASS_GET 0x20
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the encoder hard-lowpass to the value (kHz) pointed to by arg. Valid
|
||||||
|
* lowpass settings range from 2 to 99.
|
||||||
|
*
|
||||||
|
* Argument: <tt>double *</tt>
|
||||||
|
*/
|
||||||
#define OV_ECTL_LOWPASS_SET 0x21
|
#define OV_ECTL_LOWPASS_SET 0x21
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current encoder impulse block setting in the double pointed
|
||||||
|
* to by arg.
|
||||||
|
*
|
||||||
|
* Argument: <tt>double *</tt>
|
||||||
|
*/
|
||||||
#define OV_ECTL_IBLOCK_GET 0x30
|
#define OV_ECTL_IBLOCK_GET 0x30
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the impulse block bias to the the value pointed to by arg.
|
||||||
|
*
|
||||||
|
* Argument: <tt>double *</tt>
|
||||||
|
*
|
||||||
|
* Valid range is -15.0 to 0.0 [default]. A negative impulse block bias will
|
||||||
|
* direct to encoder to use more bits when incoding short blocks that contain
|
||||||
|
* strong impulses, thus improving the accuracy of impulse encoding.
|
||||||
|
*/
|
||||||
#define OV_ECTL_IBLOCK_SET 0x31
|
#define OV_ECTL_IBLOCK_SET 0x31
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the current encoder coupling setting in the int pointed
|
||||||
|
* to by arg.
|
||||||
|
*
|
||||||
|
* Argument: <tt>int *</tt>
|
||||||
|
*/
|
||||||
|
#define OV_ECTL_COUPLING_GET 0x40
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables/disables channel coupling in multichannel encoding according to arg.
|
||||||
|
*
|
||||||
|
* Argument: <tt>int *</tt>
|
||||||
|
*
|
||||||
|
* Zero disables channel coupling for multichannel inputs, nonzer enables
|
||||||
|
* channel coupling. Setting has no effect on monophonic encoding or
|
||||||
|
* multichannel counts that do not offer coupling. At present, coupling is
|
||||||
|
* available for stereo and 5.1 encoding.
|
||||||
|
*/
|
||||||
|
#define OV_ECTL_COUPLING_SET 0x41
|
||||||
|
|
||||||
|
/* deprecated rate management supported only for compatibility */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Old interface to querying bitrate management settings.
|
||||||
|
*
|
||||||
|
* Deprecated after move to bit-reservoir style management in 1.1 rendered
|
||||||
|
* this interface partially obsolete.
|
||||||
|
|
||||||
|
* \deprecated Please use \ref OV_ECTL_RATEMANAGE2_GET instead.
|
||||||
|
*
|
||||||
|
* Argument: <tt>struct ovectl_ratemanage_arg *</tt>
|
||||||
|
*/
|
||||||
|
#define OV_ECTL_RATEMANAGE_GET 0x10
|
||||||
|
/**
|
||||||
|
* Old interface to modifying bitrate management settings.
|
||||||
|
*
|
||||||
|
* deprecated after move to bit-reservoir style management in 1.1 rendered
|
||||||
|
* this interface partially obsolete.
|
||||||
|
*
|
||||||
|
* \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
|
||||||
|
*
|
||||||
|
* Argument: <tt>struct ovectl_ratemanage_arg *</tt>
|
||||||
|
*/
|
||||||
|
#define OV_ECTL_RATEMANAGE_SET 0x11
|
||||||
|
/**
|
||||||
|
* Old interface to setting average-bitrate encoding mode.
|
||||||
|
*
|
||||||
|
* Deprecated after move to bit-reservoir style management in 1.1 rendered
|
||||||
|
* this interface partially obsolete.
|
||||||
|
*
|
||||||
|
* \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
|
||||||
|
*
|
||||||
|
* Argument: <tt>struct ovectl_ratemanage_arg *</tt>
|
||||||
|
*/
|
||||||
|
#define OV_ECTL_RATEMANAGE_AVG 0x12
|
||||||
|
/**
|
||||||
|
* Old interface to setting bounded-bitrate encoding modes.
|
||||||
|
*
|
||||||
|
* deprecated after move to bit-reservoir style management in 1.1 rendered
|
||||||
|
* this interface partially obsolete.
|
||||||
|
*
|
||||||
|
* \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
|
||||||
|
*
|
||||||
|
* Argument: <tt>struct ovectl_ratemanage_arg *</tt>
|
||||||
|
*/
|
||||||
|
#define OV_ECTL_RATEMANAGE_HARD 0x13
|
||||||
|
|
||||||
|
/*@}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: stdio-based convenience library for opening/seeking/decoding
|
function: stdio-based convenience library for opening/seeking/decoding
|
||||||
last mod: $Id: vorbisfile.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -43,6 +43,65 @@ typedef struct {
|
||||||
long (*tell_func) (void *datasource);
|
long (*tell_func) (void *datasource);
|
||||||
} ov_callbacks;
|
} ov_callbacks;
|
||||||
|
|
||||||
|
#ifndef OV_EXCLUDE_STATIC_CALLBACKS
|
||||||
|
|
||||||
|
/* a few sets of convenient callbacks, especially for use under
|
||||||
|
* Windows where ov_open_callbacks() should always be used instead of
|
||||||
|
* ov_open() to avoid problems with incompatible crt.o version linking
|
||||||
|
* issues. */
|
||||||
|
|
||||||
|
static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
|
||||||
|
if(f==NULL)return(-1);
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
return fseeko64(f,off,whence);
|
||||||
|
#elif defined (_WIN32)
|
||||||
|
return _fseeki64(f,off,whence);
|
||||||
|
#else
|
||||||
|
return fseek(f,off,whence);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
|
||||||
|
* static data. That means that every file which includes this header
|
||||||
|
* will get its own copy of these structs whether it uses them or
|
||||||
|
* not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS.
|
||||||
|
* These static symbols are essential on platforms such as Windows on
|
||||||
|
* which several different versions of stdio support may be linked to
|
||||||
|
* by different DLLs, and we need to be certain we know which one
|
||||||
|
* we're using (the same one as the main application).
|
||||||
|
*/
|
||||||
|
|
||||||
|
static ov_callbacks OV_CALLBACKS_DEFAULT = {
|
||||||
|
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||||
|
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
|
||||||
|
(int (*)(void *)) fclose,
|
||||||
|
(long (*)(void *)) ftell
|
||||||
|
};
|
||||||
|
|
||||||
|
static ov_callbacks OV_CALLBACKS_NOCLOSE = {
|
||||||
|
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||||
|
(int (*)(void *, ogg_int64_t, int)) _ov_header_fseek_wrap,
|
||||||
|
(int (*)(void *)) NULL,
|
||||||
|
(long (*)(void *)) ftell
|
||||||
|
};
|
||||||
|
|
||||||
|
static ov_callbacks OV_CALLBACKS_STREAMONLY = {
|
||||||
|
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||||
|
(int (*)(void *, ogg_int64_t, int)) NULL,
|
||||||
|
(int (*)(void *)) fclose,
|
||||||
|
(long (*)(void *)) NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
|
||||||
|
(size_t (*)(void *, size_t, size_t, void *)) fread,
|
||||||
|
(int (*)(void *, ogg_int64_t, int)) NULL,
|
||||||
|
(int (*)(void *)) NULL,
|
||||||
|
(long (*)(void *)) NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NOTOPEN 0
|
#define NOTOPEN 0
|
||||||
#define PARTOPEN 1
|
#define PARTOPEN 1
|
||||||
#define OPENED 2
|
#define OPENED 2
|
||||||
|
|
@ -63,8 +122,8 @@ typedef struct OggVorbis_File {
|
||||||
ogg_int64_t *dataoffsets;
|
ogg_int64_t *dataoffsets;
|
||||||
long *serialnos;
|
long *serialnos;
|
||||||
ogg_int64_t *pcmlengths; /* overloaded to maintain binary
|
ogg_int64_t *pcmlengths; /* overloaded to maintain binary
|
||||||
compatability; x2 size, stores both
|
compatibility; x2 size, stores both
|
||||||
beginning and end values */
|
beginning and end values */
|
||||||
vorbis_info *vi;
|
vorbis_info *vi;
|
||||||
vorbis_comment *vc;
|
vorbis_comment *vc;
|
||||||
|
|
||||||
|
|
@ -88,14 +147,14 @@ typedef struct OggVorbis_File {
|
||||||
|
|
||||||
|
|
||||||
extern int ov_clear(OggVorbis_File *vf);
|
extern int ov_clear(OggVorbis_File *vf);
|
||||||
extern int ov_fopen(char *path,OggVorbis_File *vf);
|
extern int ov_fopen(const char *path,OggVorbis_File *vf);
|
||||||
extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
|
extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
|
||||||
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
|
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
|
||||||
char *initial, long ibytes, ov_callbacks callbacks);
|
const char *initial, long ibytes, ov_callbacks callbacks);
|
||||||
|
|
||||||
extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
|
extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
|
||||||
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
|
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
|
||||||
char *initial, long ibytes, ov_callbacks callbacks);
|
const char *initial, long ibytes, ov_callbacks callbacks);
|
||||||
extern int ov_test_open(OggVorbis_File *vf);
|
extern int ov_test_open(OggVorbis_File *vf);
|
||||||
|
|
||||||
extern long ov_bitrate(OggVorbis_File *vf,int i);
|
extern long ov_bitrate(OggVorbis_File *vf,int i);
|
||||||
|
|
@ -128,9 +187,12 @@ extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
|
||||||
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
|
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
|
||||||
|
|
||||||
extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
|
extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
|
||||||
int *bitstream);
|
int *bitstream);
|
||||||
|
extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
|
||||||
|
int bigendianp,int word,int sgned,int *bitstream,
|
||||||
|
void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param);
|
||||||
extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
|
extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
|
||||||
int bigendianp,int word,int sgned,int *bitstream);
|
int bigendianp,int word,int sgned,int *bitstream);
|
||||||
extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
|
extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
|
||||||
|
|
||||||
extern int ov_halfrate(OggVorbis_File *vf,int flag);
|
extern int ov_halfrate(OggVorbis_File *vf,int flag);
|
||||||
|
|
@ -142,4 +204,3 @@ extern int ov_halfrate_p(OggVorbis_File *vf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: single-block PCM analysis mode dispatch
|
function: single-block PCM analysis mode dispatch
|
||||||
last mod: $Id: analysis.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -26,8 +26,6 @@
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
int analysis_noisy=1;
|
|
||||||
|
|
||||||
/* decides between modes, dispatches to the appropriate mapping. */
|
/* decides between modes, dispatches to the appropriate mapping. */
|
||||||
int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
|
int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
|
||||||
int ret,i;
|
int ret,i;
|
||||||
|
|
@ -65,49 +63,50 @@ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ANALYSIS
|
||||||
|
int analysis_noisy=1;
|
||||||
|
|
||||||
/* there was no great place to put this.... */
|
/* there was no great place to put this.... */
|
||||||
void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){
|
void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){
|
||||||
int j;
|
int j;
|
||||||
FILE *of;
|
FILE *of;
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
|
|
||||||
/* if(i==5870){*/
|
sprintf(buffer,"%s_%d.m",base,i);
|
||||||
sprintf(buffer,"%s_%d.m",base,i);
|
of=fopen(buffer,"w");
|
||||||
of=fopen(buffer,"w");
|
|
||||||
|
|
||||||
if(!of)perror("failed to open data dump file");
|
if(!of)perror("failed to open data dump file");
|
||||||
|
|
||||||
for(j=0;j<n;j++){
|
for(j=0;j<n;j++){
|
||||||
if(bark){
|
if(bark){
|
||||||
float b=toBARK((4000.f*j/n)+.25);
|
float b=toBARK((4000.f*j/n)+.25);
|
||||||
fprintf(of,"%f ",b);
|
fprintf(of,"%f ",b);
|
||||||
}else
|
}else
|
||||||
if(off!=0)
|
if(off!=0)
|
||||||
fprintf(of,"%f ",(double)(j+off)/8000.);
|
fprintf(of,"%f ",(double)(j+off)/8000.);
|
||||||
else
|
else
|
||||||
fprintf(of,"%f ",(double)j);
|
fprintf(of,"%f ",(double)j);
|
||||||
|
|
||||||
if(dB){
|
if(dB){
|
||||||
float val;
|
float val;
|
||||||
if(v[j]==0.)
|
if(v[j]==0.)
|
||||||
val=-140.;
|
val=-140.;
|
||||||
else
|
else
|
||||||
val=todB(v+j);
|
val=todB(v+j);
|
||||||
fprintf(of,"%f\n",val);
|
fprintf(of,"%f\n",val);
|
||||||
}else{
|
}else{
|
||||||
fprintf(of,"%f\n",v[j]);
|
fprintf(of,"%f\n",v[j]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fclose(of);
|
}
|
||||||
/* } */
|
fclose(of);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
|
void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
|
||||||
ogg_int64_t off){
|
ogg_int64_t off){
|
||||||
if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off);
|
if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,14 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: libvorbis backend and mapping structures; needed for
|
function: libvorbis backend and mapping structures; needed for
|
||||||
static mode headers
|
static mode headers
|
||||||
last mod: $Id: backends.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -35,7 +35,7 @@ typedef struct{
|
||||||
void (*free_look) (vorbis_look_floor *);
|
void (*free_look) (vorbis_look_floor *);
|
||||||
void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
|
void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
|
||||||
int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
|
int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
|
||||||
void *buffer,float *);
|
void *buffer,float *);
|
||||||
} vorbis_func_floor;
|
} vorbis_func_floor;
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
|
|
@ -89,16 +89,16 @@ typedef struct{
|
||||||
void (*pack) (vorbis_info_residue *,oggpack_buffer *);
|
void (*pack) (vorbis_info_residue *,oggpack_buffer *);
|
||||||
vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
|
vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
|
||||||
vorbis_look_residue *(*look) (vorbis_dsp_state *,
|
vorbis_look_residue *(*look) (vorbis_dsp_state *,
|
||||||
vorbis_info_residue *);
|
vorbis_info_residue *);
|
||||||
void (*free_info) (vorbis_info_residue *);
|
void (*free_info) (vorbis_info_residue *);
|
||||||
void (*free_look) (vorbis_look_residue *);
|
void (*free_look) (vorbis_look_residue *);
|
||||||
long **(*class) (struct vorbis_block *,vorbis_look_residue *,
|
long **(*class) (struct vorbis_block *,vorbis_look_residue *,
|
||||||
float **,int *,int);
|
int **,int *,int);
|
||||||
int (*forward) (oggpack_buffer *,struct vorbis_block *,
|
int (*forward) (oggpack_buffer *,struct vorbis_block *,
|
||||||
vorbis_look_residue *,
|
vorbis_look_residue *,
|
||||||
float **,float **,int *,int,long **);
|
int **,int *,int,long **,int);
|
||||||
int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
|
int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
|
||||||
float **,int *,int);
|
float **,int *,int);
|
||||||
} vorbis_func_residue;
|
} vorbis_func_residue;
|
||||||
|
|
||||||
typedef struct vorbis_info_residue0{
|
typedef struct vorbis_info_residue0{
|
||||||
|
|
@ -109,19 +109,19 @@ typedef struct vorbis_info_residue0{
|
||||||
/* first stage (lossless partitioning) */
|
/* first stage (lossless partitioning) */
|
||||||
int grouping; /* group n vectors per partition */
|
int grouping; /* group n vectors per partition */
|
||||||
int partitions; /* possible codebooks for a partition */
|
int partitions; /* possible codebooks for a partition */
|
||||||
|
int partvals; /* partitions ^ groupbook dim */
|
||||||
int groupbook; /* huffbook for partitioning */
|
int groupbook; /* huffbook for partitioning */
|
||||||
int secondstages[64]; /* expanded out to pointers in lookup */
|
int secondstages[64]; /* expanded out to pointers in lookup */
|
||||||
int booklist[256]; /* list of second stage books */
|
int booklist[512]; /* list of second stage books */
|
||||||
|
|
||||||
float classmetric1[64];
|
|
||||||
float classmetric2[64];
|
|
||||||
|
|
||||||
|
const int classmetric1[64];
|
||||||
|
const int classmetric2[64];
|
||||||
} vorbis_info_residue0;
|
} vorbis_info_residue0;
|
||||||
|
|
||||||
/* Mapping backend generic *****************************************/
|
/* Mapping backend generic *****************************************/
|
||||||
typedef struct{
|
typedef struct{
|
||||||
void (*pack) (vorbis_info *,vorbis_info_mapping *,
|
void (*pack) (vorbis_info *,vorbis_info_mapping *,
|
||||||
oggpack_buffer *);
|
oggpack_buffer *);
|
||||||
vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
|
vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
|
||||||
void (*free_info) (vorbis_info_mapping *);
|
void (*free_info) (vorbis_info_mapping *);
|
||||||
int (*forward) (struct vorbis_block *vb);
|
int (*forward) (struct vorbis_block *vb);
|
||||||
|
|
@ -142,5 +142,3 @@ typedef struct vorbis_info_mapping0{
|
||||||
} vorbis_info_mapping0;
|
} vorbis_info_mapping0;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: bitrate tracking and management
|
function: bitrate tracking and management
|
||||||
last mod: $Id: bitrate.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: bitrate.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -91,7 +91,7 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
||||||
buffer the packet to keep the code path clean */
|
buffer the packet to keep the code path clean */
|
||||||
|
|
||||||
if(bm->vb)return(-1); /* one has been submitted without
|
if(bm->vb)return(-1); /* one has been submitted without
|
||||||
being claimed */
|
being claimed */
|
||||||
bm->vb=vb;
|
bm->vb=vb;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
@ -117,15 +117,15 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
||||||
|
|
||||||
if(bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){
|
if(bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){
|
||||||
while(choice>0 && this_bits>avg_target_bits &&
|
while(choice>0 && this_bits>avg_target_bits &&
|
||||||
bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){
|
bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){
|
||||||
choice--;
|
choice--;
|
||||||
this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
|
this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
|
||||||
}
|
}
|
||||||
}else if(bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){
|
}else if(bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){
|
||||||
while(choice+1<PACKETBLOBS && this_bits<avg_target_bits &&
|
while(choice+1<PACKETBLOBS && this_bits<avg_target_bits &&
|
||||||
bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){
|
bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){
|
||||||
choice++;
|
choice++;
|
||||||
this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
|
this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -143,9 +143,9 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
||||||
/* do we need to force the bitrate up? */
|
/* do we need to force the bitrate up? */
|
||||||
if(this_bits<min_target_bits){
|
if(this_bits<min_target_bits){
|
||||||
while(bm->minmax_reservoir-(min_target_bits-this_bits)<0){
|
while(bm->minmax_reservoir-(min_target_bits-this_bits)<0){
|
||||||
choice++;
|
choice++;
|
||||||
if(choice>=PACKETBLOBS)break;
|
if(choice>=PACKETBLOBS)break;
|
||||||
this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
|
this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -155,9 +155,9 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
||||||
/* do we need to force the bitrate down? */
|
/* do we need to force the bitrate down? */
|
||||||
if(this_bits>max_target_bits){
|
if(this_bits>max_target_bits){
|
||||||
while(bm->minmax_reservoir+(this_bits-max_target_bits)>bi->reservoir_bits){
|
while(bm->minmax_reservoir+(this_bits-max_target_bits)>bi->reservoir_bits){
|
||||||
choice--;
|
choice--;
|
||||||
if(choice<0)break;
|
if(choice<0)break;
|
||||||
this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
|
this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -201,19 +201,19 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
||||||
}else{
|
}else{
|
||||||
/* inbetween; we want to take reservoir toward but not past desired_fill */
|
/* inbetween; we want to take reservoir toward but not past desired_fill */
|
||||||
if(bm->minmax_reservoir>desired_fill){
|
if(bm->minmax_reservoir>desired_fill){
|
||||||
if(max_target_bits>0){ /* logical bulletproofing against initialization state */
|
if(max_target_bits>0){ /* logical bulletproofing against initialization state */
|
||||||
bm->minmax_reservoir+=(this_bits-max_target_bits);
|
bm->minmax_reservoir+=(this_bits-max_target_bits);
|
||||||
if(bm->minmax_reservoir<desired_fill)bm->minmax_reservoir=desired_fill;
|
if(bm->minmax_reservoir<desired_fill)bm->minmax_reservoir=desired_fill;
|
||||||
}else{
|
}else{
|
||||||
bm->minmax_reservoir=desired_fill;
|
bm->minmax_reservoir=desired_fill;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(min_target_bits>0){ /* logical bulletproofing against initialization state */
|
if(min_target_bits>0){ /* logical bulletproofing against initialization state */
|
||||||
bm->minmax_reservoir+=(this_bits-min_target_bits);
|
bm->minmax_reservoir+=(this_bits-min_target_bits);
|
||||||
if(bm->minmax_reservoir>desired_fill)bm->minmax_reservoir=desired_fill;
|
if(bm->minmax_reservoir>desired_fill)bm->minmax_reservoir=desired_fill;
|
||||||
}else{
|
}else{
|
||||||
bm->minmax_reservoir=desired_fill;
|
bm->minmax_reservoir=desired_fill;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: PCM data vector blocking, windowing and dis/reassembly
|
function: PCM data vector blocking, windowing and dis/reassembly
|
||||||
last mod: $Id: block.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: block.c 17561 2010-10-23 10:34:24Z xiphmont $
|
||||||
|
|
||||||
Handle windowing, overlap-add, etc of the PCM vectors. This is made
|
Handle windowing, overlap-add, etc of the PCM vectors. This is made
|
||||||
more amusing by Vorbis' current two allowed block sizes.
|
more amusing by Vorbis' current two allowed block sizes.
|
||||||
|
|
@ -75,8 +75,8 @@ static int ilog2(unsigned int v){
|
||||||
| | |endSr
|
| | |endSr
|
||||||
| |beginSr
|
| |beginSr
|
||||||
| |endSl
|
| |endSl
|
||||||
|beginSl
|
|beginSl
|
||||||
|beginW
|
|beginW
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* block abstraction setup *********************************************/
|
/* block abstraction setup *********************************************/
|
||||||
|
|
@ -98,10 +98,10 @@ int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
|
||||||
|
|
||||||
for(i=0;i<PACKETBLOBS;i++){
|
for(i=0;i<PACKETBLOBS;i++){
|
||||||
if(i==PACKETBLOBS/2){
|
if(i==PACKETBLOBS/2){
|
||||||
vbi->packetblob[i]=&vb->opb;
|
vbi->packetblob[i]=&vb->opb;
|
||||||
}else{
|
}else{
|
||||||
vbi->packetblob[i]=
|
vbi->packetblob[i]=
|
||||||
_ogg_calloc(1,sizeof(oggpack_buffer));
|
_ogg_calloc(1,sizeof(oggpack_buffer));
|
||||||
}
|
}
|
||||||
oggpack_writeinit(vbi->packetblob[i]);
|
oggpack_writeinit(vbi->packetblob[i]);
|
||||||
}
|
}
|
||||||
|
|
@ -217,16 +217,16 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
|
||||||
if(!ci->fullbooks){
|
if(!ci->fullbooks){
|
||||||
ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
|
ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
|
||||||
for(i=0;i<ci->books;i++)
|
for(i=0;i<ci->books;i++)
|
||||||
vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]);
|
vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
b->psy=_ogg_calloc(ci->psys,sizeof(*b->psy));
|
b->psy=_ogg_calloc(ci->psys,sizeof(*b->psy));
|
||||||
for(i=0;i<ci->psys;i++){
|
for(i=0;i<ci->psys;i++){
|
||||||
_vp_psy_init(b->psy+i,
|
_vp_psy_init(b->psy+i,
|
||||||
ci->psy_param[i],
|
ci->psy_param[i],
|
||||||
&ci->psy_g_param,
|
&ci->psy_g_param,
|
||||||
ci->blocksizes[ci->psy_param[i]->blockflag]/2,
|
ci->blocksizes[ci->psy_param[i]->blockflag]/2,
|
||||||
vi->rate);
|
vi->rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
v->analysisp=1;
|
v->analysisp=1;
|
||||||
|
|
@ -235,10 +235,13 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
|
||||||
if(!ci->fullbooks){
|
if(!ci->fullbooks){
|
||||||
ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
|
ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
|
||||||
for(i=0;i<ci->books;i++){
|
for(i=0;i<ci->books;i++){
|
||||||
vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]);
|
if(ci->book_param[i]==NULL)
|
||||||
/* decode codebooks are now standalone after init */
|
goto abort_books;
|
||||||
vorbis_staticbook_destroy(ci->book_param[i]);
|
if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]))
|
||||||
ci->book_param[i]=NULL;
|
goto abort_books;
|
||||||
|
/* decode codebooks are now standalone after init */
|
||||||
|
vorbis_staticbook_destroy(ci->book_param[i]);
|
||||||
|
ci->book_param[i]=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -277,6 +280,15 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
|
||||||
look(v,ci->residue_param[i]);
|
look(v,ci->residue_param[i]);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
abort_books:
|
||||||
|
for(i=0;i<ci->books;i++){
|
||||||
|
if(ci->book_param[i]!=NULL){
|
||||||
|
vorbis_staticbook_destroy(ci->book_param[i]);
|
||||||
|
ci->book_param[i]=NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vorbis_dsp_clear(v);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* arbitrary settings and spec-mandated numbers get filled in here */
|
/* arbitrary settings and spec-mandated numbers get filled in here */
|
||||||
|
|
@ -310,40 +322,40 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
|
||||||
if(b){
|
if(b){
|
||||||
|
|
||||||
if(b->ve){
|
if(b->ve){
|
||||||
_ve_envelope_clear(b->ve);
|
_ve_envelope_clear(b->ve);
|
||||||
_ogg_free(b->ve);
|
_ogg_free(b->ve);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(b->transform[0]){
|
if(b->transform[0]){
|
||||||
mdct_clear(b->transform[0][0]);
|
mdct_clear(b->transform[0][0]);
|
||||||
_ogg_free(b->transform[0][0]);
|
_ogg_free(b->transform[0][0]);
|
||||||
_ogg_free(b->transform[0]);
|
_ogg_free(b->transform[0]);
|
||||||
}
|
}
|
||||||
if(b->transform[1]){
|
if(b->transform[1]){
|
||||||
mdct_clear(b->transform[1][0]);
|
mdct_clear(b->transform[1][0]);
|
||||||
_ogg_free(b->transform[1][0]);
|
_ogg_free(b->transform[1][0]);
|
||||||
_ogg_free(b->transform[1]);
|
_ogg_free(b->transform[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(b->flr){
|
if(b->flr){
|
||||||
if(ci)
|
if(ci)
|
||||||
for(i=0;i<ci->floors;i++)
|
for(i=0;i<ci->floors;i++)
|
||||||
_floor_P[ci->floor_type[i]]->
|
_floor_P[ci->floor_type[i]]->
|
||||||
free_look(b->flr[i]);
|
free_look(b->flr[i]);
|
||||||
_ogg_free(b->flr);
|
_ogg_free(b->flr);
|
||||||
}
|
}
|
||||||
if(b->residue){
|
if(b->residue){
|
||||||
if(ci)
|
if(ci)
|
||||||
for(i=0;i<ci->residues;i++)
|
for(i=0;i<ci->residues;i++)
|
||||||
_residue_P[ci->residue_type[i]]->
|
_residue_P[ci->residue_type[i]]->
|
||||||
free_look(b->residue[i]);
|
free_look(b->residue[i]);
|
||||||
_ogg_free(b->residue);
|
_ogg_free(b->residue);
|
||||||
}
|
}
|
||||||
if(b->psy){
|
if(b->psy){
|
||||||
if(ci)
|
if(ci)
|
||||||
for(i=0;i<ci->psys;i++)
|
for(i=0;i<ci->psys;i++)
|
||||||
_vp_psy_clear(b->psy+i);
|
_vp_psy_clear(b->psy+i);
|
||||||
_ogg_free(b->psy);
|
_ogg_free(b->psy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(b->psy_g_look)_vp_global_free(b->psy_g_look);
|
if(b->psy_g_look)_vp_global_free(b->psy_g_look);
|
||||||
|
|
@ -356,8 +368,8 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
|
||||||
|
|
||||||
if(v->pcm){
|
if(v->pcm){
|
||||||
if(vi)
|
if(vi)
|
||||||
for(i=0;i<vi->channels;i++)
|
for(i=0;i<vi->channels;i++)
|
||||||
if(v->pcm[i])_ogg_free(v->pcm[i]);
|
if(v->pcm[i])_ogg_free(v->pcm[i]);
|
||||||
_ogg_free(v->pcm);
|
_ogg_free(v->pcm);
|
||||||
if(v->pcmret)_ogg_free(v->pcmret);
|
if(v->pcmret)_ogg_free(v->pcmret);
|
||||||
}
|
}
|
||||||
|
|
@ -403,7 +415,7 @@ float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
|
||||||
|
|
||||||
static void _preextrapolate_helper(vorbis_dsp_state *v){
|
static void _preextrapolate_helper(vorbis_dsp_state *v){
|
||||||
int i;
|
int i;
|
||||||
int order=32;
|
int order=16;
|
||||||
float *lpc=alloca(order*sizeof(*lpc));
|
float *lpc=alloca(order*sizeof(*lpc));
|
||||||
float *work=alloca(v->pcm_current*sizeof(*work));
|
float *work=alloca(v->pcm_current*sizeof(*work));
|
||||||
long j;
|
long j;
|
||||||
|
|
@ -413,19 +425,30 @@ static void _preextrapolate_helper(vorbis_dsp_state *v){
|
||||||
for(i=0;i<v->vi->channels;i++){
|
for(i=0;i<v->vi->channels;i++){
|
||||||
/* need to run the extrapolation in reverse! */
|
/* need to run the extrapolation in reverse! */
|
||||||
for(j=0;j<v->pcm_current;j++)
|
for(j=0;j<v->pcm_current;j++)
|
||||||
work[j]=v->pcm[i][v->pcm_current-j-1];
|
work[j]=v->pcm[i][v->pcm_current-j-1];
|
||||||
|
|
||||||
/* prime as above */
|
/* prime as above */
|
||||||
vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order);
|
vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if(v->vi->channels==2){
|
||||||
|
if(i==0)
|
||||||
|
_analysis_output("predataL",0,work,v->pcm_current-v->centerW,0,0,0);
|
||||||
|
else
|
||||||
|
_analysis_output("predataR",0,work,v->pcm_current-v->centerW,0,0,0);
|
||||||
|
}else{
|
||||||
|
_analysis_output("predata",0,work,v->pcm_current-v->centerW,0,0,0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* run the predictor filter */
|
/* run the predictor filter */
|
||||||
vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order,
|
vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order,
|
||||||
order,
|
order,
|
||||||
work+v->pcm_current-v->centerW,
|
work+v->pcm_current-v->centerW,
|
||||||
v->centerW);
|
v->centerW);
|
||||||
|
|
||||||
for(j=0;j<v->pcm_current;j++)
|
for(j=0;j<v->pcm_current;j++)
|
||||||
v->pcm[i][v->pcm_current-j-1]=work[j];
|
v->pcm[i][v->pcm_current-j-1]=work[j];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -459,23 +482,23 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
|
||||||
|
|
||||||
for(i=0;i<vi->channels;i++){
|
for(i=0;i<vi->channels;i++){
|
||||||
if(v->eofflag>order*2){
|
if(v->eofflag>order*2){
|
||||||
/* extrapolate with LPC to fill in */
|
/* extrapolate with LPC to fill in */
|
||||||
long n;
|
long n;
|
||||||
|
|
||||||
/* make a predictor filter */
|
/* make a predictor filter */
|
||||||
n=v->eofflag;
|
n=v->eofflag;
|
||||||
if(n>ci->blocksizes[1])n=ci->blocksizes[1];
|
if(n>ci->blocksizes[1])n=ci->blocksizes[1];
|
||||||
vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order);
|
vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order);
|
||||||
|
|
||||||
/* run the predictor filter */
|
/* run the predictor filter */
|
||||||
vorbis_lpc_predict(lpc,v->pcm[i]+v->eofflag-order,order,
|
vorbis_lpc_predict(lpc,v->pcm[i]+v->eofflag-order,order,
|
||||||
v->pcm[i]+v->eofflag,v->pcm_current-v->eofflag);
|
v->pcm[i]+v->eofflag,v->pcm_current-v->eofflag);
|
||||||
}else{
|
}else{
|
||||||
/* not enough data to extrapolate (unlikely to happen due to
|
/* not enough data to extrapolate (unlikely to happen due to
|
||||||
guarding the overlap, but bulletproof in case that
|
guarding the overlap, but bulletproof in case that
|
||||||
assumtion goes away). zeroes will do. */
|
assumtion goes away). zeroes will do. */
|
||||||
memset(v->pcm[i]+v->eofflag,0,
|
memset(v->pcm[i]+v->eofflag,0,
|
||||||
(v->pcm_current-v->eofflag)*sizeof(*v->pcm[i]));
|
(v->pcm_current-v->eofflag)*sizeof(*v->pcm[i]));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -525,14 +548,14 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
|
||||||
if(bp==-1){
|
if(bp==-1){
|
||||||
|
|
||||||
if(v->eofflag==0)return(0); /* not enough data currently to search for a
|
if(v->eofflag==0)return(0); /* not enough data currently to search for a
|
||||||
full long block */
|
full long block */
|
||||||
v->nW=0;
|
v->nW=0;
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
if(ci->blocksizes[0]==ci->blocksizes[1])
|
if(ci->blocksizes[0]==ci->blocksizes[1])
|
||||||
v->nW=0;
|
v->nW=0;
|
||||||
else
|
else
|
||||||
v->nW=bp;
|
v->nW=bp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -632,8 +655,8 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
|
||||||
v->pcm_current-=movementW;
|
v->pcm_current-=movementW;
|
||||||
|
|
||||||
for(i=0;i<vi->channels;i++)
|
for(i=0;i<vi->channels;i++)
|
||||||
memmove(v->pcm[i],v->pcm[i]+movementW,
|
memmove(v->pcm[i],v->pcm[i]+movementW,
|
||||||
v->pcm_current*sizeof(*v->pcm[i]));
|
v->pcm_current*sizeof(*v->pcm[i]));
|
||||||
|
|
||||||
|
|
||||||
v->lW=v->W;
|
v->lW=v->W;
|
||||||
|
|
@ -641,16 +664,16 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
|
||||||
v->centerW=new_centerNext;
|
v->centerW=new_centerNext;
|
||||||
|
|
||||||
if(v->eofflag){
|
if(v->eofflag){
|
||||||
v->eofflag-=movementW;
|
v->eofflag-=movementW;
|
||||||
if(v->eofflag<=0)v->eofflag=-1;
|
if(v->eofflag<=0)v->eofflag=-1;
|
||||||
/* do not add padding to end of stream! */
|
/* do not add padding to end of stream! */
|
||||||
if(v->centerW>=v->eofflag){
|
if(v->centerW>=v->eofflag){
|
||||||
v->granulepos+=movementW-(v->centerW-v->eofflag);
|
v->granulepos+=movementW-(v->centerW-v->eofflag);
|
||||||
}else{
|
}else{
|
||||||
v->granulepos+=movementW;
|
v->granulepos+=movementW;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
v->granulepos+=movementW;
|
v->granulepos+=movementW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -683,9 +706,11 @@ int vorbis_synthesis_restart(vorbis_dsp_state *v){
|
||||||
}
|
}
|
||||||
|
|
||||||
int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
|
int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
|
||||||
if(_vds_shared_init(v,vi,0)) return 1;
|
if(_vds_shared_init(v,vi,0)){
|
||||||
|
vorbis_dsp_clear(v);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
vorbis_synthesis_restart(v);
|
vorbis_synthesis_restart(v);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -716,7 +741,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
||||||
v->sequence=vb->sequence;
|
v->sequence=vb->sequence;
|
||||||
|
|
||||||
if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly
|
if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly
|
||||||
was called on block */
|
was called on block */
|
||||||
int n=ci->blocksizes[v->W]>>(hs+1);
|
int n=ci->blocksizes[v->W]>>(hs+1);
|
||||||
int n0=ci->blocksizes[0]>>(hs+1);
|
int n0=ci->blocksizes[0]>>(hs+1);
|
||||||
int n1=ci->blocksizes[1]>>(hs+1);
|
int n1=ci->blocksizes[1]>>(hs+1);
|
||||||
|
|
@ -744,47 +769,47 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
||||||
for(j=0;j<vi->channels;j++){
|
for(j=0;j<vi->channels;j++){
|
||||||
/* the overlap/add section */
|
/* the overlap/add section */
|
||||||
if(v->lW){
|
if(v->lW){
|
||||||
if(v->W){
|
if(v->W){
|
||||||
/* large/large */
|
/* large/large */
|
||||||
float *w=_vorbis_window_get(b->window[1]-hs);
|
float *w=_vorbis_window_get(b->window[1]-hs);
|
||||||
float *pcm=v->pcm[j]+prevCenter;
|
float *pcm=v->pcm[j]+prevCenter;
|
||||||
float *p=vb->pcm[j];
|
float *p=vb->pcm[j];
|
||||||
for(i=0;i<n1;i++)
|
for(i=0;i<n1;i++)
|
||||||
pcm[i]=pcm[i]*w[n1-i-1] + p[i]*w[i];
|
pcm[i]=pcm[i]*w[n1-i-1] + p[i]*w[i];
|
||||||
}else{
|
}else{
|
||||||
/* large/small */
|
/* large/small */
|
||||||
float *w=_vorbis_window_get(b->window[0]-hs);
|
float *w=_vorbis_window_get(b->window[0]-hs);
|
||||||
float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
|
float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
|
||||||
float *p=vb->pcm[j];
|
float *p=vb->pcm[j];
|
||||||
for(i=0;i<n0;i++)
|
for(i=0;i<n0;i++)
|
||||||
pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
|
pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(v->W){
|
if(v->W){
|
||||||
/* small/large */
|
/* small/large */
|
||||||
float *w=_vorbis_window_get(b->window[0]-hs);
|
float *w=_vorbis_window_get(b->window[0]-hs);
|
||||||
float *pcm=v->pcm[j]+prevCenter;
|
float *pcm=v->pcm[j]+prevCenter;
|
||||||
float *p=vb->pcm[j]+n1/2-n0/2;
|
float *p=vb->pcm[j]+n1/2-n0/2;
|
||||||
for(i=0;i<n0;i++)
|
for(i=0;i<n0;i++)
|
||||||
pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
|
pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
|
||||||
for(;i<n1/2+n0/2;i++)
|
for(;i<n1/2+n0/2;i++)
|
||||||
pcm[i]=p[i];
|
pcm[i]=p[i];
|
||||||
}else{
|
}else{
|
||||||
/* small/small */
|
/* small/small */
|
||||||
float *w=_vorbis_window_get(b->window[0]-hs);
|
float *w=_vorbis_window_get(b->window[0]-hs);
|
||||||
float *pcm=v->pcm[j]+prevCenter;
|
float *pcm=v->pcm[j]+prevCenter;
|
||||||
float *p=vb->pcm[j];
|
float *p=vb->pcm[j];
|
||||||
for(i=0;i<n0;i++)
|
for(i=0;i<n0;i++)
|
||||||
pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
|
pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the copy section */
|
/* the copy section */
|
||||||
{
|
{
|
||||||
float *pcm=v->pcm[j]+thisCenter;
|
float *pcm=v->pcm[j]+thisCenter;
|
||||||
float *p=vb->pcm[j]+n;
|
float *p=vb->pcm[j]+n;
|
||||||
for(i=0;i<n;i++)
|
for(i=0;i<n;i++)
|
||||||
pcm[i]=p[i];
|
pcm[i]=p[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -803,8 +828,8 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
||||||
}else{
|
}else{
|
||||||
v->pcm_returned=prevCenter;
|
v->pcm_returned=prevCenter;
|
||||||
v->pcm_current=prevCenter+
|
v->pcm_current=prevCenter+
|
||||||
((ci->blocksizes[v->lW]/4+
|
((ci->blocksizes[v->lW]/4+
|
||||||
ci->blocksizes[v->W]/4)>>hs);
|
ci->blocksizes[v->W]/4)>>hs);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -833,22 +858,37 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
||||||
|
|
||||||
/* is this a short page? */
|
/* is this a short page? */
|
||||||
if(b->sample_count>v->granulepos){
|
if(b->sample_count>v->granulepos){
|
||||||
/* corner case; if this is both the first and last audio page,
|
/* corner case; if this is both the first and last audio page,
|
||||||
then spec says the end is cut, not beginning */
|
then spec says the end is cut, not beginning */
|
||||||
if(vb->eofflag){
|
long extra=b->sample_count-vb->granulepos;
|
||||||
/* trim the end */
|
|
||||||
/* no preceeding granulepos; assume we started at zero (we'd
|
|
||||||
have to in a short single-page stream) */
|
|
||||||
/* granulepos could be -1 due to a seek, but that would result
|
|
||||||
in a long count, not short count */
|
|
||||||
|
|
||||||
v->pcm_current-=(b->sample_count-v->granulepos)>>hs;
|
/* we use ogg_int64_t for granule positions because a
|
||||||
}else{
|
uint64 isn't universally available. Unfortunately,
|
||||||
/* trim the beginning */
|
that means granposes can be 'negative' and result in
|
||||||
v->pcm_returned+=(b->sample_count-v->granulepos)>>hs;
|
extra being negative */
|
||||||
if(v->pcm_returned>v->pcm_current)
|
if(extra<0)
|
||||||
v->pcm_returned=v->pcm_current;
|
extra=0;
|
||||||
}
|
|
||||||
|
if(vb->eofflag){
|
||||||
|
/* trim the end */
|
||||||
|
/* no preceding granulepos; assume we started at zero (we'd
|
||||||
|
have to in a short single-page stream) */
|
||||||
|
/* granulepos could be -1 due to a seek, but that would result
|
||||||
|
in a long count, not short count */
|
||||||
|
|
||||||
|
/* Guard against corrupt/malicious frames that set EOP and
|
||||||
|
a backdated granpos; don't rewind more samples than we
|
||||||
|
actually have */
|
||||||
|
if(extra > (v->pcm_current - v->pcm_returned)<<hs)
|
||||||
|
extra = (v->pcm_current - v->pcm_returned)<<hs;
|
||||||
|
|
||||||
|
v->pcm_current-=extra>>hs;
|
||||||
|
}else{
|
||||||
|
/* trim the beginning */
|
||||||
|
v->pcm_returned+=extra>>hs;
|
||||||
|
if(v->pcm_returned>v->pcm_current)
|
||||||
|
v->pcm_returned=v->pcm_current;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -858,16 +898,30 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
||||||
if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
|
if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
|
||||||
|
|
||||||
if(v->granulepos>vb->granulepos){
|
if(v->granulepos>vb->granulepos){
|
||||||
long extra=v->granulepos-vb->granulepos;
|
long extra=v->granulepos-vb->granulepos;
|
||||||
|
|
||||||
if(extra)
|
if(extra)
|
||||||
if(vb->eofflag){
|
if(vb->eofflag){
|
||||||
/* partial last frame. Strip the extra samples off */
|
/* partial last frame. Strip the extra samples off */
|
||||||
v->pcm_current-=extra>>hs;
|
|
||||||
} /* else {Shouldn't happen *unless* the bitstream is out of
|
/* Guard against corrupt/malicious frames that set EOP and
|
||||||
spec. Either way, believe the bitstream } */
|
a backdated granpos; don't rewind more samples than we
|
||||||
|
actually have */
|
||||||
|
if(extra > (v->pcm_current - v->pcm_returned)<<hs)
|
||||||
|
extra = (v->pcm_current - v->pcm_returned)<<hs;
|
||||||
|
|
||||||
|
/* we use ogg_int64_t for granule positions because a
|
||||||
|
uint64 isn't universally available. Unfortunately,
|
||||||
|
that means granposes can be 'negative' and result in
|
||||||
|
extra being negative */
|
||||||
|
if(extra<0)
|
||||||
|
extra=0;
|
||||||
|
|
||||||
|
v->pcm_current-=extra>>hs;
|
||||||
|
} /* else {Shouldn't happen *unless* the bitstream is out of
|
||||||
|
spec. Either way, believe the bitstream } */
|
||||||
} /* else {Shouldn't happen *unless* the bitstream is out of
|
} /* else {Shouldn't happen *unless* the bitstream is out of
|
||||||
spec. Either way, believe the bitstream } */
|
spec. Either way, believe the bitstream } */
|
||||||
v->granulepos=vb->granulepos;
|
v->granulepos=vb->granulepos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -887,7 +941,7 @@ int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm){
|
||||||
if(pcm){
|
if(pcm){
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<vi->channels;i++)
|
for(i=0;i<vi->channels;i++)
|
||||||
v->pcmret[i]=v->pcm[i]+v->pcm_returned;
|
v->pcmret[i]=v->pcm[i]+v->pcm_returned;
|
||||||
*pcm=v->pcmret;
|
*pcm=v->pcmret;
|
||||||
}
|
}
|
||||||
return(v->pcm_current-v->pcm_returned);
|
return(v->pcm_current-v->pcm_returned);
|
||||||
|
|
@ -934,9 +988,9 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
|
||||||
for(j=0;j<vi->channels;j++){
|
for(j=0;j<vi->channels;j++){
|
||||||
float *p=v->pcm[j];
|
float *p=v->pcm[j];
|
||||||
for(i=0;i<n1;i++){
|
for(i=0;i<n1;i++){
|
||||||
float temp=p[i];
|
float temp=p[i];
|
||||||
p[i]=p[i+n1];
|
p[i]=p[i+n1];
|
||||||
p[i+n1]=temp;
|
p[i+n1]=temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -952,7 +1006,7 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
|
||||||
float *s=v->pcm[j];
|
float *s=v->pcm[j];
|
||||||
float *d=v->pcm[j]+(n1-n0)/2;
|
float *d=v->pcm[j]+(n1-n0)/2;
|
||||||
for(i=(n1+n0)/2-1;i>=0;--i)
|
for(i=(n1+n0)/2-1;i>=0;--i)
|
||||||
d[i]=s[i];
|
d[i]=s[i];
|
||||||
}
|
}
|
||||||
v->pcm_returned+=(n1-n0)/2;
|
v->pcm_returned+=(n1-n0)/2;
|
||||||
v->pcm_current+=(n1-n0)/2;
|
v->pcm_current+=(n1-n0)/2;
|
||||||
|
|
@ -960,10 +1014,10 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
|
||||||
if(v->lW==0){
|
if(v->lW==0){
|
||||||
/* short/short */
|
/* short/short */
|
||||||
for(j=0;j<vi->channels;j++){
|
for(j=0;j<vi->channels;j++){
|
||||||
float *s=v->pcm[j];
|
float *s=v->pcm[j];
|
||||||
float *d=v->pcm[j]+n1-n0;
|
float *d=v->pcm[j]+n1-n0;
|
||||||
for(i=n0-1;i>=0;--i)
|
for(i=n0-1;i>=0;--i)
|
||||||
d[i]=s[i];
|
d[i]=s[i];
|
||||||
}
|
}
|
||||||
v->pcm_returned+=n1-n0;
|
v->pcm_returned+=n1-n0;
|
||||||
v->pcm_current+=n1-n0;
|
v->pcm_current+=n1-n0;
|
||||||
|
|
@ -990,4 +1044,3 @@ float *vorbis_window(vorbis_dsp_state *v,int W){
|
||||||
if(b->window[W]-1<0)return NULL;
|
if(b->window[W]-1<0)return NULL;
|
||||||
return _vorbis_window_get(b->window[W]-hs);
|
return _vorbis_window_get(b->window[W]-hs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: basic codebook pack/unpack/code/decode operations
|
function: basic codebook pack/unpack/code/decode operations
|
||||||
last mod: $Id: codebook.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: codebook.c 18183 2012-02-03 20:51:27Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -56,10 +56,10 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
|
||||||
long this=c->lengthlist[i];
|
long this=c->lengthlist[i];
|
||||||
long last=c->lengthlist[i-1];
|
long last=c->lengthlist[i-1];
|
||||||
if(this>last){
|
if(this>last){
|
||||||
for(j=last;j<this;j++){
|
for(j=last;j<this;j++){
|
||||||
oggpack_write(opb,i-count,_ilog(c->entries-count));
|
oggpack_write(opb,i-count,_ilog(c->entries-count));
|
||||||
count=i;
|
count=i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
oggpack_write(opb,i-count,_ilog(c->entries-count));
|
oggpack_write(opb,i-count,_ilog(c->entries-count));
|
||||||
|
|
@ -78,16 +78,16 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
|
||||||
if(i==c->entries){
|
if(i==c->entries){
|
||||||
oggpack_write(opb,0,1); /* no unused entries */
|
oggpack_write(opb,0,1); /* no unused entries */
|
||||||
for(i=0;i<c->entries;i++)
|
for(i=0;i<c->entries;i++)
|
||||||
oggpack_write(opb,c->lengthlist[i]-1,5);
|
oggpack_write(opb,c->lengthlist[i]-1,5);
|
||||||
}else{
|
}else{
|
||||||
oggpack_write(opb,1,1); /* we have unused entries; thus we tag */
|
oggpack_write(opb,1,1); /* we have unused entries; thus we tag */
|
||||||
for(i=0;i<c->entries;i++){
|
for(i=0;i<c->entries;i++){
|
||||||
if(c->lengthlist[i]==0){
|
if(c->lengthlist[i]==0){
|
||||||
oggpack_write(opb,0,1);
|
oggpack_write(opb,0,1);
|
||||||
}else{
|
}else{
|
||||||
oggpack_write(opb,1,1);
|
oggpack_write(opb,1,1);
|
||||||
oggpack_write(opb,c->lengthlist[i]-1,5);
|
oggpack_write(opb,c->lengthlist[i]-1,5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -118,21 +118,21 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
|
||||||
int quantvals;
|
int quantvals;
|
||||||
switch(c->maptype){
|
switch(c->maptype){
|
||||||
case 1:
|
case 1:
|
||||||
/* a single column of (c->entries/c->dim) quantized values for
|
/* a single column of (c->entries/c->dim) quantized values for
|
||||||
building a full value list algorithmically (square lattice) */
|
building a full value list algorithmically (square lattice) */
|
||||||
quantvals=_book_maptype1_quantvals(c);
|
quantvals=_book_maptype1_quantvals(c);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
/* every value (c->entries*c->dim total) specified explicitly */
|
/* every value (c->entries*c->dim total) specified explicitly */
|
||||||
quantvals=c->entries*c->dim;
|
quantvals=c->entries*c->dim;
|
||||||
break;
|
break;
|
||||||
default: /* NOT_REACHABLE */
|
default: /* NOT_REACHABLE */
|
||||||
quantvals=-1;
|
quantvals=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* quantized values */
|
/* quantized values */
|
||||||
for(i=0;i<quantvals;i++)
|
for(i=0;i<quantvals;i++)
|
||||||
oggpack_write(opb,labs(c->quantlist[i]),c->q_quant);
|
oggpack_write(opb,labs(c->quantlist[i]),c->q_quant);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -146,9 +146,9 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
|
||||||
|
|
||||||
/* unpacks a codebook from the packet buffer into the codebook struct,
|
/* unpacks a codebook from the packet buffer into the codebook struct,
|
||||||
readies the codebook auxiliary structures for decode *************/
|
readies the codebook auxiliary structures for decode *************/
|
||||||
int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
|
static_codebook *vorbis_staticbook_unpack(oggpack_buffer *opb){
|
||||||
long i,j;
|
long i,j;
|
||||||
memset(s,0,sizeof(*s));
|
static_codebook *s=_ogg_calloc(1,sizeof(*s));
|
||||||
s->allocedp=1;
|
s->allocedp=1;
|
||||||
|
|
||||||
/* make sure alignment is correct */
|
/* make sure alignment is correct */
|
||||||
|
|
@ -159,52 +159,66 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
|
||||||
s->entries=oggpack_read(opb,24);
|
s->entries=oggpack_read(opb,24);
|
||||||
if(s->entries==-1)goto _eofout;
|
if(s->entries==-1)goto _eofout;
|
||||||
|
|
||||||
|
if(_ilog(s->dim)+_ilog(s->entries)>24)goto _eofout;
|
||||||
|
|
||||||
/* codeword ordering.... length ordered or unordered? */
|
/* codeword ordering.... length ordered or unordered? */
|
||||||
switch((int)oggpack_read(opb,1)){
|
switch((int)oggpack_read(opb,1)){
|
||||||
case 0:
|
case 0:{
|
||||||
|
long unused;
|
||||||
|
/* allocated but unused entries? */
|
||||||
|
unused=oggpack_read(opb,1);
|
||||||
|
if((s->entries*(unused?1:5)+7)>>3>opb->storage-oggpack_bytes(opb))
|
||||||
|
goto _eofout;
|
||||||
/* unordered */
|
/* unordered */
|
||||||
s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
|
s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
|
||||||
|
|
||||||
/* allocated but unused entries? */
|
/* allocated but unused entries? */
|
||||||
if(oggpack_read(opb,1)){
|
if(unused){
|
||||||
/* yes, unused entries */
|
/* yes, unused entries */
|
||||||
|
|
||||||
for(i=0;i<s->entries;i++){
|
for(i=0;i<s->entries;i++){
|
||||||
if(oggpack_read(opb,1)){
|
if(oggpack_read(opb,1)){
|
||||||
long num=oggpack_read(opb,5);
|
long num=oggpack_read(opb,5);
|
||||||
if(num==-1)goto _eofout;
|
if(num==-1)goto _eofout;
|
||||||
s->lengthlist[i]=num+1;
|
s->lengthlist[i]=num+1;
|
||||||
}else
|
}else
|
||||||
s->lengthlist[i]=0;
|
s->lengthlist[i]=0;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
/* all entries used; no tagging */
|
/* all entries used; no tagging */
|
||||||
for(i=0;i<s->entries;i++){
|
for(i=0;i<s->entries;i++){
|
||||||
long num=oggpack_read(opb,5);
|
long num=oggpack_read(opb,5);
|
||||||
if(num==-1)goto _eofout;
|
if(num==-1)goto _eofout;
|
||||||
s->lengthlist[i]=num+1;
|
s->lengthlist[i]=num+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 1:
|
case 1:
|
||||||
/* ordered */
|
/* ordered */
|
||||||
{
|
{
|
||||||
long length=oggpack_read(opb,5)+1;
|
long length=oggpack_read(opb,5)+1;
|
||||||
|
if(length==0)goto _eofout;
|
||||||
s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
|
s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
|
||||||
|
|
||||||
for(i=0;i<s->entries;){
|
for(i=0;i<s->entries;){
|
||||||
long num=oggpack_read(opb,_ilog(s->entries-i));
|
long num=oggpack_read(opb,_ilog(s->entries-i));
|
||||||
if(num==-1)goto _eofout;
|
if(num==-1)goto _eofout;
|
||||||
for(j=0;j<num && i<s->entries;j++,i++)
|
if(length>32 || num>s->entries-i ||
|
||||||
s->lengthlist[i]=length;
|
(num>0 && (num-1)>>(length-1)>1)){
|
||||||
length++;
|
goto _errout;
|
||||||
|
}
|
||||||
|
if(length>32)goto _errout;
|
||||||
|
for(j=0;j<num;j++,i++)
|
||||||
|
s->lengthlist[i]=length;
|
||||||
|
length++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* EOF */
|
/* EOF */
|
||||||
return(-1);
|
goto _eofout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we have a mapping to unpack? */
|
/* Do we have a mapping to unpack? */
|
||||||
|
|
@ -220,22 +234,25 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
|
||||||
s->q_delta=oggpack_read(opb,32);
|
s->q_delta=oggpack_read(opb,32);
|
||||||
s->q_quant=oggpack_read(opb,4)+1;
|
s->q_quant=oggpack_read(opb,4)+1;
|
||||||
s->q_sequencep=oggpack_read(opb,1);
|
s->q_sequencep=oggpack_read(opb,1);
|
||||||
|
if(s->q_sequencep==-1)goto _eofout;
|
||||||
|
|
||||||
{
|
{
|
||||||
int quantvals=0;
|
int quantvals=0;
|
||||||
switch(s->maptype){
|
switch(s->maptype){
|
||||||
case 1:
|
case 1:
|
||||||
quantvals=_book_maptype1_quantvals(s);
|
quantvals=(s->dim==0?0:_book_maptype1_quantvals(s));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
quantvals=s->entries*s->dim;
|
quantvals=s->entries*s->dim;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* quantized values */
|
/* quantized values */
|
||||||
|
if(((quantvals*s->q_quant+7)>>3)>opb->storage-oggpack_bytes(opb))
|
||||||
|
goto _eofout;
|
||||||
s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals);
|
s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals);
|
||||||
for(i=0;i<quantvals;i++)
|
for(i=0;i<quantvals;i++)
|
||||||
s->quantlist[i]=oggpack_read(opb,s->q_quant);
|
s->quantlist[i]=oggpack_read(opb,s->q_quant);
|
||||||
|
|
||||||
if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout;
|
if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout;
|
||||||
}
|
}
|
||||||
|
|
@ -245,12 +262,12 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* all set */
|
/* all set */
|
||||||
return(0);
|
return(s);
|
||||||
|
|
||||||
_errout:
|
_errout:
|
||||||
_eofout:
|
_eofout:
|
||||||
vorbis_staticbook_clear(s);
|
vorbis_staticbook_destroy(s);
|
||||||
return(-1);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns the number of bits ************************************************/
|
/* returns the number of bits ************************************************/
|
||||||
|
|
@ -260,37 +277,6 @@ int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){
|
||||||
return(book->c->lengthlist[a]);
|
return(book->c->lengthlist[a]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* One the encode side, our vector writers are each designed for a
|
|
||||||
specific purpose, and the encoder is not flexible without modification:
|
|
||||||
|
|
||||||
The LSP vector coder uses a single stage nearest-match with no
|
|
||||||
interleave, so no step and no error return. This is specced by floor0
|
|
||||||
and doesn't change.
|
|
||||||
|
|
||||||
Residue0 encoding interleaves, uses multiple stages, and each stage
|
|
||||||
peels of a specific amount of resolution from a lattice (thus we want
|
|
||||||
to match by threshold, not nearest match). Residue doesn't *have* to
|
|
||||||
be encoded that way, but to change it, one will need to add more
|
|
||||||
infrastructure on the encode side (decode side is specced and simpler) */
|
|
||||||
|
|
||||||
/* floor0 LSP (single stage, non interleaved, nearest match) */
|
|
||||||
/* returns entry number and *modifies a* to the quantization value *****/
|
|
||||||
int vorbis_book_errorv(codebook *book,float *a){
|
|
||||||
int dim=book->dim,k;
|
|
||||||
int best=_best(book,a,1);
|
|
||||||
for(k=0;k<dim;k++)
|
|
||||||
a[k]=(book->valuelist+best*dim)[k];
|
|
||||||
return(best);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* returns the number of bits and *modifies a* to the quantization value *****/
|
|
||||||
int vorbis_book_encodev(codebook *book,int best,float *a,oggpack_buffer *b){
|
|
||||||
int k,dim=book->dim;
|
|
||||||
for(k=0;k<dim;k++)
|
|
||||||
a[k]=(book->valuelist+best*dim)[k];
|
|
||||||
return(vorbis_book_encode(book,best,b));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* the 'eliminate the decode tree' optimization actually requires the
|
/* the 'eliminate the decode tree' optimization actually requires the
|
||||||
codewords to be MSb first, not LSb. This is an annoying inelegancy
|
codewords to be MSb first, not LSb. This is an annoying inelegancy
|
||||||
(and one of the first places where carefully thought out design
|
(and one of the first places where carefully thought out design
|
||||||
|
|
@ -381,6 +367,7 @@ long vorbis_book_decode(codebook *book, oggpack_buffer *b){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns 0 on OK or -1 on eof *************************************/
|
/* returns 0 on OK or -1 on eof *************************************/
|
||||||
|
/* decode vector / dim granularity gaurding is done in the upper layer */
|
||||||
long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
|
long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
|
||||||
if(book->used_entries>0){
|
if(book->used_entries>0){
|
||||||
int step=n/book->dim;
|
int step=n/book->dim;
|
||||||
|
|
@ -395,11 +382,12 @@ long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
|
||||||
}
|
}
|
||||||
for(i=0,o=0;i<book->dim;i++,o+=step)
|
for(i=0,o=0;i<book->dim;i++,o+=step)
|
||||||
for (j=0;j<step;j++)
|
for (j=0;j<step;j++)
|
||||||
a[o+j]+=t[j][i];
|
a[o+j]+=t[j][i];
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* decode vector / dim granularity gaurding is done in the upper layer */
|
||||||
long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
|
long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
|
||||||
if(book->used_entries>0){
|
if(book->used_entries>0){
|
||||||
int i,j,entry;
|
int i,j,entry;
|
||||||
|
|
@ -407,44 +395,47 @@ long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
|
||||||
|
|
||||||
if(book->dim>8){
|
if(book->dim>8){
|
||||||
for(i=0;i<n;){
|
for(i=0;i<n;){
|
||||||
entry = decode_packed_entry_number(book,b);
|
entry = decode_packed_entry_number(book,b);
|
||||||
if(entry==-1)return(-1);
|
if(entry==-1)return(-1);
|
||||||
t = book->valuelist+entry*book->dim;
|
t = book->valuelist+entry*book->dim;
|
||||||
for (j=0;j<book->dim;)
|
for (j=0;j<book->dim;)
|
||||||
a[i++]+=t[j++];
|
a[i++]+=t[j++];
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
for(i=0;i<n;){
|
for(i=0;i<n;){
|
||||||
entry = decode_packed_entry_number(book,b);
|
entry = decode_packed_entry_number(book,b);
|
||||||
if(entry==-1)return(-1);
|
if(entry==-1)return(-1);
|
||||||
t = book->valuelist+entry*book->dim;
|
t = book->valuelist+entry*book->dim;
|
||||||
j=0;
|
j=0;
|
||||||
switch((int)book->dim){
|
switch((int)book->dim){
|
||||||
case 8:
|
case 8:
|
||||||
a[i++]+=t[j++];
|
a[i++]+=t[j++];
|
||||||
case 7:
|
case 7:
|
||||||
a[i++]+=t[j++];
|
a[i++]+=t[j++];
|
||||||
case 6:
|
case 6:
|
||||||
a[i++]+=t[j++];
|
a[i++]+=t[j++];
|
||||||
case 5:
|
case 5:
|
||||||
a[i++]+=t[j++];
|
a[i++]+=t[j++];
|
||||||
case 4:
|
case 4:
|
||||||
a[i++]+=t[j++];
|
a[i++]+=t[j++];
|
||||||
case 3:
|
case 3:
|
||||||
a[i++]+=t[j++];
|
a[i++]+=t[j++];
|
||||||
case 2:
|
case 2:
|
||||||
a[i++]+=t[j++];
|
a[i++]+=t[j++];
|
||||||
case 1:
|
case 1:
|
||||||
a[i++]+=t[j++];
|
a[i++]+=t[j++];
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* unlike the others, we guard against n not being an integer number
|
||||||
|
of <dim> internally rather than in the upper layer (called only by
|
||||||
|
floor0) */
|
||||||
long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
|
long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
|
||||||
if(book->used_entries>0){
|
if(book->used_entries>0){
|
||||||
int i,j,entry;
|
int i,j,entry;
|
||||||
|
|
@ -454,22 +445,22 @@ long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
|
||||||
entry = decode_packed_entry_number(book,b);
|
entry = decode_packed_entry_number(book,b);
|
||||||
if(entry==-1)return(-1);
|
if(entry==-1)return(-1);
|
||||||
t = book->valuelist+entry*book->dim;
|
t = book->valuelist+entry*book->dim;
|
||||||
for (j=0;j<book->dim;)
|
for (j=0;i<n && j<book->dim;){
|
||||||
a[i++]=t[j++];
|
a[i++]=t[j++];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
for(i=0;i<n;){
|
for(i=0;i<n;){
|
||||||
for (j=0;j<book->dim;)
|
a[i++]=0.f;
|
||||||
a[i++]=0.f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
|
long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
|
||||||
oggpack_buffer *b,int n){
|
oggpack_buffer *b,int n){
|
||||||
|
|
||||||
long i,j,entry;
|
long i,j,entry;
|
||||||
int chptr=0;
|
int chptr=0;
|
||||||
|
|
@ -478,157 +469,16 @@ long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
|
||||||
entry = decode_packed_entry_number(book,b);
|
entry = decode_packed_entry_number(book,b);
|
||||||
if(entry==-1)return(-1);
|
if(entry==-1)return(-1);
|
||||||
{
|
{
|
||||||
const float *t = book->valuelist+entry*book->dim;
|
const float *t = book->valuelist+entry*book->dim;
|
||||||
for (j=0;j<book->dim;j++){
|
for (j=0;j<book->dim;j++){
|
||||||
a[chptr++][i]+=t[j];
|
a[chptr++][i]+=t[j];
|
||||||
if(chptr==ch){
|
if(chptr==ch){
|
||||||
chptr=0;
|
chptr=0;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _V_SELFTEST
|
|
||||||
/* Simple enough; pack a few candidate codebooks, unpack them. Code a
|
|
||||||
number of vectors through (keeping track of the quantized values),
|
|
||||||
and decode using the unpacked book. quantized version of in should
|
|
||||||
exactly equal out */
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "vorbis/book/lsp20_0.vqh"
|
|
||||||
#include "vorbis/book/res0a_13.vqh"
|
|
||||||
#define TESTSIZE 40
|
|
||||||
|
|
||||||
float test1[TESTSIZE]={
|
|
||||||
0.105939f,
|
|
||||||
0.215373f,
|
|
||||||
0.429117f,
|
|
||||||
0.587974f,
|
|
||||||
|
|
||||||
0.181173f,
|
|
||||||
0.296583f,
|
|
||||||
0.515707f,
|
|
||||||
0.715261f,
|
|
||||||
|
|
||||||
0.162327f,
|
|
||||||
0.263834f,
|
|
||||||
0.342876f,
|
|
||||||
0.406025f,
|
|
||||||
|
|
||||||
0.103571f,
|
|
||||||
0.223561f,
|
|
||||||
0.368513f,
|
|
||||||
0.540313f,
|
|
||||||
|
|
||||||
0.136672f,
|
|
||||||
0.395882f,
|
|
||||||
0.587183f,
|
|
||||||
0.652476f,
|
|
||||||
|
|
||||||
0.114338f,
|
|
||||||
0.417300f,
|
|
||||||
0.525486f,
|
|
||||||
0.698679f,
|
|
||||||
|
|
||||||
0.147492f,
|
|
||||||
0.324481f,
|
|
||||||
0.643089f,
|
|
||||||
0.757582f,
|
|
||||||
|
|
||||||
0.139556f,
|
|
||||||
0.215795f,
|
|
||||||
0.324559f,
|
|
||||||
0.399387f,
|
|
||||||
|
|
||||||
0.120236f,
|
|
||||||
0.267420f,
|
|
||||||
0.446940f,
|
|
||||||
0.608760f,
|
|
||||||
|
|
||||||
0.115587f,
|
|
||||||
0.287234f,
|
|
||||||
0.571081f,
|
|
||||||
0.708603f,
|
|
||||||
};
|
|
||||||
|
|
||||||
float test3[TESTSIZE]={
|
|
||||||
0,1,-2,3,4,-5,6,7,8,9,
|
|
||||||
8,-2,7,-1,4,6,8,3,1,-9,
|
|
||||||
10,11,12,13,14,15,26,17,18,19,
|
|
||||||
30,-25,-30,-1,-5,-32,4,3,-2,0};
|
|
||||||
|
|
||||||
static_codebook *testlist[]={&_vq_book_lsp20_0,
|
|
||||||
&_vq_book_res0a_13,NULL};
|
|
||||||
float *testvec[]={test1,test3};
|
|
||||||
|
|
||||||
int main(){
|
|
||||||
oggpack_buffer write;
|
|
||||||
oggpack_buffer read;
|
|
||||||
long ptr=0,i;
|
|
||||||
oggpack_writeinit(&write);
|
|
||||||
|
|
||||||
fprintf(stderr,"Testing codebook abstraction...:\n");
|
|
||||||
|
|
||||||
while(testlist[ptr]){
|
|
||||||
codebook c;
|
|
||||||
static_codebook s;
|
|
||||||
float *qv=alloca(sizeof(*qv)*TESTSIZE);
|
|
||||||
float *iv=alloca(sizeof(*iv)*TESTSIZE);
|
|
||||||
memcpy(qv,testvec[ptr],sizeof(*qv)*TESTSIZE);
|
|
||||||
memset(iv,0,sizeof(*iv)*TESTSIZE);
|
|
||||||
|
|
||||||
fprintf(stderr,"\tpacking/coding %ld... ",ptr);
|
|
||||||
|
|
||||||
/* pack the codebook, write the testvector */
|
|
||||||
oggpack_reset(&write);
|
|
||||||
vorbis_book_init_encode(&c,testlist[ptr]); /* get it into memory
|
|
||||||
we can write */
|
|
||||||
vorbis_staticbook_pack(testlist[ptr],&write);
|
|
||||||
fprintf(stderr,"Codebook size %ld bytes... ",oggpack_bytes(&write));
|
|
||||||
for(i=0;i<TESTSIZE;i+=c.dim){
|
|
||||||
int best=_best(&c,qv+i,1);
|
|
||||||
vorbis_book_encodev(&c,best,qv+i,&write);
|
|
||||||
}
|
|
||||||
vorbis_book_clear(&c);
|
|
||||||
|
|
||||||
fprintf(stderr,"OK.\n");
|
|
||||||
fprintf(stderr,"\tunpacking/decoding %ld... ",ptr);
|
|
||||||
|
|
||||||
/* transfer the write data to a read buffer and unpack/read */
|
|
||||||
oggpack_readinit(&read,oggpack_get_buffer(&write),oggpack_bytes(&write));
|
|
||||||
if(vorbis_staticbook_unpack(&read,&s)){
|
|
||||||
fprintf(stderr,"Error unpacking codebook.\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if(vorbis_book_init_decode(&c,&s)){
|
|
||||||
fprintf(stderr,"Error initializing codebook.\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(i=0;i<TESTSIZE;i+=c.dim)
|
|
||||||
if(vorbis_book_decodev_set(&c,iv+i,&read,c.dim)==-1){
|
|
||||||
fprintf(stderr,"Error reading codebook test data (EOP).\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
for(i=0;i<TESTSIZE;i++)
|
|
||||||
if(fabs(qv[i]-iv[i])>.000001){
|
|
||||||
fprintf(stderr,"read (%g) != written (%g) at position (%ld)\n",
|
|
||||||
iv[i],qv[i],i);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf(stderr,"OK\n");
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The above is the trivial stuff; now try unquantizing a log scale codebook */
|
|
||||||
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: basic shared codebook operations
|
function: basic shared codebook operations
|
||||||
last mod: $Id: codebook.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: codebook.h 17030 2010-03-25 06:52:55Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -40,8 +40,8 @@ typedef struct static_codebook{
|
||||||
|
|
||||||
/* mapping ***************************************************************/
|
/* mapping ***************************************************************/
|
||||||
int maptype; /* 0=none
|
int maptype; /* 0=none
|
||||||
1=implicitly populated values from map column
|
1=implicitly populated values from map column
|
||||||
2=listed arbitrary values */
|
2=listed arbitrary values */
|
||||||
|
|
||||||
/* The below does a linear, single monotonic sequence mapping. */
|
/* The below does a linear, single monotonic sequence mapping. */
|
||||||
long q_min; /* packed 32 bit float; quant value 0 maps to minval */
|
long q_min; /* packed 32 bit float; quant value 0 maps to minval */
|
||||||
|
|
@ -50,52 +50,11 @@ typedef struct static_codebook{
|
||||||
int q_sequencep; /* bitflag */
|
int q_sequencep; /* bitflag */
|
||||||
|
|
||||||
long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
|
long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
|
||||||
map == 2: list of dim*entries quantized entry vals
|
map == 2: list of dim*entries quantized entry vals
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* encode helpers ********************************************************/
|
|
||||||
struct encode_aux_nearestmatch *nearest_tree;
|
|
||||||
struct encode_aux_threshmatch *thresh_tree;
|
|
||||||
struct encode_aux_pigeonhole *pigeon_tree;
|
|
||||||
|
|
||||||
int allocedp;
|
int allocedp;
|
||||||
} static_codebook;
|
} static_codebook;
|
||||||
|
|
||||||
/* this structures an arbitrary trained book to quickly find the
|
|
||||||
nearest cell match */
|
|
||||||
typedef struct encode_aux_nearestmatch{
|
|
||||||
/* pre-calculated partitioning tree */
|
|
||||||
long *ptr0;
|
|
||||||
long *ptr1;
|
|
||||||
|
|
||||||
long *p; /* decision points (each is an entry) */
|
|
||||||
long *q; /* decision points (each is an entry) */
|
|
||||||
long aux; /* number of tree entries */
|
|
||||||
long alloc;
|
|
||||||
} encode_aux_nearestmatch;
|
|
||||||
|
|
||||||
/* assumes a maptype of 1; encode side only, so that's OK */
|
|
||||||
typedef struct encode_aux_threshmatch{
|
|
||||||
float *quantthresh;
|
|
||||||
long *quantmap;
|
|
||||||
int quantvals;
|
|
||||||
int threshvals;
|
|
||||||
} encode_aux_threshmatch;
|
|
||||||
|
|
||||||
typedef struct encode_aux_pigeonhole{
|
|
||||||
float min;
|
|
||||||
float del;
|
|
||||||
|
|
||||||
int mapentries;
|
|
||||||
int quantvals;
|
|
||||||
long *pigeonmap;
|
|
||||||
|
|
||||||
long fittotal;
|
|
||||||
long *fitlist;
|
|
||||||
long *fitmap;
|
|
||||||
long *fitlength;
|
|
||||||
} encode_aux_pigeonhole;
|
|
||||||
|
|
||||||
typedef struct codebook{
|
typedef struct codebook{
|
||||||
long dim; /* codebook dimensions (elements per vector) */
|
long dim; /* codebook dimensions (elements per vector) */
|
||||||
long entries; /* codebook entries */
|
long entries; /* codebook entries */
|
||||||
|
|
@ -114,9 +73,12 @@ typedef struct codebook{
|
||||||
int dec_firsttablen;
|
int dec_firsttablen;
|
||||||
int dec_maxlength;
|
int dec_maxlength;
|
||||||
|
|
||||||
|
/* The current encoder uses only centered, integer-only lattice books. */
|
||||||
|
int quantvals;
|
||||||
|
int minval;
|
||||||
|
int delta;
|
||||||
} codebook;
|
} codebook;
|
||||||
|
|
||||||
extern void vorbis_staticbook_clear(static_codebook *b);
|
|
||||||
extern void vorbis_staticbook_destroy(static_codebook *b);
|
extern void vorbis_staticbook_destroy(static_codebook *b);
|
||||||
extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
|
extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
|
||||||
extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
|
extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
|
||||||
|
|
@ -137,23 +99,20 @@ extern long vorbis_book_codelen(codebook *book,int entry);
|
||||||
|
|
||||||
|
|
||||||
extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
|
extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
|
||||||
extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
|
extern static_codebook *vorbis_staticbook_unpack(oggpack_buffer *b);
|
||||||
|
|
||||||
extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
|
extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
|
||||||
extern int vorbis_book_errorv(codebook *book, float *a);
|
|
||||||
extern int vorbis_book_encodev(codebook *book, int best,float *a,
|
|
||||||
oggpack_buffer *b);
|
|
||||||
|
|
||||||
extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
|
extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
|
||||||
extern long vorbis_book_decodevs_add(codebook *book, float *a,
|
extern long vorbis_book_decodevs_add(codebook *book, float *a,
|
||||||
oggpack_buffer *b,int n);
|
oggpack_buffer *b,int n);
|
||||||
extern long vorbis_book_decodev_set(codebook *book, float *a,
|
extern long vorbis_book_decodev_set(codebook *book, float *a,
|
||||||
oggpack_buffer *b,int n);
|
oggpack_buffer *b,int n);
|
||||||
extern long vorbis_book_decodev_add(codebook *book, float *a,
|
extern long vorbis_book_decodev_add(codebook *book, float *a,
|
||||||
oggpack_buffer *b,int n);
|
oggpack_buffer *b,int n);
|
||||||
extern long vorbis_book_decodevv_add(codebook *book, float **a,
|
extern long vorbis_book_decodevv_add(codebook *book, float **a,
|
||||||
long off,int ch,
|
long off,int ch,
|
||||||
oggpack_buffer *b,int n);
|
oggpack_buffer *b,int n);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: libvorbis codec headers
|
function: libvorbis codec headers
|
||||||
last mod: $Id: codec_internal.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -34,9 +34,9 @@ typedef struct vorbis_block_internal{
|
||||||
int blocktype;
|
int blocktype;
|
||||||
|
|
||||||
oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
|
oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
|
||||||
blob [PACKETBLOBS/2] points to
|
blob [PACKETBLOBS/2] points to
|
||||||
the oggpack_buffer in the
|
the oggpack_buffer in the
|
||||||
main vorbis_block */
|
main vorbis_block */
|
||||||
} vorbis_block_internal;
|
} vorbis_block_internal;
|
||||||
|
|
||||||
typedef void vorbis_look_floor;
|
typedef void vorbis_look_floor;
|
||||||
|
|
@ -133,5 +133,35 @@ typedef struct codec_setup_info {
|
||||||
extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
|
extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
|
||||||
extern void _vp_global_free(vorbis_look_psy_global *look);
|
extern void _vp_global_free(vorbis_look_psy_global *look);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int sorted_index[VIF_POSIT+2];
|
||||||
|
int forward_index[VIF_POSIT+2];
|
||||||
|
int reverse_index[VIF_POSIT+2];
|
||||||
|
|
||||||
|
int hineighbor[VIF_POSIT];
|
||||||
|
int loneighbor[VIF_POSIT];
|
||||||
|
int posts;
|
||||||
|
|
||||||
|
int n;
|
||||||
|
int quant_q;
|
||||||
|
vorbis_info_floor1 *vi;
|
||||||
|
|
||||||
|
long phrasebits;
|
||||||
|
long postbits;
|
||||||
|
long frames;
|
||||||
|
} vorbis_look_floor1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
|
const float *logmdct, /* in */
|
||||||
|
const float *logmask);
|
||||||
|
extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
|
int *A,int *B,
|
||||||
|
int del);
|
||||||
|
extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
||||||
|
vorbis_look_floor1 *look,
|
||||||
|
int *post,int *ilogmask);
|
||||||
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: PCM data envelope analysis
|
function: PCM data envelope analysis
|
||||||
last mod: $Id: envelope.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: envelope.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -88,11 +88,10 @@ void _ve_envelope_clear(envelope_lookup *e){
|
||||||
that works better and isn't patented. */
|
that works better and isn't patented. */
|
||||||
|
|
||||||
static int _ve_amp(envelope_lookup *ve,
|
static int _ve_amp(envelope_lookup *ve,
|
||||||
vorbis_info_psy_global *gi,
|
vorbis_info_psy_global *gi,
|
||||||
float *data,
|
float *data,
|
||||||
envelope_band *bands,
|
envelope_band *bands,
|
||||||
envelope_filter_state *filters,
|
envelope_filter_state *filters){
|
||||||
long pos){
|
|
||||||
long n=ve->winlength;
|
long n=ve->winlength;
|
||||||
int ret=0;
|
int ret=0;
|
||||||
long i,j;
|
long i,j;
|
||||||
|
|
@ -183,10 +182,10 @@ static int _ve_amp(envelope_lookup *ve,
|
||||||
postmin=min(acc,filters[j].ampbuf[p]);
|
postmin=min(acc,filters[j].ampbuf[p]);
|
||||||
|
|
||||||
for(i=0;i<stretch;i++){
|
for(i=0;i<stretch;i++){
|
||||||
p--;
|
p--;
|
||||||
if(p<0)p+=VE_AMP;
|
if(p<0)p+=VE_AMP;
|
||||||
premax=max(premax,filters[j].ampbuf[p]);
|
premax=max(premax,filters[j].ampbuf[p]);
|
||||||
premin=min(premin,filters[j].ampbuf[p]);
|
premin=min(premin,filters[j].ampbuf[p]);
|
||||||
}
|
}
|
||||||
|
|
||||||
valmin=postmin-premin;
|
valmin=postmin-premin;
|
||||||
|
|
@ -240,7 +239,7 @@ long _ve_envelope_search(vorbis_dsp_state *v){
|
||||||
|
|
||||||
for(i=0;i<ve->ch;i++){
|
for(i=0;i<ve->ch;i++){
|
||||||
float *pcm=v->pcm[i]+ve->searchstep*(j);
|
float *pcm=v->pcm[i]+ve->searchstep*(j);
|
||||||
ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS,j);
|
ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
ve->mark[j+VE_POST]=0;
|
ve->mark[j+VE_POST]=0;
|
||||||
|
|
@ -276,50 +275,50 @@ long _ve_envelope_search(vorbis_dsp_state *v){
|
||||||
ve->cursor=j;
|
ve->cursor=j;
|
||||||
|
|
||||||
if(ve->mark[j/ve->searchstep]){
|
if(ve->mark[j/ve->searchstep]){
|
||||||
if(j>centerW){
|
if(j>centerW){
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(j>ve->curmark){
|
if(j>ve->curmark){
|
||||||
float *marker=alloca(v->pcm_current*sizeof(*marker));
|
float *marker=alloca(v->pcm_current*sizeof(*marker));
|
||||||
int l,m;
|
int l,m;
|
||||||
memset(marker,0,sizeof(*marker)*v->pcm_current);
|
memset(marker,0,sizeof(*marker)*v->pcm_current);
|
||||||
fprintf(stderr,"mark! seq=%d, cursor:%fs time:%fs\n",
|
fprintf(stderr,"mark! seq=%d, cursor:%fs time:%fs\n",
|
||||||
seq,
|
seq,
|
||||||
(totalshift+ve->cursor)/44100.,
|
(totalshift+ve->cursor)/44100.,
|
||||||
(totalshift+j)/44100.);
|
(totalshift+j)/44100.);
|
||||||
_analysis_output_always("pcmL",seq,v->pcm[0],v->pcm_current,0,0,totalshift);
|
_analysis_output_always("pcmL",seq,v->pcm[0],v->pcm_current,0,0,totalshift);
|
||||||
_analysis_output_always("pcmR",seq,v->pcm[1],v->pcm_current,0,0,totalshift);
|
_analysis_output_always("pcmR",seq,v->pcm[1],v->pcm_current,0,0,totalshift);
|
||||||
|
|
||||||
_analysis_output_always("markL",seq,v->pcm[0],j,0,0,totalshift);
|
_analysis_output_always("markL",seq,v->pcm[0],j,0,0,totalshift);
|
||||||
_analysis_output_always("markR",seq,v->pcm[1],j,0,0,totalshift);
|
_analysis_output_always("markR",seq,v->pcm[1],j,0,0,totalshift);
|
||||||
|
|
||||||
for(m=0;m<VE_BANDS;m++){
|
for(m=0;m<VE_BANDS;m++){
|
||||||
char buf[80];
|
char buf[80];
|
||||||
sprintf(buf,"delL%d",m);
|
sprintf(buf,"delL%d",m);
|
||||||
for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m].markers[l]*.1;
|
for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m].markers[l]*.1;
|
||||||
_analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
|
_analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(m=0;m<VE_BANDS;m++){
|
for(m=0;m<VE_BANDS;m++){
|
||||||
char buf[80];
|
char buf[80];
|
||||||
sprintf(buf,"delR%d",m);
|
sprintf(buf,"delR%d",m);
|
||||||
for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m+VE_BANDS].markers[l]*.1;
|
for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m+VE_BANDS].markers[l]*.1;
|
||||||
_analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
|
_analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->mark[l]*.4;
|
for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->mark[l]*.4;
|
||||||
_analysis_output_always("mark",seq,marker,v->pcm_current,0,0,totalshift);
|
_analysis_output_always("mark",seq,marker,v->pcm_current,0,0,totalshift);
|
||||||
|
|
||||||
|
|
||||||
seq++;
|
seq++;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ve->curmark=j;
|
ve->curmark=j;
|
||||||
if(j>=testW)return(1);
|
if(j>=testW)return(1);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
j+=ve->searchstep;
|
j+=ve->searchstep;
|
||||||
}
|
}
|
||||||
|
|
@ -356,7 +355,7 @@ int _ve_envelope_mark(vorbis_dsp_state *v){
|
||||||
|
|
||||||
void _ve_envelope_shift(envelope_lookup *e,long shift){
|
void _ve_envelope_shift(envelope_lookup *e,long shift){
|
||||||
int smallsize=e->current/e->searchstep+VE_POST; /* adjust for placing marks
|
int smallsize=e->current/e->searchstep+VE_POST; /* adjust for placing marks
|
||||||
ahead of ve->current */
|
ahead of ve->current */
|
||||||
int smallshift=shift/e->searchstep;
|
int smallshift=shift/e->searchstep;
|
||||||
|
|
||||||
memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark));
|
memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark));
|
||||||
|
|
@ -364,8 +363,8 @@ void _ve_envelope_shift(envelope_lookup *e,long shift){
|
||||||
#if 0
|
#if 0
|
||||||
for(i=0;i<VE_BANDS*e->ch;i++)
|
for(i=0;i<VE_BANDS*e->ch;i++)
|
||||||
memmove(e->filter[i].markers,
|
memmove(e->filter[i].markers,
|
||||||
e->filter[i].markers+smallshift,
|
e->filter[i].markers+smallshift,
|
||||||
(1024-smallshift)*sizeof(*(*e->filter).markers));
|
(1024-smallshift)*sizeof(*(*e->filter).markers));
|
||||||
totalshift+=shift;
|
totalshift+=shift;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -374,9 +373,3 @@ void _ve_envelope_shift(envelope_lookup *e,long shift){
|
||||||
e->curmark-=shift;
|
e->curmark-=shift;
|
||||||
e->cursor-=shift;
|
e->cursor-=shift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: PCM data envelope analysis and manipulation
|
function: PCM data envelope analysis and manipulation
|
||||||
last mod: $Id: envelope.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -78,4 +78,3 @@ extern int _ve_envelope_mark(vorbis_dsp_state *v);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: floor backend 0 implementation
|
function: floor backend 0 implementation
|
||||||
last mod: $Id: floor0.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: floor0.c 18184 2012-02-03 20:55:12Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -91,6 +91,8 @@ static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||||
for(j=0;j<info->numbooks;j++){
|
for(j=0;j<info->numbooks;j++){
|
||||||
info->books[j]=oggpack_read(opb,8);
|
info->books[j]=oggpack_read(opb,8);
|
||||||
if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
|
if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
|
||||||
|
if(ci->book_param[info->books[j]]->maptype==0)goto err_out;
|
||||||
|
if(ci->book_param[info->books[j]]->dim<1)goto err_out;
|
||||||
}
|
}
|
||||||
return(info);
|
return(info);
|
||||||
|
|
||||||
|
|
@ -108,8 +110,8 @@ static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||||
linear block and mapping sizes */
|
linear block and mapping sizes */
|
||||||
|
|
||||||
static void floor0_map_lazy_init(vorbis_block *vb,
|
static void floor0_map_lazy_init(vorbis_block *vb,
|
||||||
vorbis_info_floor *infoX,
|
vorbis_info_floor *infoX,
|
||||||
vorbis_look_floor0 *look){
|
vorbis_look_floor0 *look){
|
||||||
if(!look->linearmap[vb->W]){
|
if(!look->linearmap[vb->W]){
|
||||||
vorbis_dsp_state *vd=vb->vd;
|
vorbis_dsp_state *vd=vb->vd;
|
||||||
vorbis_info *vi=vd->vi;
|
vorbis_info *vi=vd->vi;
|
||||||
|
|
@ -132,7 +134,7 @@ static void floor0_map_lazy_init(vorbis_block *vb,
|
||||||
look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap));
|
look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap));
|
||||||
for(j=0;j<n;j++){
|
for(j=0;j<n;j++){
|
||||||
int val=floor( toBARK((info->rate/2.f)/n*j)
|
int val=floor( toBARK((info->rate/2.f)/n*j)
|
||||||
*scale); /* bark numbers represent band edges */
|
*scale); /* bark numbers represent band edges */
|
||||||
if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
|
if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
|
||||||
look->linearmap[W][j]=val;
|
look->linearmap[W][j]=val;
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +144,7 @@ static void floor0_map_lazy_init(vorbis_block *vb,
|
||||||
}
|
}
|
||||||
|
|
||||||
static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd,
|
static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd,
|
||||||
vorbis_info_floor *i){
|
vorbis_info_floor *i){
|
||||||
vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
|
vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
|
||||||
vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look));
|
vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look));
|
||||||
look->m=info->order;
|
look->m=info->order;
|
||||||
|
|
@ -175,11 +177,10 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
|
||||||
vector */
|
vector */
|
||||||
float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1));
|
float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1));
|
||||||
|
|
||||||
for(j=0;j<look->m;j+=b->dim)
|
if(vorbis_book_decodev_set(b,lsp,&vb->opb,look->m)==-1)goto eop;
|
||||||
if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop;
|
|
||||||
for(j=0;j<look->m;){
|
for(j=0;j<look->m;){
|
||||||
for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
|
for(k=0;j<look->m && k<b->dim;k++,j++)lsp[j]+=last;
|
||||||
last=lsp[j-1];
|
last=lsp[j-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
lsp[look->m]=amp;
|
lsp[look->m]=amp;
|
||||||
|
|
@ -191,7 +192,7 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
|
||||||
}
|
}
|
||||||
|
|
||||||
static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
|
static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
|
||||||
void *memo,float *out){
|
void *memo,float *out){
|
||||||
vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
|
vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
|
||||||
vorbis_info_floor0 *info=look->vi;
|
vorbis_info_floor0 *info=look->vi;
|
||||||
|
|
||||||
|
|
@ -203,10 +204,10 @@ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
|
||||||
|
|
||||||
/* take the coefficients back to a spectral envelope curve */
|
/* take the coefficients back to a spectral envelope curve */
|
||||||
vorbis_lsp_to_curve(out,
|
vorbis_lsp_to_curve(out,
|
||||||
look->linearmap[vb->W],
|
look->linearmap[vb->W],
|
||||||
look->n[vb->W],
|
look->n[vb->W],
|
||||||
look->ln,
|
look->ln,
|
||||||
lsp,look->m,amp,(float)info->ampdB);
|
lsp,look->m,amp,(float)info->ampdB);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
memset(out,0,sizeof(*out)*look->n[vb->W]);
|
memset(out,0,sizeof(*out)*look->n[vb->W]);
|
||||||
|
|
@ -214,10 +215,7 @@ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* export hooks */
|
/* export hooks */
|
||||||
vorbis_func_floor floor0_exportbundle={
|
const vorbis_func_floor floor0_exportbundle={
|
||||||
NULL,&floor0_unpack,&floor0_look,&floor0_free_info,
|
NULL,&floor0_unpack,&floor0_look,&floor0_free_info,
|
||||||
&floor0_free_look,&floor0_inverse1,&floor0_inverse2
|
&floor0_free_look,&floor0_inverse1,&floor0_inverse2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: floor backend 1 implementation
|
function: floor backend 1 implementation
|
||||||
last mod: $Id: floor1.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: floor1.c 18151 2012-01-20 07:35:26Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -30,34 +30,23 @@
|
||||||
|
|
||||||
#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
|
#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int sorted_index[VIF_POSIT+2];
|
|
||||||
int forward_index[VIF_POSIT+2];
|
|
||||||
int reverse_index[VIF_POSIT+2];
|
|
||||||
|
|
||||||
int hineighbor[VIF_POSIT];
|
|
||||||
int loneighbor[VIF_POSIT];
|
|
||||||
int posts;
|
|
||||||
|
|
||||||
int n;
|
|
||||||
int quant_q;
|
|
||||||
vorbis_info_floor1 *vi;
|
|
||||||
|
|
||||||
long phrasebits;
|
|
||||||
long postbits;
|
|
||||||
long frames;
|
|
||||||
} vorbis_look_floor1;
|
|
||||||
|
|
||||||
typedef struct lsfit_acc{
|
typedef struct lsfit_acc{
|
||||||
long x0;
|
int x0;
|
||||||
long x1;
|
int x1;
|
||||||
|
|
||||||
long xa;
|
int xa;
|
||||||
long ya;
|
int ya;
|
||||||
long x2a;
|
int x2a;
|
||||||
long y2a;
|
int y2a;
|
||||||
long xya;
|
int xya;
|
||||||
long an;
|
int an;
|
||||||
|
|
||||||
|
int xb;
|
||||||
|
int yb;
|
||||||
|
int x2b;
|
||||||
|
int y2b;
|
||||||
|
int xyb;
|
||||||
|
int bn;
|
||||||
} lsfit_acc;
|
} lsfit_acc;
|
||||||
|
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
|
|
@ -74,9 +63,9 @@ static void floor1_free_look(vorbis_look_floor *i){
|
||||||
vorbis_look_floor1 *look=(vorbis_look_floor1 *)i;
|
vorbis_look_floor1 *look=(vorbis_look_floor1 *)i;
|
||||||
if(look){
|
if(look){
|
||||||
/*fprintf(stderr,"floor 1 bit usage %f:%f (%f total)\n",
|
/*fprintf(stderr,"floor 1 bit usage %f:%f (%f total)\n",
|
||||||
(float)look->phrasebits/look->frames,
|
(float)look->phrasebits/look->frames,
|
||||||
(float)look->postbits/look->frames,
|
(float)look->postbits/look->frames,
|
||||||
(float)(look->postbits+look->phrasebits)/look->frames);*/
|
(float)(look->postbits+look->phrasebits)/look->frames);*/
|
||||||
|
|
||||||
memset(look,0,sizeof(*look));
|
memset(look,0,sizeof(*look));
|
||||||
_ogg_free(look);
|
_ogg_free(look);
|
||||||
|
|
@ -138,6 +127,9 @@ static void floor1_pack (vorbis_info_floor *i,oggpack_buffer *opb){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int icomp(const void *a,const void *b){
|
||||||
|
return(**(int **)a-**(int **)b);
|
||||||
|
}
|
||||||
|
|
||||||
static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||||
codec_setup_info *ci=vi->codec_setup;
|
codec_setup_info *ci=vi->codec_setup;
|
||||||
|
|
@ -148,6 +140,7 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||||
info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
|
info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
|
||||||
for(j=0;j<info->partitions;j++){
|
for(j=0;j<info->partitions;j++){
|
||||||
info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */
|
info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */
|
||||||
|
if(info->partitionclass[j]<0)goto err_out;
|
||||||
if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];
|
if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -163,25 +156,38 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||||
for(k=0;k<(1<<info->class_subs[j]);k++){
|
for(k=0;k<(1<<info->class_subs[j]);k++){
|
||||||
info->class_subbook[j][k]=oggpack_read(opb,8)-1;
|
info->class_subbook[j][k]=oggpack_read(opb,8)-1;
|
||||||
if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books)
|
if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books)
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read the post list */
|
/* read the post list */
|
||||||
info->mult=oggpack_read(opb,2)+1; /* only 1,2,3,4 legal now */
|
info->mult=oggpack_read(opb,2)+1; /* only 1,2,3,4 legal now */
|
||||||
rangebits=oggpack_read(opb,4);
|
rangebits=oggpack_read(opb,4);
|
||||||
|
if(rangebits<0)goto err_out;
|
||||||
|
|
||||||
for(j=0,k=0;j<info->partitions;j++){
|
for(j=0,k=0;j<info->partitions;j++){
|
||||||
count+=info->class_dim[info->partitionclass[j]];
|
count+=info->class_dim[info->partitionclass[j]];
|
||||||
|
if(count>VIF_POSIT) goto err_out;
|
||||||
for(;k<count;k++){
|
for(;k<count;k++){
|
||||||
int t=info->postlist[k+2]=oggpack_read(opb,rangebits);
|
int t=info->postlist[k+2]=oggpack_read(opb,rangebits);
|
||||||
if(t<0 || t>=(1<<rangebits))
|
if(t<0 || t>=(1<<rangebits))
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
info->postlist[0]=0;
|
info->postlist[0]=0;
|
||||||
info->postlist[1]=1<<rangebits;
|
info->postlist[1]=1<<rangebits;
|
||||||
|
|
||||||
|
/* don't allow repeated values in post list as they'd result in
|
||||||
|
zero-length segments */
|
||||||
|
{
|
||||||
|
int *sortpointer[VIF_POSIT+2];
|
||||||
|
for(j=0;j<count+2;j++)sortpointer[j]=info->postlist+j;
|
||||||
|
qsort(sortpointer,count+2,sizeof(*sortpointer),icomp);
|
||||||
|
|
||||||
|
for(j=1;j<count+2;j++)
|
||||||
|
if(*sortpointer[j-1]==*sortpointer[j])goto err_out;
|
||||||
|
}
|
||||||
|
|
||||||
return(info);
|
return(info);
|
||||||
|
|
||||||
err_out:
|
err_out:
|
||||||
|
|
@ -189,12 +195,8 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int icomp(const void *a,const void *b){
|
|
||||||
return(**(int **)a-**(int **)b);
|
|
||||||
}
|
|
||||||
|
|
||||||
static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,
|
static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,
|
||||||
vorbis_info_floor *in){
|
vorbis_info_floor *in){
|
||||||
|
|
||||||
int *sortpointer[VIF_POSIT+2];
|
int *sortpointer[VIF_POSIT+2];
|
||||||
vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
|
vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
|
||||||
|
|
@ -253,12 +255,12 @@ static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,
|
||||||
for(j=0;j<i+2;j++){
|
for(j=0;j<i+2;j++){
|
||||||
int x=info->postlist[j];
|
int x=info->postlist[j];
|
||||||
if(x>lx && x<currentx){
|
if(x>lx && x<currentx){
|
||||||
lo=j;
|
lo=j;
|
||||||
lx=x;
|
lx=x;
|
||||||
}
|
}
|
||||||
if(x<hx && x>currentx){
|
if(x<hx && x>currentx){
|
||||||
hi=j;
|
hi=j;
|
||||||
hx=x;
|
hx=x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
look->loneighbor[i]=lo;
|
look->loneighbor[i]=lo;
|
||||||
|
|
@ -291,7 +293,7 @@ static int vorbis_dBquant(const float *x){
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float FLOOR1_fromdB_LOOKUP[256]={
|
static const float FLOOR1_fromdB_LOOKUP[256]={
|
||||||
1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
|
1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
|
||||||
1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
|
1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
|
||||||
1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
|
1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
|
||||||
|
|
@ -387,7 +389,7 @@ static void render_line(int n, int x0,int x1,int y0,int y1,float *d){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void render_line0(int x0,int x1,int y0,int y1,int *d){
|
static void render_line0(int n, int x0,int x1,int y0,int y1,int *d){
|
||||||
int dy=y1-y0;
|
int dy=y1-y0;
|
||||||
int adx=x1-x0;
|
int adx=x1-x0;
|
||||||
int ady=abs(dy);
|
int ady=abs(dy);
|
||||||
|
|
@ -399,8 +401,12 @@ static void render_line0(int x0,int x1,int y0,int y1,int *d){
|
||||||
|
|
||||||
ady-=abs(base*adx);
|
ady-=abs(base*adx);
|
||||||
|
|
||||||
d[x]=y;
|
if(n>x1)n=x1;
|
||||||
while(++x<x1){
|
|
||||||
|
if(x<n)
|
||||||
|
d[x]=y;
|
||||||
|
|
||||||
|
while(++x<n){
|
||||||
err=err+ady;
|
err=err+ady;
|
||||||
if(err>=adx){
|
if(err>=adx){
|
||||||
err-=adx;
|
err-=adx;
|
||||||
|
|
@ -414,12 +420,11 @@ static void render_line0(int x0,int x1,int y0,int y1,int *d){
|
||||||
|
|
||||||
/* the floor has already been filtered to only include relevant sections */
|
/* the floor has already been filtered to only include relevant sections */
|
||||||
static int accumulate_fit(const float *flr,const float *mdct,
|
static int accumulate_fit(const float *flr,const float *mdct,
|
||||||
int x0, int x1,lsfit_acc *a,
|
int x0, int x1,lsfit_acc *a,
|
||||||
int n,vorbis_info_floor1 *info){
|
int n,vorbis_info_floor1 *info){
|
||||||
long i;
|
long i;
|
||||||
int quantized=vorbis_dBquant(flr+x0);
|
|
||||||
|
|
||||||
long xa=0,ya=0,x2a=0,y2a=0,xya=0,na=0, xb=0,yb=0,x2b=0,y2b=0,xyb=0,nb=0;
|
int xa=0,ya=0,x2a=0,y2a=0,xya=0,na=0, xb=0,yb=0,x2b=0,y2b=0,xyb=0,nb=0;
|
||||||
|
|
||||||
memset(a,0,sizeof(*a));
|
memset(a,0,sizeof(*a));
|
||||||
a->x0=x0;
|
a->x0=x0;
|
||||||
|
|
@ -430,114 +435,103 @@ static int accumulate_fit(const float *flr,const float *mdct,
|
||||||
int quantized=vorbis_dBquant(flr+i);
|
int quantized=vorbis_dBquant(flr+i);
|
||||||
if(quantized){
|
if(quantized){
|
||||||
if(mdct[i]+info->twofitatten>=flr[i]){
|
if(mdct[i]+info->twofitatten>=flr[i]){
|
||||||
xa += i;
|
xa += i;
|
||||||
ya += quantized;
|
ya += quantized;
|
||||||
x2a += i*i;
|
x2a += i*i;
|
||||||
y2a += quantized*quantized;
|
y2a += quantized*quantized;
|
||||||
xya += i*quantized;
|
xya += i*quantized;
|
||||||
na++;
|
na++;
|
||||||
}else{
|
}else{
|
||||||
xb += i;
|
xb += i;
|
||||||
yb += quantized;
|
yb += quantized;
|
||||||
x2b += i*i;
|
x2b += i*i;
|
||||||
y2b += quantized*quantized;
|
y2b += quantized*quantized;
|
||||||
xyb += i*quantized;
|
xyb += i*quantized;
|
||||||
nb++;
|
nb++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xb+=xa;
|
a->xa=xa;
|
||||||
yb+=ya;
|
a->ya=ya;
|
||||||
x2b+=x2a;
|
a->x2a=x2a;
|
||||||
y2b+=y2a;
|
a->y2a=y2a;
|
||||||
xyb+=xya;
|
a->xya=xya;
|
||||||
nb+=na;
|
a->an=na;
|
||||||
|
|
||||||
/* weight toward the actually used frequencies if we meet the threshhold */
|
a->xb=xb;
|
||||||
{
|
a->yb=yb;
|
||||||
int weight=nb*info->twofitweight/(na+1);
|
a->x2b=x2b;
|
||||||
|
a->y2b=y2b;
|
||||||
a->xa=xa*weight+xb;
|
a->xyb=xyb;
|
||||||
a->ya=ya*weight+yb;
|
a->bn=nb;
|
||||||
a->x2a=x2a*weight+x2b;
|
|
||||||
a->y2a=y2a*weight+y2b;
|
|
||||||
a->xya=xya*weight+xyb;
|
|
||||||
a->an=na*weight+nb;
|
|
||||||
}
|
|
||||||
|
|
||||||
return(na);
|
return(na);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fit_line(lsfit_acc *a,int fits,int *y0,int *y1){
|
static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1,
|
||||||
long x=0,y=0,x2=0,y2=0,xy=0,an=0,i;
|
vorbis_info_floor1 *info){
|
||||||
long x0=a[0].x0;
|
double xb=0,yb=0,x2b=0,y2b=0,xyb=0,bn=0;
|
||||||
long x1=a[fits-1].x1;
|
int i;
|
||||||
|
int x0=a[0].x0;
|
||||||
|
int x1=a[fits-1].x1;
|
||||||
|
|
||||||
for(i=0;i<fits;i++){
|
for(i=0;i<fits;i++){
|
||||||
x+=a[i].xa;
|
double weight = (a[i].bn+a[i].an)*info->twofitweight/(a[i].an+1)+1.;
|
||||||
y+=a[i].ya;
|
|
||||||
x2+=a[i].x2a;
|
xb+=a[i].xb + a[i].xa * weight;
|
||||||
y2+=a[i].y2a;
|
yb+=a[i].yb + a[i].ya * weight;
|
||||||
xy+=a[i].xya;
|
x2b+=a[i].x2b + a[i].x2a * weight;
|
||||||
an+=a[i].an;
|
y2b+=a[i].y2b + a[i].y2a * weight;
|
||||||
|
xyb+=a[i].xyb + a[i].xya * weight;
|
||||||
|
bn+=a[i].bn + a[i].an * weight;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*y0>=0){
|
if(*y0>=0){
|
||||||
x+= x0;
|
xb+= x0;
|
||||||
y+= *y0;
|
yb+= *y0;
|
||||||
x2+= x0 * x0;
|
x2b+= x0 * x0;
|
||||||
y2+= *y0 * *y0;
|
y2b+= *y0 * *y0;
|
||||||
xy+= *y0 * x0;
|
xyb+= *y0 * x0;
|
||||||
an++;
|
bn++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(*y1>=0){
|
if(*y1>=0){
|
||||||
x+= x1;
|
xb+= x1;
|
||||||
y+= *y1;
|
yb+= *y1;
|
||||||
x2+= x1 * x1;
|
x2b+= x1 * x1;
|
||||||
y2+= *y1 * *y1;
|
y2b+= *y1 * *y1;
|
||||||
xy+= *y1 * x1;
|
xyb+= *y1 * x1;
|
||||||
an++;
|
bn++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(an){
|
{
|
||||||
/* need 64 bit multiplies, which C doesn't give portably as int */
|
double denom=(bn*x2b-xb*xb);
|
||||||
double fx=x;
|
|
||||||
double fy=y;
|
|
||||||
double fx2=x2;
|
|
||||||
double fxy=xy;
|
|
||||||
double denom=1./(an*fx2-fx*fx);
|
|
||||||
double a=(fy*fx2-fxy*fx)*denom;
|
|
||||||
double b=(an*fxy-fx*fy)*denom;
|
|
||||||
*y0=rint(a+b*x0);
|
|
||||||
*y1=rint(a+b*x1);
|
|
||||||
|
|
||||||
/* limit to our range! */
|
if(denom>0.){
|
||||||
if(*y0>1023)*y0=1023;
|
double a=(yb*x2b-xyb*xb)/denom;
|
||||||
if(*y1>1023)*y1=1023;
|
double b=(bn*xyb-xb*yb)/denom;
|
||||||
if(*y0<0)*y0=0;
|
*y0=rint(a+b*x0);
|
||||||
if(*y1<0)*y1=0;
|
*y1=rint(a+b*x1);
|
||||||
|
|
||||||
}else{
|
/* limit to our range! */
|
||||||
*y0=0;
|
if(*y0>1023)*y0=1023;
|
||||||
*y1=0;
|
if(*y1>1023)*y1=1023;
|
||||||
|
if(*y0<0)*y0=0;
|
||||||
|
if(*y1<0)*y1=0;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
*y0=0;
|
||||||
|
*y1=0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*static void fit_line_point(lsfit_acc *a,int fits,int *y0,int *y1){
|
|
||||||
long y=0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for(i=0;i<fits && y==0;i++)
|
|
||||||
y+=a[i].ya;
|
|
||||||
|
|
||||||
*y0=*y1=y;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
static int inspect_error(int x0,int x1,int y0,int y1,const float *mask,
|
static int inspect_error(int x0,int x1,int y0,int y1,const float *mask,
|
||||||
const float *mdct,
|
const float *mdct,
|
||||||
vorbis_info_floor1 *info){
|
vorbis_info_floor1 *info){
|
||||||
int dy=y1-y0;
|
int dy=y1-y0;
|
||||||
int adx=x1-x0;
|
int adx=x1-x0;
|
||||||
int ady=abs(dy);
|
int ady=abs(dy);
|
||||||
|
|
@ -574,8 +568,8 @@ static int inspect_error(int x0,int x1,int y0,int y1,const float *mask,
|
||||||
n++;
|
n++;
|
||||||
if(mdct[x]+info->twofitatten>=mask[x]){
|
if(mdct[x]+info->twofitatten>=mask[x]){
|
||||||
if(val){
|
if(val){
|
||||||
if(y+info->maxover<val)return(1);
|
if(y+info->maxover<val)return(1);
|
||||||
if(y-info->maxunder>val)return(1);
|
if(y-info->maxunder>val)return(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -595,11 +589,9 @@ static int post_Y(int *A,int *B,int pos){
|
||||||
return (A[pos]+B[pos])>>1;
|
return (A[pos]+B[pos])>>1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int seq=0;
|
|
||||||
|
|
||||||
int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
const float *logmdct, /* in */
|
const float *logmdct, /* in */
|
||||||
const float *logmask){
|
const float *logmask){
|
||||||
long i,j;
|
long i,j;
|
||||||
vorbis_info_floor1 *info=look->vi;
|
vorbis_info_floor1 *info=look->vi;
|
||||||
long n=look->n;
|
long n=look->n;
|
||||||
|
|
@ -627,15 +619,15 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
}else{
|
}else{
|
||||||
for(i=0;i<posts-1;i++)
|
for(i=0;i<posts-1;i++)
|
||||||
nonzero+=accumulate_fit(logmask,logmdct,look->sorted_index[i],
|
nonzero+=accumulate_fit(logmask,logmdct,look->sorted_index[i],
|
||||||
look->sorted_index[i+1],fits+i,
|
look->sorted_index[i+1],fits+i,
|
||||||
n,info);
|
n,info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nonzero){
|
if(nonzero){
|
||||||
/* start by fitting the implicit base case.... */
|
/* start by fitting the implicit base case.... */
|
||||||
int y0=-200;
|
int y0=-200;
|
||||||
int y1=-200;
|
int y1=-200;
|
||||||
fit_line(fits,posts-1,&y0,&y1);
|
fit_line(fits,posts-1,&y0,&y1,info);
|
||||||
|
|
||||||
fit_valueA[0]=y0;
|
fit_valueA[0]=y0;
|
||||||
fit_valueB[0]=y0;
|
fit_valueB[0]=y0;
|
||||||
|
|
@ -653,59 +645,71 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
|
|
||||||
/* eliminate repeat searches of a particular range with a memo */
|
/* eliminate repeat searches of a particular range with a memo */
|
||||||
if(memo[ln]!=hn){
|
if(memo[ln]!=hn){
|
||||||
/* haven't performed this error search yet */
|
/* haven't performed this error search yet */
|
||||||
int lsortpos=look->reverse_index[ln];
|
int lsortpos=look->reverse_index[ln];
|
||||||
int hsortpos=look->reverse_index[hn];
|
int hsortpos=look->reverse_index[hn];
|
||||||
memo[ln]=hn;
|
memo[ln]=hn;
|
||||||
|
|
||||||
{
|
{
|
||||||
/* A note: we want to bound/minimize *local*, not global, error */
|
/* A note: we want to bound/minimize *local*, not global, error */
|
||||||
int lx=info->postlist[ln];
|
int lx=info->postlist[ln];
|
||||||
int hx=info->postlist[hn];
|
int hx=info->postlist[hn];
|
||||||
int ly=post_Y(fit_valueA,fit_valueB,ln);
|
int ly=post_Y(fit_valueA,fit_valueB,ln);
|
||||||
int hy=post_Y(fit_valueA,fit_valueB,hn);
|
int hy=post_Y(fit_valueA,fit_valueB,hn);
|
||||||
|
|
||||||
if(ly==-1 || hy==-1){
|
if(ly==-1 || hy==-1){
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inspect_error(lx,hx,ly,hy,logmask,logmdct,info)){
|
if(inspect_error(lx,hx,ly,hy,logmask,logmdct,info)){
|
||||||
/* outside error bounds/begin search area. Split it. */
|
/* outside error bounds/begin search area. Split it. */
|
||||||
int ly0=-200;
|
int ly0=-200;
|
||||||
int ly1=-200;
|
int ly1=-200;
|
||||||
int hy0=-200;
|
int hy0=-200;
|
||||||
int hy1=-200;
|
int hy1=-200;
|
||||||
fit_line(fits+lsortpos,sortpos-lsortpos,&ly0,&ly1);
|
int ret0=fit_line(fits+lsortpos,sortpos-lsortpos,&ly0,&ly1,info);
|
||||||
fit_line(fits+sortpos,hsortpos-sortpos,&hy0,&hy1);
|
int ret1=fit_line(fits+sortpos,hsortpos-sortpos,&hy0,&hy1,info);
|
||||||
|
|
||||||
/* store new edge values */
|
if(ret0){
|
||||||
fit_valueB[ln]=ly0;
|
ly0=ly;
|
||||||
if(ln==0)fit_valueA[ln]=ly0;
|
ly1=hy0;
|
||||||
fit_valueA[i]=ly1;
|
}
|
||||||
fit_valueB[i]=hy0;
|
if(ret1){
|
||||||
fit_valueA[hn]=hy1;
|
hy0=ly1;
|
||||||
if(hn==1)fit_valueB[hn]=hy1;
|
hy1=hy;
|
||||||
|
}
|
||||||
|
|
||||||
if(ly1>=0 || hy0>=0){
|
if(ret0 && ret1){
|
||||||
/* store new neighbor values */
|
fit_valueA[i]=-200;
|
||||||
for(j=sortpos-1;j>=0;j--)
|
fit_valueB[i]=-200;
|
||||||
if(hineighbor[j]==hn)
|
}else{
|
||||||
hineighbor[j]=i;
|
/* store new edge values */
|
||||||
else
|
fit_valueB[ln]=ly0;
|
||||||
break;
|
if(ln==0)fit_valueA[ln]=ly0;
|
||||||
for(j=sortpos+1;j<posts;j++)
|
fit_valueA[i]=ly1;
|
||||||
if(loneighbor[j]==ln)
|
fit_valueB[i]=hy0;
|
||||||
loneighbor[j]=i;
|
fit_valueA[hn]=hy1;
|
||||||
else
|
if(hn==1)fit_valueB[hn]=hy1;
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
if(ly1>=0 || hy0>=0){
|
||||||
}else{
|
/* store new neighbor values */
|
||||||
|
for(j=sortpos-1;j>=0;j--)
|
||||||
fit_valueA[i]=-200;
|
if(hineighbor[j]==hn)
|
||||||
fit_valueB[i]=-200;
|
hineighbor[j]=i;
|
||||||
}
|
else
|
||||||
}
|
break;
|
||||||
|
for(j=sortpos+1;j<posts;j++)
|
||||||
|
if(loneighbor[j]==ln)
|
||||||
|
loneighbor[j]=i;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
fit_valueA[i]=-200;
|
||||||
|
fit_valueB[i]=-200;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -729,9 +733,9 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
int vx=post_Y(fit_valueA,fit_valueB,i);
|
int vx=post_Y(fit_valueA,fit_valueB,i);
|
||||||
|
|
||||||
if(vx>=0 && predicted!=vx){
|
if(vx>=0 && predicted!=vx){
|
||||||
output[i]=vx;
|
output[i]=vx;
|
||||||
}else{
|
}else{
|
||||||
output[i]= predicted|0x8000;
|
output[i]= predicted|0x8000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -741,8 +745,8 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
}
|
}
|
||||||
|
|
||||||
int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
int *A,int *B,
|
int *A,int *B,
|
||||||
int del){
|
int del){
|
||||||
|
|
||||||
long i;
|
long i;
|
||||||
long posts=look->posts;
|
long posts=look->posts;
|
||||||
|
|
@ -751,6 +755,7 @@ int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
if(A && B){
|
if(A && B){
|
||||||
output=_vorbis_block_alloc(vb,sizeof(*output)*posts);
|
output=_vorbis_block_alloc(vb,sizeof(*output)*posts);
|
||||||
|
|
||||||
|
/* overly simpleminded--- look again post 1.2 */
|
||||||
for(i=0;i<posts;i++){
|
for(i=0;i<posts;i++){
|
||||||
output[i]=((65536-del)*(A[i]&0x7fff)+del*(B[i]&0x7fff)+32768)>>16;
|
output[i]=((65536-del)*(A[i]&0x7fff)+del*(B[i]&0x7fff)+32768)>>16;
|
||||||
if(A[i]&0x8000 && B[i]&0x8000)output[i]|=0x8000;
|
if(A[i]&0x8000 && B[i]&0x8000)output[i]|=0x8000;
|
||||||
|
|
@ -762,18 +767,16 @@ int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||||
|
|
||||||
|
|
||||||
int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
||||||
vorbis_look_floor1 *look,
|
vorbis_look_floor1 *look,
|
||||||
int *post,int *ilogmask){
|
int *post,int *ilogmask){
|
||||||
|
|
||||||
long i,j;
|
long i,j;
|
||||||
vorbis_info_floor1 *info=look->vi;
|
vorbis_info_floor1 *info=look->vi;
|
||||||
long n=look->n;
|
|
||||||
long posts=look->posts;
|
long posts=look->posts;
|
||||||
codec_setup_info *ci=vb->vd->vi->codec_setup;
|
codec_setup_info *ci=vb->vd->vi->codec_setup;
|
||||||
int out[VIF_POSIT+2];
|
int out[VIF_POSIT+2];
|
||||||
static_codebook **sbooks=ci->book_param;
|
static_codebook **sbooks=ci->book_param;
|
||||||
codebook *books=ci->fullbooks;
|
codebook *books=ci->fullbooks;
|
||||||
static long seq=0;
|
|
||||||
|
|
||||||
/* quantize values to multiplier spec */
|
/* quantize values to multiplier spec */
|
||||||
if(post){
|
if(post){
|
||||||
|
|
@ -781,17 +784,17 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
||||||
int val=post[i]&0x7fff;
|
int val=post[i]&0x7fff;
|
||||||
switch(info->mult){
|
switch(info->mult){
|
||||||
case 1: /* 1024 -> 256 */
|
case 1: /* 1024 -> 256 */
|
||||||
val>>=2;
|
val>>=2;
|
||||||
break;
|
break;
|
||||||
case 2: /* 1024 -> 128 */
|
case 2: /* 1024 -> 128 */
|
||||||
val>>=3;
|
val>>=3;
|
||||||
break;
|
break;
|
||||||
case 3: /* 1024 -> 86 */
|
case 3: /* 1024 -> 86 */
|
||||||
val/=12;
|
val/=12;
|
||||||
break;
|
break;
|
||||||
case 4: /* 1024 -> 64 */
|
case 4: /* 1024 -> 64 */
|
||||||
val>>=4;
|
val>>=4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
post[i]=val | (post[i]&0x8000);
|
post[i]=val | (post[i]&0x8000);
|
||||||
}
|
}
|
||||||
|
|
@ -811,35 +814,35 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
||||||
int predicted=render_point(x0,x1,y0,y1,info->postlist[i]);
|
int predicted=render_point(x0,x1,y0,y1,info->postlist[i]);
|
||||||
|
|
||||||
if((post[i]&0x8000) || (predicted==post[i])){
|
if((post[i]&0x8000) || (predicted==post[i])){
|
||||||
post[i]=predicted|0x8000; /* in case there was roundoff jitter
|
post[i]=predicted|0x8000; /* in case there was roundoff jitter
|
||||||
in interpolation */
|
in interpolation */
|
||||||
out[i]=0;
|
out[i]=0;
|
||||||
}else{
|
}else{
|
||||||
int headroom=(look->quant_q-predicted<predicted?
|
int headroom=(look->quant_q-predicted<predicted?
|
||||||
look->quant_q-predicted:predicted);
|
look->quant_q-predicted:predicted);
|
||||||
|
|
||||||
int val=post[i]-predicted;
|
int val=post[i]-predicted;
|
||||||
|
|
||||||
/* at this point the 'deviation' value is in the range +/- max
|
/* at this point the 'deviation' value is in the range +/- max
|
||||||
range, but the real, unique range can always be mapped to
|
range, but the real, unique range can always be mapped to
|
||||||
only [0-maxrange). So we want to wrap the deviation into
|
only [0-maxrange). So we want to wrap the deviation into
|
||||||
this limited range, but do it in the way that least screws
|
this limited range, but do it in the way that least screws
|
||||||
an essentially gaussian probability distribution. */
|
an essentially gaussian probability distribution. */
|
||||||
|
|
||||||
if(val<0)
|
if(val<0)
|
||||||
if(val<-headroom)
|
if(val<-headroom)
|
||||||
val=headroom-val-1;
|
val=headroom-val-1;
|
||||||
else
|
else
|
||||||
val=-1-(val<<1);
|
val=-1-(val<<1);
|
||||||
else
|
else
|
||||||
if(val>=headroom)
|
if(val>=headroom)
|
||||||
val= val+headroom;
|
val= val+headroom;
|
||||||
else
|
else
|
||||||
val<<=1;
|
val<<=1;
|
||||||
|
|
||||||
out[i]=val;
|
out[i]=val;
|
||||||
post[ln]&=0x7fff;
|
post[ln]&=0x7fff;
|
||||||
post[hn]&=0x7fff;
|
post[hn]&=0x7fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -867,66 +870,66 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
||||||
|
|
||||||
/* generate the partition's first stage cascade value */
|
/* generate the partition's first stage cascade value */
|
||||||
if(csubbits){
|
if(csubbits){
|
||||||
int maxval[8];
|
int maxval[8];
|
||||||
for(k=0;k<csub;k++){
|
for(k=0;k<csub;k++){
|
||||||
int booknum=info->class_subbook[class][k];
|
int booknum=info->class_subbook[class][k];
|
||||||
if(booknum<0){
|
if(booknum<0){
|
||||||
maxval[k]=1;
|
maxval[k]=1;
|
||||||
}else{
|
}else{
|
||||||
maxval[k]=sbooks[info->class_subbook[class][k]]->entries;
|
maxval[k]=sbooks[info->class_subbook[class][k]]->entries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(k=0;k<cdim;k++){
|
for(k=0;k<cdim;k++){
|
||||||
for(l=0;l<csub;l++){
|
for(l=0;l<csub;l++){
|
||||||
int val=out[j+k];
|
int val=out[j+k];
|
||||||
if(val<maxval[l]){
|
if(val<maxval[l]){
|
||||||
bookas[k]=l;
|
bookas[k]=l;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cval|= bookas[k]<<cshift;
|
cval|= bookas[k]<<cshift;
|
||||||
cshift+=csubbits;
|
cshift+=csubbits;
|
||||||
}
|
}
|
||||||
/* write it */
|
/* write it */
|
||||||
look->phrasebits+=
|
look->phrasebits+=
|
||||||
vorbis_book_encode(books+info->class_book[class],cval,opb);
|
vorbis_book_encode(books+info->class_book[class],cval,opb);
|
||||||
|
|
||||||
#ifdef TRAIN_FLOOR1
|
#ifdef TRAIN_FLOOR1
|
||||||
{
|
{
|
||||||
FILE *of;
|
FILE *of;
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
sprintf(buffer,"line_%dx%ld_class%d.vqd",
|
sprintf(buffer,"line_%dx%ld_class%d.vqd",
|
||||||
vb->pcmend/2,posts-2,class);
|
vb->pcmend/2,posts-2,class);
|
||||||
of=fopen(buffer,"a");
|
of=fopen(buffer,"a");
|
||||||
fprintf(of,"%d\n",cval);
|
fprintf(of,"%d\n",cval);
|
||||||
fclose(of);
|
fclose(of);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write post values */
|
/* write post values */
|
||||||
for(k=0;k<cdim;k++){
|
for(k=0;k<cdim;k++){
|
||||||
int book=info->class_subbook[class][bookas[k]];
|
int book=info->class_subbook[class][bookas[k]];
|
||||||
if(book>=0){
|
if(book>=0){
|
||||||
/* hack to allow training with 'bad' books */
|
/* hack to allow training with 'bad' books */
|
||||||
if(out[j+k]<(books+book)->entries)
|
if(out[j+k]<(books+book)->entries)
|
||||||
look->postbits+=vorbis_book_encode(books+book,
|
look->postbits+=vorbis_book_encode(books+book,
|
||||||
out[j+k],opb);
|
out[j+k],opb);
|
||||||
/*else
|
/*else
|
||||||
fprintf(stderr,"+!");*/
|
fprintf(stderr,"+!");*/
|
||||||
|
|
||||||
#ifdef TRAIN_FLOOR1
|
#ifdef TRAIN_FLOOR1
|
||||||
{
|
{
|
||||||
FILE *of;
|
FILE *of;
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
sprintf(buffer,"line_%dx%ld_%dsub%d.vqd",
|
sprintf(buffer,"line_%dx%ld_%dsub%d.vqd",
|
||||||
vb->pcmend/2,posts-2,class,bookas[k]);
|
vb->pcmend/2,posts-2,class,bookas[k]);
|
||||||
of=fopen(buffer,"a");
|
of=fopen(buffer,"a");
|
||||||
fprintf(of,"%d\n",out[j+k]);
|
fprintf(of,"%d\n",out[j+k]);
|
||||||
fclose(of);
|
fclose(of);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
j+=cdim;
|
j+=cdim;
|
||||||
}
|
}
|
||||||
|
|
@ -937,28 +940,28 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
||||||
int hx=0;
|
int hx=0;
|
||||||
int lx=0;
|
int lx=0;
|
||||||
int ly=post[0]*info->mult;
|
int ly=post[0]*info->mult;
|
||||||
|
int n=ci->blocksizes[vb->W]/2;
|
||||||
|
|
||||||
for(j=1;j<look->posts;j++){
|
for(j=1;j<look->posts;j++){
|
||||||
int current=look->forward_index[j];
|
int current=look->forward_index[j];
|
||||||
int hy=post[current]&0x7fff;
|
int hy=post[current]&0x7fff;
|
||||||
if(hy==post[current]){
|
if(hy==post[current]){
|
||||||
|
|
||||||
hy*=info->mult;
|
hy*=info->mult;
|
||||||
hx=info->postlist[current];
|
hx=info->postlist[current];
|
||||||
|
|
||||||
render_line0(lx,hx,ly,hy,ilogmask);
|
render_line0(n,lx,hx,ly,hy,ilogmask);
|
||||||
|
|
||||||
lx=hx;
|
lx=hx;
|
||||||
ly=hy;
|
ly=hy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(j=hx;j<vb->pcmend/2;j++)ilogmask[j]=ly; /* be certain */
|
for(j=hx;j<vb->pcmend/2;j++)ilogmask[j]=ly; /* be certain */
|
||||||
seq++;
|
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
oggpack_write(opb,0,1);
|
oggpack_write(opb,0,1);
|
||||||
memset(ilogmask,0,vb->pcmend/2*sizeof(*ilogmask));
|
memset(ilogmask,0,vb->pcmend/2*sizeof(*ilogmask));
|
||||||
seq++;
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -988,20 +991,20 @@ static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
|
||||||
|
|
||||||
/* decode the partition's first stage cascade value */
|
/* decode the partition's first stage cascade value */
|
||||||
if(csubbits){
|
if(csubbits){
|
||||||
cval=vorbis_book_decode(books+info->class_book[class],&vb->opb);
|
cval=vorbis_book_decode(books+info->class_book[class],&vb->opb);
|
||||||
|
|
||||||
if(cval==-1)goto eop;
|
if(cval==-1)goto eop;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(k=0;k<cdim;k++){
|
for(k=0;k<cdim;k++){
|
||||||
int book=info->class_subbook[class][cval&(csub-1)];
|
int book=info->class_subbook[class][cval&(csub-1)];
|
||||||
cval>>=csubbits;
|
cval>>=csubbits;
|
||||||
if(book>=0){
|
if(book>=0){
|
||||||
if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1)
|
if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1)
|
||||||
goto eop;
|
goto eop;
|
||||||
}else{
|
}else{
|
||||||
fit_value[j+k]=0;
|
fit_value[j+k]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
j+=cdim;
|
j+=cdim;
|
||||||
}
|
}
|
||||||
|
|
@ -1009,36 +1012,36 @@ static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
|
||||||
/* unwrap positive values and reconsitute via linear interpolation */
|
/* unwrap positive values and reconsitute via linear interpolation */
|
||||||
for(i=2;i<look->posts;i++){
|
for(i=2;i<look->posts;i++){
|
||||||
int predicted=render_point(info->postlist[look->loneighbor[i-2]],
|
int predicted=render_point(info->postlist[look->loneighbor[i-2]],
|
||||||
info->postlist[look->hineighbor[i-2]],
|
info->postlist[look->hineighbor[i-2]],
|
||||||
fit_value[look->loneighbor[i-2]],
|
fit_value[look->loneighbor[i-2]],
|
||||||
fit_value[look->hineighbor[i-2]],
|
fit_value[look->hineighbor[i-2]],
|
||||||
info->postlist[i]);
|
info->postlist[i]);
|
||||||
int hiroom=look->quant_q-predicted;
|
int hiroom=look->quant_q-predicted;
|
||||||
int loroom=predicted;
|
int loroom=predicted;
|
||||||
int room=(hiroom<loroom?hiroom:loroom)<<1;
|
int room=(hiroom<loroom?hiroom:loroom)<<1;
|
||||||
int val=fit_value[i];
|
int val=fit_value[i];
|
||||||
|
|
||||||
if(val){
|
if(val){
|
||||||
if(val>=room){
|
if(val>=room){
|
||||||
if(hiroom>loroom){
|
if(hiroom>loroom){
|
||||||
val = val-loroom;
|
val = val-loroom;
|
||||||
}else{
|
}else{
|
||||||
val = -1-(val-hiroom);
|
val = -1-(val-hiroom);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(val&1){
|
if(val&1){
|
||||||
val= -((val+1)>>1);
|
val= -((val+1)>>1);
|
||||||
}else{
|
}else{
|
||||||
val>>=1;
|
val>>=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fit_value[i]=val+predicted;
|
fit_value[i]=(val+predicted)&0x7fff;
|
||||||
fit_value[look->loneighbor[i-2]]&=0x7fff;
|
fit_value[look->loneighbor[i-2]]&=0x7fff;
|
||||||
fit_value[look->hineighbor[i-2]]&=0x7fff;
|
fit_value[look->hineighbor[i-2]]&=0x7fff;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
fit_value[i]=predicted|0x8000;
|
fit_value[i]=predicted|0x8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1050,7 +1053,7 @@ static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
|
||||||
}
|
}
|
||||||
|
|
||||||
static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
|
static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
|
||||||
float *out){
|
float *out){
|
||||||
vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
|
vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
|
||||||
vorbis_info_floor1 *info=look->vi;
|
vorbis_info_floor1 *info=look->vi;
|
||||||
|
|
||||||
|
|
@ -1064,18 +1067,23 @@ static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
|
||||||
int hx=0;
|
int hx=0;
|
||||||
int lx=0;
|
int lx=0;
|
||||||
int ly=fit_value[0]*info->mult;
|
int ly=fit_value[0]*info->mult;
|
||||||
|
/* guard lookup against out-of-range values */
|
||||||
|
ly=(ly<0?0:ly>255?255:ly);
|
||||||
|
|
||||||
for(j=1;j<look->posts;j++){
|
for(j=1;j<look->posts;j++){
|
||||||
int current=look->forward_index[j];
|
int current=look->forward_index[j];
|
||||||
int hy=fit_value[current]&0x7fff;
|
int hy=fit_value[current]&0x7fff;
|
||||||
if(hy==fit_value[current]){
|
if(hy==fit_value[current]){
|
||||||
|
|
||||||
hy*=info->mult;
|
hx=info->postlist[current];
|
||||||
hx=info->postlist[current];
|
hy*=info->mult;
|
||||||
|
/* guard lookup against out-of-range values */
|
||||||
|
hy=(hy<0?0:hy>255?255:hy);
|
||||||
|
|
||||||
render_line(n,lx,hx,ly,hy,out);
|
render_line(n,lx,hx,ly,hy,out);
|
||||||
|
|
||||||
lx=hx;
|
lx=hx;
|
||||||
ly=hy;
|
ly=hy;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(j=hx;j<n;j++)out[j]*=FLOOR1_fromdB_LOOKUP[ly]; /* be certain */
|
for(j=hx;j<n;j++)out[j]*=FLOOR1_fromdB_LOOKUP[ly]; /* be certain */
|
||||||
|
|
@ -1086,9 +1094,7 @@ static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* export hooks */
|
/* export hooks */
|
||||||
vorbis_func_floor floor1_exportbundle={
|
const vorbis_func_floor floor1_exportbundle={
|
||||||
&floor1_pack,&floor1_unpack,&floor1_look,&floor1_free_info,
|
&floor1_pack,&floor1_unpack,&floor1_look,&floor1_free_info,
|
||||||
&floor1_free_look,&floor1_inverse1,&floor1_inverse2
|
&floor1_free_look,&floor1_inverse1,&floor1_inverse2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: highlevel encoder setup struct seperated out for vorbisenc clarity
|
function: highlevel encoder setup struct separated out for vorbisenc clarity
|
||||||
last mod: $Id: highlevel.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -23,14 +23,14 @@ typedef struct highlevel_byblocktype {
|
||||||
} highlevel_byblocktype;
|
} highlevel_byblocktype;
|
||||||
|
|
||||||
typedef struct highlevel_encode_setup {
|
typedef struct highlevel_encode_setup {
|
||||||
void *setup;
|
|
||||||
int set_in_stone;
|
int set_in_stone;
|
||||||
|
const void *setup;
|
||||||
double base_setting;
|
double base_setting;
|
||||||
double long_setting;
|
|
||||||
double short_setting;
|
|
||||||
double impulse_noisetune;
|
double impulse_noisetune;
|
||||||
|
|
||||||
|
/* bitrate management below all settable */
|
||||||
|
float req;
|
||||||
int managed;
|
int managed;
|
||||||
long bitrate_min;
|
long bitrate_min;
|
||||||
long bitrate_av;
|
long bitrate_av;
|
||||||
|
|
@ -41,9 +41,11 @@ typedef struct highlevel_encode_setup {
|
||||||
|
|
||||||
int impulse_block_p;
|
int impulse_block_p;
|
||||||
int noise_normalize_p;
|
int noise_normalize_p;
|
||||||
|
int coupling_p;
|
||||||
|
|
||||||
double stereo_point_setting;
|
double stereo_point_setting;
|
||||||
double lowpass_kHz;
|
double lowpass_kHz;
|
||||||
|
int lowpass_altered;
|
||||||
|
|
||||||
double ath_floating_dB;
|
double ath_floating_dB;
|
||||||
double ath_absolute_dB;
|
double ath_absolute_dB;
|
||||||
|
|
@ -54,4 +56,3 @@ typedef struct highlevel_encode_setup {
|
||||||
highlevel_byblocktype block[4]; /* padding, impulse, transition, long */
|
highlevel_byblocktype block[4]; /* padding, impulse, transition, long */
|
||||||
|
|
||||||
} highlevel_encode_setup;
|
} highlevel_encode_setup;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: maintain the info structure, info <-> header packets
|
function: maintain the info structure, info <-> header packets
|
||||||
last mod: $Id: info.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: info.c 18186 2012-02-03 22:08:44Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -31,6 +31,9 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.3"
|
||||||
|
#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20120203 (Omnipresent)"
|
||||||
|
|
||||||
/* helpers */
|
/* helpers */
|
||||||
static int ilog2(unsigned int v){
|
static int ilog2(unsigned int v){
|
||||||
int ret=0;
|
int ret=0;
|
||||||
|
|
@ -42,7 +45,7 @@ static int ilog2(unsigned int v){
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _v_writestring(oggpack_buffer *o,char *s, int bytes){
|
static void _v_writestring(oggpack_buffer *o,const char *s, int bytes){
|
||||||
|
|
||||||
while(bytes--){
|
while(bytes--){
|
||||||
oggpack_write(o,*s++,8);
|
oggpack_write(o,*s++,8);
|
||||||
|
|
@ -59,11 +62,11 @@ void vorbis_comment_init(vorbis_comment *vc){
|
||||||
memset(vc,0,sizeof(*vc));
|
memset(vc,0,sizeof(*vc));
|
||||||
}
|
}
|
||||||
|
|
||||||
void vorbis_comment_add(vorbis_comment *vc,char *comment){
|
void vorbis_comment_add(vorbis_comment *vc,const char *comment){
|
||||||
vc->user_comments=_ogg_realloc(vc->user_comments,
|
vc->user_comments=_ogg_realloc(vc->user_comments,
|
||||||
(vc->comments+2)*sizeof(*vc->user_comments));
|
(vc->comments+2)*sizeof(*vc->user_comments));
|
||||||
vc->comment_lengths=_ogg_realloc(vc->comment_lengths,
|
vc->comment_lengths=_ogg_realloc(vc->comment_lengths,
|
||||||
(vc->comments+2)*sizeof(*vc->comment_lengths));
|
(vc->comments+2)*sizeof(*vc->comment_lengths));
|
||||||
vc->comment_lengths[vc->comments]=strlen(comment);
|
vc->comment_lengths[vc->comments]=strlen(comment);
|
||||||
vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1);
|
vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1);
|
||||||
strcpy(vc->user_comments[vc->comments], comment);
|
strcpy(vc->user_comments[vc->comments], comment);
|
||||||
|
|
@ -71,7 +74,7 @@ void vorbis_comment_add(vorbis_comment *vc,char *comment){
|
||||||
vc->user_comments[vc->comments]=NULL;
|
vc->user_comments[vc->comments]=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents){
|
void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents){
|
||||||
char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */
|
char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */
|
||||||
strcpy(comment, tag);
|
strcpy(comment, tag);
|
||||||
strcat(comment, "=");
|
strcat(comment, "=");
|
||||||
|
|
@ -91,7 +94,7 @@ static int tagcompare(const char *s1, const char *s2, int n){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
|
char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count){
|
||||||
long i;
|
long i;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
int taglen = strlen(tag)+1; /* +1 for the = we append */
|
int taglen = strlen(tag)+1; /* +1 for the = we append */
|
||||||
|
|
@ -103,16 +106,16 @@ char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
|
||||||
for(i=0;i<vc->comments;i++){
|
for(i=0;i<vc->comments;i++){
|
||||||
if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
|
if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
|
||||||
if(count == found)
|
if(count == found)
|
||||||
/* We return a pointer to the data, not a copy */
|
/* We return a pointer to the data, not a copy */
|
||||||
return vc->user_comments[i] + taglen;
|
return vc->user_comments[i] + taglen;
|
||||||
else
|
else
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL; /* didn't find anything */
|
return NULL; /* didn't find anything */
|
||||||
}
|
}
|
||||||
|
|
||||||
int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
|
int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){
|
||||||
int i,count=0;
|
int i,count=0;
|
||||||
int taglen = strlen(tag)+1; /* +1 for the = we append */
|
int taglen = strlen(tag)+1; /* +1 for the = we append */
|
||||||
char *fulltag = alloca(taglen+1);
|
char *fulltag = alloca(taglen+1);
|
||||||
|
|
@ -130,10 +133,12 @@ int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
|
||||||
void vorbis_comment_clear(vorbis_comment *vc){
|
void vorbis_comment_clear(vorbis_comment *vc){
|
||||||
if(vc){
|
if(vc){
|
||||||
long i;
|
long i;
|
||||||
for(i=0;i<vc->comments;i++)
|
if(vc->user_comments){
|
||||||
if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
|
for(i=0;i<vc->comments;i++)
|
||||||
if(vc->user_comments)_ogg_free(vc->user_comments);
|
if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
|
||||||
if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
|
_ogg_free(vc->user_comments);
|
||||||
|
}
|
||||||
|
if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
|
||||||
if(vc->vendor)_ogg_free(vc->vendor);
|
if(vc->vendor)_ogg_free(vc->vendor);
|
||||||
memset(vc,0,sizeof(*vc));
|
memset(vc,0,sizeof(*vc));
|
||||||
}
|
}
|
||||||
|
|
@ -163,32 +168,32 @@ void vorbis_info_clear(vorbis_info *vi){
|
||||||
|
|
||||||
for(i=0;i<ci->maps;i++) /* unpack does the range checking */
|
for(i=0;i<ci->maps;i++) /* unpack does the range checking */
|
||||||
if(ci->map_param[i]) /* this may be cleaning up an aborted
|
if(ci->map_param[i]) /* this may be cleaning up an aborted
|
||||||
unpack, in which case the below type
|
unpack, in which case the below type
|
||||||
cannot be trusted */
|
cannot be trusted */
|
||||||
_mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
|
_mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
|
||||||
|
|
||||||
for(i=0;i<ci->floors;i++) /* unpack does the range checking */
|
for(i=0;i<ci->floors;i++) /* unpack does the range checking */
|
||||||
if(ci->floor_param[i]) /* this may be cleaning up an aborted
|
if(ci->floor_param[i]) /* this may be cleaning up an aborted
|
||||||
unpack, in which case the below type
|
unpack, in which case the below type
|
||||||
cannot be trusted */
|
cannot be trusted */
|
||||||
_floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
|
_floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
|
||||||
|
|
||||||
for(i=0;i<ci->residues;i++) /* unpack does the range checking */
|
for(i=0;i<ci->residues;i++) /* unpack does the range checking */
|
||||||
if(ci->residue_param[i]) /* this may be cleaning up an aborted
|
if(ci->residue_param[i]) /* this may be cleaning up an aborted
|
||||||
unpack, in which case the below type
|
unpack, in which case the below type
|
||||||
cannot be trusted */
|
cannot be trusted */
|
||||||
_residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
|
_residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
|
||||||
|
|
||||||
for(i=0;i<ci->books;i++){
|
for(i=0;i<ci->books;i++){
|
||||||
if(ci->book_param[i]){
|
if(ci->book_param[i]){
|
||||||
/* knows if the book was not alloced */
|
/* knows if the book was not alloced */
|
||||||
vorbis_staticbook_destroy(ci->book_param[i]);
|
vorbis_staticbook_destroy(ci->book_param[i]);
|
||||||
}
|
}
|
||||||
if(ci->fullbooks)
|
if(ci->fullbooks)
|
||||||
vorbis_book_clear(ci->fullbooks+i);
|
vorbis_book_clear(ci->fullbooks+i);
|
||||||
}
|
}
|
||||||
if(ci->fullbooks)
|
if(ci->fullbooks)
|
||||||
_ogg_free(ci->fullbooks);
|
_ogg_free(ci->fullbooks);
|
||||||
|
|
||||||
for(i=0;i<ci->psys;i++)
|
for(i=0;i<ci->psys;i++)
|
||||||
_vi_psy_free(ci->psy_param[i]);
|
_vi_psy_free(ci->psy_param[i]);
|
||||||
|
|
@ -236,17 +241,21 @@ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
|
||||||
int i;
|
int i;
|
||||||
int vendorlen=oggpack_read(opb,32);
|
int vendorlen=oggpack_read(opb,32);
|
||||||
if(vendorlen<0)goto err_out;
|
if(vendorlen<0)goto err_out;
|
||||||
|
if(vendorlen>opb->storage-8)goto err_out;
|
||||||
vc->vendor=_ogg_calloc(vendorlen+1,1);
|
vc->vendor=_ogg_calloc(vendorlen+1,1);
|
||||||
_v_readstring(opb,vc->vendor,vendorlen);
|
_v_readstring(opb,vc->vendor,vendorlen);
|
||||||
vc->comments=oggpack_read(opb,32);
|
i=oggpack_read(opb,32);
|
||||||
if(vc->comments<0)goto err_out;
|
if(i<0)goto err_out;
|
||||||
|
if(i>((opb->storage-oggpack_bytes(opb))>>2))goto err_out;
|
||||||
|
vc->comments=i;
|
||||||
vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
|
vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
|
||||||
vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
|
vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
|
||||||
|
|
||||||
for(i=0;i<vc->comments;i++){
|
for(i=0;i<vc->comments;i++){
|
||||||
int len=oggpack_read(opb,32);
|
int len=oggpack_read(opb,32);
|
||||||
if(len<0)goto err_out;
|
if(len<0)goto err_out;
|
||||||
vc->comment_lengths[i]=len;
|
if(len>opb->storage-oggpack_bytes(opb))goto err_out;
|
||||||
|
vc->comment_lengths[i]=len;
|
||||||
vc->user_comments[i]=_ogg_calloc(len+1,1);
|
vc->user_comments[i]=_ogg_calloc(len+1,1);
|
||||||
_v_readstring(opb,vc->user_comments[i],len);
|
_v_readstring(opb,vc->user_comments[i],len);
|
||||||
}
|
}
|
||||||
|
|
@ -267,15 +276,16 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
||||||
|
|
||||||
/* codebooks */
|
/* codebooks */
|
||||||
ci->books=oggpack_read(opb,8)+1;
|
ci->books=oggpack_read(opb,8)+1;
|
||||||
/*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/
|
if(ci->books<=0)goto err_out;
|
||||||
for(i=0;i<ci->books;i++){
|
for(i=0;i<ci->books;i++){
|
||||||
ci->book_param[i]=_ogg_calloc(1,sizeof(*ci->book_param[i]));
|
ci->book_param[i]=vorbis_staticbook_unpack(opb);
|
||||||
if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
|
if(!ci->book_param[i])goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* time backend settings; hooks are unused */
|
/* time backend settings; hooks are unused */
|
||||||
{
|
{
|
||||||
int times=oggpack_read(opb,6)+1;
|
int times=oggpack_read(opb,6)+1;
|
||||||
|
if(times<=0)goto err_out;
|
||||||
for(i=0;i<times;i++){
|
for(i=0;i<times;i++){
|
||||||
int test=oggpack_read(opb,16);
|
int test=oggpack_read(opb,16);
|
||||||
if(test<0 || test>=VI_TIMEB)goto err_out;
|
if(test<0 || test>=VI_TIMEB)goto err_out;
|
||||||
|
|
@ -284,8 +294,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
||||||
|
|
||||||
/* floor backend settings */
|
/* floor backend settings */
|
||||||
ci->floors=oggpack_read(opb,6)+1;
|
ci->floors=oggpack_read(opb,6)+1;
|
||||||
/*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/
|
if(ci->floors<=0)goto err_out;
|
||||||
/*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/
|
|
||||||
for(i=0;i<ci->floors;i++){
|
for(i=0;i<ci->floors;i++){
|
||||||
ci->floor_type[i]=oggpack_read(opb,16);
|
ci->floor_type[i]=oggpack_read(opb,16);
|
||||||
if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
|
if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
|
||||||
|
|
@ -295,8 +304,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
||||||
|
|
||||||
/* residue backend settings */
|
/* residue backend settings */
|
||||||
ci->residues=oggpack_read(opb,6)+1;
|
ci->residues=oggpack_read(opb,6)+1;
|
||||||
/*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/
|
if(ci->residues<=0)goto err_out;
|
||||||
/*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/
|
|
||||||
for(i=0;i<ci->residues;i++){
|
for(i=0;i<ci->residues;i++){
|
||||||
ci->residue_type[i]=oggpack_read(opb,16);
|
ci->residue_type[i]=oggpack_read(opb,16);
|
||||||
if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
|
if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
|
||||||
|
|
@ -306,8 +314,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
||||||
|
|
||||||
/* map backend settings */
|
/* map backend settings */
|
||||||
ci->maps=oggpack_read(opb,6)+1;
|
ci->maps=oggpack_read(opb,6)+1;
|
||||||
/*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/
|
if(ci->maps<=0)goto err_out;
|
||||||
/*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/
|
|
||||||
for(i=0;i<ci->maps;i++){
|
for(i=0;i<ci->maps;i++){
|
||||||
ci->map_type[i]=oggpack_read(opb,16);
|
ci->map_type[i]=oggpack_read(opb,16);
|
||||||
if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
|
if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
|
||||||
|
|
@ -317,7 +324,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
||||||
|
|
||||||
/* mode settings */
|
/* mode settings */
|
||||||
ci->modes=oggpack_read(opb,6)+1;
|
ci->modes=oggpack_read(opb,6)+1;
|
||||||
/*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/
|
if(ci->modes<=0)goto err_out;
|
||||||
for(i=0;i<ci->modes;i++){
|
for(i=0;i<ci->modes;i++){
|
||||||
ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i]));
|
ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i]));
|
||||||
ci->mode_param[i]->blockflag=oggpack_read(opb,1);
|
ci->mode_param[i]->blockflag=oggpack_read(opb,1);
|
||||||
|
|
@ -328,6 +335,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
||||||
if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
|
if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
|
||||||
if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
|
if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
|
||||||
if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
|
if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
|
||||||
|
if(ci->mode_param[i]->mapping<0)goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
|
if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
|
||||||
|
|
@ -382,42 +390,42 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op)
|
||||||
memset(buffer,0,6);
|
memset(buffer,0,6);
|
||||||
_v_readstring(&opb,buffer,6);
|
_v_readstring(&opb,buffer,6);
|
||||||
if(memcmp(buffer,"vorbis",6)){
|
if(memcmp(buffer,"vorbis",6)){
|
||||||
/* not a vorbis header */
|
/* not a vorbis header */
|
||||||
return(OV_ENOTVORBIS);
|
return(OV_ENOTVORBIS);
|
||||||
}
|
}
|
||||||
switch(packtype){
|
switch(packtype){
|
||||||
case 0x01: /* least significant *bit* is read first */
|
case 0x01: /* least significant *bit* is read first */
|
||||||
if(!op->b_o_s){
|
if(!op->b_o_s){
|
||||||
/* Not the initial packet */
|
/* Not the initial packet */
|
||||||
return(OV_EBADHEADER);
|
return(OV_EBADHEADER);
|
||||||
}
|
}
|
||||||
if(vi->rate!=0){
|
if(vi->rate!=0){
|
||||||
/* previously initialized info header */
|
/* previously initialized info header */
|
||||||
return(OV_EBADHEADER);
|
return(OV_EBADHEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(_vorbis_unpack_info(vi,&opb));
|
return(_vorbis_unpack_info(vi,&opb));
|
||||||
|
|
||||||
case 0x03: /* least significant *bit* is read first */
|
case 0x03: /* least significant *bit* is read first */
|
||||||
if(vi->rate==0){
|
if(vi->rate==0){
|
||||||
/* um... we didn't get the initial header */
|
/* um... we didn't get the initial header */
|
||||||
return(OV_EBADHEADER);
|
return(OV_EBADHEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(_vorbis_unpack_comment(vc,&opb));
|
return(_vorbis_unpack_comment(vc,&opb));
|
||||||
|
|
||||||
case 0x05: /* least significant *bit* is read first */
|
case 0x05: /* least significant *bit* is read first */
|
||||||
if(vi->rate==0 || vc->vendor==NULL){
|
if(vi->rate==0 || vc->vendor==NULL){
|
||||||
/* um... we didn;t get the initial header or comments yet */
|
/* um... we didn;t get the initial header or comments yet */
|
||||||
return(OV_EBADHEADER);
|
return(OV_EBADHEADER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(_vorbis_unpack_books(vi,&opb));
|
return(_vorbis_unpack_books(vi,&opb));
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Not a valid vorbis header type */
|
/* Not a valid vorbis header type */
|
||||||
return(OV_EBADHEADER);
|
return(OV_EBADHEADER);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -451,8 +459,7 @@ static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
|
static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
|
||||||
char temp[]="Xiph.Org libVorbis I 20070622";
|
int bytes = strlen(ENCODE_VENDOR_STRING);
|
||||||
int bytes = strlen(temp);
|
|
||||||
|
|
||||||
/* preamble */
|
/* preamble */
|
||||||
oggpack_write(opb,0x03,8);
|
oggpack_write(opb,0x03,8);
|
||||||
|
|
@ -460,7 +467,7 @@ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
|
||||||
|
|
||||||
/* vendor */
|
/* vendor */
|
||||||
oggpack_write(opb,bytes,32);
|
oggpack_write(opb,bytes,32);
|
||||||
_v_writestring(opb,temp, bytes);
|
_v_writestring(opb,ENCODE_VENDOR_STRING, bytes);
|
||||||
|
|
||||||
/* comments */
|
/* comments */
|
||||||
|
|
||||||
|
|
@ -469,10 +476,10 @@ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
|
||||||
int i;
|
int i;
|
||||||
for(i=0;i<vc->comments;i++){
|
for(i=0;i<vc->comments;i++){
|
||||||
if(vc->user_comments[i]){
|
if(vc->user_comments[i]){
|
||||||
oggpack_write(opb,vc->comment_lengths[i],32);
|
oggpack_write(opb,vc->comment_lengths[i],32);
|
||||||
_v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]);
|
_v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]);
|
||||||
}else{
|
}else{
|
||||||
oggpack_write(opb,0,32);
|
oggpack_write(opb,0,32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -538,12 +545,15 @@ err_out:
|
||||||
}
|
}
|
||||||
|
|
||||||
int vorbis_commentheader_out(vorbis_comment *vc,
|
int vorbis_commentheader_out(vorbis_comment *vc,
|
||||||
ogg_packet *op){
|
ogg_packet *op){
|
||||||
|
|
||||||
oggpack_buffer opb;
|
oggpack_buffer opb;
|
||||||
|
|
||||||
oggpack_writeinit(&opb);
|
oggpack_writeinit(&opb);
|
||||||
if(_vorbis_pack_comment(&opb,vc)) return OV_EIMPL;
|
if(_vorbis_pack_comment(&opb,vc)){
|
||||||
|
oggpack_writeclear(&opb);
|
||||||
|
return OV_EIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
op->packet = _ogg_malloc(oggpack_bytes(&opb));
|
op->packet = _ogg_malloc(oggpack_bytes(&opb));
|
||||||
memcpy(op->packet, opb.buffer, oggpack_bytes(&opb));
|
memcpy(op->packet, opb.buffer, oggpack_bytes(&opb));
|
||||||
|
|
@ -554,14 +564,15 @@ int vorbis_commentheader_out(vorbis_comment *vc,
|
||||||
op->granulepos=0;
|
op->granulepos=0;
|
||||||
op->packetno=1;
|
op->packetno=1;
|
||||||
|
|
||||||
|
oggpack_writeclear(&opb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vorbis_analysis_headerout(vorbis_dsp_state *v,
|
int vorbis_analysis_headerout(vorbis_dsp_state *v,
|
||||||
vorbis_comment *vc,
|
vorbis_comment *vc,
|
||||||
ogg_packet *op,
|
ogg_packet *op,
|
||||||
ogg_packet *op_comm,
|
ogg_packet *op_comm,
|
||||||
ogg_packet *op_code){
|
ogg_packet *op_code){
|
||||||
int ret=OV_EIMPL;
|
int ret=OV_EIMPL;
|
||||||
vorbis_info *vi=v->vi;
|
vorbis_info *vi=v->vi;
|
||||||
oggpack_buffer opb;
|
oggpack_buffer opb;
|
||||||
|
|
@ -621,12 +632,12 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
|
||||||
oggpack_writeclear(&opb);
|
oggpack_writeclear(&opb);
|
||||||
return(0);
|
return(0);
|
||||||
err_out:
|
err_out:
|
||||||
oggpack_writeclear(&opb);
|
|
||||||
memset(op,0,sizeof(*op));
|
memset(op,0,sizeof(*op));
|
||||||
memset(op_comm,0,sizeof(*op_comm));
|
memset(op_comm,0,sizeof(*op_comm));
|
||||||
memset(op_code,0,sizeof(*op_code));
|
memset(op_code,0,sizeof(*op_code));
|
||||||
|
|
||||||
if(b){
|
if(b){
|
||||||
|
oggpack_writeclear(&opb);
|
||||||
if(b->header)_ogg_free(b->header);
|
if(b->header)_ogg_free(b->header);
|
||||||
if(b->header1)_ogg_free(b->header1);
|
if(b->header1)_ogg_free(b->header1);
|
||||||
if(b->header2)_ogg_free(b->header2);
|
if(b->header2)_ogg_free(b->header2);
|
||||||
|
|
@ -638,7 +649,20 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
|
||||||
}
|
}
|
||||||
|
|
||||||
double vorbis_granule_time(vorbis_dsp_state *v,ogg_int64_t granulepos){
|
double vorbis_granule_time(vorbis_dsp_state *v,ogg_int64_t granulepos){
|
||||||
if(granulepos>=0)
|
if(granulepos == -1) return -1;
|
||||||
|
|
||||||
|
/* We're not guaranteed a 64 bit unsigned type everywhere, so we
|
||||||
|
have to put the unsigned granpo in a signed type. */
|
||||||
|
if(granulepos>=0){
|
||||||
return((double)granulepos/v->vi->rate);
|
return((double)granulepos/v->vi->rate);
|
||||||
return(-1);
|
}else{
|
||||||
|
ogg_int64_t granuleoff=0xffffffff;
|
||||||
|
granuleoff<<=31;
|
||||||
|
granuleoff|=0x7ffffffff;
|
||||||
|
return(((double)granulepos+2+granuleoff+granuleoff)/v->vi->rate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *vorbis_version_string(void){
|
||||||
|
return GENERAL_VENDOR_STRING;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: lookup based functions
|
function: lookup based functions
|
||||||
last mod: $Id: lookup.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: lookup.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ long vorbis_coslook_i(long a){
|
||||||
int i=a>>COS_LOOKUP_I_SHIFT;
|
int i=a>>COS_LOOKUP_I_SHIFT;
|
||||||
int d=a&COS_LOOKUP_I_MASK;
|
int d=a&COS_LOOKUP_I_MASK;
|
||||||
return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
|
return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
|
||||||
COS_LOOKUP_I_SHIFT);
|
COS_LOOKUP_I_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: lookup based functions
|
function: lookup based functions
|
||||||
last mod: $Id: lookup.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: lookup data; generated by lookups.pl; edit there
|
function: lookup data; generated by lookups.pl; edit there
|
||||||
last mod: $Id: lookup_data.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: lookup_data.h 16037 2009-05-26 21:10:58Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -19,76 +19,76 @@
|
||||||
|
|
||||||
#ifdef FLOAT_LOOKUP
|
#ifdef FLOAT_LOOKUP
|
||||||
#define COS_LOOKUP_SZ 128
|
#define COS_LOOKUP_SZ 128
|
||||||
static float COS_LOOKUP[COS_LOOKUP_SZ+1]={
|
static const float COS_LOOKUP[COS_LOOKUP_SZ+1]={
|
||||||
+1.0000000000000f,+0.9996988186962f,+0.9987954562052f,+0.9972904566787f,
|
+1.0000000000000f,+0.9996988186962f,+0.9987954562052f,+0.9972904566787f,
|
||||||
+0.9951847266722f,+0.9924795345987f,+0.9891765099648f,+0.9852776423889f,
|
+0.9951847266722f,+0.9924795345987f,+0.9891765099648f,+0.9852776423889f,
|
||||||
+0.9807852804032f,+0.9757021300385f,+0.9700312531945f,+0.9637760657954f,
|
+0.9807852804032f,+0.9757021300385f,+0.9700312531945f,+0.9637760657954f,
|
||||||
+0.9569403357322f,+0.9495281805930f,+0.9415440651830f,+0.9329927988347f,
|
+0.9569403357322f,+0.9495281805930f,+0.9415440651830f,+0.9329927988347f,
|
||||||
+0.9238795325113f,+0.9142097557035f,+0.9039892931234f,+0.8932243011955f,
|
+0.9238795325113f,+0.9142097557035f,+0.9039892931234f,+0.8932243011955f,
|
||||||
+0.8819212643484f,+0.8700869911087f,+0.8577286100003f,+0.8448535652497f,
|
+0.8819212643484f,+0.8700869911087f,+0.8577286100003f,+0.8448535652497f,
|
||||||
+0.8314696123025f,+0.8175848131516f,+0.8032075314806f,+0.7883464276266f,
|
+0.8314696123025f,+0.8175848131516f,+0.8032075314806f,+0.7883464276266f,
|
||||||
+0.7730104533627f,+0.7572088465065f,+0.7409511253550f,+0.7242470829515f,
|
+0.7730104533627f,+0.7572088465065f,+0.7409511253550f,+0.7242470829515f,
|
||||||
+0.7071067811865f,+0.6895405447371f,+0.6715589548470f,+0.6531728429538f,
|
+0.7071067811865f,+0.6895405447371f,+0.6715589548470f,+0.6531728429538f,
|
||||||
+0.6343932841636f,+0.6152315905806f,+0.5956993044924f,+0.5758081914178f,
|
+0.6343932841636f,+0.6152315905806f,+0.5956993044924f,+0.5758081914178f,
|
||||||
+0.5555702330196f,+0.5349976198871f,+0.5141027441932f,+0.4928981922298f,
|
+0.5555702330196f,+0.5349976198871f,+0.5141027441932f,+0.4928981922298f,
|
||||||
+0.4713967368260f,+0.4496113296546f,+0.4275550934303f,+0.4052413140050f,
|
+0.4713967368260f,+0.4496113296546f,+0.4275550934303f,+0.4052413140050f,
|
||||||
+0.3826834323651f,+0.3598950365350f,+0.3368898533922f,+0.3136817403989f,
|
+0.3826834323651f,+0.3598950365350f,+0.3368898533922f,+0.3136817403989f,
|
||||||
+0.2902846772545f,+0.2667127574749f,+0.2429801799033f,+0.2191012401569f,
|
+0.2902846772545f,+0.2667127574749f,+0.2429801799033f,+0.2191012401569f,
|
||||||
+0.1950903220161f,+0.1709618887603f,+0.1467304744554f,+0.1224106751992f,
|
+0.1950903220161f,+0.1709618887603f,+0.1467304744554f,+0.1224106751992f,
|
||||||
+0.0980171403296f,+0.0735645635997f,+0.0490676743274f,+0.0245412285229f,
|
+0.0980171403296f,+0.0735645635997f,+0.0490676743274f,+0.0245412285229f,
|
||||||
+0.0000000000000f,-0.0245412285229f,-0.0490676743274f,-0.0735645635997f,
|
+0.0000000000000f,-0.0245412285229f,-0.0490676743274f,-0.0735645635997f,
|
||||||
-0.0980171403296f,-0.1224106751992f,-0.1467304744554f,-0.1709618887603f,
|
-0.0980171403296f,-0.1224106751992f,-0.1467304744554f,-0.1709618887603f,
|
||||||
-0.1950903220161f,-0.2191012401569f,-0.2429801799033f,-0.2667127574749f,
|
-0.1950903220161f,-0.2191012401569f,-0.2429801799033f,-0.2667127574749f,
|
||||||
-0.2902846772545f,-0.3136817403989f,-0.3368898533922f,-0.3598950365350f,
|
-0.2902846772545f,-0.3136817403989f,-0.3368898533922f,-0.3598950365350f,
|
||||||
-0.3826834323651f,-0.4052413140050f,-0.4275550934303f,-0.4496113296546f,
|
-0.3826834323651f,-0.4052413140050f,-0.4275550934303f,-0.4496113296546f,
|
||||||
-0.4713967368260f,-0.4928981922298f,-0.5141027441932f,-0.5349976198871f,
|
-0.4713967368260f,-0.4928981922298f,-0.5141027441932f,-0.5349976198871f,
|
||||||
-0.5555702330196f,-0.5758081914178f,-0.5956993044924f,-0.6152315905806f,
|
-0.5555702330196f,-0.5758081914178f,-0.5956993044924f,-0.6152315905806f,
|
||||||
-0.6343932841636f,-0.6531728429538f,-0.6715589548470f,-0.6895405447371f,
|
-0.6343932841636f,-0.6531728429538f,-0.6715589548470f,-0.6895405447371f,
|
||||||
-0.7071067811865f,-0.7242470829515f,-0.7409511253550f,-0.7572088465065f,
|
-0.7071067811865f,-0.7242470829515f,-0.7409511253550f,-0.7572088465065f,
|
||||||
-0.7730104533627f,-0.7883464276266f,-0.8032075314806f,-0.8175848131516f,
|
-0.7730104533627f,-0.7883464276266f,-0.8032075314806f,-0.8175848131516f,
|
||||||
-0.8314696123025f,-0.8448535652497f,-0.8577286100003f,-0.8700869911087f,
|
-0.8314696123025f,-0.8448535652497f,-0.8577286100003f,-0.8700869911087f,
|
||||||
-0.8819212643484f,-0.8932243011955f,-0.9039892931234f,-0.9142097557035f,
|
-0.8819212643484f,-0.8932243011955f,-0.9039892931234f,-0.9142097557035f,
|
||||||
-0.9238795325113f,-0.9329927988347f,-0.9415440651830f,-0.9495281805930f,
|
-0.9238795325113f,-0.9329927988347f,-0.9415440651830f,-0.9495281805930f,
|
||||||
-0.9569403357322f,-0.9637760657954f,-0.9700312531945f,-0.9757021300385f,
|
-0.9569403357322f,-0.9637760657954f,-0.9700312531945f,-0.9757021300385f,
|
||||||
-0.9807852804032f,-0.9852776423889f,-0.9891765099648f,-0.9924795345987f,
|
-0.9807852804032f,-0.9852776423889f,-0.9891765099648f,-0.9924795345987f,
|
||||||
-0.9951847266722f,-0.9972904566787f,-0.9987954562052f,-0.9996988186962f,
|
-0.9951847266722f,-0.9972904566787f,-0.9987954562052f,-0.9996988186962f,
|
||||||
-1.0000000000000f,
|
-1.0000000000000f,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INVSQ_LOOKUP_SZ 32
|
#define INVSQ_LOOKUP_SZ 32
|
||||||
static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={
|
static const float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={
|
||||||
1.414213562373f,1.392621247646f,1.371988681140f,1.352246807566f,
|
1.414213562373f,1.392621247646f,1.371988681140f,1.352246807566f,
|
||||||
1.333333333333f,1.315191898443f,1.297771369046f,1.281025230441f,
|
1.333333333333f,1.315191898443f,1.297771369046f,1.281025230441f,
|
||||||
1.264911064067f,1.249390095109f,1.234426799697f,1.219988562661f,
|
1.264911064067f,1.249390095109f,1.234426799697f,1.219988562661f,
|
||||||
1.206045378311f,1.192569588000f,1.179535649239f,1.166919931983f,
|
1.206045378311f,1.192569588000f,1.179535649239f,1.166919931983f,
|
||||||
1.154700538379f,1.142857142857f,1.131370849898f,1.120224067222f,
|
1.154700538379f,1.142857142857f,1.131370849898f,1.120224067222f,
|
||||||
1.109400392450f,1.098884511590f,1.088662107904f,1.078719779941f,
|
1.109400392450f,1.098884511590f,1.088662107904f,1.078719779941f,
|
||||||
1.069044967650f,1.059625885652f,1.050451462878f,1.041511287847f,
|
1.069044967650f,1.059625885652f,1.050451462878f,1.041511287847f,
|
||||||
1.032795558989f,1.024295039463f,1.016001016002f,1.007905261358f,
|
1.032795558989f,1.024295039463f,1.016001016002f,1.007905261358f,
|
||||||
1.000000000000f,
|
1.000000000000f,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define INVSQ2EXP_LOOKUP_MIN (-32)
|
#define INVSQ2EXP_LOOKUP_MIN (-32)
|
||||||
#define INVSQ2EXP_LOOKUP_MAX 32
|
#define INVSQ2EXP_LOOKUP_MAX 32
|
||||||
static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\
|
static const float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\
|
||||||
INVSQ2EXP_LOOKUP_MIN+1]={
|
INVSQ2EXP_LOOKUP_MIN+1]={
|
||||||
65536.f, 46340.95001f, 32768.f, 23170.47501f,
|
65536.f, 46340.95001f, 32768.f, 23170.47501f,
|
||||||
16384.f, 11585.2375f, 8192.f, 5792.618751f,
|
16384.f, 11585.2375f, 8192.f, 5792.618751f,
|
||||||
4096.f, 2896.309376f, 2048.f, 1448.154688f,
|
4096.f, 2896.309376f, 2048.f, 1448.154688f,
|
||||||
1024.f, 724.0773439f, 512.f, 362.038672f,
|
1024.f, 724.0773439f, 512.f, 362.038672f,
|
||||||
256.f, 181.019336f, 128.f, 90.50966799f,
|
256.f, 181.019336f, 128.f, 90.50966799f,
|
||||||
64.f, 45.254834f, 32.f, 22.627417f,
|
64.f, 45.254834f, 32.f, 22.627417f,
|
||||||
16.f, 11.3137085f, 8.f, 5.656854249f,
|
16.f, 11.3137085f, 8.f, 5.656854249f,
|
||||||
4.f, 2.828427125f, 2.f, 1.414213562f,
|
4.f, 2.828427125f, 2.f, 1.414213562f,
|
||||||
1.f, 0.7071067812f, 0.5f, 0.3535533906f,
|
1.f, 0.7071067812f, 0.5f, 0.3535533906f,
|
||||||
0.25f, 0.1767766953f, 0.125f, 0.08838834765f,
|
0.25f, 0.1767766953f, 0.125f, 0.08838834765f,
|
||||||
0.0625f, 0.04419417382f, 0.03125f, 0.02209708691f,
|
0.0625f, 0.04419417382f, 0.03125f, 0.02209708691f,
|
||||||
0.015625f, 0.01104854346f, 0.0078125f, 0.005524271728f,
|
0.015625f, 0.01104854346f, 0.0078125f, 0.005524271728f,
|
||||||
0.00390625f, 0.002762135864f, 0.001953125f, 0.001381067932f,
|
0.00390625f, 0.002762135864f, 0.001953125f, 0.001381067932f,
|
||||||
0.0009765625f, 0.000690533966f, 0.00048828125f, 0.000345266983f,
|
0.0009765625f, 0.000690533966f, 0.00048828125f, 0.000345266983f,
|
||||||
0.000244140625f,0.0001726334915f,0.0001220703125f,8.631674575e-05f,
|
0.000244140625f,0.0001726334915f,0.0001220703125f,8.631674575e-05f,
|
||||||
6.103515625e-05f,4.315837288e-05f,3.051757812e-05f,2.157918644e-05f,
|
6.103515625e-05f,4.315837288e-05f,3.051757812e-05f,2.157918644e-05f,
|
||||||
1.525878906e-05f,
|
1.525878906e-05f,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -98,90 +98,93 @@ static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\
|
||||||
#define FROMdB_SHIFT 5
|
#define FROMdB_SHIFT 5
|
||||||
#define FROMdB2_SHIFT 3
|
#define FROMdB2_SHIFT 3
|
||||||
#define FROMdB2_MASK 31
|
#define FROMdB2_MASK 31
|
||||||
static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
|
|
||||||
1.f, 0.6309573445f, 0.3981071706f, 0.2511886432f,
|
#ifdef FLOAT_LOOKUP
|
||||||
0.1584893192f, 0.1f, 0.06309573445f, 0.03981071706f,
|
static const float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
|
||||||
0.02511886432f, 0.01584893192f, 0.01f, 0.006309573445f,
|
1.f, 0.6309573445f, 0.3981071706f, 0.2511886432f,
|
||||||
0.003981071706f, 0.002511886432f, 0.001584893192f, 0.001f,
|
0.1584893192f, 0.1f, 0.06309573445f, 0.03981071706f,
|
||||||
0.0006309573445f,0.0003981071706f,0.0002511886432f,0.0001584893192f,
|
0.02511886432f, 0.01584893192f, 0.01f, 0.006309573445f,
|
||||||
0.0001f,6.309573445e-05f,3.981071706e-05f,2.511886432e-05f,
|
0.003981071706f, 0.002511886432f, 0.001584893192f, 0.001f,
|
||||||
1.584893192e-05f, 1e-05f,6.309573445e-06f,3.981071706e-06f,
|
0.0006309573445f,0.0003981071706f,0.0002511886432f,0.0001584893192f,
|
||||||
2.511886432e-06f,1.584893192e-06f, 1e-06f,6.309573445e-07f,
|
0.0001f,6.309573445e-05f,3.981071706e-05f,2.511886432e-05f,
|
||||||
3.981071706e-07f,2.511886432e-07f,1.584893192e-07f,
|
1.584893192e-05f, 1e-05f,6.309573445e-06f,3.981071706e-06f,
|
||||||
|
2.511886432e-06f,1.584893192e-06f, 1e-06f,6.309573445e-07f,
|
||||||
|
3.981071706e-07f,2.511886432e-07f,1.584893192e-07f,
|
||||||
};
|
};
|
||||||
|
|
||||||
static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
|
static const float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
|
||||||
0.9928302478f, 0.9786445908f, 0.9646616199f, 0.9508784391f,
|
0.9928302478f, 0.9786445908f, 0.9646616199f, 0.9508784391f,
|
||||||
0.9372921937f, 0.92390007f, 0.9106992942f, 0.8976871324f,
|
0.9372921937f, 0.92390007f, 0.9106992942f, 0.8976871324f,
|
||||||
0.8848608897f, 0.8722179097f, 0.8597555737f, 0.8474713009f,
|
0.8848608897f, 0.8722179097f, 0.8597555737f, 0.8474713009f,
|
||||||
0.835362547f, 0.8234268041f, 0.8116616003f, 0.8000644989f,
|
0.835362547f, 0.8234268041f, 0.8116616003f, 0.8000644989f,
|
||||||
0.7886330981f, 0.7773650302f, 0.7662579617f, 0.755309592f,
|
0.7886330981f, 0.7773650302f, 0.7662579617f, 0.755309592f,
|
||||||
0.7445176537f, 0.7338799116f, 0.7233941627f, 0.7130582353f,
|
0.7445176537f, 0.7338799116f, 0.7233941627f, 0.7130582353f,
|
||||||
0.7028699885f, 0.6928273125f, 0.6829281272f, 0.6731703824f,
|
0.7028699885f, 0.6928273125f, 0.6829281272f, 0.6731703824f,
|
||||||
0.6635520573f, 0.6540711597f, 0.6447257262f, 0.6355138211f,
|
0.6635520573f, 0.6540711597f, 0.6447257262f, 0.6355138211f,
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef INT_LOOKUP
|
#ifdef INT_LOOKUP
|
||||||
|
|
||||||
#define INVSQ_LOOKUP_I_SHIFT 10
|
#define INVSQ_LOOKUP_I_SHIFT 10
|
||||||
#define INVSQ_LOOKUP_I_MASK 1023
|
#define INVSQ_LOOKUP_I_MASK 1023
|
||||||
static long INVSQ_LOOKUP_I[64+1]={
|
static const long INVSQ_LOOKUP_I[64+1]={
|
||||||
92682l, 91966l, 91267l, 90583l,
|
92682l, 91966l, 91267l, 90583l,
|
||||||
89915l, 89261l, 88621l, 87995l,
|
89915l, 89261l, 88621l, 87995l,
|
||||||
87381l, 86781l, 86192l, 85616l,
|
87381l, 86781l, 86192l, 85616l,
|
||||||
85051l, 84497l, 83953l, 83420l,
|
85051l, 84497l, 83953l, 83420l,
|
||||||
82897l, 82384l, 81880l, 81385l,
|
82897l, 82384l, 81880l, 81385l,
|
||||||
80899l, 80422l, 79953l, 79492l,
|
80899l, 80422l, 79953l, 79492l,
|
||||||
79039l, 78594l, 78156l, 77726l,
|
79039l, 78594l, 78156l, 77726l,
|
||||||
77302l, 76885l, 76475l, 76072l,
|
77302l, 76885l, 76475l, 76072l,
|
||||||
75674l, 75283l, 74898l, 74519l,
|
75674l, 75283l, 74898l, 74519l,
|
||||||
74146l, 73778l, 73415l, 73058l,
|
74146l, 73778l, 73415l, 73058l,
|
||||||
72706l, 72359l, 72016l, 71679l,
|
72706l, 72359l, 72016l, 71679l,
|
||||||
71347l, 71019l, 70695l, 70376l,
|
71347l, 71019l, 70695l, 70376l,
|
||||||
70061l, 69750l, 69444l, 69141l,
|
70061l, 69750l, 69444l, 69141l,
|
||||||
68842l, 68548l, 68256l, 67969l,
|
68842l, 68548l, 68256l, 67969l,
|
||||||
67685l, 67405l, 67128l, 66855l,
|
67685l, 67405l, 67128l, 66855l,
|
||||||
66585l, 66318l, 66054l, 65794l,
|
66585l, 66318l, 66054l, 65794l,
|
||||||
65536l,
|
65536l,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define COS_LOOKUP_I_SHIFT 9
|
#define COS_LOOKUP_I_SHIFT 9
|
||||||
#define COS_LOOKUP_I_MASK 511
|
#define COS_LOOKUP_I_MASK 511
|
||||||
#define COS_LOOKUP_I_SZ 128
|
#define COS_LOOKUP_I_SZ 128
|
||||||
static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
|
static const long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
|
||||||
16384l, 16379l, 16364l, 16340l,
|
16384l, 16379l, 16364l, 16340l,
|
||||||
16305l, 16261l, 16207l, 16143l,
|
16305l, 16261l, 16207l, 16143l,
|
||||||
16069l, 15986l, 15893l, 15791l,
|
16069l, 15986l, 15893l, 15791l,
|
||||||
15679l, 15557l, 15426l, 15286l,
|
15679l, 15557l, 15426l, 15286l,
|
||||||
15137l, 14978l, 14811l, 14635l,
|
15137l, 14978l, 14811l, 14635l,
|
||||||
14449l, 14256l, 14053l, 13842l,
|
14449l, 14256l, 14053l, 13842l,
|
||||||
13623l, 13395l, 13160l, 12916l,
|
13623l, 13395l, 13160l, 12916l,
|
||||||
12665l, 12406l, 12140l, 11866l,
|
12665l, 12406l, 12140l, 11866l,
|
||||||
11585l, 11297l, 11003l, 10702l,
|
11585l, 11297l, 11003l, 10702l,
|
||||||
10394l, 10080l, 9760l, 9434l,
|
10394l, 10080l, 9760l, 9434l,
|
||||||
9102l, 8765l, 8423l, 8076l,
|
9102l, 8765l, 8423l, 8076l,
|
||||||
7723l, 7366l, 7005l, 6639l,
|
7723l, 7366l, 7005l, 6639l,
|
||||||
6270l, 5897l, 5520l, 5139l,
|
6270l, 5897l, 5520l, 5139l,
|
||||||
4756l, 4370l, 3981l, 3590l,
|
4756l, 4370l, 3981l, 3590l,
|
||||||
3196l, 2801l, 2404l, 2006l,
|
3196l, 2801l, 2404l, 2006l,
|
||||||
1606l, 1205l, 804l, 402l,
|
1606l, 1205l, 804l, 402l,
|
||||||
0l, -401l, -803l, -1204l,
|
0l, -401l, -803l, -1204l,
|
||||||
-1605l, -2005l, -2403l, -2800l,
|
-1605l, -2005l, -2403l, -2800l,
|
||||||
-3195l, -3589l, -3980l, -4369l,
|
-3195l, -3589l, -3980l, -4369l,
|
||||||
-4755l, -5138l, -5519l, -5896l,
|
-4755l, -5138l, -5519l, -5896l,
|
||||||
-6269l, -6638l, -7004l, -7365l,
|
-6269l, -6638l, -7004l, -7365l,
|
||||||
-7722l, -8075l, -8422l, -8764l,
|
-7722l, -8075l, -8422l, -8764l,
|
||||||
-9101l, -9433l, -9759l, -10079l,
|
-9101l, -9433l, -9759l, -10079l,
|
||||||
-10393l, -10701l, -11002l, -11296l,
|
-10393l, -10701l, -11002l, -11296l,
|
||||||
-11584l, -11865l, -12139l, -12405l,
|
-11584l, -11865l, -12139l, -12405l,
|
||||||
-12664l, -12915l, -13159l, -13394l,
|
-12664l, -12915l, -13159l, -13394l,
|
||||||
-13622l, -13841l, -14052l, -14255l,
|
-13622l, -13841l, -14052l, -14255l,
|
||||||
-14448l, -14634l, -14810l, -14977l,
|
-14448l, -14634l, -14810l, -14977l,
|
||||||
-15136l, -15285l, -15425l, -15556l,
|
-15136l, -15285l, -15425l, -15556l,
|
||||||
-15678l, -15790l, -15892l, -15985l,
|
-15678l, -15790l, -15892l, -15985l,
|
||||||
-16068l, -16142l, -16206l, -16260l,
|
-16068l, -16142l, -16206l, -16260l,
|
||||||
-16304l, -16339l, -16363l, -16378l,
|
-16304l, -16339l, -16363l, -16378l,
|
||||||
-16383l,
|
-16383l,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: LPC low level routines
|
function: LPC low level routines
|
||||||
last mod: $Id: lpc.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -62,6 +62,7 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
|
||||||
double *aut=alloca(sizeof(*aut)*(m+1));
|
double *aut=alloca(sizeof(*aut)*(m+1));
|
||||||
double *lpc=alloca(sizeof(*lpc)*(m));
|
double *lpc=alloca(sizeof(*lpc)*(m));
|
||||||
double error;
|
double error;
|
||||||
|
double epsilon;
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
||||||
/* autocorrelation, p+1 lag coefficients */
|
/* autocorrelation, p+1 lag coefficients */
|
||||||
|
|
@ -74,14 +75,16 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
|
||||||
|
|
||||||
/* Generate lpc coefficients from autocorr values */
|
/* Generate lpc coefficients from autocorr values */
|
||||||
|
|
||||||
error=aut[0];
|
/* set our noise floor to about -100dB */
|
||||||
|
error=aut[0] * (1. + 1e-10);
|
||||||
|
epsilon=1e-9*aut[0]+1e-10;
|
||||||
|
|
||||||
for(i=0;i<m;i++){
|
for(i=0;i<m;i++){
|
||||||
double r= -aut[i+1];
|
double r= -aut[i+1];
|
||||||
|
|
||||||
if(error==0){
|
if(error<epsilon){
|
||||||
memset(lpci,0,m*sizeof(*lpci));
|
memset(lpc+i,0,(m-i)*sizeof(*lpc));
|
||||||
return 0;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sum up this iteration's reflection coefficient; note that in
|
/* Sum up this iteration's reflection coefficient; note that in
|
||||||
|
|
@ -101,9 +104,22 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
|
||||||
lpc[j]+=r*lpc[i-1-j];
|
lpc[j]+=r*lpc[i-1-j];
|
||||||
lpc[i-1-j]+=r*tmp;
|
lpc[i-1-j]+=r*tmp;
|
||||||
}
|
}
|
||||||
if(i%2)lpc[j]+=lpc[j]*r;
|
if(i&1)lpc[j]+=lpc[j]*r;
|
||||||
|
|
||||||
error*=1.f-r*r;
|
error*=1.-r*r;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
|
||||||
|
/* slightly damp the filter */
|
||||||
|
{
|
||||||
|
double g = .99;
|
||||||
|
double damp = g;
|
||||||
|
for(j=0;j<m;j++){
|
||||||
|
lpc[j]*=damp;
|
||||||
|
damp*=g;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(j=0;j<m;j++)lpci[j]=(float)lpc[j];
|
for(j=0;j<m;j++)lpci[j]=(float)lpc[j];
|
||||||
|
|
@ -142,8 +158,3 @@ void vorbis_lpc_predict(float *coeff,float *prime,int m,
|
||||||
data[i]=work[o]=y;
|
data[i]=work[o]=y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: LPC low level routines
|
function: LPC low level routines
|
||||||
last mod: $Id: lpc.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -24,6 +24,6 @@
|
||||||
extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m);
|
extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m);
|
||||||
|
|
||||||
extern void vorbis_lpc_predict(float *coeff,float *prime,int m,
|
extern void vorbis_lpc_predict(float *coeff,float *prime,int m,
|
||||||
float *data,long n);
|
float *data,long n);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: LSP (also called LSF) conversion routines
|
function: LSP (also called LSF) conversion routines
|
||||||
last mod: $Id: lsp.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: lsp.c 17538 2010-10-15 02:52:29Z tterribe $
|
||||||
|
|
||||||
The LSP generation code is taken (with minimal modification and a
|
The LSP generation code is taken (with minimal modification and a
|
||||||
few bugfixes) from "On the Computation of the LSP Frequencies" by
|
few bugfixes) from "On the Computation of the LSP Frequencies" by
|
||||||
|
|
@ -46,14 +46,15 @@
|
||||||
implementation. The float lookup is likely the optimal choice on
|
implementation. The float lookup is likely the optimal choice on
|
||||||
any machine with an FPU. The integer implementation is *not* fixed
|
any machine with an FPU. The integer implementation is *not* fixed
|
||||||
point (due to the need for a large dynamic range and thus a
|
point (due to the need for a large dynamic range and thus a
|
||||||
seperately tracked exponent) and thus much more complex than the
|
separately tracked exponent) and thus much more complex than the
|
||||||
relatively simple float implementations. It's mostly for future
|
relatively simple float implementations. It's mostly for future
|
||||||
work on a fully fixed point implementation for processors like the
|
work on a fully fixed point implementation for processors like the
|
||||||
ARM family. */
|
ARM family. */
|
||||||
|
|
||||||
/* undefine both for the 'old' but more precise implementation */
|
/* define either of these (preferably FLOAT_LOOKUP) to have faster
|
||||||
#define FLOAT_LOOKUP
|
but less precise implementation. */
|
||||||
#undef INT_LOOKUP
|
#undef FLOAT_LOOKUP
|
||||||
|
#undef INT_LOOKUP
|
||||||
|
|
||||||
#ifdef FLOAT_LOOKUP
|
#ifdef FLOAT_LOOKUP
|
||||||
#include "lookup.c" /* catch this in the build system; we #include for
|
#include "lookup.c" /* catch this in the build system; we #include for
|
||||||
|
|
@ -62,7 +63,7 @@
|
||||||
|
|
||||||
/* side effect: changes *lsp to cosines of lsp */
|
/* side effect: changes *lsp to cosines of lsp */
|
||||||
void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
float amp,float ampoffset){
|
float amp,float ampoffset){
|
||||||
int i;
|
int i;
|
||||||
float wdel=M_PI/ln;
|
float wdel=M_PI/ln;
|
||||||
vorbis_fpu_control fpu;
|
vorbis_fpu_control fpu;
|
||||||
|
|
@ -80,11 +81,11 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
float *ftmp=lsp;
|
float *ftmp=lsp;
|
||||||
int c=m>>1;
|
int c=m>>1;
|
||||||
|
|
||||||
do{
|
while(c--){
|
||||||
q*=ftmp[0]-w;
|
q*=ftmp[0]-w;
|
||||||
p*=ftmp[1]-w;
|
p*=ftmp[1]-w;
|
||||||
ftmp+=2;
|
ftmp+=2;
|
||||||
}while(--c);
|
}
|
||||||
|
|
||||||
if(m&1){
|
if(m&1){
|
||||||
/* odd order filter; slightly assymetric */
|
/* odd order filter; slightly assymetric */
|
||||||
|
|
@ -100,9 +101,9 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
|
|
||||||
q=frexp(p+q,&qexp);
|
q=frexp(p+q,&qexp);
|
||||||
q=vorbis_fromdBlook(amp*
|
q=vorbis_fromdBlook(amp*
|
||||||
vorbis_invsqlook(q)*
|
vorbis_invsqlook(q)*
|
||||||
vorbis_invsq2explook(qexp+m)-
|
vorbis_invsq2explook(qexp+m)-
|
||||||
ampoffset);
|
ampoffset);
|
||||||
|
|
||||||
do{
|
do{
|
||||||
curve[i++]*=q;
|
curve[i++]*=q;
|
||||||
|
|
@ -118,26 +119,26 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
compilers (like gcc) that can't inline across
|
compilers (like gcc) that can't inline across
|
||||||
modules */
|
modules */
|
||||||
|
|
||||||
static int MLOOP_1[64]={
|
static const int MLOOP_1[64]={
|
||||||
0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,
|
0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,
|
||||||
14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,
|
14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,
|
||||||
15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
|
15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
|
||||||
15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
|
15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int MLOOP_2[64]={
|
static const int MLOOP_2[64]={
|
||||||
0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,
|
0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,
|
||||||
8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,
|
8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,
|
||||||
9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
|
9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
|
||||||
9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
|
9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int MLOOP_3[8]={0,1,2,2,3,3,3,3};
|
static const int MLOOP_3[8]={0,1,2,2,3,3,3,3};
|
||||||
|
|
||||||
|
|
||||||
/* side effect: changes *lsp to cosines of lsp */
|
/* side effect: changes *lsp to cosines of lsp */
|
||||||
void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
float amp,float ampoffset){
|
float amp,float ampoffset){
|
||||||
|
|
||||||
/* 0 <= m < 256 */
|
/* 0 <= m < 256 */
|
||||||
|
|
||||||
|
|
@ -161,15 +162,15 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
|
|
||||||
for(j=3;j<m;j+=2){
|
for(j=3;j<m;j+=2){
|
||||||
if(!(shift=MLOOP_1[(pi|qi)>>25]))
|
if(!(shift=MLOOP_1[(pi|qi)>>25]))
|
||||||
if(!(shift=MLOOP_2[(pi|qi)>>19]))
|
if(!(shift=MLOOP_2[(pi|qi)>>19]))
|
||||||
shift=MLOOP_3[(pi|qi)>>16];
|
shift=MLOOP_3[(pi|qi)>>16];
|
||||||
qi=(qi>>shift)*labs(ilsp[j-1]-wi);
|
qi=(qi>>shift)*labs(ilsp[j-1]-wi);
|
||||||
pi=(pi>>shift)*labs(ilsp[j]-wi);
|
pi=(pi>>shift)*labs(ilsp[j]-wi);
|
||||||
qexp+=shift;
|
qexp+=shift;
|
||||||
}
|
}
|
||||||
if(!(shift=MLOOP_1[(pi|qi)>>25]))
|
if(!(shift=MLOOP_1[(pi|qi)>>25]))
|
||||||
if(!(shift=MLOOP_2[(pi|qi)>>19]))
|
if(!(shift=MLOOP_2[(pi|qi)>>19]))
|
||||||
shift=MLOOP_3[(pi|qi)>>16];
|
shift=MLOOP_3[(pi|qi)>>16];
|
||||||
|
|
||||||
/* pi,qi normalized collectively, both tracked using qexp */
|
/* pi,qi normalized collectively, both tracked using qexp */
|
||||||
|
|
||||||
|
|
@ -181,8 +182,8 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
qexp+=shift;
|
qexp+=shift;
|
||||||
|
|
||||||
if(!(shift=MLOOP_1[(pi|qi)>>25]))
|
if(!(shift=MLOOP_1[(pi|qi)>>25]))
|
||||||
if(!(shift=MLOOP_2[(pi|qi)>>19]))
|
if(!(shift=MLOOP_2[(pi|qi)>>19]))
|
||||||
shift=MLOOP_3[(pi|qi)>>16];
|
shift=MLOOP_3[(pi|qi)>>16];
|
||||||
|
|
||||||
pi>>=shift;
|
pi>>=shift;
|
||||||
qi>>=shift;
|
qi>>=shift;
|
||||||
|
|
@ -199,7 +200,7 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
/* even order filter; still symmetric */
|
/* even order filter; still symmetric */
|
||||||
|
|
||||||
/* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
|
/* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
|
||||||
worth tracking step by step */
|
worth tracking step by step */
|
||||||
|
|
||||||
pi>>=shift;
|
pi>>=shift;
|
||||||
qi>>=shift;
|
qi>>=shift;
|
||||||
|
|
@ -224,13 +225,13 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
qi>>=1; qexp++;
|
qi>>=1; qexp++;
|
||||||
}else
|
}else
|
||||||
while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
|
while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
|
||||||
qi<<=1; qexp--;
|
qi<<=1; qexp--;
|
||||||
}
|
}
|
||||||
|
|
||||||
amp=vorbis_fromdBlook_i(ampi* /* n.4 */
|
amp=vorbis_fromdBlook_i(ampi* /* n.4 */
|
||||||
vorbis_invsqlook_i(qi,qexp)-
|
vorbis_invsqlook_i(qi,qexp)-
|
||||||
/* m.8, m+n<=8 */
|
/* m.8, m+n<=8 */
|
||||||
ampoffseti); /* 8.12[0] */
|
ampoffseti); /* 8.12[0] */
|
||||||
|
|
||||||
curve[i]*=amp;
|
curve[i]*=amp;
|
||||||
while(map[++i]==k)curve[i]*=amp;
|
while(map[++i]==k)curve[i]*=amp;
|
||||||
|
|
@ -245,7 +246,7 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
|
|
||||||
/* side effect: changes *lsp to cosines of lsp */
|
/* side effect: changes *lsp to cosines of lsp */
|
||||||
void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
||||||
float amp,float ampoffset){
|
float amp,float ampoffset){
|
||||||
int i;
|
int i;
|
||||||
float wdel=M_PI/ln;
|
float wdel=M_PI/ln;
|
||||||
for(i=0;i<m;i++)lsp[i]=2.f*cos(lsp[i]);
|
for(i=0;i<m;i++)lsp[i]=2.f*cos(lsp[i]);
|
||||||
|
|
@ -321,22 +322,22 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){
|
||||||
|
|
||||||
/* eval the polynomial and its first two derivatives */
|
/* eval the polynomial and its first two derivatives */
|
||||||
for(i=m;i>0;i--){
|
for(i=m;i>0;i--){
|
||||||
ppp = new*ppp + pp;
|
ppp = new*ppp + pp;
|
||||||
pp = new*pp + p;
|
pp = new*pp + p;
|
||||||
p = new*p + defl[i-1];
|
p = new*p + defl[i-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Laguerre's method */
|
/* Laguerre's method */
|
||||||
denom=(m-1) * ((m-1)*pp*pp - m*p*ppp);
|
denom=(m-1) * ((m-1)*pp*pp - m*p*ppp);
|
||||||
if(denom<0)
|
if(denom<0)
|
||||||
return(-1); /* complex root! The LPC generator handed us a bad filter */
|
return(-1); /* complex root! The LPC generator handed us a bad filter */
|
||||||
|
|
||||||
if(pp>0){
|
if(pp>0){
|
||||||
denom = pp + sqrt(denom);
|
denom = pp + sqrt(denom);
|
||||||
if(denom<EPSILON)denom=EPSILON;
|
if(denom<EPSILON)denom=EPSILON;
|
||||||
}else{
|
}else{
|
||||||
denom = pp - sqrt(denom);
|
denom = pp - sqrt(denom);
|
||||||
if(denom>-(EPSILON))denom=-(EPSILON);
|
if(denom>-(EPSILON))denom=-(EPSILON);
|
||||||
}
|
}
|
||||||
|
|
||||||
delta = m*p/denom;
|
delta = m*p/denom;
|
||||||
|
|
@ -378,8 +379,8 @@ static int Newton_Raphson(float *a,int ord,float *r){
|
||||||
double p=a[ord];
|
double p=a[ord];
|
||||||
for(k=ord-1; k>= 0; k--) {
|
for(k=ord-1; k>= 0; k--) {
|
||||||
|
|
||||||
pp= pp* rooti + p;
|
pp= pp* rooti + p;
|
||||||
p = p * rooti + a[k];
|
p = p * rooti + a[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
delta = p/pp;
|
delta = p/pp;
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: LSP (also called LSF) conversion routines
|
function: LSP (also called LSF) conversion routines
|
||||||
last mod: $Id: lsp.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: lsp.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
extern int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m);
|
extern int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m);
|
||||||
|
|
||||||
extern void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,
|
extern void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,
|
||||||
float *lsp,int m,
|
float *lsp,int m,
|
||||||
float amp,float ampoffset);
|
float amp,float ampoffset);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: channel mapping 0 implementation
|
function: channel mapping 0 implementation
|
||||||
last mod: $Id: mapping0.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: mapping0.c 17022 2010-03-25 03:45:42Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ static int ilog(unsigned int v){
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
|
static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
|
||||||
oggpack_buffer *opb){
|
oggpack_buffer *opb){
|
||||||
int i;
|
int i;
|
||||||
vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
|
vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
|
||||||
|
|
||||||
|
|
@ -100,46 +100,51 @@ static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
|
||||||
|
|
||||||
/* also responsible for range checking */
|
/* also responsible for range checking */
|
||||||
static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
||||||
int i;
|
int i,b;
|
||||||
vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info));
|
vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info));
|
||||||
codec_setup_info *ci=vi->codec_setup;
|
codec_setup_info *ci=vi->codec_setup;
|
||||||
memset(info,0,sizeof(*info));
|
memset(info,0,sizeof(*info));
|
||||||
|
|
||||||
if(oggpack_read(opb,1))
|
b=oggpack_read(opb,1);
|
||||||
|
if(b<0)goto err_out;
|
||||||
|
if(b){
|
||||||
info->submaps=oggpack_read(opb,4)+1;
|
info->submaps=oggpack_read(opb,4)+1;
|
||||||
else
|
if(info->submaps<=0)goto err_out;
|
||||||
|
}else
|
||||||
info->submaps=1;
|
info->submaps=1;
|
||||||
|
|
||||||
if(oggpack_read(opb,1)){
|
b=oggpack_read(opb,1);
|
||||||
|
if(b<0)goto err_out;
|
||||||
|
if(b){
|
||||||
info->coupling_steps=oggpack_read(opb,8)+1;
|
info->coupling_steps=oggpack_read(opb,8)+1;
|
||||||
|
if(info->coupling_steps<=0)goto err_out;
|
||||||
for(i=0;i<info->coupling_steps;i++){
|
for(i=0;i<info->coupling_steps;i++){
|
||||||
int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
|
int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
|
||||||
int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
|
int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
|
||||||
|
|
||||||
if(testM<0 ||
|
if(testM<0 ||
|
||||||
testA<0 ||
|
testA<0 ||
|
||||||
testM==testA ||
|
testM==testA ||
|
||||||
testM>=vi->channels ||
|
testM>=vi->channels ||
|
||||||
testA>=vi->channels) goto err_out;
|
testA>=vi->channels) goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */
|
if(oggpack_read(opb,2)!=0)goto err_out; /* 2,3:reserved */
|
||||||
|
|
||||||
if(info->submaps>1){
|
if(info->submaps>1){
|
||||||
for(i=0;i<vi->channels;i++){
|
for(i=0;i<vi->channels;i++){
|
||||||
info->chmuxlist[i]=oggpack_read(opb,4);
|
info->chmuxlist[i]=oggpack_read(opb,4);
|
||||||
if(info->chmuxlist[i]>=info->submaps)goto err_out;
|
if(info->chmuxlist[i]>=info->submaps || info->chmuxlist[i]<0)goto err_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(i=0;i<info->submaps;i++){
|
for(i=0;i<info->submaps;i++){
|
||||||
oggpack_read(opb,8); /* time submap unused */
|
oggpack_read(opb,8); /* time submap unused */
|
||||||
info->floorsubmap[i]=oggpack_read(opb,8);
|
info->floorsubmap[i]=oggpack_read(opb,8);
|
||||||
if(info->floorsubmap[i]>=ci->floors)goto err_out;
|
if(info->floorsubmap[i]>=ci->floors || info->floorsubmap[i]<0)goto err_out;
|
||||||
info->residuesubmap[i]=oggpack_read(opb,8);
|
info->residuesubmap[i]=oggpack_read(opb,8);
|
||||||
if(info->residuesubmap[i]>=ci->residues)goto err_out;
|
if(info->residuesubmap[i]>=ci->residues || info->residuesubmap[i]<0)goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
|
@ -229,16 +234,6 @@ static float FLOOR1_fromdB_LOOKUP[256]={
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor *look,
|
|
||||||
const float *logmdct, /* in */
|
|
||||||
const float *logmask);
|
|
||||||
extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor *look,
|
|
||||||
int *A,int *B,
|
|
||||||
int del);
|
|
||||||
extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
|
||||||
vorbis_look_floor *look,
|
|
||||||
int *post,int *ilogmask);
|
|
||||||
|
|
||||||
|
|
||||||
static int mapping0_forward(vorbis_block *vb){
|
static int mapping0_forward(vorbis_block *vb){
|
||||||
vorbis_dsp_state *vd=vb->vd;
|
vorbis_dsp_state *vd=vb->vd;
|
||||||
|
|
@ -251,7 +246,7 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
|
|
||||||
int *nonzero = alloca(sizeof(*nonzero)*vi->channels);
|
int *nonzero = alloca(sizeof(*nonzero)*vi->channels);
|
||||||
float **gmdct = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct));
|
float **gmdct = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct));
|
||||||
int **ilogmaskch= _vorbis_block_alloc(vb,vi->channels*sizeof(*ilogmaskch));
|
int **iwork = _vorbis_block_alloc(vb,vi->channels*sizeof(*iwork));
|
||||||
int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts));
|
int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts));
|
||||||
|
|
||||||
float global_ampmax=vbi->ampmax;
|
float global_ampmax=vbi->ampmax;
|
||||||
|
|
@ -260,8 +255,7 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
|
|
||||||
int modenumber=vb->W;
|
int modenumber=vb->W;
|
||||||
vorbis_info_mapping0 *info=ci->map_param[modenumber];
|
vorbis_info_mapping0 *info=ci->map_param[modenumber];
|
||||||
vorbis_look_psy *psy_look=
|
vorbis_look_psy *psy_look=b->psy+blocktype+(vb->W?2:0);
|
||||||
b->psy+blocktype+(vb->W?2:0);
|
|
||||||
|
|
||||||
vb->mode=modenumber;
|
vb->mode=modenumber;
|
||||||
|
|
||||||
|
|
@ -272,6 +266,7 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
float *pcm =vb->pcm[i];
|
float *pcm =vb->pcm[i];
|
||||||
float *logfft =pcm;
|
float *logfft =pcm;
|
||||||
|
|
||||||
|
iwork[i]=_vorbis_block_alloc(vb,n/2*sizeof(**iwork));
|
||||||
gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
|
gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
|
||||||
|
|
||||||
scale_dB=todB(&scale) + .345; /* + .345 is a hack; the original
|
scale_dB=todB(&scale) + .345; /* + .345 is a hack; the original
|
||||||
|
|
@ -290,22 +285,28 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
next major model upgrade. */
|
next major model upgrade. */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2)
|
if(vi->channels==2){
|
||||||
if(i==0)
|
if(i==0)
|
||||||
_analysis_output("pcmL",seq,pcm,n,0,0,total-n/2);
|
_analysis_output("pcmL",seq,pcm,n,0,0,total-n/2);
|
||||||
else
|
else
|
||||||
_analysis_output("pcmR",seq,pcm,n,0,0,total-n/2);
|
_analysis_output("pcmR",seq,pcm,n,0,0,total-n/2);
|
||||||
|
}else{
|
||||||
|
_analysis_output("pcm",seq,pcm,n,0,0,total-n/2);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* window the PCM data */
|
/* window the PCM data */
|
||||||
_vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
|
_vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2)
|
if(vi->channels==2){
|
||||||
if(i==0)
|
if(i==0)
|
||||||
_analysis_output("windowedL",seq,pcm,n,0,0,total-n/2);
|
_analysis_output("windowedL",seq,pcm,n,0,0,total-n/2);
|
||||||
else
|
else
|
||||||
_analysis_output("windowedR",seq,pcm,n,0,0,total-n/2);
|
_analysis_output("windowedR",seq,pcm,n,0,0,total-n/2);
|
||||||
|
}else{
|
||||||
|
_analysis_output("windowed",seq,pcm,n,0,0,total-n/2);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* transform the PCM data */
|
/* transform the PCM data */
|
||||||
|
|
@ -355,10 +356,12 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2){
|
if(vi->channels==2){
|
||||||
if(i==0){
|
if(i==0){
|
||||||
_analysis_output("fftL",seq,logfft,n/2,1,0,0);
|
_analysis_output("fftL",seq,logfft,n/2,1,0,0);
|
||||||
}else{
|
}else{
|
||||||
_analysis_output("fftR",seq,logfft,n/2,1,0,0);
|
_analysis_output("fftR",seq,logfft,n/2,1,0,0);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
_analysis_output("fft",seq,logfft,n/2,1,0,0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -370,7 +373,7 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
|
|
||||||
for(i=0;i<vi->channels;i++){
|
for(i=0;i<vi->channels;i++){
|
||||||
/* the encoder setup assumes that all the modes used by any
|
/* the encoder setup assumes that all the modes used by any
|
||||||
specific bitrate tweaking use the same floor */
|
specific bitrate tweaking use the same floor */
|
||||||
|
|
||||||
int submap=info->chmuxlist[i];
|
int submap=info->chmuxlist[i];
|
||||||
|
|
||||||
|
|
@ -387,7 +390,7 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS);
|
memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS);
|
||||||
|
|
||||||
for(j=0;j<n/2;j++)
|
for(j=0;j<n/2;j++)
|
||||||
logmdct[j]=todB(mdct+j) + .345; /* + .345 is a hack; the original
|
logmdct[j]=todB(mdct+j) + .345; /* + .345 is a hack; the original
|
||||||
todB estimation used on IEEE 754
|
todB estimation used on IEEE 754
|
||||||
compliant machines had a bug that
|
compliant machines had a bug that
|
||||||
returned dB values about a third
|
returned dB values about a third
|
||||||
|
|
@ -404,12 +407,12 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2){
|
if(vi->channels==2){
|
||||||
if(i==0)
|
if(i==0)
|
||||||
_analysis_output("mdctL",seq,logmdct,n/2,1,0,0);
|
_analysis_output("mdctL",seq,logmdct,n/2,1,0,0);
|
||||||
else
|
else
|
||||||
_analysis_output("mdctR",seq,logmdct,n/2,1,0,0);
|
_analysis_output("mdctR",seq,logmdct,n/2,1,0,0);
|
||||||
}else{
|
}else{
|
||||||
_analysis_output("mdct",seq,logmdct,n/2,1,0,0);
|
_analysis_output("mdct",seq,logmdct,n/2,1,0,0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -420,15 +423,17 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
'noise_depth' vector, the more tonal that area is) */
|
'noise_depth' vector, the more tonal that area is) */
|
||||||
|
|
||||||
_vp_noisemask(psy_look,
|
_vp_noisemask(psy_look,
|
||||||
logmdct,
|
logmdct,
|
||||||
noise); /* noise does not have by-frequency offset
|
noise); /* noise does not have by-frequency offset
|
||||||
bias applied yet */
|
bias applied yet */
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2){
|
if(vi->channels==2){
|
||||||
if(i==0)
|
if(i==0)
|
||||||
_analysis_output("noiseL",seq,noise,n/2,1,0,0);
|
_analysis_output("noiseL",seq,noise,n/2,1,0,0);
|
||||||
else
|
else
|
||||||
_analysis_output("noiseR",seq,noise,n/2,1,0,0);
|
_analysis_output("noiseR",seq,noise,n/2,1,0,0);
|
||||||
|
}else{
|
||||||
|
_analysis_output("noise",seq,noise,n/2,1,0,0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -437,55 +442,61 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
vector. This includes tone masking, peak limiting and ATH */
|
vector. This includes tone masking, peak limiting and ATH */
|
||||||
|
|
||||||
_vp_tonemask(psy_look,
|
_vp_tonemask(psy_look,
|
||||||
logfft,
|
logfft,
|
||||||
tone,
|
tone,
|
||||||
global_ampmax,
|
global_ampmax,
|
||||||
local_ampmax[i]);
|
local_ampmax[i]);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2){
|
if(vi->channels==2){
|
||||||
if(i==0)
|
if(i==0)
|
||||||
_analysis_output("toneL",seq,tone,n/2,1,0,0);
|
_analysis_output("toneL",seq,tone,n/2,1,0,0);
|
||||||
else
|
else
|
||||||
_analysis_output("toneR",seq,tone,n/2,1,0,0);
|
_analysis_output("toneR",seq,tone,n/2,1,0,0);
|
||||||
|
}else{
|
||||||
|
_analysis_output("tone",seq,tone,n/2,1,0,0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* third step; we offset the noise vectors, overlay tone
|
/* third step; we offset the noise vectors, overlay tone
|
||||||
masking. We then do a floor1-specific line fit. If we're
|
masking. We then do a floor1-specific line fit. If we're
|
||||||
performing bitrate management, the line fit is performed
|
performing bitrate management, the line fit is performed
|
||||||
multiple times for up/down tweakage on demand. */
|
multiple times for up/down tweakage on demand. */
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
float aotuv[psy_look->n];
|
float aotuv[psy_look->n];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
_vp_offset_and_mix(psy_look,
|
_vp_offset_and_mix(psy_look,
|
||||||
noise,
|
noise,
|
||||||
tone,
|
tone,
|
||||||
1,
|
1,
|
||||||
logmask,
|
logmask,
|
||||||
mdct,
|
mdct,
|
||||||
logmdct);
|
logmdct);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2){
|
if(vi->channels==2){
|
||||||
if(i==0)
|
if(i==0)
|
||||||
_analysis_output("aotuvM1_L",seq,aotuv,psy_look->n,1,1,0);
|
_analysis_output("aotuvM1_L",seq,aotuv,psy_look->n,1,1,0);
|
||||||
else
|
else
|
||||||
_analysis_output("aotuvM1_R",seq,aotuv,psy_look->n,1,1,0);
|
_analysis_output("aotuvM1_R",seq,aotuv,psy_look->n,1,1,0);
|
||||||
}
|
}else{
|
||||||
|
_analysis_output("aotuvM1",seq,aotuv,psy_look->n,1,1,0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2){
|
if(vi->channels==2){
|
||||||
if(i==0)
|
if(i==0)
|
||||||
_analysis_output("mask1L",seq,logmask,n/2,1,0,0);
|
_analysis_output("mask1L",seq,logmask,n/2,1,0,0);
|
||||||
else
|
else
|
||||||
_analysis_output("mask1R",seq,logmask,n/2,1,0,0);
|
_analysis_output("mask1R",seq,logmask,n/2,1,0,0);
|
||||||
|
}else{
|
||||||
|
_analysis_output("mask1",seq,logmask,n/2,1,0,0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -495,73 +506,78 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
if(ci->floor_type[info->floorsubmap[submap]]!=1)return(-1);
|
if(ci->floor_type[info->floorsubmap[submap]]!=1)return(-1);
|
||||||
|
|
||||||
floor_posts[i][PACKETBLOBS/2]=
|
floor_posts[i][PACKETBLOBS/2]=
|
||||||
floor1_fit(vb,b->flr[info->floorsubmap[submap]],
|
floor1_fit(vb,b->flr[info->floorsubmap[submap]],
|
||||||
logmdct,
|
logmdct,
|
||||||
logmask);
|
logmask);
|
||||||
|
|
||||||
/* are we managing bitrate? If so, perform two more fits for
|
/* are we managing bitrate? If so, perform two more fits for
|
||||||
later rate tweaking (fits represent hi/lo) */
|
later rate tweaking (fits represent hi/lo) */
|
||||||
if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){
|
if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){
|
||||||
/* higher rate by way of lower noise curve */
|
/* higher rate by way of lower noise curve */
|
||||||
|
|
||||||
_vp_offset_and_mix(psy_look,
|
_vp_offset_and_mix(psy_look,
|
||||||
noise,
|
noise,
|
||||||
tone,
|
tone,
|
||||||
2,
|
2,
|
||||||
logmask,
|
logmask,
|
||||||
mdct,
|
mdct,
|
||||||
logmdct);
|
logmdct);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2){
|
if(vi->channels==2){
|
||||||
if(i==0)
|
if(i==0)
|
||||||
_analysis_output("mask2L",seq,logmask,n/2,1,0,0);
|
_analysis_output("mask2L",seq,logmask,n/2,1,0,0);
|
||||||
else
|
else
|
||||||
_analysis_output("mask2R",seq,logmask,n/2,1,0,0);
|
_analysis_output("mask2R",seq,logmask,n/2,1,0,0);
|
||||||
}
|
}else{
|
||||||
|
_analysis_output("mask2",seq,logmask,n/2,1,0,0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
floor_posts[i][PACKETBLOBS-1]=
|
floor_posts[i][PACKETBLOBS-1]=
|
||||||
floor1_fit(vb,b->flr[info->floorsubmap[submap]],
|
floor1_fit(vb,b->flr[info->floorsubmap[submap]],
|
||||||
logmdct,
|
logmdct,
|
||||||
logmask);
|
logmask);
|
||||||
|
|
||||||
/* lower rate by way of higher noise curve */
|
/* lower rate by way of higher noise curve */
|
||||||
_vp_offset_and_mix(psy_look,
|
_vp_offset_and_mix(psy_look,
|
||||||
noise,
|
noise,
|
||||||
tone,
|
tone,
|
||||||
0,
|
0,
|
||||||
logmask,
|
logmask,
|
||||||
mdct,
|
mdct,
|
||||||
logmdct);
|
logmdct);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(vi->channels==2)
|
if(vi->channels==2){
|
||||||
if(i==0)
|
if(i==0)
|
||||||
_analysis_output("mask0L",seq,logmask,n/2,1,0,0);
|
_analysis_output("mask0L",seq,logmask,n/2,1,0,0);
|
||||||
else
|
else
|
||||||
_analysis_output("mask0R",seq,logmask,n/2,1,0,0);
|
_analysis_output("mask0R",seq,logmask,n/2,1,0,0);
|
||||||
|
}else{
|
||||||
|
_analysis_output("mask0",seq,logmask,n/2,1,0,0);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
floor_posts[i][0]=
|
floor_posts[i][0]=
|
||||||
floor1_fit(vb,b->flr[info->floorsubmap[submap]],
|
floor1_fit(vb,b->flr[info->floorsubmap[submap]],
|
||||||
logmdct,
|
logmdct,
|
||||||
logmask);
|
logmask);
|
||||||
|
|
||||||
/* we also interpolate a range of intermediate curves for
|
/* we also interpolate a range of intermediate curves for
|
||||||
intermediate rates */
|
intermediate rates */
|
||||||
for(k=1;k<PACKETBLOBS/2;k++)
|
for(k=1;k<PACKETBLOBS/2;k++)
|
||||||
floor_posts[i][k]=
|
floor_posts[i][k]=
|
||||||
floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
|
floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
|
||||||
floor_posts[i][0],
|
floor_posts[i][0],
|
||||||
floor_posts[i][PACKETBLOBS/2],
|
floor_posts[i][PACKETBLOBS/2],
|
||||||
k*65536/(PACKETBLOBS/2));
|
k*65536/(PACKETBLOBS/2));
|
||||||
for(k=PACKETBLOBS/2+1;k<PACKETBLOBS-1;k++)
|
for(k=PACKETBLOBS/2+1;k<PACKETBLOBS-1;k++)
|
||||||
floor_posts[i][k]=
|
floor_posts[i][k]=
|
||||||
floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
|
floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
|
||||||
floor_posts[i][PACKETBLOBS/2],
|
floor_posts[i][PACKETBLOBS/2],
|
||||||
floor_posts[i][PACKETBLOBS-1],
|
floor_posts[i][PACKETBLOBS-1],
|
||||||
(k-PACKETBLOBS/2)*65536/(PACKETBLOBS/2));
|
(k-PACKETBLOBS/2)*65536/(PACKETBLOBS/2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -582,43 +598,12 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
/* iterate over the many masking curve fits we've created */
|
/* iterate over the many masking curve fits we've created */
|
||||||
|
|
||||||
{
|
{
|
||||||
float **res_bundle=alloca(sizeof(*res_bundle)*vi->channels);
|
int **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels);
|
||||||
float **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels);
|
|
||||||
int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
|
int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
|
||||||
int **sortindex=alloca(sizeof(*sortindex)*vi->channels);
|
|
||||||
float **mag_memo;
|
|
||||||
int **mag_sort;
|
|
||||||
|
|
||||||
if(info->coupling_steps){
|
|
||||||
mag_memo=_vp_quantize_couple_memo(vb,
|
|
||||||
&ci->psy_g_param,
|
|
||||||
psy_look,
|
|
||||||
info,
|
|
||||||
gmdct);
|
|
||||||
|
|
||||||
mag_sort=_vp_quantize_couple_sort(vb,
|
|
||||||
psy_look,
|
|
||||||
info,
|
|
||||||
mag_memo);
|
|
||||||
|
|
||||||
hf_reduction(&ci->psy_g_param,
|
|
||||||
psy_look,
|
|
||||||
info,
|
|
||||||
mag_memo);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(sortindex,0,sizeof(*sortindex)*vi->channels);
|
|
||||||
if(psy_look->vi->normal_channel_p){
|
|
||||||
for(i=0;i<vi->channels;i++){
|
|
||||||
float *mdct =gmdct[i];
|
|
||||||
sortindex[i]=alloca(sizeof(**sortindex)*n/2);
|
|
||||||
_vp_noise_normalize_sort(psy_look,mdct,sortindex[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(k=(vorbis_bitrate_managed(vb)?0:PACKETBLOBS/2);
|
for(k=(vorbis_bitrate_managed(vb)?0:PACKETBLOBS/2);
|
||||||
k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2);
|
k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2);
|
||||||
k++){
|
k++){
|
||||||
oggpack_buffer *opb=vbi->packetblob[k];
|
oggpack_buffer *opb=vbi->packetblob[k];
|
||||||
|
|
||||||
/* start out our new packet blob with packet type and mode */
|
/* start out our new packet blob with packet type and mode */
|
||||||
|
|
@ -628,93 +613,82 @@ static int mapping0_forward(vorbis_block *vb){
|
||||||
/* Encode frame mode, pre,post windowsize, then dispatch */
|
/* Encode frame mode, pre,post windowsize, then dispatch */
|
||||||
oggpack_write(opb,modenumber,b->modebits);
|
oggpack_write(opb,modenumber,b->modebits);
|
||||||
if(vb->W){
|
if(vb->W){
|
||||||
oggpack_write(opb,vb->lW,1);
|
oggpack_write(opb,vb->lW,1);
|
||||||
oggpack_write(opb,vb->nW,1);
|
oggpack_write(opb,vb->nW,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* encode floor, compute masking curve, sep out residue */
|
/* encode floor, compute masking curve, sep out residue */
|
||||||
for(i=0;i<vi->channels;i++){
|
for(i=0;i<vi->channels;i++){
|
||||||
int submap=info->chmuxlist[i];
|
int submap=info->chmuxlist[i];
|
||||||
float *mdct =gmdct[i];
|
int *ilogmask=iwork[i];
|
||||||
float *res =vb->pcm[i];
|
|
||||||
int *ilogmask=ilogmaskch[i]=
|
|
||||||
_vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
|
|
||||||
|
|
||||||
nonzero[i]=floor1_encode(opb,vb,b->flr[info->floorsubmap[submap]],
|
nonzero[i]=floor1_encode(opb,vb,b->flr[info->floorsubmap[submap]],
|
||||||
floor_posts[i][k],
|
floor_posts[i][k],
|
||||||
ilogmask);
|
ilogmask);
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
char buf[80];
|
char buf[80];
|
||||||
sprintf(buf,"maskI%c%d",i?'R':'L',k);
|
sprintf(buf,"maskI%c%d",i?'R':'L',k);
|
||||||
float work[n/2];
|
float work[n/2];
|
||||||
for(j=0;j<n/2;j++)
|
for(j=0;j<n/2;j++)
|
||||||
work[j]=FLOOR1_fromdB_LOOKUP[ilogmask[j]];
|
work[j]=FLOOR1_fromdB_LOOKUP[iwork[i][j]];
|
||||||
_analysis_output(buf,seq,work,n/2,1,1,0);
|
_analysis_output(buf,seq,work,n/2,1,1,0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
_vp_remove_floor(psy_look,
|
|
||||||
mdct,
|
|
||||||
ilogmask,
|
|
||||||
res,
|
|
||||||
ci->psy_g_param.sliding_lowpass[vb->W][k]);
|
|
||||||
|
|
||||||
_vp_noise_normalize(psy_look,res,res+n/2,sortindex[i]);
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
char buf[80];
|
|
||||||
float work[n/2];
|
|
||||||
for(j=0;j<n/2;j++)
|
|
||||||
work[j]=FLOOR1_fromdB_LOOKUP[ilogmask[j]]*(res+n/2)[j];
|
|
||||||
sprintf(buf,"resI%c%d",i?'R':'L',k);
|
|
||||||
_analysis_output(buf,seq,work,n/2,1,1,0);
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* our iteration is now based on masking curve, not prequant and
|
/* our iteration is now based on masking curve, not prequant and
|
||||||
coupling. Only one prequant/coupling step */
|
coupling. Only one prequant/coupling step */
|
||||||
|
|
||||||
/* quantize/couple */
|
/* quantize/couple */
|
||||||
/* incomplete implementation that assumes the tree is all depth
|
/* incomplete implementation that assumes the tree is all depth
|
||||||
one, or no tree at all */
|
one, or no tree at all */
|
||||||
if(info->coupling_steps){
|
_vp_couple_quantize_normalize(k,
|
||||||
_vp_couple(k,
|
&ci->psy_g_param,
|
||||||
&ci->psy_g_param,
|
psy_look,
|
||||||
psy_look,
|
info,
|
||||||
info,
|
gmdct,
|
||||||
vb->pcm,
|
iwork,
|
||||||
mag_memo,
|
nonzero,
|
||||||
mag_sort,
|
ci->psy_g_param.sliding_lowpass[vb->W][k],
|
||||||
ilogmaskch,
|
vi->channels);
|
||||||
nonzero,
|
|
||||||
ci->psy_g_param.sliding_lowpass[vb->W][k]);
|
#if 0
|
||||||
|
for(i=0;i<vi->channels;i++){
|
||||||
|
char buf[80];
|
||||||
|
sprintf(buf,"res%c%d",i?'R':'L',k);
|
||||||
|
float work[n/2];
|
||||||
|
for(j=0;j<n/2;j++)
|
||||||
|
work[j]=iwork[i][j];
|
||||||
|
_analysis_output(buf,seq,work,n/2,1,0,0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* classify and encode by submap */
|
/* classify and encode by submap */
|
||||||
for(i=0;i<info->submaps;i++){
|
for(i=0;i<info->submaps;i++){
|
||||||
int ch_in_bundle=0;
|
int ch_in_bundle=0;
|
||||||
long **classifications;
|
long **classifications;
|
||||||
int resnum=info->residuesubmap[i];
|
int resnum=info->residuesubmap[i];
|
||||||
|
|
||||||
for(j=0;j<vi->channels;j++){
|
for(j=0;j<vi->channels;j++){
|
||||||
if(info->chmuxlist[j]==i){
|
if(info->chmuxlist[j]==i){
|
||||||
zerobundle[ch_in_bundle]=0;
|
zerobundle[ch_in_bundle]=0;
|
||||||
if(nonzero[j])zerobundle[ch_in_bundle]=1;
|
if(nonzero[j])zerobundle[ch_in_bundle]=1;
|
||||||
res_bundle[ch_in_bundle]=vb->pcm[j];
|
couple_bundle[ch_in_bundle++]=iwork[j];
|
||||||
couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
classifications=_residue_P[ci->residue_type[resnum]]->
|
classifications=_residue_P[ci->residue_type[resnum]]->
|
||||||
class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle);
|
class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle);
|
||||||
|
|
||||||
_residue_P[ci->residue_type[resnum]]->
|
ch_in_bundle=0;
|
||||||
forward(opb,vb,b->residue[resnum],
|
for(j=0;j<vi->channels;j++)
|
||||||
couple_bundle,NULL,zerobundle,ch_in_bundle,classifications);
|
if(info->chmuxlist[j]==i)
|
||||||
|
couple_bundle[ch_in_bundle++]=iwork[j];
|
||||||
|
|
||||||
|
_residue_P[ci->residue_type[resnum]]->
|
||||||
|
forward(opb,vb,b->residue[resnum],
|
||||||
|
couple_bundle,zerobundle,ch_in_bundle,classifications,i);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ok, done encoding. Next protopacket. */
|
/* ok, done encoding. Next protopacket. */
|
||||||
|
|
@ -735,7 +709,6 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
|
||||||
codec_setup_info *ci=vi->codec_setup;
|
codec_setup_info *ci=vi->codec_setup;
|
||||||
private_state *b=vd->backend_state;
|
private_state *b=vd->backend_state;
|
||||||
vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)l;
|
vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)l;
|
||||||
int hs=ci->halfrate_flag;
|
|
||||||
|
|
||||||
int i,j;
|
int i,j;
|
||||||
long n=vb->pcmend=ci->blocksizes[vb->W];
|
long n=vb->pcmend=ci->blocksizes[vb->W];
|
||||||
|
|
@ -772,17 +745,17 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
|
||||||
int ch_in_bundle=0;
|
int ch_in_bundle=0;
|
||||||
for(j=0;j<vi->channels;j++){
|
for(j=0;j<vi->channels;j++){
|
||||||
if(info->chmuxlist[j]==i){
|
if(info->chmuxlist[j]==i){
|
||||||
if(nonzero[j])
|
if(nonzero[j])
|
||||||
zerobundle[ch_in_bundle]=1;
|
zerobundle[ch_in_bundle]=1;
|
||||||
else
|
else
|
||||||
zerobundle[ch_in_bundle]=0;
|
zerobundle[ch_in_bundle]=0;
|
||||||
pcmbundle[ch_in_bundle++]=vb->pcm[j];
|
pcmbundle[ch_in_bundle++]=vb->pcm[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_residue_P[ci->residue_type[info->residuesubmap[i]]]->
|
_residue_P[ci->residue_type[info->residuesubmap[i]]]->
|
||||||
inverse(vb,b->residue[info->residuesubmap[i]],
|
inverse(vb,b->residue[info->residuesubmap[i]],
|
||||||
pcmbundle,zerobundle,ch_in_bundle);
|
pcmbundle,zerobundle,ch_in_bundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* channel coupling */
|
/* channel coupling */
|
||||||
|
|
@ -795,21 +768,21 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
|
||||||
float ang=pcmA[j];
|
float ang=pcmA[j];
|
||||||
|
|
||||||
if(mag>0)
|
if(mag>0)
|
||||||
if(ang>0){
|
if(ang>0){
|
||||||
pcmM[j]=mag;
|
pcmM[j]=mag;
|
||||||
pcmA[j]=mag-ang;
|
pcmA[j]=mag-ang;
|
||||||
}else{
|
}else{
|
||||||
pcmA[j]=mag;
|
pcmA[j]=mag;
|
||||||
pcmM[j]=mag+ang;
|
pcmM[j]=mag+ang;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if(ang>0){
|
if(ang>0){
|
||||||
pcmM[j]=mag;
|
pcmM[j]=mag;
|
||||||
pcmA[j]=mag+ang;
|
pcmA[j]=mag+ang;
|
||||||
}else{
|
}else{
|
||||||
pcmA[j]=mag;
|
pcmA[j]=mag;
|
||||||
pcmM[j]=mag-ang;
|
pcmM[j]=mag-ang;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -819,7 +792,7 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
|
||||||
int submap=info->chmuxlist[i];
|
int submap=info->chmuxlist[i];
|
||||||
_floor_P[ci->floor_type[info->floorsubmap[submap]]]->
|
_floor_P[ci->floor_type[info->floorsubmap[submap]]]->
|
||||||
inverse2(vb,b->flr[info->floorsubmap[submap]],
|
inverse2(vb,b->flr[info->floorsubmap[submap]],
|
||||||
floormemo[i],pcm);
|
floormemo[i],pcm);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
|
/* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
|
||||||
|
|
@ -834,11 +807,10 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* export hooks */
|
/* export hooks */
|
||||||
vorbis_func_mapping mapping0_exportbundle={
|
const vorbis_func_mapping mapping0_exportbundle={
|
||||||
&mapping0_pack,
|
&mapping0_pack,
|
||||||
&mapping0_unpack,
|
&mapping0_unpack,
|
||||||
&mapping0_free_info,
|
&mapping0_free_info,
|
||||||
&mapping0_forward,
|
&mapping0_forward,
|
||||||
&mapping0_inverse
|
&mapping0_inverse
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: masking curve data for psychoacoustics
|
function: masking curve data for psychoacoustics
|
||||||
last mod: $Id: masking.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: masking.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
overly for only a bin or two of savings. */
|
overly for only a bin or two of savings. */
|
||||||
|
|
||||||
#define MAX_ATH 88
|
#define MAX_ATH 88
|
||||||
static float ATH[]={
|
static const float ATH[]={
|
||||||
/*15*/ -51, -52, -53, -54, -55, -56, -57, -58,
|
/*15*/ -51, -52, -53, -54, -55, -56, -57, -58,
|
||||||
/*31*/ -59, -60, -61, -62, -63, -64, -65, -66,
|
/*31*/ -59, -60, -61, -62, -63, -64, -65, -66,
|
||||||
/*63*/ -67, -68, -69, -70, -71, -72, -73, -74,
|
/*63*/ -67, -68, -69, -70, -71, -72, -73, -74,
|
||||||
|
|
@ -48,7 +48,7 @@ static float ATH[]={
|
||||||
/* (Vorbis 0dB, the loudest possible tone, is assumed to be ~100dB SPL
|
/* (Vorbis 0dB, the loudest possible tone, is assumed to be ~100dB SPL
|
||||||
for collection of these curves) */
|
for collection of these curves) */
|
||||||
|
|
||||||
static float tonemasks[P_BANDS][6][EHMER_MAX]={
|
static const float tonemasks[P_BANDS][6][EHMER_MAX]={
|
||||||
/* 62.5 Hz */
|
/* 62.5 Hz */
|
||||||
{{ -60, -60, -60, -60, -60, -60, -60, -60,
|
{{ -60, -60, -60, -60, -60, -60, -60, -60,
|
||||||
-60, -60, -60, -60, -62, -62, -65, -73,
|
-60, -60, -60, -60, -62, -62, -65, -73,
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,14 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: normalized modified discrete cosine transform
|
function: normalized modified discrete cosine transform
|
||||||
power of two length transform only [64 <= n ]
|
power of two length transform only [64 <= n ]
|
||||||
last mod: $Id: mdct.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: mdct.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
Original algorithm adapted long ago from _The use of multirate filter
|
Original algorithm adapted long ago from _The use of multirate filter
|
||||||
banks for coding of high quality digital audio_, by T. Sporer,
|
banks for coding of high quality digital audio_, by T. Sporer,
|
||||||
|
|
@ -81,7 +81,7 @@ void mdct_init(mdct_lookup *lookup,int n){
|
||||||
for(i=0;i<n/8;i++){
|
for(i=0;i<n/8;i++){
|
||||||
int acc=0;
|
int acc=0;
|
||||||
for(j=0;msb>>j;j++)
|
for(j=0;msb>>j;j++)
|
||||||
if((msb>>j)&i)acc|=1<<j;
|
if((msb>>j)&i)acc|=1<<j;
|
||||||
bitrev[i*2]=((~acc)&mask)-1;
|
bitrev[i*2]=((~acc)&mask)-1;
|
||||||
bitrev[i*2+1]=acc;
|
bitrev[i*2+1]=acc;
|
||||||
|
|
||||||
|
|
@ -97,20 +97,20 @@ STIN void mdct_butterfly_8(DATA_TYPE *x){
|
||||||
REG_TYPE r2 = x[4] + x[0];
|
REG_TYPE r2 = x[4] + x[0];
|
||||||
REG_TYPE r3 = x[4] - x[0];
|
REG_TYPE r3 = x[4] - x[0];
|
||||||
|
|
||||||
x[6] = r0 + r2;
|
x[6] = r0 + r2;
|
||||||
x[4] = r0 - r2;
|
x[4] = r0 - r2;
|
||||||
|
|
||||||
r0 = x[5] - x[1];
|
r0 = x[5] - x[1];
|
||||||
r2 = x[7] - x[3];
|
r2 = x[7] - x[3];
|
||||||
x[0] = r1 + r0;
|
x[0] = r1 + r0;
|
||||||
x[2] = r1 - r0;
|
x[2] = r1 - r0;
|
||||||
|
|
||||||
r0 = x[5] + x[1];
|
r0 = x[5] + x[1];
|
||||||
r1 = x[7] + x[3];
|
r1 = x[7] + x[3];
|
||||||
x[3] = r2 + r3;
|
x[3] = r2 + r3;
|
||||||
x[1] = r2 - r3;
|
x[1] = r2 - r3;
|
||||||
x[7] = r1 + r0;
|
x[7] = r1 + r0;
|
||||||
x[5] = r1 - r0;
|
x[5] = r1 - r0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -145,8 +145,8 @@ STIN void mdct_butterfly_16(DATA_TYPE *x){
|
||||||
x[6] = r0;
|
x[6] = r0;
|
||||||
x[7] = r1;
|
x[7] = r1;
|
||||||
|
|
||||||
mdct_butterfly_8(x);
|
mdct_butterfly_8(x);
|
||||||
mdct_butterfly_8(x+8);
|
mdct_butterfly_8(x+8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 32 point butterfly (in place, 4 register) */
|
/* 32 point butterfly (in place, 4 register) */
|
||||||
|
|
@ -155,68 +155,68 @@ STIN void mdct_butterfly_32(DATA_TYPE *x){
|
||||||
REG_TYPE r1 = x[31] - x[15];
|
REG_TYPE r1 = x[31] - x[15];
|
||||||
|
|
||||||
x[30] += x[14];
|
x[30] += x[14];
|
||||||
x[31] += x[15];
|
x[31] += x[15];
|
||||||
x[14] = r0;
|
x[14] = r0;
|
||||||
x[15] = r1;
|
x[15] = r1;
|
||||||
|
|
||||||
r0 = x[28] - x[12];
|
r0 = x[28] - x[12];
|
||||||
r1 = x[29] - x[13];
|
r1 = x[29] - x[13];
|
||||||
x[28] += x[12];
|
x[28] += x[12];
|
||||||
x[29] += x[13];
|
x[29] += x[13];
|
||||||
x[12] = MULT_NORM( r0 * cPI1_8 - r1 * cPI3_8 );
|
x[12] = MULT_NORM( r0 * cPI1_8 - r1 * cPI3_8 );
|
||||||
x[13] = MULT_NORM( r0 * cPI3_8 + r1 * cPI1_8 );
|
x[13] = MULT_NORM( r0 * cPI3_8 + r1 * cPI1_8 );
|
||||||
|
|
||||||
r0 = x[26] - x[10];
|
r0 = x[26] - x[10];
|
||||||
r1 = x[27] - x[11];
|
r1 = x[27] - x[11];
|
||||||
x[26] += x[10];
|
x[26] += x[10];
|
||||||
x[27] += x[11];
|
x[27] += x[11];
|
||||||
x[10] = MULT_NORM(( r0 - r1 ) * cPI2_8);
|
x[10] = MULT_NORM(( r0 - r1 ) * cPI2_8);
|
||||||
x[11] = MULT_NORM(( r0 + r1 ) * cPI2_8);
|
x[11] = MULT_NORM(( r0 + r1 ) * cPI2_8);
|
||||||
|
|
||||||
r0 = x[24] - x[8];
|
r0 = x[24] - x[8];
|
||||||
r1 = x[25] - x[9];
|
r1 = x[25] - x[9];
|
||||||
x[24] += x[8];
|
x[24] += x[8];
|
||||||
x[25] += x[9];
|
x[25] += x[9];
|
||||||
x[8] = MULT_NORM( r0 * cPI3_8 - r1 * cPI1_8 );
|
x[8] = MULT_NORM( r0 * cPI3_8 - r1 * cPI1_8 );
|
||||||
x[9] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 );
|
x[9] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 );
|
||||||
|
|
||||||
r0 = x[22] - x[6];
|
r0 = x[22] - x[6];
|
||||||
r1 = x[7] - x[23];
|
r1 = x[7] - x[23];
|
||||||
x[22] += x[6];
|
x[22] += x[6];
|
||||||
x[23] += x[7];
|
x[23] += x[7];
|
||||||
x[6] = r1;
|
x[6] = r1;
|
||||||
x[7] = r0;
|
x[7] = r0;
|
||||||
|
|
||||||
r0 = x[4] - x[20];
|
r0 = x[4] - x[20];
|
||||||
r1 = x[5] - x[21];
|
r1 = x[5] - x[21];
|
||||||
x[20] += x[4];
|
x[20] += x[4];
|
||||||
x[21] += x[5];
|
x[21] += x[5];
|
||||||
x[4] = MULT_NORM( r1 * cPI1_8 + r0 * cPI3_8 );
|
x[4] = MULT_NORM( r1 * cPI1_8 + r0 * cPI3_8 );
|
||||||
x[5] = MULT_NORM( r1 * cPI3_8 - r0 * cPI1_8 );
|
x[5] = MULT_NORM( r1 * cPI3_8 - r0 * cPI1_8 );
|
||||||
|
|
||||||
r0 = x[2] - x[18];
|
r0 = x[2] - x[18];
|
||||||
r1 = x[3] - x[19];
|
r1 = x[3] - x[19];
|
||||||
x[18] += x[2];
|
x[18] += x[2];
|
||||||
x[19] += x[3];
|
x[19] += x[3];
|
||||||
x[2] = MULT_NORM(( r1 + r0 ) * cPI2_8);
|
x[2] = MULT_NORM(( r1 + r0 ) * cPI2_8);
|
||||||
x[3] = MULT_NORM(( r1 - r0 ) * cPI2_8);
|
x[3] = MULT_NORM(( r1 - r0 ) * cPI2_8);
|
||||||
|
|
||||||
r0 = x[0] - x[16];
|
r0 = x[0] - x[16];
|
||||||
r1 = x[1] - x[17];
|
r1 = x[1] - x[17];
|
||||||
x[16] += x[0];
|
x[16] += x[0];
|
||||||
x[17] += x[1];
|
x[17] += x[1];
|
||||||
x[0] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 );
|
x[0] = MULT_NORM( r1 * cPI3_8 + r0 * cPI1_8 );
|
||||||
x[1] = MULT_NORM( r1 * cPI1_8 - r0 * cPI3_8 );
|
x[1] = MULT_NORM( r1 * cPI1_8 - r0 * cPI3_8 );
|
||||||
|
|
||||||
mdct_butterfly_16(x);
|
mdct_butterfly_16(x);
|
||||||
mdct_butterfly_16(x+16);
|
mdct_butterfly_16(x+16);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* N point first stage butterfly (in place, 2 register) */
|
/* N point first stage butterfly (in place, 2 register) */
|
||||||
STIN void mdct_butterfly_first(DATA_TYPE *T,
|
STIN void mdct_butterfly_first(DATA_TYPE *T,
|
||||||
DATA_TYPE *x,
|
DATA_TYPE *x,
|
||||||
int points){
|
int points){
|
||||||
|
|
||||||
DATA_TYPE *x1 = x + points - 8;
|
DATA_TYPE *x1 = x + points - 8;
|
||||||
DATA_TYPE *x2 = x + (points>>1) - 8;
|
DATA_TYPE *x2 = x + (points>>1) - 8;
|
||||||
|
|
@ -226,32 +226,32 @@ STIN void mdct_butterfly_first(DATA_TYPE *T,
|
||||||
do{
|
do{
|
||||||
|
|
||||||
r0 = x1[6] - x2[6];
|
r0 = x1[6] - x2[6];
|
||||||
r1 = x1[7] - x2[7];
|
r1 = x1[7] - x2[7];
|
||||||
x1[6] += x2[6];
|
x1[6] += x2[6];
|
||||||
x1[7] += x2[7];
|
x1[7] += x2[7];
|
||||||
x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
||||||
x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
||||||
|
|
||||||
r0 = x1[4] - x2[4];
|
r0 = x1[4] - x2[4];
|
||||||
r1 = x1[5] - x2[5];
|
r1 = x1[5] - x2[5];
|
||||||
x1[4] += x2[4];
|
x1[4] += x2[4];
|
||||||
x1[5] += x2[5];
|
x1[5] += x2[5];
|
||||||
x2[4] = MULT_NORM(r1 * T[5] + r0 * T[4]);
|
x2[4] = MULT_NORM(r1 * T[5] + r0 * T[4]);
|
||||||
x2[5] = MULT_NORM(r1 * T[4] - r0 * T[5]);
|
x2[5] = MULT_NORM(r1 * T[4] - r0 * T[5]);
|
||||||
|
|
||||||
r0 = x1[2] - x2[2];
|
r0 = x1[2] - x2[2];
|
||||||
r1 = x1[3] - x2[3];
|
r1 = x1[3] - x2[3];
|
||||||
x1[2] += x2[2];
|
x1[2] += x2[2];
|
||||||
x1[3] += x2[3];
|
x1[3] += x2[3];
|
||||||
x2[2] = MULT_NORM(r1 * T[9] + r0 * T[8]);
|
x2[2] = MULT_NORM(r1 * T[9] + r0 * T[8]);
|
||||||
x2[3] = MULT_NORM(r1 * T[8] - r0 * T[9]);
|
x2[3] = MULT_NORM(r1 * T[8] - r0 * T[9]);
|
||||||
|
|
||||||
r0 = x1[0] - x2[0];
|
r0 = x1[0] - x2[0];
|
||||||
r1 = x1[1] - x2[1];
|
r1 = x1[1] - x2[1];
|
||||||
x1[0] += x2[0];
|
x1[0] += x2[0];
|
||||||
x1[1] += x2[1];
|
x1[1] += x2[1];
|
||||||
x2[0] = MULT_NORM(r1 * T[13] + r0 * T[12]);
|
x2[0] = MULT_NORM(r1 * T[13] + r0 * T[12]);
|
||||||
x2[1] = MULT_NORM(r1 * T[12] - r0 * T[13]);
|
x2[1] = MULT_NORM(r1 * T[12] - r0 * T[13]);
|
||||||
|
|
||||||
x1-=8;
|
x1-=8;
|
||||||
x2-=8;
|
x2-=8;
|
||||||
|
|
@ -262,9 +262,9 @@ STIN void mdct_butterfly_first(DATA_TYPE *T,
|
||||||
|
|
||||||
/* N/stage point generic N stage butterfly (in place, 2 register) */
|
/* N/stage point generic N stage butterfly (in place, 2 register) */
|
||||||
STIN void mdct_butterfly_generic(DATA_TYPE *T,
|
STIN void mdct_butterfly_generic(DATA_TYPE *T,
|
||||||
DATA_TYPE *x,
|
DATA_TYPE *x,
|
||||||
int points,
|
int points,
|
||||||
int trigint){
|
int trigint){
|
||||||
|
|
||||||
DATA_TYPE *x1 = x + points - 8;
|
DATA_TYPE *x1 = x + points - 8;
|
||||||
DATA_TYPE *x2 = x + (points>>1) - 8;
|
DATA_TYPE *x2 = x + (points>>1) - 8;
|
||||||
|
|
@ -274,40 +274,40 @@ STIN void mdct_butterfly_generic(DATA_TYPE *T,
|
||||||
do{
|
do{
|
||||||
|
|
||||||
r0 = x1[6] - x2[6];
|
r0 = x1[6] - x2[6];
|
||||||
r1 = x1[7] - x2[7];
|
r1 = x1[7] - x2[7];
|
||||||
x1[6] += x2[6];
|
x1[6] += x2[6];
|
||||||
x1[7] += x2[7];
|
x1[7] += x2[7];
|
||||||
x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
||||||
x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
||||||
|
|
||||||
T+=trigint;
|
T+=trigint;
|
||||||
|
|
||||||
r0 = x1[4] - x2[4];
|
r0 = x1[4] - x2[4];
|
||||||
r1 = x1[5] - x2[5];
|
r1 = x1[5] - x2[5];
|
||||||
x1[4] += x2[4];
|
x1[4] += x2[4];
|
||||||
x1[5] += x2[5];
|
x1[5] += x2[5];
|
||||||
x2[4] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
x2[4] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
||||||
x2[5] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
x2[5] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
||||||
|
|
||||||
T+=trigint;
|
T+=trigint;
|
||||||
|
|
||||||
r0 = x1[2] - x2[2];
|
r0 = x1[2] - x2[2];
|
||||||
r1 = x1[3] - x2[3];
|
r1 = x1[3] - x2[3];
|
||||||
x1[2] += x2[2];
|
x1[2] += x2[2];
|
||||||
x1[3] += x2[3];
|
x1[3] += x2[3];
|
||||||
x2[2] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
x2[2] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
||||||
x2[3] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
x2[3] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
||||||
|
|
||||||
T+=trigint;
|
T+=trigint;
|
||||||
|
|
||||||
r0 = x1[0] - x2[0];
|
r0 = x1[0] - x2[0];
|
||||||
r1 = x1[1] - x2[1];
|
r1 = x1[1] - x2[1];
|
||||||
x1[0] += x2[0];
|
x1[0] += x2[0];
|
||||||
x1[1] += x2[1];
|
x1[1] += x2[1];
|
||||||
x2[0] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
x2[0] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
||||||
x2[1] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
x2[1] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
||||||
|
|
||||||
T+=trigint;
|
T+=trigint;
|
||||||
x1-=8;
|
x1-=8;
|
||||||
x2-=8;
|
x2-=8;
|
||||||
|
|
||||||
|
|
@ -315,8 +315,8 @@ STIN void mdct_butterfly_generic(DATA_TYPE *T,
|
||||||
}
|
}
|
||||||
|
|
||||||
STIN void mdct_butterflies(mdct_lookup *init,
|
STIN void mdct_butterflies(mdct_lookup *init,
|
||||||
DATA_TYPE *x,
|
DATA_TYPE *x,
|
||||||
int points){
|
int points){
|
||||||
|
|
||||||
DATA_TYPE *T=init->trig;
|
DATA_TYPE *T=init->trig;
|
||||||
int stages=init->log2n-5;
|
int stages=init->log2n-5;
|
||||||
|
|
@ -345,7 +345,7 @@ void mdct_clear(mdct_lookup *l){
|
||||||
}
|
}
|
||||||
|
|
||||||
STIN void mdct_bitreverse(mdct_lookup *init,
|
STIN void mdct_bitreverse(mdct_lookup *init,
|
||||||
DATA_TYPE *x){
|
DATA_TYPE *x){
|
||||||
int n = init->n;
|
int n = init->n;
|
||||||
int *bit = init->bitrev;
|
int *bit = init->bitrev;
|
||||||
DATA_TYPE *w0 = x;
|
DATA_TYPE *w0 = x;
|
||||||
|
|
@ -361,15 +361,15 @@ STIN void mdct_bitreverse(mdct_lookup *init,
|
||||||
REG_TYPE r2 = MULT_NORM(r1 * T[0] + r0 * T[1]);
|
REG_TYPE r2 = MULT_NORM(r1 * T[0] + r0 * T[1]);
|
||||||
REG_TYPE r3 = MULT_NORM(r1 * T[1] - r0 * T[0]);
|
REG_TYPE r3 = MULT_NORM(r1 * T[1] - r0 * T[0]);
|
||||||
|
|
||||||
w1 -= 4;
|
w1 -= 4;
|
||||||
|
|
||||||
r0 = HALVE(x0[1] + x1[1]);
|
r0 = HALVE(x0[1] + x1[1]);
|
||||||
r1 = HALVE(x0[0] - x1[0]);
|
r1 = HALVE(x0[0] - x1[0]);
|
||||||
|
|
||||||
w0[0] = r0 + r2;
|
w0[0] = r0 + r2;
|
||||||
w1[2] = r0 - r2;
|
w1[2] = r0 - r2;
|
||||||
w0[1] = r1 + r3;
|
w0[1] = r1 + r3;
|
||||||
w1[3] = r3 - r1;
|
w1[3] = r3 - r1;
|
||||||
|
|
||||||
x0 = x+bit[2];
|
x0 = x+bit[2];
|
||||||
x1 = x+bit[3];
|
x1 = x+bit[3];
|
||||||
|
|
@ -382,14 +382,14 @@ STIN void mdct_bitreverse(mdct_lookup *init,
|
||||||
r0 = HALVE(x0[1] + x1[1]);
|
r0 = HALVE(x0[1] + x1[1]);
|
||||||
r1 = HALVE(x0[0] - x1[0]);
|
r1 = HALVE(x0[0] - x1[0]);
|
||||||
|
|
||||||
w0[2] = r0 + r2;
|
w0[2] = r0 + r2;
|
||||||
w1[0] = r0 - r2;
|
w1[0] = r0 - r2;
|
||||||
w0[3] = r1 + r3;
|
w0[3] = r1 + r3;
|
||||||
w1[1] = r3 - r1;
|
w1[1] = r3 - r1;
|
||||||
|
|
||||||
T += 4;
|
T += 4;
|
||||||
bit += 4;
|
bit += 4;
|
||||||
w0 += 4;
|
w0 += 4;
|
||||||
|
|
||||||
}while(w0<w1);
|
}while(w0<w1);
|
||||||
}
|
}
|
||||||
|
|
@ -561,4 +561,3 @@ void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
|
||||||
T+=2;
|
T+=2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: modified discrete cosine transform prototypes
|
function: modified discrete cosine transform prototypes
|
||||||
last mod: $Id: mdct.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -69,15 +69,3 @@ extern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
|
||||||
extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
|
extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: miscellaneous prototypes
|
function: miscellaneous prototypes
|
||||||
last mod: $Id: misc.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: misc.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -19,16 +19,21 @@
|
||||||
#define _V_RANDOM_H_
|
#define _V_RANDOM_H_
|
||||||
#include "vorbis/codec.h"
|
#include "vorbis/codec.h"
|
||||||
|
|
||||||
extern int analysis_noisy;
|
|
||||||
|
|
||||||
extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
|
extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
|
||||||
extern void _vorbis_block_ripcord(vorbis_block *vb);
|
extern void _vorbis_block_ripcord(vorbis_block *vb);
|
||||||
|
|
||||||
|
#ifdef ANALYSIS
|
||||||
|
extern int analysis_noisy;
|
||||||
extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
|
extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
|
||||||
ogg_int64_t off);
|
ogg_int64_t off);
|
||||||
|
extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,
|
||||||
|
ogg_int64_t off);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_MALLOC
|
#ifdef DEBUG_MALLOC
|
||||||
|
|
||||||
#define _VDBG_GRAPHFILE "malloc.m"
|
#define _VDBG_GRAPHFILE "malloc.m"
|
||||||
|
#undef _VDBG_GRAPHFILE
|
||||||
extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line);
|
extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line);
|
||||||
extern void _VDBG_free(void *ptr,char *file,long line);
|
extern void _VDBG_free(void *ptr,char *file,long line);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: key floor settings
|
function: key floor settings
|
||||||
last mod: $Id: floor_all.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: floor_all.h 17050 2010-03-26 01:34:42Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -19,21 +19,21 @@
|
||||||
#include "backends.h"
|
#include "backends.h"
|
||||||
#include "books/floor/floor_books.h"
|
#include "books/floor/floor_books.h"
|
||||||
|
|
||||||
static static_codebook *_floor_128x4_books[]={
|
static const static_codebook*const _floor_128x4_books[]={
|
||||||
&_huff_book_line_128x4_class0,
|
&_huff_book_line_128x4_class0,
|
||||||
&_huff_book_line_128x4_0sub0,
|
&_huff_book_line_128x4_0sub0,
|
||||||
&_huff_book_line_128x4_0sub1,
|
&_huff_book_line_128x4_0sub1,
|
||||||
&_huff_book_line_128x4_0sub2,
|
&_huff_book_line_128x4_0sub2,
|
||||||
&_huff_book_line_128x4_0sub3,
|
&_huff_book_line_128x4_0sub3,
|
||||||
};
|
};
|
||||||
static static_codebook *_floor_256x4_books[]={
|
static const static_codebook*const _floor_256x4_books[]={
|
||||||
&_huff_book_line_256x4_class0,
|
&_huff_book_line_256x4_class0,
|
||||||
&_huff_book_line_256x4_0sub0,
|
&_huff_book_line_256x4_0sub0,
|
||||||
&_huff_book_line_256x4_0sub1,
|
&_huff_book_line_256x4_0sub1,
|
||||||
&_huff_book_line_256x4_0sub2,
|
&_huff_book_line_256x4_0sub2,
|
||||||
&_huff_book_line_256x4_0sub3,
|
&_huff_book_line_256x4_0sub3,
|
||||||
};
|
};
|
||||||
static static_codebook *_floor_128x7_books[]={
|
static const static_codebook*const _floor_128x7_books[]={
|
||||||
&_huff_book_line_128x7_class0,
|
&_huff_book_line_128x7_class0,
|
||||||
&_huff_book_line_128x7_class1,
|
&_huff_book_line_128x7_class1,
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ static static_codebook *_floor_128x7_books[]={
|
||||||
&_huff_book_line_128x7_1sub2,
|
&_huff_book_line_128x7_1sub2,
|
||||||
&_huff_book_line_128x7_1sub3,
|
&_huff_book_line_128x7_1sub3,
|
||||||
};
|
};
|
||||||
static static_codebook *_floor_256x7_books[]={
|
static const static_codebook*const _floor_256x7_books[]={
|
||||||
&_huff_book_line_256x7_class0,
|
&_huff_book_line_256x7_class0,
|
||||||
&_huff_book_line_256x7_class1,
|
&_huff_book_line_256x7_class1,
|
||||||
|
|
||||||
|
|
@ -55,7 +55,7 @@ static static_codebook *_floor_256x7_books[]={
|
||||||
&_huff_book_line_256x7_1sub2,
|
&_huff_book_line_256x7_1sub2,
|
||||||
&_huff_book_line_256x7_1sub3,
|
&_huff_book_line_256x7_1sub3,
|
||||||
};
|
};
|
||||||
static static_codebook *_floor_128x11_books[]={
|
static const static_codebook*const _floor_128x11_books[]={
|
||||||
&_huff_book_line_128x11_class1,
|
&_huff_book_line_128x11_class1,
|
||||||
&_huff_book_line_128x11_class2,
|
&_huff_book_line_128x11_class2,
|
||||||
&_huff_book_line_128x11_class3,
|
&_huff_book_line_128x11_class3,
|
||||||
|
|
@ -70,7 +70,7 @@ static static_codebook *_floor_128x11_books[]={
|
||||||
&_huff_book_line_128x11_3sub2,
|
&_huff_book_line_128x11_3sub2,
|
||||||
&_huff_book_line_128x11_3sub3,
|
&_huff_book_line_128x11_3sub3,
|
||||||
};
|
};
|
||||||
static static_codebook *_floor_128x17_books[]={
|
static const static_codebook*const _floor_128x17_books[]={
|
||||||
&_huff_book_line_128x17_class1,
|
&_huff_book_line_128x17_class1,
|
||||||
&_huff_book_line_128x17_class2,
|
&_huff_book_line_128x17_class2,
|
||||||
&_huff_book_line_128x17_class3,
|
&_huff_book_line_128x17_class3,
|
||||||
|
|
@ -85,14 +85,14 @@ static static_codebook *_floor_128x17_books[]={
|
||||||
&_huff_book_line_128x17_3sub2,
|
&_huff_book_line_128x17_3sub2,
|
||||||
&_huff_book_line_128x17_3sub3,
|
&_huff_book_line_128x17_3sub3,
|
||||||
};
|
};
|
||||||
static static_codebook *_floor_256x4low_books[]={
|
static const static_codebook*const _floor_256x4low_books[]={
|
||||||
&_huff_book_line_256x4low_class0,
|
&_huff_book_line_256x4low_class0,
|
||||||
&_huff_book_line_256x4low_0sub0,
|
&_huff_book_line_256x4low_0sub0,
|
||||||
&_huff_book_line_256x4low_0sub1,
|
&_huff_book_line_256x4low_0sub1,
|
||||||
&_huff_book_line_256x4low_0sub2,
|
&_huff_book_line_256x4low_0sub2,
|
||||||
&_huff_book_line_256x4low_0sub3,
|
&_huff_book_line_256x4low_0sub3,
|
||||||
};
|
};
|
||||||
static static_codebook *_floor_1024x27_books[]={
|
static const static_codebook*const _floor_1024x27_books[]={
|
||||||
&_huff_book_line_1024x27_class1,
|
&_huff_book_line_1024x27_class1,
|
||||||
&_huff_book_line_1024x27_class2,
|
&_huff_book_line_1024x27_class2,
|
||||||
&_huff_book_line_1024x27_class3,
|
&_huff_book_line_1024x27_class3,
|
||||||
|
|
@ -110,7 +110,7 @@ static static_codebook *_floor_1024x27_books[]={
|
||||||
&_huff_book_line_1024x27_4sub2,
|
&_huff_book_line_1024x27_4sub2,
|
||||||
&_huff_book_line_1024x27_4sub3,
|
&_huff_book_line_1024x27_4sub3,
|
||||||
};
|
};
|
||||||
static static_codebook *_floor_2048x27_books[]={
|
static const static_codebook*const _floor_2048x27_books[]={
|
||||||
&_huff_book_line_2048x27_class1,
|
&_huff_book_line_2048x27_class1,
|
||||||
&_huff_book_line_2048x27_class2,
|
&_huff_book_line_2048x27_class2,
|
||||||
&_huff_book_line_2048x27_class3,
|
&_huff_book_line_2048x27_class3,
|
||||||
|
|
@ -129,7 +129,7 @@ static static_codebook *_floor_2048x27_books[]={
|
||||||
&_huff_book_line_2048x27_4sub3,
|
&_huff_book_line_2048x27_4sub3,
|
||||||
};
|
};
|
||||||
|
|
||||||
static static_codebook *_floor_512x17_books[]={
|
static const static_codebook*const _floor_512x17_books[]={
|
||||||
&_huff_book_line_512x17_class1,
|
&_huff_book_line_512x17_class1,
|
||||||
&_huff_book_line_512x17_class2,
|
&_huff_book_line_512x17_class2,
|
||||||
&_huff_book_line_512x17_class3,
|
&_huff_book_line_512x17_class3,
|
||||||
|
|
@ -145,7 +145,11 @@ static static_codebook *_floor_512x17_books[]={
|
||||||
&_huff_book_line_512x17_3sub3,
|
&_huff_book_line_512x17_3sub3,
|
||||||
};
|
};
|
||||||
|
|
||||||
static static_codebook **_floor_books[10]={
|
static const static_codebook*const _floor_Xx0_books[]={
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
static const static_codebook*const *const _floor_books[11]={
|
||||||
_floor_128x4_books,
|
_floor_128x4_books,
|
||||||
_floor_256x4_books,
|
_floor_256x4_books,
|
||||||
_floor_128x7_books,
|
_floor_128x7_books,
|
||||||
|
|
@ -156,93 +160,101 @@ static static_codebook **_floor_books[10]={
|
||||||
_floor_1024x27_books,
|
_floor_1024x27_books,
|
||||||
_floor_2048x27_books,
|
_floor_2048x27_books,
|
||||||
_floor_512x17_books,
|
_floor_512x17_books,
|
||||||
|
_floor_Xx0_books,
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_info_floor1 _floor[10]={
|
static const vorbis_info_floor1 _floor[11]={
|
||||||
/* 128 x 4 */
|
/* 0: 128 x 4 */
|
||||||
{
|
{
|
||||||
1,{0},{4},{2},{0},
|
1,{0},{4},{2},{0},
|
||||||
{{1,2,3,4}},
|
{{1,2,3,4}},
|
||||||
4,{0,128, 33,8,16,70},
|
4,{0,128, 33,8,16,70},
|
||||||
|
|
||||||
60,30,500, 1.,18., -1
|
60,30,500, 1.,18., 128
|
||||||
},
|
},
|
||||||
/* 256 x 4 */
|
/* 1: 256 x 4 */
|
||||||
{
|
{
|
||||||
1,{0},{4},{2},{0},
|
1,{0},{4},{2},{0},
|
||||||
{{1,2,3,4}},
|
{{1,2,3,4}},
|
||||||
4,{0,256, 66,16,32,140},
|
4,{0,256, 66,16,32,140},
|
||||||
|
|
||||||
60,30,500, 1.,18., -1
|
60,30,500, 1.,18., 256
|
||||||
},
|
},
|
||||||
/* 128 x 7 */
|
/* 2: 128 x 7 */
|
||||||
{
|
{
|
||||||
2,{0,1},{3,4},{2,2},{0,1},
|
2,{0,1},{3,4},{2,2},{0,1},
|
||||||
{{-1,2,3,4},{-1,5,6,7}},
|
{{-1,2,3,4},{-1,5,6,7}},
|
||||||
4,{0,128, 14,4,58, 2,8,28,90},
|
4,{0,128, 14,4,58, 2,8,28,90},
|
||||||
|
|
||||||
60,30,500, 1.,18., -1
|
60,30,500, 1.,18., 128
|
||||||
},
|
},
|
||||||
/* 256 x 7 */
|
/* 3: 256 x 7 */
|
||||||
{
|
{
|
||||||
2,{0,1},{3,4},{2,2},{0,1},
|
2,{0,1},{3,4},{2,2},{0,1},
|
||||||
{{-1,2,3,4},{-1,5,6,7}},
|
{{-1,2,3,4},{-1,5,6,7}},
|
||||||
4,{0,256, 28,8,116, 4,16,56,180},
|
4,{0,256, 28,8,116, 4,16,56,180},
|
||||||
|
|
||||||
60,30,500, 1.,18., -1
|
60,30,500, 1.,18., 256
|
||||||
},
|
},
|
||||||
/* 128 x 11 */
|
/* 4: 128 x 11 */
|
||||||
{
|
{
|
||||||
4,{0,1,2,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
|
4,{0,1,2,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
|
||||||
{{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
|
{{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
|
||||||
|
|
||||||
2,{0,128, 8,33, 4,16,70, 2,6,12, 23,46,90},
|
2,{0,128, 8,33, 4,16,70, 2,6,12, 23,46,90},
|
||||||
|
|
||||||
60,30,500, 1,18., -1
|
60,30,500, 1,18., 128
|
||||||
},
|
},
|
||||||
/* 128 x 17 */
|
/* 5: 128 x 17 */
|
||||||
{
|
{
|
||||||
6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
|
6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
|
||||||
{{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
|
{{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
|
||||||
2,{0,128, 12,46, 4,8,16, 23,33,70, 2,6,10, 14,19,28, 39,58,90},
|
2,{0,128, 12,46, 4,8,16, 23,33,70, 2,6,10, 14,19,28, 39,58,90},
|
||||||
|
|
||||||
60,30,500, 1,18., -1
|
60,30,500, 1,18., 128
|
||||||
},
|
},
|
||||||
/* 256 x 4 (low bitrate version) */
|
/* 6: 256 x 4 (low bitrate version) */
|
||||||
{
|
{
|
||||||
1,{0},{4},{2},{0},
|
1,{0},{4},{2},{0},
|
||||||
{{1,2,3,4}},
|
{{1,2,3,4}},
|
||||||
4,{0,256, 66,16,32,140},
|
4,{0,256, 66,16,32,140},
|
||||||
|
|
||||||
60,30,500, 1.,18., -1
|
60,30,500, 1.,18., 256
|
||||||
},
|
},
|
||||||
/* 1024 x 27 */
|
/* 7: 1024 x 27 */
|
||||||
{
|
{
|
||||||
8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
|
8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
|
||||||
{{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
|
{{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
|
||||||
2,{0,1024, 93,23,372, 6,46,186,750, 14,33,65, 130,260,556,
|
2,{0,1024, 93,23,372, 6,46,186,750, 14,33,65, 130,260,556,
|
||||||
3,10,18,28, 39,55,79,111, 158,220,312, 464,650,850},
|
3,10,18,28, 39,55,79,111, 158,220,312, 464,650,850},
|
||||||
|
|
||||||
60,30,500, 3,18., -1 /* lowpass */
|
60,30,500, 3,18., 1024
|
||||||
},
|
},
|
||||||
/* 2048 x 27 */
|
/* 8: 2048 x 27 */
|
||||||
{
|
{
|
||||||
8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
|
8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
|
||||||
{{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
|
{{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
|
||||||
2,{0,2048, 186,46,744, 12,92,372,1500, 28,66,130, 260,520,1112,
|
2,{0,2048, 186,46,744, 12,92,372,1500, 28,66,130, 260,520,1112,
|
||||||
6,20,36,56, 78,110,158,222, 316,440,624, 928,1300,1700},
|
6,20,36,56, 78,110,158,222, 316,440,624, 928,1300,1700},
|
||||||
|
|
||||||
60,30,500, 3,18., -1 /* lowpass */
|
60,30,500, 3,18., 2048
|
||||||
},
|
},
|
||||||
/* 512 x 17 */
|
/* 9: 512 x 17 */
|
||||||
{
|
{
|
||||||
6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
|
6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
|
||||||
{{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
|
{{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
|
||||||
2,{0,512, 46,186, 16,33,65, 93,130,278,
|
2,{0,512, 46,186, 16,33,65, 93,130,278,
|
||||||
7,23,39, 55,79,110, 156,232,360},
|
7,23,39, 55,79,110, 156,232,360},
|
||||||
|
|
||||||
60,30,500, 1,18., -1 /* lowpass! */
|
60,30,500, 1,18., 512
|
||||||
|
},
|
||||||
|
|
||||||
|
/* 10: X x 0 (LFE floor; edge posts only) */
|
||||||
|
{
|
||||||
|
0,{0}, {0},{0},{-1},
|
||||||
|
{{-1}},
|
||||||
|
2,{0,12},
|
||||||
|
60,30,500, 1.,18., 10
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,25 +5,25 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: 11kHz settings
|
function: 11kHz settings
|
||||||
last mod: $Id: psych_11.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: psych_11.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
static double _psy_lowpass_11[3]={4.5,5.5,30.,};
|
static const double _psy_lowpass_11[3]={4.5,5.5,30.,};
|
||||||
|
|
||||||
static att3 _psy_tone_masteratt_11[3]={
|
static const att3 _psy_tone_masteratt_11[3]={
|
||||||
{{ 30, 25, 12}, 0, 0}, /* 0 */
|
{{ 30, 25, 12}, 0, 0}, /* 0 */
|
||||||
{{ 30, 25, 12}, 0, 0}, /* 0 */
|
{{ 30, 25, 12}, 0, 0}, /* 0 */
|
||||||
{{ 20, 0, -14}, 0, 0}, /* 0 */
|
{{ 20, 0, -14}, 0, 0}, /* 0 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static vp_adjblock _vp_tonemask_adj_11[3]={
|
static const vp_adjblock _vp_tonemask_adj_11[3]={
|
||||||
/* adjust for mode zero */
|
/* adjust for mode zero */
|
||||||
/* 63 125 250 500 1 2 4 8 16 */
|
/* 63 125 250 500 1 2 4 8 16 */
|
||||||
{{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 2, 0,99,99,99}}, /* 0 */
|
{{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 2, 0,99,99,99}}, /* 0 */
|
||||||
|
|
@ -32,7 +32,7 @@ static vp_adjblock _vp_tonemask_adj_11[3]={
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static noise3 _psy_noisebias_11[3]={
|
static const noise3 _psy_noisebias_11[3]={
|
||||||
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
||||||
{{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 10, 10, 12, 12, 12, 99, 99, 99},
|
{{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 10, 10, 12, 12, 12, 99, 99, 99},
|
||||||
{-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 4, 5, 5, 10, 99, 99, 99},
|
{-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 4, 5, 5, 10, 99, 99, 99},
|
||||||
|
|
@ -47,5 +47,5 @@ static noise3 _psy_noisebias_11[3]={
|
||||||
{-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}},
|
{-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _noise_thresh_11[3]={ .3,.5,.5 };
|
static const double _noise_thresh_11[3]={ .3,.5,.5 };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,18 +5,18 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: 16kHz settings
|
function: 16kHz settings
|
||||||
last mod: $Id: psych_16.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: psych_16.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
/* stereo mode by base quality level */
|
/* stereo mode by base quality level */
|
||||||
static adj_stereo _psy_stereo_modes_16[4]={
|
static const adj_stereo _psy_stereo_modes_16[4]={
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
|
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
|
||||||
{{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
|
{{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
|
||||||
{ 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
|
{ 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
|
||||||
|
|
@ -36,16 +36,16 @@ static adj_stereo _psy_stereo_modes_16[4]={
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _psy_lowpass_16[4]={6.5,8,30.,99.};
|
static const double _psy_lowpass_16[4]={6.5,8,30.,99.};
|
||||||
|
|
||||||
static att3 _psy_tone_masteratt_16[4]={
|
static const att3 _psy_tone_masteratt_16[4]={
|
||||||
{{ 30, 25, 12}, 0, 0}, /* 0 */
|
{{ 30, 25, 12}, 0, 0}, /* 0 */
|
||||||
{{ 25, 22, 12}, 0, 0}, /* 0 */
|
{{ 25, 22, 12}, 0, 0}, /* 0 */
|
||||||
{{ 20, 12, 0}, 0, 0}, /* 0 */
|
{{ 20, 12, 0}, 0, 0}, /* 0 */
|
||||||
{{ 15, 0, -14}, 0, 0}, /* 0 */
|
{{ 15, 0, -14}, 0, 0}, /* 0 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static vp_adjblock _vp_tonemask_adj_16[4]={
|
static const vp_adjblock _vp_tonemask_adj_16[4]={
|
||||||
/* adjust for mode zero */
|
/* adjust for mode zero */
|
||||||
/* 63 125 250 500 1 2 4 8 16 */
|
/* 63 125 250 500 1 2 4 8 16 */
|
||||||
{{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */
|
{{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */
|
||||||
|
|
@ -55,7 +55,7 @@ static vp_adjblock _vp_tonemask_adj_16[4]={
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static noise3 _psy_noisebias_16_short[4]={
|
static const noise3 _psy_noisebias_16_short[4]={
|
||||||
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
||||||
{{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
|
{{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
|
||||||
{-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15},
|
{-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15},
|
||||||
|
|
@ -74,7 +74,7 @@ static noise3 _psy_noisebias_16_short[4]={
|
||||||
{-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
|
{-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static noise3 _psy_noisebias_16_impulse[4]={
|
static const noise3 _psy_noisebias_16_impulse[4]={
|
||||||
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
||||||
{{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
|
{{{-15,-15,-15,-15,-15,-10,-10,-5, 4, 10, 10, 10, 10, 12, 12, 14, 20},
|
||||||
{-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15},
|
{-15,-15,-15,-15,-15,-10,-10, -5, 0, 0, 4, 5, 5, 6, 8, 8, 15},
|
||||||
|
|
@ -93,7 +93,7 @@ static noise3 _psy_noisebias_16_impulse[4]={
|
||||||
{-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
|
{-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static noise3 _psy_noisebias_16[4]={
|
static const noise3 _psy_noisebias_16[4]={
|
||||||
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
||||||
{{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 6, 8, 8, 10, 10, 10, 14, 20},
|
{{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 6, 8, 8, 10, 10, 10, 14, 20},
|
||||||
{-10,-10,-10,-10,-10, -5, -2, -2, 0, 0, 0, 4, 5, 6, 8, 8, 15},
|
{-10,-10,-10,-10,-10, -5, -2, -2, 0, 0, 0, 4, 5, 6, 8, 8, 15},
|
||||||
|
|
@ -112,25 +112,22 @@ static noise3 _psy_noisebias_16[4]={
|
||||||
{-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
|
{-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static noiseguard _psy_noiseguards_16[4]={
|
static const noiseguard _psy_noiseguards_16[4]={
|
||||||
{10,10,-1},
|
{10,10,-1},
|
||||||
{10,10,-1},
|
{10,10,-1},
|
||||||
{20,20,-1},
|
{20,20,-1},
|
||||||
{20,20,-1},
|
{20,20,-1},
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _noise_thresh_16[4]={ .3,.5,.5,.5 };
|
static const double _noise_thresh_16[4]={ .3,.5,.5,.5 };
|
||||||
|
|
||||||
static int _noise_start_16[3]={ 256,256,9999 };
|
static const int _noise_start_16[3]={ 256,256,9999 };
|
||||||
static int _noise_part_16[4]={ 8,8,8,8 };
|
static const int _noise_part_16[4]={ 8,8,8,8 };
|
||||||
|
|
||||||
static int _psy_ath_floater_16[4]={
|
static const int _psy_ath_floater_16[4]={
|
||||||
-100,-100,-100,-105,
|
-100,-100,-100,-105,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _psy_ath_abs_16[4]={
|
static const int _psy_ath_abs_16[4]={
|
||||||
-130,-130,-130,-140,
|
-130,-130,-130,-140,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,20 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: key psychoacoustic settings for 44.1/48kHz
|
function: key psychoacoustic settings for 44.1/48kHz
|
||||||
last mod: $Id: psych_44.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: psych_44.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
/* preecho trigger settings *****************************************/
|
/* preecho trigger settings *****************************************/
|
||||||
|
|
||||||
static vorbis_info_psy_global _psy_global_44[5]={
|
static const vorbis_info_psy_global _psy_global_44[5]={
|
||||||
|
|
||||||
{8, /* lines per eighth octave */
|
{8, /* lines per eighth octave */
|
||||||
{20.f,14.f,12.f,12.f,12.f,12.f,12.f},
|
{20.f,14.f,12.f,12.f,12.f,12.f,12.f},
|
||||||
|
|
@ -53,7 +53,7 @@ static vorbis_info_psy_global _psy_global_44[5]={
|
||||||
};
|
};
|
||||||
|
|
||||||
/* noise compander lookups * low, mid, high quality ****************/
|
/* noise compander lookups * low, mid, high quality ****************/
|
||||||
static compandblock _psy_compand_44[6]={
|
static const compandblock _psy_compand_44[6]={
|
||||||
/* sub-mode Z short */
|
/* sub-mode Z short */
|
||||||
{{
|
{{
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */
|
0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */
|
||||||
|
|
@ -106,7 +106,7 @@ static compandblock _psy_compand_44[6]={
|
||||||
|
|
||||||
/* tonal masking curve level adjustments *************************/
|
/* tonal masking curve level adjustments *************************/
|
||||||
|
|
||||||
static vp_adjblock _vp_tonemask_adj_longblock[12]={
|
static const vp_adjblock _vp_tonemask_adj_longblock[12]={
|
||||||
|
|
||||||
/* 63 125 250 500 1 2 4 8 16 */
|
/* 63 125 250 500 1 2 4 8 16 */
|
||||||
|
|
||||||
|
|
@ -146,7 +146,7 @@ static vp_adjblock _vp_tonemask_adj_longblock[12]={
|
||||||
{{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 10 */
|
{{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2, 0}}, /* 10 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static vp_adjblock _vp_tonemask_adj_otherblock[12]={
|
static const vp_adjblock _vp_tonemask_adj_otherblock[12]={
|
||||||
/* 63 125 250 500 1 2 4 8 16 */
|
/* 63 125 250 500 1 2 4 8 16 */
|
||||||
|
|
||||||
{{ -3, -8,-13,-15,-10,-10, -9, -9, -9, -9, -9, 1, 1, 1, 1, 1, 1}}, /* -1 */
|
{{ -3, -8,-13,-15,-10,-10, -9, -9, -9, -9, -9, 1, 1, 1, 1, 1, 1}}, /* -1 */
|
||||||
|
|
@ -186,7 +186,7 @@ static vp_adjblock _vp_tonemask_adj_otherblock[12]={
|
||||||
};
|
};
|
||||||
|
|
||||||
/* noise bias (transition block) */
|
/* noise bias (transition block) */
|
||||||
static noise3 _psy_noisebias_trans[12]={
|
static const noise3 _psy_noisebias_trans[12]={
|
||||||
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
||||||
/* -1 */
|
/* -1 */
|
||||||
{{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 10, 12, 14, 20},
|
{{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 10, 12, 14, 20},
|
||||||
|
|
@ -269,7 +269,7 @@ static noise3 _psy_noisebias_trans[12]={
|
||||||
};
|
};
|
||||||
|
|
||||||
/* noise bias (long block) */
|
/* noise bias (long block) */
|
||||||
static noise3 _psy_noisebias_long[12]={
|
static const noise3 _psy_noisebias_long[12]={
|
||||||
/*63 125 250 500 1k 2k 4k 8k 16k*/
|
/*63 125 250 500 1k 2k 4k 8k 16k*/
|
||||||
/* -1 */
|
/* -1 */
|
||||||
{{{-10,-10,-10,-10,-10, -4, 0, 0, 0, 6, 6, 6, 6, 10, 10, 12, 20},
|
{{{-10,-10,-10,-10,-10, -4, 0, 0, 0, 6, 6, 6, 6, 10, 10, 12, 20},
|
||||||
|
|
@ -344,7 +344,7 @@ static noise3 _psy_noisebias_long[12]={
|
||||||
};
|
};
|
||||||
|
|
||||||
/* noise bias (impulse block) */
|
/* noise bias (impulse block) */
|
||||||
static noise3 _psy_noisebias_impulse[12]={
|
static const noise3 _psy_noisebias_impulse[12]={
|
||||||
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
||||||
/* -1 */
|
/* -1 */
|
||||||
{{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 10, 12, 14, 20},
|
{{{-10,-10,-10,-10,-10, -4, 0, 0, 4, 8, 8, 8, 8, 10, 12, 14, 20},
|
||||||
|
|
@ -413,7 +413,7 @@ static noise3 _psy_noisebias_impulse[12]={
|
||||||
};
|
};
|
||||||
|
|
||||||
/* noise bias (padding block) */
|
/* noise bias (padding block) */
|
||||||
static noise3 _psy_noisebias_padding[12]={
|
static const noise3 _psy_noisebias_padding[12]={
|
||||||
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
||||||
|
|
||||||
/* -1 */
|
/* -1 */
|
||||||
|
|
@ -471,24 +471,24 @@ static noise3 _psy_noisebias_padding[12]={
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static noiseguard _psy_noiseguards_44[4]={
|
static const noiseguard _psy_noiseguards_44[4]={
|
||||||
{3,3,15},
|
{3,3,15},
|
||||||
{3,3,15},
|
{3,3,15},
|
||||||
{10,10,100},
|
{10,10,100},
|
||||||
{10,10,100},
|
{10,10,100},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _psy_tone_suppress[12]={
|
static const int _psy_tone_suppress[12]={
|
||||||
-20,-20,-20,-20,-20,-24,-30,-40,-40,-45,-45,-45,
|
-20,-20,-20,-20,-20,-24,-30,-40,-40,-45,-45,-45,
|
||||||
};
|
};
|
||||||
static int _psy_tone_0dB[12]={
|
static const int _psy_tone_0dB[12]={
|
||||||
90,90,95,95,95,95,105,105,105,105,105,105,
|
90,90,95,95,95,95,105,105,105,105,105,105,
|
||||||
};
|
};
|
||||||
static int _psy_noise_suppress[12]={
|
static const int _psy_noise_suppress[12]={
|
||||||
-20,-20,-24,-24,-24,-24,-30,-40,-40,-45,-45,-45,
|
-20,-20,-24,-24,-24,-24,-30,-40,-40,-45,-45,-45,
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_info_psy _psy_info_template={
|
static const vorbis_info_psy _psy_info_template={
|
||||||
/* blockflag */
|
/* blockflag */
|
||||||
-1,
|
-1,
|
||||||
/* ath_adjatt, ath_maxatt */
|
/* ath_adjatt, ath_maxatt */
|
||||||
|
|
@ -500,16 +500,16 @@ static vorbis_info_psy _psy_info_template={
|
||||||
1, -0.f, .5f, .5f, 0,0,0,
|
1, -0.f, .5f, .5f, 0,0,0,
|
||||||
/* noiseoffset*3, noisecompand, max_curve_dB */
|
/* noiseoffset*3, noisecompand, max_curve_dB */
|
||||||
{{-1},{-1},{-1}},{-1},105.f,
|
{{-1},{-1},{-1}},{-1},105.f,
|
||||||
/* noise normalization - channel_p, point_p, start, partition, thresh. */
|
/* noise normalization - noise_p, start, partition, thresh. */
|
||||||
0,0,-1,-1,0.,
|
0,-1,-1,0.,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ath ****************/
|
/* ath ****************/
|
||||||
|
|
||||||
static int _psy_ath_floater[12]={
|
static const int _psy_ath_floater[12]={
|
||||||
-100,-100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120,
|
-100,-100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120,
|
||||||
};
|
};
|
||||||
static int _psy_ath_abs[12]={
|
static const int _psy_ath_abs[12]={
|
||||||
-130,-130,-130,-130,-140,-140,-140,-140,-140,-140,-140,-150,
|
-130,-130,-130,-130,-140,-140,-140,-140,-140,-140,-140,-150,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -522,7 +522,7 @@ static int _psy_ath_abs[12]={
|
||||||
/* various stereo possibilities */
|
/* various stereo possibilities */
|
||||||
|
|
||||||
/* stereo mode by base quality level */
|
/* stereo mode by base quality level */
|
||||||
static adj_stereo _psy_stereo_modes_44[12]={
|
static const adj_stereo _psy_stereo_modes_44[12]={
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -1 */
|
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -1 */
|
||||||
{{ 4, 4, 4, 4, 4, 4, 4, 3, 2, 2, 1, 0, 0, 0, 0},
|
{{ 4, 4, 4, 4, 4, 4, 4, 3, 2, 2, 1, 0, 0, 0, 0},
|
||||||
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 4, 3},
|
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 4, 3},
|
||||||
|
|
@ -530,10 +530,6 @@ static adj_stereo _psy_stereo_modes_44[12]={
|
||||||
{ 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}},
|
{ 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}},
|
||||||
|
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 */
|
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 */
|
||||||
/*{{ 4, 4, 4, 4, 4, 4, 4, 3, 2, 2, 1, 0, 0, 0, 0},
|
|
||||||
{ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 4, 3},
|
|
||||||
{ 1, 2, 3, 4, 5, 5, 6, 6, 6, 6, 6, 7, 8, 8, 8},
|
|
||||||
{ 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}},*/
|
|
||||||
{{ 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 0, 0, 0, 0, 0},
|
{{ 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 0, 0, 0, 0, 0},
|
||||||
{ 8, 8, 8, 8, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4, 3},
|
{ 8, 8, 8, 8, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4, 3},
|
||||||
{ 1, 2, 3, 4, 4, 5, 6, 6, 6, 6, 6, 8, 8, 8, 8},
|
{ 1, 2, 3, 4, 4, 5, 6, 6, 6, 6, 6, 8, 8, 8, 8},
|
||||||
|
|
@ -548,10 +544,6 @@ static adj_stereo _psy_stereo_modes_44[12]={
|
||||||
|
|
||||||
|
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 */
|
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 */
|
||||||
/* {{ 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 0, 0, 0, 0, 0},
|
|
||||||
{ 8, 8, 8, 6, 5, 5, 5, 5, 5, 5, 5, 4, 3, 2, 1},
|
|
||||||
{ 3, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8},
|
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */
|
|
||||||
{{ 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 0, 0, 0, 0, 0},
|
{{ 3, 3, 3, 3, 3, 3, 3, 2, 1, 1, 0, 0, 0, 0, 0},
|
||||||
{ 8, 8, 6, 6, 5, 5, 4, 4, 4, 4, 4, 4, 3, 2, 1},
|
{ 8, 8, 6, 6, 5, 5, 4, 4, 4, 4, 4, 4, 3, 2, 1},
|
||||||
{ 3, 4, 4, 5, 5, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8},
|
{ 3, 4, 4, 5, 5, 6, 6, 6, 6, 6, 6, 8, 8, 8, 8},
|
||||||
|
|
@ -567,37 +559,21 @@ static adj_stereo _psy_stereo_modes_44[12]={
|
||||||
{ 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10},
|
{ 6, 6, 6, 8, 8, 8, 8, 8, 8, 8, 10, 10, 10, 10, 10},
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 */
|
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 */
|
||||||
/* {{ 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0},
|
|
||||||
{ 6, 6, 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10},
|
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
|
|
||||||
{{ 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{{ 2, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{ 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0},
|
{ 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0},
|
||||||
{ 6, 7, 8, 8, 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12},
|
{ 6, 7, 8, 8, 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12},
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 */
|
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 6 */
|
||||||
/* {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 3, 3, 3, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
|
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */
|
|
||||||
{{ 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},
|
||||||
{ 3, 3, 3, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{ 3, 3, 3, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{ 8, 8, 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
|
{ 8, 8, 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 7 */
|
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 7 */
|
||||||
/* {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 3, 3, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 8, 8, 8, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
|
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
|
|
||||||
{{ 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},
|
||||||
{ 3, 3, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{ 3, 3, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{ 8, 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
|
{ 8, 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 */
|
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 8 */
|
||||||
/* {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
|
||||||
{ 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
|
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
|
|
||||||
{{ 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},
|
||||||
{ 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
{ 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||||
{ 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
|
{ 8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
|
||||||
|
|
@ -615,7 +591,7 @@ static adj_stereo _psy_stereo_modes_44[12]={
|
||||||
};
|
};
|
||||||
|
|
||||||
/* tone master attenuation by base quality mode and bitrate tweak */
|
/* tone master attenuation by base quality mode and bitrate tweak */
|
||||||
static att3 _psy_tone_masteratt_44[12]={
|
static const att3 _psy_tone_masteratt_44[12]={
|
||||||
{{ 35, 21, 9}, 0, 0}, /* -1 */
|
{{ 35, 21, 9}, 0, 0}, /* -1 */
|
||||||
{{ 30, 20, 8}, -2, 1.25}, /* 0 */
|
{{ 30, 20, 8}, -2, 1.25}, /* 0 */
|
||||||
/* {{ 25, 14, 4}, 0, 0}, *//* 1 */
|
/* {{ 25, 14, 4}, 0, 0}, *//* 1 */
|
||||||
|
|
@ -633,34 +609,34 @@ static att3 _psy_tone_masteratt_44[12]={
|
||||||
};
|
};
|
||||||
|
|
||||||
/* lowpass by mode **************/
|
/* lowpass by mode **************/
|
||||||
static double _psy_lowpass_44[12]={
|
static const double _psy_lowpass_44[12]={
|
||||||
/* 15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999. */
|
/* 15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999. */
|
||||||
13.9,15.1,15.8,16.5,17.2,18.9,20.1,48.,999.,999.,999.,999.
|
13.9,15.1,15.8,16.5,17.2,18.9,20.1,48.,999.,999.,999.,999.
|
||||||
};
|
};
|
||||||
|
|
||||||
/* noise normalization **********/
|
/* noise normalization **********/
|
||||||
|
|
||||||
static int _noise_start_short_44[11]={
|
static const int _noise_start_short_44[11]={
|
||||||
/* 16,16,16,16,32,32,9999,9999,9999,9999 */
|
/* 16,16,16,16,32,32,9999,9999,9999,9999 */
|
||||||
32,16,16,16,32,9999,9999,9999,9999,9999,9999
|
32,16,16,16,32,9999,9999,9999,9999,9999,9999
|
||||||
};
|
};
|
||||||
static int _noise_start_long_44[11]={
|
static const int _noise_start_long_44[11]={
|
||||||
/* 128,128,128,256,512,512,9999,9999,9999,9999 */
|
/* 128,128,128,256,512,512,9999,9999,9999,9999 */
|
||||||
256,128,128,256,512,9999,9999,9999,9999,9999,9999
|
256,128,128,256,512,9999,9999,9999,9999,9999,9999
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _noise_part_short_44[11]={
|
static const int _noise_part_short_44[11]={
|
||||||
8,8,8,8,8,8,8,8,8,8,8
|
8,8,8,8,8,8,8,8,8,8,8
|
||||||
};
|
};
|
||||||
static int _noise_part_long_44[11]={
|
static const int _noise_part_long_44[11]={
|
||||||
32,32,32,32,32,32,32,32,32,32,32
|
32,32,32,32,32,32,32,32,32,32,32
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _noise_thresh_44[11]={
|
static const double _noise_thresh_44[11]={
|
||||||
/* .2,.2,.3,.4,.5,.5,9999.,9999.,9999.,9999., */
|
/* .2,.2,.3,.4,.5,.5,9999.,9999.,9999.,9999., */
|
||||||
.2,.2,.2,.4,.6,9999.,9999.,9999.,9999.,9999.,9999.,
|
.2,.2,.2,.4,.6,9999.,9999.,9999.,9999.,9999.,9999.,
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _noise_thresh_5only[2]={
|
static const double _noise_thresh_5only[2]={
|
||||||
.5,.5,
|
.5,.5,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,23 +5,23 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: 8kHz psychoacoustic settings
|
function: 8kHz psychoacoustic settings
|
||||||
last mod: $Id: psych_8.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: psych_8.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
static att3 _psy_tone_masteratt_8[3]={
|
static const att3 _psy_tone_masteratt_8[3]={
|
||||||
{{ 32, 25, 12}, 0, 0}, /* 0 */
|
{{ 32, 25, 12}, 0, 0}, /* 0 */
|
||||||
{{ 30, 25, 12}, 0, 0}, /* 0 */
|
{{ 30, 25, 12}, 0, 0}, /* 0 */
|
||||||
{{ 20, 0, -14}, 0, 0}, /* 0 */
|
{{ 20, 0, -14}, 0, 0}, /* 0 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static vp_adjblock _vp_tonemask_adj_8[3]={
|
static const vp_adjblock _vp_tonemask_adj_8[3]={
|
||||||
/* adjust for mode zero */
|
/* adjust for mode zero */
|
||||||
/* 63 125 250 500 1 2 4 8 16 */
|
/* 63 125 250 500 1 2 4 8 16 */
|
||||||
{{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* 1 */
|
{{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* 1 */
|
||||||
|
|
@ -30,7 +30,7 @@ static vp_adjblock _vp_tonemask_adj_8[3]={
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static noise3 _psy_noisebias_8[3]={
|
static const noise3 _psy_noisebias_8[3]={
|
||||||
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
/* 63 125 250 500 1k 2k 4k 8k 16k*/
|
||||||
{{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 8, 8, 8, 10, 10, 99, 99, 99},
|
{{{-10,-10,-10,-10, -5, -5, -5, 0, 4, 8, 8, 8, 10, 10, 99, 99, 99},
|
||||||
{-10,-10,-10,-10, -5, -5, -5, 0, 0, 4, 4, 4, 4, 4, 99, 99, 99},
|
{-10,-10,-10,-10, -5, -5, -5, 0, 0, 4, 4, 4, 4, 4, 99, 99, 99},
|
||||||
|
|
@ -46,7 +46,7 @@ static noise3 _psy_noisebias_8[3]={
|
||||||
};
|
};
|
||||||
|
|
||||||
/* stereo mode by base quality level */
|
/* stereo mode by base quality level */
|
||||||
static adj_stereo _psy_stereo_modes_8[3]={
|
static const adj_stereo _psy_stereo_modes_8[3]={
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
|
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
|
||||||
{{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
|
{{ 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3},
|
||||||
{ 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
|
{ 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
|
||||||
|
|
@ -62,12 +62,12 @@ static adj_stereo _psy_stereo_modes_8[3]={
|
||||||
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
{ 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static noiseguard _psy_noiseguards_8[2]={
|
static const noiseguard _psy_noiseguards_8[2]={
|
||||||
{10,10,-1},
|
{10,10,-1},
|
||||||
{10,10,-1},
|
{10,10,-1},
|
||||||
};
|
};
|
||||||
|
|
||||||
static compandblock _psy_compand_8[2]={
|
static const compandblock _psy_compand_8[2]={
|
||||||
{{
|
{{
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */
|
0, 1, 2, 3, 4, 5, 6, 7, /* 7dB */
|
||||||
8, 8, 9, 9,10,10,11, 11, /* 15dB */
|
8, 8, 9, 9,10,10,11, 11, /* 15dB */
|
||||||
|
|
@ -84,19 +84,18 @@ static compandblock _psy_compand_8[2]={
|
||||||
}},
|
}},
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _psy_lowpass_8[3]={3.,4.,4.};
|
static const double _psy_lowpass_8[3]={3.,4.,4.};
|
||||||
static int _noise_start_8[2]={
|
static const int _noise_start_8[2]={
|
||||||
64,64,
|
64,64,
|
||||||
};
|
};
|
||||||
static int _noise_part_8[2]={
|
static const int _noise_part_8[2]={
|
||||||
8,8,
|
8,8,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _psy_ath_floater_8[3]={
|
static const int _psy_ath_floater_8[3]={
|
||||||
-100,-100,-105,
|
-100,-100,-105,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _psy_ath_abs_8[3]={
|
static const int _psy_ath_abs_8[3]={
|
||||||
-130,-130,-140,
|
-130,-130,-140,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
/********************************************************************
|
/********************************************************************
|
||||||
* *
|
* *
|
||||||
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
* This FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: toplevel residue templates 16/22kHz
|
function: toplevel residue templates 16/22kHz
|
||||||
last mod: $Id: residue_16.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: residue_16.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
/***** residue backends *********************************************/
|
/***** residue backends *********************************************/
|
||||||
|
|
||||||
static static_bookblock _resbook_16s_0={
|
static const static_bookblock _resbook_16s_0={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_16c0_s_p1_0},
|
{0,0,&_16c0_s_p1_0},
|
||||||
|
|
@ -31,7 +31,7 @@ static static_bookblock _resbook_16s_0={
|
||||||
{&_16c0_s_p9_0,&_16c0_s_p9_1,&_16c0_s_p9_2}
|
{&_16c0_s_p9_0,&_16c0_s_p9_1,&_16c0_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_16s_1={
|
static const static_bookblock _resbook_16s_1={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_16c1_s_p1_0},
|
{0,0,&_16c1_s_p1_0},
|
||||||
|
|
@ -45,7 +45,7 @@ static static_bookblock _resbook_16s_1={
|
||||||
{&_16c1_s_p9_0,&_16c1_s_p9_1,&_16c1_s_p9_2}
|
{&_16c1_s_p9_0,&_16c1_s_p9_1,&_16c1_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_16s_2={
|
static const static_bookblock _resbook_16s_2={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_16c2_s_p1_0},
|
{0,0,&_16c2_s_p1_0},
|
||||||
|
|
@ -60,37 +60,37 @@ static static_bookblock _resbook_16s_2={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_16s_0[]={
|
static const vorbis_residue_template _res_16s_0[]={
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,32, &_residue_44_mid,
|
||||||
&_huff_book__16c0_s_single,&_huff_book__16c0_s_single,
|
&_huff_book__16c0_s_single,&_huff_book__16c0_s_single,
|
||||||
&_resbook_16s_0,&_resbook_16s_0},
|
&_resbook_16s_0,&_resbook_16s_0},
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_16s_1[]={
|
static const vorbis_residue_template _res_16s_1[]={
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,32, &_residue_44_mid,
|
||||||
&_huff_book__16c1_s_short,&_huff_book__16c1_s_short,
|
&_huff_book__16c1_s_short,&_huff_book__16c1_s_short,
|
||||||
&_resbook_16s_1,&_resbook_16s_1},
|
&_resbook_16s_1,&_resbook_16s_1},
|
||||||
|
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,32, &_residue_44_mid,
|
||||||
&_huff_book__16c1_s_long,&_huff_book__16c1_s_long,
|
&_huff_book__16c1_s_long,&_huff_book__16c1_s_long,
|
||||||
&_resbook_16s_1,&_resbook_16s_1}
|
&_resbook_16s_1,&_resbook_16s_1}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_16s_2[]={
|
static const vorbis_residue_template _res_16s_2[]={
|
||||||
{2,0, &_residue_44_high,
|
{2,0,32, &_residue_44_high,
|
||||||
&_huff_book__16c2_s_short,&_huff_book__16c2_s_short,
|
&_huff_book__16c2_s_short,&_huff_book__16c2_s_short,
|
||||||
&_resbook_16s_2,&_resbook_16s_2},
|
&_resbook_16s_2,&_resbook_16s_2},
|
||||||
|
|
||||||
{2,0, &_residue_44_high,
|
{2,0,32, &_residue_44_high,
|
||||||
&_huff_book__16c2_s_long,&_huff_book__16c2_s_long,
|
&_huff_book__16c2_s_long,&_huff_book__16c2_s_long,
|
||||||
&_resbook_16s_2,&_resbook_16s_2}
|
&_resbook_16s_2,&_resbook_16s_2}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_mapping_template _mapres_template_16_stereo[3]={
|
static const vorbis_mapping_template _mapres_template_16_stereo[3]={
|
||||||
{ _map_nominal, _res_16s_0 }, /* 0 */
|
{ _map_nominal, _res_16s_0 }, /* 0 */
|
||||||
{ _map_nominal, _res_16s_1 }, /* 1 */
|
{ _map_nominal, _res_16s_1 }, /* 1 */
|
||||||
{ _map_nominal, _res_16s_2 }, /* 2 */
|
{ _map_nominal, _res_16s_2 }, /* 2 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static static_bookblock _resbook_16u_0={
|
static const static_bookblock _resbook_16u_0={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_16u0__p1_0},
|
{0,0,&_16u0__p1_0},
|
||||||
|
|
@ -102,7 +102,7 @@ static static_bookblock _resbook_16u_0={
|
||||||
{&_16u0__p7_0,&_16u0__p7_1,&_16u0__p7_2}
|
{&_16u0__p7_0,&_16u0__p7_1,&_16u0__p7_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_16u_1={
|
static const static_bookblock _resbook_16u_1={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_16u1__p1_0},
|
{0,0,&_16u1__p1_0},
|
||||||
|
|
@ -116,7 +116,7 @@ static static_bookblock _resbook_16u_1={
|
||||||
{&_16u1__p9_0,&_16u1__p9_1,&_16u1__p9_2}
|
{&_16u1__p9_0,&_16u1__p9_1,&_16u1__p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_16u_2={
|
static const static_bookblock _resbook_16u_2={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_16u2_p1_0},
|
{0,0,&_16u2_p1_0},
|
||||||
|
|
@ -131,32 +131,32 @@ static static_bookblock _resbook_16u_2={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_16u_0[]={
|
static const vorbis_residue_template _res_16u_0[]={
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,32, &_residue_44_low_un,
|
||||||
&_huff_book__16u0__single,&_huff_book__16u0__single,
|
&_huff_book__16u0__single,&_huff_book__16u0__single,
|
||||||
&_resbook_16u_0,&_resbook_16u_0},
|
&_resbook_16u_0,&_resbook_16u_0},
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_16u_1[]={
|
static const vorbis_residue_template _res_16u_1[]={
|
||||||
{1,0, &_residue_44_mid_un,
|
{1,0,32, &_residue_44_mid_un,
|
||||||
&_huff_book__16u1__short,&_huff_book__16u1__short,
|
&_huff_book__16u1__short,&_huff_book__16u1__short,
|
||||||
&_resbook_16u_1,&_resbook_16u_1},
|
&_resbook_16u_1,&_resbook_16u_1},
|
||||||
|
|
||||||
{1,0, &_residue_44_mid_un,
|
{1,0,32, &_residue_44_mid_un,
|
||||||
&_huff_book__16u1__long,&_huff_book__16u1__long,
|
&_huff_book__16u1__long,&_huff_book__16u1__long,
|
||||||
&_resbook_16u_1,&_resbook_16u_1}
|
&_resbook_16u_1,&_resbook_16u_1}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_16u_2[]={
|
static const vorbis_residue_template _res_16u_2[]={
|
||||||
{1,0, &_residue_44_hi_un,
|
{1,0,32, &_residue_44_hi_un,
|
||||||
&_huff_book__16u2__short,&_huff_book__16u2__short,
|
&_huff_book__16u2__short,&_huff_book__16u2__short,
|
||||||
&_resbook_16u_2,&_resbook_16u_2},
|
&_resbook_16u_2,&_resbook_16u_2},
|
||||||
|
|
||||||
{1,0, &_residue_44_hi_un,
|
{1,0,32, &_residue_44_hi_un,
|
||||||
&_huff_book__16u2__long,&_huff_book__16u2__long,
|
&_huff_book__16u2__long,&_huff_book__16u2__long,
|
||||||
&_resbook_16u_2,&_resbook_16u_2}
|
&_resbook_16u_2,&_resbook_16u_2}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static vorbis_mapping_template _mapres_template_16_uncoupled[3]={
|
static const vorbis_mapping_template _mapres_template_16_uncoupled[3]={
|
||||||
{ _map_nominal_u, _res_16u_0 }, /* 0 */
|
{ _map_nominal_u, _res_16u_0 }, /* 0 */
|
||||||
{ _map_nominal_u, _res_16u_1 }, /* 1 */
|
{ _map_nominal_u, _res_16u_1 }, /* 1 */
|
||||||
{ _map_nominal_u, _res_16u_2 }, /* 2 */
|
{ _map_nominal_u, _res_16u_2 }, /* 2 */
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: toplevel residue templates for 32/44.1/48kHz
|
function: toplevel residue templates for 32/44.1/48kHz
|
||||||
last mod: $Id: residue_44.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: residue_44.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -21,34 +21,34 @@
|
||||||
|
|
||||||
/***** residue backends *********************************************/
|
/***** residue backends *********************************************/
|
||||||
|
|
||||||
static vorbis_info_residue0 _residue_44_low={
|
static const vorbis_info_residue0 _residue_44_low={
|
||||||
0,-1, -1, 9,-1,
|
0,-1, -1, 9,-1,-1,
|
||||||
/* 0 1 2 3 4 5 6 7 */
|
/* 0 1 2 3 4 5 6 7 */
|
||||||
{0},
|
{0},
|
||||||
{-1},
|
{-1},
|
||||||
{ .5, 1.5, 2.5, 2.5, 4.5, 8.5, 16.5, 32.5},
|
{ 0, 1, 2, 2, 4, 8, 16, 32},
|
||||||
{ .5, .5, .5, 999., 4.5, 8.5, 16.5, 32.5},
|
{ 0, 0, 0,999, 4, 8, 16, 32},
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_info_residue0 _residue_44_mid={
|
static const vorbis_info_residue0 _residue_44_mid={
|
||||||
0,-1, -1, 10,-1,
|
0,-1, -1, 10,-1,-1,
|
||||||
/* 0 1 2 3 4 5 6 7 8 */
|
/* 0 1 2 3 4 5 6 7 8 */
|
||||||
{0},
|
{0},
|
||||||
{-1},
|
{-1},
|
||||||
{ .5, 1.5, 1.5, 2.5, 2.5, 4.5, 8.5, 16.5, 32.5},
|
{ 0, 1, 1, 2, 2, 4, 8, 16, 32},
|
||||||
{ .5, .5, 999., .5, 999., 4.5, 8.5, 16.5, 32.5},
|
{ 0, 0,999, 0,999, 4, 8, 16, 32},
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_info_residue0 _residue_44_high={
|
static const vorbis_info_residue0 _residue_44_high={
|
||||||
0,-1, -1, 10,-1,
|
0,-1, -1, 10,-1,-1,
|
||||||
/* 0 1 2 3 4 5 6 7 8 */
|
/* 0 1 2 3 4 5 6 7 8 */
|
||||||
{0},
|
{0},
|
||||||
{-1},
|
{-1},
|
||||||
{ .5, 1.5, 2.5, 4.5, 8.5, 16.5, 32.5, 71.5,157.5},
|
{ 0, 1, 2, 4, 8, 16, 32, 71,157},
|
||||||
{ .5, 1.5, 2.5, 3.5, 4.5, 8.5, 16.5, 71.5,157.5},
|
{ 0, 1, 2, 3, 4, 8, 16, 71,157},
|
||||||
};
|
};
|
||||||
|
|
||||||
static static_bookblock _resbook_44s_n1={
|
static const static_bookblock _resbook_44s_n1={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44cn1_s_p1_0},{0,0,&_44cn1_s_p2_0},
|
{0},{0,0,&_44cn1_s_p1_0},{0,0,&_44cn1_s_p2_0},
|
||||||
{0,0,&_44cn1_s_p3_0},{0,0,&_44cn1_s_p4_0},{0,0,&_44cn1_s_p5_0},
|
{0,0,&_44cn1_s_p3_0},{0,0,&_44cn1_s_p4_0},{0,0,&_44cn1_s_p5_0},
|
||||||
|
|
@ -56,7 +56,7 @@ static static_bookblock _resbook_44s_n1={
|
||||||
{&_44cn1_s_p8_0,&_44cn1_s_p8_1,&_44cn1_s_p8_2}
|
{&_44cn1_s_p8_0,&_44cn1_s_p8_1,&_44cn1_s_p8_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44sm_n1={
|
static const static_bookblock _resbook_44sm_n1={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44cn1_sm_p1_0},{0,0,&_44cn1_sm_p2_0},
|
{0},{0,0,&_44cn1_sm_p1_0},{0,0,&_44cn1_sm_p2_0},
|
||||||
{0,0,&_44cn1_sm_p3_0},{0,0,&_44cn1_sm_p4_0},{0,0,&_44cn1_sm_p5_0},
|
{0,0,&_44cn1_sm_p3_0},{0,0,&_44cn1_sm_p4_0},{0,0,&_44cn1_sm_p5_0},
|
||||||
|
|
@ -65,7 +65,7 @@ static static_bookblock _resbook_44sm_n1={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static static_bookblock _resbook_44s_0={
|
static const static_bookblock _resbook_44s_0={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0},
|
{0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0},
|
||||||
{0,0,&_44c0_s_p3_0},{0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0},
|
{0,0,&_44c0_s_p3_0},{0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0},
|
||||||
|
|
@ -73,7 +73,7 @@ static static_bookblock _resbook_44s_0={
|
||||||
{&_44c0_s_p8_0,&_44c0_s_p8_1,&_44c0_s_p8_2}
|
{&_44c0_s_p8_0,&_44c0_s_p8_1,&_44c0_s_p8_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44sm_0={
|
static const static_bookblock _resbook_44sm_0={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0},
|
{0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0},
|
||||||
{0,0,&_44c0_sm_p3_0},{0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0},
|
{0,0,&_44c0_sm_p3_0},{0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0},
|
||||||
|
|
@ -82,7 +82,7 @@ static static_bookblock _resbook_44sm_0={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static static_bookblock _resbook_44s_1={
|
static const static_bookblock _resbook_44s_1={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0},
|
{0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0},
|
||||||
{0,0,&_44c1_s_p3_0},{0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0},
|
{0,0,&_44c1_s_p3_0},{0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0},
|
||||||
|
|
@ -90,7 +90,7 @@ static static_bookblock _resbook_44s_1={
|
||||||
{&_44c1_s_p8_0,&_44c1_s_p8_1,&_44c1_s_p8_2}
|
{&_44c1_s_p8_0,&_44c1_s_p8_1,&_44c1_s_p8_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44sm_1={
|
static const static_bookblock _resbook_44sm_1={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0},
|
{0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0},
|
||||||
{0,0,&_44c1_sm_p3_0},{0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0},
|
{0,0,&_44c1_sm_p3_0},{0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0},
|
||||||
|
|
@ -99,7 +99,7 @@ static static_bookblock _resbook_44sm_1={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static static_bookblock _resbook_44s_2={
|
static const static_bookblock _resbook_44s_2={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0},
|
{0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0},
|
||||||
{0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0},
|
{0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0},
|
||||||
|
|
@ -107,7 +107,7 @@ static static_bookblock _resbook_44s_2={
|
||||||
{&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2}
|
{&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44s_3={
|
static const static_bookblock _resbook_44s_3={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0},
|
{0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0},
|
||||||
{0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0},
|
{0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0},
|
||||||
|
|
@ -115,7 +115,7 @@ static static_bookblock _resbook_44s_3={
|
||||||
{&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2}
|
{&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44s_4={
|
static const static_bookblock _resbook_44s_4={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0},
|
{0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0},
|
||||||
{0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0},
|
{0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0},
|
||||||
|
|
@ -123,7 +123,7 @@ static static_bookblock _resbook_44s_4={
|
||||||
{&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2}
|
{&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44s_5={
|
static const static_bookblock _resbook_44s_5={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0},
|
{0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0},
|
||||||
{0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0},
|
{0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0},
|
||||||
|
|
@ -131,7 +131,7 @@ static static_bookblock _resbook_44s_5={
|
||||||
{&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2}
|
{&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44s_6={
|
static const static_bookblock _resbook_44s_6={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0},
|
{0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0},
|
||||||
{0,0,&_44c6_s_p4_0},
|
{0,0,&_44c6_s_p4_0},
|
||||||
|
|
@ -142,7 +142,7 @@ static static_bookblock _resbook_44s_6={
|
||||||
{&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2}
|
{&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44s_7={
|
static const static_bookblock _resbook_44s_7={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0},
|
{0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0},
|
||||||
{0,0,&_44c7_s_p4_0},
|
{0,0,&_44c7_s_p4_0},
|
||||||
|
|
@ -153,7 +153,7 @@ static static_bookblock _resbook_44s_7={
|
||||||
{&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2}
|
{&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44s_8={
|
static const static_bookblock _resbook_44s_8={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0},
|
{0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0},
|
||||||
{0,0,&_44c8_s_p4_0},
|
{0,0,&_44c8_s_p4_0},
|
||||||
|
|
@ -164,7 +164,7 @@ static static_bookblock _resbook_44s_8={
|
||||||
{&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2}
|
{&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44s_9={
|
static const static_bookblock _resbook_44s_9={
|
||||||
{
|
{
|
||||||
{0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0},
|
{0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0},
|
||||||
{0,0,&_44c9_s_p4_0},
|
{0,0,&_44c9_s_p4_0},
|
||||||
|
|
@ -176,108 +176,108 @@ static static_bookblock _resbook_44s_9={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_44s_n1[]={
|
static const vorbis_residue_template _res_44s_n1[]={
|
||||||
{2,0, &_residue_44_low,
|
{2,0,32, &_residue_44_low,
|
||||||
&_huff_book__44cn1_s_short,&_huff_book__44cn1_sm_short,
|
&_huff_book__44cn1_s_short,&_huff_book__44cn1_sm_short,
|
||||||
&_resbook_44s_n1,&_resbook_44sm_n1},
|
&_resbook_44s_n1,&_resbook_44sm_n1},
|
||||||
|
|
||||||
{2,0, &_residue_44_low,
|
{2,0,32, &_residue_44_low,
|
||||||
&_huff_book__44cn1_s_long,&_huff_book__44cn1_sm_long,
|
&_huff_book__44cn1_s_long,&_huff_book__44cn1_sm_long,
|
||||||
&_resbook_44s_n1,&_resbook_44sm_n1}
|
&_resbook_44s_n1,&_resbook_44sm_n1}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44s_0[]={
|
static const vorbis_residue_template _res_44s_0[]={
|
||||||
{2,0, &_residue_44_low,
|
{2,0,16, &_residue_44_low,
|
||||||
&_huff_book__44c0_s_short,&_huff_book__44c0_sm_short,
|
&_huff_book__44c0_s_short,&_huff_book__44c0_sm_short,
|
||||||
&_resbook_44s_0,&_resbook_44sm_0},
|
&_resbook_44s_0,&_resbook_44sm_0},
|
||||||
|
|
||||||
{2,0, &_residue_44_low,
|
{2,0,32, &_residue_44_low,
|
||||||
&_huff_book__44c0_s_long,&_huff_book__44c0_sm_long,
|
&_huff_book__44c0_s_long,&_huff_book__44c0_sm_long,
|
||||||
&_resbook_44s_0,&_resbook_44sm_0}
|
&_resbook_44s_0,&_resbook_44sm_0}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44s_1[]={
|
static const vorbis_residue_template _res_44s_1[]={
|
||||||
{2,0, &_residue_44_low,
|
{2,0,16, &_residue_44_low,
|
||||||
&_huff_book__44c1_s_short,&_huff_book__44c1_sm_short,
|
&_huff_book__44c1_s_short,&_huff_book__44c1_sm_short,
|
||||||
&_resbook_44s_1,&_resbook_44sm_1},
|
&_resbook_44s_1,&_resbook_44sm_1},
|
||||||
|
|
||||||
{2,0, &_residue_44_low,
|
{2,0,32, &_residue_44_low,
|
||||||
&_huff_book__44c1_s_long,&_huff_book__44c1_sm_long,
|
&_huff_book__44c1_s_long,&_huff_book__44c1_sm_long,
|
||||||
&_resbook_44s_1,&_resbook_44sm_1}
|
&_resbook_44s_1,&_resbook_44sm_1}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_44s_2[]={
|
static const vorbis_residue_template _res_44s_2[]={
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,16, &_residue_44_mid,
|
||||||
&_huff_book__44c2_s_short,&_huff_book__44c2_s_short,
|
&_huff_book__44c2_s_short,&_huff_book__44c2_s_short,
|
||||||
&_resbook_44s_2,&_resbook_44s_2},
|
&_resbook_44s_2,&_resbook_44s_2},
|
||||||
|
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,32, &_residue_44_mid,
|
||||||
&_huff_book__44c2_s_long,&_huff_book__44c2_s_long,
|
&_huff_book__44c2_s_long,&_huff_book__44c2_s_long,
|
||||||
&_resbook_44s_2,&_resbook_44s_2}
|
&_resbook_44s_2,&_resbook_44s_2}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44s_3[]={
|
static const vorbis_residue_template _res_44s_3[]={
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,16, &_residue_44_mid,
|
||||||
&_huff_book__44c3_s_short,&_huff_book__44c3_s_short,
|
&_huff_book__44c3_s_short,&_huff_book__44c3_s_short,
|
||||||
&_resbook_44s_3,&_resbook_44s_3},
|
&_resbook_44s_3,&_resbook_44s_3},
|
||||||
|
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,32, &_residue_44_mid,
|
||||||
&_huff_book__44c3_s_long,&_huff_book__44c3_s_long,
|
&_huff_book__44c3_s_long,&_huff_book__44c3_s_long,
|
||||||
&_resbook_44s_3,&_resbook_44s_3}
|
&_resbook_44s_3,&_resbook_44s_3}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44s_4[]={
|
static const vorbis_residue_template _res_44s_4[]={
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,16, &_residue_44_mid,
|
||||||
&_huff_book__44c4_s_short,&_huff_book__44c4_s_short,
|
&_huff_book__44c4_s_short,&_huff_book__44c4_s_short,
|
||||||
&_resbook_44s_4,&_resbook_44s_4},
|
&_resbook_44s_4,&_resbook_44s_4},
|
||||||
|
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,32, &_residue_44_mid,
|
||||||
&_huff_book__44c4_s_long,&_huff_book__44c4_s_long,
|
&_huff_book__44c4_s_long,&_huff_book__44c4_s_long,
|
||||||
&_resbook_44s_4,&_resbook_44s_4}
|
&_resbook_44s_4,&_resbook_44s_4}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44s_5[]={
|
static const vorbis_residue_template _res_44s_5[]={
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,16, &_residue_44_mid,
|
||||||
&_huff_book__44c5_s_short,&_huff_book__44c5_s_short,
|
&_huff_book__44c5_s_short,&_huff_book__44c5_s_short,
|
||||||
&_resbook_44s_5,&_resbook_44s_5},
|
&_resbook_44s_5,&_resbook_44s_5},
|
||||||
|
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,32, &_residue_44_mid,
|
||||||
&_huff_book__44c5_s_long,&_huff_book__44c5_s_long,
|
&_huff_book__44c5_s_long,&_huff_book__44c5_s_long,
|
||||||
&_resbook_44s_5,&_resbook_44s_5}
|
&_resbook_44s_5,&_resbook_44s_5}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44s_6[]={
|
static const vorbis_residue_template _res_44s_6[]={
|
||||||
{2,0, &_residue_44_high,
|
{2,0,16, &_residue_44_high,
|
||||||
&_huff_book__44c6_s_short,&_huff_book__44c6_s_short,
|
&_huff_book__44c6_s_short,&_huff_book__44c6_s_short,
|
||||||
&_resbook_44s_6,&_resbook_44s_6},
|
&_resbook_44s_6,&_resbook_44s_6},
|
||||||
|
|
||||||
{2,0, &_residue_44_high,
|
{2,0,32, &_residue_44_high,
|
||||||
&_huff_book__44c6_s_long,&_huff_book__44c6_s_long,
|
&_huff_book__44c6_s_long,&_huff_book__44c6_s_long,
|
||||||
&_resbook_44s_6,&_resbook_44s_6}
|
&_resbook_44s_6,&_resbook_44s_6}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44s_7[]={
|
static const vorbis_residue_template _res_44s_7[]={
|
||||||
{2,0, &_residue_44_high,
|
{2,0,16, &_residue_44_high,
|
||||||
&_huff_book__44c7_s_short,&_huff_book__44c7_s_short,
|
&_huff_book__44c7_s_short,&_huff_book__44c7_s_short,
|
||||||
&_resbook_44s_7,&_resbook_44s_7},
|
&_resbook_44s_7,&_resbook_44s_7},
|
||||||
|
|
||||||
{2,0, &_residue_44_high,
|
{2,0,32, &_residue_44_high,
|
||||||
&_huff_book__44c7_s_long,&_huff_book__44c7_s_long,
|
&_huff_book__44c7_s_long,&_huff_book__44c7_s_long,
|
||||||
&_resbook_44s_7,&_resbook_44s_7}
|
&_resbook_44s_7,&_resbook_44s_7}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44s_8[]={
|
static const vorbis_residue_template _res_44s_8[]={
|
||||||
{2,0, &_residue_44_high,
|
{2,0,16, &_residue_44_high,
|
||||||
&_huff_book__44c8_s_short,&_huff_book__44c8_s_short,
|
&_huff_book__44c8_s_short,&_huff_book__44c8_s_short,
|
||||||
&_resbook_44s_8,&_resbook_44s_8},
|
&_resbook_44s_8,&_resbook_44s_8},
|
||||||
|
|
||||||
{2,0, &_residue_44_high,
|
{2,0,32, &_residue_44_high,
|
||||||
&_huff_book__44c8_s_long,&_huff_book__44c8_s_long,
|
&_huff_book__44c8_s_long,&_huff_book__44c8_s_long,
|
||||||
&_resbook_44s_8,&_resbook_44s_8}
|
&_resbook_44s_8,&_resbook_44s_8}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44s_9[]={
|
static const vorbis_residue_template _res_44s_9[]={
|
||||||
{2,0, &_residue_44_high,
|
{2,0,16, &_residue_44_high,
|
||||||
&_huff_book__44c9_s_short,&_huff_book__44c9_s_short,
|
&_huff_book__44c9_s_short,&_huff_book__44c9_s_short,
|
||||||
&_resbook_44s_9,&_resbook_44s_9},
|
&_resbook_44s_9,&_resbook_44s_9},
|
||||||
|
|
||||||
{2,0, &_residue_44_high,
|
{2,0,32, &_residue_44_high,
|
||||||
&_huff_book__44c9_s_long,&_huff_book__44c9_s_long,
|
&_huff_book__44c9_s_long,&_huff_book__44c9_s_long,
|
||||||
&_resbook_44s_9,&_resbook_44s_9}
|
&_resbook_44s_9,&_resbook_44s_9}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_mapping_template _mapres_template_44_stereo[]={
|
static const vorbis_mapping_template _mapres_template_44_stereo[]={
|
||||||
{ _map_nominal, _res_44s_n1 }, /* -1 */
|
{ _map_nominal, _res_44s_n1 }, /* -1 */
|
||||||
{ _map_nominal, _res_44s_0 }, /* 0 */
|
{ _map_nominal, _res_44s_0 }, /* 0 */
|
||||||
{ _map_nominal, _res_44s_1 }, /* 1 */
|
{ _map_nominal, _res_44s_1 }, /* 1 */
|
||||||
|
|
@ -290,5 +290,3 @@ static vorbis_mapping_template _mapres_template_44_stereo[]={
|
||||||
{ _map_nominal, _res_44s_8 }, /* 8 */
|
{ _map_nominal, _res_44s_8 }, /* 8 */
|
||||||
{ _map_nominal, _res_44s_9 }, /* 9 */
|
{ _map_nominal, _res_44s_9 }, /* 9 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: toplevel residue templates for 32/44.1/48kHz uncoupled
|
function: toplevel residue templates for 32/44.1/48kHz uncoupled
|
||||||
last mod: $Id: residue_44u.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: residue_44u.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -22,41 +22,41 @@
|
||||||
/***** residue backends *********************************************/
|
/***** residue backends *********************************************/
|
||||||
|
|
||||||
|
|
||||||
static vorbis_info_residue0 _residue_44_low_un={
|
static const vorbis_info_residue0 _residue_44_low_un={
|
||||||
0,-1, -1, 8,-1,
|
0,-1, -1, 8,-1,-1,
|
||||||
{0},
|
{0},
|
||||||
{-1},
|
{-1},
|
||||||
{ .5, 1.5, 1.5, 2.5, 2.5, 4.5, 28.5},
|
{ 0, 1, 1, 2, 2, 4, 28},
|
||||||
{ -1, 25, -1, 45, -1, -1, -1}
|
{ -1, 25, -1, 45, -1, -1, -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_info_residue0 _residue_44_mid_un={
|
static const vorbis_info_residue0 _residue_44_mid_un={
|
||||||
0,-1, -1, 10,-1,
|
0,-1, -1, 10,-1,-1,
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 */
|
/* 0 1 2 3 4 5 6 7 8 9 */
|
||||||
{0},
|
{0},
|
||||||
{-1},
|
{-1},
|
||||||
{ .5, 1.5, 1.5, 2.5, 2.5, 4.5, 4.5, 16.5, 60.5},
|
{ 0, 1, 1, 2, 2, 4, 4, 16, 60},
|
||||||
{ -1, 30, -1, 50, -1, 80, -1, -1, -1}
|
{ -1, 30, -1, 50, -1, 80, -1, -1, -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_info_residue0 _residue_44_hi_un={
|
static const vorbis_info_residue0 _residue_44_hi_un={
|
||||||
0,-1, -1, 10,-1,
|
0,-1, -1, 10,-1,-1,
|
||||||
/* 0 1 2 3 4 5 6 7 8 9 */
|
/* 0 1 2 3 4 5 6 7 8 9 */
|
||||||
{0},
|
{0},
|
||||||
{-1},
|
{-1},
|
||||||
{ .5, 1.5, 2.5, 4.5, 8.5, 16.5, 32.5, 71.5,157.5},
|
{ 0, 1, 2, 4, 8, 16, 32, 71,157},
|
||||||
{ -1, -1, -1, -1, -1, -1, -1, -1, -1}
|
{ -1, -1, -1, -1, -1, -1, -1, -1, -1}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* mapping conventions:
|
/* mapping conventions:
|
||||||
only one submap (this would change for efficient 5.1 support for example)*/
|
only one submap (this would change for efficient 5.1 support for example)*/
|
||||||
/* Four psychoacoustic profiles are used, one for each blocktype */
|
/* Four psychoacoustic profiles are used, one for each blocktype */
|
||||||
static vorbis_info_mapping0 _map_nominal_u[2]={
|
static const vorbis_info_mapping0 _map_nominal_u[2]={
|
||||||
{1, {0,0}, {0}, {0}, 0,{0},{0}},
|
{1, {0,0,0,0,0,0}, {0}, {0}, 0,{0},{0}},
|
||||||
{1, {0,0}, {1}, {1}, 0,{0},{0}}
|
{1, {0,0,0,0,0,0}, {1}, {1}, 0,{0},{0}}
|
||||||
};
|
};
|
||||||
|
|
||||||
static static_bookblock _resbook_44u_n1={
|
static const static_bookblock _resbook_44u_n1={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44un1__p1_0},
|
{0,0,&_44un1__p1_0},
|
||||||
|
|
@ -68,7 +68,7 @@ static static_bookblock _resbook_44u_n1={
|
||||||
{&_44un1__p7_0,&_44un1__p7_1,&_44un1__p7_2}
|
{&_44un1__p7_0,&_44un1__p7_1,&_44un1__p7_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_0={
|
static const static_bookblock _resbook_44u_0={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u0__p1_0},
|
{0,0,&_44u0__p1_0},
|
||||||
|
|
@ -80,7 +80,7 @@ static static_bookblock _resbook_44u_0={
|
||||||
{&_44u0__p7_0,&_44u0__p7_1,&_44u0__p7_2}
|
{&_44u0__p7_0,&_44u0__p7_1,&_44u0__p7_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_1={
|
static const static_bookblock _resbook_44u_1={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u1__p1_0},
|
{0,0,&_44u1__p1_0},
|
||||||
|
|
@ -92,7 +92,7 @@ static static_bookblock _resbook_44u_1={
|
||||||
{&_44u1__p7_0,&_44u1__p7_1,&_44u1__p7_2}
|
{&_44u1__p7_0,&_44u1__p7_1,&_44u1__p7_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_2={
|
static const static_bookblock _resbook_44u_2={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u2__p1_0},
|
{0,0,&_44u2__p1_0},
|
||||||
|
|
@ -104,7 +104,7 @@ static static_bookblock _resbook_44u_2={
|
||||||
{&_44u2__p7_0,&_44u2__p7_1,&_44u2__p7_2}
|
{&_44u2__p7_0,&_44u2__p7_1,&_44u2__p7_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_3={
|
static const static_bookblock _resbook_44u_3={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u3__p1_0},
|
{0,0,&_44u3__p1_0},
|
||||||
|
|
@ -116,7 +116,7 @@ static static_bookblock _resbook_44u_3={
|
||||||
{&_44u3__p7_0,&_44u3__p7_1,&_44u3__p7_2}
|
{&_44u3__p7_0,&_44u3__p7_1,&_44u3__p7_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_4={
|
static const static_bookblock _resbook_44u_4={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u4__p1_0},
|
{0,0,&_44u4__p1_0},
|
||||||
|
|
@ -128,7 +128,7 @@ static static_bookblock _resbook_44u_4={
|
||||||
{&_44u4__p7_0,&_44u4__p7_1,&_44u4__p7_2}
|
{&_44u4__p7_0,&_44u4__p7_1,&_44u4__p7_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_5={
|
static const static_bookblock _resbook_44u_5={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u5__p1_0},
|
{0,0,&_44u5__p1_0},
|
||||||
|
|
@ -142,7 +142,7 @@ static static_bookblock _resbook_44u_5={
|
||||||
{&_44u5__p9_0,&_44u5__p9_1,&_44u5__p9_2}
|
{&_44u5__p9_0,&_44u5__p9_1,&_44u5__p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_6={
|
static const static_bookblock _resbook_44u_6={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u6__p1_0},
|
{0,0,&_44u6__p1_0},
|
||||||
|
|
@ -156,7 +156,7 @@ static static_bookblock _resbook_44u_6={
|
||||||
{&_44u6__p9_0,&_44u6__p9_1,&_44u6__p9_2}
|
{&_44u6__p9_0,&_44u6__p9_1,&_44u6__p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_7={
|
static const static_bookblock _resbook_44u_7={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u7__p1_0},
|
{0,0,&_44u7__p1_0},
|
||||||
|
|
@ -170,7 +170,7 @@ static static_bookblock _resbook_44u_7={
|
||||||
{&_44u7__p9_0,&_44u7__p9_1,&_44u7__p9_2}
|
{&_44u7__p9_0,&_44u7__p9_1,&_44u7__p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_8={
|
static const static_bookblock _resbook_44u_8={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u8_p1_0},
|
{0,0,&_44u8_p1_0},
|
||||||
|
|
@ -184,7 +184,7 @@ static static_bookblock _resbook_44u_8={
|
||||||
{&_44u8_p9_0,&_44u8_p9_1,&_44u8_p9_2}
|
{&_44u8_p9_0,&_44u8_p9_1,&_44u8_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_44u_9={
|
static const static_bookblock _resbook_44u_9={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_44u9_p1_0},
|
{0,0,&_44u9_p1_0},
|
||||||
|
|
@ -199,111 +199,111 @@ static static_bookblock _resbook_44u_9={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_44u_n1[]={
|
static const vorbis_residue_template _res_44u_n1[]={
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,32, &_residue_44_low_un,
|
||||||
&_huff_book__44un1__short,&_huff_book__44un1__short,
|
&_huff_book__44un1__short,&_huff_book__44un1__short,
|
||||||
&_resbook_44u_n1,&_resbook_44u_n1},
|
&_resbook_44u_n1,&_resbook_44u_n1},
|
||||||
|
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,32, &_residue_44_low_un,
|
||||||
&_huff_book__44un1__long,&_huff_book__44un1__long,
|
&_huff_book__44un1__long,&_huff_book__44un1__long,
|
||||||
&_resbook_44u_n1,&_resbook_44u_n1}
|
&_resbook_44u_n1,&_resbook_44u_n1}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44u_0[]={
|
static const vorbis_residue_template _res_44u_0[]={
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,16, &_residue_44_low_un,
|
||||||
&_huff_book__44u0__short,&_huff_book__44u0__short,
|
&_huff_book__44u0__short,&_huff_book__44u0__short,
|
||||||
&_resbook_44u_0,&_resbook_44u_0},
|
&_resbook_44u_0,&_resbook_44u_0},
|
||||||
|
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,32, &_residue_44_low_un,
|
||||||
&_huff_book__44u0__long,&_huff_book__44u0__long,
|
&_huff_book__44u0__long,&_huff_book__44u0__long,
|
||||||
&_resbook_44u_0,&_resbook_44u_0}
|
&_resbook_44u_0,&_resbook_44u_0}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44u_1[]={
|
static const vorbis_residue_template _res_44u_1[]={
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,16, &_residue_44_low_un,
|
||||||
&_huff_book__44u1__short,&_huff_book__44u1__short,
|
&_huff_book__44u1__short,&_huff_book__44u1__short,
|
||||||
&_resbook_44u_1,&_resbook_44u_1},
|
&_resbook_44u_1,&_resbook_44u_1},
|
||||||
|
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,32, &_residue_44_low_un,
|
||||||
&_huff_book__44u1__long,&_huff_book__44u1__long,
|
&_huff_book__44u1__long,&_huff_book__44u1__long,
|
||||||
&_resbook_44u_1,&_resbook_44u_1}
|
&_resbook_44u_1,&_resbook_44u_1}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44u_2[]={
|
static const vorbis_residue_template _res_44u_2[]={
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,16, &_residue_44_low_un,
|
||||||
&_huff_book__44u2__short,&_huff_book__44u2__short,
|
&_huff_book__44u2__short,&_huff_book__44u2__short,
|
||||||
&_resbook_44u_2,&_resbook_44u_2},
|
&_resbook_44u_2,&_resbook_44u_2},
|
||||||
|
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,32, &_residue_44_low_un,
|
||||||
&_huff_book__44u2__long,&_huff_book__44u2__long,
|
&_huff_book__44u2__long,&_huff_book__44u2__long,
|
||||||
&_resbook_44u_2,&_resbook_44u_2}
|
&_resbook_44u_2,&_resbook_44u_2}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44u_3[]={
|
static const vorbis_residue_template _res_44u_3[]={
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,16, &_residue_44_low_un,
|
||||||
&_huff_book__44u3__short,&_huff_book__44u3__short,
|
&_huff_book__44u3__short,&_huff_book__44u3__short,
|
||||||
&_resbook_44u_3,&_resbook_44u_3},
|
&_resbook_44u_3,&_resbook_44u_3},
|
||||||
|
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,32, &_residue_44_low_un,
|
||||||
&_huff_book__44u3__long,&_huff_book__44u3__long,
|
&_huff_book__44u3__long,&_huff_book__44u3__long,
|
||||||
&_resbook_44u_3,&_resbook_44u_3}
|
&_resbook_44u_3,&_resbook_44u_3}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44u_4[]={
|
static const vorbis_residue_template _res_44u_4[]={
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,16, &_residue_44_low_un,
|
||||||
&_huff_book__44u4__short,&_huff_book__44u4__short,
|
&_huff_book__44u4__short,&_huff_book__44u4__short,
|
||||||
&_resbook_44u_4,&_resbook_44u_4},
|
&_resbook_44u_4,&_resbook_44u_4},
|
||||||
|
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,32, &_residue_44_low_un,
|
||||||
&_huff_book__44u4__long,&_huff_book__44u4__long,
|
&_huff_book__44u4__long,&_huff_book__44u4__long,
|
||||||
&_resbook_44u_4,&_resbook_44u_4}
|
&_resbook_44u_4,&_resbook_44u_4}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_44u_5[]={
|
static const vorbis_residue_template _res_44u_5[]={
|
||||||
{1,0, &_residue_44_mid_un,
|
{1,0,16, &_residue_44_mid_un,
|
||||||
&_huff_book__44u5__short,&_huff_book__44u5__short,
|
&_huff_book__44u5__short,&_huff_book__44u5__short,
|
||||||
&_resbook_44u_5,&_resbook_44u_5},
|
&_resbook_44u_5,&_resbook_44u_5},
|
||||||
|
|
||||||
{1,0, &_residue_44_mid_un,
|
{1,0,32, &_residue_44_mid_un,
|
||||||
&_huff_book__44u5__long,&_huff_book__44u5__long,
|
&_huff_book__44u5__long,&_huff_book__44u5__long,
|
||||||
&_resbook_44u_5,&_resbook_44u_5}
|
&_resbook_44u_5,&_resbook_44u_5}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_44u_6[]={
|
static const vorbis_residue_template _res_44u_6[]={
|
||||||
{1,0, &_residue_44_mid_un,
|
{1,0,16, &_residue_44_mid_un,
|
||||||
&_huff_book__44u6__short,&_huff_book__44u6__short,
|
&_huff_book__44u6__short,&_huff_book__44u6__short,
|
||||||
&_resbook_44u_6,&_resbook_44u_6},
|
&_resbook_44u_6,&_resbook_44u_6},
|
||||||
|
|
||||||
{1,0, &_residue_44_mid_un,
|
{1,0,32, &_residue_44_mid_un,
|
||||||
&_huff_book__44u6__long,&_huff_book__44u6__long,
|
&_huff_book__44u6__long,&_huff_book__44u6__long,
|
||||||
&_resbook_44u_6,&_resbook_44u_6}
|
&_resbook_44u_6,&_resbook_44u_6}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_44u_7[]={
|
static const vorbis_residue_template _res_44u_7[]={
|
||||||
{1,0, &_residue_44_mid_un,
|
{1,0,16, &_residue_44_mid_un,
|
||||||
&_huff_book__44u7__short,&_huff_book__44u7__short,
|
&_huff_book__44u7__short,&_huff_book__44u7__short,
|
||||||
&_resbook_44u_7,&_resbook_44u_7},
|
&_resbook_44u_7,&_resbook_44u_7},
|
||||||
|
|
||||||
{1,0, &_residue_44_mid_un,
|
{1,0,32, &_residue_44_mid_un,
|
||||||
&_huff_book__44u7__long,&_huff_book__44u7__long,
|
&_huff_book__44u7__long,&_huff_book__44u7__long,
|
||||||
&_resbook_44u_7,&_resbook_44u_7}
|
&_resbook_44u_7,&_resbook_44u_7}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_44u_8[]={
|
static const vorbis_residue_template _res_44u_8[]={
|
||||||
{1,0, &_residue_44_hi_un,
|
{1,0,16, &_residue_44_hi_un,
|
||||||
&_huff_book__44u8__short,&_huff_book__44u8__short,
|
&_huff_book__44u8__short,&_huff_book__44u8__short,
|
||||||
&_resbook_44u_8,&_resbook_44u_8},
|
&_resbook_44u_8,&_resbook_44u_8},
|
||||||
|
|
||||||
{1,0, &_residue_44_hi_un,
|
{1,0,32, &_residue_44_hi_un,
|
||||||
&_huff_book__44u8__long,&_huff_book__44u8__long,
|
&_huff_book__44u8__long,&_huff_book__44u8__long,
|
||||||
&_resbook_44u_8,&_resbook_44u_8}
|
&_resbook_44u_8,&_resbook_44u_8}
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_44u_9[]={
|
static const vorbis_residue_template _res_44u_9[]={
|
||||||
{1,0, &_residue_44_hi_un,
|
{1,0,16, &_residue_44_hi_un,
|
||||||
&_huff_book__44u9__short,&_huff_book__44u9__short,
|
&_huff_book__44u9__short,&_huff_book__44u9__short,
|
||||||
&_resbook_44u_9,&_resbook_44u_9},
|
&_resbook_44u_9,&_resbook_44u_9},
|
||||||
|
|
||||||
{1,0, &_residue_44_hi_un,
|
{1,0,32, &_residue_44_hi_un,
|
||||||
&_huff_book__44u9__long,&_huff_book__44u9__long,
|
&_huff_book__44u9__long,&_huff_book__44u9__long,
|
||||||
&_resbook_44u_9,&_resbook_44u_9}
|
&_resbook_44u_9,&_resbook_44u_9}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_mapping_template _mapres_template_44_uncoupled[]={
|
static const vorbis_mapping_template _mapres_template_44_uncoupled[]={
|
||||||
{ _map_nominal_u, _res_44u_n1 }, /* -1 */
|
{ _map_nominal_u, _res_44u_n1 }, /* -1 */
|
||||||
{ _map_nominal_u, _res_44u_0 }, /* 0 */
|
{ _map_nominal_u, _res_44u_0 }, /* 0 */
|
||||||
{ _map_nominal_u, _res_44u_1 }, /* 1 */
|
{ _map_nominal_u, _res_44u_1 }, /* 1 */
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: toplevel residue templates 8/11kHz
|
function: toplevel residue templates 8/11kHz
|
||||||
last mod: $Id: residue_8.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: residue_8.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
/***** residue backends *********************************************/
|
/***** residue backends *********************************************/
|
||||||
|
|
||||||
static static_bookblock _resbook_8s_0={
|
static const static_bookblock _resbook_8s_0={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_8c0_s_p1_0},
|
{0,0,&_8c0_s_p1_0},
|
||||||
|
|
@ -34,7 +34,7 @@ static static_bookblock _resbook_8s_0={
|
||||||
{&_8c0_s_p9_0,&_8c0_s_p9_1,&_8c0_s_p9_2}
|
{&_8c0_s_p9_0,&_8c0_s_p9_1,&_8c0_s_p9_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_8s_1={
|
static const static_bookblock _resbook_8s_1={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_8c1_s_p1_0},
|
{0,0,&_8c1_s_p1_0},
|
||||||
|
|
@ -49,23 +49,23 @@ static static_bookblock _resbook_8s_1={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_8s_0[]={
|
static const vorbis_residue_template _res_8s_0[]={
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,32, &_residue_44_mid,
|
||||||
&_huff_book__8c0_s_single,&_huff_book__8c0_s_single,
|
&_huff_book__8c0_s_single,&_huff_book__8c0_s_single,
|
||||||
&_resbook_8s_0,&_resbook_8s_0},
|
&_resbook_8s_0,&_resbook_8s_0},
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_8s_1[]={
|
static const vorbis_residue_template _res_8s_1[]={
|
||||||
{2,0, &_residue_44_mid,
|
{2,0,32, &_residue_44_mid,
|
||||||
&_huff_book__8c1_s_single,&_huff_book__8c1_s_single,
|
&_huff_book__8c1_s_single,&_huff_book__8c1_s_single,
|
||||||
&_resbook_8s_1,&_resbook_8s_1},
|
&_resbook_8s_1,&_resbook_8s_1},
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_mapping_template _mapres_template_8_stereo[2]={
|
static const vorbis_mapping_template _mapres_template_8_stereo[2]={
|
||||||
{ _map_nominal, _res_8s_0 }, /* 0 */
|
{ _map_nominal, _res_8s_0 }, /* 0 */
|
||||||
{ _map_nominal, _res_8s_1 }, /* 1 */
|
{ _map_nominal, _res_8s_1 }, /* 1 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static static_bookblock _resbook_8u_0={
|
static const static_bookblock _resbook_8u_0={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_8u0__p1_0},
|
{0,0,&_8u0__p1_0},
|
||||||
|
|
@ -77,7 +77,7 @@ static static_bookblock _resbook_8u_0={
|
||||||
{&_8u0__p7_0,&_8u0__p7_1,&_8u0__p7_2}
|
{&_8u0__p7_0,&_8u0__p7_1,&_8u0__p7_2}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static static_bookblock _resbook_8u_1={
|
static const static_bookblock _resbook_8u_1={
|
||||||
{
|
{
|
||||||
{0},
|
{0},
|
||||||
{0,0,&_8u1__p1_0},
|
{0,0,&_8u1__p1_0},
|
||||||
|
|
@ -92,18 +92,18 @@ static static_bookblock _resbook_8u_1={
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_residue_template _res_8u_0[]={
|
static const vorbis_residue_template _res_8u_0[]={
|
||||||
{1,0, &_residue_44_low_un,
|
{1,0,32, &_residue_44_low_un,
|
||||||
&_huff_book__8u0__single,&_huff_book__8u0__single,
|
&_huff_book__8u0__single,&_huff_book__8u0__single,
|
||||||
&_resbook_8u_0,&_resbook_8u_0},
|
&_resbook_8u_0,&_resbook_8u_0},
|
||||||
};
|
};
|
||||||
static vorbis_residue_template _res_8u_1[]={
|
static const vorbis_residue_template _res_8u_1[]={
|
||||||
{1,0, &_residue_44_mid_un,
|
{1,0,32, &_residue_44_mid_un,
|
||||||
&_huff_book__8u1__single,&_huff_book__8u1__single,
|
&_huff_book__8u1__single,&_huff_book__8u1__single,
|
||||||
&_resbook_8u_1,&_resbook_8u_1},
|
&_resbook_8u_1,&_resbook_8u_1},
|
||||||
};
|
};
|
||||||
|
|
||||||
static vorbis_mapping_template _mapres_template_8_uncoupled[2]={
|
static const vorbis_mapping_template _mapres_template_8_uncoupled[2]={
|
||||||
{ _map_nominal_u, _res_8u_0 }, /* 0 */
|
{ _map_nominal_u, _res_8u_0 }, /* 0 */
|
||||||
{ _map_nominal_u, _res_8u_1 }, /* 1 */
|
{ _map_nominal_u, _res_8u_1 }, /* 1 */
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,39 +5,42 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: 11kHz settings
|
function: 11kHz settings
|
||||||
last mod: $Id: setup_11.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: setup_11.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
#include "psych_11.h"
|
#include "psych_11.h"
|
||||||
|
|
||||||
static int blocksize_11[2]={
|
static const int blocksize_11[2]={
|
||||||
512,512
|
512,512
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _floor_mapping_11[2]={
|
static const int _floor_mapping_11a[]={
|
||||||
6,6,
|
6,6
|
||||||
|
};
|
||||||
|
static const int *_floor_mapping_11[]={
|
||||||
|
_floor_mapping_11a
|
||||||
};
|
};
|
||||||
|
|
||||||
static double rate_mapping_11[3]={
|
static const double rate_mapping_11[3]={
|
||||||
8000.,13000.,44000.,
|
8000.,13000.,44000.,
|
||||||
};
|
};
|
||||||
|
|
||||||
static double rate_mapping_11_uncoupled[3]={
|
static const double rate_mapping_11_uncoupled[3]={
|
||||||
12000.,20000.,50000.,
|
12000.,20000.,50000.,
|
||||||
};
|
};
|
||||||
|
|
||||||
static double quality_mapping_11[3]={
|
static const double quality_mapping_11[3]={
|
||||||
-.1,.0,1.
|
-.1,.0,1.
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_11_stereo={
|
static const ve_setup_data_template ve_setup_11_stereo={
|
||||||
2,
|
2,
|
||||||
rate_mapping_11,
|
rate_mapping_11,
|
||||||
quality_mapping_11,
|
quality_mapping_11,
|
||||||
|
|
@ -82,13 +85,13 @@ ve_setup_data_template ve_setup_11_stereo={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
|
1,
|
||||||
_floor_mapping_11,
|
_floor_mapping_11,
|
||||||
NULL,
|
|
||||||
|
|
||||||
_mapres_template_8_stereo
|
_mapres_template_8_stereo
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_11_uncoupled={
|
static const ve_setup_data_template ve_setup_11_uncoupled={
|
||||||
2,
|
2,
|
||||||
rate_mapping_11_uncoupled,
|
rate_mapping_11_uncoupled,
|
||||||
quality_mapping_11,
|
quality_mapping_11,
|
||||||
|
|
@ -133,9 +136,8 @@ ve_setup_data_template ve_setup_11_uncoupled={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
|
1,
|
||||||
_floor_mapping_11,
|
_floor_mapping_11,
|
||||||
NULL,
|
|
||||||
|
|
||||||
_mapres_template_8_uncoupled
|
_mapres_template_8_uncoupled
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,48 +5,52 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: 16kHz settings
|
function: 16kHz settings
|
||||||
last mod: $Id: setup_16.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: setup_16.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
#include "psych_16.h"
|
#include "psych_16.h"
|
||||||
#include "residue_16.h"
|
#include "residue_16.h"
|
||||||
|
|
||||||
static int blocksize_16_short[3]={
|
static const int blocksize_16_short[3]={
|
||||||
1024,512,512
|
1024,512,512
|
||||||
};
|
};
|
||||||
static int blocksize_16_long[3]={
|
static const int blocksize_16_long[3]={
|
||||||
1024,1024,1024
|
1024,1024,1024
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _floor_mapping_16_short[3]={
|
static const int _floor_mapping_16a[]={
|
||||||
9,3,3
|
9,3,3
|
||||||
};
|
};
|
||||||
static int _floor_mapping_16[3]={
|
static const int _floor_mapping_16b[]={
|
||||||
9,9,9
|
9,9,9
|
||||||
};
|
};
|
||||||
|
static const int *_floor_mapping_16[]={
|
||||||
|
_floor_mapping_16a,
|
||||||
|
_floor_mapping_16b
|
||||||
|
};
|
||||||
|
|
||||||
static double rate_mapping_16[4]={
|
static const double rate_mapping_16[4]={
|
||||||
12000.,20000.,44000.,86000.
|
12000.,20000.,44000.,86000.
|
||||||
};
|
};
|
||||||
|
|
||||||
static double rate_mapping_16_uncoupled[4]={
|
static const double rate_mapping_16_uncoupled[4]={
|
||||||
16000.,28000.,64000.,100000.
|
16000.,28000.,64000.,100000.
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _global_mapping_16[4]={ 1., 2., 3., 4. };
|
static const double _global_mapping_16[4]={ 1., 2., 3., 4. };
|
||||||
|
|
||||||
static double quality_mapping_16[4]={ -.1,.05,.5,1. };
|
static const double quality_mapping_16[4]={ -.1,.05,.5,1. };
|
||||||
|
|
||||||
static double _psy_compand_16_mapping[4]={ 0., .8, 1., 1.};
|
static const double _psy_compand_16_mapping[4]={ 0., .8, 1., 1.};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_16_stereo={
|
static const ve_setup_data_template ve_setup_16_stereo={
|
||||||
3,
|
3,
|
||||||
rate_mapping_16,
|
rate_mapping_16,
|
||||||
quality_mapping_16,
|
quality_mapping_16,
|
||||||
|
|
@ -91,13 +95,13 @@ ve_setup_data_template ve_setup_16_stereo={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_mapping_16_short,
|
2,
|
||||||
_floor_mapping_16,
|
_floor_mapping_16,
|
||||||
|
|
||||||
_mapres_template_16_stereo
|
_mapres_template_16_stereo
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_16_uncoupled={
|
static const ve_setup_data_template ve_setup_16_uncoupled={
|
||||||
3,
|
3,
|
||||||
rate_mapping_16_uncoupled,
|
rate_mapping_16_uncoupled,
|
||||||
quality_mapping_16,
|
quality_mapping_16,
|
||||||
|
|
@ -116,7 +120,7 @@ ve_setup_data_template ve_setup_16_uncoupled={
|
||||||
_vp_tonemask_adj_16,
|
_vp_tonemask_adj_16,
|
||||||
_vp_tonemask_adj_16,
|
_vp_tonemask_adj_16,
|
||||||
|
|
||||||
_psy_noiseguards_8,
|
_psy_noiseguards_16,
|
||||||
_psy_noisebias_16_impulse,
|
_psy_noisebias_16_impulse,
|
||||||
_psy_noisebias_16_short,
|
_psy_noisebias_16_short,
|
||||||
_psy_noisebias_16_short,
|
_psy_noisebias_16_short,
|
||||||
|
|
@ -142,7 +146,7 @@ ve_setup_data_template ve_setup_16_uncoupled={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_mapping_16_short,
|
2,
|
||||||
_floor_mapping_16,
|
_floor_mapping_16,
|
||||||
|
|
||||||
_mapres_template_16_uncoupled
|
_mapres_template_16_uncoupled
|
||||||
|
|
|
||||||
|
|
@ -5,27 +5,27 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: 22kHz settings
|
function: 22kHz settings
|
||||||
last mod: $Id: setup_22.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: setup_22.h 17026 2010-03-25 05:00:27Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
static double rate_mapping_22[4]={
|
static const double rate_mapping_22[4]={
|
||||||
15000.,20000.,44000.,86000.
|
15000.,20000.,44000.,86000.
|
||||||
};
|
};
|
||||||
|
|
||||||
static double rate_mapping_22_uncoupled[4]={
|
static const double rate_mapping_22_uncoupled[4]={
|
||||||
16000.,28000.,50000.,90000.
|
16000.,28000.,50000.,90000.
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _psy_lowpass_22[4]={9.5,11.,30.,99.};
|
static const double _psy_lowpass_22[4]={9.5,11.,30.,99.};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_22_stereo={
|
static const ve_setup_data_template ve_setup_22_stereo={
|
||||||
3,
|
3,
|
||||||
rate_mapping_22,
|
rate_mapping_22,
|
||||||
quality_mapping_16,
|
quality_mapping_16,
|
||||||
|
|
@ -52,8 +52,8 @@ ve_setup_data_template ve_setup_22_stereo={
|
||||||
_psy_noise_suppress,
|
_psy_noise_suppress,
|
||||||
|
|
||||||
_psy_compand_8,
|
_psy_compand_8,
|
||||||
_psy_compand_8_mapping,
|
_psy_compand_16_mapping,
|
||||||
_psy_compand_8_mapping,
|
_psy_compand_16_mapping,
|
||||||
|
|
||||||
{_noise_start_16,_noise_start_16},
|
{_noise_start_16,_noise_start_16},
|
||||||
{ _noise_part_16, _noise_part_16},
|
{ _noise_part_16, _noise_part_16},
|
||||||
|
|
@ -70,13 +70,13 @@ ve_setup_data_template ve_setup_22_stereo={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_mapping_16_short,
|
2,
|
||||||
_floor_mapping_16,
|
_floor_mapping_16,
|
||||||
|
|
||||||
_mapres_template_16_stereo
|
_mapres_template_16_stereo
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_22_uncoupled={
|
static const ve_setup_data_template ve_setup_22_uncoupled={
|
||||||
3,
|
3,
|
||||||
rate_mapping_22_uncoupled,
|
rate_mapping_22_uncoupled,
|
||||||
quality_mapping_16,
|
quality_mapping_16,
|
||||||
|
|
@ -95,7 +95,7 @@ ve_setup_data_template ve_setup_22_uncoupled={
|
||||||
_vp_tonemask_adj_16,
|
_vp_tonemask_adj_16,
|
||||||
_vp_tonemask_adj_16,
|
_vp_tonemask_adj_16,
|
||||||
|
|
||||||
_psy_noiseguards_8,
|
_psy_noiseguards_16,
|
||||||
_psy_noisebias_16_impulse,
|
_psy_noisebias_16_impulse,
|
||||||
_psy_noisebias_16_short,
|
_psy_noisebias_16_short,
|
||||||
_psy_noisebias_16_short,
|
_psy_noisebias_16_short,
|
||||||
|
|
@ -103,8 +103,8 @@ ve_setup_data_template ve_setup_22_uncoupled={
|
||||||
_psy_noise_suppress,
|
_psy_noise_suppress,
|
||||||
|
|
||||||
_psy_compand_8,
|
_psy_compand_8,
|
||||||
_psy_compand_8_mapping,
|
_psy_compand_16_mapping,
|
||||||
_psy_compand_8_mapping,
|
_psy_compand_16_mapping,
|
||||||
|
|
||||||
{_noise_start_16,_noise_start_16},
|
{_noise_start_16,_noise_start_16},
|
||||||
{ _noise_part_16, _noise_part_16},
|
{ _noise_part_16, _noise_part_16},
|
||||||
|
|
@ -121,7 +121,7 @@ ve_setup_data_template ve_setup_22_uncoupled={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_mapping_16_short,
|
2,
|
||||||
_floor_mapping_16,
|
_floor_mapping_16,
|
||||||
|
|
||||||
_mapres_template_16_uncoupled
|
_mapres_template_16_uncoupled
|
||||||
|
|
|
||||||
|
|
@ -5,31 +5,31 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: toplevel settings for 32kHz
|
function: toplevel settings for 32kHz
|
||||||
last mod: $Id: setup_32.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: setup_32.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
static double rate_mapping_32[12]={
|
static const double rate_mapping_32[12]={
|
||||||
18000.,28000.,35000.,45000.,56000.,60000.,
|
18000.,28000.,35000.,45000.,56000.,60000.,
|
||||||
75000.,90000.,100000.,115000.,150000.,190000.,
|
75000.,90000.,100000.,115000.,150000.,190000.,
|
||||||
};
|
};
|
||||||
|
|
||||||
static double rate_mapping_32_un[12]={
|
static const double rate_mapping_32_un[12]={
|
||||||
30000.,42000.,52000.,64000.,72000.,78000.,
|
30000.,42000.,52000.,64000.,72000.,78000.,
|
||||||
86000.,92000.,110000.,120000.,140000.,190000.,
|
86000.,92000.,110000.,120000.,140000.,190000.,
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _psy_lowpass_32[12]={
|
static const double _psy_lowpass_32[12]={
|
||||||
12.3,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99.
|
12.3,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99.
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_32_stereo={
|
static const ve_setup_data_template ve_setup_32_stereo={
|
||||||
11,
|
11,
|
||||||
rate_mapping_32,
|
rate_mapping_32,
|
||||||
quality_mapping_44,
|
quality_mapping_44,
|
||||||
|
|
@ -74,13 +74,13 @@ ve_setup_data_template ve_setup_32_stereo={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_short_mapping_44,
|
2,
|
||||||
_floor_long_mapping_44,
|
_floor_mapping_44,
|
||||||
|
|
||||||
_mapres_template_44_stereo
|
_mapres_template_44_stereo
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_32_uncoupled={
|
static const ve_setup_data_template ve_setup_32_uncoupled={
|
||||||
11,
|
11,
|
||||||
rate_mapping_32_un,
|
rate_mapping_32_un,
|
||||||
quality_mapping_44,
|
quality_mapping_44,
|
||||||
|
|
@ -125,8 +125,8 @@ ve_setup_data_template ve_setup_32_uncoupled={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_short_mapping_44,
|
2,
|
||||||
_floor_long_mapping_44,
|
_floor_mapping_44,
|
||||||
|
|
||||||
_mapres_template_44_uncoupled
|
_mapres_template_44_uncoupled
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: toplevel settings for 44.1/48kHz
|
function: toplevel settings for 44.1/48kHz
|
||||||
last mod: $Id: setup_44.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: setup_44.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -19,42 +19,53 @@
|
||||||
#include "modes/residue_44.h"
|
#include "modes/residue_44.h"
|
||||||
#include "modes/psych_44.h"
|
#include "modes/psych_44.h"
|
||||||
|
|
||||||
static double rate_mapping_44_stereo[12]={
|
static const double rate_mapping_44_stereo[12]={
|
||||||
22500.,32000.,40000.,48000.,56000.,64000.,
|
22500.,32000.,40000.,48000.,56000.,64000.,
|
||||||
80000.,96000.,112000.,128000.,160000.,250001.
|
80000.,96000.,112000.,128000.,160000.,250001.
|
||||||
};
|
};
|
||||||
|
|
||||||
static double quality_mapping_44[12]={
|
static const double quality_mapping_44[12]={
|
||||||
-.1,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0
|
-.1,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0
|
||||||
};
|
};
|
||||||
|
|
||||||
static int blocksize_short_44[11]={
|
static const int blocksize_short_44[11]={
|
||||||
512,256,256,256,256,256,256,256,256,256,256
|
512,256,256,256,256,256,256,256,256,256,256
|
||||||
};
|
};
|
||||||
static int blocksize_long_44[11]={
|
static const int blocksize_long_44[11]={
|
||||||
4096,2048,2048,2048,2048,2048,2048,2048,2048,2048,2048
|
4096,2048,2048,2048,2048,2048,2048,2048,2048,2048,2048
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _psy_compand_short_mapping[12]={
|
static const double _psy_compand_short_mapping[12]={
|
||||||
0.5, 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
|
0.5, 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
|
||||||
};
|
};
|
||||||
static double _psy_compand_long_mapping[12]={
|
static const double _psy_compand_long_mapping[12]={
|
||||||
3.5, 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5.
|
3.5, 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5.
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _global_mapping_44[12]={
|
static const double _global_mapping_44[12]={
|
||||||
/* 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.5, 4., 4. */
|
/* 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.5, 4., 4. */
|
||||||
0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
|
0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _floor_short_mapping_44[11]={
|
static const int _floor_mapping_44a[11]={
|
||||||
1,0,0,2,2,4,5,5,5,5,5
|
1,0,0,2,2,4,5,5,5,5,5
|
||||||
};
|
};
|
||||||
static int _floor_long_mapping_44[11]={
|
|
||||||
|
static const int _floor_mapping_44b[11]={
|
||||||
8,7,7,7,7,7,7,7,7,7,7
|
8,7,7,7,7,7,7,7,7,7,7
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_44_stereo={
|
static const int _floor_mapping_44c[11]={
|
||||||
|
10,10,10,10,10,10,10,10,10,10,10
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int *_floor_mapping_44[]={
|
||||||
|
_floor_mapping_44a,
|
||||||
|
_floor_mapping_44b,
|
||||||
|
_floor_mapping_44c,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const ve_setup_data_template ve_setup_44_stereo={
|
||||||
11,
|
11,
|
||||||
rate_mapping_44_stereo,
|
rate_mapping_44_stereo,
|
||||||
quality_mapping_44,
|
quality_mapping_44,
|
||||||
|
|
@ -99,9 +110,8 @@ ve_setup_data_template ve_setup_44_stereo={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_short_mapping_44,
|
2,
|
||||||
_floor_long_mapping_44,
|
_floor_mapping_44,
|
||||||
|
|
||||||
_mapres_template_44_stereo
|
_mapres_template_44_stereo
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,24 +5,24 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: toplevel settings for 44.1/48kHz uncoupled modes
|
function: toplevel settings for 44.1/48kHz uncoupled modes
|
||||||
last mod: $Id: setup_44u.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: setup_44u.h 16962 2010-03-11 07:30:34Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
#include "modes/residue_44u.h"
|
#include "modes/residue_44u.h"
|
||||||
|
|
||||||
static double rate_mapping_44_un[12]={
|
static const double rate_mapping_44_un[12]={
|
||||||
32000.,48000.,60000.,70000.,80000.,86000.,
|
32000.,48000.,60000.,70000.,80000.,86000.,
|
||||||
96000.,110000.,120000.,140000.,160000.,240001.
|
96000.,110000.,120000.,140000.,160000.,240001.
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_44_uncoupled={
|
static const ve_setup_data_template ve_setup_44_uncoupled={
|
||||||
11,
|
11,
|
||||||
rate_mapping_44_un,
|
rate_mapping_44_un,
|
||||||
quality_mapping_44,
|
quality_mapping_44,
|
||||||
|
|
@ -63,12 +63,12 @@ ve_setup_data_template ve_setup_44_uncoupled={
|
||||||
|
|
||||||
_psy_global_44,
|
_psy_global_44,
|
||||||
_global_mapping_44,
|
_global_mapping_44,
|
||||||
NULL,
|
_psy_stereo_modes_44,
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_short_mapping_44,
|
2,
|
||||||
_floor_long_mapping_44,
|
_floor_mapping_44,
|
||||||
|
|
||||||
_mapres_template_44_uncoupled
|
_mapres_template_44_uncoupled
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,44 +5,48 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: 8kHz settings
|
function: 8kHz settings
|
||||||
last mod: $Id: setup_8.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: setup_8.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
#include "psych_8.h"
|
#include "psych_8.h"
|
||||||
#include "residue_8.h"
|
#include "residue_8.h"
|
||||||
|
|
||||||
static int blocksize_8[2]={
|
static const int blocksize_8[2]={
|
||||||
512,512
|
512,512
|
||||||
};
|
};
|
||||||
|
|
||||||
static int _floor_mapping_8[2]={
|
static const int _floor_mapping_8a[]={
|
||||||
6,6,
|
6,6
|
||||||
};
|
};
|
||||||
|
|
||||||
static double rate_mapping_8[3]={
|
static const int *_floor_mapping_8[]={
|
||||||
|
_floor_mapping_8a
|
||||||
|
};
|
||||||
|
|
||||||
|
static const double rate_mapping_8[3]={
|
||||||
6000.,9000.,32000.,
|
6000.,9000.,32000.,
|
||||||
};
|
};
|
||||||
|
|
||||||
static double rate_mapping_8_uncoupled[3]={
|
static const double rate_mapping_8_uncoupled[3]={
|
||||||
8000.,14000.,42000.,
|
8000.,14000.,42000.,
|
||||||
};
|
};
|
||||||
|
|
||||||
static double quality_mapping_8[3]={
|
static const double quality_mapping_8[3]={
|
||||||
-.1,.0,1.
|
-.1,.0,1.
|
||||||
};
|
};
|
||||||
|
|
||||||
static double _psy_compand_8_mapping[3]={ 0., 1., 1.};
|
static const double _psy_compand_8_mapping[3]={ 0., 1., 1.};
|
||||||
|
|
||||||
static double _global_mapping_8[3]={ 1., 2., 3. };
|
static const double _global_mapping_8[3]={ 1., 2., 3. };
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_8_stereo={
|
static const ve_setup_data_template ve_setup_8_stereo={
|
||||||
2,
|
2,
|
||||||
rate_mapping_8,
|
rate_mapping_8,
|
||||||
quality_mapping_8,
|
quality_mapping_8,
|
||||||
|
|
@ -87,13 +91,13 @@ ve_setup_data_template ve_setup_8_stereo={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
|
1,
|
||||||
_floor_mapping_8,
|
_floor_mapping_8,
|
||||||
NULL,
|
|
||||||
|
|
||||||
_mapres_template_8_stereo
|
_mapres_template_8_stereo
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_8_uncoupled={
|
static const ve_setup_data_template ve_setup_8_uncoupled={
|
||||||
2,
|
2,
|
||||||
rate_mapping_8_uncoupled,
|
rate_mapping_8_uncoupled,
|
||||||
quality_mapping_8,
|
quality_mapping_8,
|
||||||
|
|
@ -138,9 +142,8 @@ ve_setup_data_template ve_setup_8_uncoupled={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
|
1,
|
||||||
_floor_mapping_8,
|
_floor_mapping_8,
|
||||||
NULL,
|
|
||||||
|
|
||||||
_mapres_template_8_uncoupled
|
_mapres_template_8_uncoupled
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,22 +5,22 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: catch-all toplevel settings for q modes only
|
function: catch-all toplevel settings for q modes only
|
||||||
last mod: $Id: setup_X.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: setup_X.h 16894 2010-02-12 20:32:12Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
static double rate_mapping_X[12]={
|
static const double rate_mapping_X[12]={
|
||||||
-1.,-1.,-1.,-1.,-1.,-1.,
|
-1.,-1.,-1.,-1.,-1.,-1.,
|
||||||
-1.,-1.,-1.,-1.,-1.,-1.
|
-1.,-1.,-1.,-1.,-1.,-1.
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_X_stereo={
|
static const ve_setup_data_template ve_setup_X_stereo={
|
||||||
11,
|
11,
|
||||||
rate_mapping_X,
|
rate_mapping_X,
|
||||||
quality_mapping_44,
|
quality_mapping_44,
|
||||||
|
|
@ -65,13 +65,13 @@ ve_setup_data_template ve_setup_X_stereo={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_short_mapping_44,
|
2,
|
||||||
_floor_long_mapping_44,
|
_floor_mapping_44,
|
||||||
|
|
||||||
_mapres_template_44_stereo
|
_mapres_template_44_stereo
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_X_uncoupled={
|
static const ve_setup_data_template ve_setup_X_uncoupled={
|
||||||
11,
|
11,
|
||||||
rate_mapping_X,
|
rate_mapping_X,
|
||||||
quality_mapping_44,
|
quality_mapping_44,
|
||||||
|
|
@ -116,13 +116,13 @@ ve_setup_data_template ve_setup_X_uncoupled={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
_floor_short_mapping_44,
|
2,
|
||||||
_floor_long_mapping_44,
|
_floor_mapping_44,
|
||||||
|
|
||||||
_mapres_template_44_uncoupled
|
_mapres_template_44_uncoupled
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_XX_stereo={
|
static const ve_setup_data_template ve_setup_XX_stereo={
|
||||||
2,
|
2,
|
||||||
rate_mapping_X,
|
rate_mapping_X,
|
||||||
quality_mapping_8,
|
quality_mapping_8,
|
||||||
|
|
@ -167,13 +167,13 @@ ve_setup_data_template ve_setup_XX_stereo={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
|
1,
|
||||||
_floor_mapping_8,
|
_floor_mapping_8,
|
||||||
NULL,
|
|
||||||
|
|
||||||
_mapres_template_8_stereo
|
_mapres_template_8_stereo
|
||||||
};
|
};
|
||||||
|
|
||||||
ve_setup_data_template ve_setup_XX_uncoupled={
|
static const ve_setup_data_template ve_setup_XX_uncoupled={
|
||||||
2,
|
2,
|
||||||
rate_mapping_X,
|
rate_mapping_X,
|
||||||
quality_mapping_8,
|
quality_mapping_8,
|
||||||
|
|
@ -218,9 +218,8 @@ ve_setup_data_template ve_setup_XX_uncoupled={
|
||||||
|
|
||||||
_floor_books,
|
_floor_books,
|
||||||
_floor,
|
_floor,
|
||||||
|
1,
|
||||||
_floor_mapping_8,
|
_floor_mapping_8,
|
||||||
NULL,
|
|
||||||
|
|
||||||
_mapres_template_8_uncoupled
|
_mapres_template_8_uncoupled
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||||
last mod: $Id: os.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: os.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -79,6 +79,8 @@ void *_alloca(size_t size);
|
||||||
# define max(x,y) ((x)<(y)?(y):(x))
|
# define max(x,y) ((x)<(y)?(y):(x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Special i386 GCC implementation */
|
||||||
#if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__)
|
#if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__)
|
||||||
# define VORBIS_FPU_CONTROL
|
# define VORBIS_FPU_CONTROL
|
||||||
/* both GCC and MSVC are kinda stupid about rounding/casting to int.
|
/* both GCC and MSVC are kinda stupid about rounding/casting to int.
|
||||||
|
|
@ -94,10 +96,10 @@ static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
|
||||||
ogg_int16_t ret;
|
ogg_int16_t ret;
|
||||||
ogg_int16_t temp;
|
ogg_int16_t temp;
|
||||||
__asm__ __volatile__("fnstcw %0\n\t"
|
__asm__ __volatile__("fnstcw %0\n\t"
|
||||||
"movw %0,%%dx\n\t"
|
"movw %0,%%dx\n\t"
|
||||||
"orw $62463,%%dx\n\t"
|
"andw $62463,%%dx\n\t"
|
||||||
"movw %%dx,%1\n\t"
|
"movw %%dx,%1\n\t"
|
||||||
"fldcw %1\n\t":"=m"(ret):"m"(temp): "dx");
|
"fldcw %1\n\t":"=m"(ret):"m"(temp): "dx");
|
||||||
*fpu=ret;
|
*fpu=ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,21 +115,23 @@ static inline int vorbis_ftoi(double f){ /* yes, double! Otherwise,
|
||||||
__asm__("fistl %0": "=m"(i) : "t"(f));
|
__asm__("fistl %0": "=m"(i) : "t"(f));
|
||||||
return(i);
|
return(i);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* Special i386 GCC implementation */
|
||||||
|
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__GNUC__) && !defined(__BORLANDC__) && !defined(_XBOX_VER)
|
/* MSVC inline assembly. 32 bit only; inline ASM isn't implemented in the
|
||||||
|
* 64 bit compiler */
|
||||||
|
#if defined(_MSC_VER) && !defined(_WIN64) && !defined(_WIN32_WCE)
|
||||||
# define VORBIS_FPU_CONTROL
|
# define VORBIS_FPU_CONTROL
|
||||||
|
|
||||||
typedef ogg_int16_t vorbis_fpu_control;
|
typedef ogg_int16_t vorbis_fpu_control;
|
||||||
|
|
||||||
static __inline int vorbis_ftoi(double f){
|
static __inline int vorbis_ftoi(double f){
|
||||||
int i;
|
int i;
|
||||||
__asm{
|
__asm{
|
||||||
fld f
|
fld f
|
||||||
fistp i
|
fistp i
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
|
static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
|
||||||
|
|
@ -136,21 +140,47 @@ static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
|
||||||
static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
|
static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* Special MSVC 32 bit implementation */
|
||||||
|
|
||||||
|
|
||||||
|
/* Optimized code path for x86_64 builds. Uses SSE2 intrinsics. This can be
|
||||||
|
done safely because all x86_64 CPUs supports SSE2. */
|
||||||
|
#if (defined(_MSC_VER) && defined(_WIN64)) || (defined(__GNUC__) && defined (__x86_64__))
|
||||||
|
# define VORBIS_FPU_CONTROL
|
||||||
|
|
||||||
|
typedef ogg_int16_t vorbis_fpu_control;
|
||||||
|
|
||||||
|
#include <emmintrin.h>
|
||||||
|
static __inline int vorbis_ftoi(double f){
|
||||||
|
return _mm_cvtsd_si32(_mm_load_sd(&f));
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
|
||||||
|
}
|
||||||
|
|
||||||
|
static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* Special MSVC x64 implementation */
|
||||||
|
|
||||||
|
|
||||||
|
/* If no special implementation was found for the current compiler / platform,
|
||||||
|
use the default implementation here: */
|
||||||
#ifndef VORBIS_FPU_CONTROL
|
#ifndef VORBIS_FPU_CONTROL
|
||||||
|
|
||||||
typedef int vorbis_fpu_control;
|
typedef int vorbis_fpu_control;
|
||||||
|
|
||||||
static int vorbis_ftoi(double f){
|
static int vorbis_ftoi(double f){
|
||||||
return (int)(f+.5);
|
/* Note: MSVC and GCC (at least on some systems) round towards zero, thus,
|
||||||
|
the floor() call is required to ensure correct roudning of
|
||||||
|
negative numbers */
|
||||||
|
return (int)floor(f+.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't have special code for this compiler/arch, so do it the slow way */
|
/* We don't have special code for this compiler/arch, so do it the slow way */
|
||||||
# define vorbis_fpu_setround(vorbis_fpu_control) {}
|
# define vorbis_fpu_setround(vorbis_fpu_control) {}
|
||||||
# define vorbis_fpu_restore(vorbis_fpu_control) {}
|
# define vorbis_fpu_restore(vorbis_fpu_control) {}
|
||||||
|
|
||||||
#endif
|
#endif /* default implementation */
|
||||||
|
|
||||||
#endif /* _OS_H */
|
#endif /* _OS_H */
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: random psychoacoustics (not including preecho)
|
function: random psychoacoustics (not including preecho)
|
||||||
last mod: $Id: psy.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -57,8 +57,7 @@ typedef struct vorbis_info_psy{
|
||||||
|
|
||||||
float max_curve_dB;
|
float max_curve_dB;
|
||||||
|
|
||||||
int normal_channel_p;
|
int normal_p;
|
||||||
int normal_point_p;
|
|
||||||
int normal_start;
|
int normal_start;
|
||||||
int normal_partition;
|
int normal_partition;
|
||||||
double normal_thresh;
|
double normal_thresh;
|
||||||
|
|
@ -115,72 +114,41 @@ typedef struct {
|
||||||
} vorbis_look_psy;
|
} vorbis_look_psy;
|
||||||
|
|
||||||
extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
|
extern void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
|
||||||
vorbis_info_psy_global *gi,int n,long rate);
|
vorbis_info_psy_global *gi,int n,long rate);
|
||||||
extern void _vp_psy_clear(vorbis_look_psy *p);
|
extern void _vp_psy_clear(vorbis_look_psy *p);
|
||||||
extern void *_vi_psy_dup(void *source);
|
extern void *_vi_psy_dup(void *source);
|
||||||
|
|
||||||
extern void _vi_psy_free(vorbis_info_psy *i);
|
extern void _vi_psy_free(vorbis_info_psy *i);
|
||||||
extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
|
extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
|
||||||
|
|
||||||
extern void _vp_remove_floor(vorbis_look_psy *p,
|
|
||||||
float *mdct,
|
|
||||||
int *icodedflr,
|
|
||||||
float *residue,
|
|
||||||
int sliding_lowpass);
|
|
||||||
|
|
||||||
extern void _vp_noisemask(vorbis_look_psy *p,
|
extern void _vp_noisemask(vorbis_look_psy *p,
|
||||||
float *logmdct,
|
float *logmdct,
|
||||||
float *logmask);
|
float *logmask);
|
||||||
|
|
||||||
extern void _vp_tonemask(vorbis_look_psy *p,
|
extern void _vp_tonemask(vorbis_look_psy *p,
|
||||||
float *logfft,
|
float *logfft,
|
||||||
float *logmask,
|
float *logmask,
|
||||||
float global_specmax,
|
float global_specmax,
|
||||||
float local_specmax);
|
float local_specmax);
|
||||||
|
|
||||||
extern void _vp_offset_and_mix(vorbis_look_psy *p,
|
extern void _vp_offset_and_mix(vorbis_look_psy *p,
|
||||||
float *noise,
|
float *noise,
|
||||||
float *tone,
|
float *tone,
|
||||||
int offset_select,
|
int offset_select,
|
||||||
float *logmask,
|
float *logmask,
|
||||||
float *mdct,
|
float *mdct,
|
||||||
float *logmdct);
|
float *logmdct);
|
||||||
|
|
||||||
extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
|
extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
|
||||||
|
|
||||||
extern float **_vp_quantize_couple_memo(vorbis_block *vb,
|
extern void _vp_couple_quantize_normalize(int blobno,
|
||||||
vorbis_info_psy_global *g,
|
vorbis_info_psy_global *g,
|
||||||
vorbis_look_psy *p,
|
vorbis_look_psy *p,
|
||||||
vorbis_info_mapping0 *vi,
|
vorbis_info_mapping0 *vi,
|
||||||
float **mdct);
|
float **mdct,
|
||||||
|
int **iwork,
|
||||||
extern void _vp_couple(int blobno,
|
int *nonzero,
|
||||||
vorbis_info_psy_global *g,
|
int sliding_lowpass,
|
||||||
vorbis_look_psy *p,
|
int ch);
|
||||||
vorbis_info_mapping0 *vi,
|
|
||||||
float **res,
|
|
||||||
float **mag_memo,
|
|
||||||
int **mag_sort,
|
|
||||||
int **ifloor,
|
|
||||||
int *nonzero,
|
|
||||||
int sliding_lowpass);
|
|
||||||
|
|
||||||
extern void _vp_noise_normalize(vorbis_look_psy *p,
|
|
||||||
float *in,float *out,int *sortedindex);
|
|
||||||
|
|
||||||
extern void _vp_noise_normalize_sort(vorbis_look_psy *p,
|
|
||||||
float *magnitudes,int *sortedindex);
|
|
||||||
|
|
||||||
extern int **_vp_quantize_couple_sort(vorbis_block *vb,
|
|
||||||
vorbis_look_psy *p,
|
|
||||||
vorbis_info_mapping0 *vi,
|
|
||||||
float **mags);
|
|
||||||
|
|
||||||
extern void hf_reduction(vorbis_info_psy_global *g,
|
|
||||||
vorbis_look_psy *p,
|
|
||||||
vorbis_info_mapping0 *vi,
|
|
||||||
float **mdct);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: registry for time, floor, res backends and channel mappings
|
function: registry for time, floor, res backends and channel mappings
|
||||||
last mod: $Id: registry.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -22,25 +22,24 @@
|
||||||
/* seems like major overkill now; the backend numbers will grow into
|
/* seems like major overkill now; the backend numbers will grow into
|
||||||
the infrastructure soon enough */
|
the infrastructure soon enough */
|
||||||
|
|
||||||
extern vorbis_func_floor floor0_exportbundle;
|
extern const vorbis_func_floor floor0_exportbundle;
|
||||||
extern vorbis_func_floor floor1_exportbundle;
|
extern const vorbis_func_floor floor1_exportbundle;
|
||||||
extern vorbis_func_residue residue0_exportbundle;
|
extern const vorbis_func_residue residue0_exportbundle;
|
||||||
extern vorbis_func_residue residue1_exportbundle;
|
extern const vorbis_func_residue residue1_exportbundle;
|
||||||
extern vorbis_func_residue residue2_exportbundle;
|
extern const vorbis_func_residue residue2_exportbundle;
|
||||||
extern vorbis_func_mapping mapping0_exportbundle;
|
extern const vorbis_func_mapping mapping0_exportbundle;
|
||||||
|
|
||||||
vorbis_func_floor *_floor_P[]={
|
const vorbis_func_floor *const _floor_P[]={
|
||||||
&floor0_exportbundle,
|
&floor0_exportbundle,
|
||||||
&floor1_exportbundle,
|
&floor1_exportbundle,
|
||||||
};
|
};
|
||||||
|
|
||||||
vorbis_func_residue *_residue_P[]={
|
const vorbis_func_residue *const _residue_P[]={
|
||||||
&residue0_exportbundle,
|
&residue0_exportbundle,
|
||||||
&residue1_exportbundle,
|
&residue1_exportbundle,
|
||||||
&residue2_exportbundle,
|
&residue2_exportbundle,
|
||||||
};
|
};
|
||||||
|
|
||||||
vorbis_func_mapping *_mapping_P[]={
|
const vorbis_func_mapping *const _mapping_P[]={
|
||||||
&mapping0_exportbundle,
|
&mapping0_exportbundle,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: registry for time, floor, res backends and channel mappings
|
function: registry for time, floor, res backends and channel mappings
|
||||||
last mod: $Id: registry.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
#define VI_RESB 3
|
#define VI_RESB 3
|
||||||
#define VI_MAPB 1
|
#define VI_MAPB 1
|
||||||
|
|
||||||
extern vorbis_func_floor *_floor_P[];
|
extern const vorbis_func_floor *const _floor_P[];
|
||||||
extern vorbis_func_residue *_residue_P[];
|
extern const vorbis_func_residue *const _residue_P[];
|
||||||
extern vorbis_func_mapping *_mapping_P[];
|
extern const vorbis_func_mapping *const _mapping_P[];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: residue backend 0, 1 and 2 implementation
|
function: residue backend 0, 1 and 2 implementation
|
||||||
last mod: $Id: res0.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: res0.c 17556 2010-10-21 18:25:19Z tterribe $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -31,6 +31,9 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
//#define TRAIN_RES 1
|
||||||
|
//#define TRAIN_RESAUX 1
|
||||||
|
|
||||||
#if defined(TRAIN_RES) || defined (TRAIN_RESAUX)
|
#if defined(TRAIN_RES) || defined (TRAIN_RESAUX)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -58,6 +61,7 @@ typedef struct {
|
||||||
float training_min[8][64];
|
float training_min[8][64];
|
||||||
float tmin;
|
float tmin;
|
||||||
float tmax;
|
float tmax;
|
||||||
|
int submap;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} vorbis_look_residue0;
|
} vorbis_look_residue0;
|
||||||
|
|
@ -80,59 +84,59 @@ void res0_free_look(vorbis_look_residue *i){
|
||||||
{
|
{
|
||||||
int j,k,l;
|
int j,k,l;
|
||||||
for(j=0;j<look->parts;j++){
|
for(j=0;j<look->parts;j++){
|
||||||
/*fprintf(stderr,"partition %d: ",j);*/
|
/*fprintf(stderr,"partition %d: ",j);*/
|
||||||
for(k=0;k<8;k++)
|
for(k=0;k<8;k++)
|
||||||
if(look->training_data[k][j]){
|
if(look->training_data[k][j]){
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
FILE *of;
|
FILE *of;
|
||||||
codebook *statebook=look->partbooks[j][k];
|
codebook *statebook=look->partbooks[j][k];
|
||||||
|
|
||||||
/* long and short into the same bucket by current convention */
|
/* long and short into the same bucket by current convention */
|
||||||
sprintf(buffer,"res_part%d_pass%d.vqd",j,k);
|
sprintf(buffer,"res_sub%d_part%d_pass%d.vqd",look->submap,j,k);
|
||||||
of=fopen(buffer,"a");
|
of=fopen(buffer,"a");
|
||||||
|
|
||||||
for(l=0;l<statebook->entries;l++)
|
for(l=0;l<statebook->entries;l++)
|
||||||
fprintf(of,"%d:%ld\n",l,look->training_data[k][j][l]);
|
fprintf(of,"%d:%ld\n",l,look->training_data[k][j][l]);
|
||||||
|
|
||||||
fclose(of);
|
fclose(of);
|
||||||
|
|
||||||
/*fprintf(stderr,"%d(%.2f|%.2f) ",k,
|
/*fprintf(stderr,"%d(%.2f|%.2f) ",k,
|
||||||
look->training_min[k][j],look->training_max[k][j]);*/
|
look->training_min[k][j],look->training_max[k][j]);*/
|
||||||
|
|
||||||
_ogg_free(look->training_data[k][j]);
|
_ogg_free(look->training_data[k][j]);
|
||||||
look->training_data[k][j]=NULL;
|
look->training_data[k][j]=NULL;
|
||||||
}
|
}
|
||||||
/*fprintf(stderr,"\n");*/
|
/*fprintf(stderr,"\n");*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(stderr,"min/max residue: %g::%g\n",look->tmin,look->tmax);
|
fprintf(stderr,"min/max residue: %g::%g\n",look->tmin,look->tmax);
|
||||||
|
|
||||||
/*fprintf(stderr,"residue bit usage %f:%f (%f total)\n",
|
/*fprintf(stderr,"residue bit usage %f:%f (%f total)\n",
|
||||||
(float)look->phrasebits/look->frames,
|
(float)look->phrasebits/look->frames,
|
||||||
(float)look->postbits/look->frames,
|
(float)look->postbits/look->frames,
|
||||||
(float)(look->postbits+look->phrasebits)/look->frames);*/
|
(float)(look->postbits+look->phrasebits)/look->frames);*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*vorbis_info_residue0 *info=look->info;
|
/*vorbis_info_residue0 *info=look->info;
|
||||||
|
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%ld frames encoded in %ld phrasebits and %ld residue bits "
|
"%ld frames encoded in %ld phrasebits and %ld residue bits "
|
||||||
"(%g/frame) \n",look->frames,look->phrasebits,
|
"(%g/frame) \n",look->frames,look->phrasebits,
|
||||||
look->resbitsflat,
|
look->resbitsflat,
|
||||||
(look->phrasebits+look->resbitsflat)/(float)look->frames);
|
(look->phrasebits+look->resbitsflat)/(float)look->frames);
|
||||||
|
|
||||||
for(j=0;j<look->parts;j++){
|
for(j=0;j<look->parts;j++){
|
||||||
long acc=0;
|
long acc=0;
|
||||||
fprintf(stderr,"\t[%d] == ",j);
|
fprintf(stderr,"\t[%d] == ",j);
|
||||||
for(k=0;k<look->stages;k++)
|
for(k=0;k<look->stages;k++)
|
||||||
if((info->secondstages[j]>>k)&1){
|
if((info->secondstages[j]>>k)&1){
|
||||||
fprintf(stderr,"%ld,",look->resbits[j][k]);
|
fprintf(stderr,"%ld,",look->resbits[j][k]);
|
||||||
acc+=look->resbits[j][k];
|
acc+=look->resbits[j][k];
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr,":: (%ld vals) %1.2fbits/sample\n",look->resvals[j],
|
fprintf(stderr,":: (%ld vals) %1.2fbits/sample\n",look->resvals[j],
|
||||||
acc?(float)acc/(look->resvals[j]*info->grouping):0);
|
acc?(float)acc/(look->resvals[j]*info->grouping):0);
|
||||||
}
|
}
|
||||||
fprintf(stderr,"\n");*/
|
fprintf(stderr,"\n");*/
|
||||||
|
|
||||||
|
|
@ -174,7 +178,7 @@ void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){
|
||||||
oggpack_write(opb,info->end,24);
|
oggpack_write(opb,info->end,24);
|
||||||
|
|
||||||
oggpack_write(opb,info->grouping-1,24); /* residue vectors to group and
|
oggpack_write(opb,info->grouping-1,24); /* residue vectors to group and
|
||||||
code with a partitioned book */
|
code with a partitioned book */
|
||||||
oggpack_write(opb,info->partitions-1,6); /* possible partition choices */
|
oggpack_write(opb,info->partitions-1,6); /* possible partition choices */
|
||||||
oggpack_write(opb,info->groupbook,8); /* group huffman book */
|
oggpack_write(opb,info->groupbook,8); /* group huffman book */
|
||||||
|
|
||||||
|
|
@ -208,20 +212,52 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
||||||
info->partitions=oggpack_read(opb,6)+1;
|
info->partitions=oggpack_read(opb,6)+1;
|
||||||
info->groupbook=oggpack_read(opb,8);
|
info->groupbook=oggpack_read(opb,8);
|
||||||
|
|
||||||
|
/* check for premature EOP */
|
||||||
|
if(info->groupbook<0)goto errout;
|
||||||
|
|
||||||
for(j=0;j<info->partitions;j++){
|
for(j=0;j<info->partitions;j++){
|
||||||
int cascade=oggpack_read(opb,3);
|
int cascade=oggpack_read(opb,3);
|
||||||
if(oggpack_read(opb,1))
|
int cflag=oggpack_read(opb,1);
|
||||||
cascade|=(oggpack_read(opb,5)<<3);
|
if(cflag<0) goto errout;
|
||||||
|
if(cflag){
|
||||||
|
int c=oggpack_read(opb,5);
|
||||||
|
if(c<0) goto errout;
|
||||||
|
cascade|=(c<<3);
|
||||||
|
}
|
||||||
info->secondstages[j]=cascade;
|
info->secondstages[j]=cascade;
|
||||||
|
|
||||||
acc+=icount(cascade);
|
acc+=icount(cascade);
|
||||||
}
|
}
|
||||||
for(j=0;j<acc;j++)
|
for(j=0;j<acc;j++){
|
||||||
info->booklist[j]=oggpack_read(opb,8);
|
int book=oggpack_read(opb,8);
|
||||||
|
if(book<0) goto errout;
|
||||||
|
info->booklist[j]=book;
|
||||||
|
}
|
||||||
|
|
||||||
if(info->groupbook>=ci->books)goto errout;
|
if(info->groupbook>=ci->books)goto errout;
|
||||||
for(j=0;j<acc;j++)
|
for(j=0;j<acc;j++){
|
||||||
if(info->booklist[j]>=ci->books)goto errout;
|
if(info->booklist[j]>=ci->books)goto errout;
|
||||||
|
if(ci->book_param[info->booklist[j]]->maptype==0)goto errout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* verify the phrasebook is not specifying an impossible or
|
||||||
|
inconsistent partitioning scheme. */
|
||||||
|
/* modify the phrasebook ranging check from r16327; an early beta
|
||||||
|
encoder had a bug where it used an oversized phrasebook by
|
||||||
|
accident. These files should continue to be playable, but don't
|
||||||
|
allow an exploit */
|
||||||
|
{
|
||||||
|
int entries = ci->book_param[info->groupbook]->entries;
|
||||||
|
int dim = ci->book_param[info->groupbook]->dim;
|
||||||
|
int partvals = 1;
|
||||||
|
if (dim<1) goto errout;
|
||||||
|
while(dim>0){
|
||||||
|
partvals *= info->partitions;
|
||||||
|
if(partvals > entries) goto errout;
|
||||||
|
dim--;
|
||||||
|
}
|
||||||
|
info->partvals = partvals;
|
||||||
|
}
|
||||||
|
|
||||||
return(info);
|
return(info);
|
||||||
errout:
|
errout:
|
||||||
|
|
@ -230,7 +266,7 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
||||||
}
|
}
|
||||||
|
|
||||||
vorbis_look_residue *res0_look(vorbis_dsp_state *vd,
|
vorbis_look_residue *res0_look(vorbis_dsp_state *vd,
|
||||||
vorbis_info_residue *vr){
|
vorbis_info_residue *vr){
|
||||||
vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
|
vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
|
||||||
vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(*look));
|
vorbis_look_residue0 *look=_ogg_calloc(1,sizeof(*look));
|
||||||
codec_setup_info *ci=vd->vi->codec_setup;
|
codec_setup_info *ci=vd->vi->codec_setup;
|
||||||
|
|
@ -253,17 +289,20 @@ vorbis_look_residue *res0_look(vorbis_dsp_state *vd,
|
||||||
if(stages>maxstage)maxstage=stages;
|
if(stages>maxstage)maxstage=stages;
|
||||||
look->partbooks[j]=_ogg_calloc(stages,sizeof(*look->partbooks[j]));
|
look->partbooks[j]=_ogg_calloc(stages,sizeof(*look->partbooks[j]));
|
||||||
for(k=0;k<stages;k++)
|
for(k=0;k<stages;k++)
|
||||||
if(info->secondstages[j]&(1<<k)){
|
if(info->secondstages[j]&(1<<k)){
|
||||||
look->partbooks[j][k]=ci->fullbooks+info->booklist[acc++];
|
look->partbooks[j][k]=ci->fullbooks+info->booklist[acc++];
|
||||||
#ifdef TRAIN_RES
|
#ifdef TRAIN_RES
|
||||||
look->training_data[k][j]=_ogg_calloc(look->partbooks[j][k]->entries,
|
look->training_data[k][j]=_ogg_calloc(look->partbooks[j][k]->entries,
|
||||||
sizeof(***look->training_data));
|
sizeof(***look->training_data));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
look->partvals=rint(pow((float)look->parts,(float)dim));
|
look->partvals=1;
|
||||||
|
for(j=0;j<dim;j++)
|
||||||
|
look->partvals*=look->parts;
|
||||||
|
|
||||||
look->stages=maxstage;
|
look->stages=maxstage;
|
||||||
look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap));
|
look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap));
|
||||||
for(j=0;j<look->partvals;j++){
|
for(j=0;j<look->partvals;j++){
|
||||||
|
|
@ -287,66 +326,72 @@ vorbis_look_residue *res0_look(vorbis_dsp_state *vd,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* break an abstraction and copy some code for performance purposes */
|
/* break an abstraction and copy some code for performance purposes */
|
||||||
static int local_book_besterror(codebook *book,float *a){
|
static int local_book_besterror(codebook *book,int *a){
|
||||||
int dim=book->dim,i,k,o;
|
int dim=book->dim;
|
||||||
int best=0;
|
int i,j,o;
|
||||||
encode_aux_threshmatch *tt=book->c->thresh_tree;
|
int minval=book->minval;
|
||||||
|
int del=book->delta;
|
||||||
/* find the quant val of each scalar */
|
int qv=book->quantvals;
|
||||||
for(k=0,o=dim;k<dim;++k){
|
int ze=(qv>>1);
|
||||||
float val=a[--o];
|
int index=0;
|
||||||
i=tt->threshvals>>1;
|
/* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */
|
||||||
|
int p[8]={0,0,0,0,0,0,0,0};
|
||||||
if(val<tt->quantthresh[i]){
|
|
||||||
if(val<tt->quantthresh[i-1]){
|
|
||||||
for(--i;i>0;--i)
|
|
||||||
if(val>=tt->quantthresh[i-1])
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
|
|
||||||
for(++i;i<tt->threshvals-1;++i)
|
|
||||||
if(val<tt->quantthresh[i])break;
|
|
||||||
|
|
||||||
|
if(del!=1){
|
||||||
|
for(i=0,o=dim;i<dim;i++){
|
||||||
|
int v = (a[--o]-minval+(del>>1))/del;
|
||||||
|
int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1));
|
||||||
|
index = index*qv+ (m<0?0:(m>=qv?qv-1:m));
|
||||||
|
p[o]=v*del+minval;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
for(i=0,o=dim;i<dim;i++){
|
||||||
|
int v = a[--o]-minval;
|
||||||
|
int m = (v<ze ? ((ze-v)<<1)-1 : ((v-ze)<<1));
|
||||||
|
index = index*qv+ (m<0?0:(m>=qv?qv-1:m));
|
||||||
|
p[o]=v*del+minval;
|
||||||
}
|
}
|
||||||
|
|
||||||
best=(best*tt->quantvals)+tt->quantmap[i];
|
|
||||||
}
|
}
|
||||||
/* regular lattices are easy :-) */
|
|
||||||
|
|
||||||
if(book->c->lengthlist[best]<=0){
|
if(book->c->lengthlist[index]<=0){
|
||||||
const static_codebook *c=book->c;
|
const static_codebook *c=book->c;
|
||||||
int i,j;
|
int best=-1;
|
||||||
float bestf=0.f;
|
/* assumes integer/centered encoder codebook maptype 1 no more than dim 8 */
|
||||||
float *e=book->valuelist;
|
int e[8]={0,0,0,0,0,0,0,0};
|
||||||
best=-1;
|
int maxval = book->minval + book->delta*(book->quantvals-1);
|
||||||
for(i=0;i<book->entries;i++){
|
for(i=0;i<book->entries;i++){
|
||||||
if(c->lengthlist[i]>0){
|
if(c->lengthlist[i]>0){
|
||||||
float this=0.f;
|
int this=0;
|
||||||
for(j=0;j<dim;j++){
|
for(j=0;j<dim;j++){
|
||||||
float val=(e[j]-a[j]);
|
int val=(e[j]-a[j]);
|
||||||
this+=val*val;
|
this+=val*val;
|
||||||
}
|
}
|
||||||
if(best==-1 || this<bestf){
|
if(best==-1 || this<best){
|
||||||
bestf=this;
|
memcpy(p,e,sizeof(p));
|
||||||
best=i;
|
best=this;
|
||||||
}
|
index=i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e+=dim;
|
/* assumes the value patterning created by the tools in vq/ */
|
||||||
|
j=0;
|
||||||
|
while(e[j]>=maxval)
|
||||||
|
e[j++]=0;
|
||||||
|
if(e[j]>=0)
|
||||||
|
e[j]+=book->delta;
|
||||||
|
e[j]= -e[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(best>-1){
|
if(index>-1){
|
||||||
float *ptr=book->valuelist+best*dim;
|
|
||||||
for(i=0;i<dim;i++)
|
for(i=0;i<dim;i++)
|
||||||
*a++ -= *ptr++;
|
*a++ -= p[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return(best);
|
return(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _encodepart(oggpack_buffer *opb,float *vec, int n,
|
static int _encodepart(oggpack_buffer *opb,int *vec, int n,
|
||||||
codebook *book,long *acc){
|
codebook *book,long *acc){
|
||||||
int i,bits=0;
|
int i,bits=0;
|
||||||
int dim=book->dim;
|
int dim=book->dim;
|
||||||
int step=n/dim;
|
int step=n/dim;
|
||||||
|
|
@ -355,7 +400,7 @@ static int _encodepart(oggpack_buffer *opb,float *vec, int n,
|
||||||
int entry=local_book_besterror(book,vec+i*dim);
|
int entry=local_book_besterror(book,vec+i*dim);
|
||||||
|
|
||||||
#ifdef TRAIN_RES
|
#ifdef TRAIN_RES
|
||||||
if(entry>0)
|
if(entry>=0)
|
||||||
acc[entry]++;
|
acc[entry]++;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -367,12 +412,10 @@ static int _encodepart(oggpack_buffer *opb,float *vec, int n,
|
||||||
}
|
}
|
||||||
|
|
||||||
static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
|
static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,int ch){
|
int **in,int ch){
|
||||||
long i,j,k;
|
long i,j,k;
|
||||||
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
||||||
vorbis_info_residue0 *info=look->info;
|
vorbis_info_residue0 *info=look->info;
|
||||||
vorbis_info *vi=vb->vd->vi;
|
|
||||||
codec_setup_info *ci=vi->codec_setup;
|
|
||||||
|
|
||||||
/* move all this setup out later */
|
/* move all this setup out later */
|
||||||
int samples_per_partition=info->grouping;
|
int samples_per_partition=info->grouping;
|
||||||
|
|
@ -395,18 +438,18 @@ static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
for(i=0;i<partvals;i++){
|
for(i=0;i<partvals;i++){
|
||||||
int offset=i*samples_per_partition+info->begin;
|
int offset=i*samples_per_partition+info->begin;
|
||||||
for(j=0;j<ch;j++){
|
for(j=0;j<ch;j++){
|
||||||
float max=0.;
|
int max=0;
|
||||||
float ent=0.;
|
int ent=0;
|
||||||
for(k=0;k<samples_per_partition;k++){
|
for(k=0;k<samples_per_partition;k++){
|
||||||
if(fabs(in[j][offset+k])>max)max=fabs(in[j][offset+k]);
|
if(abs(in[j][offset+k])>max)max=abs(in[j][offset+k]);
|
||||||
ent+=fabs(rint(in[j][offset+k]));
|
ent+=abs(in[j][offset+k]);
|
||||||
}
|
}
|
||||||
ent*=scale;
|
ent*=scale;
|
||||||
|
|
||||||
for(k=0;k<possible_partitions-1;k++)
|
for(k=0;k<possible_partitions-1;k++)
|
||||||
if(max<=info->classmetric1[k] &&
|
if(max<=info->classmetric1[k] &&
|
||||||
(info->classmetric2[k]<0 || (int)ent<info->classmetric2[k]))
|
(info->classmetric2[k]<0 || ent<info->classmetric2[k]))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
partword[j][i]=k;
|
partword[j][i]=k;
|
||||||
}
|
}
|
||||||
|
|
@ -421,7 +464,7 @@ static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
sprintf(buffer,"resaux_%d.vqd",look->train_seq);
|
sprintf(buffer,"resaux_%d.vqd",look->train_seq);
|
||||||
of=fopen(buffer,"a");
|
of=fopen(buffer,"a");
|
||||||
for(j=0;j<partvals;j++)
|
for(j=0;j<partvals;j++)
|
||||||
fprintf(of,"%ld, ",partword[i][j]);
|
fprintf(of,"%ld, ",partword[i][j]);
|
||||||
fprintf(of,"\n");
|
fprintf(of,"\n");
|
||||||
fclose(of);
|
fclose(of);
|
||||||
}
|
}
|
||||||
|
|
@ -435,8 +478,8 @@ static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
/* designed for stereo or other modes where the partition size is an
|
/* designed for stereo or other modes where the partition size is an
|
||||||
integer multiple of the number of channels encoded in the current
|
integer multiple of the number of channels encoded in the current
|
||||||
submap */
|
submap */
|
||||||
static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in,
|
static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,int **in,
|
||||||
int ch){
|
int ch){
|
||||||
long i,j,k,l;
|
long i,j,k,l;
|
||||||
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
||||||
vorbis_info_residue0 *info=look->info;
|
vorbis_info_residue0 *info=look->info;
|
||||||
|
|
@ -454,23 +497,23 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in,
|
||||||
char buffer[80];
|
char buffer[80];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0]));
|
partword[0]=_vorbis_block_alloc(vb,partvals*sizeof(*partword[0]));
|
||||||
memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0]));
|
memset(partword[0],0,partvals*sizeof(*partword[0]));
|
||||||
|
|
||||||
for(i=0,l=info->begin/ch;i<partvals;i++){
|
for(i=0,l=info->begin/ch;i<partvals;i++){
|
||||||
float magmax=0.f;
|
int magmax=0;
|
||||||
float angmax=0.f;
|
int angmax=0;
|
||||||
for(j=0;j<samples_per_partition;j+=ch){
|
for(j=0;j<samples_per_partition;j+=ch){
|
||||||
if(fabs(in[0][l])>magmax)magmax=fabs(in[0][l]);
|
if(abs(in[0][l])>magmax)magmax=abs(in[0][l]);
|
||||||
for(k=1;k<ch;k++)
|
for(k=1;k<ch;k++)
|
||||||
if(fabs(in[k][l])>angmax)angmax=fabs(in[k][l]);
|
if(abs(in[k][l])>angmax)angmax=abs(in[k][l]);
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(j=0;j<possible_partitions-1;j++)
|
for(j=0;j<possible_partitions-1;j++)
|
||||||
if(magmax<=info->classmetric1[j] &&
|
if(magmax<=info->classmetric1[j] &&
|
||||||
angmax<=info->classmetric2[j])
|
angmax<=info->classmetric2[j])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
partword[0][i]=j;
|
partword[0][i]=j;
|
||||||
|
|
||||||
|
|
@ -491,16 +534,19 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _01forward(oggpack_buffer *opb,
|
static int _01forward(oggpack_buffer *opb,
|
||||||
vorbis_block *vb,vorbis_look_residue *vl,
|
vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,int ch,
|
int **in,int ch,
|
||||||
long **partword,
|
long **partword,
|
||||||
int (*encode)(oggpack_buffer *,float *,int,
|
int (*encode)(oggpack_buffer *,int *,int,
|
||||||
codebook *,long *)){
|
codebook *,long *),
|
||||||
|
int submap){
|
||||||
long i,j,k,s;
|
long i,j,k,s;
|
||||||
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
||||||
vorbis_info_residue0 *info=look->info;
|
vorbis_info_residue0 *info=look->info;
|
||||||
|
|
||||||
vorbis_dsp_state *vd=vb->vd;
|
#ifdef TRAIN_RES
|
||||||
|
look->submap=submap;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* move all this setup out later */
|
/* move all this setup out later */
|
||||||
int samples_per_partition=info->grouping;
|
int samples_per_partition=info->grouping;
|
||||||
|
|
@ -514,7 +560,7 @@ static int _01forward(oggpack_buffer *opb,
|
||||||
|
|
||||||
#ifdef TRAIN_RES
|
#ifdef TRAIN_RES
|
||||||
for(i=0;i<ch;i++)
|
for(i=0;i<ch;i++)
|
||||||
for(j=info->begin;j<end;j++){
|
for(j=info->begin;j<info->end;j++){
|
||||||
if(in[i][j]>look->tmax)look->tmax=in[i][j];
|
if(in[i][j]>look->tmax)look->tmax=in[i][j];
|
||||||
if(in[i][j]<look->tmin)look->tmin=in[i][j];
|
if(in[i][j]<look->tmin)look->tmin=in[i][j];
|
||||||
}
|
}
|
||||||
|
|
@ -534,59 +580,59 @@ static int _01forward(oggpack_buffer *opb,
|
||||||
|
|
||||||
/* first we encode a partition codeword for each channel */
|
/* first we encode a partition codeword for each channel */
|
||||||
if(s==0){
|
if(s==0){
|
||||||
for(j=0;j<ch;j++){
|
for(j=0;j<ch;j++){
|
||||||
long val=partword[j][i];
|
long val=partword[j][i];
|
||||||
for(k=1;k<partitions_per_word;k++){
|
for(k=1;k<partitions_per_word;k++){
|
||||||
val*=possible_partitions;
|
val*=possible_partitions;
|
||||||
if(i+k<partvals)
|
if(i+k<partvals)
|
||||||
val+=partword[j][i+k];
|
val+=partword[j][i+k];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* training hack */
|
/* training hack */
|
||||||
if(val<look->phrasebook->entries)
|
if(val<look->phrasebook->entries)
|
||||||
look->phrasebits+=vorbis_book_encode(look->phrasebook,val,opb);
|
look->phrasebits+=vorbis_book_encode(look->phrasebook,val,opb);
|
||||||
#if 0 /*def TRAIN_RES*/
|
#if 0 /*def TRAIN_RES*/
|
||||||
else
|
else
|
||||||
fprintf(stderr,"!");
|
fprintf(stderr,"!");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now we encode interleaved residual values for the partitions */
|
/* now we encode interleaved residual values for the partitions */
|
||||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++){
|
for(k=0;k<partitions_per_word && i<partvals;k++,i++){
|
||||||
long offset=i*samples_per_partition+info->begin;
|
long offset=i*samples_per_partition+info->begin;
|
||||||
|
|
||||||
for(j=0;j<ch;j++){
|
for(j=0;j<ch;j++){
|
||||||
if(s==0)resvals[partword[j][i]]+=samples_per_partition;
|
if(s==0)resvals[partword[j][i]]+=samples_per_partition;
|
||||||
if(info->secondstages[partword[j][i]]&(1<<s)){
|
if(info->secondstages[partword[j][i]]&(1<<s)){
|
||||||
codebook *statebook=look->partbooks[partword[j][i]][s];
|
codebook *statebook=look->partbooks[partword[j][i]][s];
|
||||||
if(statebook){
|
if(statebook){
|
||||||
int ret;
|
int ret;
|
||||||
long *accumulator=NULL;
|
long *accumulator=NULL;
|
||||||
|
|
||||||
#ifdef TRAIN_RES
|
#ifdef TRAIN_RES
|
||||||
accumulator=look->training_data[s][partword[j][i]];
|
accumulator=look->training_data[s][partword[j][i]];
|
||||||
{
|
{
|
||||||
int l;
|
int l;
|
||||||
float *samples=in[j]+offset;
|
int *samples=in[j]+offset;
|
||||||
for(l=0;l<samples_per_partition;l++){
|
for(l=0;l<samples_per_partition;l++){
|
||||||
if(samples[l]<look->training_min[s][partword[j][i]])
|
if(samples[l]<look->training_min[s][partword[j][i]])
|
||||||
look->training_min[s][partword[j][i]]=samples[l];
|
look->training_min[s][partword[j][i]]=samples[l];
|
||||||
if(samples[l]>look->training_max[s][partword[j][i]])
|
if(samples[l]>look->training_max[s][partword[j][i]])
|
||||||
look->training_max[s][partword[j][i]]=samples[l];
|
look->training_max[s][partword[j][i]]=samples[l];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret=encode(opb,in[j]+offset,samples_per_partition,
|
ret=encode(opb,in[j]+offset,samples_per_partition,
|
||||||
statebook,accumulator);
|
statebook,accumulator);
|
||||||
|
|
||||||
look->postbits+=ret;
|
look->postbits+=ret;
|
||||||
resbits[partword[j][i]]+=ret;
|
resbits[partword[j][i]]+=ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -609,9 +655,9 @@ static int _01forward(oggpack_buffer *opb,
|
||||||
|
|
||||||
/* a truncated packet here just means 'stop working'; it's not an error */
|
/* a truncated packet here just means 'stop working'; it's not an error */
|
||||||
static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,int ch,
|
float **in,int ch,
|
||||||
long (*decodepart)(codebook *, float *,
|
long (*decodepart)(codebook *, float *,
|
||||||
oggpack_buffer *,int)){
|
oggpack_buffer *,int)){
|
||||||
|
|
||||||
long i,j,k,l,s;
|
long i,j,k,l,s;
|
||||||
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
||||||
|
|
@ -635,31 +681,31 @@ static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
for(s=0;s<look->stages;s++){
|
for(s=0;s<look->stages;s++){
|
||||||
|
|
||||||
/* each loop decodes on partition codeword containing
|
/* each loop decodes on partition codeword containing
|
||||||
partitions_per_word partitions */
|
partitions_per_word partitions */
|
||||||
for(i=0,l=0;i<partvals;l++){
|
for(i=0,l=0;i<partvals;l++){
|
||||||
if(s==0){
|
if(s==0){
|
||||||
/* fetch the partition word for each channel */
|
/* fetch the partition word for each channel */
|
||||||
for(j=0;j<ch;j++){
|
for(j=0;j<ch;j++){
|
||||||
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
|
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
|
||||||
|
|
||||||
if(temp==-1)goto eopbreak;
|
if(temp==-1 || temp>=info->partvals)goto eopbreak;
|
||||||
partword[j][l]=look->decodemap[temp];
|
partword[j][l]=look->decodemap[temp];
|
||||||
if(partword[j][l]==NULL)goto errout;
|
if(partword[j][l]==NULL)goto errout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now we decode residual values for the partitions */
|
/* now we decode residual values for the partitions */
|
||||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
||||||
for(j=0;j<ch;j++){
|
for(j=0;j<ch;j++){
|
||||||
long offset=info->begin+i*samples_per_partition;
|
long offset=info->begin+i*samples_per_partition;
|
||||||
if(info->secondstages[partword[j][l][k]]&(1<<s)){
|
if(info->secondstages[partword[j][l][k]]&(1<<s)){
|
||||||
codebook *stagebook=look->partbooks[partword[j][l][k]][s];
|
codebook *stagebook=look->partbooks[partword[j][l][k]][s];
|
||||||
if(stagebook){
|
if(stagebook){
|
||||||
if(decodepart(stagebook,in[j]+offset,&vb->opb,
|
if(decodepart(stagebook,in[j]+offset,&vb->opb,
|
||||||
samples_per_partition)==-1)goto eopbreak;
|
samples_per_partition)==-1)goto eopbreak;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -668,56 +714,8 @@ static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* residue 0 and 1 are just slight variants of one another. 0 is
|
|
||||||
interleaved, 1 is not */
|
|
||||||
long **res0_class(vorbis_block *vb,vorbis_look_residue *vl,
|
|
||||||
float **in,int *nonzero,int ch){
|
|
||||||
/* we encode only the nonzero parts of a bundle */
|
|
||||||
int i,used=0;
|
|
||||||
for(i=0;i<ch;i++)
|
|
||||||
if(nonzero[i])
|
|
||||||
in[used++]=in[i];
|
|
||||||
if(used)
|
|
||||||
/*return(_01class(vb,vl,in,used,_interleaved_testhack));*/
|
|
||||||
return(_01class(vb,vl,in,used));
|
|
||||||
else
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int res0_forward(vorbis_block *vb,vorbis_look_residue *vl,
|
|
||||||
float **in,float **out,int *nonzero,int ch,
|
|
||||||
long **partword){
|
|
||||||
/* we encode only the nonzero parts of a bundle */
|
|
||||||
int i,j,used=0,n=vb->pcmend/2;
|
|
||||||
for(i=0;i<ch;i++)
|
|
||||||
if(nonzero[i]){
|
|
||||||
if(out)
|
|
||||||
for(j=0;j<n;j++)
|
|
||||||
out[i][j]+=in[i][j];
|
|
||||||
in[used++]=in[i];
|
|
||||||
}
|
|
||||||
if(used){
|
|
||||||
int ret=_01forward(vb,vl,in,used,partword,
|
|
||||||
_interleaved_encodepart);
|
|
||||||
if(out){
|
|
||||||
used=0;
|
|
||||||
for(i=0;i<ch;i++)
|
|
||||||
if(nonzero[i]){
|
|
||||||
for(j=0;j<n;j++)
|
|
||||||
out[i][j]-=in[used][j];
|
|
||||||
used++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(ret);
|
|
||||||
}else{
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,int *nonzero,int ch){
|
float **in,int *nonzero,int ch){
|
||||||
int i,used=0;
|
int i,used=0;
|
||||||
for(i=0;i<ch;i++)
|
for(i=0;i<ch;i++)
|
||||||
if(nonzero[i])
|
if(nonzero[i])
|
||||||
|
|
@ -729,36 +727,21 @@ int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
}
|
}
|
||||||
|
|
||||||
int res1_forward(oggpack_buffer *opb,vorbis_block *vb,vorbis_look_residue *vl,
|
int res1_forward(oggpack_buffer *opb,vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,float **out,int *nonzero,int ch,
|
int **in,int *nonzero,int ch, long **partword, int submap){
|
||||||
long **partword){
|
int i,used=0;
|
||||||
int i,j,used=0,n=vb->pcmend/2;
|
|
||||||
for(i=0;i<ch;i++)
|
for(i=0;i<ch;i++)
|
||||||
if(nonzero[i]){
|
if(nonzero[i])
|
||||||
if(out)
|
|
||||||
for(j=0;j<n;j++)
|
|
||||||
out[i][j]+=in[i][j];
|
|
||||||
in[used++]=in[i];
|
in[used++]=in[i];
|
||||||
}
|
|
||||||
|
|
||||||
if(used){
|
if(used){
|
||||||
int ret=_01forward(opb,vb,vl,in,used,partword,_encodepart);
|
return _01forward(opb,vb,vl,in,used,partword,_encodepart,submap);
|
||||||
if(out){
|
|
||||||
used=0;
|
|
||||||
for(i=0;i<ch;i++)
|
|
||||||
if(nonzero[i]){
|
|
||||||
for(j=0;j<n;j++)
|
|
||||||
out[i][j]-=in[used][j];
|
|
||||||
used++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(ret);
|
|
||||||
}else{
|
}else{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
long **res1_class(vorbis_block *vb,vorbis_look_residue *vl,
|
long **res1_class(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,int *nonzero,int ch){
|
int **in,int *nonzero,int ch){
|
||||||
int i,used=0;
|
int i,used=0;
|
||||||
for(i=0;i<ch;i++)
|
for(i=0;i<ch;i++)
|
||||||
if(nonzero[i])
|
if(nonzero[i])
|
||||||
|
|
@ -770,7 +753,7 @@ long **res1_class(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
}
|
}
|
||||||
|
|
||||||
int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,int *nonzero,int ch){
|
float **in,int *nonzero,int ch){
|
||||||
int i,used=0;
|
int i,used=0;
|
||||||
for(i=0;i<ch;i++)
|
for(i=0;i<ch;i++)
|
||||||
if(nonzero[i])
|
if(nonzero[i])
|
||||||
|
|
@ -782,7 +765,7 @@ int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
}
|
}
|
||||||
|
|
||||||
long **res2_class(vorbis_block *vb,vorbis_look_residue *vl,
|
long **res2_class(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,int *nonzero,int ch){
|
int **in,int *nonzero,int ch){
|
||||||
int i,used=0;
|
int i,used=0;
|
||||||
for(i=0;i<ch;i++)
|
for(i=0;i<ch;i++)
|
||||||
if(nonzero[i])used++;
|
if(nonzero[i])used++;
|
||||||
|
|
@ -796,35 +779,23 @@ long **res2_class(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
into a single vector and encoded. */
|
into a single vector and encoded. */
|
||||||
|
|
||||||
int res2_forward(oggpack_buffer *opb,
|
int res2_forward(oggpack_buffer *opb,
|
||||||
vorbis_block *vb,vorbis_look_residue *vl,
|
vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,float **out,int *nonzero,int ch,
|
int **in,int *nonzero,int ch, long **partword,int submap){
|
||||||
long **partword){
|
|
||||||
long i,j,k,n=vb->pcmend/2,used=0;
|
long i,j,k,n=vb->pcmend/2,used=0;
|
||||||
|
|
||||||
/* don't duplicate the code; use a working vector hack for now and
|
/* don't duplicate the code; use a working vector hack for now and
|
||||||
reshape ourselves into a single channel res1 */
|
reshape ourselves into a single channel res1 */
|
||||||
/* ugly; reallocs for each coupling pass :-( */
|
/* ugly; reallocs for each coupling pass :-( */
|
||||||
float *work=_vorbis_block_alloc(vb,ch*n*sizeof(*work));
|
int *work=_vorbis_block_alloc(vb,ch*n*sizeof(*work));
|
||||||
for(i=0;i<ch;i++){
|
for(i=0;i<ch;i++){
|
||||||
float *pcm=in[i];
|
int *pcm=in[i];
|
||||||
if(nonzero[i])used++;
|
if(nonzero[i])used++;
|
||||||
for(j=0,k=i;j<n;j++,k+=ch)
|
for(j=0,k=i;j<n;j++,k+=ch)
|
||||||
work[k]=pcm[j];
|
work[k]=pcm[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(used){
|
if(used){
|
||||||
int ret=_01forward(opb,vb,vl,&work,1,partword,_encodepart);
|
return _01forward(opb,vb,vl,&work,1,partword,_encodepart,submap);
|
||||||
/* update the sofar vector */
|
|
||||||
if(out){
|
|
||||||
for(i=0;i<ch;i++){
|
|
||||||
float *pcm=in[i];
|
|
||||||
float *sofar=out[i];
|
|
||||||
for(j=0,k=i;j<n;j++,k+=ch)
|
|
||||||
sofar[j]+=pcm[j]-work[k];
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return(ret);
|
|
||||||
}else{
|
}else{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
@ -832,7 +803,7 @@ int res2_forward(oggpack_buffer *opb,
|
||||||
|
|
||||||
/* duplicate code here as speed is somewhat more important */
|
/* duplicate code here as speed is somewhat more important */
|
||||||
int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
float **in,int *nonzero,int ch){
|
float **in,int *nonzero,int ch){
|
||||||
long i,k,l,s;
|
long i,k,l,s;
|
||||||
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
||||||
vorbis_info_residue0 *info=look->info;
|
vorbis_info_residue0 *info=look->info;
|
||||||
|
|
@ -855,26 +826,26 @@ int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
for(s=0;s<look->stages;s++){
|
for(s=0;s<look->stages;s++){
|
||||||
for(i=0,l=0;i<partvals;l++){
|
for(i=0,l=0;i<partvals;l++){
|
||||||
|
|
||||||
if(s==0){
|
if(s==0){
|
||||||
/* fetch the partition word */
|
/* fetch the partition word */
|
||||||
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
|
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
|
||||||
if(temp==-1)goto eopbreak;
|
if(temp==-1 || temp>=info->partvals)goto eopbreak;
|
||||||
partword[l]=look->decodemap[temp];
|
partword[l]=look->decodemap[temp];
|
||||||
if(partword[l]==NULL)goto errout;
|
if(partword[l]==NULL)goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now we decode residual values for the partitions */
|
/* now we decode residual values for the partitions */
|
||||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
||||||
if(info->secondstages[partword[l][k]]&(1<<s)){
|
if(info->secondstages[partword[l][k]]&(1<<s)){
|
||||||
codebook *stagebook=look->partbooks[partword[l][k]][s];
|
codebook *stagebook=look->partbooks[partword[l][k]][s];
|
||||||
|
|
||||||
if(stagebook){
|
if(stagebook){
|
||||||
if(vorbis_book_decodevv_add(stagebook,in,
|
if(vorbis_book_decodevv_add(stagebook,in,
|
||||||
i*samples_per_partition+info->begin,ch,
|
i*samples_per_partition+info->begin,ch,
|
||||||
&vb->opb,samples_per_partition)==-1)
|
&vb->opb,samples_per_partition)==-1)
|
||||||
goto eopbreak;
|
goto eopbreak;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -884,7 +855,7 @@ int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
vorbis_func_residue residue0_exportbundle={
|
const vorbis_func_residue residue0_exportbundle={
|
||||||
NULL,
|
NULL,
|
||||||
&res0_unpack,
|
&res0_unpack,
|
||||||
&res0_look,
|
&res0_look,
|
||||||
|
|
@ -895,7 +866,7 @@ vorbis_func_residue residue0_exportbundle={
|
||||||
&res0_inverse
|
&res0_inverse
|
||||||
};
|
};
|
||||||
|
|
||||||
vorbis_func_residue residue1_exportbundle={
|
const vorbis_func_residue residue1_exportbundle={
|
||||||
&res0_pack,
|
&res0_pack,
|
||||||
&res0_unpack,
|
&res0_unpack,
|
||||||
&res0_look,
|
&res0_look,
|
||||||
|
|
@ -906,7 +877,7 @@ vorbis_func_residue residue1_exportbundle={
|
||||||
&res1_inverse
|
&res1_inverse
|
||||||
};
|
};
|
||||||
|
|
||||||
vorbis_func_residue residue2_exportbundle={
|
const vorbis_func_residue residue2_exportbundle={
|
||||||
&res0_pack,
|
&res0_pack,
|
||||||
&res0_unpack,
|
&res0_unpack,
|
||||||
&res0_look,
|
&res0_look,
|
||||||
|
|
@ -916,4 +887,3 @@ vorbis_func_residue residue2_exportbundle={
|
||||||
&res2_forward,
|
&res2_forward,
|
||||||
&res2_inverse
|
&res2_inverse
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: linear scale -> dB, Bark and Mel scales
|
function: linear scale -> dB, Bark and Mel scales
|
||||||
last mod: $Id: scales.h 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: scales.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -21,11 +21,16 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
/* MS Visual Studio doesn't have C99 inline keyword. */
|
||||||
|
#define inline __inline
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 20log10(x) */
|
/* 20log10(x) */
|
||||||
#define VORBIS_IEEE_FLOAT32 1
|
#define VORBIS_IEEE_FLOAT32 1
|
||||||
#ifdef VORBIS_IEEE_FLOAT32
|
#ifdef VORBIS_IEEE_FLOAT32
|
||||||
|
|
||||||
static float unitnorm(float x){
|
static inline float unitnorm(float x){
|
||||||
union {
|
union {
|
||||||
ogg_uint32_t i;
|
ogg_uint32_t i;
|
||||||
float f;
|
float f;
|
||||||
|
|
@ -36,7 +41,7 @@ static float unitnorm(float x){
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */
|
/* Segher was off (too high) by ~ .3 decibel. Center the conversion correctly. */
|
||||||
static float todB(const float *x){
|
static inline float todB(const float *x){
|
||||||
union {
|
union {
|
||||||
ogg_uint32_t i;
|
ogg_uint32_t i;
|
||||||
float f;
|
float f;
|
||||||
|
|
@ -83,4 +88,3 @@ static float unitnorm(float x){
|
||||||
#define fromOC(o) (exp(((o)+5.965784f)*.693147f))
|
#define fromOC(o) (exp(((o)+5.965784f)*.693147f))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: basic shared codebook operations
|
function: basic shared codebook operations
|
||||||
last mod: $Id: sharedbook.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: sharedbook.c 17030 2010-03-25 06:52:55Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -52,7 +52,7 @@ long _float32_pack(float val){
|
||||||
sign=0x80000000;
|
sign=0x80000000;
|
||||||
val= -val;
|
val= -val;
|
||||||
}
|
}
|
||||||
exp= floor(log(val)/log(2.f));
|
exp= floor(log(val)/log(2.f)+.001); //+epsilon
|
||||||
mant=rint(ldexp(val,(VQ_FMAN-1)-exp));
|
mant=rint(ldexp(val,(VQ_FMAN-1)-exp));
|
||||||
exp=(exp+VQ_FEXP_BIAS)<<VQ_FMAN;
|
exp=(exp+VQ_FEXP_BIAS)<<VQ_FMAN;
|
||||||
|
|
||||||
|
|
@ -82,49 +82,62 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
||||||
ogg_uint32_t entry=marker[length];
|
ogg_uint32_t entry=marker[length];
|
||||||
|
|
||||||
/* when we claim a node for an entry, we also claim the nodes
|
/* when we claim a node for an entry, we also claim the nodes
|
||||||
below it (pruning off the imagined tree that may have dangled
|
below it (pruning off the imagined tree that may have dangled
|
||||||
from it) as well as blocking the use of any nodes directly
|
from it) as well as blocking the use of any nodes directly
|
||||||
above for leaves */
|
above for leaves */
|
||||||
|
|
||||||
/* update ourself */
|
/* update ourself */
|
||||||
if(length<32 && (entry>>length)){
|
if(length<32 && (entry>>length)){
|
||||||
/* error condition; the lengths must specify an overpopulated tree */
|
/* error condition; the lengths must specify an overpopulated tree */
|
||||||
_ogg_free(r);
|
_ogg_free(r);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
r[count++]=entry;
|
r[count++]=entry;
|
||||||
|
|
||||||
/* Look to see if the next shorter marker points to the node
|
/* Look to see if the next shorter marker points to the node
|
||||||
above. if so, update it and repeat. */
|
above. if so, update it and repeat. */
|
||||||
{
|
{
|
||||||
for(j=length;j>0;j--){
|
for(j=length;j>0;j--){
|
||||||
|
|
||||||
if(marker[j]&1){
|
if(marker[j]&1){
|
||||||
/* have to jump branches */
|
/* have to jump branches */
|
||||||
if(j==1)
|
if(j==1)
|
||||||
marker[1]++;
|
marker[1]++;
|
||||||
else
|
else
|
||||||
marker[j]=marker[j-1]<<1;
|
marker[j]=marker[j-1]<<1;
|
||||||
break; /* invariant says next upper marker would already
|
break; /* invariant says next upper marker would already
|
||||||
have been moved if it was on the same path */
|
have been moved if it was on the same path */
|
||||||
}
|
}
|
||||||
marker[j]++;
|
marker[j]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prune the tree; the implicit invariant says all the longer
|
/* prune the tree; the implicit invariant says all the longer
|
||||||
markers were dangling from our just-taken node. Dangle them
|
markers were dangling from our just-taken node. Dangle them
|
||||||
from our *new* node. */
|
from our *new* node. */
|
||||||
for(j=length+1;j<33;j++)
|
for(j=length+1;j<33;j++)
|
||||||
if((marker[j]>>1) == entry){
|
if((marker[j]>>1) == entry){
|
||||||
entry=marker[j];
|
entry=marker[j];
|
||||||
marker[j]=marker[j-1]<<1;
|
marker[j]=marker[j-1]<<1;
|
||||||
}else
|
}else
|
||||||
break;
|
break;
|
||||||
}else
|
}else
|
||||||
if(sparsecount==0)count++;
|
if(sparsecount==0)count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* sanity check the huffman tree; an underpopulated tree must be
|
||||||
|
rejected. The only exception is the one-node pseudo-nil tree,
|
||||||
|
which appears to be underpopulated because the tree doesn't
|
||||||
|
really exist; there's only one possible 'codeword' or zero bits,
|
||||||
|
but the above tree-gen code doesn't mark that. */
|
||||||
|
if(sparsecount != 1){
|
||||||
|
for(i=1;i<33;i++)
|
||||||
|
if(marker[i] & (0xffffffffUL>>(32-i))){
|
||||||
|
_ogg_free(r);
|
||||||
|
return(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* bitreverse the words because our bitwise packer/unpacker is LSb
|
/* bitreverse the words because our bitwise packer/unpacker is LSb
|
||||||
endian */
|
endian */
|
||||||
for(i=0,count=0;i<n;i++){
|
for(i=0,count=0;i<n;i++){
|
||||||
|
|
@ -136,7 +149,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
||||||
|
|
||||||
if(sparsecount){
|
if(sparsecount){
|
||||||
if(l[i])
|
if(l[i])
|
||||||
r[count++]=temp;
|
r[count++]=temp;
|
||||||
}else
|
}else
|
||||||
r[count++]=temp;
|
r[count++]=temp;
|
||||||
}
|
}
|
||||||
|
|
@ -167,9 +180,9 @@ long _book_maptype1_quantvals(const static_codebook *b){
|
||||||
return(vals);
|
return(vals);
|
||||||
}else{
|
}else{
|
||||||
if(acc>b->entries){
|
if(acc>b->entries){
|
||||||
vals--;
|
vals--;
|
||||||
}else{
|
}else{
|
||||||
vals++;
|
vals++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -193,49 +206,49 @@ float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){
|
||||||
switch(b->maptype){
|
switch(b->maptype){
|
||||||
case 1:
|
case 1:
|
||||||
/* most of the time, entries%dimensions == 0, but we need to be
|
/* most of the time, entries%dimensions == 0, but we need to be
|
||||||
well defined. We define that the possible vales at each
|
well defined. We define that the possible vales at each
|
||||||
scalar is values == entries/dim. If entries%dim != 0, we'll
|
scalar is values == entries/dim. If entries%dim != 0, we'll
|
||||||
have 'too few' values (values*dim<entries), which means that
|
have 'too few' values (values*dim<entries), which means that
|
||||||
we'll have 'left over' entries; left over entries use zeroed
|
we'll have 'left over' entries; left over entries use zeroed
|
||||||
values (and are wasted). So don't generate codebooks like
|
values (and are wasted). So don't generate codebooks like
|
||||||
that */
|
that */
|
||||||
quantvals=_book_maptype1_quantvals(b);
|
quantvals=_book_maptype1_quantvals(b);
|
||||||
for(j=0;j<b->entries;j++){
|
for(j=0;j<b->entries;j++){
|
||||||
if((sparsemap && b->lengthlist[j]) || !sparsemap){
|
if((sparsemap && b->lengthlist[j]) || !sparsemap){
|
||||||
float last=0.f;
|
float last=0.f;
|
||||||
int indexdiv=1;
|
int indexdiv=1;
|
||||||
for(k=0;k<b->dim;k++){
|
for(k=0;k<b->dim;k++){
|
||||||
int index= (j/indexdiv)%quantvals;
|
int index= (j/indexdiv)%quantvals;
|
||||||
float val=b->quantlist[index];
|
float val=b->quantlist[index];
|
||||||
val=fabs(val)*delta+mindel+last;
|
val=fabs(val)*delta+mindel+last;
|
||||||
if(b->q_sequencep)last=val;
|
if(b->q_sequencep)last=val;
|
||||||
if(sparsemap)
|
if(sparsemap)
|
||||||
r[sparsemap[count]*b->dim+k]=val;
|
r[sparsemap[count]*b->dim+k]=val;
|
||||||
else
|
else
|
||||||
r[count*b->dim+k]=val;
|
r[count*b->dim+k]=val;
|
||||||
indexdiv*=quantvals;
|
indexdiv*=quantvals;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
for(j=0;j<b->entries;j++){
|
for(j=0;j<b->entries;j++){
|
||||||
if((sparsemap && b->lengthlist[j]) || !sparsemap){
|
if((sparsemap && b->lengthlist[j]) || !sparsemap){
|
||||||
float last=0.f;
|
float last=0.f;
|
||||||
|
|
||||||
for(k=0;k<b->dim;k++){
|
for(k=0;k<b->dim;k++){
|
||||||
float val=b->quantlist[j*b->dim+k];
|
float val=b->quantlist[j*b->dim+k];
|
||||||
val=fabs(val)*delta+mindel+last;
|
val=fabs(val)*delta+mindel+last;
|
||||||
if(b->q_sequencep)last=val;
|
if(b->q_sequencep)last=val;
|
||||||
if(sparsemap)
|
if(sparsemap)
|
||||||
r[sparsemap[count]*b->dim+k]=val;
|
r[sparsemap[count]*b->dim+k]=val;
|
||||||
else
|
else
|
||||||
r[count*b->dim+k]=val;
|
r[count*b->dim+k]=val;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -245,34 +258,13 @@ float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void vorbis_staticbook_clear(static_codebook *b){
|
void vorbis_staticbook_destroy(static_codebook *b){
|
||||||
if(b->allocedp){
|
if(b->allocedp){
|
||||||
if(b->quantlist)_ogg_free(b->quantlist);
|
if(b->quantlist)_ogg_free(b->quantlist);
|
||||||
if(b->lengthlist)_ogg_free(b->lengthlist);
|
if(b->lengthlist)_ogg_free(b->lengthlist);
|
||||||
if(b->nearest_tree){
|
|
||||||
_ogg_free(b->nearest_tree->ptr0);
|
|
||||||
_ogg_free(b->nearest_tree->ptr1);
|
|
||||||
_ogg_free(b->nearest_tree->p);
|
|
||||||
_ogg_free(b->nearest_tree->q);
|
|
||||||
memset(b->nearest_tree,0,sizeof(*b->nearest_tree));
|
|
||||||
_ogg_free(b->nearest_tree);
|
|
||||||
}
|
|
||||||
if(b->thresh_tree){
|
|
||||||
_ogg_free(b->thresh_tree->quantthresh);
|
|
||||||
_ogg_free(b->thresh_tree->quantmap);
|
|
||||||
memset(b->thresh_tree,0,sizeof(*b->thresh_tree));
|
|
||||||
_ogg_free(b->thresh_tree);
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(b,0,sizeof(*b));
|
memset(b,0,sizeof(*b));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void vorbis_staticbook_destroy(static_codebook *b){
|
|
||||||
if(b->allocedp){
|
|
||||||
vorbis_staticbook_clear(b);
|
|
||||||
_ogg_free(b);
|
_ogg_free(b);
|
||||||
}
|
} /* otherwise, it is in static memory */
|
||||||
}
|
}
|
||||||
|
|
||||||
void vorbis_book_clear(codebook *b){
|
void vorbis_book_clear(codebook *b){
|
||||||
|
|
@ -296,7 +288,10 @@ int vorbis_book_init_encode(codebook *c,const static_codebook *s){
|
||||||
c->used_entries=s->entries;
|
c->used_entries=s->entries;
|
||||||
c->dim=s->dim;
|
c->dim=s->dim;
|
||||||
c->codelist=_make_words(s->lengthlist,s->entries,0);
|
c->codelist=_make_words(s->lengthlist,s->entries,0);
|
||||||
c->valuelist=_book_unquantize(s,s->entries,NULL);
|
//c->valuelist=_book_unquantize(s,s->entries,NULL);
|
||||||
|
c->quantvals=_book_maptype1_quantvals(s);
|
||||||
|
c->minval=(int)rint(_float32_unpack(s->q_min));
|
||||||
|
c->delta=(int)rint(_float32_unpack(s->q_delta));
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
@ -372,12 +367,12 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||||
|
|
||||||
for(n=0,i=0;i<s->entries;i++)
|
for(n=0,i=0;i<s->entries;i++)
|
||||||
if(s->lengthlist[i]>0)
|
if(s->lengthlist[i]>0)
|
||||||
c->dec_index[sortindex[n++]]=i;
|
c->dec_index[sortindex[n++]]=i;
|
||||||
|
|
||||||
c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths));
|
c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths));
|
||||||
for(n=0,i=0;i<s->entries;i++)
|
for(n=0,i=0;i<s->entries;i++)
|
||||||
if(s->lengthlist[i]>0)
|
if(s->lengthlist[i]>0)
|
||||||
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
|
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
|
||||||
|
|
||||||
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
|
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
|
||||||
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
|
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
|
||||||
|
|
@ -389,11 +384,11 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||||
|
|
||||||
for(i=0;i<n;i++){
|
for(i=0;i<n;i++){
|
||||||
if(c->dec_maxlength<c->dec_codelengths[i])
|
if(c->dec_maxlength<c->dec_codelengths[i])
|
||||||
c->dec_maxlength=c->dec_codelengths[i];
|
c->dec_maxlength=c->dec_codelengths[i];
|
||||||
if(c->dec_codelengths[i]<=c->dec_firsttablen){
|
if(c->dec_codelengths[i]<=c->dec_firsttablen){
|
||||||
ogg_uint32_t orig=bitreverse(c->codelist[i]);
|
ogg_uint32_t orig=bitreverse(c->codelist[i]);
|
||||||
for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
|
for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
|
||||||
c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
|
c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -404,24 +399,24 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||||
long lo=0,hi=0;
|
long lo=0,hi=0;
|
||||||
|
|
||||||
for(i=0;i<tabn;i++){
|
for(i=0;i<tabn;i++){
|
||||||
ogg_uint32_t word=i<<(32-c->dec_firsttablen);
|
ogg_uint32_t word=i<<(32-c->dec_firsttablen);
|
||||||
if(c->dec_firsttable[bitreverse(word)]==0){
|
if(c->dec_firsttable[bitreverse(word)]==0){
|
||||||
while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
|
while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
|
||||||
while( hi<n && word>=(c->codelist[hi]&mask))hi++;
|
while( hi<n && word>=(c->codelist[hi]&mask))hi++;
|
||||||
|
|
||||||
/* we only actually have 15 bits per hint to play with here.
|
/* we only actually have 15 bits per hint to play with here.
|
||||||
In order to overflow gracefully (nothing breaks, efficiency
|
In order to overflow gracefully (nothing breaks, efficiency
|
||||||
just drops), encode as the difference from the extremes. */
|
just drops), encode as the difference from the extremes. */
|
||||||
{
|
{
|
||||||
unsigned long loval=lo;
|
unsigned long loval=lo;
|
||||||
unsigned long hival=n-hi;
|
unsigned long hival=n-hi;
|
||||||
|
|
||||||
if(loval>0x7fff)loval=0x7fff;
|
if(loval>0x7fff)loval=0x7fff;
|
||||||
if(hival>0x7fff)hival=0x7fff;
|
if(hival>0x7fff)hival=0x7fff;
|
||||||
c->dec_firsttable[bitreverse(word)]=
|
c->dec_firsttable[bitreverse(word)]=
|
||||||
0x80000000UL | (loval<<15) | hival;
|
0x80000000UL | (loval<<15) | hival;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -432,157 +427,6 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float _dist(int el,float *ref, float *b,int step){
|
|
||||||
int i;
|
|
||||||
float acc=0.f;
|
|
||||||
for(i=0;i<el;i++){
|
|
||||||
float val=(ref[i]-b[i*step]);
|
|
||||||
acc+=val*val;
|
|
||||||
}
|
|
||||||
return(acc);
|
|
||||||
}
|
|
||||||
|
|
||||||
int _best(codebook *book, float *a, int step){
|
|
||||||
encode_aux_threshmatch *tt=book->c->thresh_tree;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
encode_aux_nearestmatch *nt=book->c->nearest_tree;
|
|
||||||
encode_aux_pigeonhole *pt=book->c->pigeon_tree;
|
|
||||||
#endif
|
|
||||||
int dim=book->dim;
|
|
||||||
int k,o;
|
|
||||||
/*int savebest=-1;
|
|
||||||
float saverr;*/
|
|
||||||
|
|
||||||
/* do we have a threshhold encode hint? */
|
|
||||||
if(tt){
|
|
||||||
int index=0,i;
|
|
||||||
/* find the quant val of each scalar */
|
|
||||||
for(k=0,o=step*(dim-1);k<dim;k++,o-=step){
|
|
||||||
|
|
||||||
i=tt->threshvals>>1;
|
|
||||||
if(a[o]<tt->quantthresh[i]){
|
|
||||||
|
|
||||||
for(;i>0;i--)
|
|
||||||
if(a[o]>=tt->quantthresh[i-1])
|
|
||||||
break;
|
|
||||||
|
|
||||||
}else{
|
|
||||||
|
|
||||||
for(i++;i<tt->threshvals-1;i++)
|
|
||||||
if(a[o]<tt->quantthresh[i])break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
index=(index*tt->quantvals)+tt->quantmap[i];
|
|
||||||
}
|
|
||||||
/* regular lattices are easy :-) */
|
|
||||||
if(book->c->lengthlist[index]>0) /* is this unused? If so, we'll
|
|
||||||
use a decision tree after all
|
|
||||||
and fall through*/
|
|
||||||
return(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* do we have a pigeonhole encode hint? */
|
|
||||||
if(pt){
|
|
||||||
const static_codebook *c=book->c;
|
|
||||||
int i,besti=-1;
|
|
||||||
float best=0.f;
|
|
||||||
int entry=0;
|
|
||||||
|
|
||||||
/* dealing with sequentialness is a pain in the ass */
|
|
||||||
if(c->q_sequencep){
|
|
||||||
int pv;
|
|
||||||
long mul=1;
|
|
||||||
float qlast=0;
|
|
||||||
for(k=0,o=0;k<dim;k++,o+=step){
|
|
||||||
pv=(int)((a[o]-qlast-pt->min)/pt->del);
|
|
||||||
if(pv<0 || pv>=pt->mapentries)break;
|
|
||||||
entry+=pt->pigeonmap[pv]*mul;
|
|
||||||
mul*=pt->quantvals;
|
|
||||||
qlast+=pv*pt->del+pt->min;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
for(k=0,o=step*(dim-1);k<dim;k++,o-=step){
|
|
||||||
int pv=(int)((a[o]-pt->min)/pt->del);
|
|
||||||
if(pv<0 || pv>=pt->mapentries)break;
|
|
||||||
entry=entry*pt->quantvals+pt->pigeonmap[pv];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* must be within the pigeonholable range; if we quant outside (or
|
|
||||||
in an entry that we define no list for), brute force it */
|
|
||||||
if(k==dim && pt->fitlength[entry]){
|
|
||||||
/* search the abbreviated list */
|
|
||||||
long *list=pt->fitlist+pt->fitmap[entry];
|
|
||||||
for(i=0;i<pt->fitlength[entry];i++){
|
|
||||||
float this=_dist(dim,book->valuelist+list[i]*dim,a,step);
|
|
||||||
if(besti==-1 || this<best){
|
|
||||||
best=this;
|
|
||||||
besti=list[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return(besti);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nt){
|
|
||||||
/* optimized using the decision tree */
|
|
||||||
while(1){
|
|
||||||
float c=0.f;
|
|
||||||
float *p=book->valuelist+nt->p[ptr];
|
|
||||||
float *q=book->valuelist+nt->q[ptr];
|
|
||||||
|
|
||||||
for(k=0,o=0;k<dim;k++,o+=step)
|
|
||||||
c+=(p[k]-q[k])*(a[o]-(p[k]+q[k])*.5);
|
|
||||||
|
|
||||||
if(c>0.f) /* in A */
|
|
||||||
ptr= -nt->ptr0[ptr];
|
|
||||||
else /* in B */
|
|
||||||
ptr= -nt->ptr1[ptr];
|
|
||||||
if(ptr<=0)break;
|
|
||||||
}
|
|
||||||
return(-ptr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* brute force it! */
|
|
||||||
{
|
|
||||||
const static_codebook *c=book->c;
|
|
||||||
int i,besti=-1;
|
|
||||||
float best=0.f;
|
|
||||||
float *e=book->valuelist;
|
|
||||||
for(i=0;i<book->entries;i++){
|
|
||||||
if(c->lengthlist[i]>0){
|
|
||||||
float this=_dist(dim,e,a,step);
|
|
||||||
if(besti==-1 || this<best){
|
|
||||||
best=this;
|
|
||||||
besti=i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
e+=dim;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*if(savebest!=-1 && savebest!=besti){
|
|
||||||
fprintf(stderr,"brute force/pigeonhole disagreement:\n"
|
|
||||||
"original:");
|
|
||||||
for(i=0;i<dim*step;i+=step)fprintf(stderr,"%g,",a[i]);
|
|
||||||
fprintf(stderr,"\n"
|
|
||||||
"pigeonhole (entry %d, err %g):",savebest,saverr);
|
|
||||||
for(i=0;i<dim;i++)fprintf(stderr,"%g,",
|
|
||||||
(book->valuelist+savebest*dim)[i]);
|
|
||||||
fprintf(stderr,"\n"
|
|
||||||
"bruteforce (entry %d, err %g):",besti,best);
|
|
||||||
for(i=0;i<dim;i++)fprintf(stderr,"%g,",
|
|
||||||
(book->valuelist+besti*dim)[i]);
|
|
||||||
fprintf(stderr,"\n");
|
|
||||||
}*/
|
|
||||||
return(besti);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
long vorbis_book_codeword(codebook *book,int entry){
|
long vorbis_book_codeword(codebook *book,int entry){
|
||||||
if(book->c) /* only use with encode; decode optimizations are
|
if(book->c) /* only use with encode; decode optimizations are
|
||||||
allowed to break this */
|
allowed to break this */
|
||||||
|
|
@ -625,7 +469,7 @@ static_codebook test1={
|
||||||
0,
|
0,
|
||||||
0,0,0,0,
|
0,0,0,0,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,NULL
|
0
|
||||||
};
|
};
|
||||||
static float *test1_result=NULL;
|
static float *test1_result=NULL;
|
||||||
|
|
||||||
|
|
@ -636,7 +480,7 @@ static_codebook test2={
|
||||||
2,
|
2,
|
||||||
-533200896,1611661312,4,0,
|
-533200896,1611661312,4,0,
|
||||||
full_quantlist1,
|
full_quantlist1,
|
||||||
NULL,NULL
|
0
|
||||||
};
|
};
|
||||||
static float test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2};
|
static float test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2};
|
||||||
|
|
||||||
|
|
@ -647,7 +491,7 @@ static_codebook test3={
|
||||||
2,
|
2,
|
||||||
-533200896,1611661312,4,1,
|
-533200896,1611661312,4,1,
|
||||||
full_quantlist1,
|
full_quantlist1,
|
||||||
NULL,NULL
|
0
|
||||||
};
|
};
|
||||||
static float test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6};
|
static float test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6};
|
||||||
|
|
||||||
|
|
@ -658,17 +502,17 @@ static_codebook test4={
|
||||||
1,
|
1,
|
||||||
-533200896,1611661312,4,0,
|
-533200896,1611661312,4,0,
|
||||||
partial_quantlist1,
|
partial_quantlist1,
|
||||||
NULL,NULL
|
0
|
||||||
};
|
};
|
||||||
static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3,
|
static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3,
|
||||||
-3, 4,-3, 4, 4,-3, -1, 4,-3,
|
-3, 4,-3, 4, 4,-3, -1, 4,-3,
|
||||||
-3,-1,-3, 4,-1,-3, -1,-1,-3,
|
-3,-1,-3, 4,-1,-3, -1,-1,-3,
|
||||||
-3,-3, 4, 4,-3, 4, -1,-3, 4,
|
-3,-3, 4, 4,-3, 4, -1,-3, 4,
|
||||||
-3, 4, 4, 4, 4, 4, -1, 4, 4,
|
-3, 4, 4, 4, 4, 4, -1, 4, 4,
|
||||||
-3,-1, 4, 4,-1, 4, -1,-1, 4,
|
-3,-1, 4, 4,-1, 4, -1,-1, 4,
|
||||||
-3,-3,-1, 4,-3,-1, -1,-3,-1,
|
-3,-3,-1, 4,-3,-1, -1,-3,-1,
|
||||||
-3, 4,-1, 4, 4,-1, -1, 4,-1,
|
-3, 4,-1, 4, 4,-1, -1, 4,-1,
|
||||||
-3,-1,-1, 4,-1,-1, -1,-1,-1};
|
-3,-1,-1, 4,-1,-1, -1,-1,-1};
|
||||||
|
|
||||||
/* linear, algorithmic mapping, sequential */
|
/* linear, algorithmic mapping, sequential */
|
||||||
static_codebook test5={
|
static_codebook test5={
|
||||||
|
|
@ -677,17 +521,17 @@ static_codebook test5={
|
||||||
1,
|
1,
|
||||||
-533200896,1611661312,4,1,
|
-533200896,1611661312,4,1,
|
||||||
partial_quantlist1,
|
partial_quantlist1,
|
||||||
NULL,NULL
|
0
|
||||||
};
|
};
|
||||||
static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7,
|
static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7,
|
||||||
-3, 1,-2, 4, 8, 5, -1, 3, 0,
|
-3, 1,-2, 4, 8, 5, -1, 3, 0,
|
||||||
-3,-4,-7, 4, 3, 0, -1,-2,-5,
|
-3,-4,-7, 4, 3, 0, -1,-2,-5,
|
||||||
-3,-6,-2, 4, 1, 5, -1,-4, 0,
|
-3,-6,-2, 4, 1, 5, -1,-4, 0,
|
||||||
-3, 1, 5, 4, 8,12, -1, 3, 7,
|
-3, 1, 5, 4, 8,12, -1, 3, 7,
|
||||||
-3,-4, 0, 4, 3, 7, -1,-2, 2,
|
-3,-4, 0, 4, 3, 7, -1,-2, 2,
|
||||||
-3,-6,-7, 4, 1, 0, -1,-4,-5,
|
-3,-6,-7, 4, 1, 0, -1,-4,-5,
|
||||||
-3, 1, 0, 4, 8, 7, -1, 3, 2,
|
-3, 1, 0, 4, 8, 7, -1, 3, 2,
|
||||||
-3,-4,-5, 4, 3, 2, -1,-2,-3};
|
-3,-4,-5, 4, 3, 2, -1,-2,-3};
|
||||||
|
|
||||||
void run_test(static_codebook *b,float *comp){
|
void run_test(static_codebook *b,float *comp){
|
||||||
float *out=_book_unquantize(b,b->entries,NULL);
|
float *out=_book_unquantize(b,b->entries,NULL);
|
||||||
|
|
@ -701,15 +545,15 @@ void run_test(static_codebook *b,float *comp){
|
||||||
|
|
||||||
for(i=0;i<b->entries*b->dim;i++)
|
for(i=0;i<b->entries*b->dim;i++)
|
||||||
if(fabs(out[i]-comp[i])>.0001){
|
if(fabs(out[i]-comp[i])>.0001){
|
||||||
fprintf(stderr,"disagreement in unquantized and reference data:\n"
|
fprintf(stderr,"disagreement in unquantized and reference data:\n"
|
||||||
"position %d, %g != %g\n",i,out[i],comp[i]);
|
"position %d, %g != %g\n",i,out[i],comp[i]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
if(out){
|
if(out){
|
||||||
fprintf(stderr,"_book_unquantize returned a value array: \n"
|
fprintf(stderr,"_book_unquantize returned a value array: \n"
|
||||||
" correct result should have been NULL\n");
|
" correct result should have been NULL\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: *unnormalized* fft transform
|
function: *unnormalized* fft transform
|
||||||
last mod: $Id: smallft.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: smallft.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -94,10 +94,10 @@ static void drfti1(int n, float *wa, int *ifac){
|
||||||
argld=(float)ld*argh;
|
argld=(float)ld*argh;
|
||||||
fi=0.f;
|
fi=0.f;
|
||||||
for (ii=2;ii<ido;ii+=2){
|
for (ii=2;ii<ido;ii+=2){
|
||||||
fi+=1.f;
|
fi+=1.f;
|
||||||
arg=fi*argld;
|
arg=fi*argld;
|
||||||
wa[i++]=cos(arg);
|
wa[i++]=cos(arg);
|
||||||
wa[i++]=sin(arg);
|
wa[i++]=sin(arg);
|
||||||
}
|
}
|
||||||
is+=ido;
|
is+=ido;
|
||||||
}
|
}
|
||||||
|
|
@ -167,7 +167,7 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
|
static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
|
||||||
float *wa2,float *wa3){
|
float *wa2,float *wa3){
|
||||||
static float hsqt2 = .70710678118654752f;
|
static float hsqt2 = .70710678118654752f;
|
||||||
int i,k,t0,t1,t2,t3,t4,t5,t6;
|
int i,k,t0,t1,t2,t3,t4,t5,t6;
|
||||||
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
|
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
|
||||||
|
|
@ -747,7 +747,7 @@ static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
|
static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
|
||||||
float *wa2,float *wa3){
|
float *wa2,float *wa3){
|
||||||
static float sqrt2=1.414213562373095f;
|
static float sqrt2=1.414213562373095f;
|
||||||
int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
|
int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
|
||||||
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
|
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: single-block PCM synthesis
|
function: single-block PCM synthesis
|
||||||
last mod: $Id: synthesis.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: synthesis.c 17474 2010-09-30 03:41:41Z gmaxwell $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -24,13 +24,17 @@
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
|
int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
|
||||||
vorbis_dsp_state *vd=vb->vd;
|
vorbis_dsp_state *vd= vb ? vb->vd : 0;
|
||||||
private_state *b=vd->backend_state;
|
private_state *b= vd ? vd->backend_state : 0;
|
||||||
vorbis_info *vi=vd->vi;
|
vorbis_info *vi= vd ? vd->vi : 0;
|
||||||
codec_setup_info *ci=vi->codec_setup;
|
codec_setup_info *ci= vi ? vi->codec_setup : 0;
|
||||||
oggpack_buffer *opb=&vb->opb;
|
oggpack_buffer *opb=vb ? &vb->opb : 0;
|
||||||
int type,mode,i;
|
int type,mode,i;
|
||||||
|
|
||||||
|
if (!vd || !b || !vi || !ci || !opb) {
|
||||||
|
return OV_EBADPACKET;
|
||||||
|
}
|
||||||
|
|
||||||
/* first things first. Make sure decode is ready */
|
/* first things first. Make sure decode is ready */
|
||||||
_vorbis_block_ripcord(vb);
|
_vorbis_block_ripcord(vb);
|
||||||
oggpack_readinit(opb,op->packet,op->bytes);
|
oggpack_readinit(opb,op->packet,op->bytes);
|
||||||
|
|
@ -43,9 +47,15 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
|
||||||
|
|
||||||
/* read our mode and pre/post windowsize */
|
/* read our mode and pre/post windowsize */
|
||||||
mode=oggpack_read(opb,b->modebits);
|
mode=oggpack_read(opb,b->modebits);
|
||||||
if(mode==-1)return(OV_EBADPACKET);
|
if(mode==-1){
|
||||||
|
return(OV_EBADPACKET);
|
||||||
|
}
|
||||||
|
|
||||||
vb->mode=mode;
|
vb->mode=mode;
|
||||||
|
if(!ci->mode_param[mode]){
|
||||||
|
return(OV_EBADPACKET);
|
||||||
|
}
|
||||||
|
|
||||||
vb->W=ci->mode_param[mode]->blockflag;
|
vb->W=ci->mode_param[mode]->blockflag;
|
||||||
if(vb->W){
|
if(vb->W){
|
||||||
|
|
||||||
|
|
@ -53,7 +63,9 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
|
||||||
only for window selection */
|
only for window selection */
|
||||||
vb->lW=oggpack_read(opb,1);
|
vb->lW=oggpack_read(opb,1);
|
||||||
vb->nW=oggpack_read(opb,1);
|
vb->nW=oggpack_read(opb,1);
|
||||||
if(vb->nW==-1) return(OV_EBADPACKET);
|
if(vb->nW==-1){
|
||||||
|
return(OV_EBADPACKET);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
vb->lW=0;
|
vb->lW=0;
|
||||||
vb->nW=0;
|
vb->nW=0;
|
||||||
|
|
@ -74,7 +86,7 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
|
||||||
type=ci->map_type[ci->mode_param[mode]->mapping];
|
type=ci->map_type[ci->mode_param[mode]->mapping];
|
||||||
|
|
||||||
return(_mapping_P[type]->inverse(vb,ci->map_param[ci->mode_param[mode]->
|
return(_mapping_P[type]->inverse(vb,ci->map_param[ci->mode_param[mode]->
|
||||||
mapping]));
|
mapping]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* used to track pcm position without actually performing decode.
|
/* used to track pcm position without actually performing decode.
|
||||||
|
|
@ -102,6 +114,10 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
|
||||||
if(mode==-1)return(OV_EBADPACKET);
|
if(mode==-1)return(OV_EBADPACKET);
|
||||||
|
|
||||||
vb->mode=mode;
|
vb->mode=mode;
|
||||||
|
if(!ci->mode_param[mode]){
|
||||||
|
return(OV_EBADPACKET);
|
||||||
|
}
|
||||||
|
|
||||||
vb->W=ci->mode_param[mode]->blockflag;
|
vb->W=ci->mode_param[mode]->blockflag;
|
||||||
if(vb->W){
|
if(vb->W){
|
||||||
vb->lW=oggpack_read(opb,1);
|
vb->lW=oggpack_read(opb,1);
|
||||||
|
|
@ -166,5 +182,3 @@ int vorbis_synthesis_halfrate_p(vorbis_info *vi){
|
||||||
codec_setup_info *ci=vi->codec_setup;
|
codec_setup_info *ci=vi->codec_setup;
|
||||||
return ci->halfrate_flag;
|
return ci->halfrate_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -5,13 +5,13 @@
|
||||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||||
* *
|
* *
|
||||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||||
* *
|
* *
|
||||||
********************************************************************
|
********************************************************************
|
||||||
|
|
||||||
function: window functions
|
function: window functions
|
||||||
last mod: $Id: window.c 13293 2007-07-24 00:09:47Z xiphmont $
|
last mod: $Id: window.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||||
|
|
||||||
********************************************************************/
|
********************************************************************/
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
static float vwin64[32] = {
|
static const float vwin64[32] = {
|
||||||
0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F,
|
0.0009460463F, 0.0085006468F, 0.0235352254F, 0.0458950567F,
|
||||||
0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F,
|
0.0753351908F, 0.1115073077F, 0.1539457973F, 0.2020557475F,
|
||||||
0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F,
|
0.2551056759F, 0.3122276645F, 0.3724270287F, 0.4346027792F,
|
||||||
|
|
@ -31,7 +31,7 @@ static float vwin64[32] = {
|
||||||
0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F,
|
0.9989462667F, 0.9997230082F, 0.9999638688F, 0.9999995525F,
|
||||||
};
|
};
|
||||||
|
|
||||||
static float vwin128[64] = {
|
static const float vwin128[64] = {
|
||||||
0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F,
|
0.0002365472F, 0.0021280687F, 0.0059065254F, 0.0115626550F,
|
||||||
0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F,
|
0.0190823442F, 0.0284463735F, 0.0396300935F, 0.0526030430F,
|
||||||
0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F,
|
0.0673285281F, 0.0837631763F, 0.1018564887F, 0.1215504095F,
|
||||||
|
|
@ -50,7 +50,7 @@ static float vwin128[64] = {
|
||||||
0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F,
|
0.9999331503F, 0.9999825563F, 0.9999977357F, 0.9999999720F,
|
||||||
};
|
};
|
||||||
|
|
||||||
static float vwin256[128] = {
|
static const float vwin256[128] = {
|
||||||
0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F,
|
0.0000591390F, 0.0005321979F, 0.0014780301F, 0.0028960636F,
|
||||||
0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F,
|
0.0047854363F, 0.0071449926F, 0.0099732775F, 0.0132685298F,
|
||||||
0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F,
|
0.0170286741F, 0.0212513119F, 0.0259337111F, 0.0310727950F,
|
||||||
|
|
@ -85,7 +85,7 @@ static float vwin256[128] = {
|
||||||
0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F,
|
0.9999958064F, 0.9999989077F, 0.9999998584F, 0.9999999983F,
|
||||||
};
|
};
|
||||||
|
|
||||||
static float vwin512[256] = {
|
static const float vwin512[256] = {
|
||||||
0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F,
|
0.0000147849F, 0.0001330607F, 0.0003695946F, 0.0007243509F,
|
||||||
0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F,
|
0.0011972759F, 0.0017882983F, 0.0024973285F, 0.0033242588F,
|
||||||
0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F,
|
0.0042689632F, 0.0053312973F, 0.0065110982F, 0.0078081841F,
|
||||||
|
|
@ -152,7 +152,7 @@ static float vwin512[256] = {
|
||||||
0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F,
|
0.9999997377F, 0.9999999317F, 0.9999999911F, 0.9999999999F,
|
||||||
};
|
};
|
||||||
|
|
||||||
static float vwin1024[512] = {
|
static const float vwin1024[512] = {
|
||||||
0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F,
|
0.0000036962F, 0.0000332659F, 0.0000924041F, 0.0001811086F,
|
||||||
0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F,
|
0.0002993761F, 0.0004472021F, 0.0006245811F, 0.0008315063F,
|
||||||
0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F,
|
0.0010679699F, 0.0013339631F, 0.0016294757F, 0.0019544965F,
|
||||||
|
|
@ -283,7 +283,7 @@ static float vwin1024[512] = {
|
||||||
0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F,
|
0.9999999836F, 0.9999999957F, 0.9999999994F, 1.0000000000F,
|
||||||
};
|
};
|
||||||
|
|
||||||
static float vwin2048[1024] = {
|
static const float vwin2048[1024] = {
|
||||||
0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F,
|
0.0000009241F, 0.0000083165F, 0.0000231014F, 0.0000452785F,
|
||||||
0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F,
|
0.0000748476F, 0.0001118085F, 0.0001561608F, 0.0002079041F,
|
||||||
0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F,
|
0.0002670379F, 0.0003335617F, 0.0004074748F, 0.0004887765F,
|
||||||
|
|
@ -542,7 +542,7 @@ static float vwin2048[1024] = {
|
||||||
0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F,
|
0.9999999990F, 0.9999999997F, 1.0000000000F, 1.0000000000F,
|
||||||
};
|
};
|
||||||
|
|
||||||
static float vwin4096[2048] = {
|
static const float vwin4096[2048] = {
|
||||||
0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F,
|
0.0000002310F, 0.0000020791F, 0.0000057754F, 0.0000113197F,
|
||||||
0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F,
|
0.0000187121F, 0.0000279526F, 0.0000390412F, 0.0000519777F,
|
||||||
0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F,
|
0.0000667623F, 0.0000833949F, 0.0001018753F, 0.0001222036F,
|
||||||
|
|
@ -1057,7 +1057,7 @@ static float vwin4096[2048] = {
|
||||||
0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
|
0.9999999999F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
|
||||||
};
|
};
|
||||||
|
|
||||||
static float vwin8192[4096] = {
|
static const float vwin8192[4096] = {
|
||||||
0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F,
|
0.0000000578F, 0.0000005198F, 0.0000014438F, 0.0000028299F,
|
||||||
0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F,
|
0.0000046780F, 0.0000069882F, 0.0000097604F, 0.0000129945F,
|
||||||
0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F,
|
0.0000166908F, 0.0000208490F, 0.0000254692F, 0.0000305515F,
|
||||||
|
|
@ -2084,7 +2084,7 @@ static float vwin8192[4096] = {
|
||||||
1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
|
1.0000000000F, 1.0000000000F, 1.0000000000F, 1.0000000000F,
|
||||||
};
|
};
|
||||||
|
|
||||||
static float *vwin[8] = {
|
static const float *const vwin[8] = {
|
||||||
vwin64,
|
vwin64,
|
||||||
vwin128,
|
vwin128,
|
||||||
vwin256,
|
vwin256,
|
||||||
|
|
@ -2095,18 +2095,18 @@ static float *vwin[8] = {
|
||||||
vwin8192,
|
vwin8192,
|
||||||
};
|
};
|
||||||
|
|
||||||
float *_vorbis_window_get(int n){
|
const float *_vorbis_window_get(int n){
|
||||||
return vwin[n];
|
return vwin[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
void _vorbis_apply_window(float *d,int *winno,long *blocksizes,
|
void _vorbis_apply_window(float *d,int *winno,long *blocksizes,
|
||||||
int lW,int W,int nW){
|
int lW,int W,int nW){
|
||||||
lW=(W?lW:0);
|
lW=(W?lW:0);
|
||||||
nW=(W?nW:0);
|
nW=(W?nW:0);
|
||||||
|
|
||||||
{
|
{
|
||||||
float *windowLW=vwin[winno[lW]];
|
const float *windowLW=vwin[winno[lW]];
|
||||||
float *windowNW=vwin[winno[nW]];
|
const float *windowNW=vwin[winno[nW]];
|
||||||
|
|
||||||
long n=blocksizes[W];
|
long n=blocksizes[W];
|
||||||
long ln=blocksizes[lW];
|
long ln=blocksizes[lW];
|
||||||
|
|
@ -2133,4 +2133,3 @@ void _vorbis_apply_window(float *d,int *winno,long *blocksizes,
|
||||||
d[i]=0.f;
|
d[i]=0.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue