[xiph-commits] r14311 - branches/theora-thusnelda/lib/enc

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Dec 18 00:47:59 PST 2007


Author: xiphmont
Date: 2007-12-18 00:47:59 -0800 (Tue, 18 Dec 2007)
New Revision: 14311

Modified:
   branches/theora-thusnelda/lib/enc/frinit.c
Log:
macro/superblock aggregator init cleanup (eliminate pointer arithmetic)



Modified: branches/theora-thusnelda/lib/enc/frinit.c
===================================================================
--- branches/theora-thusnelda/lib/enc/frinit.c	2007-12-18 08:43:32 UTC (rev 14310)
+++ branches/theora-thusnelda/lib/enc/frinit.c	2007-12-18 08:47:59 UTC (rev 14311)
@@ -158,6 +158,7 @@
     int fhilberty[16] = {0,0,1,1,2,3,3,2,2,3,3,2,1,1,0,0};
     int mhilbertx[4] = {0,0,1,1};
     int mhilberty[4] = {0,1,1,0};
+    int offset = 0;
     int plane;
 
     for(plane=0;plane<3;plane++){
@@ -170,15 +171,16 @@
 	    int frow = row*4 + fhilberty[frag];
 	    int fcol = col*4 + fhilbertx[frag];
 	    if(frow<cpi->frag_v[plane] && fcol<cpi->frag_h[plane]){
-	      int fragindex = frow*cpi->frag_h[plane] + fcol;
-	      cpi->super[plane][superindex].f[frag] = &cpi->frag[plane][fragindex] - cpi->frag[0]; 
+	      int fragindex = frow*cpi->frag_h[plane] + fcol + offset;
+	      cpi->super[plane][superindex].f[frag] = fragindex;
 	    }else
 	      cpi->super[plane][superindex].f[frag] = cpi->frag_total; /* 'invalid' */
 	  }
 	}
       }
+      offset+=cpi->frag_n[plane];
     }
-
+    
     for(row=0;row<cpi->super_v[0];row++){
       for(col=0;col<cpi->super_h[0];col++){
 	int superindex = row*cpi->super_h[0] + col;
@@ -188,7 +190,7 @@
 	  int mcol = col*2 + mhilbertx[mb];
 	  if(mrow<cpi->macro_v && mcol<cpi->macro_h){
 	    int macroindex = mrow*cpi->macro_h + mcol;
-	    cpi->super[0][superindex].m[mb] = &cpi->macro[macroindex] - cpi->macro;
+	    cpi->super[0][superindex].m[mb] = macroindex;
 	  }else
 	    cpi->super[0][superindex].m[mb] = cpi->macro_total;
 
@@ -220,13 +222,15 @@
 	}
 	
 	if(row<cpi->frag_v[1] && col<cpi->frag_h[1])
-	  cpi->macro[macroindex].u = &cpi->frag[1][macroindex]-cpi->frag[0];
+	  cpi->macro[macroindex].u = cpi->frag_n[0] + macroindex;
 	else
 	  cpi->macro[macroindex].u = cpi->frag_total;
+
 	if(row<cpi->frag_v[2] && col<cpi->frag_h[2])
-	  cpi->macro[macroindex].v = &cpi->frag[2][macroindex]-cpi->frag[0];
+	  cpi->macro[macroindex].v = cpi->frag_n[0] + cpi->frag_n[1] + macroindex; 
 	else
 	  cpi->macro[macroindex].v = cpi->frag_total;
+
       }
     }
   }



More information about the commits mailing list