mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 14:54:25 +00:00
since upstream(i.e. xiph) doesn't update it since 2018. locally added NOMINMAX guard as well.
This commit is contained in:
@@ -3,5 +3,5 @@ git repository using the update.sh script. The only changes
|
||||
made were those applied by update.sh and the addition/update of
|
||||
Makefile.in files for the UXP build system.
|
||||
|
||||
The upstream release used was https://gitlab.xiph.org/xiph/tremor
|
||||
The git revision used was 7c30a66346199f3f09017a09567c6c8a3a0eedc8.
|
||||
The upstream release used was https://github.com/sezero/tremor
|
||||
The git revision used was 91decb5f1b11a84a2157a6326d9135b22627024b.
|
||||
|
||||
@@ -153,9 +153,6 @@ extern void vorbis_info_init(vorbis_info *vi);
|
||||
extern void vorbis_info_clear(vorbis_info *vi);
|
||||
extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
|
||||
extern void vorbis_comment_init(vorbis_comment *vc);
|
||||
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);
|
||||
extern void vorbis_comment_clear(vorbis_comment *vc);
|
||||
|
||||
+10
-21
@@ -22,10 +22,10 @@
|
||||
|
||||
#ifdef _LOW_ACCURACY_
|
||||
# define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
|
||||
# define LOOKUP_T const unsigned char
|
||||
# define LOOKUP_T unsigned char
|
||||
#else
|
||||
# define X(n) (n)
|
||||
# define LOOKUP_T const ogg_int32_t
|
||||
# define LOOKUP_T ogg_int32_t
|
||||
#endif
|
||||
|
||||
#include "asm_arm.h"
|
||||
@@ -37,29 +37,22 @@
|
||||
#ifndef _LOW_ACCURACY_
|
||||
/* 64 bit multiply */
|
||||
|
||||
#if !(defined WIN32 && defined WINCE)
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER==LITTLE_ENDIAN
|
||||
union magic {
|
||||
struct {
|
||||
ogg_int32_t lo;
|
||||
ogg_int32_t hi;
|
||||
} halves;
|
||||
ogg_int64_t whole;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER==BIG_ENDIAN
|
||||
union magic {
|
||||
struct {
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
ogg_int32_t hi;
|
||||
ogg_int32_t lo;
|
||||
} halves;
|
||||
ogg_int64_t whole;
|
||||
};
|
||||
#else /* little endian */
|
||||
ogg_int32_t lo;
|
||||
ogg_int32_t hi;
|
||||
#endif
|
||||
} halves;
|
||||
ogg_int64_t whole;
|
||||
};
|
||||
|
||||
STIN ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
|
||||
union magic magic;
|
||||
@@ -246,7 +239,3 @@ STIN ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap,
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,11 @@ SOURCES += [
|
||||
|
||||
FINAL_LIBRARY = 'gkmedias'
|
||||
|
||||
DEFINES['HAVE_ALLOCA'] = True
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
DEFINES['NOMINMAX'] = True
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'AIX':
|
||||
DEFINES['alloca'] = '__alloca'
|
||||
|
||||
|
||||
+40
-15
@@ -17,7 +17,10 @@
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <ogg/os_types.h>
|
||||
|
||||
#ifndef _V_IFDEFJAIL_H_
|
||||
@@ -25,34 +28,55 @@
|
||||
|
||||
# ifdef __GNUC__
|
||||
# define STIN static __inline__
|
||||
# elif _WIN32
|
||||
# elif defined(__VBCC__)
|
||||
# define STIN static inline
|
||||
# elif defined(_WIN32)
|
||||
# define STIN static __inline
|
||||
# elif defined(__WATCOMC__)
|
||||
# define STIN static __inline
|
||||
# else
|
||||
# define STIN static
|
||||
# endif
|
||||
#else
|
||||
# define STIN static
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI (3.1415926536f)
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <malloc.h>
|
||||
# define rint(x) (floor((x)+0.5f))
|
||||
# define NO_FLOAT_MATH_LIB
|
||||
# define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
|
||||
# define LITTLE_ENDIAN 1
|
||||
# define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
#if defined HAVE_ALLOCA
|
||||
|
||||
# ifdef _WIN32
|
||||
# include <malloc.h>
|
||||
# define VAR_STACK(type, var, size) type *var = ((type*)_alloca(sizeof(type)*(size)))
|
||||
# else
|
||||
# ifdef HAVE_ALLOCA_H
|
||||
# include <alloca.h>
|
||||
# else
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
# if defined(__AROS__) && defined(__GNUC__)
|
||||
/* bypass __alloca_get_stack_limit() call in alloca.h
|
||||
from old AROS SDKs, directly use __builtin_alloca(). */
|
||||
# undef alloca
|
||||
# define alloca __builtin_alloca
|
||||
# endif
|
||||
# define VAR_STACK(type, var, size) type *var = ((type*) alloca(sizeof(type)*(size)))
|
||||
# endif
|
||||
|
||||
#elif defined VAR_ARRAYS
|
||||
|
||||
# define VAR_STACK(type, var, size) type var[size]
|
||||
|
||||
#else
|
||||
|
||||
#error "Either VAR_ARRAYS or HAVE_ALLOCA must be defined to select the stack allocation mode"
|
||||
#endif
|
||||
|
||||
#ifdef USE_MEMORY_H
|
||||
# include <memory.h>
|
||||
#endif
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#ifndef min
|
||||
# define min(x,y) ((x)>(y)?(y):(x))
|
||||
#endif
|
||||
@@ -60,5 +84,6 @@
|
||||
#ifndef max
|
||||
# define max(x,y) ((x)<(y)?(y):(x))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* _OS_H */
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codebook.h"
|
||||
@@ -168,7 +167,7 @@ STIN long decode_packed_entry_number(codebook *book,
|
||||
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){
|
||||
@@ -245,9 +244,9 @@ long vorbis_book_decode(codebook *book, oggpack_buffer *b){
|
||||
long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a,
|
||||
oggpack_buffer *b,int n,int point){
|
||||
if(book->used_entries>0){
|
||||
int step=n/book->dim;
|
||||
long *entry = (long *)alloca(sizeof(*entry)*step);
|
||||
ogg_int32_t **t = (ogg_int32_t **)alloca(sizeof(*t)*step);
|
||||
const int step=n/book->dim;
|
||||
VAR_STACK(long, entry, step);
|
||||
VAR_STACK(ogg_int32_t *, t, step);
|
||||
int i,j,o;
|
||||
int shift=point-book->binarypoint;
|
||||
|
||||
@@ -336,7 +335,7 @@ long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a,
|
||||
}
|
||||
}else{
|
||||
|
||||
int i,j;
|
||||
int i;
|
||||
for(i=0;i<n;){
|
||||
a[i++]=0;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
@@ -145,7 +144,7 @@ void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
|
||||
int i;
|
||||
int ampoffseti=ampoffset*4096;
|
||||
int ampi=amp;
|
||||
ogg_int32_t *ilsp=(ogg_int32_t *)alloca(m*sizeof(*ilsp));
|
||||
VAR_STACK(ogg_int32_t, ilsp, m);
|
||||
/* lsp is in 8.24, range 0 to PI; coslook wants it in .16 0 to 1*/
|
||||
for(i=0;i<m;i++){
|
||||
#ifndef _LOW_ACCURACY_
|
||||
@@ -436,4 +435,3 @@ vorbis_func_floor floor0_exportbundle={
|
||||
&floor0_free_look,&floor0_inverse1,&floor0_inverse2
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "ivorbiscodec.h"
|
||||
@@ -37,6 +36,10 @@ static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){
|
||||
}
|
||||
}
|
||||
|
||||
STIN int _v_toupper(int c) {
|
||||
return (c >= 'a' && c <= 'z') ? (c & ~('a' - 'A')) : c;
|
||||
}
|
||||
|
||||
void vorbis_comment_init(vorbis_comment *vc){
|
||||
memset(vc,0,sizeof(*vc));
|
||||
}
|
||||
@@ -46,7 +49,7 @@ void vorbis_comment_init(vorbis_comment *vc){
|
||||
static int tagcompare(const char *s1, const char *s2, int n){
|
||||
int c=0;
|
||||
while(c < n){
|
||||
if(toupper(s1[c]) != toupper(s2[c]))
|
||||
if(_v_toupper(s1[c]) != _v_toupper(s2[c]))
|
||||
return !0;
|
||||
c++;
|
||||
}
|
||||
@@ -56,8 +59,8 @@ static int tagcompare(const char *s1, const char *s2, int n){
|
||||
char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
|
||||
long i;
|
||||
int found = 0;
|
||||
int taglen = strlen(tag)+1; /* +1 for the = we append */
|
||||
char *fulltag = (char *)alloca(taglen+ 1);
|
||||
const int taglen = strlen(tag)+1; /* +1 for the = we append */
|
||||
VAR_STACK(char, fulltag, taglen+1);
|
||||
|
||||
strcpy(fulltag, tag);
|
||||
strcat(fulltag, "=");
|
||||
@@ -76,8 +79,8 @@ char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
|
||||
|
||||
int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
|
||||
int i,count=0;
|
||||
int taglen = strlen(tag)+1; /* +1 for the = we append */
|
||||
char *fulltag = (char *)alloca(taglen+1);
|
||||
const int taglen = strlen(tag)+1; /* +1 for the = we append */
|
||||
VAR_STACK(char, fulltag, taglen+1);
|
||||
strcpy(fulltag,tag);
|
||||
strcat(fulltag, "=");
|
||||
|
||||
@@ -166,9 +169,9 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
|
||||
vi->channels=oggpack_read(opb,8);
|
||||
vi->rate=oggpack_read(opb,32);
|
||||
|
||||
vi->bitrate_upper=oggpack_read(opb,32);
|
||||
vi->bitrate_nominal=oggpack_read(opb,32);
|
||||
vi->bitrate_lower=oggpack_read(opb,32);
|
||||
vi->bitrate_upper=(ogg_int32_t)oggpack_read(opb,32);
|
||||
vi->bitrate_nominal=(ogg_int32_t)oggpack_read(opb,32);
|
||||
vi->bitrate_lower=(ogg_int32_t)oggpack_read(opb,32);
|
||||
|
||||
ci->blocksizes[0]=1<<oggpack_read(opb,4);
|
||||
ci->blocksizes[1]=1<<oggpack_read(opb,4);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "ivorbiscodec.h"
|
||||
#include "mdct.h"
|
||||
@@ -129,7 +128,6 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)
|
||||
int i,b;
|
||||
vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)_ogg_calloc(1,sizeof(*info));
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
memset(info,0,sizeof(*info));
|
||||
|
||||
b=oggpack_read(opb,1);
|
||||
if(b<0)goto err_out;
|
||||
@@ -194,11 +192,11 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
|
||||
int i,j;
|
||||
long n=vb->pcmend=ci->blocksizes[vb->W];
|
||||
|
||||
ogg_int32_t **pcmbundle=(ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels);
|
||||
int *zerobundle=(int *)alloca(sizeof(*zerobundle)*vi->channels);
|
||||
VAR_STACK(ogg_int32_t *, pcmbundle, vi->channels);
|
||||
VAR_STACK(int, zerobundle, vi->channels);
|
||||
|
||||
int *nonzero =(int *)alloca(sizeof(*nonzero)*vi->channels);
|
||||
void **floormemo=(void **)alloca(sizeof(*floormemo)*vi->channels);
|
||||
VAR_STACK(int, nonzero, vi->channels);
|
||||
VAR_STACK(void *, floormemo, vi->channels);
|
||||
|
||||
/* time domain information decode (note that applying the
|
||||
information would have to happen later; we'll probably add a
|
||||
|
||||
@@ -147,7 +147,7 @@ STIN void mdct_butterfly_32(DATA_TYPE *x){
|
||||
/* N/stage point generic N stage butterfly (in place, 2 register) */
|
||||
STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
|
||||
|
||||
LOOKUP_T *T = sincos_lookup0;
|
||||
const LOOKUP_T *T = sincos_lookup0;
|
||||
DATA_TYPE *x1 = x + points - 8;
|
||||
DATA_TYPE *x2 = x + (points>>1) - 8;
|
||||
REG_TYPE r0;
|
||||
@@ -257,8 +257,8 @@ STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
|
||||
int bit = 0;
|
||||
DATA_TYPE *w0 = x;
|
||||
DATA_TYPE *w1 = x = w0+(n>>1);
|
||||
LOOKUP_T *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
|
||||
LOOKUP_T *Ttop = T+1024;
|
||||
const LOOKUP_T *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
|
||||
const LOOKUP_T *Ttop = T+1024;
|
||||
DATA_TYPE r2;
|
||||
|
||||
do{
|
||||
@@ -342,8 +342,8 @@ void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
|
||||
int n4=n>>2;
|
||||
DATA_TYPE *iX;
|
||||
DATA_TYPE *oX;
|
||||
LOOKUP_T *T;
|
||||
LOOKUP_T *V;
|
||||
const LOOKUP_T *T;
|
||||
const LOOKUP_T *V;
|
||||
int shift;
|
||||
int step;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
@@ -226,7 +225,7 @@ static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||
if(n>0){
|
||||
int partvals=n/samples_per_partition;
|
||||
int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
|
||||
int ***partword=(int ***)alloca(ch*sizeof(*partword));
|
||||
VAR_STACK(int **, partword, ch);
|
||||
|
||||
for(j=0;j<ch;j++)
|
||||
partword[j]=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "misc.h"
|
||||
@@ -330,7 +329,7 @@ static int sort32a(const void *a,const void *b){
|
||||
/* decode codebook arrangement is more heavily optimized than encode */
|
||||
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 */
|
||||
@@ -355,7 +354,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||
|
||||
/* perform sort */
|
||||
ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
|
||||
ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
|
||||
VAR_STACK(ogg_uint32_t *, codep, n);
|
||||
|
||||
if(codes==NULL)goto err_out;
|
||||
|
||||
@@ -366,7 +365,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||
|
||||
qsort(codep,n,sizeof(*codep),sort32a);
|
||||
|
||||
sortindex=(int *)alloca(n*sizeof(*sortindex));
|
||||
{ VAR_STACK(int, sortindex, n);
|
||||
c->codelist=(ogg_uint32_t *)_ogg_malloc(n*sizeof(*c->codelist));
|
||||
/* the index is a reverse index */
|
||||
for(i=0;i<n;i++){
|
||||
@@ -391,7 +390,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||
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;
|
||||
@@ -444,4 +443,3 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||
vorbis_book_clear(c);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "misc.h"
|
||||
#include "window.h"
|
||||
#include "window_lookup.h"
|
||||
@@ -56,7 +55,7 @@ void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
|
||||
long *blocksizes,
|
||||
int lW,int W,int nW){
|
||||
|
||||
LOOKUP_T *window[2]={window_p[0],window_p[1]};
|
||||
const LOOKUP_T *window[2];
|
||||
long n=blocksizes[W];
|
||||
long ln=blocksizes[lW];
|
||||
long rn=blocksizes[nW];
|
||||
@@ -69,6 +68,9 @@ void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
|
||||
|
||||
int i,p;
|
||||
|
||||
window[0] = (const LOOKUP_T *)window_p[0];
|
||||
window[1] = (const LOOKUP_T *)window_p[1];
|
||||
|
||||
for(i=0;i<leftbegin;i++)
|
||||
d[i]=0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user