From 43c7e123b42bc229e596a0860ed3a4d6ae67c9d2 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Mon, 22 Apr 2013 08:01:42 -0300 Subject: [PATCH 6/8] tremor: floor/mapping/residue function renaming Prefix _floor_P/_mapping_P/_residue_P and related functions with ivorbis_ to make sure it doesn't clash with libvorbis' symbols. This is particularly harmful for iOS applications that link to both libvorbis and tremor as an iOS app puts all symbols together in the same binary. --- block.c | 4 ++-- floor0.c | 20 ++++++++++---------- floor1.c | 22 +++++++++++----------- info.c | 12 ++++++------ mapping0.c | 28 ++++++++++++++-------------- registry.c | 32 ++++++++++++++++---------------- registry.h | 6 +++--- res012.c | 52 ++++++++++++++++++++++++++-------------------------- synthesis.c | 2 +- 9 files changed, 89 insertions(+), 89 deletions(-) diff --git a/block.c b/block.c index 666bc51..098ce23 100644 --- a/block.c +++ b/block.c @@ -190,7 +190,7 @@ static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){ for(i=0;imodes;i++){ int mapnum=ci->mode_param[i]->mapping; int maptype=ci->map_type[mapnum]; - b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i], + b->mode[i]=_ivorbis_mapping_P[maptype]->look(v,ci->mode_param[i], ci->map_param[mapnum]); } return 0; @@ -251,7 +251,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){ for(i=0;imodes;i++){ int mapnum=ci->mode_param[i]->mapping; int maptype=ci->map_type[mapnum]; - if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]); + if(b && b->mode)_ivorbis_mapping_P[maptype]->free_look(b->mode[i]); } } diff --git a/floor0.c b/floor0.c index 964383e..2430685 100644 --- a/floor0.c +++ b/floor0.c @@ -288,7 +288,7 @@ void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln, /*************** vorbis decode glue ************/ -static void floor0_free_info(vorbis_info_floor *i){ +static void ivorbis_floor0_free_info(vorbis_info_floor *i){ vorbis_info_floor0 *info=(vorbis_info_floor0 *)i; if(info){ memset(info,0,sizeof(*info)); @@ -296,7 +296,7 @@ static void floor0_free_info(vorbis_info_floor *i){ } } -static void floor0_free_look(vorbis_look_floor *i){ +static void ivorbis_floor0_free_look(vorbis_look_floor *i){ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; if(look){ @@ -307,7 +307,7 @@ static void floor0_free_look(vorbis_look_floor *i){ } } -static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){ +static vorbis_info_floor *ivorbis_floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){ codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; int j; @@ -333,7 +333,7 @@ static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){ return(info); err_out: - floor0_free_info(info); + ivorbis_floor0_free_info(info); return(NULL); } @@ -345,7 +345,7 @@ static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){ Note that the scale depends on the sampling rate as well as the linear block and mapping sizes */ -static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi, +static vorbis_look_floor *ivorbis_floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi, vorbis_info_floor *i){ int j; vorbis_info *vi=vd->vi; @@ -381,7 +381,7 @@ static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi return look; } -static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ +static void *ivorbis_floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; vorbis_info_floor0 *info=look->vi; int j,k; @@ -412,7 +412,7 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){ return(NULL); } -static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, +static int ivorbis_floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, void *memo,ogg_int32_t *out){ vorbis_look_floor0 *look=(vorbis_look_floor0 *)i; vorbis_info_floor0 *info=look->vi; @@ -431,9 +431,9 @@ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i, } /* export hooks */ -vorbis_func_floor floor0_exportbundle={ - &floor0_unpack,&floor0_look,&floor0_free_info, - &floor0_free_look,&floor0_inverse1,&floor0_inverse2 +vorbis_func_floor ivorbis_floor0_exportbundle={ + &ivorbis_floor0_unpack,&ivorbis_floor0_look,&ivorbis_floor0_free_info, + &ivorbis_floor0_free_look,&ivorbis_floor0_inverse1,&ivorbis_floor0_inverse2 }; diff --git a/floor1.c b/floor1.c index e63ae9f..e46fd35 100644 --- a/floor1.c +++ b/floor1.c @@ -26,7 +26,7 @@ #include "misc.h" #include "block.h" -#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */ +#define ivorbis_floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */ typedef struct { int forward_index[VIF_POSIT+2]; @@ -43,7 +43,7 @@ typedef struct { /***********************************************/ -static void floor1_free_info(vorbis_info_floor *i){ +static void ivorbis_floor1_free_info(vorbis_info_floor *i){ vorbis_info_floor1 *info=(vorbis_info_floor1 *)i; if(info){ memset(info,0,sizeof(*info)); @@ -51,7 +51,7 @@ static void floor1_free_info(vorbis_info_floor *i){ } } -static void floor1_free_look(vorbis_look_floor *i){ +static void ivorbis_floor1_free_look(vorbis_look_floor *i){ vorbis_look_floor1 *look=(vorbis_look_floor1 *)i; if(look){ memset(look,0,sizeof(*look)); @@ -72,7 +72,7 @@ static int icomp(const void *a,const void *b){ return(**(int **)a-**(int **)b); } -static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){ +static vorbis_info_floor *ivorbis_floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){ codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; int j,k,count=0,maxclass=-1,rangebits; @@ -132,11 +132,11 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){ return(info); err_out: - floor1_free_info(info); + ivorbis_floor1_free_info(info); return(NULL); } -static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi, +static vorbis_look_floor *ivorbis_floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi, vorbis_info_floor *in){ int *sortpointer[VIF_POSIT+2]; @@ -324,7 +324,7 @@ static void render_line(int n, int x0,int x1,int y0,int y1,ogg_int32_t *d){ } } -static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){ +static void *ivorbis_floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){ vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; vorbis_info_floor1 *info=look->vi; codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup; @@ -411,7 +411,7 @@ static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){ return(NULL); } -static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo, +static int ivorbis_floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo, ogg_int32_t *out){ vorbis_look_floor1 *look=(vorbis_look_floor1 *)in; vorbis_info_floor1 *info=look->vi; @@ -453,8 +453,8 @@ static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo, } /* export hooks */ -vorbis_func_floor floor1_exportbundle={ - &floor1_unpack,&floor1_look,&floor1_free_info, - &floor1_free_look,&floor1_inverse1,&floor1_inverse2 +vorbis_func_floor ivorbis_floor1_exportbundle={ + &ivorbis_floor1_unpack,&ivorbis_floor1_look,&ivorbis_floor1_free_info, + &ivorbis_floor1_free_look,&ivorbis_floor1_inverse1,&ivorbis_floor1_inverse2 }; diff --git a/info.c b/info.c index 3f3308e..5c6a8b5 100644 --- a/info.c +++ b/info.c @@ -127,15 +127,15 @@ void vorbis_info_clear(vorbis_info *vi){ for(i=0;imaps;i++) /* unpack does the range checking */ if(ci->map_param[i]) - _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); + _ivorbis_mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]); for(i=0;ifloors;i++) /* unpack does the range checking */ if(ci->floor_param[i]) - _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); + _ivorbis_floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]); for(i=0;iresidues;i++) /* unpack does the range checking */ if(ci->residue_param[i]) - _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); + _ivorbis_residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]); for(i=0;ibooks;i++){ if(ci->book_param[i]){ @@ -254,7 +254,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ for(i=0;ifloors;i++){ ci->floor_type[i]=oggpack_read(opb,16); if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out; - ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb); + ci->floor_param[i]=_ivorbis_floor_P[ci->floor_type[i]]->unpack(vi,opb); if(!ci->floor_param[i])goto err_out; } @@ -264,7 +264,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ for(i=0;iresidues;i++){ ci->residue_type[i]=oggpack_read(opb,16); if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out; - ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb); + ci->residue_param[i]=_ivorbis_residue_P[ci->residue_type[i]]->unpack(vi,opb); if(!ci->residue_param[i])goto err_out; } @@ -274,7 +274,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){ for(i=0;imaps;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); + ci->map_param[i]=_ivorbis_mapping_P[ci->map_type[i]]->unpack(vi,opb); if(!ci->map_param[i])goto err_out; } diff --git a/mapping0.c b/mapping0.c index aa03e85..56a13a9 100644 --- a/mapping0.c +++ b/mapping0.c @@ -53,7 +53,7 @@ typedef struct { invalidate decay */ } vorbis_look_mapping0; -static void mapping0_free_info(vorbis_info_mapping *i){ +static void ivorbis_mapping0_free_info(vorbis_info_mapping *i){ vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i; if(info){ memset(info,0,sizeof(*info)); @@ -61,7 +61,7 @@ static void mapping0_free_info(vorbis_info_mapping *i){ } } -static void mapping0_free_look(vorbis_look_mapping *look){ +static void ivorbis_mapping0_free_look(vorbis_look_mapping *look){ int i; vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look; if(l){ @@ -80,7 +80,7 @@ static void mapping0_free_look(vorbis_look_mapping *look){ } } -static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm, +static vorbis_look_mapping *ivorbis_mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm, vorbis_info_mapping *m){ int i; vorbis_info *vi=vd->vi; @@ -100,10 +100,10 @@ static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode int floornum=info->floorsubmap[i]; int resnum=info->residuesubmap[i]; - look->floor_func[i]=_floor_P[ci->floor_type[floornum]]; + look->floor_func[i]=_ivorbis_floor_P[ci->floor_type[floornum]]; look->floor_look[i]=look->floor_func[i]-> look(vd,vm,ci->floor_param[floornum]); - look->residue_func[i]=_residue_P[ci->residue_type[resnum]]; + look->residue_func[i]=_ivorbis_residue_P[ci->residue_type[resnum]]; look->residue_look[i]=look->residue_func[i]-> look(vd,vm,ci->residue_param[resnum]); @@ -125,7 +125,7 @@ static int ilog(unsigned int v){ } /* also responsible for range checking */ -static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){ +static vorbis_info_mapping *ivorbis_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; @@ -178,12 +178,12 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb) return info; err_out: - mapping0_free_info(info); + ivorbis_mapping0_free_info(info); return(NULL); } static int seq=0; -static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ +static int ivorbis_mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ vorbis_dsp_state *vd=vb->vd; vorbis_info *vi=vd->vi; codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; @@ -319,10 +319,10 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){ } /* export hooks */ -vorbis_func_mapping mapping0_exportbundle={ - &mapping0_unpack, - &mapping0_look, - &mapping0_free_info, - &mapping0_free_look, - &mapping0_inverse +vorbis_func_mapping ivorbis_mapping0_exportbundle={ + &ivorbis_mapping0_unpack, + &ivorbis_mapping0_look, + &ivorbis_mapping0_free_info, + &ivorbis_mapping0_free_look, + &ivorbis_mapping0_inverse }; diff --git a/registry.c b/registry.c index c0b5fec..f02ce0b 100644 --- a/registry.c +++ b/registry.c @@ -24,26 +24,26 @@ /* seems like major overkill now; the backend numbers will grow into the infrastructure soon enough */ -extern vorbis_func_floor floor0_exportbundle; -extern vorbis_func_floor floor1_exportbundle; -extern vorbis_func_residue residue0_exportbundle; -extern vorbis_func_residue residue1_exportbundle; -extern vorbis_func_residue residue2_exportbundle; -extern vorbis_func_mapping mapping0_exportbundle; - -vorbis_func_floor *_floor_P[]={ - &floor0_exportbundle, - &floor1_exportbundle, +extern vorbis_func_floor ivorbis_floor0_exportbundle; +extern vorbis_func_floor ivorbis_floor1_exportbundle; +extern vorbis_func_residue ivorbis_residue0_exportbundle; +extern vorbis_func_residue ivorbis_residue1_exportbundle; +extern vorbis_func_residue ivorbis_residue2_exportbundle; +extern vorbis_func_mapping ivorbis_mapping0_exportbundle; + +vorbis_func_floor *_ivorbis_floor_P[]={ + &ivorbis_floor0_exportbundle, + &ivorbis_floor1_exportbundle, }; -vorbis_func_residue *_residue_P[]={ - &residue0_exportbundle, - &residue1_exportbundle, - &residue2_exportbundle, +vorbis_func_residue *_ivorbis_residue_P[]={ + &ivorbis_residue0_exportbundle, + &ivorbis_residue1_exportbundle, + &ivorbis_residue2_exportbundle, }; -vorbis_func_mapping *_mapping_P[]={ - &mapping0_exportbundle, +vorbis_func_mapping *_ivorbis_mapping_P[]={ + &ivorbis_mapping0_exportbundle, }; diff --git a/registry.h b/registry.h index 2bc8068..0210326 100644 --- a/registry.h +++ b/registry.h @@ -33,8 +33,8 @@ # define EXTERN extern #endif -EXTERN vorbis_func_floor *_floor_P[]; -EXTERN vorbis_func_residue *_residue_P[]; -EXTERN vorbis_func_mapping *_mapping_P[]; +EXTERN vorbis_func_floor *_ivorbis_floor_P[]; +EXTERN vorbis_func_residue *_ivorbis_residue_P[]; +EXTERN vorbis_func_mapping *_ivorbis_mapping_P[]; #endif diff --git a/res012.c b/res012.c index f036caa..f5ab17f 100644 --- a/res012.c +++ b/res012.c @@ -42,7 +42,7 @@ typedef struct { } vorbis_look_residue0; -void res0_free_info(vorbis_info_residue *i){ +void ivorbis_res0_free_info(vorbis_info_residue *i){ vorbis_info_residue0 *info=(vorbis_info_residue0 *)i; if(info){ memset(info,0,sizeof(*info)); @@ -50,7 +50,7 @@ void res0_free_info(vorbis_info_residue *i){ } } -void res0_free_look(vorbis_look_residue *i){ +void ivorbis_res0_free_look(vorbis_look_residue *i){ int j; if(i){ @@ -87,7 +87,7 @@ static int icount(unsigned int v){ } /* vorbis_info is for range checking */ -vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ +vorbis_info_residue *ivorbis_res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ int j,acc=0; vorbis_info_residue0 *info=(vorbis_info_residue0 *)_ogg_calloc(1,sizeof(*info)); codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; @@ -147,11 +147,11 @@ vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ return(info); errout: - res0_free_info(info); + ivorbis_res0_free_info(info); return(NULL); } -vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm, +vorbis_look_residue *ivorbis_res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm, vorbis_info_residue *vr){ vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; vorbis_look_residue0 *look=(vorbis_look_residue0 *)_ogg_calloc(1,sizeof(*look)); @@ -266,7 +266,7 @@ static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl, return(0); } -int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl, +int ivorbis_res0_inverse(vorbis_block *vb,vorbis_look_residue *vl, ogg_int32_t **in,int *nonzero,int ch){ int i,used=0; for(i=0;imap_type[ci->mode_param[mode]->mapping]; - return(_mapping_P[type]->inverse(vb,b->mode[mode])); + return(_ivorbis_mapping_P[type]->inverse(vb,b->mode[mode])); }else{ /* no pcm */ vb->pcmend=0; -- 2.1.4