зеркало из https://github.com/mozilla/gecko-dev.git
Bug 501279. Update libvorbis to r16335.
--HG-- extra : rebase_source : 04d15a3e154054fe00b3c01f3c252f5f9613e3e8
This commit is contained in:
Родитель
35d3e4d56c
Коммит
3efd4dbb3f
|
@ -2,11 +2,11 @@ diff --git a/media/libvorbis/include/vorbis/codec.h b/media/libvorbis/include/vo
|
|||
index b23fe0a..c62b2d5 100644
|
||||
--- a/media/libvorbis/include/vorbis/codec.h
|
||||
+++ b/media/libvorbis/include/vorbis/codec.h
|
||||
@@ -170,16 +170,17 @@ extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
|
||||
@@ -170,18 +170,19 @@ extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
|
||||
extern void vorbis_comment_add_tag(vorbis_comment *vc,
|
||||
char *tag, char *contents);
|
||||
extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
|
||||
extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);
|
||||
const char *tag, const char *contents);
|
||||
extern char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
|
||||
extern int vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
|
||||
extern void vorbis_comment_clear(vorbis_comment *vc);
|
||||
|
||||
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
|
||||
|
@ -14,7 +14,9 @@ index b23fe0a..c62b2d5 100644
|
|||
+extern void vorbis_dsp_init(vorbis_dsp_state *v);
|
||||
extern void vorbis_dsp_clear(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 ****************************/
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ index 8872f57..b7b2399 100644
|
|||
+ if(mode==-1) {
|
||||
+ return(OV_EBADPACKET);
|
||||
+ }
|
||||
|
||||
|
||||
vb->mode=mode;
|
||||
+ if(!ci->mode_param[mode]) {
|
||||
+ return(OV_EBADPACKET);
|
||||
|
|
|
@ -26,7 +26,7 @@ index b7b2399..05774fd 100644
|
|||
+ if (!vd || !b || !vi || !ci || !opb) {
|
||||
+ return OV_EBADPACKET;
|
||||
+ }
|
||||
|
||||
|
||||
/* first things first. Make sure decode is ready */
|
||||
_vorbis_block_ripcord(vb);
|
||||
oggpack_readinit(opb,op->packet,op->bytes);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: libvorbis codec headers
|
||||
last mod: $Id$
|
||||
last mod: $Id: codec.h 16037 2009-05-26 21:10:58Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* 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
|
||||
last mod: $Id$
|
||||
last mod: $Id: backends.h 16326 2009-07-24 00:06:53Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -68,16 +68,16 @@ typedef struct{
|
|||
int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
|
||||
|
||||
|
||||
int mult; /* 1 2 3 or 4 */
|
||||
int postlist[VIF_POSIT+2]; /* first two implicit */
|
||||
int mult; /* 1 2 3 or 4 */
|
||||
int postlist[VIF_POSIT+2]; /* first two implicit */
|
||||
|
||||
|
||||
/* encode side analysis parameters */
|
||||
float maxover;
|
||||
float maxunder;
|
||||
float maxerr;
|
||||
float maxover;
|
||||
float maxunder;
|
||||
float maxerr;
|
||||
|
||||
float twofitweight;
|
||||
float twofitweight;
|
||||
float twofitatten;
|
||||
|
||||
int n;
|
||||
|
@ -111,10 +111,10 @@ typedef struct vorbis_info_residue0{
|
|||
int partitions; /* possible codebooks for a partition */
|
||||
int groupbook; /* huffbook for partitioning */
|
||||
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 */
|
||||
|
||||
const float classmetric1[64];
|
||||
const float classmetric2[64];
|
||||
const float classmetric1[64];
|
||||
const float classmetric2[64];
|
||||
} vorbis_info_residue0;
|
||||
|
||||
/* Mapping backend generic *****************************************/
|
||||
|
@ -130,7 +130,7 @@ typedef struct{
|
|||
typedef struct vorbis_info_mapping0{
|
||||
int submaps; /* <= 16 */
|
||||
int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
|
||||
|
||||
|
||||
int floorsubmap[16]; /* [mux] submap to floors */
|
||||
int residuesubmap[16]; /* [mux] submap to residue */
|
||||
|
||||
|
@ -141,5 +141,3 @@ typedef struct vorbis_info_mapping0{
|
|||
} vorbis_info_mapping0;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: bitrate tracking and management
|
||||
last mod: $Id$
|
||||
last mod: $Id: bitrate.h 13293 2007-07-24 00:09:47Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: basic shared codebook operations
|
||||
last mod: $Id$
|
||||
last mod: $Id: codebook.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -40,7 +40,7 @@ typedef struct static_codebook{
|
|||
|
||||
/* mapping ***************************************************************/
|
||||
int maptype; /* 0=none
|
||||
1=implicitly populated values from map column
|
||||
1=implicitly populated values from map column
|
||||
2=listed arbitrary values */
|
||||
|
||||
/* The below does a linear, single monotonic sequence mapping. */
|
||||
|
@ -71,15 +71,15 @@ typedef struct encode_aux_nearestmatch{
|
|||
long *p; /* decision points (each is an entry) */
|
||||
long *q; /* decision points (each is an entry) */
|
||||
long aux; /* number of tree entries */
|
||||
long alloc;
|
||||
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;
|
||||
int quantvals;
|
||||
int threshvals;
|
||||
} encode_aux_threshmatch;
|
||||
|
||||
typedef struct encode_aux_pigeonhole{
|
||||
|
@ -105,7 +105,7 @@ typedef struct codebook{
|
|||
/* for encode, the below are entry-ordered, fully populated */
|
||||
/* for decode, the below are ordered by bitreversed codeword and only
|
||||
used entries are populated */
|
||||
float *valuelist; /* list of dim*entries actual entry values */
|
||||
float *valuelist; /* list of dim*entries actual entry values */
|
||||
ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
|
||||
|
||||
int *dec_index; /* only used if sparseness collapsed */
|
||||
|
@ -141,18 +141,18 @@ extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
|
|||
|
||||
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,
|
||||
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_decodevs_add(codebook *book, float *a,
|
||||
extern long vorbis_book_decodevs_add(codebook *book, float *a,
|
||||
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);
|
||||
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);
|
||||
extern long vorbis_book_decodevv_add(codebook *book, float **a,
|
||||
long off,int ch,
|
||||
long off,int ch,
|
||||
oggpack_buffer *b,int n);
|
||||
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: libvorbis codec headers
|
||||
last mod: $Id$
|
||||
last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -23,19 +23,19 @@
|
|||
|
||||
#define BLOCKTYPE_IMPULSE 0
|
||||
#define BLOCKTYPE_PADDING 1
|
||||
#define BLOCKTYPE_TRANSITION 0
|
||||
#define BLOCKTYPE_TRANSITION 0
|
||||
#define BLOCKTYPE_LONG 1
|
||||
|
||||
#define PACKETBLOBS 15
|
||||
|
||||
typedef struct vorbis_block_internal{
|
||||
float **pcmdelay; /* this is a pointer into local storage */
|
||||
float **pcmdelay; /* this is a pointer into local storage */
|
||||
float ampmax;
|
||||
int blocktype;
|
||||
|
||||
oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
|
||||
oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
|
||||
blob [PACKETBLOBS/2] points to
|
||||
the oggpack_buffer in the
|
||||
the oggpack_buffer in the
|
||||
main vorbis_block */
|
||||
} vorbis_block_internal;
|
||||
|
||||
|
@ -60,7 +60,7 @@ typedef void vorbis_info_mapping;
|
|||
|
||||
typedef struct private_state {
|
||||
/* local lookup storage */
|
||||
envelope_lookup *ve; /* envelope lookup */
|
||||
envelope_lookup *ve; /* envelope lookup */
|
||||
int window[2];
|
||||
vorbis_look_transform **transform[2]; /* block, type */
|
||||
drft_lookup fft_look[2];
|
||||
|
@ -87,7 +87,7 @@ typedef struct private_state {
|
|||
/* codec_setup_info contains all the setup information specific to the
|
||||
specific compression/decompression mode in progress (eg,
|
||||
psychoacoustic settings, channel setup, options, codebook
|
||||
etc).
|
||||
etc).
|
||||
*********************************************************************/
|
||||
|
||||
#include "highlevel.h"
|
||||
|
@ -127,7 +127,7 @@ typedef struct codec_setup_info {
|
|||
highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a
|
||||
highly redundant structure, but
|
||||
improves clarity of program flow. */
|
||||
int halfrate_flag; /* painless downsample for decode */
|
||||
int halfrate_flag; /* painless downsample for decode */
|
||||
} codec_setup_info;
|
||||
|
||||
extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
|
||||
|
@ -139,7 +139,7 @@ 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;
|
||||
|
@ -165,4 +165,3 @@ 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 *
|
||||
* 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/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: PCM data envelope analysis and manipulation
|
||||
last mod: $Id$
|
||||
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
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: highlevel encoder setup struct seperated out for vorbisenc clarity
|
||||
last mod: $Id$
|
||||
last mod: $Id: highlevel.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -21,7 +21,7 @@ typedef struct highlevel_byblocktype {
|
|||
double noise_bias_setting;
|
||||
double noise_compand_setting;
|
||||
} highlevel_byblocktype;
|
||||
|
||||
|
||||
typedef struct highlevel_encode_setup {
|
||||
const void *setup;
|
||||
int set_in_stone;
|
||||
|
@ -38,7 +38,7 @@ typedef struct highlevel_encode_setup {
|
|||
long bitrate_max;
|
||||
long bitrate_reservoir;
|
||||
double bitrate_reservoir_bias;
|
||||
|
||||
|
||||
int impulse_block_p;
|
||||
int noise_normalize_p;
|
||||
|
||||
|
@ -50,8 +50,7 @@ typedef struct highlevel_encode_setup {
|
|||
|
||||
double amplitude_track_dBpersec;
|
||||
double trigger_setting;
|
||||
|
||||
|
||||
highlevel_byblocktype block[4]; /* padding, impulse, transition, long */
|
||||
|
||||
} highlevel_encode_setup;
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: lookup based functions
|
||||
last mod: $Id$
|
||||
last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -27,6 +27,6 @@ extern float vorbis_fromdBlook(float a);
|
|||
extern long vorbis_invsqlook_i(long a,long e);
|
||||
extern long vorbis_coslook_i(long a);
|
||||
extern float vorbis_fromdBlook_i(long a);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: lookup data; generated by lookups.pl; edit there
|
||||
last mod: $Id$
|
||||
last mod: $Id: lookup_data.h 16037 2009-05-26 21:10:58Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: LPC low level routines
|
||||
last mod: $Id$
|
||||
last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: LSP (also called LSF) conversion routines
|
||||
last mod: $Id$
|
||||
last mod: $Id: lsp.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -24,5 +24,5 @@ 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,
|
||||
float *lsp,int m,
|
||||
float amp,float ampoffset);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: modified discrete cosine transform prototypes
|
||||
last mod: $Id$
|
||||
last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
typedef struct {
|
||||
int n;
|
||||
int log2n;
|
||||
|
||||
|
||||
DATA_TYPE *trig;
|
||||
int *bitrev;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: miscellaneous prototypes
|
||||
last mod: $Id$
|
||||
last mod: $Id: misc.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -19,21 +19,25 @@
|
|||
#define _V_RANDOM_H_
|
||||
#include "vorbis/codec.h"
|
||||
|
||||
extern int analysis_noisy;
|
||||
|
||||
extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
|
||||
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,
|
||||
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
|
||||
|
||||
#define _VDBG_GRAPHFILE "malloc.m"
|
||||
#undef _VDBG_GRAPHFILE
|
||||
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_malloc(void *ptr,long bytes,char *file,long line);
|
||||
extern void _VDBG_free(void *ptr,char *file,long line);
|
||||
|
||||
#ifndef MISC_C
|
||||
#ifndef MISC_C
|
||||
#undef _ogg_malloc
|
||||
#undef _ogg_calloc
|
||||
#undef _ogg_realloc
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
last mod: $Id$
|
||||
last mod: $Id: os.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -51,7 +51,7 @@
|
|||
|
||||
#if defined(_WIN32) && !defined(__SYMBIAN32__)
|
||||
# include <malloc.h>
|
||||
# define rint(x) (floor((x)+0.5f))
|
||||
# define rint(x) (floor((x)+0.5f))
|
||||
# define NO_FLOAT_MATH_LIB
|
||||
# define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
|
||||
#endif
|
||||
|
@ -101,7 +101,7 @@ static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
|
|||
ogg_int16_t temp;
|
||||
__asm__ __volatile__("fnstcw %0\n\t"
|
||||
"movw %0,%%dx\n\t"
|
||||
"orw $62463,%%dx\n\t"
|
||||
"andw $62463,%%dx\n\t"
|
||||
"movw %%dx,%1\n\t"
|
||||
"fldcw %1\n\t":"=m"(ret):"m"(temp): "dx");
|
||||
*fpu=ret;
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: random psychoacoustics (not including preecho)
|
||||
last mod: $Id$
|
||||
last mod: $Id: psy.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -76,11 +76,11 @@ typedef struct{
|
|||
float ampmax_att_per_sec;
|
||||
|
||||
/* channel coupling config */
|
||||
int coupling_pkHz[PACKETBLOBS];
|
||||
int coupling_pointlimit[2][PACKETBLOBS];
|
||||
int coupling_prepointamp[PACKETBLOBS];
|
||||
int coupling_postpointamp[PACKETBLOBS];
|
||||
int sliding_lowpass[2][PACKETBLOBS];
|
||||
int coupling_pkHz[PACKETBLOBS];
|
||||
int coupling_pointlimit[2][PACKETBLOBS];
|
||||
int coupling_prepointamp[PACKETBLOBS];
|
||||
int coupling_postpointamp[PACKETBLOBS];
|
||||
int sliding_lowpass[2][PACKETBLOBS];
|
||||
|
||||
} vorbis_info_psy_global;
|
||||
|
||||
|
@ -89,7 +89,7 @@ typedef struct {
|
|||
int channels;
|
||||
|
||||
vorbis_info_psy_global *gi;
|
||||
int coupling_pointlimit[2][P_NOISECURVES];
|
||||
int coupling_pointlimit[2][P_NOISECURVES];
|
||||
} vorbis_look_psy_global;
|
||||
|
||||
|
||||
|
@ -107,7 +107,7 @@ typedef struct {
|
|||
long firstoc;
|
||||
long shiftoc;
|
||||
int eighth_octave_lines; /* power of two, please */
|
||||
int total_octave_lines;
|
||||
int total_octave_lines;
|
||||
long rate; /* cache it */
|
||||
|
||||
float m_val; /* Masking compensation value */
|
||||
|
@ -129,7 +129,7 @@ extern void _vp_remove_floor(vorbis_look_psy *p,
|
|||
int sliding_lowpass);
|
||||
|
||||
extern void _vp_noisemask(vorbis_look_psy *p,
|
||||
float *logmdct,
|
||||
float *logmdct,
|
||||
float *logmask);
|
||||
|
||||
extern void _vp_tonemask(vorbis_look_psy *p,
|
||||
|
@ -183,4 +183,3 @@ extern void hf_reduction(vorbis_info_psy_global *g,
|
|||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: registry for time, floor, res backends and channel mappings
|
||||
last mod: $Id$
|
||||
last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: linear scale -> dB, Bark and Mel scales
|
||||
last mod: $Id$
|
||||
last mod: $Id: scales.h 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -63,9 +63,9 @@ static float unitnorm(float x){
|
|||
#define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f)
|
||||
#define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define fromdB(x) (exp((x)*.11512925f))
|
||||
#define fromdB(x) (exp((x)*.11512925f))
|
||||
|
||||
/* The bark scale equations are approximations, since the original
|
||||
table was somewhat hand rolled. The below are chosen to have the
|
||||
|
@ -88,4 +88,3 @@ static float unitnorm(float x){
|
|||
#define fromOC(o) (exp(((o)+5.965784f)*.693147f))
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: fft transform
|
||||
last mod: $Id$
|
||||
last mod: $Id: smallft.h 13293 2007-07-24 00:09:47Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: single-block PCM analysis mode dispatch
|
||||
last mod: $Id$
|
||||
last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -26,8 +26,6 @@
|
|||
#include "os.h"
|
||||
#include "misc.h"
|
||||
|
||||
int analysis_noisy=1;
|
||||
|
||||
/* decides between modes, dispatches to the appropriate mapping. */
|
||||
int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
|
||||
int ret,i;
|
||||
|
@ -41,7 +39,7 @@ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
|
|||
/* first things first. Make sure encode is ready */
|
||||
for(i=0;i<PACKETBLOBS;i++)
|
||||
oggpack_reset(vbi->packetblob[i]);
|
||||
|
||||
|
||||
/* we only have one mapping type (0), and we let the mapping code
|
||||
itself figure out what soft mode to use. This allows easier
|
||||
bitrate management */
|
||||
|
@ -54,7 +52,7 @@ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
|
|||
/* The app is using a bitmanaged mode... but not using the
|
||||
bitrate management interface. */
|
||||
return(OV_EINVAL);
|
||||
|
||||
|
||||
op->packet=oggpack_get_buffer(&vb->opb);
|
||||
op->bytes=oggpack_bytes(&vb->opb);
|
||||
op->b_o_s=0;
|
||||
|
@ -65,43 +63,42 @@ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
|
|||
return(0);
|
||||
}
|
||||
|
||||
#ifdef ANALYSIS
|
||||
int analysis_noisy=1;
|
||||
|
||||
/* 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){
|
||||
#if 0
|
||||
int j;
|
||||
FILE *of;
|
||||
char buffer[80];
|
||||
|
||||
/* if(i==5870){*/
|
||||
sprintf(buffer,"%s_%d.m",base,i);
|
||||
of=fopen(buffer,"w");
|
||||
|
||||
if(!of)perror("failed to open data dump file");
|
||||
|
||||
for(j=0;j<n;j++){
|
||||
if(bark){
|
||||
float b=toBARK((4000.f*j/n)+.25);
|
||||
fprintf(of,"%f ",b);
|
||||
}else
|
||||
if(off!=0)
|
||||
fprintf(of,"%f ",(double)(j+off)/8000.);
|
||||
else
|
||||
fprintf(of,"%f ",(double)j);
|
||||
|
||||
if(dB){
|
||||
float val;
|
||||
if(v[j]==0.)
|
||||
val=-140.;
|
||||
else
|
||||
val=todB(v+j);
|
||||
fprintf(of,"%f\n",val);
|
||||
}else{
|
||||
fprintf(of,"%f\n",v[j]);
|
||||
}
|
||||
sprintf(buffer,"%s_%d.m",base,i);
|
||||
of=fopen(buffer,"w");
|
||||
|
||||
if(!of)perror("failed to open data dump file");
|
||||
|
||||
for(j=0;j<n;j++){
|
||||
if(bark){
|
||||
float b=toBARK((4000.f*j/n)+.25);
|
||||
fprintf(of,"%f ",b);
|
||||
}else
|
||||
if(off!=0)
|
||||
fprintf(of,"%f ",(double)(j+off)/8000.);
|
||||
else
|
||||
fprintf(of,"%f ",(double)j);
|
||||
|
||||
if(dB){
|
||||
float val;
|
||||
if(v[j]==0.)
|
||||
val=-140.;
|
||||
else
|
||||
val=todB(v+j);
|
||||
fprintf(of,"%f\n",val);
|
||||
}else{
|
||||
fprintf(of,"%f\n",v[j]);
|
||||
}
|
||||
fclose(of);
|
||||
/* } */
|
||||
#endif
|
||||
}
|
||||
fclose(of);
|
||||
}
|
||||
|
||||
void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
|
||||
|
@ -109,7 +106,7 @@ void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
|
|||
if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: bitrate tracking and management
|
||||
last mod: $Id$
|
||||
last mod: $Id: bitrate.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -31,7 +31,7 @@ void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){
|
|||
bitrate_manager_info *bi=&ci->bi;
|
||||
|
||||
memset(bm,0,sizeof(*bm));
|
||||
|
||||
|
||||
if(bi && (bi->reservoir_bits>0)){
|
||||
long ratesamples=vi->rate;
|
||||
int halfsamples=ci->blocksizes[0]>>1;
|
||||
|
@ -42,8 +42,8 @@ void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){
|
|||
bm->avg_bitsper= rint(1.*bi->avg_rate*halfsamples/ratesamples);
|
||||
bm->min_bitsper= rint(1.*bi->min_rate*halfsamples/ratesamples);
|
||||
bm->max_bitsper= rint(1.*bi->max_rate*halfsamples/ratesamples);
|
||||
|
||||
bm->avgfloat=PACKETBLOBS/2;
|
||||
|
||||
bm->avgfloat=PACKETBLOBS/2;
|
||||
|
||||
/* not a necessary fix, but one that leads to a more balanced
|
||||
typical initialization */
|
||||
|
@ -53,7 +53,7 @@ void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){
|
|||
bm->avg_reservoir=desired_fill;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void vorbis_bitrate_clear(bitrate_manager_state *bm){
|
||||
|
@ -63,7 +63,7 @@ void vorbis_bitrate_clear(bitrate_manager_state *bm){
|
|||
|
||||
int vorbis_bitrate_managed(vorbis_block *vb){
|
||||
vorbis_dsp_state *vd=vb->vd;
|
||||
private_state *b=vd->backend_state;
|
||||
private_state *b=vd->backend_state;
|
||||
bitrate_manager_state *bm=&b->bms;
|
||||
|
||||
if(bm && bm->managed)return(1);
|
||||
|
@ -74,7 +74,7 @@ int vorbis_bitrate_managed(vorbis_block *vb){
|
|||
int vorbis_bitrate_addblock(vorbis_block *vb){
|
||||
vorbis_block_internal *vbi=vb->internal;
|
||||
vorbis_dsp_state *vd=vb->vd;
|
||||
private_state *b=vd->backend_state;
|
||||
private_state *b=vd->backend_state;
|
||||
bitrate_manager_state *bm=&b->bms;
|
||||
vorbis_info *vi=vd->vi;
|
||||
codec_setup_info *ci=vi->codec_setup;
|
||||
|
@ -89,7 +89,7 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
|||
if(!bm->managed){
|
||||
/* not a bitrate managed stream, but for API simplicity, we'll
|
||||
buffer the packet to keep the code path clean */
|
||||
|
||||
|
||||
if(bm->vb)return(-1); /* one has been submitted without
|
||||
being claimed */
|
||||
bm->vb=vb;
|
||||
|
@ -97,7 +97,7 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
|||
}
|
||||
|
||||
bm->vb=vb;
|
||||
|
||||
|
||||
/* look ahead for avg floater */
|
||||
if(bm->avg_bitsper>0){
|
||||
double slew=0.;
|
||||
|
@ -149,7 +149,7 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* enforce max (if used) on the current floater (if used) */
|
||||
if(bm->max_bitsper>0){
|
||||
/* do we need to force the bitrate down? */
|
||||
|
@ -170,9 +170,9 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
|||
frame will need to be truncated */
|
||||
long maxsize=(max_target_bits+(bi->reservoir_bits-bm->minmax_reservoir))/8;
|
||||
bm->choice=choice=0;
|
||||
|
||||
|
||||
if(oggpack_bytes(vbi->packetblob[choice])>maxsize){
|
||||
|
||||
|
||||
oggpack_writetrunc(vbi->packetblob[choice],maxsize*8);
|
||||
this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
|
|||
|
||||
/* avg reservoir */
|
||||
if(bm->avg_bitsper>0){
|
||||
long avg_target_bits=(vb->W?bm->avg_bitsper*bm->short_per_long:bm->avg_bitsper);
|
||||
long avg_target_bits=(vb->W?bm->avg_bitsper*bm->short_per_long:bm->avg_bitsper);
|
||||
bm->avg_reservoir+=this_bits-avg_target_bits;
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,ogg_packet *op){
|
|||
|
||||
if(op){
|
||||
vorbis_block_internal *vbi=vb->internal;
|
||||
|
||||
|
||||
if(vorbis_bitrate_managed(vb))
|
||||
choice=bm->choice;
|
||||
|
||||
|
@ -247,7 +247,7 @@ int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,ogg_packet *op){
|
|||
op->granulepos=vb->granulepos;
|
||||
op->packetno=vb->sequence; /* for sake of completeness */
|
||||
}
|
||||
|
||||
|
||||
bm->vb=0;
|
||||
return(1);
|
||||
}
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: PCM data vector blocking, windowing and dis/reassembly
|
||||
last mod: $Id$
|
||||
last mod: $Id: block.c 16330 2009-07-24 01:58:50Z xiphmont $
|
||||
|
||||
Handle windowing, overlap-add, etc of the PCM vectors. This is made
|
||||
more amusing by Vorbis' current two allowed block sizes.
|
||||
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -50,28 +50,28 @@ static int ilog2(unsigned int v){
|
|||
:.....''' |_____--- '''......| | \_______|
|
||||
:.................|__________________|_______|__|______|
|
||||
|<------ Sl ------>| > Sr < |endW
|
||||
|beginSl |endSl | |endSr
|
||||
|beginSl |endSl | |endSr
|
||||
|beginW |endlW |beginSr
|
||||
|
||||
|
||||
|< lW >|
|
||||
|< lW >|
|
||||
<--------------- W ---------------->
|
||||
| | .. ______________ |
|
||||
| | ' `/ | ---_ |
|
||||
|___.'___/`. | ---_____|
|
||||
|___.'___/`. | ---_____|
|
||||
|_______|__|_______|_________________|
|
||||
| >|Sl|< |<------ Sr ----->|endW
|
||||
| | |endSl |beginSr |endSr
|
||||
|beginW | |endlW
|
||||
|beginW | |endlW
|
||||
mult[0] |beginSl mult[n]
|
||||
|
||||
<-------------- lW ----------------->
|
||||
|<--W-->|
|
||||
: .............. ___ | |
|
||||
: .''' |`/ \ | |
|
||||
:.....''' |/`....\|...|
|
||||
:.........................|___|___|___|
|
||||
|Sl |Sr |endW
|
||||
|<--W-->|
|
||||
: .............. ___ | |
|
||||
: .''' |`/ \ | |
|
||||
:.....''' |/`....\|...|
|
||||
:.........................|___|___|___|
|
||||
|Sl |Sr |endW
|
||||
| | |endSr
|
||||
| |beginSr
|
||||
| |endSl
|
||||
|
@ -102,7 +102,7 @@ int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
|
|||
_ogg_calloc(1,sizeof(oggpack_buffer));
|
||||
}
|
||||
oggpack_writeinit(vbi->packetblob[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
|
@ -183,7 +183,7 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
|
|||
int hs;
|
||||
|
||||
if(ci==NULL) return 1;
|
||||
hs=ci->halfrate_flag;
|
||||
hs=ci->halfrate_flag;
|
||||
|
||||
memset(v,0,sizeof(*v));
|
||||
b=v->backend_state=_ogg_calloc(1,sizeof(*b));
|
||||
|
@ -230,15 +230,16 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
|
|||
v->analysisp=1;
|
||||
}else{
|
||||
/* finish the codebooks */
|
||||
if(!ci->fullbooks){
|
||||
if(!ci->fullbooks)
|
||||
ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
|
||||
for(i=0;i<ci->books;i++){
|
||||
if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]))
|
||||
return -1;
|
||||
for(i=0;i<ci->books;i++){
|
||||
if(ci->book_param[i]==NULL)
|
||||
goto abort_books;
|
||||
if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]))
|
||||
goto abort_books;
|
||||
/* decode codebooks are now standalone after init */
|
||||
vorbis_staticbook_destroy(ci->book_param[i]);
|
||||
ci->book_param[i]=NULL;
|
||||
}
|
||||
vorbis_staticbook_destroy(ci->book_param[i]);
|
||||
ci->book_param[i]=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,9 +274,18 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
|
|||
|
||||
for(i=0;i<ci->residues;i++)
|
||||
b->residue[i]=_residue_P[ci->residue_type[i]]->
|
||||
look(v,ci->residue_param[i]);
|
||||
look(v,ci->residue_param[i]);
|
||||
|
||||
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 */
|
||||
|
@ -311,7 +321,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
|
|||
private_state *b=v->backend_state;
|
||||
|
||||
if(b){
|
||||
|
||||
|
||||
if(b->ve){
|
||||
_ve_envelope_clear(b->ve);
|
||||
_ogg_free(b->ve);
|
||||
|
@ -356,7 +366,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
|
|||
drft_clear(&b->fft_look[1]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(v->pcm){
|
||||
if(vi)
|
||||
for(i=0;i<vi->channels;i++)
|
||||
|
@ -372,7 +382,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
|
|||
if(b->header2)_ogg_free(b->header2);
|
||||
_ogg_free(b);
|
||||
}
|
||||
|
||||
|
||||
memset(v,0,sizeof(*v));
|
||||
}
|
||||
}
|
||||
|
@ -389,10 +399,10 @@ float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
|
|||
|
||||
/* Do we have enough storage space for the requested buffer? If not,
|
||||
expand the PCM (and envelope) storage */
|
||||
|
||||
|
||||
if(v->pcm_current+vals>=v->pcm_storage){
|
||||
v->pcm_storage=v->pcm_current+vals*2;
|
||||
|
||||
|
||||
for(i=0;i<vi->channels;i++){
|
||||
v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i]));
|
||||
}
|
||||
|
@ -400,7 +410,7 @@ float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
|
|||
|
||||
for(i=0;i<vi->channels;i++)
|
||||
v->pcmret[i]=v->pcm[i]+v->pcm_current;
|
||||
|
||||
|
||||
return(v->pcmret);
|
||||
}
|
||||
|
||||
|
@ -417,7 +427,7 @@ static void _preextrapolate_helper(vorbis_dsp_state *v){
|
|||
/* need to run the extrapolation in reverse! */
|
||||
for(j=0;j<v->pcm_current;j++)
|
||||
work[j]=v->pcm[i][v->pcm_current-j-1];
|
||||
|
||||
|
||||
/* prime as above */
|
||||
vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order);
|
||||
|
||||
|
@ -430,8 +440,8 @@ static void _preextrapolate_helper(vorbis_dsp_state *v){
|
|||
}else{
|
||||
_analysis_output("predata",0,work,v->pcm_current-v->centerW,0,0,0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* run the predictor filter */
|
||||
vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order,
|
||||
order,
|
||||
|
@ -467,7 +477,7 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
|
|||
amplitude off a cliff, creating spread spectrum noise that will
|
||||
suck to encode. Extrapolate for the sake of cleanliness. */
|
||||
|
||||
vorbis_analysis_buffer(v,ci->blocksizes[1]*3);
|
||||
vorbis_analysis_buffer(v,ci->blocksizes[1]*3);
|
||||
v->eofflag=v->pcm_current;
|
||||
v->pcm_current+=ci->blocksizes[1]*3;
|
||||
|
||||
|
@ -534,7 +544,7 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
/* we do an envelope search even on a single blocksize; we may still
|
||||
be throwing more bits at impulses, and envelope search handles
|
||||
marking impulses too. */
|
||||
{
|
||||
{
|
||||
long bp=_ve_envelope_search(v);
|
||||
if(bp==-1){
|
||||
|
||||
|
@ -566,7 +576,7 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* fill in the block. Note that for a short window, lW and nW are *short*
|
||||
regardless of actual settings in the stream */
|
||||
|
||||
|
@ -594,12 +604,12 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vb->vd=v;
|
||||
vb->sequence=v->sequence++;
|
||||
vb->granulepos=v->granulepos;
|
||||
vb->pcmend=ci->blocksizes[v->W];
|
||||
|
||||
|
||||
/* copy the vectors; this uses the local storage in vb */
|
||||
|
||||
/* this tracks 'strongest peak' for later psychoacoustics */
|
||||
|
@ -607,7 +617,7 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
if(vbi->ampmax>g->ampmax)g->ampmax=vbi->ampmax;
|
||||
g->ampmax=_vp_ampmax_decay(g->ampmax,v);
|
||||
vbi->ampmax=g->ampmax;
|
||||
|
||||
|
||||
vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
|
||||
vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(*vbi->pcmdelay)*vi->channels);
|
||||
for(i=0;i<vi->channels;i++){
|
||||
|
@ -615,14 +625,14 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
_vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i]));
|
||||
memcpy(vbi->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i]));
|
||||
vb->pcm[i]=vbi->pcmdelay[i]+beginW;
|
||||
|
||||
/* before we added the delay
|
||||
|
||||
/* before we added the delay
|
||||
vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
|
||||
memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(*vb->pcm[i]));
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* handle eof detection: eof==0 means that we've not yet received EOF
|
||||
eof>0 marks the last 'real' sample in pcm[]
|
||||
eof<0 'no more to do'; doesn't get here */
|
||||
|
@ -644,16 +654,16 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
|
||||
_ve_envelope_shift(b->ve,movementW);
|
||||
v->pcm_current-=movementW;
|
||||
|
||||
|
||||
for(i=0;i<vi->channels;i++)
|
||||
memmove(v->pcm[i],v->pcm[i]+movementW,
|
||||
v->pcm_current*sizeof(*v->pcm[i]));
|
||||
|
||||
|
||||
|
||||
|
||||
v->lW=v->W;
|
||||
v->W=v->nW;
|
||||
v->centerW=new_centerNext;
|
||||
|
||||
|
||||
if(v->eofflag){
|
||||
v->eofflag-=movementW;
|
||||
if(v->eofflag<=0)v->eofflag=-1;
|
||||
|
@ -682,11 +692,11 @@ int vorbis_synthesis_restart(vorbis_dsp_state *v){
|
|||
if(!vi)return -1;
|
||||
ci=vi->codec_setup;
|
||||
if(!ci)return -1;
|
||||
hs=ci->halfrate_flag;
|
||||
hs=ci->halfrate_flag;
|
||||
|
||||
v->centerW=ci->blocksizes[1]>>(hs+1);
|
||||
v->pcm_current=v->centerW>>hs;
|
||||
|
||||
|
||||
v->pcm_returned=-1;
|
||||
v->granulepos=-1;
|
||||
v->sequence=-1;
|
||||
|
@ -713,16 +723,16 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
vorbis_info *vi=v->vi;
|
||||
codec_setup_info *ci=vi->codec_setup;
|
||||
private_state *b=v->backend_state;
|
||||
int hs=ci->halfrate_flag;
|
||||
int hs=ci->halfrate_flag;
|
||||
int i,j;
|
||||
|
||||
if(!vb)return(OV_EINVAL);
|
||||
if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL);
|
||||
|
||||
|
||||
v->lW=v->W;
|
||||
v->W=vb->W;
|
||||
v->nW=-1;
|
||||
|
||||
|
||||
if((v->sequence==-1)||
|
||||
(v->sequence+1 != vb->sequence)){
|
||||
v->granulepos=-1; /* out of sequence; lose count */
|
||||
|
@ -730,8 +740,8 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
}
|
||||
|
||||
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 */
|
||||
int n=ci->blocksizes[v->W]>>(hs+1);
|
||||
int n0=ci->blocksizes[0]>>(hs+1);
|
||||
|
@ -739,12 +749,12 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
|
||||
int thisCenter;
|
||||
int prevCenter;
|
||||
|
||||
|
||||
v->glue_bits+=vb->glue_bits;
|
||||
v->time_bits+=vb->time_bits;
|
||||
v->floor_bits+=vb->floor_bits;
|
||||
v->res_bits+=vb->res_bits;
|
||||
|
||||
|
||||
if(v->centerW){
|
||||
thisCenter=n1;
|
||||
prevCenter=0;
|
||||
|
@ -752,11 +762,11 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
thisCenter=0;
|
||||
prevCenter=n1;
|
||||
}
|
||||
|
||||
|
||||
/* v->pcm is now used like a two-stage double buffer. We don't want
|
||||
to have to constantly shift *or* adjust memory usage. Don't
|
||||
accept a new block until the old is shifted out */
|
||||
|
||||
|
||||
for(j=0;j<vi->channels;j++){
|
||||
/* the overlap/add section */
|
||||
if(v->lW){
|
||||
|
@ -794,7 +804,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* the copy section */
|
||||
{
|
||||
float *pcm=v->pcm[j]+thisCenter;
|
||||
|
@ -803,16 +813,16 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
pcm[i]=p[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(v->centerW)
|
||||
v->centerW=0;
|
||||
else
|
||||
v->centerW=n1;
|
||||
|
||||
|
||||
/* deal with initial packet state; we do this using the explicit
|
||||
pcm_returned==-1 flag otherwise we're sensitive to first block
|
||||
being short or long */
|
||||
|
||||
|
||||
if(v->pcm_returned==-1){
|
||||
v->pcm_returned=thisCenter;
|
||||
v->pcm_current=thisCenter;
|
||||
|
@ -822,14 +832,14 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
((ci->blocksizes[v->lW]/4+
|
||||
ci->blocksizes[v->W]/4)>>hs);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* track the frame number... This is for convenience, but also
|
||||
making sure our last packet doesn't end with added padding. If
|
||||
the last packet is partial, the number of samples we'll have to
|
||||
return will be past the vb->granulepos.
|
||||
|
||||
|
||||
This is not foolproof! It will be confused if we begin
|
||||
decoding at the last page after a seek or hole. In that case,
|
||||
we don't have a starting point to judge where the last frame
|
||||
|
@ -841,7 +851,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
}else{
|
||||
b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
|
||||
}
|
||||
|
||||
|
||||
if(v->granulepos==-1){
|
||||
if(vb->granulepos!=-1){ /* only set if we have a position to set to */
|
||||
|
||||
|
@ -857,7 +867,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
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;
|
||||
}else{
|
||||
/* trim the beginning */
|
||||
|
@ -872,7 +882,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
}else{
|
||||
v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
|
||||
if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
|
||||
|
||||
|
||||
if(v->granulepos>vb->granulepos){
|
||||
long extra=v->granulepos-vb->granulepos;
|
||||
|
||||
|
@ -887,12 +897,12 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
|||
v->granulepos=vb->granulepos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Update, cleanup */
|
||||
|
||||
|
||||
if(vb->eofflag)v->eofflag=1;
|
||||
return(0);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* pcm==NULL indicates we just want the pending samples, no more */
|
||||
|
@ -925,8 +935,8 @@ int vorbis_synthesis_read(vorbis_dsp_state *v,int n){
|
|||
int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
|
||||
vorbis_info *vi=v->vi;
|
||||
codec_setup_info *ci=vi->codec_setup;
|
||||
int hs=ci->halfrate_flag;
|
||||
|
||||
int hs=ci->halfrate_flag;
|
||||
|
||||
int n=ci->blocksizes[v->W]>>(hs+1);
|
||||
int n0=ci->blocksizes[0]>>(hs+1);
|
||||
int n1=ci->blocksizes[1]>>(hs+1);
|
||||
|
@ -960,7 +970,7 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
|
|||
v->pcm_returned-=n1;
|
||||
v->centerW=0;
|
||||
}
|
||||
|
||||
|
||||
/* solidify buffer into contiguous space */
|
||||
if((v->lW^v->W)==1){
|
||||
/* long/short or short/long */
|
||||
|
@ -985,7 +995,7 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
|
|||
v->pcm_current+=n1-n0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(pcm){
|
||||
int i;
|
||||
for(i=0;i<vi->channels;i++)
|
||||
|
@ -1000,10 +1010,9 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
|
|||
float *vorbis_window(vorbis_dsp_state *v,int W){
|
||||
vorbis_info *vi=v->vi;
|
||||
codec_setup_info *ci=vi->codec_setup;
|
||||
int hs=ci->halfrate_flag;
|
||||
int hs=ci->halfrate_flag;
|
||||
private_state *b=v->backend_state;
|
||||
|
||||
if(b->window[W]-1<0)return NULL;
|
||||
return _vorbis_window_get(b->window[W]-hs);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: basic codebook pack/unpack/code/decode operations
|
||||
last mod: $Id$
|
||||
last mod: $Id: codebook.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -38,11 +38,11 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
|
|||
|
||||
/* pack the codewords. There are two packings; length ordered and
|
||||
length random. Decide between the two now. */
|
||||
|
||||
|
||||
for(i=1;i<c->entries;i++)
|
||||
if(c->lengthlist[i-1]==0 || c->lengthlist[i]<c->lengthlist[i-1])break;
|
||||
if(i==c->entries)ordered=1;
|
||||
|
||||
|
||||
if(ordered){
|
||||
/* length ordered. We only need to say how many codewords of
|
||||
each length. The actual codewords are generated
|
||||
|
@ -63,12 +63,12 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
|
|||
}
|
||||
}
|
||||
oggpack_write(opb,i-count,_ilog(c->entries-count));
|
||||
|
||||
|
||||
}else{
|
||||
/* length random. Again, we don't code the codeword itself, just
|
||||
the length. This time, though, we have to encode each length */
|
||||
oggpack_write(opb,0,1); /* unordered */
|
||||
|
||||
|
||||
/* algortihmic mapping has use for 'unused entries', which we tag
|
||||
here. The algorithmic mapping happens as usual, but the unused
|
||||
entry has no codeword. */
|
||||
|
@ -102,18 +102,18 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
|
|||
case 1:case 2:
|
||||
/* implicitly populated value mapping */
|
||||
/* explicitly populated value mapping */
|
||||
|
||||
|
||||
if(!c->quantlist){
|
||||
/* no quantlist? error */
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
/* values that define the dequantization */
|
||||
oggpack_write(opb,c->q_min,32);
|
||||
oggpack_write(opb,c->q_delta,32);
|
||||
oggpack_write(opb,c->q_quant-1,4);
|
||||
oggpack_write(opb,c->q_sequencep,1);
|
||||
|
||||
|
||||
{
|
||||
int quantvals;
|
||||
switch(c->maptype){
|
||||
|
@ -187,7 +187,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
|
|||
s->lengthlist[i]=num+1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 1:
|
||||
/* ordered */
|
||||
|
@ -208,7 +208,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
|
|||
/* EOF */
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
/* Do we have a mapping to unpack? */
|
||||
switch((s->maptype=oggpack_read(opb,4))){
|
||||
case 0:
|
||||
|
@ -222,6 +222,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
|
|||
s->q_delta=oggpack_read(opb,32);
|
||||
s->q_quant=oggpack_read(opb,4)+1;
|
||||
s->q_sequencep=oggpack_read(opb,1);
|
||||
if(s->q_sequencep==-1)goto _eofout;
|
||||
|
||||
{
|
||||
int quantvals=0;
|
||||
|
@ -233,12 +234,12 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
|
|||
quantvals=s->entries*s->dim;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* quantized values */
|
||||
s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals);
|
||||
for(i=0;i<quantvals;i++)
|
||||
s->quantlist[i]=oggpack_read(opb,s->q_quant);
|
||||
|
||||
|
||||
if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout;
|
||||
}
|
||||
break;
|
||||
|
@ -248,11 +249,11 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
|
|||
|
||||
/* all set */
|
||||
return(0);
|
||||
|
||||
|
||||
_errout:
|
||||
_eofout:
|
||||
vorbis_staticbook_clear(s);
|
||||
return(-1);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/* returns the number of bits ************************************************/
|
||||
|
@ -313,7 +314,7 @@ STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){
|
|||
int read=book->dec_maxlength;
|
||||
long lo,hi;
|
||||
long lok = oggpack_look(b,book->dec_firsttablen);
|
||||
|
||||
|
||||
if (lok >= 0) {
|
||||
long entry = book->dec_firsttable[lok];
|
||||
if(entry&0x80000000UL){
|
||||
|
@ -327,30 +328,30 @@ STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){
|
|||
lo=0;
|
||||
hi=book->used_entries;
|
||||
}
|
||||
|
||||
|
||||
lok = oggpack_look(b, read);
|
||||
|
||||
|
||||
while(lok<0 && read>1)
|
||||
lok = oggpack_look(b, --read);
|
||||
if(lok<0)return -1;
|
||||
|
||||
|
||||
/* bisect search for the codeword in the ordered list */
|
||||
{
|
||||
ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok);
|
||||
|
||||
|
||||
while(hi-lo>1){
|
||||
long p=(hi-lo)>>1;
|
||||
long test=book->codelist[lo+p]>testword;
|
||||
long test=book->codelist[lo+p]>testword;
|
||||
lo+=p&(test-1);
|
||||
hi-=p&(-test);
|
||||
}
|
||||
|
||||
|
||||
if(book->dec_codelengths[lo]<=read){
|
||||
oggpack_adv(b, book->dec_codelengths[lo]);
|
||||
return(lo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
oggpack_adv(b, read);
|
||||
|
||||
return(-1);
|
||||
|
@ -359,13 +360,13 @@ STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){
|
|||
/* Decode side is specced and easier, because we don't need to find
|
||||
matches using different criteria; we simply read and map. There are
|
||||
two things we need to do 'depending':
|
||||
|
||||
|
||||
We may need to support interleave. We don't really, but it's
|
||||
convenient to do it here rather than rebuild the vector later.
|
||||
|
||||
Cascades may be additive or multiplicitive; this is not inherent in
|
||||
the codebook, but set in the code using the codebook. Like
|
||||
interleaving, it's easiest to do it here.
|
||||
interleaving, it's easiest to do it here.
|
||||
addmul==0 -> declarative (set the value)
|
||||
addmul==1 -> additive
|
||||
addmul==2 -> multiplicitive */
|
||||
|
@ -389,7 +390,7 @@ long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
|
|||
long *entry = alloca(sizeof(*entry)*step);
|
||||
float **t = alloca(sizeof(*t)*step);
|
||||
int i,j,o;
|
||||
|
||||
|
||||
for (i = 0; i < step; i++) {
|
||||
entry[i]=decode_packed_entry_number(book,b);
|
||||
if(entry[i]==-1)return(-1);
|
||||
|
@ -406,7 +407,7 @@ long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
|
|||
if(book->used_entries>0){
|
||||
int i,j,entry;
|
||||
float *t;
|
||||
|
||||
|
||||
if(book->dim>8){
|
||||
for(i=0;i<n;){
|
||||
entry = decode_packed_entry_number(book,b);
|
||||
|
@ -442,7 +443,7 @@ long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
@ -451,7 +452,7 @@ long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
|
|||
if(book->used_entries>0){
|
||||
int i,j,entry;
|
||||
float *t;
|
||||
|
||||
|
||||
for(i=0;i<n;){
|
||||
entry = decode_packed_entry_number(book,b);
|
||||
if(entry==-1)return(-1);
|
||||
|
@ -461,7 +462,7 @@ long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
|
|||
}
|
||||
}else{
|
||||
int i,j;
|
||||
|
||||
|
||||
for(i=0;i<n;){
|
||||
for (j=0;j<book->dim;)
|
||||
a[i++]=0.f;
|
||||
|
@ -573,7 +574,7 @@ int main(){
|
|||
oggpack_buffer read;
|
||||
long ptr=0,i;
|
||||
oggpack_writeinit(&write);
|
||||
|
||||
|
||||
fprintf(stderr,"Testing codebook abstraction...:\n");
|
||||
|
||||
while(testlist[ptr]){
|
||||
|
@ -597,7 +598,7 @@ int main(){
|
|||
vorbis_book_encodev(&c,best,qv+i,&write);
|
||||
}
|
||||
vorbis_book_clear(&c);
|
||||
|
||||
|
||||
fprintf(stderr,"OK.\n");
|
||||
fprintf(stderr,"\tunpacking/decoding %ld... ",ptr);
|
||||
|
||||
|
@ -623,7 +624,7 @@ int main(){
|
|||
iv[i],qv[i],i);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
fprintf(stderr,"OK\n");
|
||||
ptr++;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: PCM data envelope analysis
|
||||
last mod: $Id$
|
||||
function: PCM data envelope analysis
|
||||
last mod: $Id: envelope.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -67,7 +67,7 @@ void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){
|
|||
}
|
||||
e->band[j].total=1./e->band[j].total;
|
||||
}
|
||||
|
||||
|
||||
e->filter=_ogg_calloc(VE_BANDS*ch,sizeof(*e->filter));
|
||||
e->mark=_ogg_calloc(e->storage,sizeof(*e->mark));
|
||||
|
||||
|
@ -110,15 +110,15 @@ static int _ve_amp(envelope_lookup *ve,
|
|||
float penalty=gi->stretch_penalty-(ve->stretch/2-VE_MINSTRETCH);
|
||||
if(penalty<0.f)penalty=0.f;
|
||||
if(penalty>gi->stretch_penalty)penalty=gi->stretch_penalty;
|
||||
|
||||
|
||||
/*_analysis_output_always("lpcm",seq2,data,n,0,0,
|
||||
totalshift+pos*ve->searchstep);*/
|
||||
|
||||
|
||||
/* window and transform */
|
||||
for(i=0;i<n;i++)
|
||||
vec[i]=data[i]*ve->mdct_win[i];
|
||||
mdct_forward(&ve->mdct,vec,vec);
|
||||
|
||||
|
||||
/*_analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */
|
||||
|
||||
/* near-DC spreading function; this has nothing to do with
|
||||
|
@ -144,7 +144,7 @@ static int _ve_amp(envelope_lookup *ve,
|
|||
if(filters->nearptr>=VE_NEARDC)filters->nearptr=0;
|
||||
decay=todB(&decay)*.5-15.f;
|
||||
}
|
||||
|
||||
|
||||
/* perform spreading and limiting, also smooth the spectrum. yes,
|
||||
the MDCT results in all real coefficients, but it still *behaves*
|
||||
like real/imaginary pairs */
|
||||
|
@ -158,7 +158,7 @@ static int _ve_amp(envelope_lookup *ve,
|
|||
}
|
||||
|
||||
/*_analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/
|
||||
|
||||
|
||||
/* perform preecho/postecho triggering by band */
|
||||
for(j=0;j<VE_BANDS;j++){
|
||||
float acc=0.;
|
||||
|
@ -167,27 +167,27 @@ static int _ve_amp(envelope_lookup *ve,
|
|||
/* accumulate amplitude */
|
||||
for(i=0;i<bands[j].end;i++)
|
||||
acc+=vec[i+bands[j].begin]*bands[j].window[i];
|
||||
|
||||
|
||||
acc*=bands[j].total;
|
||||
|
||||
/* convert amplitude to delta */
|
||||
{
|
||||
int p,this=filters[j].ampptr;
|
||||
float postmax,postmin,premax=-99999.f,premin=99999.f;
|
||||
|
||||
|
||||
p=this;
|
||||
p--;
|
||||
if(p<0)p+=VE_AMP;
|
||||
postmax=max(acc,filters[j].ampbuf[p]);
|
||||
postmin=min(acc,filters[j].ampbuf[p]);
|
||||
|
||||
|
||||
for(i=0;i<stretch;i++){
|
||||
p--;
|
||||
if(p<0)p+=VE_AMP;
|
||||
premax=max(premax,filters[j].ampbuf[p]);
|
||||
premin=min(premin,filters[j].ampbuf[p]);
|
||||
}
|
||||
|
||||
|
||||
valmin=postmin-premin;
|
||||
valmax=postmax-premax;
|
||||
|
||||
|
@ -204,7 +204,7 @@ static int _ve_amp(envelope_lookup *ve,
|
|||
}
|
||||
if(valmin<gi->postecho_thresh[j]-penalty)ret|=2;
|
||||
}
|
||||
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ long _ve_envelope_search(vorbis_dsp_state *v){
|
|||
ve->stretch++;
|
||||
if(ve->stretch>VE_MAXSTRETCH*2)
|
||||
ve->stretch=VE_MAXSTRETCH*2;
|
||||
|
||||
|
||||
for(i=0;i<ve->ch;i++){
|
||||
float *pcm=v->pcm[i]+ve->searchstep*(j);
|
||||
ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS);
|
||||
|
@ -265,13 +265,13 @@ long _ve_envelope_search(vorbis_dsp_state *v){
|
|||
ci->blocksizes[v->W]/4+
|
||||
ci->blocksizes[1]/2+
|
||||
ci->blocksizes[0]/4;
|
||||
|
||||
|
||||
j=ve->cursor;
|
||||
|
||||
|
||||
while(j<ve->current-(ve->searchstep)){/* account for postecho
|
||||
working back one window */
|
||||
if(j>=testW)return(1);
|
||||
|
||||
|
||||
ve->cursor=j;
|
||||
|
||||
if(ve->mark[j/ve->searchstep]){
|
||||
|
@ -291,7 +291,7 @@ long _ve_envelope_search(vorbis_dsp_state *v){
|
|||
|
||||
_analysis_output_always("markL",seq,v->pcm[0],j,0,0,totalshift);
|
||||
_analysis_output_always("markR",seq,v->pcm[1],j,0,0,totalshift);
|
||||
|
||||
|
||||
for(m=0;m<VE_BANDS;m++){
|
||||
char buf[80];
|
||||
sprintf(buf,"delL%d",m);
|
||||
|
@ -308,10 +308,10 @@ long _ve_envelope_search(vorbis_dsp_state *v){
|
|||
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
||||
seq++;
|
||||
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -323,7 +323,7 @@ long _ve_envelope_search(vorbis_dsp_state *v){
|
|||
j+=ve->searchstep;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
@ -359,23 +359,17 @@ void _ve_envelope_shift(envelope_lookup *e,long shift){
|
|||
int smallshift=shift/e->searchstep;
|
||||
|
||||
memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark));
|
||||
|
||||
|
||||
#if 0
|
||||
for(i=0;i<VE_BANDS*e->ch;i++)
|
||||
memmove(e->filter[i].markers,
|
||||
e->filter[i].markers+smallshift,
|
||||
(1024-smallshift)*sizeof(*(*e->filter).markers));
|
||||
totalshift+=shift;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
e->current-=shift;
|
||||
if(e->curmark>=0)
|
||||
e->curmark-=shift;
|
||||
e->cursor-=shift;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: floor backend 0 implementation
|
||||
last mod: $Id$
|
||||
last mod: $Id: floor0.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -82,12 +82,12 @@ static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
|||
info->ampbits=oggpack_read(opb,6);
|
||||
info->ampdB=oggpack_read(opb,8);
|
||||
info->numbooks=oggpack_read(opb,4)+1;
|
||||
|
||||
|
||||
if(info->order<1)goto err_out;
|
||||
if(info->rate<1)goto err_out;
|
||||
if(info->barkmap<1)goto err_out;
|
||||
if(info->numbooks<1)goto err_out;
|
||||
|
||||
|
||||
for(j=0;j<info->numbooks;j++){
|
||||
info->books[j]=oggpack_read(opb,8);
|
||||
if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
|
||||
|
@ -122,7 +122,7 @@ static void floor0_map_lazy_init(vorbis_block *vb,
|
|||
floor(bark(rate/2-1)*C)=mapped-1
|
||||
floor(bark(rate/2)*C)=mapped */
|
||||
float scale=look->ln/toBARK(info->rate/2.f);
|
||||
|
||||
|
||||
/* the mapping from a linear scale to a smaller bark scale is
|
||||
straightforward. We do *not* make sure that the linear mapping
|
||||
does not skip bark-scale bins; the decoder simply skips them and
|
||||
|
@ -131,7 +131,7 @@ static void floor0_map_lazy_init(vorbis_block *vb,
|
|||
accurate */
|
||||
look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap));
|
||||
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 */
|
||||
if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
|
||||
look->linearmap[W][j]=val;
|
||||
|
@ -164,7 +164,7 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
|
|||
long maxval=(1<<info->ampbits)-1;
|
||||
float amp=(float)ampraw/maxval*info->ampdB;
|
||||
int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
|
||||
|
||||
|
||||
if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
|
||||
codec_setup_info *ci=vb->vd->vi->codec_setup;
|
||||
codebook *b=ci->fullbooks+info->books[booknum];
|
||||
|
@ -174,14 +174,14 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
|
|||
smash; b->dim is provably more than we can overflow the
|
||||
vector */
|
||||
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+j,&vb->opb,b->dim)==-1)goto eop;
|
||||
for(j=0;j<look->m;){
|
||||
for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
|
||||
last=lsp[j-1];
|
||||
}
|
||||
|
||||
|
||||
lsp[look->m]=amp;
|
||||
return(lsp);
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
|
|||
void *memo,float *out){
|
||||
vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
|
||||
vorbis_info_floor0 *info=look->vi;
|
||||
|
||||
|
||||
floor0_map_lazy_init(vb,info,look);
|
||||
|
||||
if(memo){
|
||||
|
@ -218,6 +218,3 @@ const vorbis_func_floor floor0_exportbundle={
|
|||
NULL,&floor0_unpack,&floor0_look,&floor0_free_info,
|
||||
&floor0_free_look,&floor0_inverse1,&floor0_inverse2
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: floor backend 1 implementation
|
||||
last mod: $Id$
|
||||
last mod: $Id: floor1.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -38,12 +38,12 @@ typedef struct lsfit_acc{
|
|||
long ya;
|
||||
long x2a;
|
||||
long y2a;
|
||||
long xya;
|
||||
long xya;
|
||||
long an;
|
||||
} lsfit_acc;
|
||||
|
||||
/***********************************************/
|
||||
|
||||
|
||||
static void floor1_free_info(vorbis_info_floor *i){
|
||||
vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
|
||||
if(info){
|
||||
|
@ -109,12 +109,12 @@ static void floor1_pack (vorbis_info_floor *i,oggpack_buffer *opb){
|
|||
}
|
||||
|
||||
/* save out the post list */
|
||||
oggpack_write(opb,info->mult-1,2); /* only 1,2,3,4 legal now */
|
||||
oggpack_write(opb,info->mult-1,2); /* only 1,2,3,4 legal now */
|
||||
oggpack_write(opb,ilog2(maxposit),4);
|
||||
rangebits=ilog2(maxposit);
|
||||
|
||||
for(j=0,k=0;j<info->partitions;j++){
|
||||
count+=info->class_dim[info->partitionclass[j]];
|
||||
count+=info->class_dim[info->partitionclass[j]];
|
||||
for(;k<count;k++)
|
||||
oggpack_write(opb,info->postlist[k+2],rangebits);
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
|||
info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
|
||||
for(j=0;j<info->partitions;j++){
|
||||
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];
|
||||
}
|
||||
|
||||
|
@ -153,11 +154,12 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
|||
}
|
||||
|
||||
/* 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);
|
||||
if(rangebits<0)goto err_out;
|
||||
|
||||
for(j=0,k=0;j<info->partitions;j++){
|
||||
count+=info->class_dim[info->partitionclass[j]];
|
||||
count+=info->class_dim[info->partitionclass[j]];
|
||||
for(;k<count;k++){
|
||||
int t=info->postlist[k+2]=oggpack_read(opb,rangebits);
|
||||
if(t<0 || t>=(1<<rangebits))
|
||||
|
@ -195,7 +197,7 @@ static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,
|
|||
|
||||
look->vi=info;
|
||||
look->n=info->postlist[1];
|
||||
|
||||
|
||||
/* we drop each position value in-between already decoded values,
|
||||
and use linear interpolation to predict each new value past the
|
||||
edges. The positions are read in the order of the position
|
||||
|
@ -284,70 +286,70 @@ static int vorbis_dBquant(const float *x){
|
|||
}
|
||||
|
||||
static const float FLOOR1_fromdB_LOOKUP[256]={
|
||||
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.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
|
||||
2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
|
||||
2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
|
||||
3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
|
||||
4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
|
||||
6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
|
||||
7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
|
||||
1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
|
||||
1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
|
||||
1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
|
||||
2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
|
||||
2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
|
||||
3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
|
||||
4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
|
||||
5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
|
||||
7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
|
||||
9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
|
||||
1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
|
||||
1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
|
||||
2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
|
||||
2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
|
||||
3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
|
||||
4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
|
||||
5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
|
||||
7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
|
||||
9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
|
||||
0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
|
||||
0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
|
||||
0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
|
||||
0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
|
||||
0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
|
||||
0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
|
||||
0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
|
||||
0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
|
||||
0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
|
||||
0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
|
||||
0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
|
||||
0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
|
||||
0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
|
||||
0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
|
||||
0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
|
||||
0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
|
||||
0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
|
||||
0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
|
||||
0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
|
||||
0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
|
||||
0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
|
||||
0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
|
||||
0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
|
||||
0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
|
||||
0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
|
||||
0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
|
||||
0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
|
||||
0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
|
||||
0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
|
||||
0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
|
||||
0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
|
||||
0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
|
||||
0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
|
||||
0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
|
||||
0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
|
||||
0.82788260F, 0.88168307F, 0.9389798F, 1.F,
|
||||
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.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
|
||||
2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
|
||||
2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
|
||||
3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
|
||||
4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
|
||||
6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
|
||||
7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
|
||||
1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
|
||||
1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
|
||||
1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
|
||||
2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
|
||||
2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
|
||||
3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
|
||||
4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
|
||||
5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
|
||||
7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
|
||||
9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
|
||||
1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
|
||||
1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
|
||||
2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
|
||||
2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
|
||||
3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
|
||||
4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
|
||||
5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
|
||||
7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
|
||||
9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
|
||||
0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
|
||||
0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
|
||||
0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
|
||||
0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
|
||||
0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
|
||||
0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
|
||||
0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
|
||||
0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
|
||||
0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
|
||||
0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
|
||||
0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
|
||||
0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
|
||||
0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
|
||||
0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
|
||||
0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
|
||||
0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
|
||||
0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
|
||||
0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
|
||||
0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
|
||||
0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
|
||||
0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
|
||||
0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
|
||||
0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
|
||||
0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
|
||||
0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
|
||||
0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
|
||||
0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
|
||||
0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
|
||||
0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
|
||||
0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
|
||||
0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
|
||||
0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
|
||||
0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
|
||||
0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
|
||||
0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
|
||||
0.82788260F, 0.88168307F, 0.9389798F, 1.F,
|
||||
};
|
||||
|
||||
static void render_line(int n, int x0,int x1,int y0,int y1,float *d){
|
||||
|
@ -512,7 +514,7 @@ static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1){
|
|||
if(*y1>1023)*y1=1023;
|
||||
if(*y0<0)*y0=0;
|
||||
if(*y1<0)*y1=0;
|
||||
|
||||
|
||||
return 0;
|
||||
}else{
|
||||
*y0=0;
|
||||
|
@ -605,7 +607,7 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
|||
int fit_valueB[VIF_POSIT+2]; /* index by range list position */
|
||||
|
||||
int loneighbor[VIF_POSIT+2]; /* sorted index of range list position (+2) */
|
||||
int hineighbor[VIF_POSIT+2];
|
||||
int hineighbor[VIF_POSIT+2];
|
||||
int *output=NULL;
|
||||
int memo[VIF_POSIT+2];
|
||||
|
||||
|
@ -625,7 +627,7 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
|||
look->sorted_index[i+1],fits+i,
|
||||
n,info);
|
||||
}
|
||||
|
||||
|
||||
if(nonzero){
|
||||
/* start by fitting the implicit base case.... */
|
||||
int y0=-200;
|
||||
|
@ -652,11 +654,11 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
|||
int lsortpos=look->reverse_index[ln];
|
||||
int hsortpos=look->reverse_index[hn];
|
||||
memo[ln]=hn;
|
||||
|
||||
|
||||
{
|
||||
/* A note: we want to bound/minimize *local*, not global, error */
|
||||
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 hy=post_Y(fit_valueA,fit_valueB,hn);
|
||||
|
||||
|
@ -693,7 +695,7 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
|||
fit_valueB[i]=hy0;
|
||||
fit_valueA[hn]=hy1;
|
||||
if(hn==1)fit_valueB[hn]=hy1;
|
||||
|
||||
|
||||
if(ly1>=0 || hy0>=0){
|
||||
/* store new neighbor values */
|
||||
for(j=sortpos-1;j>=0;j--)
|
||||
|
@ -735,7 +737,7 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
|||
int predicted=render_point(x0,x1,y0,y1,info->postlist[i]);
|
||||
int vx=post_Y(fit_valueA,fit_valueB,i);
|
||||
|
||||
if(vx>=0 && predicted!=vx){
|
||||
if(vx>=0 && predicted!=vx){
|
||||
output[i]=vx;
|
||||
}else{
|
||||
output[i]= predicted|0x8000;
|
||||
|
@ -746,7 +748,7 @@ int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
|||
return(output);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
|
||||
int *A,int *B,
|
||||
int del){
|
||||
|
@ -823,15 +825,15 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
|||
}else{
|
||||
int headroom=(look->quant_q-predicted<predicted?
|
||||
look->quant_q-predicted:predicted);
|
||||
|
||||
|
||||
int val=post[i]-predicted;
|
||||
|
||||
|
||||
/* at this point the 'deviation' value is in the range +/- max
|
||||
range, but the real, unique range can always be mapped to
|
||||
only [0-maxrange). So we want to wrap the deviation into
|
||||
this limited range, but do it in the way that least screws
|
||||
an essentially gaussian probability distribution. */
|
||||
|
||||
|
||||
if(val<0)
|
||||
if(val<-headroom)
|
||||
val=headroom-val-1;
|
||||
|
@ -842,7 +844,7 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
|||
val= val+headroom;
|
||||
else
|
||||
val<<=1;
|
||||
|
||||
|
||||
out[i]=val;
|
||||
post[ln]&=0x7fff;
|
||||
post[hn]&=0x7fff;
|
||||
|
@ -896,7 +898,7 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
|||
/* write it */
|
||||
look->phrasebits+=
|
||||
vorbis_book_encode(books+info->class_book[class],cval,opb);
|
||||
|
||||
|
||||
#ifdef TRAIN_FLOOR1
|
||||
{
|
||||
FILE *of;
|
||||
|
@ -909,7 +911,7 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* write post values */
|
||||
for(k=0;k<cdim;k++){
|
||||
int book=info->class_subbook[class][bookas[k]];
|
||||
|
@ -950,9 +952,9 @@ int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
|
|||
|
||||
hy*=info->mult;
|
||||
hx=info->postlist[current];
|
||||
|
||||
|
||||
render_line0(lx,hx,ly,hy,ilogmask);
|
||||
|
||||
|
||||
lx=hx;
|
||||
ly=hy;
|
||||
}
|
||||
|
@ -1044,7 +1046,7 @@ static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
|
|||
}else{
|
||||
fit_value[i]=predicted|0x8000;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(fit_value);
|
||||
|
@ -1072,12 +1074,12 @@ static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
|
|||
int current=look->forward_index[j];
|
||||
int hy=fit_value[current]&0x7fff;
|
||||
if(hy==fit_value[current]){
|
||||
|
||||
|
||||
hy*=info->mult;
|
||||
hx=info->postlist[current];
|
||||
|
||||
|
||||
render_line(n,lx,hx,ly,hy,out);
|
||||
|
||||
|
||||
lx=hx;
|
||||
ly=hy;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: maintain the info structure, info <-> header packets
|
||||
last mod: $Id$
|
||||
last mod: $Id: info.c 16243 2009-07-10 02:49:31Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "vorbis/codec.h"
|
||||
#include "codec_internal.h"
|
||||
|
@ -32,8 +31,8 @@
|
|||
#include "misc.h"
|
||||
#include "os.h"
|
||||
|
||||
#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.2.2"
|
||||
#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20090624"
|
||||
#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.2.3"
|
||||
#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20090709"
|
||||
|
||||
/* helpers */
|
||||
static int ilog2(unsigned int v){
|
||||
|
@ -103,7 +102,7 @@ char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count){
|
|||
|
||||
strcpy(fulltag, tag);
|
||||
strcat(fulltag, "=");
|
||||
|
||||
|
||||
for(i=0;i<vc->comments;i++){
|
||||
if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
|
||||
if(count == found)
|
||||
|
@ -178,13 +177,13 @@ void vorbis_info_clear(vorbis_info *vi){
|
|||
unpack, in which case the below type
|
||||
cannot be trusted */
|
||||
_floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
|
||||
|
||||
|
||||
for(i=0;i<ci->residues;i++) /* unpack does the range checking */
|
||||
if(ci->residue_param[i]) /* this may be cleaning up an aborted
|
||||
unpack, in which case the below type
|
||||
cannot be trusted */
|
||||
_residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
|
||||
|
||||
|
||||
for(i=0;i<ci->books;i++){
|
||||
if(ci->book_param[i]){
|
||||
/* knows if the book was not alloced */
|
||||
|
@ -195,7 +194,7 @@ void vorbis_info_clear(vorbis_info *vi){
|
|||
}
|
||||
if(ci->fullbooks)
|
||||
_ogg_free(ci->fullbooks);
|
||||
|
||||
|
||||
for(i=0;i<ci->psys;i++)
|
||||
_vi_psy_free(ci->psy_param[i]);
|
||||
|
||||
|
@ -223,10 +222,10 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
|
|||
|
||||
ci->blocksizes[0]=1<<oggpack_read(opb,4);
|
||||
ci->blocksizes[1]=1<<oggpack_read(opb,4);
|
||||
|
||||
|
||||
if(vi->rate<1)goto err_out;
|
||||
if(vi->channels<1)goto err_out;
|
||||
if(ci->blocksizes[0]<64)goto err_out;
|
||||
if(ci->blocksizes[0]<64)goto err_out;
|
||||
if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
|
||||
if(ci->blocksizes[1]>8192)goto err_out;
|
||||
|
||||
|
@ -242,24 +241,24 @@ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
|
|||
int i;
|
||||
int vendorlen=oggpack_read(opb,32);
|
||||
if(vendorlen<0)goto err_out;
|
||||
if(vendorlen+8>opb->storage)goto err_out;
|
||||
if(vendorlen>opb->storage-8)goto err_out;
|
||||
vc->vendor=_ogg_calloc(vendorlen+1,1);
|
||||
_v_readstring(opb,vc->vendor,vendorlen);
|
||||
i=oggpack_read(opb,32);
|
||||
if(i<0)goto err_out;
|
||||
if(4*i+oggpack_bytes(opb)>opb->storage)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->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
|
||||
|
||||
|
||||
for(i=0;i<vc->comments;i++){
|
||||
int len=oggpack_read(opb,32);
|
||||
if(len<0)goto err_out;
|
||||
if(len+oggpack_bytes(opb)>opb->storage)goto err_out;
|
||||
if(len>opb->storage-oggpack_bytes(opb))goto err_out;
|
||||
vc->comment_lengths[i]=len;
|
||||
vc->user_comments[i]=_ogg_calloc(len+1,1);
|
||||
_v_readstring(opb,vc->user_comments[i],len);
|
||||
}
|
||||
}
|
||||
if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
|
||||
|
||||
return(0);
|
||||
|
@ -277,7 +276,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
|||
|
||||
/* codebooks */
|
||||
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++){
|
||||
ci->book_param[i]=_ogg_calloc(1,sizeof(*ci->book_param[i]));
|
||||
if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
|
||||
|
@ -286,6 +285,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
|||
/* time backend settings; hooks are unused */
|
||||
{
|
||||
int times=oggpack_read(opb,6)+1;
|
||||
if(times<=0)goto err_out;
|
||||
for(i=0;i<times;i++){
|
||||
int test=oggpack_read(opb,16);
|
||||
if(test<0 || test>=VI_TIMEB)goto err_out;
|
||||
|
@ -294,8 +294,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
|||
|
||||
/* floor backend settings */
|
||||
ci->floors=oggpack_read(opb,6)+1;
|
||||
/*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/
|
||||
/*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/
|
||||
if(ci->floors<=0)goto err_out;
|
||||
for(i=0;i<ci->floors;i++){
|
||||
ci->floor_type[i]=oggpack_read(opb,16);
|
||||
if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
|
||||
|
@ -305,8 +304,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
|||
|
||||
/* residue backend settings */
|
||||
ci->residues=oggpack_read(opb,6)+1;
|
||||
/*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/
|
||||
/*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/
|
||||
if(ci->residues<=0)goto err_out;
|
||||
for(i=0;i<ci->residues;i++){
|
||||
ci->residue_type[i]=oggpack_read(opb,16);
|
||||
if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
|
||||
|
@ -316,18 +314,17 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
|||
|
||||
/* map backend settings */
|
||||
ci->maps=oggpack_read(opb,6)+1;
|
||||
/*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/
|
||||
/*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/
|
||||
if(ci->maps<=0)goto err_out;
|
||||
for(i=0;i<ci->maps;i++){
|
||||
ci->map_type[i]=oggpack_read(opb,16);
|
||||
if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
|
||||
ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
|
||||
if(!ci->map_param[i])goto err_out;
|
||||
}
|
||||
|
||||
|
||||
/* mode settings */
|
||||
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++){
|
||||
ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i]));
|
||||
ci->mode_param[i]->blockflag=oggpack_read(opb,1);
|
||||
|
@ -338,8 +335,9 @@ 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]->transformtype>=VI_WINDOWB)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 */
|
||||
|
||||
return(0);
|
||||
|
@ -380,7 +378,7 @@ int vorbis_synthesis_idheader(ogg_packet *op){
|
|||
|
||||
int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
|
||||
oggpack_buffer opb;
|
||||
|
||||
|
||||
if(op){
|
||||
oggpack_readinit(&opb,op->packet,op->bytes);
|
||||
|
||||
|
@ -440,7 +438,7 @@ static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
|
|||
codec_setup_info *ci=vi->codec_setup;
|
||||
if(!ci)return(OV_EFAULT);
|
||||
|
||||
/* preamble */
|
||||
/* preamble */
|
||||
oggpack_write(opb,0x01,8);
|
||||
_v_writestring(opb,"vorbis", 6);
|
||||
|
||||
|
@ -463,7 +461,7 @@ static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
|
|||
static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
|
||||
int bytes = strlen(ENCODE_VENDOR_STRING);
|
||||
|
||||
/* preamble */
|
||||
/* preamble */
|
||||
oggpack_write(opb,0x03,8);
|
||||
_v_writestring(opb,"vorbis", 6);
|
||||
|
||||
|
@ -489,7 +487,7 @@ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
|
|||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){
|
||||
codec_setup_info *ci=vi->codec_setup;
|
||||
int i;
|
||||
|
@ -544,7 +542,7 @@ static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){
|
|||
return(0);
|
||||
err_out:
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
int vorbis_commentheader_out(vorbis_comment *vc,
|
||||
ogg_packet *op){
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: lookup based functions
|
||||
last mod: $Id$
|
||||
last mod: $Id: lookup.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -56,16 +56,16 @@ float vorbis_fromdBlook(float a){
|
|||
|
||||
#ifdef INT_LOOKUP
|
||||
/* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in
|
||||
16.16 format
|
||||
16.16 format
|
||||
|
||||
returns in m.8 format */
|
||||
long vorbis_invsqlook_i(long a,long e){
|
||||
long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1);
|
||||
long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1);
|
||||
long d=(a&INVSQ_LOOKUP_I_MASK)<<(16-INVSQ_LOOKUP_I_SHIFT); /* 0.16 */
|
||||
long val=INVSQ_LOOKUP_I[i]- /* 1.16 */
|
||||
(((INVSQ_LOOKUP_I[i]-INVSQ_LOOKUP_I[i+1])* /* 0.16 */
|
||||
d)>>16); /* result 1.16 */
|
||||
|
||||
|
||||
e+=32;
|
||||
if(e&1)val=(val*5792)>>13; /* multiply val by 1/sqrt(2) */
|
||||
e=(e>>1)-8;
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: LPC low level routines
|
||||
last mod: $Id$
|
||||
last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -72,7 +72,7 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
|
|||
for(i=j;i<n;i++)d+=(double)data[i]*data[i-j];
|
||||
aut[j]=d;
|
||||
}
|
||||
|
||||
|
||||
/* Generate lpc coefficients from autocorr values */
|
||||
|
||||
/* set our noise floor to about -100dB */
|
||||
|
@ -93,10 +93,10 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
|
|||
each iteration. */
|
||||
|
||||
for(j=0;j<i;j++)r-=lpc[j]*aut[i-j];
|
||||
r/=error;
|
||||
r/=error;
|
||||
|
||||
/* Update LPC coefficients and total error */
|
||||
|
||||
|
||||
lpc[i]=r;
|
||||
for(j=0;j<i/2;j++){
|
||||
double tmp=lpc[j];
|
||||
|
@ -111,8 +111,8 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
|
|||
}
|
||||
|
||||
done:
|
||||
|
||||
/* slightly damp the filter */
|
||||
|
||||
/* slightly damp the filter */
|
||||
{
|
||||
double g = .99;
|
||||
double damp = g;
|
||||
|
@ -126,14 +126,14 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
|
|||
|
||||
/* we need the error value to know how big an impulse to hit the
|
||||
filter with later */
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
void vorbis_lpc_predict(float *coeff,float *prime,int m,
|
||||
float *data,long n){
|
||||
|
||||
/* in: coeff[0...m-1] LPC coefficients
|
||||
/* in: coeff[0...m-1] LPC coefficients
|
||||
prime[0...m-1] initial values (allocated size of n+m-1)
|
||||
out: data[0...n-1] data samples */
|
||||
|
||||
|
@ -154,12 +154,7 @@ void vorbis_lpc_predict(float *coeff,float *prime,int m,
|
|||
p=m;
|
||||
for(j=0;j<m;j++)
|
||||
y-=work[o++]*coeff[--p];
|
||||
|
||||
|
||||
data[i]=work[o]=y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: LSP (also called LSF) conversion routines
|
||||
last mod: $Id$
|
||||
last mod: $Id: lsp.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
The LSP generation code is taken (with minimal modification and a
|
||||
few bugfixes) from "On the Computation of the LSP Frequencies" by
|
||||
|
@ -51,9 +51,10 @@
|
|||
work on a fully fixed point implementation for processors like the
|
||||
ARM family. */
|
||||
|
||||
/* undefine both for the 'old' but more precise implementation */
|
||||
#define FLOAT_LOOKUP
|
||||
#undef INT_LOOKUP
|
||||
/* define either of these (preferably FLOAT_LOOKUP) to have faster
|
||||
but less precise implementation. */
|
||||
#undef FLOAT_LOOKUP
|
||||
#undef INT_LOOKUP
|
||||
|
||||
#ifdef FLOAT_LOOKUP
|
||||
#include "vorbis_lookup.c" /* catch this in the build system; we #include for
|
||||
|
@ -66,7 +67,7 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
|||
int i;
|
||||
float wdel=M_PI/ln;
|
||||
vorbis_fpu_control fpu;
|
||||
|
||||
|
||||
vorbis_fpu_setround(&fpu);
|
||||
for(i=0;i<m;i++)lsp[i]=vorbis_coslook(lsp[i]);
|
||||
|
||||
|
@ -99,9 +100,9 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
|||
}
|
||||
|
||||
q=frexp(p+q,&qexp);
|
||||
q=vorbis_fromdBlook(amp*
|
||||
q=vorbis_fromdBlook(amp*
|
||||
vorbis_invsqlook(q)*
|
||||
vorbis_invsq2explook(qexp+m)-
|
||||
vorbis_invsq2explook(qexp+m)-
|
||||
ampoffset);
|
||||
|
||||
do{
|
||||
|
@ -183,7 +184,7 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
|||
if(!(shift=MLOOP_1[(pi|qi)>>25]))
|
||||
if(!(shift=MLOOP_2[(pi|qi)>>19]))
|
||||
shift=MLOOP_3[(pi|qi)>>16];
|
||||
|
||||
|
||||
pi>>=shift;
|
||||
qi>>=shift;
|
||||
qexp+=shift-14*((m+1)>>1);
|
||||
|
@ -200,7 +201,7 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
|||
|
||||
/* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
|
||||
worth tracking step by step */
|
||||
|
||||
|
||||
pi>>=shift;
|
||||
qi>>=shift;
|
||||
qexp+=shift-7*m;
|
||||
|
@ -208,27 +209,27 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
|||
pi=((pi*pi)>>16);
|
||||
qi=((qi*qi)>>16);
|
||||
qexp=qexp*2+m;
|
||||
|
||||
|
||||
pi*=(1<<14)-wi;
|
||||
qi*=(1<<14)+wi;
|
||||
qi=(qi+pi)>>14;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* we've let the normalization drift because it wasn't important;
|
||||
however, for the lookup, things must be normalized again. We
|
||||
need at most one right shift or a number of left shifts */
|
||||
|
||||
if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
|
||||
qi>>=1; qexp++;
|
||||
qi>>=1; qexp++;
|
||||
}else
|
||||
while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
|
||||
qi<<=1; qexp--;
|
||||
qi<<=1; qexp--;
|
||||
}
|
||||
|
||||
amp=vorbis_fromdBlook_i(ampi* /* n.4 */
|
||||
vorbis_invsqlook_i(qi,qexp)-
|
||||
vorbis_invsqlook_i(qi,qexp)-
|
||||
/* m.8, m+n<=8 */
|
||||
ampoffseti); /* 8.12[0] */
|
||||
|
||||
|
@ -237,7 +238,7 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
|
|||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#else
|
||||
|
||||
/* old, nonoptimized but simple version for any poor sap who needs to
|
||||
figure out what the hell this code does, or wants the other
|
||||
|
@ -289,7 +290,7 @@ static void cheby(float *g, int ord) {
|
|||
for(i=2; i<= ord; i++) {
|
||||
for(j=ord; j >= i; j--) {
|
||||
g[j-2] -= g[j];
|
||||
g[j] += g[j];
|
||||
g[j] += g[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -318,14 +319,14 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){
|
|||
/* iterate a root */
|
||||
while(1){
|
||||
double p=defl[m],pp=0.f,ppp=0.f,denom;
|
||||
|
||||
|
||||
/* eval the polynomial and its first two derivatives */
|
||||
for(i=m;i>0;i--){
|
||||
ppp = new*ppp + pp;
|
||||
pp = new*pp + p;
|
||||
p = new*p + defl[i-1];
|
||||
}
|
||||
|
||||
|
||||
/* Laguerre's method */
|
||||
denom=(m-1) * ((m-1)*pp*pp - m*p*ppp);
|
||||
if(denom<0)
|
||||
|
@ -344,14 +345,14 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){
|
|||
|
||||
if(delta<0.f)delta*=-1;
|
||||
|
||||
if(fabs(delta/new)<10e-12)break;
|
||||
if(fabs(delta/new)<10e-12)break;
|
||||
lastdelta=delta;
|
||||
}
|
||||
|
||||
r[m-1]=new;
|
||||
|
||||
/* forward deflation */
|
||||
|
||||
|
||||
for(i=m;i>0;i--)
|
||||
defl[i-1]+=new*defl[i];
|
||||
defl++;
|
||||
|
@ -368,10 +369,10 @@ static int Newton_Raphson(float *a,int ord,float *r){
|
|||
double *root=alloca(ord*sizeof(*root));
|
||||
|
||||
for(i=0; i<ord;i++) root[i] = r[i];
|
||||
|
||||
|
||||
while(error>1e-20){
|
||||
error=0;
|
||||
|
||||
|
||||
for(i=0; i<ord; i++) { /* Update each point. */
|
||||
double pp=0.,delta;
|
||||
double rooti=root[i];
|
||||
|
@ -386,9 +387,9 @@ static int Newton_Raphson(float *a,int ord,float *r){
|
|||
root[i] -= delta;
|
||||
error+= delta*delta;
|
||||
}
|
||||
|
||||
|
||||
if(count>40)return(-1);
|
||||
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
|
@ -418,12 +419,12 @@ int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){
|
|||
/* Compute the first half of K & R F1 & F2 polynomials. */
|
||||
/* Compute half of the symmetric and antisymmetric polynomials. */
|
||||
/* Remove the roots at +1 and -1. */
|
||||
|
||||
|
||||
g1[g1_order] = 1.f;
|
||||
for(i=1;i<=g1_order;i++) g1[g1_order-i] = lpc[i-1]+lpc[m-i];
|
||||
g2[g2_order] = 1.f;
|
||||
for(i=1;i<=g2_order;i++) g2[g2_order-i] = lpc[i-1]-lpc[m-i];
|
||||
|
||||
|
||||
if(g1_order>g2_order){
|
||||
for(i=2; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+2];
|
||||
}else{
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: channel mapping 0 implementation
|
||||
last mod: $Id$
|
||||
last mod: $Id: mapping0.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -76,14 +76,14 @@ static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
|
|||
if(info->coupling_steps>0){
|
||||
oggpack_write(opb,1,1);
|
||||
oggpack_write(opb,info->coupling_steps-1,8);
|
||||
|
||||
|
||||
for(i=0;i<info->coupling_steps;i++){
|
||||
oggpack_write(opb,info->coupling_mag[i],ilog(vi->channels));
|
||||
oggpack_write(opb,info->coupling_ang[i],ilog(vi->channels));
|
||||
}
|
||||
}else
|
||||
oggpack_write(opb,0,1);
|
||||
|
||||
|
||||
oggpack_write(opb,0,2); /* 2,3:reserved */
|
||||
|
||||
/* we don't write the channel submappings if we only have one... */
|
||||
|
@ -100,46 +100,51 @@ static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
|
|||
|
||||
/* also responsible for range checking */
|
||||
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));
|
||||
codec_setup_info *ci=vi->codec_setup;
|
||||
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;
|
||||
else
|
||||
if(info->submaps<=0)goto err_out;
|
||||
}else
|
||||
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;
|
||||
|
||||
if(info->coupling_steps<=0)goto err_out;
|
||||
for(i=0;i<info->coupling_steps;i++){
|
||||
int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
|
||||
int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
|
||||
|
||||
if(testM<0 ||
|
||||
testA<0 ||
|
||||
testM==testA ||
|
||||
if(testM<0 ||
|
||||
testA<0 ||
|
||||
testM==testA ||
|
||||
testM>=vi->channels ||
|
||||
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){
|
||||
for(i=0;i<vi->channels;i++){
|
||||
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++){
|
||||
oggpack_read(opb,8); /* time submap unused */
|
||||
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);
|
||||
if(info->residuesubmap[i]>=ci->residues)goto err_out;
|
||||
if(info->residuesubmap[i]>=ci->residues || info->residuesubmap[i]<0)goto err_out;
|
||||
}
|
||||
|
||||
return info;
|
||||
|
@ -161,73 +166,73 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)
|
|||
static long seq=0;
|
||||
static ogg_int64_t total=0;
|
||||
static float FLOOR1_fromdB_LOOKUP[256]={
|
||||
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.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
|
||||
2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
|
||||
2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
|
||||
3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
|
||||
4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
|
||||
6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
|
||||
7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
|
||||
1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
|
||||
1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
|
||||
1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
|
||||
2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
|
||||
2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
|
||||
3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
|
||||
4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
|
||||
5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
|
||||
7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
|
||||
9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
|
||||
1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
|
||||
1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
|
||||
2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
|
||||
2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
|
||||
3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
|
||||
4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
|
||||
5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
|
||||
7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
|
||||
9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
|
||||
0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
|
||||
0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
|
||||
0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
|
||||
0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
|
||||
0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
|
||||
0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
|
||||
0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
|
||||
0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
|
||||
0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
|
||||
0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
|
||||
0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
|
||||
0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
|
||||
0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
|
||||
0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
|
||||
0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
|
||||
0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
|
||||
0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
|
||||
0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
|
||||
0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
|
||||
0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
|
||||
0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
|
||||
0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
|
||||
0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
|
||||
0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
|
||||
0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
|
||||
0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
|
||||
0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
|
||||
0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
|
||||
0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
|
||||
0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
|
||||
0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
|
||||
0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
|
||||
0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
|
||||
0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
|
||||
0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
|
||||
0.82788260F, 0.88168307F, 0.9389798F, 1.F,
|
||||
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.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
|
||||
2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
|
||||
2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
|
||||
3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
|
||||
4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
|
||||
6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
|
||||
7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
|
||||
1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
|
||||
1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
|
||||
1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
|
||||
2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
|
||||
2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
|
||||
3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
|
||||
4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
|
||||
5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
|
||||
7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
|
||||
9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
|
||||
1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
|
||||
1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
|
||||
2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
|
||||
2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
|
||||
3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
|
||||
4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
|
||||
5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
|
||||
7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
|
||||
9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
|
||||
0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
|
||||
0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
|
||||
0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
|
||||
0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
|
||||
0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
|
||||
0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
|
||||
0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
|
||||
0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
|
||||
0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
|
||||
0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
|
||||
0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
|
||||
0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
|
||||
0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
|
||||
0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
|
||||
0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
|
||||
0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
|
||||
0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
|
||||
0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
|
||||
0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
|
||||
0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
|
||||
0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
|
||||
0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
|
||||
0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
|
||||
0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
|
||||
0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
|
||||
0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
|
||||
0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
|
||||
0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
|
||||
0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
|
||||
0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
|
||||
0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
|
||||
0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
|
||||
0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
|
||||
0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
|
||||
0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
|
||||
0.82788260F, 0.88168307F, 0.9389798F, 1.F,
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
static int mapping0_forward(vorbis_block *vb){
|
||||
|
@ -243,7 +248,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
float **gmdct = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct));
|
||||
int **ilogmaskch= _vorbis_block_alloc(vb,vi->channels*sizeof(*ilogmaskch));
|
||||
int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts));
|
||||
|
||||
|
||||
float global_ampmax=vbi->ampmax;
|
||||
float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels);
|
||||
int blocktype=vbi->blocktype;
|
||||
|
@ -259,7 +264,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
float scale=4.f/n;
|
||||
float scale_dB;
|
||||
|
||||
float *pcm =vb->pcm[i];
|
||||
float *pcm =vb->pcm[i];
|
||||
float *logfft =pcm;
|
||||
|
||||
gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
|
||||
|
@ -289,7 +294,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
_analysis_output("pcm",seq,pcm,n,0,0,total-n/2);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* window the PCM data */
|
||||
_vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
|
||||
|
||||
|
@ -307,7 +312,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
/* transform the PCM data */
|
||||
/* only MDCT right now.... */
|
||||
mdct_forward(b->transform[vb->W][0],pcm,gmdct[i]);
|
||||
|
||||
|
||||
/* FFT yields more accurate tonal estimation (not phase sensitive) */
|
||||
drft_forward(&b->fft_look[vb->W],pcm);
|
||||
logfft[0]=scale_dB+todB(pcm) + .345; /* + .345 is a hack; the
|
||||
|
@ -361,21 +366,21 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
float *noise = _vorbis_block_alloc(vb,n/2*sizeof(*noise));
|
||||
float *tone = _vorbis_block_alloc(vb,n/2*sizeof(*tone));
|
||||
|
||||
|
||||
for(i=0;i<vi->channels;i++){
|
||||
/* the encoder setup assumes that all the modes used by any
|
||||
specific bitrate tweaking use the same floor */
|
||||
|
||||
|
||||
int submap=info->chmuxlist[i];
|
||||
|
||||
|
||||
/* the following makes things clearer to *me* anyway */
|
||||
float *mdct =gmdct[i];
|
||||
float *logfft =vb->pcm[i];
|
||||
|
||||
|
||||
float *logmdct =logfft+n/2;
|
||||
float *logmask =logfft;
|
||||
|
||||
|
@ -383,7 +388,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
|
||||
floor_posts[i]=_vorbis_block_alloc(vb,PACKETBLOBS*sizeof(**floor_posts));
|
||||
memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS);
|
||||
|
||||
|
||||
for(j=0;j<n/2;j++)
|
||||
logmdct[j]=todB(mdct+j) + .345; /* + .345 is a hack; the original
|
||||
todB estimation used on IEEE 754
|
||||
|
@ -409,8 +414,8 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
}else{
|
||||
_analysis_output("mdct",seq,logmdct,n/2,1,0,0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/* first step; noise masking. Not only does 'noise masking'
|
||||
give us curves from which we can decide how much resolution
|
||||
to give noise parts of the spectrum, it also implicitly hands
|
||||
|
@ -470,7 +475,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
logmask,
|
||||
mdct,
|
||||
logmdct);
|
||||
|
||||
|
||||
#if 0
|
||||
if(vi->channels==2){
|
||||
if(i==0)
|
||||
|
@ -504,7 +509,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
floor1_fit(vb,b->flr[info->floorsubmap[submap]],
|
||||
logmdct,
|
||||
logmask);
|
||||
|
||||
|
||||
/* are we managing bitrate? If so, perform two more fits for
|
||||
later rate tweaking (fits represent hi/lo) */
|
||||
if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){
|
||||
|
@ -528,12 +533,12 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
_analysis_output("mask2",seq,logmask,n/2,1,0,0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
floor_posts[i][PACKETBLOBS-1]=
|
||||
floor1_fit(vb,b->flr[info->floorsubmap[submap]],
|
||||
logmdct,
|
||||
logmask);
|
||||
|
||||
|
||||
/* lower rate by way of higher noise curve */
|
||||
_vp_offset_and_mix(psy_look,
|
||||
noise,
|
||||
|
@ -558,7 +563,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
floor1_fit(vb,b->flr[info->floorsubmap[submap]],
|
||||
logmdct,
|
||||
logmask);
|
||||
|
||||
|
||||
/* we also interpolate a range of intermediate curves for
|
||||
intermediate rates */
|
||||
for(k=1;k<PACKETBLOBS/2;k++)
|
||||
|
@ -581,13 +586,13 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
/*
|
||||
the next phases are performed once for vbr-only and PACKETBLOB
|
||||
times for bitrate managed modes.
|
||||
|
||||
|
||||
1) encode actual mode being used
|
||||
2) encode the floor for each channel, compute coded mask curve/res
|
||||
3) normalize and couple.
|
||||
4) encode residue
|
||||
5) save packet bytes to the packetblob vector
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/* iterate over the many masking curve fits we've created */
|
||||
|
@ -605,12 +610,12 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
&ci->psy_g_param,
|
||||
psy_look,
|
||||
info,
|
||||
gmdct);
|
||||
|
||||
gmdct);
|
||||
|
||||
mag_sort=_vp_quantize_couple_sort(vb,
|
||||
psy_look,
|
||||
info,
|
||||
mag_memo);
|
||||
mag_memo);
|
||||
|
||||
hf_reduction(&ci->psy_g_param,
|
||||
psy_look,
|
||||
|
@ -650,7 +655,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
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]],
|
||||
floor_posts[i][k],
|
||||
ilogmask);
|
||||
|
@ -672,7 +677,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
|
||||
_vp_noise_normalize(psy_look,res,res+n/2,sortindex[i]);
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
{
|
||||
char buf[80];
|
||||
|
@ -685,10 +690,10 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/* our iteration is now based on masking curve, not prequant and
|
||||
coupling. Only one prequant/coupling step */
|
||||
|
||||
|
||||
/* quantize/couple */
|
||||
/* incomplete implementation that assumes the tree is all depth
|
||||
one, or no tree at all */
|
||||
|
@ -704,7 +709,7 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
nonzero,
|
||||
ci->psy_g_param.sliding_lowpass[vb->W][k]);
|
||||
}
|
||||
|
||||
|
||||
/* classify and encode by submap */
|
||||
for(i=0;i<info->submaps;i++){
|
||||
int ch_in_bundle=0;
|
||||
|
@ -719,14 +724,14 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
classifications=_residue_P[ci->residue_type[resnum]]->
|
||||
class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle);
|
||||
|
||||
/* couple_bundle is destructively overwritten by
|
||||
the class function if some but not all of the channels are
|
||||
marked as silence; build a fresh copy */
|
||||
ch_in_bundle=0;
|
||||
ch_in_bundle=0;
|
||||
for(j=0;j<vi->channels;j++)
|
||||
if(info->chmuxlist[j]==i)
|
||||
couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2;
|
||||
|
@ -735,10 +740,10 @@ static int mapping0_forward(vorbis_block *vb){
|
|||
forward(opb,vb,b->residue[resnum],
|
||||
couple_bundle,NULL,zerobundle,ch_in_bundle,classifications);
|
||||
}
|
||||
|
||||
|
||||
/* ok, done encoding. Next protopacket. */
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
@ -763,7 +768,7 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
|
|||
|
||||
int *nonzero =alloca(sizeof(*nonzero)*vi->channels);
|
||||
void **floormemo=alloca(sizeof(*floormemo)*vi->channels);
|
||||
|
||||
|
||||
/* recover the spectral envelope; store it in the PCM vector for now */
|
||||
for(i=0;i<vi->channels;i++){
|
||||
int submap=info->chmuxlist[i];
|
||||
|
@ -772,7 +777,7 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
|
|||
if(floormemo[i])
|
||||
nonzero[i]=1;
|
||||
else
|
||||
nonzero[i]=0;
|
||||
nonzero[i]=0;
|
||||
memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
|
||||
}
|
||||
|
||||
|
@ -780,8 +785,8 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
|
|||
for(i=0;i<info->coupling_steps;i++){
|
||||
if(nonzero[info->coupling_mag[i]] ||
|
||||
nonzero[info->coupling_ang[i]]){
|
||||
nonzero[info->coupling_mag[i]]=1;
|
||||
nonzero[info->coupling_ang[i]]=1;
|
||||
nonzero[info->coupling_mag[i]]=1;
|
||||
nonzero[info->coupling_ang[i]]=1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -859,4 +864,3 @@ const vorbis_func_mapping mapping0_exportbundle={
|
|||
&mapping0_forward,
|
||||
&mapping0_inverse
|
||||
};
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: normalized modified discrete cosine transform
|
||||
power of two length transform only [64 <= n ]
|
||||
last mod: $Id$
|
||||
last mod: $Id: mdct.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
Original algorithm adapted long ago from _The use of multirate filter
|
||||
banks for coding of high quality digital audio_, by T. Sporer,
|
||||
|
@ -52,7 +52,7 @@
|
|||
void mdct_init(mdct_lookup *lookup,int n){
|
||||
int *bitrev=_ogg_malloc(sizeof(*bitrev)*(n/4));
|
||||
DATA_TYPE *T=_ogg_malloc(sizeof(*T)*(n+n/4));
|
||||
|
||||
|
||||
int i;
|
||||
int n2=n>>1;
|
||||
int log2n=lookup->log2n=rint(log((float)n)/log(2.f));
|
||||
|
@ -99,19 +99,19 @@ STIN void mdct_butterfly_8(DATA_TYPE *x){
|
|||
|
||||
x[6] = r0 + r2;
|
||||
x[4] = r0 - r2;
|
||||
|
||||
|
||||
r0 = x[5] - x[1];
|
||||
r2 = x[7] - x[3];
|
||||
x[0] = r1 + r0;
|
||||
x[2] = r1 - r0;
|
||||
|
||||
|
||||
r0 = x[5] + x[1];
|
||||
r1 = x[7] + x[3];
|
||||
x[3] = r2 + r3;
|
||||
x[1] = r2 - r3;
|
||||
x[7] = r1 + r0;
|
||||
x[5] = r1 - r0;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* 16 point butterfly (in place, 4 register) */
|
||||
|
@ -154,14 +154,14 @@ STIN void mdct_butterfly_32(DATA_TYPE *x){
|
|||
REG_TYPE r0 = x[30] - x[14];
|
||||
REG_TYPE r1 = x[31] - x[15];
|
||||
|
||||
x[30] += x[14];
|
||||
x[30] += x[14];
|
||||
x[31] += x[15];
|
||||
x[14] = r0;
|
||||
x[14] = r0;
|
||||
x[15] = r1;
|
||||
|
||||
r0 = x[28] - x[12];
|
||||
r0 = x[28] - x[12];
|
||||
r1 = x[29] - x[13];
|
||||
x[28] += x[12];
|
||||
x[28] += x[12];
|
||||
x[29] += x[13];
|
||||
x[12] = MULT_NORM( r0 * cPI1_8 - r1 * cPI3_8 );
|
||||
x[13] = MULT_NORM( r0 * cPI3_8 + r1 * cPI1_8 );
|
||||
|
@ -217,42 +217,42 @@ STIN void mdct_butterfly_32(DATA_TYPE *x){
|
|||
STIN void mdct_butterfly_first(DATA_TYPE *T,
|
||||
DATA_TYPE *x,
|
||||
int points){
|
||||
|
||||
|
||||
DATA_TYPE *x1 = x + points - 8;
|
||||
DATA_TYPE *x2 = x + (points>>1) - 8;
|
||||
REG_TYPE r0;
|
||||
REG_TYPE r1;
|
||||
|
||||
do{
|
||||
|
||||
|
||||
r0 = x1[6] - x2[6];
|
||||
r1 = x1[7] - x2[7];
|
||||
x1[6] += x2[6];
|
||||
x1[7] += x2[7];
|
||||
x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
||||
x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
||||
|
||||
|
||||
r0 = x1[4] - x2[4];
|
||||
r1 = x1[5] - x2[5];
|
||||
x1[4] += x2[4];
|
||||
x1[5] += x2[5];
|
||||
x2[4] = MULT_NORM(r1 * T[5] + r0 * T[4]);
|
||||
x2[5] = MULT_NORM(r1 * T[4] - r0 * T[5]);
|
||||
|
||||
|
||||
r0 = x1[2] - x2[2];
|
||||
r1 = x1[3] - x2[3];
|
||||
x1[2] += x2[2];
|
||||
x1[3] += x2[3];
|
||||
x2[2] = MULT_NORM(r1 * T[9] + r0 * T[8]);
|
||||
x2[3] = MULT_NORM(r1 * T[8] - r0 * T[9]);
|
||||
|
||||
|
||||
r0 = x1[0] - x2[0];
|
||||
r1 = x1[1] - x2[1];
|
||||
x1[0] += x2[0];
|
||||
x1[1] += x2[1];
|
||||
x2[0] = MULT_NORM(r1 * T[13] + r0 * T[12]);
|
||||
x2[1] = MULT_NORM(r1 * T[12] - r0 * T[13]);
|
||||
|
||||
|
||||
x1-=8;
|
||||
x2-=8;
|
||||
T+=16;
|
||||
|
@ -265,41 +265,41 @@ STIN void mdct_butterfly_generic(DATA_TYPE *T,
|
|||
DATA_TYPE *x,
|
||||
int points,
|
||||
int trigint){
|
||||
|
||||
|
||||
DATA_TYPE *x1 = x + points - 8;
|
||||
DATA_TYPE *x2 = x + (points>>1) - 8;
|
||||
REG_TYPE r0;
|
||||
REG_TYPE r1;
|
||||
|
||||
do{
|
||||
|
||||
|
||||
r0 = x1[6] - x2[6];
|
||||
r1 = x1[7] - x2[7];
|
||||
x1[6] += x2[6];
|
||||
x1[7] += x2[7];
|
||||
x2[6] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
||||
x2[7] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
||||
|
||||
|
||||
T+=trigint;
|
||||
|
||||
|
||||
r0 = x1[4] - x2[4];
|
||||
r1 = x1[5] - x2[5];
|
||||
x1[4] += x2[4];
|
||||
x1[5] += x2[5];
|
||||
x2[4] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
||||
x2[5] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
||||
|
||||
|
||||
T+=trigint;
|
||||
|
||||
|
||||
r0 = x1[2] - x2[2];
|
||||
r1 = x1[3] - x2[3];
|
||||
x1[2] += x2[2];
|
||||
x1[3] += x2[3];
|
||||
x2[2] = MULT_NORM(r1 * T[1] + r0 * T[0]);
|
||||
x2[3] = MULT_NORM(r1 * T[0] - r0 * T[1]);
|
||||
|
||||
|
||||
T+=trigint;
|
||||
|
||||
|
||||
r0 = x1[0] - x2[0];
|
||||
r1 = x1[1] - x2[1];
|
||||
x1[0] += x2[0];
|
||||
|
@ -317,11 +317,11 @@ STIN void mdct_butterfly_generic(DATA_TYPE *T,
|
|||
STIN void mdct_butterflies(mdct_lookup *init,
|
||||
DATA_TYPE *x,
|
||||
int points){
|
||||
|
||||
|
||||
DATA_TYPE *T=init->trig;
|
||||
int stages=init->log2n-5;
|
||||
int i,j;
|
||||
|
||||
|
||||
if(--stages>0){
|
||||
mdct_butterfly_first(T,x,points);
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ void mdct_clear(mdct_lookup *l){
|
|||
}
|
||||
}
|
||||
|
||||
STIN void mdct_bitreverse(mdct_lookup *init,
|
||||
STIN void mdct_bitreverse(mdct_lookup *init,
|
||||
DATA_TYPE *x){
|
||||
int n = init->n;
|
||||
int *bit = init->bitrev;
|
||||
|
@ -365,7 +365,7 @@ STIN void mdct_bitreverse(mdct_lookup *init,
|
|||
|
||||
r0 = HALVE(x0[1] + x1[1]);
|
||||
r1 = HALVE(x0[0] - x1[0]);
|
||||
|
||||
|
||||
w0[0] = r0 + r2;
|
||||
w1[2] = r0 - r2;
|
||||
w0[1] = r1 + r3;
|
||||
|
@ -381,7 +381,7 @@ STIN void mdct_bitreverse(mdct_lookup *init,
|
|||
|
||||
r0 = HALVE(x0[1] + x1[1]);
|
||||
r1 = HALVE(x0[0] - x1[0]);
|
||||
|
||||
|
||||
w0[2] = r0 + r2;
|
||||
w1[0] = r0 - r2;
|
||||
w0[3] = r1 + r3;
|
||||
|
@ -439,7 +439,7 @@ void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
|
|||
DATA_TYPE *oX2=out+n2+n4;
|
||||
DATA_TYPE *iX =out;
|
||||
T =init->trig+n2;
|
||||
|
||||
|
||||
do{
|
||||
oX1-=4;
|
||||
|
||||
|
@ -501,44 +501,44 @@ void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
|
|||
/* rotate */
|
||||
|
||||
/* window + rotate + step 1 */
|
||||
|
||||
|
||||
REG_TYPE r0;
|
||||
REG_TYPE r1;
|
||||
DATA_TYPE *x0=in+n2+n4;
|
||||
DATA_TYPE *x1=x0+1;
|
||||
DATA_TYPE *T=init->trig+n2;
|
||||
|
||||
|
||||
int i=0;
|
||||
|
||||
|
||||
for(i=0;i<n8;i+=2){
|
||||
x0 -=4;
|
||||
T-=2;
|
||||
r0= x0[2] + x1[0];
|
||||
r1= x0[0] + x1[2];
|
||||
r1= x0[0] + x1[2];
|
||||
w2[i]= MULT_NORM(r1*T[1] + r0*T[0]);
|
||||
w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]);
|
||||
x1 +=4;
|
||||
}
|
||||
|
||||
x1=in+1;
|
||||
|
||||
|
||||
for(;i<n2-n8;i+=2){
|
||||
T-=2;
|
||||
x0 -=4;
|
||||
r0= x0[2] - x1[0];
|
||||
r1= x0[0] - x1[2];
|
||||
r1= x0[0] - x1[2];
|
||||
w2[i]= MULT_NORM(r1*T[1] + r0*T[0]);
|
||||
w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]);
|
||||
x1 +=4;
|
||||
}
|
||||
|
||||
|
||||
x0=in+n;
|
||||
|
||||
for(;i<n2;i+=2){
|
||||
T-=2;
|
||||
x0 -=4;
|
||||
r0= -x0[2] - x1[0];
|
||||
r1= -x0[0] - x1[2];
|
||||
r1= -x0[0] - x1[2];
|
||||
w2[i]= MULT_NORM(r1*T[1] + r0*T[0]);
|
||||
w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]);
|
||||
x1 +=4;
|
||||
|
@ -561,4 +561,3 @@ void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
|
|||
T+=2;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: psychoacoustics not including preecho
|
||||
last mod: $Id$
|
||||
last mod: $Id: psy.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -68,12 +68,12 @@ void _vi_psy_free(vorbis_info_psy *i){
|
|||
|
||||
static void min_curve(float *c,
|
||||
float *c2){
|
||||
int i;
|
||||
int i;
|
||||
for(i=0;i<EHMER_MAX;i++)if(c2[i]<c[i])c[i]=c2[i];
|
||||
}
|
||||
static void max_curve(float *c,
|
||||
float *c2){
|
||||
int i;
|
||||
int i;
|
||||
for(i=0;i<EHMER_MAX;i++)if(c2[i]>c[i])c[i]=c2[i];
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
|
|||
curve limiting (last step). */
|
||||
|
||||
/* A half-band's settings must be valid over the whole band, and
|
||||
it's better to mask too little than too much */
|
||||
it's better to mask too little than too much */
|
||||
int ath_offset=i*4;
|
||||
for(j=0;j<EHMER_MAX;j++){
|
||||
float min=999.;
|
||||
|
@ -120,7 +120,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
|
|||
memcpy(workc[i][j+2],tonemasks[i][j],EHMER_MAX*sizeof(*tonemasks[i][j]));
|
||||
memcpy(workc[i][0],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
|
||||
memcpy(workc[i][1],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
|
||||
|
||||
|
||||
/* apply centered curve boost/decay */
|
||||
for(j=0;j<P_LEVELS;j++){
|
||||
for(k=0;k<EHMER_MAX;k++){
|
||||
|
@ -141,7 +141,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
|
|||
}
|
||||
|
||||
/* Now limit the louder curves.
|
||||
|
||||
|
||||
the idea is this: We don't know what the playback attenuation
|
||||
will be; 0dB SL moves every time the user twiddles the volume
|
||||
knob. So that means we have to use a single 'most pessimal' curve
|
||||
|
@ -149,7 +149,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
|
|||
can be in (we assume) a range of ...+100dB] SL. However, sounds
|
||||
20dB down will be in a range ...+80], 40dB down is from ...+60],
|
||||
etc... */
|
||||
|
||||
|
||||
for(j=1;j<P_LEVELS;j++){
|
||||
min_curve(athc[j],athc[j-1]);
|
||||
min_curve(workc[i][j],athc[j]);
|
||||
|
@ -168,7 +168,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
|
|||
composite of multiple octaves. It also may mean that a single
|
||||
bin may span > an eighth of an octave and that the eighth
|
||||
octave values may also be composited. */
|
||||
|
||||
|
||||
/* which octave curves will we be compositing? */
|
||||
bin=floor(fromOC(i*.5)/binHz);
|
||||
lo_curve= ceil(toOC(bin*binHz+1)*2);
|
||||
|
@ -179,9 +179,9 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
|
|||
|
||||
for(m=0;m<P_LEVELS;m++){
|
||||
ret[i][m]=_ogg_malloc(sizeof(***ret)*(EHMER_MAX+2));
|
||||
|
||||
|
||||
for(j=0;j<n;j++)brute_buffer[j]=999.;
|
||||
|
||||
|
||||
/* render the curve into bins, then pull values back into curve.
|
||||
The point is that any inherent subsampling aliasing results in
|
||||
a safe minimum */
|
||||
|
@ -191,7 +191,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
|
|||
for(j=0;j<EHMER_MAX;j++){
|
||||
int lo_bin= fromOC(j*.125+k*.5-2.0625)/binHz;
|
||||
int hi_bin= fromOC(j*.125+k*.5-1.9375)/binHz+1;
|
||||
|
||||
|
||||
if(lo_bin<0)lo_bin=0;
|
||||
if(lo_bin>n)lo_bin=n;
|
||||
if(lo_bin<l)l=lo_bin;
|
||||
|
@ -216,7 +216,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
|
|||
for(j=0;j<EHMER_MAX;j++){
|
||||
int lo_bin= fromOC(j*.125+i*.5-2.0625)/binHz;
|
||||
int hi_bin= fromOC(j*.125+i*.5-1.9375)/binHz+1;
|
||||
|
||||
|
||||
if(lo_bin<0)lo_bin=0;
|
||||
if(lo_bin>n)lo_bin=n;
|
||||
if(lo_bin<l)l=lo_bin;
|
||||
|
@ -250,9 +250,9 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
|
|||
|
||||
/* add fenceposts */
|
||||
for(j=0;j<EHMER_OFFSET;j++)
|
||||
if(ret[i][m][j+2]>-200.f)break;
|
||||
if(ret[i][m][j+2]>-200.f)break;
|
||||
ret[i][m][0]=j;
|
||||
|
||||
|
||||
for(j=EHMER_MAX-1;j>EHMER_OFFSET+1;j--)
|
||||
if(ret[i][m][j+2]>-200.f)
|
||||
break;
|
||||
|
@ -289,7 +289,7 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
|
|||
if(rate < 26000) p->m_val = 0;
|
||||
else if(rate < 38000) p->m_val = .94; /* 32kHz */
|
||||
else if(rate > 46000) p->m_val = 1.275; /* 48kHz */
|
||||
|
||||
|
||||
/* set up the lookups for a given blocksize and sample rate */
|
||||
|
||||
for(i=0,j=0;i<MAX_ATH-1;i++){
|
||||
|
@ -309,14 +309,14 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
|
|||
}
|
||||
|
||||
for(i=0;i<n;i++){
|
||||
float bark=toBARK(rate/(2*n)*i);
|
||||
float bark=toBARK(rate/(2*n)*i);
|
||||
|
||||
for(;lo+vi->noisewindowlomin<i &&
|
||||
for(;lo+vi->noisewindowlomin<i &&
|
||||
toBARK(rate/(2*n)*lo)<(bark-vi->noisewindowlo);lo++);
|
||||
|
||||
|
||||
for(;hi<=n && (hi<i+vi->noisewindowhimin ||
|
||||
toBARK(rate/(2*n)*hi)<(bark+vi->noisewindowhi));hi++);
|
||||
|
||||
|
||||
p->bark[i]=((lo-1)<<16)+(hi-1);
|
||||
|
||||
}
|
||||
|
@ -326,27 +326,27 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
|
|||
|
||||
p->tonecurves=setup_tone_curves(vi->toneatt,rate*.5/n,n,
|
||||
vi->tone_centerboost,vi->tone_decay);
|
||||
|
||||
|
||||
/* set up rolling noise median */
|
||||
p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset));
|
||||
for(i=0;i<P_NOISECURVES;i++)
|
||||
p->noiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset));
|
||||
|
||||
|
||||
for(i=0;i<n;i++){
|
||||
float halfoc=toOC((i+.5)*rate/(2.*n))*2.;
|
||||
int inthalfoc;
|
||||
float del;
|
||||
|
||||
|
||||
if(halfoc<0)halfoc=0;
|
||||
if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1;
|
||||
inthalfoc=(int)halfoc;
|
||||
del=halfoc-inthalfoc;
|
||||
|
||||
|
||||
for(j=0;j<P_NOISECURVES;j++)
|
||||
p->noiseoffset[j][i]=
|
||||
p->vi->noiseoff[j][inthalfoc]*(1.-del) +
|
||||
p->vi->noiseoff[j][inthalfoc]*(1.-del) +
|
||||
p->vi->noiseoff[j][inthalfoc+1]*del;
|
||||
|
||||
|
||||
}
|
||||
#if 0
|
||||
{
|
||||
|
@ -413,7 +413,7 @@ static void seed_curve(float *seed,
|
|||
|
||||
static void seed_loop(vorbis_look_psy *p,
|
||||
const float ***curves,
|
||||
const float *f,
|
||||
const float *f,
|
||||
const float *flr,
|
||||
float *seed,
|
||||
float specmax){
|
||||
|
@ -430,7 +430,7 @@ static void seed_loop(vorbis_look_psy *p,
|
|||
i++;
|
||||
if(f[i]>max)max=f[i];
|
||||
}
|
||||
|
||||
|
||||
if(max+6.f>flr[i]){
|
||||
oc=oc>>p->shiftoc;
|
||||
|
||||
|
@ -498,7 +498,7 @@ static void seed_chase(float *seeds, int linesper, long n){
|
|||
for(;pos<endpos;pos++)
|
||||
seeds[pos]=ampstack[i];
|
||||
}
|
||||
|
||||
|
||||
/* there. Linear time. I now remember this was on a problem set I
|
||||
had in Grad Skool... I didn't solve it at the time ;-) */
|
||||
|
||||
|
@ -515,7 +515,7 @@ static void max_seeds(vorbis_look_psy *p,
|
|||
long pos;
|
||||
|
||||
seed_chase(seed,linesper,n); /* for masking */
|
||||
|
||||
|
||||
pos=p->octave[0]-p->firstoc-(linesper>>1);
|
||||
|
||||
while(linpos+1<p->n){
|
||||
|
@ -527,18 +527,18 @@ static void max_seeds(vorbis_look_psy *p,
|
|||
if((seed[pos]>NEGINF && seed[pos]<minV) || minV==NEGINF)
|
||||
minV=seed[pos];
|
||||
}
|
||||
|
||||
|
||||
end=pos+p->firstoc;
|
||||
for(;linpos<p->n && p->octave[linpos]<=end;linpos++)
|
||||
if(flr[linpos]<minV)flr[linpos]=minV;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
float minV=seed[p->total_octave_lines-1];
|
||||
for(;linpos<p->n;linpos++)
|
||||
if(flr[linpos]<minV)flr[linpos]=minV;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void bark_noise_hybridmp(int n,const long *b,
|
||||
|
@ -546,7 +546,7 @@ static void bark_noise_hybridmp(int n,const long *b,
|
|||
float *noise,
|
||||
const float offset,
|
||||
const int fixed){
|
||||
|
||||
|
||||
float *N=alloca(n*sizeof(*N));
|
||||
float *X=alloca(n*sizeof(*N));
|
||||
float *XX=alloca(n*sizeof(*N));
|
||||
|
@ -569,7 +569,7 @@ static void bark_noise_hybridmp(int n,const long *b,
|
|||
if (y < 1.f) y = 1.f;
|
||||
|
||||
w = y * y * .5;
|
||||
|
||||
|
||||
tN += w;
|
||||
tX += w;
|
||||
tY += w * y;
|
||||
|
@ -581,12 +581,12 @@ static void bark_noise_hybridmp(int n,const long *b,
|
|||
XY[0] = tXY;
|
||||
|
||||
for (i = 1, x = 1.f; i < n; i++, x += 1.f) {
|
||||
|
||||
|
||||
y = f[i] + offset;
|
||||
if (y < 1.f) y = 1.f;
|
||||
|
||||
w = y * y;
|
||||
|
||||
|
||||
tN += w;
|
||||
tX += w * x;
|
||||
tXX += w * x * x;
|
||||
|
@ -599,59 +599,59 @@ static void bark_noise_hybridmp(int n,const long *b,
|
|||
Y[i] = tY;
|
||||
XY[i] = tXY;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0, x = 0.f;; i++, x += 1.f) {
|
||||
|
||||
|
||||
lo = b[i] >> 16;
|
||||
if( lo>=0 ) break;
|
||||
hi = b[i] & 0xffff;
|
||||
|
||||
|
||||
tN = N[hi] + N[-lo];
|
||||
tX = X[hi] - X[-lo];
|
||||
tXX = XX[hi] + XX[-lo];
|
||||
tY = Y[hi] + Y[-lo];
|
||||
tY = Y[hi] + Y[-lo];
|
||||
tXY = XY[hi] - XY[-lo];
|
||||
|
||||
|
||||
A = tY * tXX - tX * tXY;
|
||||
B = tN * tXY - tX * tY;
|
||||
D = tN * tXX - tX * tX;
|
||||
R = (A + x * B) / D;
|
||||
if (R < 0.f)
|
||||
R = 0.f;
|
||||
|
||||
|
||||
noise[i] = R - offset;
|
||||
}
|
||||
|
||||
|
||||
for ( ;; i++, x += 1.f) {
|
||||
|
||||
|
||||
lo = b[i] >> 16;
|
||||
hi = b[i] & 0xffff;
|
||||
if(hi>=n)break;
|
||||
|
||||
|
||||
tN = N[hi] - N[lo];
|
||||
tX = X[hi] - X[lo];
|
||||
tXX = XX[hi] - XX[lo];
|
||||
tY = Y[hi] - Y[lo];
|
||||
tXY = XY[hi] - XY[lo];
|
||||
|
||||
|
||||
A = tY * tXX - tX * tXY;
|
||||
B = tN * tXY - tX * tY;
|
||||
D = tN * tXX - tX * tX;
|
||||
R = (A + x * B) / D;
|
||||
if (R < 0.f) R = 0.f;
|
||||
|
||||
|
||||
noise[i] = R - offset;
|
||||
}
|
||||
for ( ; i < n; i++, x += 1.f) {
|
||||
|
||||
|
||||
R = (A + x * B) / D;
|
||||
if (R < 0.f) R = 0.f;
|
||||
|
||||
|
||||
noise[i] = R - offset;
|
||||
}
|
||||
|
||||
|
||||
if (fixed <= 0) return;
|
||||
|
||||
|
||||
for (i = 0, x = 0.f;; i++, x += 1.f) {
|
||||
hi = i + fixed / 2;
|
||||
lo = hi - fixed;
|
||||
|
@ -662,8 +662,8 @@ static void bark_noise_hybridmp(int n,const long *b,
|
|||
tXX = XX[hi] + XX[-lo];
|
||||
tY = Y[hi] + Y[-lo];
|
||||
tXY = XY[hi] - XY[-lo];
|
||||
|
||||
|
||||
|
||||
|
||||
A = tY * tXX - tX * tXY;
|
||||
B = tN * tXY - tX * tY;
|
||||
D = tN * tXX - tX * tX;
|
||||
|
@ -672,22 +672,22 @@ static void bark_noise_hybridmp(int n,const long *b,
|
|||
if (R - offset < noise[i]) noise[i] = R - offset;
|
||||
}
|
||||
for ( ;; i++, x += 1.f) {
|
||||
|
||||
|
||||
hi = i + fixed / 2;
|
||||
lo = hi - fixed;
|
||||
if(hi>=n)break;
|
||||
|
||||
|
||||
tN = N[hi] - N[lo];
|
||||
tX = X[hi] - X[lo];
|
||||
tXX = XX[hi] - XX[lo];
|
||||
tY = Y[hi] - Y[lo];
|
||||
tXY = XY[hi] - XY[lo];
|
||||
|
||||
|
||||
A = tY * tXX - tX * tXY;
|
||||
B = tN * tXY - tX * tY;
|
||||
D = tN * tXX - tX * tX;
|
||||
R = (A + x * B) / D;
|
||||
|
||||
|
||||
if (R - offset < noise[i]) noise[i] = R - offset;
|
||||
}
|
||||
for ( ; i < n; i++, x += 1.f) {
|
||||
|
@ -697,69 +697,69 @@ static void bark_noise_hybridmp(int n,const long *b,
|
|||
}
|
||||
|
||||
static const float FLOOR1_fromdB_INV_LOOKUP[256]={
|
||||
0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F,
|
||||
7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F,
|
||||
5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F,
|
||||
4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F,
|
||||
3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F,
|
||||
2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F,
|
||||
2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F,
|
||||
1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F,
|
||||
1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F,
|
||||
973377.F, 913981.F, 858210.F, 805842.F,
|
||||
756669.F, 710497.F, 667142.F, 626433.F,
|
||||
588208.F, 552316.F, 518613.F, 486967.F,
|
||||
457252.F, 429351.F, 403152.F, 378551.F,
|
||||
355452.F, 333762.F, 313396.F, 294273.F,
|
||||
276316.F, 259455.F, 243623.F, 228757.F,
|
||||
214798.F, 201691.F, 189384.F, 177828.F,
|
||||
166977.F, 156788.F, 147221.F, 138237.F,
|
||||
129802.F, 121881.F, 114444.F, 107461.F,
|
||||
100903.F, 94746.3F, 88964.9F, 83536.2F,
|
||||
78438.8F, 73652.5F, 69158.2F, 64938.1F,
|
||||
60975.6F, 57254.9F, 53761.2F, 50480.6F,
|
||||
47400.3F, 44507.9F, 41792.0F, 39241.9F,
|
||||
36847.3F, 34598.9F, 32487.7F, 30505.3F,
|
||||
28643.8F, 26896.0F, 25254.8F, 23713.7F,
|
||||
22266.7F, 20908.0F, 19632.2F, 18434.2F,
|
||||
17309.4F, 16253.1F, 15261.4F, 14330.1F,
|
||||
13455.7F, 12634.6F, 11863.7F, 11139.7F,
|
||||
10460.0F, 9821.72F, 9222.39F, 8659.64F,
|
||||
8131.23F, 7635.06F, 7169.17F, 6731.70F,
|
||||
6320.93F, 5935.23F, 5573.06F, 5232.99F,
|
||||
4913.67F, 4613.84F, 4332.30F, 4067.94F,
|
||||
3819.72F, 3586.64F, 3367.78F, 3162.28F,
|
||||
2969.31F, 2788.13F, 2617.99F, 2458.24F,
|
||||
2308.24F, 2167.39F, 2035.14F, 1910.95F,
|
||||
1794.35F, 1684.85F, 1582.04F, 1485.51F,
|
||||
1394.86F, 1309.75F, 1229.83F, 1154.78F,
|
||||
1084.32F, 1018.15F, 956.024F, 897.687F,
|
||||
842.910F, 791.475F, 743.179F, 697.830F,
|
||||
655.249F, 615.265F, 577.722F, 542.469F,
|
||||
509.367F, 478.286F, 449.101F, 421.696F,
|
||||
395.964F, 371.803F, 349.115F, 327.812F,
|
||||
307.809F, 289.026F, 271.390F, 254.830F,
|
||||
239.280F, 224.679F, 210.969F, 198.096F,
|
||||
186.008F, 174.658F, 164.000F, 153.993F,
|
||||
144.596F, 135.773F, 127.488F, 119.708F,
|
||||
112.404F, 105.545F, 99.1046F, 93.0572F,
|
||||
87.3788F, 82.0469F, 77.0404F, 72.3394F,
|
||||
67.9252F, 63.7804F, 59.8885F, 56.2341F,
|
||||
52.8027F, 49.5807F, 46.5553F, 43.7144F,
|
||||
41.0470F, 38.5423F, 36.1904F, 33.9821F,
|
||||
31.9085F, 29.9614F, 28.1332F, 26.4165F,
|
||||
24.8045F, 23.2910F, 21.8697F, 20.5352F,
|
||||
19.2822F, 18.1056F, 17.0008F, 15.9634F,
|
||||
14.9893F, 14.0746F, 13.2158F, 12.4094F,
|
||||
11.6522F, 10.9411F, 10.2735F, 9.64662F,
|
||||
9.05798F, 8.50526F, 7.98626F, 7.49894F,
|
||||
7.04135F, 6.61169F, 6.20824F, 5.82941F,
|
||||
5.47370F, 5.13970F, 4.82607F, 4.53158F,
|
||||
4.25507F, 3.99542F, 3.75162F, 3.52269F,
|
||||
3.30774F, 3.10590F, 2.91638F, 2.73842F,
|
||||
2.57132F, 2.41442F, 2.26709F, 2.12875F,
|
||||
1.99885F, 1.87688F, 1.76236F, 1.65482F,
|
||||
1.55384F, 1.45902F, 1.36999F, 1.28640F,
|
||||
0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F,
|
||||
7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F,
|
||||
5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F,
|
||||
4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F,
|
||||
3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F,
|
||||
2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F,
|
||||
2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F,
|
||||
1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F,
|
||||
1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F,
|
||||
973377.F, 913981.F, 858210.F, 805842.F,
|
||||
756669.F, 710497.F, 667142.F, 626433.F,
|
||||
588208.F, 552316.F, 518613.F, 486967.F,
|
||||
457252.F, 429351.F, 403152.F, 378551.F,
|
||||
355452.F, 333762.F, 313396.F, 294273.F,
|
||||
276316.F, 259455.F, 243623.F, 228757.F,
|
||||
214798.F, 201691.F, 189384.F, 177828.F,
|
||||
166977.F, 156788.F, 147221.F, 138237.F,
|
||||
129802.F, 121881.F, 114444.F, 107461.F,
|
||||
100903.F, 94746.3F, 88964.9F, 83536.2F,
|
||||
78438.8F, 73652.5F, 69158.2F, 64938.1F,
|
||||
60975.6F, 57254.9F, 53761.2F, 50480.6F,
|
||||
47400.3F, 44507.9F, 41792.0F, 39241.9F,
|
||||
36847.3F, 34598.9F, 32487.7F, 30505.3F,
|
||||
28643.8F, 26896.0F, 25254.8F, 23713.7F,
|
||||
22266.7F, 20908.0F, 19632.2F, 18434.2F,
|
||||
17309.4F, 16253.1F, 15261.4F, 14330.1F,
|
||||
13455.7F, 12634.6F, 11863.7F, 11139.7F,
|
||||
10460.0F, 9821.72F, 9222.39F, 8659.64F,
|
||||
8131.23F, 7635.06F, 7169.17F, 6731.70F,
|
||||
6320.93F, 5935.23F, 5573.06F, 5232.99F,
|
||||
4913.67F, 4613.84F, 4332.30F, 4067.94F,
|
||||
3819.72F, 3586.64F, 3367.78F, 3162.28F,
|
||||
2969.31F, 2788.13F, 2617.99F, 2458.24F,
|
||||
2308.24F, 2167.39F, 2035.14F, 1910.95F,
|
||||
1794.35F, 1684.85F, 1582.04F, 1485.51F,
|
||||
1394.86F, 1309.75F, 1229.83F, 1154.78F,
|
||||
1084.32F, 1018.15F, 956.024F, 897.687F,
|
||||
842.910F, 791.475F, 743.179F, 697.830F,
|
||||
655.249F, 615.265F, 577.722F, 542.469F,
|
||||
509.367F, 478.286F, 449.101F, 421.696F,
|
||||
395.964F, 371.803F, 349.115F, 327.812F,
|
||||
307.809F, 289.026F, 271.390F, 254.830F,
|
||||
239.280F, 224.679F, 210.969F, 198.096F,
|
||||
186.008F, 174.658F, 164.000F, 153.993F,
|
||||
144.596F, 135.773F, 127.488F, 119.708F,
|
||||
112.404F, 105.545F, 99.1046F, 93.0572F,
|
||||
87.3788F, 82.0469F, 77.0404F, 72.3394F,
|
||||
67.9252F, 63.7804F, 59.8885F, 56.2341F,
|
||||
52.8027F, 49.5807F, 46.5553F, 43.7144F,
|
||||
41.0470F, 38.5423F, 36.1904F, 33.9821F,
|
||||
31.9085F, 29.9614F, 28.1332F, 26.4165F,
|
||||
24.8045F, 23.2910F, 21.8697F, 20.5352F,
|
||||
19.2822F, 18.1056F, 17.0008F, 15.9634F,
|
||||
14.9893F, 14.0746F, 13.2158F, 12.4094F,
|
||||
11.6522F, 10.9411F, 10.2735F, 9.64662F,
|
||||
9.05798F, 8.50526F, 7.98626F, 7.49894F,
|
||||
7.04135F, 6.61169F, 6.20824F, 5.82941F,
|
||||
5.47370F, 5.13970F, 4.82607F, 4.53158F,
|
||||
4.25507F, 3.99542F, 3.75162F, 3.52269F,
|
||||
3.30774F, 3.10590F, 2.91638F, 2.73842F,
|
||||
2.57132F, 2.41442F, 2.26709F, 2.12875F,
|
||||
1.99885F, 1.87688F, 1.76236F, 1.65482F,
|
||||
1.55384F, 1.45902F, 1.36999F, 1.28640F,
|
||||
1.20790F, 1.13419F, 1.06499F, 1.F
|
||||
};
|
||||
|
||||
|
@ -767,12 +767,12 @@ void _vp_remove_floor(vorbis_look_psy *p,
|
|||
float *mdct,
|
||||
int *codedflr,
|
||||
float *residue,
|
||||
int sliding_lowpass){
|
||||
int sliding_lowpass){
|
||||
|
||||
int i,n=p->n;
|
||||
|
||||
|
||||
if(sliding_lowpass>n)sliding_lowpass=n;
|
||||
|
||||
|
||||
for(i=0;i<sliding_lowpass;i++){
|
||||
residue[i]=
|
||||
mdct[i]*FLOOR1_fromdB_INV_LOOKUP[codedflr[i]];
|
||||
|
@ -783,7 +783,7 @@ void _vp_remove_floor(vorbis_look_psy *p,
|
|||
}
|
||||
|
||||
void _vp_noisemask(vorbis_look_psy *p,
|
||||
float *logmdct,
|
||||
float *logmdct,
|
||||
float *logmask){
|
||||
|
||||
int i,n=p->n;
|
||||
|
@ -798,7 +798,7 @@ void _vp_noisemask(vorbis_look_psy *p,
|
|||
p->vi->noisewindowfixed);
|
||||
|
||||
for(i=0;i<n;i++)work[i]=logmdct[i]-work[i];
|
||||
|
||||
|
||||
#if 0
|
||||
{
|
||||
static int seq=0;
|
||||
|
@ -807,12 +807,12 @@ void _vp_noisemask(vorbis_look_psy *p,
|
|||
for(i=0;i<n;i++){
|
||||
work2[i]=logmask[i]+work[i];
|
||||
}
|
||||
|
||||
|
||||
if(seq&1)
|
||||
_analysis_output("median2R",seq/2,work,n,1,0,0);
|
||||
else
|
||||
_analysis_output("median2L",seq/2,work,n,1,0,0);
|
||||
|
||||
|
||||
if(seq&1)
|
||||
_analysis_output("envelope2R",seq/2,work2,n,1,0,0);
|
||||
else
|
||||
|
@ -841,11 +841,11 @@ void _vp_tonemask(vorbis_look_psy *p,
|
|||
float *seed=alloca(sizeof(*seed)*p->total_octave_lines);
|
||||
float att=local_specmax+p->vi->ath_adjatt;
|
||||
for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
|
||||
|
||||
|
||||
/* set the ATH (floating below localmax, not global max by a
|
||||
specified att) */
|
||||
if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
|
||||
|
||||
|
||||
for(i=0;i<n;i++)
|
||||
logmask[i]=p->ath[i]+att;
|
||||
|
||||
|
@ -867,7 +867,7 @@ void _vp_offset_and_mix(vorbis_look_psy *p,
|
|||
float toneatt=p->vi->tone_masteratt[offset_select];
|
||||
|
||||
cx = p->m_val;
|
||||
|
||||
|
||||
for(i=0;i<n;i++){
|
||||
float val= noise[i]+p->noiseoffset[offset_select][i];
|
||||
if(val>p->vi->noisemaxsupp)val=p->vi->noisemaxsupp;
|
||||
|
@ -876,39 +876,39 @@ void _vp_offset_and_mix(vorbis_look_psy *p,
|
|||
|
||||
/* AoTuV */
|
||||
/** @ M1 **
|
||||
The following codes improve a noise problem.
|
||||
The following codes improve a noise problem.
|
||||
A fundamental idea uses the value of masking and carries out
|
||||
the relative compensation of the MDCT.
|
||||
However, this code is not perfect and all noise problems cannot be solved.
|
||||
the relative compensation of the MDCT.
|
||||
However, this code is not perfect and all noise problems cannot be solved.
|
||||
by Aoyumi @ 2004/04/18
|
||||
*/
|
||||
|
||||
if(offset_select == 1) {
|
||||
coeffi = -17.2; /* coeffi is a -17.2dB threshold */
|
||||
val = val - logmdct[i]; /* val == mdct line value relative to floor in dB */
|
||||
|
||||
|
||||
if(val > coeffi){
|
||||
/* mdct value is > -17.2 dB below floor */
|
||||
|
||||
|
||||
de = 1.0-((val-coeffi)*0.005*cx);
|
||||
/* pro-rated attenuation:
|
||||
-0.00 dB boost if mdct value is -17.2dB (relative to floor)
|
||||
-0.77 dB boost if mdct value is 0dB (relative to floor)
|
||||
-1.64 dB boost if mdct value is +17.2dB (relative to floor)
|
||||
-0.00 dB boost if mdct value is -17.2dB (relative to floor)
|
||||
-0.77 dB boost if mdct value is 0dB (relative to floor)
|
||||
-1.64 dB boost if mdct value is +17.2dB (relative to floor)
|
||||
etc... */
|
||||
|
||||
|
||||
if(de < 0) de = 0.0001;
|
||||
}else
|
||||
/* mdct value is <= -17.2 dB below floor */
|
||||
|
||||
|
||||
de = 1.0-((val-coeffi)*0.0003*cx);
|
||||
/* pro-rated attenuation:
|
||||
+0.00 dB atten if mdct value is -17.2dB (relative to floor)
|
||||
+0.45 dB atten if mdct value is -34.4dB (relative to floor)
|
||||
+0.00 dB atten if mdct value is -17.2dB (relative to floor)
|
||||
+0.45 dB atten if mdct value is -34.4dB (relative to floor)
|
||||
etc... */
|
||||
|
||||
|
||||
mdct[i] *= de;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -926,16 +926,16 @@ float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){
|
|||
return(amp);
|
||||
}
|
||||
|
||||
static void couple_lossless(float A, float B,
|
||||
static void couple_lossless(float A, float B,
|
||||
float *qA, float *qB){
|
||||
int test1=fabs(*qA)>fabs(*qB);
|
||||
test1-= fabs(*qA)<fabs(*qB);
|
||||
|
||||
|
||||
if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
|
||||
if(test1==1){
|
||||
*qB=(*qA>0.f?*qA-*qB:*qB-*qA);
|
||||
}else{
|
||||
float temp=*qB;
|
||||
float temp=*qB;
|
||||
*qB=(*qB>0.f?*qA-*qB:*qB-*qA);
|
||||
*qA=temp;
|
||||
}
|
||||
|
@ -947,19 +947,19 @@ static void couple_lossless(float A, float B,
|
|||
}
|
||||
|
||||
static const float hypot_lookup[32]={
|
||||
-0.009935, -0.011245, -0.012726, -0.014397,
|
||||
-0.016282, -0.018407, -0.020800, -0.023494,
|
||||
-0.026522, -0.029923, -0.033737, -0.038010,
|
||||
-0.042787, -0.048121, -0.054064, -0.060671,
|
||||
-0.068000, -0.076109, -0.085054, -0.094892,
|
||||
-0.105675, -0.117451, -0.130260, -0.144134,
|
||||
-0.159093, -0.175146, -0.192286, -0.210490,
|
||||
-0.009935, -0.011245, -0.012726, -0.014397,
|
||||
-0.016282, -0.018407, -0.020800, -0.023494,
|
||||
-0.026522, -0.029923, -0.033737, -0.038010,
|
||||
-0.042787, -0.048121, -0.054064, -0.060671,
|
||||
-0.068000, -0.076109, -0.085054, -0.094892,
|
||||
-0.105675, -0.117451, -0.130260, -0.144134,
|
||||
-0.159093, -0.175146, -0.192286, -0.210490,
|
||||
-0.229718, -0.249913, -0.271001, -0.292893};
|
||||
|
||||
static void precomputed_couple_point(float premag,
|
||||
int floorA,int floorB,
|
||||
float *mag, float *ang){
|
||||
|
||||
|
||||
int test=(floorA>floorB)-1;
|
||||
int offset=31-abs(floorA-floorB);
|
||||
float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f;
|
||||
|
@ -1003,11 +1003,11 @@ float **_vp_quantize_couple_memo(vorbis_block *vb,
|
|||
vorbis_look_psy *p,
|
||||
vorbis_info_mapping0 *vi,
|
||||
float **mdct){
|
||||
|
||||
|
||||
int i,j,n=p->n;
|
||||
float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
|
||||
int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
|
||||
|
||||
|
||||
for(i=0;i<vi->coupling_steps;i++){
|
||||
float *mdctM=mdct[vi->coupling_mag[i]];
|
||||
float *mdctA=mdct[vi->coupling_ang[i]];
|
||||
|
@ -1039,10 +1039,10 @@ int **_vp_quantize_couple_sort(vorbis_block *vb,
|
|||
int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
|
||||
int partition=p->vi->normal_partition;
|
||||
float **work=alloca(sizeof(*work)*partition);
|
||||
|
||||
|
||||
for(i=0;i<vi->coupling_steps;i++){
|
||||
ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
|
||||
|
||||
|
||||
for(j=0;j<n;j+=partition){
|
||||
for(k=0;k<partition;k++)work[k]=mags[i]+k+j;
|
||||
qsort(work,partition,sizeof(*work),apsort);
|
||||
|
@ -1084,17 +1084,17 @@ void _vp_noise_normalize(vorbis_look_psy *p,
|
|||
if(vi->normal_channel_p){
|
||||
for(;j<start;j++)
|
||||
out[j]=rint(in[j]);
|
||||
|
||||
|
||||
for(;j+partition<=n;j+=partition){
|
||||
float acc=0.;
|
||||
int k;
|
||||
|
||||
|
||||
for(i=j;i<j+partition;i++)
|
||||
acc+=in[i]*in[i];
|
||||
|
||||
|
||||
for(i=0;i<partition;i++){
|
||||
k=sortedindex[i+j-start];
|
||||
|
||||
|
||||
if(in[k]*in[k]>=.25f){
|
||||
out[k]=rint(in[k]);
|
||||
acc-=in[k]*in[k];
|
||||
|
@ -1105,17 +1105,17 @@ void _vp_noise_normalize(vorbis_look_psy *p,
|
|||
acc-=1.;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(;i<partition;i++){
|
||||
k=sortedindex[i+j-start];
|
||||
out[k]=0.;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(;j<n;j++)
|
||||
out[j]=rint(in[j]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void _vp_couple(int blobno,
|
||||
|
@ -1147,7 +1147,7 @@ void _vp_couple(int blobno,
|
|||
nonzero channels. */
|
||||
if(nonzero[vi->coupling_mag[i]] ||
|
||||
nonzero[vi->coupling_ang[i]]){
|
||||
|
||||
|
||||
|
||||
float *rM=res[vi->coupling_mag[i]];
|
||||
float *rA=res[vi->coupling_ang[i]];
|
||||
|
@ -1161,13 +1161,13 @@ void _vp_couple(int blobno,
|
|||
int limit=g->coupling_pointlimit[p->vi->blockflag][blobno];
|
||||
int pointlimit=limit;
|
||||
|
||||
nonzero[vi->coupling_mag[i]]=1;
|
||||
nonzero[vi->coupling_ang[i]]=1;
|
||||
nonzero[vi->coupling_mag[i]]=1;
|
||||
nonzero[vi->coupling_ang[i]]=1;
|
||||
|
||||
/* The threshold of a stereo is changed with the size of n */
|
||||
if(n > 1000)
|
||||
postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]];
|
||||
|
||||
postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]];
|
||||
|
||||
for(j=0;j<p->n;j+=partition){
|
||||
float acc=0.f;
|
||||
|
||||
|
@ -1192,7 +1192,7 @@ void _vp_couple(int blobno,
|
|||
qA[l]=0.;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(p->vi->normal_point_p){
|
||||
for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){
|
||||
int l=mag_sort[i][j+k];
|
||||
|
@ -1200,7 +1200,7 @@ void _vp_couple(int blobno,
|
|||
qM[l]=unitnorm(qM[l]);
|
||||
acc-=1.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1209,22 +1209,22 @@ void _vp_couple(int blobno,
|
|||
|
||||
/* AoTuV */
|
||||
/** @ M2 **
|
||||
The boost problem by the combination of noise normalization and point stereo is eased.
|
||||
However, this is a temporary patch.
|
||||
The boost problem by the combination of noise normalization and point stereo is eased.
|
||||
However, this is a temporary patch.
|
||||
by Aoyumi @ 2004/04/18
|
||||
*/
|
||||
|
||||
void hf_reduction(vorbis_info_psy_global *g,
|
||||
vorbis_look_psy *p,
|
||||
vorbis_look_psy *p,
|
||||
vorbis_info_mapping0 *vi,
|
||||
float **mdct){
|
||||
|
||||
|
||||
int i,j,n=p->n, de=0.3*p->m_val;
|
||||
int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
|
||||
|
||||
|
||||
for(i=0; i<vi->coupling_steps; i++){
|
||||
/* for(j=start; j<limit; j++){} // ???*/
|
||||
for(j=limit; j<n; j++)
|
||||
for(j=limit; j<n; j++)
|
||||
mdct[i][j] *= (1.0 - de*((float)(j-limit) / (float)(n-limit)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: registry for time, floor, res backends and channel mappings
|
||||
last mod: $Id$
|
||||
last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -43,4 +43,3 @@ const vorbis_func_residue *const _residue_P[]={
|
|||
const vorbis_func_mapping *const _mapping_P[]={
|
||||
&mapping0_exportbundle,
|
||||
};
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: residue backend 0, 1 and 2 implementation
|
||||
last mod: $Id$
|
||||
last mod: $Id: res0.c 16327 2009-07-24 00:49:25Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -33,11 +33,11 @@
|
|||
|
||||
#if defined(TRAIN_RES) || defined (TRAIN_RESAUX)
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
vorbis_info_residue0 *info;
|
||||
|
||||
|
||||
int parts;
|
||||
int stages;
|
||||
codebook *fullbooks;
|
||||
|
@ -86,16 +86,16 @@ void res0_free_look(vorbis_look_residue *i){
|
|||
char buffer[80];
|
||||
FILE *of;
|
||||
codebook *statebook=look->partbooks[j][k];
|
||||
|
||||
|
||||
/* long and short into the same bucket by current convention */
|
||||
sprintf(buffer,"res_part%d_pass%d.vqd",j,k);
|
||||
of=fopen(buffer,"a");
|
||||
|
||||
for(l=0;l<statebook->entries;l++)
|
||||
fprintf(of,"%d:%ld\n",l,look->training_data[k][j][l]);
|
||||
|
||||
|
||||
fclose(of);
|
||||
|
||||
|
||||
/*fprintf(stderr,"%d(%.2f|%.2f) ",k,
|
||||
look->training_min[k][j],look->training_max[k][j]);*/
|
||||
|
||||
|
@ -121,7 +121,7 @@ void res0_free_look(vorbis_look_residue *i){
|
|||
"(%g/frame) \n",look->frames,look->phrasebits,
|
||||
look->resbitsflat,
|
||||
(look->phrasebits+look->resbitsflat)/(float)look->frames);
|
||||
|
||||
|
||||
for(j=0;j<look->parts;j++){
|
||||
long acc=0;
|
||||
fprintf(stderr,"\t[%d] == ",j);
|
||||
|
@ -173,7 +173,7 @@ void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){
|
|||
oggpack_write(opb,info->begin,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 */
|
||||
oggpack_write(opb,info->partitions-1,6); /* possible partition choices */
|
||||
oggpack_write(opb,info->groupbook,8); /* group huffman book */
|
||||
|
@ -184,9 +184,9 @@ void res0_pack(vorbis_info_residue *vr,oggpack_buffer *opb){
|
|||
for(j=0;j<info->partitions;j++){
|
||||
if(ilog(info->secondstages[j])>3){
|
||||
/* yes, this is a minor hack due to not thinking ahead */
|
||||
oggpack_write(opb,info->secondstages[j],3);
|
||||
oggpack_write(opb,info->secondstages[j],3);
|
||||
oggpack_write(opb,1,1);
|
||||
oggpack_write(opb,info->secondstages[j]>>3,5);
|
||||
oggpack_write(opb,info->secondstages[j]>>3,5);
|
||||
}else
|
||||
oggpack_write(opb,info->secondstages[j],4); /* trailing zero */
|
||||
acc+=icount(info->secondstages[j]);
|
||||
|
@ -208,16 +208,27 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
|||
info->partitions=oggpack_read(opb,6)+1;
|
||||
info->groupbook=oggpack_read(opb,8);
|
||||
|
||||
/* check for premature EOP */
|
||||
if(info->groupbook<0)goto errout;
|
||||
|
||||
for(j=0;j<info->partitions;j++){
|
||||
int cascade=oggpack_read(opb,3);
|
||||
if(oggpack_read(opb,1))
|
||||
cascade|=(oggpack_read(opb,5)<<3);
|
||||
int cflag=oggpack_read(opb,1);
|
||||
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;
|
||||
|
||||
acc+=icount(cascade);
|
||||
}
|
||||
for(j=0;j<acc;j++)
|
||||
info->booklist[j]=oggpack_read(opb,8);
|
||||
for(j=0;j<acc;j++){
|
||||
int book=oggpack_read(opb,8);
|
||||
if(book<0) goto errout;
|
||||
info->booklist[j]=book;
|
||||
}
|
||||
|
||||
if(info->groupbook>=ci->books)goto errout;
|
||||
for(j=0;j<acc;j++){
|
||||
|
@ -236,6 +247,7 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
|||
if(partvals > entries) goto errout;
|
||||
dim--;
|
||||
}
|
||||
if(partvals < entries) goto errout;
|
||||
}
|
||||
|
||||
return(info);
|
||||
|
@ -315,23 +327,23 @@ static int local_book_besterror(codebook *book,float *a){
|
|||
float val=a[--o];
|
||||
i=tt->threshvals>>1;
|
||||
|
||||
if(val<tt->quantthresh[i]){
|
||||
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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
best=(best*tt->quantvals)+tt->quantmap[i];
|
||||
}
|
||||
/* regular lattices are easy :-) */
|
||||
|
||||
|
||||
if(book->c->lengthlist[best]<=0){
|
||||
const static_codebook *c=book->c;
|
||||
int i,j;
|
||||
|
@ -376,9 +388,9 @@ static int _encodepart(oggpack_buffer *opb,float *vec, int n,
|
|||
if(entry>0)
|
||||
acc[entry]++;
|
||||
#endif
|
||||
|
||||
|
||||
bits+=vorbis_book_encode(book,entry,opb);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return(bits);
|
||||
|
@ -394,20 +406,20 @@ static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
|
|||
int samples_per_partition=info->grouping;
|
||||
int possible_partitions=info->partitions;
|
||||
int n=info->end-info->begin;
|
||||
|
||||
|
||||
int partvals=n/samples_per_partition;
|
||||
long **partword=_vorbis_block_alloc(vb,ch*sizeof(*partword));
|
||||
float scale=100./samples_per_partition;
|
||||
|
||||
|
||||
/* we find the partition type for each partition of each
|
||||
channel. We'll go back and do the interleaved encoding in a
|
||||
bit. For now, clarity */
|
||||
|
||||
|
||||
for(i=0;i<ch;i++){
|
||||
partword[i]=_vorbis_block_alloc(vb,n/samples_per_partition*sizeof(*partword[i]));
|
||||
memset(partword[i],0,n/samples_per_partition*sizeof(*partword[i]));
|
||||
}
|
||||
|
||||
|
||||
for(i=0;i<partvals;i++){
|
||||
int offset=i*samples_per_partition+info->begin;
|
||||
for(j=0;j<ch;j++){
|
||||
|
@ -418,21 +430,21 @@ static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
|
|||
ent+=fabs(rint(in[j][offset+k]));
|
||||
}
|
||||
ent*=scale;
|
||||
|
||||
|
||||
for(k=0;k<possible_partitions-1;k++)
|
||||
if(max<=info->classmetric1[k] &&
|
||||
(info->classmetric2[k]<0 || (int)ent<info->classmetric2[k]))
|
||||
break;
|
||||
|
||||
partword[j][i]=k;
|
||||
|
||||
partword[j][i]=k;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef TRAIN_RESAUX
|
||||
{
|
||||
FILE *of;
|
||||
char buffer[80];
|
||||
|
||||
|
||||
for(i=0;i<ch;i++){
|
||||
sprintf(buffer,"resaux_%d.vqd",look->train_seq);
|
||||
of=fopen(buffer,"a");
|
||||
|
@ -444,7 +456,7 @@ static long **_01class(vorbis_block *vb,vorbis_look_residue *vl,
|
|||
}
|
||||
#endif
|
||||
look->frames++;
|
||||
|
||||
|
||||
return(partword);
|
||||
}
|
||||
|
||||
|
@ -464,15 +476,15 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in,
|
|||
|
||||
int partvals=n/samples_per_partition;
|
||||
long **partword=_vorbis_block_alloc(vb,sizeof(*partword));
|
||||
|
||||
|
||||
#if defined(TRAIN_RES) || defined (TRAIN_RESAUX)
|
||||
FILE *of;
|
||||
char buffer[80];
|
||||
#endif
|
||||
|
||||
|
||||
partword[0]=_vorbis_block_alloc(vb,n*ch/samples_per_partition*sizeof(*partword[0]));
|
||||
memset(partword[0],0,n*ch/samples_per_partition*sizeof(*partword[0]));
|
||||
|
||||
|
||||
for(i=0,l=info->begin/ch;i<partvals;i++){
|
||||
float magmax=0.f;
|
||||
float angmax=0.f;
|
||||
|
@ -482,16 +494,16 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in,
|
|||
if(fabs(in[k][l])>angmax)angmax=fabs(in[k][l]);
|
||||
l++;
|
||||
}
|
||||
|
||||
|
||||
for(j=0;j<possible_partitions-1;j++)
|
||||
if(magmax<=info->classmetric1[j] &&
|
||||
angmax<=info->classmetric2[j])
|
||||
break;
|
||||
|
||||
|
||||
partword[0][i]=j;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#ifdef TRAIN_RESAUX
|
||||
sprintf(buffer,"resaux_%d.vqd",look->train_seq);
|
||||
of=fopen(buffer,"a");
|
||||
|
@ -500,9 +512,9 @@ static long **_2class(vorbis_block *vb,vorbis_look_residue *vl,float **in,
|
|||
fprintf(of,"\n");
|
||||
fclose(of);
|
||||
#endif
|
||||
|
||||
|
||||
look->frames++;
|
||||
|
||||
|
||||
return(partword);
|
||||
}
|
||||
|
||||
|
@ -525,7 +537,7 @@ static int _01forward(oggpack_buffer *opb,
|
|||
int partvals=n/samples_per_partition;
|
||||
long resbits[128];
|
||||
long resvals[128];
|
||||
|
||||
|
||||
#ifdef TRAIN_RES
|
||||
for(i=0;i<ch;i++)
|
||||
for(j=info->begin;j<end;j++){
|
||||
|
@ -533,19 +545,19 @@ static int _01forward(oggpack_buffer *opb,
|
|||
if(in[i][j]<look->tmin)look->tmin=in[i][j];
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
memset(resbits,0,sizeof(resbits));
|
||||
memset(resvals,0,sizeof(resvals));
|
||||
|
||||
|
||||
/* we code the partition words for each channel, then the residual
|
||||
words for a partition per channel until we've written all the
|
||||
residual words for that partition word. Then write the next
|
||||
partition channel words... */
|
||||
|
||||
|
||||
for(s=0;s<look->stages;s++){
|
||||
|
||||
|
||||
for(i=0;i<partvals;){
|
||||
|
||||
|
||||
/* first we encode a partition codeword for each channel */
|
||||
if(s==0){
|
||||
for(j=0;j<ch;j++){
|
||||
|
@ -554,8 +566,8 @@ static int _01forward(oggpack_buffer *opb,
|
|||
val*=possible_partitions;
|
||||
if(i+k<partvals)
|
||||
val+=partword[j][i+k];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* training hack */
|
||||
if(val<look->phrasebook->entries)
|
||||
look->phrasebits+=vorbis_book_encode(look->phrasebook,val,opb);
|
||||
|
@ -563,14 +575,14 @@ static int _01forward(oggpack_buffer *opb,
|
|||
else
|
||||
fprintf(stderr,"!");
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now we encode interleaved residual values for the partitions */
|
||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++){
|
||||
long offset=i*samples_per_partition+info->begin;
|
||||
|
||||
|
||||
for(j=0;j<ch;j++){
|
||||
if(s==0)resvals[partword[j][i]]+=samples_per_partition;
|
||||
if(info->secondstages[partword[j][i]]&(1<<s)){
|
||||
|
@ -578,7 +590,7 @@ static int _01forward(oggpack_buffer *opb,
|
|||
if(statebook){
|
||||
int ret;
|
||||
long *accumulator=NULL;
|
||||
|
||||
|
||||
#ifdef TRAIN_RES
|
||||
accumulator=look->training_data[s][partword[j][i]];
|
||||
{
|
||||
|
@ -592,10 +604,10 @@ static int _01forward(oggpack_buffer *opb,
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
ret=encode(opb,in[j]+offset,samples_per_partition,
|
||||
statebook,accumulator);
|
||||
|
||||
|
||||
look->postbits+=ret;
|
||||
resbits[partword[j][i]]+=ret;
|
||||
}
|
||||
|
@ -604,7 +616,7 @@ static int _01forward(oggpack_buffer *opb,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*{
|
||||
long total=0;
|
||||
long totalbits=0;
|
||||
|
@ -614,7 +626,7 @@ static int _01forward(oggpack_buffer *opb,
|
|||
total+=resvals[k];
|
||||
totalbits+=resbits[k];
|
||||
}
|
||||
|
||||
|
||||
fprintf(stderr,":: %ld:%1.2g\n",total,(double)totalbits/total);
|
||||
}*/
|
||||
|
||||
|
@ -624,7 +636,7 @@ static int _01forward(oggpack_buffer *opb,
|
|||
/* a truncated packet here just means 'stop working'; it's not an error */
|
||||
static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||
float **in,int ch,
|
||||
long (*decodepart)(codebook *, float *,
|
||||
long (*decodepart)(codebook *, float *,
|
||||
oggpack_buffer *,int)){
|
||||
|
||||
long i,j,k,l,s;
|
||||
|
@ -637,31 +649,31 @@ static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
|||
int max=vb->pcmend>>1;
|
||||
int end=(info->end<max?info->end:max);
|
||||
int n=end-info->begin;
|
||||
|
||||
|
||||
if(n>0){
|
||||
int partvals=n/samples_per_partition;
|
||||
int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
|
||||
int ***partword=alloca(ch*sizeof(*partword));
|
||||
|
||||
|
||||
for(j=0;j<ch;j++)
|
||||
partword[j]=_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
|
||||
|
||||
|
||||
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 */
|
||||
for(i=0,l=0;i<partvals;l++){
|
||||
if(s==0){
|
||||
/* fetch the partition word for each channel */
|
||||
for(j=0;j<ch;j++){
|
||||
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
|
||||
|
||||
|
||||
if(temp==-1)goto eopbreak;
|
||||
partword[j][l]=look->decodemap[temp];
|
||||
if(partword[j][l]==NULL)goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now we decode residual values for the partitions */
|
||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
||||
for(j=0;j<ch;j++){
|
||||
|
@ -674,7 +686,7 @@ static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
errout:
|
||||
|
@ -825,7 +837,7 @@ int res2_forward(oggpack_buffer *opb,
|
|||
for(j=0,k=i;j<n;j++,k+=ch)
|
||||
work[k]=pcm[j];
|
||||
}
|
||||
|
||||
|
||||
if(used){
|
||||
int ret=_01forward(opb,vb,vl,&work,1,partword,_encodepart);
|
||||
/* update the sofar vector */
|
||||
|
@ -835,7 +847,7 @@ int res2_forward(oggpack_buffer *opb,
|
|||
float *sofar=out[i];
|
||||
for(j=0,k=i;j<n;j++,k+=ch)
|
||||
sofar[j]+=pcm[j]-work[k];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return(ret);
|
||||
|
@ -862,13 +874,13 @@ int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
|||
int partvals=n/samples_per_partition;
|
||||
int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
|
||||
int **partword=_vorbis_block_alloc(vb,partwords*sizeof(*partword));
|
||||
|
||||
|
||||
for(i=0;i<ch;i++)if(nonzero[i])break;
|
||||
if(i==ch)return(0); /* no nonzero vectors */
|
||||
|
||||
|
||||
for(s=0;s<look->stages;s++){
|
||||
for(i=0,l=0;i<partvals;l++){
|
||||
|
||||
|
||||
if(s==0){
|
||||
/* fetch the partition word */
|
||||
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
|
||||
|
@ -876,12 +888,12 @@ int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
|||
partword[l]=look->decodemap[temp];
|
||||
if(partword[l]==NULL)goto errout;
|
||||
}
|
||||
|
||||
|
||||
/* now we decode residual values for the partitions */
|
||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
||||
if(info->secondstages[partword[l][k]]&(1<<s)){
|
||||
codebook *stagebook=look->partbooks[partword[l][k]][s];
|
||||
|
||||
|
||||
if(stagebook){
|
||||
if(vorbis_book_decodevv_add(stagebook,in,
|
||||
i*samples_per_partition+info->begin,ch,
|
||||
|
@ -889,7 +901,7 @@ int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
|||
goto eopbreak;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
errout:
|
||||
|
@ -930,4 +942,3 @@ const vorbis_func_residue residue2_exportbundle={
|
|||
&res2_forward,
|
||||
&res2_inverse
|
||||
};
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: basic shared codebook operations
|
||||
last mod: $Id$
|
||||
last mod: $Id: sharedbook.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -36,7 +36,7 @@ int _ilog(unsigned int v){
|
|||
}
|
||||
|
||||
/* 32 bit float (not IEEE; nonnormalized mantissa +
|
||||
biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
|
||||
biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
|
||||
Why not IEEE? It's just not that important here. */
|
||||
|
||||
#define VQ_FEXP 10
|
||||
|
@ -80,12 +80,12 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
|||
long length=l[i];
|
||||
if(length>0){
|
||||
ogg_uint32_t entry=marker[length];
|
||||
|
||||
|
||||
/* when we claim a node for an entry, we also claim the nodes
|
||||
below it (pruning off the imagined tree that may have dangled
|
||||
from it) as well as blocking the use of any nodes directly
|
||||
above for leaves */
|
||||
|
||||
|
||||
/* update ourself */
|
||||
if(length<32 && (entry>>length)){
|
||||
/* error condition; the lengths must specify an overpopulated tree */
|
||||
|
@ -93,12 +93,12 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
|||
return(NULL);
|
||||
}
|
||||
r[count++]=entry;
|
||||
|
||||
|
||||
/* Look to see if the next shorter marker points to the node
|
||||
above. if so, update it and repeat. */
|
||||
{
|
||||
for(j=length;j>0;j--){
|
||||
|
||||
|
||||
if(marker[j]&1){
|
||||
/* have to jump branches */
|
||||
if(j==1)
|
||||
|
@ -111,7 +111,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
|||
marker[j]++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* prune the tree; the implicit invariant says all the longer
|
||||
markers were dangling from our just-taken node. Dangle them
|
||||
from our *new* node. */
|
||||
|
@ -124,7 +124,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
|||
}else
|
||||
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
|
||||
|
@ -221,7 +221,7 @@ float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){
|
|||
int index= (j/indexdiv)%quantvals;
|
||||
float val=b->quantlist[index];
|
||||
val=fabs(val)*delta+mindel+last;
|
||||
if(b->q_sequencep)last=val;
|
||||
if(b->q_sequencep)last=val;
|
||||
if(sparsemap)
|
||||
r[sparsemap[count]*b->dim+k]=val;
|
||||
else
|
||||
|
@ -237,11 +237,11 @@ float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){
|
|||
for(j=0;j<b->entries;j++){
|
||||
if((sparsemap && b->lengthlist[j]) || !sparsemap){
|
||||
float last=0.f;
|
||||
|
||||
|
||||
for(k=0;k<b->dim;k++){
|
||||
float val=b->quantlist[j*b->dim+k];
|
||||
val=fabs(val)*delta+mindel+last;
|
||||
if(b->q_sequencep)last=val;
|
||||
if(b->q_sequencep)last=val;
|
||||
if(sparsemap)
|
||||
r[sparsemap[count]*b->dim+k]=val;
|
||||
else
|
||||
|
@ -323,7 +323,7 @@ static ogg_uint32_t bitreverse(ogg_uint32_t x){
|
|||
}
|
||||
|
||||
static int sort32a(const void *a,const void *b){
|
||||
return ( **(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
|
||||
return ( **(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
|
||||
( **(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||
int i,j,n=0,tabn;
|
||||
int *sortindex;
|
||||
memset(c,0,sizeof(*c));
|
||||
|
||||
|
||||
/* count actually used entries */
|
||||
for(i=0;i<s->entries;i++)
|
||||
if(s->lengthlist[i]>0)
|
||||
|
@ -343,30 +343,30 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||
c->dim=s->dim;
|
||||
|
||||
if(n>0){
|
||||
|
||||
/* two different remappings go on here.
|
||||
|
||||
|
||||
/* two different remappings go on here.
|
||||
|
||||
First, we collapse the likely sparse codebook down only to
|
||||
actually represented values/words. This collapsing needs to be
|
||||
indexed as map-valueless books are used to encode original entry
|
||||
positions as integers.
|
||||
|
||||
|
||||
Second, we reorder all vectors, including the entry index above,
|
||||
by sorted bitreversed codeword to allow treeless decode. */
|
||||
|
||||
/* perform sort */
|
||||
ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
|
||||
ogg_uint32_t **codep=alloca(sizeof(*codep)*n);
|
||||
|
||||
|
||||
if(codes==NULL)goto err_out;
|
||||
|
||||
|
||||
for(i=0;i<n;i++){
|
||||
codes[i]=bitreverse(codes[i]);
|
||||
codep[i]=codes+i;
|
||||
}
|
||||
|
||||
|
||||
qsort(codep,n,sizeof(*codep),sort32a);
|
||||
|
||||
|
||||
sortindex=alloca(n*sizeof(*sortindex));
|
||||
c->codelist=_ogg_malloc(n*sizeof(*c->codelist));
|
||||
/* the index is a reverse index */
|
||||
|
@ -378,28 +378,28 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||
for(i=0;i<n;i++)
|
||||
c->codelist[sortindex[i]]=codes[i];
|
||||
_ogg_free(codes);
|
||||
|
||||
|
||||
|
||||
c->valuelist=_book_unquantize(s,n,sortindex);
|
||||
c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index));
|
||||
|
||||
|
||||
for(n=0,i=0;i<s->entries;i++)
|
||||
if(s->lengthlist[i]>0)
|
||||
c->dec_index[sortindex[n++]]=i;
|
||||
|
||||
|
||||
c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths));
|
||||
for(n=0,i=0;i<s->entries;i++)
|
||||
if(s->lengthlist[i]>0)
|
||||
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
|
||||
|
||||
|
||||
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
|
||||
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
|
||||
if(c->dec_firsttablen>8)c->dec_firsttablen=8;
|
||||
|
||||
|
||||
tabn=1<<c->dec_firsttablen;
|
||||
c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
|
||||
c->dec_maxlength=0;
|
||||
|
||||
|
||||
for(i=0;i<n;i++){
|
||||
if(c->dec_maxlength<c->dec_codelengths[i])
|
||||
c->dec_maxlength=c->dec_codelengths[i];
|
||||
|
@ -409,26 +409,26 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||
c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* now fill in 'unused' entries in the firsttable with hi/lo search
|
||||
hints for the non-direct-hits */
|
||||
{
|
||||
ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
|
||||
long lo=0,hi=0;
|
||||
|
||||
|
||||
for(i=0;i<tabn;i++){
|
||||
ogg_uint32_t word=i<<(32-c->dec_firsttablen);
|
||||
if(c->dec_firsttable[bitreverse(word)]==0){
|
||||
while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
|
||||
while( hi<n && word>=(c->codelist[hi]&mask))hi++;
|
||||
|
||||
|
||||
/* we only actually have 15 bits per hint to play with here.
|
||||
In order to overflow gracefully (nothing breaks, efficiency
|
||||
just drops), encode as the difference from the extremes. */
|
||||
{
|
||||
unsigned long loval=lo;
|
||||
unsigned long hival=n-hi;
|
||||
|
||||
|
||||
if(loval>0x7fff)loval=0x7fff;
|
||||
if(hival>0x7fff)hival=0x7fff;
|
||||
c->dec_firsttable[bitreverse(word)]=
|
||||
|
@ -479,7 +479,7 @@ int _best(codebook *book, float *a, int step){
|
|||
for(;i>0;i--)
|
||||
if(a[o]>=tt->quantthresh[i-1])
|
||||
break;
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
for(i++;i<tt->threshvals-1;i++)
|
||||
|
@ -537,7 +537,7 @@ int _best(codebook *book, float *a, int step){
|
|||
}
|
||||
}
|
||||
|
||||
return(besti);
|
||||
return(besti);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,10 +547,10 @@ int _best(codebook *book, float *a, int step){
|
|||
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 */
|
||||
|
@ -559,7 +559,7 @@ int _best(codebook *book, float *a, int step){
|
|||
}
|
||||
return(-ptr);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* brute force it! */
|
||||
{
|
||||
|
@ -642,7 +642,7 @@ static_codebook test1={
|
|||
0
|
||||
};
|
||||
static float *test1_result=NULL;
|
||||
|
||||
|
||||
/* linear, full mapping, nonsequential */
|
||||
static_codebook test2={
|
||||
4,3,
|
||||
|
@ -679,7 +679,7 @@ static_codebook test4={
|
|||
};
|
||||
static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-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, 4, 4, 4, 4, 4, -1, 4, 4,
|
||||
-3,-1, 4, 4,-1, 4, -1,-1, 4,
|
||||
|
@ -699,7 +699,7 @@ static_codebook test5={
|
|||
};
|
||||
static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7,
|
||||
-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, 1, 5, 4, 8,12, -1, 3, 7,
|
||||
-3,-4, 0, 4, 3, 7, -1,-2, 2,
|
||||
|
@ -746,7 +746,7 @@ int main(){
|
|||
fprintf(stderr,"OK\nDequant test 5... ");
|
||||
run_test(&test5,test5_result);
|
||||
fprintf(stderr,"OK\n\n");
|
||||
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: *unnormalized* fft transform
|
||||
last mod: $Id$
|
||||
last mod: $Id: smallft.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -125,7 +125,7 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
|
|||
t1+=ido;
|
||||
t2+=ido;
|
||||
}
|
||||
|
||||
|
||||
if(ido<2)return;
|
||||
if(ido==2)goto L105;
|
||||
|
||||
|
@ -172,7 +172,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
|
|||
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;
|
||||
t0=l1*ido;
|
||||
|
||||
|
||||
t1=t0;
|
||||
t4=t1<<1;
|
||||
t2=t1+(t1<<1);
|
||||
|
@ -244,7 +244,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
|
|||
if(ido&1)return;
|
||||
|
||||
L105:
|
||||
|
||||
|
||||
t2=(t1=t0+ido-1)+(t0<<1);
|
||||
t3=ido<<2;
|
||||
t4=ido;
|
||||
|
@ -278,7 +278,7 @@ static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
|
|||
int nbd;
|
||||
float dcp,arg,dsp,ar1h,ar2h;
|
||||
int idp2,ipp2;
|
||||
|
||||
|
||||
arg=tpi/(float)ip;
|
||||
dcp=cos(arg);
|
||||
dsp=sin(arg);
|
||||
|
@ -636,7 +636,7 @@ static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
|
|||
float ti2,tr2;
|
||||
|
||||
t0=l1*ido;
|
||||
|
||||
|
||||
t1=0;
|
||||
t2=0;
|
||||
t3=(ido<<1)-1;
|
||||
|
@ -752,7 +752,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
|
|||
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;
|
||||
t0=l1*ido;
|
||||
|
||||
|
||||
t1=0;
|
||||
t2=ido<<2;
|
||||
t3=0;
|
||||
|
@ -761,7 +761,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
|
|||
t4=t3+t6;
|
||||
t5=t1;
|
||||
tr3=cc[t4-1]+cc[t4-1];
|
||||
tr4=cc[t4]+cc[t4];
|
||||
tr4=cc[t4]+cc[t4];
|
||||
tr1=cc[t3]-cc[(t4+=t6)-1];
|
||||
tr2=cc[t3]+cc[t4-1];
|
||||
ch[t5]=tr2+tr3;
|
||||
|
@ -856,7 +856,7 @@ static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
|
|||
ipp2=ip;
|
||||
ipph=(ip+1)>>1;
|
||||
if(ido<l1)goto L103;
|
||||
|
||||
|
||||
t1=0;
|
||||
t2=0;
|
||||
for(k=0;k<l1;k++){
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 *
|
||||
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* by the Xiph.Org Foundation http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: single-block PCM synthesis
|
||||
last mod: $Id$
|
||||
last mod: $Id: synthesis.c 16227 2009-07-08 06:58:46Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
@ -34,7 +34,7 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
|
|||
if (!vd || !b || !vi || !ci || !opb) {
|
||||
return OV_EBADPACKET;
|
||||
}
|
||||
|
||||
|
||||
/* first things first. Make sure decode is ready */
|
||||
_vorbis_block_ripcord(vb);
|
||||
oggpack_readinit(opb,op->packet,op->bytes);
|
||||
|
@ -50,7 +50,7 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
|
|||
if(mode==-1) {
|
||||
return(OV_EBADPACKET);
|
||||
}
|
||||
|
||||
|
||||
vb->mode=mode;
|
||||
if(!ci->mode_param[mode]) {
|
||||
return(OV_EBADPACKET);
|
||||
|
@ -67,7 +67,7 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
|
|||
vb->lW=0;
|
||||
vb->nW=0;
|
||||
}
|
||||
|
||||
|
||||
/* more setup */
|
||||
vb->granulepos=op->granulepos;
|
||||
vb->sequence=op->packetno;
|
||||
|
@ -95,7 +95,7 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
|
|||
codec_setup_info *ci=vi->codec_setup;
|
||||
oggpack_buffer *opb=&vb->opb;
|
||||
int mode;
|
||||
|
||||
|
||||
/* first things first. Make sure decode is ready */
|
||||
_vorbis_block_ripcord(vb);
|
||||
oggpack_readinit(opb,op->packet,op->bytes);
|
||||
|
@ -109,7 +109,7 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
|
|||
/* read our mode and pre/post windowsize */
|
||||
mode=oggpack_read(opb,b->modebits);
|
||||
if(mode==-1)return(OV_EBADPACKET);
|
||||
|
||||
|
||||
vb->mode=mode;
|
||||
vb->W=ci->mode_param[mode]->blockflag;
|
||||
if(vb->W){
|
||||
|
@ -120,7 +120,7 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
|
|||
vb->lW=0;
|
||||
vb->nW=0;
|
||||
}
|
||||
|
||||
|
||||
/* more setup */
|
||||
vb->granulepos=op->granulepos;
|
||||
vb->sequence=op->packetno;
|
||||
|
@ -137,7 +137,7 @@ long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
|
|||
codec_setup_info *ci=vi->codec_setup;
|
||||
oggpack_buffer opb;
|
||||
int mode;
|
||||
|
||||
|
||||
oggpack_readinit(&opb,op->packet,op->bytes);
|
||||
|
||||
/* Check the packet type */
|
||||
|
@ -164,7 +164,7 @@ long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
|
|||
int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){
|
||||
/* set / clear half-sample-rate mode */
|
||||
codec_setup_info *ci=vi->codec_setup;
|
||||
|
||||
|
||||
/* right now, our MDCT can't handle < 64 sample windows. */
|
||||
if(ci->blocksizes[0]<=64 && flag)return -1;
|
||||
ci->halfrate_flag=(flag?1:0);
|
||||
|
@ -175,5 +175,3 @@ int vorbis_synthesis_halfrate_p(vorbis_info *vi){
|
|||
codec_setup_info *ci=vi->codec_setup;
|
||||
return ci->halfrate_flag;
|
||||
}
|
||||
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -11,7 +11,7 @@
|
|||
********************************************************************
|
||||
|
||||
function: window functions
|
||||
last mod: $Id$
|
||||
last mod: $Id: window.h 13293 2007-07-24 00:09:47Z xiphmont $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче