Commit cbf28777 authored by Monty's avatar Monty
Browse files

Remove trailing whitespace


svn path=/trunk/vorbis/; revision=16227
parent 321cfc8e
......@@ -5,12 +5,12 @@
* 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$
......@@ -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;
......@@ -113,8 +113,8 @@ typedef struct vorbis_info_residue0{
int secondstages[64]; /* expanded out to pointers in lookup */
int booklist[256]; /* 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
......@@ -5,7 +5,7 @@
* 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/ *
* *
********************************************************************
......@@ -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,7 +5,7 @@
* 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/ *
* *
********************************************************************
......@@ -15,7 +15,7 @@
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
......@@ -104,7 +104,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);
......@@ -185,7 +185,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));
......@@ -275,7 +275,7 @@ 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;
}
......@@ -309,7 +309,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);
......@@ -354,7 +354,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++)
......@@ -370,7 +370,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
if(b->header2)_ogg_free(b->header2);
_ogg_free(b);
}
memset(v,0,sizeof(*v));
}
}
......@@ -387,10 +387,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]));
}
......@@ -398,7 +398,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);
}
......@@ -415,7 +415,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);
......@@ -428,8 +428,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,
......@@ -465,7 +465,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;
......@@ -532,7 +532,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){
......@@ -564,7 +564,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 */
......@@ -592,12 +592,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 */
......@@ -605,7 +605,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++){
......@@ -613,14 +613,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 */
......@@ -642,16 +642,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;
......@@ -680,11 +680,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;
......@@ -711,16 +711,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 */
......@@ -728,8 +728,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);
......@@ -737,12 +737,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;
......@@ -750,11 +750,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){
......@@ -792,7 +792,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;
......@@ -801,16 +801,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;
......@@ -820,14 +820,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
......@@ -839,7 +839,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 */
......@@ -855,7 +855,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 */
......@@ -870,7 +870,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;
......@@ -885,12 +885,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 */
......@@ -923,8 +923,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);
......@@ -958,7 +958,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 */
......@@ -983,7 +983,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++)
......@@ -998,10 +998,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,7 +5,7 @@
* 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/ *
* *
********************************************************************
......@@ -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: