mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2025-01-23 16:41:11 +01:00
arm-vita-eabi-gcc complains about int / ogg_int32_t
This commit is contained in:
parent
f9e74075ad
commit
0db5c0da94
@ -34,7 +34,7 @@ int _ilog(unsigned int v){
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 32 bit float (not IEEE; nonnormalized mantissa +
|
/* 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. */
|
Why not IEEE? It's just not that important here. */
|
||||||
|
|
||||||
#define VQ_FEXP 10
|
#define VQ_FEXP 10
|
||||||
@ -77,12 +77,12 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
|||||||
long length=l[i];
|
long length=l[i];
|
||||||
if(length>0){
|
if(length>0){
|
||||||
ogg_uint32_t entry=marker[length];
|
ogg_uint32_t entry=marker[length];
|
||||||
|
|
||||||
/* when we claim a node for an entry, we also claim the nodes
|
/* when we claim a node for an entry, we also claim the nodes
|
||||||
below it (pruning off the imagined tree that may have dangled
|
below it (pruning off the imagined tree that may have dangled
|
||||||
from it) as well as blocking the use of any nodes directly
|
from it) as well as blocking the use of any nodes directly
|
||||||
above for leaves */
|
above for leaves */
|
||||||
|
|
||||||
/* update ourself */
|
/* update ourself */
|
||||||
if(length<32 && (entry>>length)){
|
if(length<32 && (entry>>length)){
|
||||||
/* error condition; the lengths must specify an overpopulated tree */
|
/* error condition; the lengths must specify an overpopulated tree */
|
||||||
@ -90,12 +90,12 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
r[count++]=entry;
|
r[count++]=entry;
|
||||||
|
|
||||||
/* Look to see if the next shorter marker points to the node
|
/* Look to see if the next shorter marker points to the node
|
||||||
above. if so, update it and repeat. */
|
above. if so, update it and repeat. */
|
||||||
{
|
{
|
||||||
for(j=length;j>0;j--){
|
for(j=length;j>0;j--){
|
||||||
|
|
||||||
if(marker[j]&1){
|
if(marker[j]&1){
|
||||||
/* have to jump branches */
|
/* have to jump branches */
|
||||||
if(j==1)
|
if(j==1)
|
||||||
@ -108,7 +108,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
|||||||
marker[j]++;
|
marker[j]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prune the tree; the implicit invariant says all the longer
|
/* prune the tree; the implicit invariant says all the longer
|
||||||
markers were dangling from our just-taken node. Dangle them
|
markers were dangling from our just-taken node. Dangle them
|
||||||
from our *new* node. */
|
from our *new* node. */
|
||||||
@ -121,7 +121,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
|||||||
}else
|
}else
|
||||||
if(sparsecount==0)count++;
|
if(sparsecount==0)count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bitreverse the words because our bitwise packer/unpacker is LSb
|
/* bitreverse the words because our bitwise packer/unpacker is LSb
|
||||||
endian */
|
endian */
|
||||||
for(i=0,count=0;i<n;i++){
|
for(i=0,count=0;i<n;i++){
|
||||||
@ -210,18 +210,18 @@ ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
|
|||||||
int indexdiv=1;
|
int indexdiv=1;
|
||||||
for(k=0;k<b->dim;k++){
|
for(k=0;k<b->dim;k++){
|
||||||
int index= (j/indexdiv)%quantvals;
|
int index= (j/indexdiv)%quantvals;
|
||||||
int point=0;
|
ogg_int32_t point=0;
|
||||||
int val=VFLOAT_MULTI(delta,delpoint,
|
int val=VFLOAT_MULTI(delta,delpoint,
|
||||||
abs(b->quantlist[index]),&point);
|
abs(b->quantlist[index]),&point);
|
||||||
|
|
||||||
val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
|
val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
|
||||||
val=VFLOAT_ADD(last,lastpoint,val,point,&point);
|
val=VFLOAT_ADD(last,lastpoint,val,point,&point);
|
||||||
|
|
||||||
if(b->q_sequencep){
|
if(b->q_sequencep){
|
||||||
last=val;
|
last=val;
|
||||||
lastpoint=point;
|
lastpoint=point;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sparsemap){
|
if(sparsemap){
|
||||||
r[sparsemap[count]*b->dim+k]=val;
|
r[sparsemap[count]*b->dim+k]=val;
|
||||||
rp[sparsemap[count]*b->dim+k]=point;
|
rp[sparsemap[count]*b->dim+k]=point;
|
||||||
@ -244,15 +244,15 @@ ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
|
|||||||
int lastpoint=0;
|
int lastpoint=0;
|
||||||
|
|
||||||
for(k=0;k<b->dim;k++){
|
for(k=0;k<b->dim;k++){
|
||||||
int point=0;
|
ogg_int32_t point=0;
|
||||||
int val=VFLOAT_MULTI(delta,delpoint,
|
int val=VFLOAT_MULTI(delta,delpoint,
|
||||||
abs(b->quantlist[j*b->dim+k]),&point);
|
abs(b->quantlist[j*b->dim+k]),&point);
|
||||||
|
|
||||||
val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
|
val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
|
||||||
val=VFLOAT_ADD(last,lastpoint,val,point,&point);
|
val=VFLOAT_ADD(last,lastpoint,val,point,&point);
|
||||||
|
|
||||||
if(b->q_sequencep){
|
if(b->q_sequencep){
|
||||||
last=val;
|
last=val;
|
||||||
lastpoint=point;
|
lastpoint=point;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
|
|||||||
for(j=0;j<n*b->dim;j++)
|
for(j=0;j<n*b->dim;j++)
|
||||||
if(rp[j]<*maxpoint)
|
if(rp[j]<*maxpoint)
|
||||||
r[j]>>=*maxpoint-rp[j];
|
r[j]>>=*maxpoint-rp[j];
|
||||||
|
|
||||||
_ogg_free(rp);
|
_ogg_free(rp);
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
@ -324,7 +324,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||||||
int i,j,n=0,tabn;
|
int i,j,n=0,tabn;
|
||||||
int *sortindex;
|
int *sortindex;
|
||||||
memset(c,0,sizeof(*c));
|
memset(c,0,sizeof(*c));
|
||||||
|
|
||||||
/* count actually used entries */
|
/* count actually used entries */
|
||||||
for(i=0;i<s->entries;i++)
|
for(i=0;i<s->entries;i++)
|
||||||
if(s->lengthlist[i]>0)
|
if(s->lengthlist[i]>0)
|
||||||
@ -335,20 +335,20 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||||||
c->dim=s->dim;
|
c->dim=s->dim;
|
||||||
|
|
||||||
if(n>0){
|
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
|
First, we collapse the likely sparse codebook down only to
|
||||||
actually represented values/words. This collapsing needs to be
|
actually represented values/words. This collapsing needs to be
|
||||||
indexed as map-valueless books are used to encode original entry
|
indexed as map-valueless books are used to encode original entry
|
||||||
positions as integers.
|
positions as integers.
|
||||||
|
|
||||||
Second, we reorder all vectors, including the entry index above,
|
Second, we reorder all vectors, including the entry index above,
|
||||||
by sorted bitreversed codeword to allow treeless decode. */
|
by sorted bitreversed codeword to allow treeless decode. */
|
||||||
|
|
||||||
/* perform sort */
|
/* perform sort */
|
||||||
ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
|
ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
|
||||||
ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
|
ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
|
||||||
|
|
||||||
if(codes==NULL)goto err_out;
|
if(codes==NULL)goto err_out;
|
||||||
|
|
||||||
for(i=0;i<n;i++){
|
for(i=0;i<n;i++){
|
||||||
@ -369,29 +369,29 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||||||
for(i=0;i<n;i++)
|
for(i=0;i<n;i++)
|
||||||
c->codelist[sortindex[i]]=codes[i];
|
c->codelist[sortindex[i]]=codes[i];
|
||||||
_ogg_free(codes);
|
_ogg_free(codes);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
|
c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
|
||||||
c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
|
c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
|
||||||
|
|
||||||
for(n=0,i=0;i<s->entries;i++)
|
for(n=0,i=0;i<s->entries;i++)
|
||||||
if(s->lengthlist[i]>0)
|
if(s->lengthlist[i]>0)
|
||||||
c->dec_index[sortindex[n++]]=i;
|
c->dec_index[sortindex[n++]]=i;
|
||||||
|
|
||||||
c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
|
c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
|
||||||
for(n=0,i=0;i<s->entries;i++)
|
for(n=0,i=0;i<s->entries;i++)
|
||||||
if(s->lengthlist[i]>0)
|
if(s->lengthlist[i]>0)
|
||||||
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
|
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
|
||||||
|
|
||||||
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
|
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
|
||||||
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
|
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
|
||||||
if(c->dec_firsttablen>8)c->dec_firsttablen=8;
|
if(c->dec_firsttablen>8)c->dec_firsttablen=8;
|
||||||
|
|
||||||
tabn=1<<c->dec_firsttablen;
|
tabn=1<<c->dec_firsttablen;
|
||||||
c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
|
c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
|
||||||
c->dec_maxlength=0;
|
c->dec_maxlength=0;
|
||||||
|
|
||||||
for(i=0;i<n;i++){
|
for(i=0;i<n;i++){
|
||||||
if(c->dec_maxlength<c->dec_codelengths[i])
|
if(c->dec_maxlength<c->dec_codelengths[i])
|
||||||
c->dec_maxlength=c->dec_codelengths[i];
|
c->dec_maxlength=c->dec_codelengths[i];
|
||||||
@ -401,26 +401,26 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||||||
c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
|
c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now fill in 'unused' entries in the firsttable with hi/lo search
|
/* now fill in 'unused' entries in the firsttable with hi/lo search
|
||||||
hints for the non-direct-hits */
|
hints for the non-direct-hits */
|
||||||
{
|
{
|
||||||
ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
|
ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
|
||||||
long lo=0,hi=0;
|
long lo=0,hi=0;
|
||||||
|
|
||||||
for(i=0;i<tabn;i++){
|
for(i=0;i<tabn;i++){
|
||||||
ogg_uint32_t word=i<<(32-c->dec_firsttablen);
|
ogg_uint32_t word=i<<(32-c->dec_firsttablen);
|
||||||
if(c->dec_firsttable[bitreverse(word)]==0){
|
if(c->dec_firsttable[bitreverse(word)]==0){
|
||||||
while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
|
while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
|
||||||
while( hi<n && word>=(c->codelist[hi]&mask))hi++;
|
while( hi<n && word>=(c->codelist[hi]&mask))hi++;
|
||||||
|
|
||||||
/* we only actually have 15 bits per hint to play with here.
|
/* we only actually have 15 bits per hint to play with here.
|
||||||
In order to overflow gracefully (nothing breaks, efficiency
|
In order to overflow gracefully (nothing breaks, efficiency
|
||||||
just drops), encode as the difference from the extremes. */
|
just drops), encode as the difference from the extremes. */
|
||||||
{
|
{
|
||||||
unsigned long loval=lo;
|
unsigned long loval=lo;
|
||||||
unsigned long hival=n-hi;
|
unsigned long hival=n-hi;
|
||||||
|
|
||||||
if(loval>0x7fff)loval=0x7fff;
|
if(loval>0x7fff)loval=0x7fff;
|
||||||
if(hival>0x7fff)hival=0x7fff;
|
if(hival>0x7fff)hival=0x7fff;
|
||||||
c->dec_firsttable[bitreverse(word)]=
|
c->dec_firsttable[bitreverse(word)]=
|
||||||
@ -436,4 +436,3 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
|||||||
vorbis_book_clear(c);
|
vorbis_book_clear(c);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user