[MN-dev] [mndiff]: r113 - trunk/noe/rs.c

michael subversion at mplayerhq.hu
Sat Oct 25 17:42:01 CEST 2008


Author: michael
Date: Sat Oct 25 17:42:00 2008
New Revision: 113

Log:
Seperate the choice for how to evaluate the errorLocator.
This improves speed for the case of few errors and many erasures.


Modified:
   trunk/noe/rs.c

Modified: trunk/noe/rs.c
==============================================================================
--- trunk/noe/rs.c	(original)
+++ trunk/noe/rs.c	Sat Oct 25 17:42:00 2008
@@ -361,7 +361,7 @@ static int rsBerlekampMassey(GFF4Element
 
 int EXT(rsDecode)(GFF4Element *data, int *erasure, GFF4Element *erasureLocator, int erasureCount, int parityCount, int codeBits){
     int i, j, k;
-    int errorCount, gfftEval;
+    int errorCount, elfft, gfftEval;
     const int decimate= SHIFT - codeBits;
     const int codeCount= (SIZE - 1)>>decimate;
     GFF4Element locator0[SIZE]; //[parityCount + 1 + 1];
@@ -418,6 +418,8 @@ for(i=0; i<erasureCount; i++){
     errorLocator= locators[i];
     psi= locators[1-i]; //reuse some unused space
 
+    elfft = !M && errorCount>20; //FIXME finetune threshold
+
     if(M)                                   gfftEval= 0;
     else if(errorCount + erasureCount > codeCount/64) gfftEval= 2;
     else                                    gfftEval= errorCount>20;
@@ -428,19 +430,10 @@ for(i=0; i<erasureCount; i++){
         memcpy(psi, errorLocator, (errorLocator[0]+2)*sizeof(GFF4Element));
     EXT(getDerivative)(psi, psi);
 
-    if(gfftEval){
+    if(elfft){
         memset(errorLocator + errorCount+2, 0, (codeCount - errorCount - 1)*sizeof(GFF4Element));
         errorLocator++;
         EXT(gfft)(errorLocator, errorLocator, codeBits);
-        if(gfftEval>1){
-            //FIXME
-            memset(omega + omega[0] + 2, 0, (codeCount - omega[0] - 1)*sizeof(GFF4Element));
-            memset(psi   + psi  [0] + 2, 0, (codeCount - psi  [0] - 1)*sizeof(GFF4Element));
-            omega++;
-            psi++;
-            EXT(gfft)(omega, omega, codeBits);
-            EXT(gfft)(psi  , psi  , codeBits);
-        }
 
         for(j=0,i=0; j<errorCount; i++){
             if(i > codeCount)
@@ -469,6 +462,16 @@ for(i=0; i<erasureCount; i++){
         }
     }
 
+        if(gfftEval>1){
+            //FIXME
+            memset(omega + omega[0] + 2, 0, (codeCount - omega[0] - 1)*sizeof(GFF4Element));
+            memset(psi   + psi  [0] + 2, 0, (codeCount - psi  [0] - 1)*sizeof(GFF4Element));
+            omega++;
+            psi++;
+            EXT(gfft)(omega, omega, codeBits);
+            EXT(gfft)(psi  , psi  , codeBits);
+        }
+
     for(i=0; i<erasureCount + errorCount; i++){
         const int r= i<erasureCount ? erasure[i] : error[i-erasureCount];
         int e;



More information about the Mndiff-dev mailing list