Changeset 2065 for trunk/symbol_table


Ignore:
Timestamp:
Apr 28, 2012, 5:23:05 PM (7 years ago)
Author:
ksherdy
Message:

Added in log2 pablo statements. Updated Python demo.

Location:
trunk/symbol_table
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/demo_strms.py

    r2055 r2065  
    22import marker_strms
    33import div2_group_strms
     4import log2_group_strms
    45import sys
    56
     
    1617def Demo_div2(u8data, basis_bits):
    1718
    18     lgth = 100 + 1
     19    lgth = len(u8data)
    1920
    2021    markers = marker_strms.Markers()
     
    3334        ('groups.starts', bitstream2string(groups.starts, lgth)),
    3435        ('groups.ends', bitstream2string(groups.ends, lgth)),
    35         ('groups.ends_1_2', bitstream2string(groups.ends_2, lgth)),
    36         ('groups.ends_3_4', bitstream2string(groups.ends_4, lgth)),
    37         ('groups.ends_5_6', bitstream2string(groups.ends_6, lgth)),
    38         ('groups.ends_7_8', bitstream2string(groups.ends_8, lgth)),
    39         ('groups.ends_9_10', bitstream2string(groups.ends_10, lgth)),
    40         ('groups.ends_11_12', bitstream2string(groups.ends_12, lgth)),
    41         ('groups.ends_13_14', bitstream2string(groups.ends_14, lgth)),
    42         ('groups.ends_15_16', bitstream2string(groups.ends_16, lgth)),
     36        ('groups.ends_2', bitstream2string(groups.ends_2, lgth)),
     37        ('groups.ends_4', bitstream2string(groups.ends_4, lgth)),
     38        ('groups.ends_6', bitstream2string(groups.ends_6, lgth)),
     39        ('groups.ends_8', bitstream2string(groups.ends_8, lgth)),
     40        ('groups.ends_10', bitstream2string(groups.ends_10, lgth)),
     41        ('groups.ends_12', bitstream2string(groups.ends_12, lgth)),
     42        ('groups.ends_14', bitstream2string(groups.ends_14, lgth)),
     43        ('groups.ends_16', bitstream2string(groups.ends_16, lgth)),
    4344        ('groups.ends_gte_17', bitstream2string(groups.ends_gte_17, lgth))])
     45
     46def Demo_log2(u8data, basis_bits):
     47
     48    lgth = len(u8data)
     49
     50    markers = marker_strms.Markers()
     51    marker_strms.Classify_markers(basis_bits, markers)
     52    marker_strms.Generate_markers(markers)
     53
     54    groups = log2_group_strms.Groups()
     55    groups.starts = markers.starts
     56    groups.ends = markers.ends
     57    log2_group_strms.Gen_lgth_groups(groups)
     58
     59    print_aligned_streams([('Input Data', u8data),
     60        ('markers.spans', bitstream2string(markers.spans, lgth)),
     61        ('markers.starts', bitstream2string(markers.starts, lgth)),
     62        ('markers.ends', bitstream2string(markers.ends, lgth)),
     63        ('groups.starts', bitstream2string(groups.starts, lgth)),
     64        ('groups.ends', bitstream2string(groups.ends, lgth)),
     65        ('groups.ends_1', bitstream2string(groups.ends_1, lgth)),
     66        ('groups.ends_2', bitstream2string(groups.ends_2, lgth)),
     67        ('groups.ends_4', bitstream2string(groups.ends_4, lgth)),
     68        ('groups.ends_8', bitstream2string(groups.ends_8, lgth)),
     69        ('groups.ends_16', bitstream2string(groups.ends_16, lgth)),
     70        ('groups.ends_gte_17', bitstream2string(groups.ends_gte_17, lgth))])
    4471
    4572if __name__ == "__main__":
    4673
    4774    if len(sys.argv) < 2:
    48         sys.stderr.write("Usage: python " + filename + " <filename>" "\n")
     75        sys.stderr.write("Usage: python " + filename + " <filename>\n")
    4976        sys.exit(2)
    5077
     
    6390    basis_bits.bit_7 = b[7]
    6491
    65     Demo_div2(u8data, basis_bits)
     92    # Demo_div2(u8data, basis_bits)
     93    Demo_log2(u8data, basis_bits)
    6694
  • trunk/symbol_table/div2_group_strms.py

    r2059 r2065  
    33
    44class Groups():
    5         starts = 0
    6         ends = 0
     5        starts = 0
     6        ends = 0
    77        ends_2 = 0
    88        ends_4 = 0
     
    1313        ends_14 = 0
    1414        ends_16 = 0
    15         ends_gte_17 = 0
     15        ends_gte_17 = 0
    1616
    1717def Gen_lgth_groups(groups):
  • trunk/symbol_table/id_group_strms.py

    r2043 r2065  
    1 from bitutil import *
     1# demo
     2import bitutil as pablo
    23
    34class Groups():
  • trunk/symbol_table/src/hash_table.hpp

    r2064 r2065  
    415415        uint32_t lgth = raw_byte_lgth;
    416416
    417 
    418 
    419417        ///////////////////////////////////////////////////////////////////////////
    420418        // Even
     
    424422        } else {
    425423
    426             if (!div2_hash_table::is_delimeter((char) *(raw_bytes + (idx + lgth - 1)))) {
     424            if (!div2_hash_table::is_delimeter((char) *(raw_bytes + (idx + lgth-1)))) { // TODO - update on pablo to check at pos == idx
    427425
    428426                this->pool_and_insert(bucket, raw_bytes, idx, lgth, h0, h1, gid_factory, gid_data, gid);
    429427                return gid;
    430428            } else {
    431 
    432                     ///////////////////////////////////////////////////////////////////////////
    433                     // Odd
    434                     ///////////////////////////////////////////////////////////////////////////
    435                     if(this->hash_table_odd.lookup(bucket, raw_bytes, idx, lgth-1, h0, h1, gid)) {
    436                         return gid;
    437                     }
    438 
    439                     hash_table_odd.pool_and_insert(bucket, raw_bytes, idx, lgth-1, h0, h1, gid_factory, gid_data, gid);
     429                ///////////////////////////////////////////////////////////////////////////
     430                // Odd
     431                ///////////////////////////////////////////////////////////////////////////
     432                if(this->hash_table_odd.lookup(bucket, raw_bytes, idx, lgth-1, h0, h1, gid)) {
    440433                    return gid;
     434                }
     435
     436                hash_table_odd.pool_and_insert(bucket, raw_bytes, idx, lgth-1, h0, h1, gid_factory, gid_data, gid);
     437                return gid;
    441438            }
    442439        }
  • trunk/symbol_table/symbol_table.pro

    r2054 r2065  
    5050    demo_strms.py \
    5151    bitutil.py \
    52     pablo.py
     52    pablo.py \
     53    log2_group_strms.py
    5354HEADERS += marker_strms_template.hpp \
    5455    marker_strms.hpp \
Note: See TracChangeset for help on using the changeset viewer.