[xiph-commits] r17555 - in trunk: Tremor vorbis/lib
tterribe at svn.xiph.org
tterribe at svn.xiph.org
Thu Oct 21 11:14:51 PDT 2010
Author: tterribe
Date: 2010-10-21 11:14:51 -0700 (Thu, 21 Oct 2010)
New Revision: 17555
Modified:
trunk/Tremor/floor1.c
trunk/vorbis/lib/floor1.c
Log:
Port r17543 from Tremor.
A codebook that allows values outside the circular range of the piecewise
floor1 representation can overflow the lookup
Also fix a typo in the comments of the original patch.
Modified: trunk/Tremor/floor1.c
===================================================================
--- trunk/Tremor/floor1.c 2010-10-21 18:09:29 UTC (rev 17554)
+++ trunk/Tremor/floor1.c 2010-10-21 18:14:51 UTC (rev 17555)
@@ -425,7 +425,7 @@
int hx=0;
int lx=0;
int ly=fit_value[0]*info->mult;
- /* guard lookup against out-of-rage values */
+ /* guard lookup against out-of-range values */
ly=(ly<0?0:ly>255?255:ly);
for(j=1;j<look->posts;j++){
@@ -435,10 +435,9 @@
hx=info->postlist[current];
hy*=info->mult;
- /* guard lookup against out-of-rage values */
+ /* guard lookup against out-of-range values */
hy=(hy<0?0:hy>255?255:hy);
-
render_line(n,lx,hx,ly,hy,out);
lx=hx;
Modified: trunk/vorbis/lib/floor1.c
===================================================================
--- trunk/vorbis/lib/floor1.c 2010-10-21 18:09:29 UTC (rev 17554)
+++ trunk/vorbis/lib/floor1.c 2010-10-21 18:14:51 UTC (rev 17555)
@@ -1035,7 +1035,7 @@
}
}
- fit_value[i]=val+predicted;
+ fit_value[i]=val+predicted&0x7fff;
fit_value[look->loneighbor[i-2]]&=0x7fff;
fit_value[look->hineighbor[i-2]]&=0x7fff;
@@ -1066,13 +1066,18 @@
int hx=0;
int lx=0;
int ly=fit_value[0]*info->mult;
+ /* guard lookup against out-of-range values */
+ ly=(ly<0?0:ly>255?255:ly);
+
for(j=1;j<look->posts;j++){
int current=look->forward_index[j];
int hy=fit_value[current]&0x7fff;
if(hy==fit_value[current]){
+ hx=info->postlist[current];
hy*=info->mult;
- hx=info->postlist[current];
+ /* guard lookup against out-of-range values */
+ hy=(hy<0?0:hy>255?255:hy);
render_line(n,lx,hx,ly,hy,out);
More information about the commits
mailing list