Show
Ignore:
Timestamp:
10/24/07 09:54:08 (6 years ago)
Author:
jgaeddert
Message:

fixing PACKET_RS_512 encoder/decoder for main data block

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • experimental/components/Packetizer/trunk/Packetizer-metadata/src/PacketizerDSP.cpp

    r5490 r5492  
    985985    for (unsigned int i=0; i<128; i++) 
    986986        ones += c_ones[(unsigned int) (buf2[i])]; 
    987     printf("num ones: %d\n", ones); 
    988987    ones = ones % 65536;    // 2^16 
    989988    buf2[128] = ones & 0x0F; 
     
    10051004    for (unsigned int i=0; i<12; i++) { 
    10061005        // copy data from buf2 to buf1 
    1007         memmove(&buf1[nw], &buf1[nr], kk); 
    1008         nr += kk; 
     1006        memmove(&buf1[nw], &buf2[nr], kk); 
    10091007 
    10101008        // apply encoder 
    10111009        encode_rs_char(rs, (unsigned char*) &buf1[nw], (unsigned char*) &buf1[nw+kk]); 
     1010        nr += kk; 
    10121011        nw += nn; 
    1013  
    1014         printf("%d: nr = %d, nw = %d\n",i,nr,nw); 
    10151012    } 
    10161013     
    10171014    // 4. unpack data: move 4-bit symbols from buf1 to 1-bit symbols in output 
    10181015    SigProc::repack_bytes(buf1, 4, nw, output, 1, output_length, &num_written); 
    1019     printf("PACKET_RS_512 finished writing %d bits (should be 720)\n", num_written); 
    10201016    num_read = 512; 
    10211017 
     
    10921088    nw = 0; 
    10931089    nr = 0; 
    1094     int nerrors; 
    1095     int nerrors_total; 
     1090    int nerrors(0); 
     1091    int nerrors_total(0); 
    10961092    for (unsigned int i=0; i<12; i++) { 
    10971093        // apply decoder (no erasure knowledge) 
    10981094        nerrors = decode_rs_char(rs, (unsigned char*) &buf2[nr], 0, 0); 
    1099         printf("%d: nerrors = %d\n", i, nerrors); 
    1100         nerrors_total += nerrors; 
     1095        nerrors_total = nerrors_total + nerrors; 
    11011096 
    11021097        // copy data from buf2 to buf1 
    11031098        memmove(&buf1[nw], &buf2[nr], kk); 
     1099 
    11041100        nr += nn; 
    11051101        nw += kk; 
    1106  
    1107         printf("%d: nr = %d, nw = %d\n",i,nr,nw); 
    11081102    } 
    11091103 
     
    11131107    for (unsigned int i=0; i<4; i++) { 
    11141108        checksum <<= 4; 
    1115         checksum |= buf2[nr+i]; 
     1109        checksum |= buf1[nw-i-1]; 
    11161110    } 
    11171111    unsigned int ones(0); 
    11181112    for (unsigned int i=0; i<128; i++) 
    11191113        ones += c_ones[(unsigned int) (buf1[i])]; 
    1120     printf("checksum: %d, ones: %d\n", checksum, ones); 
     1114    //printf("checksum: %d, ones: %d\n", checksum, ones); 
    11211115 
    11221116    // 4. unpack data: move 4-bit symbols from buf1 to 1-bit symbols in output 
    1123     SigProc::repack_bytes(buf1, 4, nw, output, 1, output_length, &num_written); 
    1124     printf("PACKET_RS_512 finished writing %d bits (should be 512)\n", num_written); 
    1125     num_read = 512; 
    1126  
    1127 } 
    1128  
     1117    SigProc::repack_bytes(buf1, 4, nw-4, output, 1, output_length, &num_written); 
     1118    num_read = 720; 
     1119 
     1120} 
     1121