Skip to content

smileboywtu/LubyTransformCode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

 _   _____    ____          _
| | |_   _|  / ___|___   __| | ___  ___
| |   | |   | |   / _ \ / _` |/ _ \/ __|
| |___| |   | |__| (_) | (_| |  __/\__ \
|_____|_|    \____\___/ \__,_|\___||___/
========================================

anrosent
Completed for Brown University course cs168: Computer Networks.

    This is an implementation of a Luby Transform code in Python, consisting of two executables, one for each encoding and decoding files. The sampling code is pulled into a library shared between the two executables.

Encoding
--------

    The encoding algorithm follows the given spec, so no innovations there. A few optimizations are made however. First, the CDF of the degree distribution, M(d), is precomputed for all degrees d = 1, ..., K. This CDF is represented as an array mapping index d => M(d), so sampling from the degree distribution mu(d) becomes a linear search through the CDF array looking for the bucket our random number on [0, 1) landed in. This random number is generated as specified using the linear congruential generator.
    Second, the integer representation of all blocks is held in RAM for maximum speed in block sample generation. This is a limitation on the size of the file practically encoded on most computers, but this decision does not reach far into other parts of the design, and it can be easily addressed if necessary for better memory scalability.

Decoding
--------

    The decoder is essentially a loop that reads the header, then the body, of each incoming block and conducts all possible steps in the belief propagation algorithm on a representation of the source node/check node graph that become possible given the new check node. This is done using an online algorithm, which computes the appropriate messages incrementally and passes them eagerly as the value of source nodes is resolved. Thus, the program will terminate once it has read only as many blocks is necessary in the stream to decode the file, and it seems to scale well as the file size, block size, and drop rate increase.

Usage
-----

    To run the encoder, invoke the following from the shell
    $ ./encoder <file> <blocksize> <seed> [c] [delta]

    To run the decoder, run the following
    $ ./decoder <drop-rate>
    where <drop-rate> is written as a decimal probability of a block being dropped in transmission

Development
-----------

    The project current contains two version of the LT Code:

        1. python3 version, this version can work correctly.
        2. java8 and java6 version, this version also work well now.

Example
-------

   on ubuntu 14.04, python 3 environment:

      ./encoder test.txt 128 | ./decoder 0.0 > output.txt

   after that, you can use the diff to check the source data and the output data

      diff test.txt output.txt


   on ubuntu 14.04, oracle java 8 version

     cd java/

     // encode the file into a buffer file
     java lubyTransformCode.LubyTransformCode encode sendfile.txt >buffer

     // decode the source file from the buffer
     java lubyTransformCode.LubyTransformCode decode copy.txt <buffer

     // check
     diff sendfile.txt copy.txt

About

python and java library for Luby Transform Code(LT-Code)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 84.1%
  • Python 15.9%