# Source Coding MATLAB Toolbox

This program can be used to load into MATLAB memory a text file or an image file, in character format

• bitstring_to_index.m
This program converts any bitstring to an integer index.

• index_to_bitstring.m
This program converts an integer index to the corresponding bitstring.

• print_bitstrings.m
This program prints to the screen several bitstrings whose indices are given in a vector.

• archive_bitstrings.m
This program prints to a file several bitstrings whose indices are given in a vector.

• input_bitstrings.m
This program allows one to input several bitstrings at once into MATLAB memory as a vector of indices.

• concat.m
This program concatenates together two or more bitstrings presented to the program in the form of a vector of indices.

• prefix_encode.m
This program encodes a given data vector via the memoryless prefix code induced by a given prefix set.

• compactcodeP.m
This program designs a compact prefix code having a given proper Kraft vector as the vector of codeword lengths.

• compactcodeI.m
This program designs a compact prefix code whose vector of codeword lengths is less than or equal to a given improper Kraft vector.

• numkraft.m
This program computes the number of compact prefix codeword sets having a given number of codewords.

• frequency.m
This program computes the frequency with which each symbol appears in a given data vector.

• huffmanlength.m
This program computes the length of the binary codeword that results when a data vector is encoded via the Huffman code designed for that vector.

• huffmancode.m
This program computes the codeword lengths for the Huffman code that is designed to encode a given data vector.

• pseudoseq.m
This program generates a pseudorandom sequence of a given length from a given alphabet with prescribed symbol frequencies.

• entropy.m
This program computes the first order entropy of a given data vector.

• block_entropy.m
This program computes the entropy resulting from partitioning a given data vector into blocks of a given length.

• cond_entropy.m
This program computes the conditional entropy of a given data vector, using a memory window of a given fixed size.

• Bcomprate.m
This program computes the minimum compression rate achievable in the encoding of a given data vector using block codes with a given block length.

• FMcomprate.m
This program computes the minimum compression rate achievable in the encoding of a data vector via finite memory codes which employ a memory window of a given fixed size.

• LZparse.m
This program computes the indices of the variable-length blocks appearing in the Lempel-Ziv parsing of a binary data vector.

• LZcodelength.m
This program computes the length of the codeword generated by the Lempel-Ziv encoder in response to a binary data vector.

• runlengths.m
This program computes the runlengths for a horizontally scanned image.

• binarycode.m
This program computes the binary code representation of a nonegative integer.

• graycode.m
This program computes the Gray code representation of a nonnegative integer.

• opt2level.m
This program determines the optimal two-level scalar quantizer for a given datavector.

• lloyd.m
This program allows one to design a scalar quantizer via Lloyd's algorithm.

• LBG.m
This program allows one to design a vector quantizer via the LBG algorithm.

• SQNR.m
This program allows one to compute the signal to quantizing noise ratio for a given vector quantizer.

• dist_rate_func.m
This program allows one to compute the distortion rate function of a memoryless information source.

• blahut.m
This program is an auxiliary program that must be placed in your directory in order to make the program ``dist_rate_func'' run.

• laplace.m
This program is a pseudorandom number generator allowing one to simulate a Laplacian memoryless source.

• scan.m
This program allows one to do a raster scan of a digital image.

• signum.m
This program implements the signum function.