Changeset 5519

Show
Ignore:
Timestamp:
10/25/07 17:25:28 (6 years ago)
Author:
jgaeddert
Message:

allocating less subheader data to src_id, dst_id, etc.; freeing memory from rs_char

Location:
experimental/components/Packetizer/trunk/Packetizer-metadata
Files:
3 modified

Legend:

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

    r5512 r5519  
    4949    packet_header_length = NUM_CONTROL_CODES*PN_CONTROL_CODE_LENGTH; 
    5050 
     51    // initialize buffers 
    5152    buf1 = new unsigned char[MAX_PACKET_SIZE]; 
    5253    buf2 = new unsigned char[MAX_PACKET_SIZE]; 
     
    533534    // ----         ---- 
    534535    // packet_id    32 
    535     // src_id       16 
    536     // dst_id       16 
    537     // app_id       16 
    538     // port_id      16 
    539     // expansion    64 
     536    // src_id        8 
     537    // dst_id        8 
     538    // app_id        8 
     539    // port_id       8 
     540    // packet_len   16 
     541    // expansion    48 
    540542    buf1[0] = (packet_id >> 0)  & 0xFF; 
    541543    buf1[1] = (packet_id >> 8)  & 0xFF; 
     
    544546 
    545547    buf1[4] = (src_id >> 0 ) & 0xFF; 
    546     buf1[5] = (src_id >> 8 ) & 0xFF; 
    547  
    548     buf1[6] = (dst_id >> 0 ) & 0xFF; 
    549     buf1[7] = (dst_id >> 8 ) & 0xFF; 
    550  
    551     buf1[8] = (app_id >> 0 ) & 0xFF; 
    552     buf1[9] = (app_id >> 8 ) & 0xFF; 
    553  
    554     buf1[10] = (port_id >> 0 ) & 0xFF; 
    555     buf1[11] = (port_id >> 8 ) & 0xFF; 
    556  
     548 
     549    buf1[5] = (dst_id >> 0 ) & 0xFF; 
     550 
     551    buf1[6] = (app_id >> 0 ) & 0xFF; 
     552 
     553    buf1[7] = (port_id >> 0 ) & 0xFF; 
     554 
     555    buf1[8] = (packet_data_length >> 0 ) & 0xFF; 
     556    buf1[9] = (packet_data_length >> 8 ) & 0xFF; 
     557 
     558    buf1[10] = 7; 
     559    buf1[11] = 7; 
    557560    buf1[12] = 7; 
    558561    buf1[13] = 7; 
     
    587590    rs = init_rs_char(symsize,0x43,1,1,nroots,npad); 
    588591    encode_rs_char(rs, buf1, &buf1[kk]); 
     592    free_rs_char(rs); 
    589593 
    590594    // 5. unpack to output buffer 
     
    765769    int nerrors(0); 
    766770    nerrors = decode_rs_char(rs, buf2, 0, 0); 
     771    free_rs_char(rs); 
    767772 
    768773    // 3. repack 27 6-bit symbols (-2 bits) to 20 8-bit symbols 
     
    795800    // ----         ---- 
    796801    // packet_id    32 
    797     // src_id       16 
    798     // dst_id       16 
    799     // app_id       16 
    800     // port_id      16 
    801     // expansion    64 
     802    // src_id        8 
     803    // dst_id        8 
     804    // app_id        8 
     805    // port_id       8 
     806    // packet_len   16 
     807    // expansion    48 
    802808    packet_id = 0; 
    803809    packet_id = 0; 
     
    808814 
    809815    src_id = 0; 
    810     src_id |= (buf2[4] << 0); 
    811     src_id |= (buf2[5] << 8); 
     816    src_id |= buf2[4]; 
    812817 
    813818    dst_id = 0; 
    814     dst_id |= (buf2[6] << 0); 
    815     dst_id |= (buf2[7] << 8); 
     819    dst_id |= buf2[5]; 
    816820 
    817821    app_id = 0; 
    818     app_id |= (buf2[8] << 0); 
    819     app_id |= (buf2[9] << 8); 
     822    app_id |= buf2[6]; 
    820823 
    821824    port_id = 0; 
    822     port_id |= (buf2[10] << 0); 
    823     port_id |= (buf2[11] << 8); 
     825    port_id |= buf2[7]; 
     826 
     827    packet_data_length = 0; 
     828    packet_data_length |= buf2[8]; 
     829    packet_data_length |= buf2[9]; 
    824830 
    825831    return true; 
     
    985991        nw += nn; 
    986992    } 
     993    free_rs_char(rs); 
    987994     
    988995    // 4. unpack data: move 4-bit symbols from buf1 to 1-bit symbols in output 
     
    10751082        nw += kk; 
    10761083    } 
     1084    free_rs_char(rs); 
    10771085 
    10781086    // 3. calculate and compare crc/checksum (16-bit) 
  • experimental/components/Packetizer/trunk/Packetizer-metadata/tests/CreateExtract_testsuite.h

    r5509 r5519  
    9595        // Initialize properties 
    9696        p.packet_id = 32768; 
    97         p.src_id = 567; 
     97        p.src_id = 247; 
    9898        p.dst_id = 129; 
    99         p.port_id = 1889; 
     99        p.port_id = 189; 
    100100        p.app_id = 10; 
    101101        p.ConfigurePacketType( PACKET_RS_512 ); 
  • experimental/components/Packetizer/trunk/Packetizer-metadata/tests/EncodeDecodeSubheader_testsuite.h

    r5504 r5519  
    5959        // Set encoder packet id property 
    6060        enc.packet_id = 68392; 
    61         enc.src_id = 859; 
    62         enc.dst_id = 906; 
     61        enc.src_id = 255; 
     62        enc.dst_id = 159; 
    6363        enc.port_id = 254; 
    6464        enc.app_id = 211;