Commit 9000e934 authored by Segher Boessenkool's avatar Segher Boessenkool
Browse files

fix nasty warnings, and some non-ansi constructs. increase portability.

svn path=/trunk/vorbis/; revision=2881
parent 51b21ae5
......@@ -11,7 +11,7 @@
********************************************************************
function: PCM data vector blocking, windowing and dis/reassembly
last mod: $Id: block.c,v 1.53 2001/12/20 01:00:26 segher Exp $
last mod: $Id: block.c,v 1.54 2001/12/21 14:52:35 segher Exp $
Handle windowing, overlap-add, etc of the PCM vectors. This is made
more amusing by Vorbis' current two allowed block sizes.
......@@ -712,7 +712,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
/* overlap/add PCM */
switch(v->W){
switch((int)v->W){
case 0:
beginSl=0;
endSl=ci->blocksizes[0]/2;
......
......@@ -11,7 +11,7 @@
********************************************************************
function: basic codebook pack/unpack/code/decode operations
last mod: $Id: codebook.c,v 1.34 2001/12/20 01:00:26 segher Exp $
last mod: $Id: codebook.c,v 1.35 2001/12/21 14:52:35 segher Exp $
********************************************************************/
......@@ -160,7 +160,7 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
if(s->entries==-1)goto _eofout;
/* codeword ordering.... length ordered or unordered? */
switch(oggpack_read(opb,1)){
switch((int)oggpack_read(opb,1)){
case 0:
/* unordered */
s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
......@@ -327,7 +327,7 @@ long vorbis_book_decode(codebook *book, oggpack_buffer *b){
}
do{
switch(oggpack_read1(b)){
switch((int)oggpack_read1(b)){
case 0:
ptr=t->ptr0[ptr];
break;
......@@ -377,7 +377,7 @@ long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
if(entry==-1)return(-1);
t = book->valuelist+entry*book->dim;
j=0;
switch(book->dim){
switch((int)book->dim){
case 8:
a[i++]+=t[j++];
case 7:
......
......@@ -11,7 +11,7 @@
********************************************************************
function: floor backend 0 implementation
last mod: $Id: floor0.c,v 1.48 2001/12/20 01:00:26 segher Exp $
last mod: $Id: floor0.c,v 1.49 2001/12/21 14:52:35 segher Exp $
********************************************************************/
......@@ -392,7 +392,7 @@ static int floor0_forward(vorbis_block *vb,vorbis_look_floor *in,
for(j=0;j<look->n;j++)
codedflr[j]=1.f;
vorbis_lsp_to_curve(codedflr,look->linearmap,look->n,look->ln,
lspwork,look->m,amp,info->ampdB);
lspwork,look->m,amp,(float)info->ampdB);
_analysis_output("barklsp",seq-1,codedflr,look->n,1,1);
_analysis_output("lsp3",seq-1,codedflr,look->n,0,1);
......@@ -452,7 +452,7 @@ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
/* take the coefficients back to a spectral envelope curve */
vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
lsp,look->m,amp,info->ampdB);
lsp,look->m,amp,(float)info->ampdB);
return(1);
}
memset(out,0,sizeof(*out)*look->n);
......
......@@ -12,7 +12,7 @@
function: normalized modified discrete cosine transform
power of two length transform only [64 <= n ]
last mod: $Id: mdct.c,v 1.27 2001/12/20 01:00:29 segher Exp $
last mod: $Id: mdct.c,v 1.28 2001/12/21 14:52:35 segher Exp $
Original algorithm adapted long ago from _The use of multirate filter
banks for coding of high quality digital audio_, by T. Sporer,
......@@ -54,7 +54,7 @@ void mdct_init(mdct_lookup *lookup,int n){
int i;
int n2=n>>1;
int log2n=lookup->log2n=rint(log(n)/log(2));
int log2n=lookup->log2n=rint(log((float)n)/log(2.f));
lookup->n=n;
lookup->trig=T;
lookup->bitrev=bitrev;
......
......@@ -11,7 +11,7 @@
********************************************************************
function: psychoacoustics not including preecho
last mod: $Id: psy.c,v 1.61 2001/12/19 18:06:17 segher Exp $
last mod: $Id: psy.c,v 1.62 2001/12/21 14:52:35 segher Exp $
********************************************************************/
......@@ -80,7 +80,7 @@ static void set_curve(float *ref,float *c,int n, float crate){
int i,j=0;
for(i=0;i<MAX_BARK-1;i++){
int endpos=rint(fromBARK(i+1)*2*n/crate);
int endpos=rint(fromBARK((float)(i+1))*2*n/crate);
float base=ref[i];
if(j<endpos){
float delta=(ref[i+1]-base)/(endpos-j);
......@@ -211,7 +211,7 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
p->eighth_octave_lines=gi->eighth_octave_lines;
p->shiftoc=rint(log(gi->eighth_octave_lines*8)/log(2))-1;
p->shiftoc=rint(log(gi->eighth_octave_lines*8.f)/log(2.f))-1;
p->firstoc=toOC(.25f*rate/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines;
maxoc=toOC((n*.5f-.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f;
......@@ -227,7 +227,7 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
/* set up the lookups for a given blocksize and sample rate */
if(vi->ath)
set_curve(vi->ath, p->ath,n,rate);
set_curve(vi->ath, p->ath,n,(float)rate);
for(i=0;i<n;i++){
float bark=toBARK(rate/(2*n)*i);
......
......@@ -11,7 +11,7 @@
********************************************************************
function: residue backend 0, 1 and 2 implementation
last mod: $Id: res0.c,v 1.42 2001/12/20 01:00:29 segher Exp $
last mod: $Id: res0.c,v 1.43 2001/12/21 14:52:36 segher Exp $
********************************************************************/
......@@ -272,7 +272,7 @@ vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
}
}
look->partvals=rint(pow(look->parts,dim));
look->partvals=rint(pow((float)look->parts,(pow)dim));
look->stages=maxstage;
look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap));
for(j=0;j<look->partvals;j++){
......
......@@ -11,7 +11,7 @@
********************************************************************
function: basic shared codebook operations
last mod: $Id: sharedbook.c,v 1.21 2001/12/20 01:00:30 segher Exp $
last mod: $Id: sharedbook.c,v 1.22 2001/12/21 14:52:36 segher Exp $
********************************************************************/
......@@ -51,7 +51,7 @@ long _float32_pack(float val){
sign=0x80000000;
val= -val;
}
exp= floor(log(val)/log(2));
exp= floor(log(val)/log(2.f));
mant=rint(ldexp(val,(VQ_FMAN-1)-exp));
exp=(exp+VQ_FEXP_BIAS)<<VQ_FMAN;
......@@ -197,7 +197,7 @@ decode_aux *_make_decode_tree(codebook *c){
that's portable and totally safe against roundoff, but I haven't
thought of it. Therefore, we opt on the side of caution */
long _book_maptype1_quantvals(const static_codebook *b){
long vals=floor(pow(b->entries,1.f/b->dim));
long vals=floor(pow((float)b->entries,1.f/b->dim));
/* the above *should* be reliable, but we'll not assume that FP is
ever reliable when bitstream sync is at stake; verify via integer
......
......@@ -11,7 +11,7 @@
********************************************************************
function: simple programmatic interface for encoder mode setup
last mod: $Id: vorbisenc.c,v 1.29 2001/12/21 08:44:07 xiphmont Exp $
last mod: $Id: vorbisenc.c,v 1.30 2001/12/21 14:52:36 segher Exp $
********************************************************************/
......@@ -915,7 +915,7 @@ int vorbis_encode_setup_managed(vorbis_info *vi,
long min_bitrate){
double approx_vbr=approx_bitrate_to_vbr(channels,(channels==2),
nominal_bitrate,rate);
(float)nominal_bitrate,rate);
int ret=0;
if(approx_vbr<0)return(OV_EIMPL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment