[MN-dev] [mndiff]: r128 - in trunk/noe: ldpc.c ldpc.h test_ldpc.c
michael
subversion at mplayerhq.hu
Wed Nov 26 00:01:45 CET 2008
Author: michael
Date: Wed Nov 26 00:01:45 2008
New Revision: 128
Log:
Make the sparseness of the parity matrix a user parameter.
Modified:
trunk/noe/ldpc.c
trunk/noe/ldpc.h
trunk/noe/test_ldpc.c
Modified: trunk/noe/ldpc.c
==============================================================================
--- trunk/noe/ldpc.c (original)
+++ trunk/noe/ldpc.c Wed Nov 26 00:01:45 2008
@@ -73,22 +73,23 @@ int inverse(ELEM *matrix, int width, int
return p;
}
-LDPCContext *EXT(initLDPC)(int data_len, int parity_len, uint32_t seed){
+LDPCContext *EXT(initLDPC)(int data_len, int parity_len, uint32_t seed, int nzc){
LDPCContext *c= malloc(sizeof(LDPCContext));
int row[parity_len];
KISSState kiss;
- int i, j, y, nzc;
+ int i, j, y;
int code_len= data_len + parity_len;
+ if(nzc==0){
if (parity_len < 16) nzc=3;
else if(parity_len < 32) nzc=4;
else if(parity_len < 64) nzc=5;
else if(parity_len <256) nzc=6;
else nzc=7;
+ }
- if(nzc > MAX_NZC)
+ if(nzc > MAX_NZC || nzc > parity_len)
goto fail;
- assert(nzc <= parity_len);
init_random(&kiss, seed);
Modified: trunk/noe/ldpc.h
==============================================================================
--- trunk/noe/ldpc.h (original)
+++ trunk/noe/ldpc.h Wed Nov 26 00:01:45 2008
@@ -18,7 +18,11 @@
struct LDPCContext;
-struct LDPCContext *EXT(initLDPC)(int data_len, int parity_len, uint32_t seed);
+/**
+ *
+ * @param nzc number of non zero elements per column, 0 means choose automatically.
+ */
+struct LDPCContext *EXT(initLDPC)(int data_len, int parity_len, uint32_t seed, int nzc);
/**
*
Modified: trunk/noe/test_ldpc.c
==============================================================================
--- trunk/noe/test_ldpc.c (original)
+++ trunk/noe/test_ldpc.c Wed Nov 26 00:01:45 2008
@@ -49,13 +49,13 @@ int main(){
parity_pos[i]= data_len + i;
for(seed=0; 1; seed++){
- enc= EXT(initLDPC)(data_len, parity_len, seed);
+ enc= EXT(initLDPC)(data_len, parity_len, seed, 0);
if(EXT(init_matrixLDPC)(enc, parity_len, parity_pos) >= 0)
break;
EXT(freeLDPC)(enc);
}
- dec= EXT(initLDPC)(data_len, parity_len, seed);
+ dec= EXT(initLDPC)(data_len, parity_len, seed, 0);
for(erasure_count= parity_len; erasure_count > parity_len-3; erasure_count--){
int fail=0;
More information about the Mndiff-dev
mailing list