summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2003-04-14 01:55:13 +0000
committerMonty <xiphmont@xiph.org>2003-04-14 01:55:13 +0000
commit111d0a836c6a791e685b08ac44b0a637c382dc97 (patch)
tree3c9591547d37017811ac30c4f8909da79afe557a
parent17a83fe7417ea1d074fd2bed178bbc931b294d00 (diff)
downloadtremor-111d0a836c6a791e685b08ac44b0a637c382dc97.tar.gz
Low accuracy version of floor0.c fixed
git-svn-id: https://svn.xiph.org/branches/lowmem-branch/Tremor@4609 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r--floor0.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/floor0.c b/floor0.c
index 028cb2c..27b9b0d 100644
--- a/floor0.c
+++ b/floor0.c
@@ -141,7 +141,11 @@ void vorbis_lsp_to_curve(ogg_int32_t *curve,int n,int ln,
int fdy=nyq-fbase*fdx;
int map=0;
+#ifdef _LOW_ACCURACY_
+ ogg_uint32_t nextbark=((tBnyq1<<11)/ln)>>12;
+#else
ogg_uint32_t nextbark=MULT31(imap>>1,tBnyq1);
+#endif
int nextf=barklook[nextbark>>14]+(((nextbark&0x3fff)*
(barklook[(nextbark>>14)+1]-barklook[nextbark>>14]))>>14);
@@ -301,11 +305,22 @@ void vorbis_lsp_to_curve(ogg_int32_t *curve,int n,int ln,
while(1){
map++;
- nextbark=MULT31((map+1)*(imap>>1),tBnyq1);
- nextf=barklook[nextbark>>14]+
- (((nextbark&0x3fff)*
- (barklook[(nextbark>>14)+1]-barklook[nextbark>>14]))>>14);
- if(f<=nextf)break;
+ if(map+1<ln){
+
+#ifdef _LOW_ACCURACY_
+ nextbark=((tBnyq1<<11)/ln*(map+1))>>12;
+#else
+ nextbark=MULT31((map+1)*(imap>>1),tBnyq1);
+#endif
+ nextf=barklook[nextbark>>14]+
+ (((nextbark&0x3fff)*
+ (barklook[(nextbark>>14)+1]-barklook[nextbark>>14]))>>14);
+ if(f<=nextf)break;
+
+ }else{
+ nextf=9999999;
+ break;
+ }
}
if(map>=ln){
map=ln-1; /* guard against the approximation */