Code

21 Feb, 2007 0811 by phoebus

This page will serve as a repository for various bits of code. I make no guarantees or claims of functionality.

Most of the source code will be somewhat well-documented. This will also serve as code scratch-space, so everything here is a work in progress.

If you want to use any of this code, feel free, but please let me know:)

Bitstream - a Bitstream class written in C++. Allows bit-level manipulation of data, including reading and writing arbitrary numbers of bits, as well as input from and output to files.

Bitstream (Java version)a Bitstream class with a subset of the functionality of the C++ version above. Used to integrate Huffman coding into the Marklar image editor.

Marklar - A rudimentary GUI image editor written in Java. Built from three classes. Requires the Java Huffman Encode library below (included in the zipfile download).

  • huffmanImages.zip - a zip file of all the necessary files for the image editor. Unzip the files to the same directory and run “javac *.java“. To launch the editor, do “java -Xms32m -Xmx256m Marklar“.
  • Marklar.java - contains the GUI and event handling code.
  • ImagePanel.java - extends from JPanel and includes methods for performing filters and transformations on a BufferedImage.
  • CentralViewportLayout.java - a custom LayoutManager for use with a JScrollPane, allowing the viewport to stay centered in the scrollpane.

Huffman Encode - an unfinished console program for performing Huffman coding on image (or other) files. Written in C++. Requires the above Bitstream C++ library.

Huffman coding Java classes - Java classes used for Huffman coding of Java Bitstream objects

Huffman image Java classes - Java classes used for encoding and decoded BufferedImage objects using Huffman coding

Tags: , , , , , , ,

Posted in Uncategorized | Printer-Friendly Version Printer-Friendly Version |

11 Responses

  1. apollonic.net » Blog Archive » Code Page is Up Says:

    […] Code […]

  2. apollonic.net » Blog Archive » The Rundown Says:

    […] Code […]

  3. bird Says:

    i used the c++ code but i had 6 error can u tell me what to do??
    the errors are:

    Compiling…
    bitstream.cpp
    C:\Documents and Settings\user\Desktop\huffman\bitstream.cpp(231) : warning C4800: ‘int’ : forcing value to bool ‘true’ or ‘false’ (performance warning)
    C:\Documents and Settings\user\Desktop\huffman\bitstream.cpp(243) : warning C4800: ‘unsigned int’ : forcing value to bool ‘true’ or ‘false’ (performance warning)
    C:\Documents and Settings\user\Desktop\huffman\bitstream.cpp(730) : error C2593: ‘operator

  4. Javier Says:

    Easy way out: just deactivaye warnings messages in your compiler and you’ll be fine. I had problems during decoding though.

  5. alen Says:

    please make a huffmantree program using c++ that will accept a binary number and display its equivalent string.thanks…

  6. Doodee Says:

    Thanks for sharing

  7. Frieseneusa Says:

    I’d prefer reading in my native language, because my knowledge of your languange is no so well. But it was interesting! Look for some my links:

  8. vikchil Says:

    I am not able to compile HuffTree.java

    I get following error. can someone please help?

    HuffTree.java:76: ‘(’ or ‘[’ expected
    PriorityQueue nodeQueue = new PriorityQueue(
    weights.length);
    ^
    HuffTree.java:114: expected
    public HashMap getMap() {
    ^
    HuffTree.java:133: ‘;’ expected

    ^
    3 errors

    Thank you,

    Vikram

  9. vikchil Says:

    I got it working actually. I used NetBeans either 5.5 or 6.0.
    Here is my problem.
    I have encoded an image file and the resultant ‘huf’ file is way bigger than the original one. My input file was abt 110Kb but the output file was abt 900Kb.
    Am I doing anything wrong here?

    Please let me know. Thank you,

    Vik

  10. Frieseneusa Says:

    I’d prefer reading in my native language, because my knowledge of your languange is no so well.

  11. Best Insurance Quotes Says:

    nice blog

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.