[xiph-commits] r16956 - trunk/vorbis/lib

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Mar 9 08:05:44 PST 2010


Author: xiphmont
Date: 2010-03-09 08:05:44 -0800 (Tue, 09 Mar 2010)
New Revision: 16956

Modified:
   trunk/vorbis/lib/floor1.c
Log:
Add some unneccessary but potentially useful bulletproofing to allow use of versized floors in 
floor1 on encode side (already worked properly decode-side).



Modified: trunk/vorbis/lib/floor1.c
===================================================================
--- trunk/vorbis/lib/floor1.c	2010-03-09 05:33:58 UTC (rev 16955)
+++ trunk/vorbis/lib/floor1.c	2010-03-09 16:05:44 UTC (rev 16956)
@@ -381,7 +381,7 @@
   }
 }
 
-static void render_line0(int x0,int x1,int y0,int y1,int *d){
+static void render_line0(int n, int x0,int x1,int y0,int y1,int *d){
   int dy=y1-y0;
   int adx=x1-x0;
   int ady=abs(dy);
@@ -393,8 +393,12 @@
 
   ady-=abs(base*adx);
 
-  d[x]=y;
-  while(++x<x1){
+  if(n>x1)n=x1;
+
+  if(x<n)
+    d[x]=y;
+
+  while(++x<n){
     err=err+ady;
     if(err>=adx){
       err-=adx;
@@ -945,6 +949,8 @@
       int hx=0;
       int lx=0;
       int ly=post[0]*info->mult;
+      int n=ci->blocksizes[vb->W]/2;
+
       for(j=1;j<look->posts;j++){
         int current=look->forward_index[j];
         int hy=post[current]&0x7fff;
@@ -953,7 +959,7 @@
           hy*=info->mult;
           hx=info->postlist[current];
 
-          render_line0(lx,hx,ly,hy,ilogmask);
+          render_line0(n,lx,hx,ly,hy,ilogmask);
 
           lx=hx;
           ly=hy;



More information about the commits mailing list