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
- HuffTree.java - creates a tree for Huffman coding
- HuffDecoder.java
- HuffEncoder.java
Huffman image Java classes - Java classes used for encoding and decoded BufferedImage objects using Huffman coding
Tags: c, c++, code, coding, cs, java, programming, softwarePosted in Uncategorized |
Printer-Friendly Version
|
February 21st, 2007 at 8:16
[…] Code […]
February 25th, 2007 at 19:07
[…] Code […]
May 1st, 2007 at 13:56
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
May 10th, 2007 at 23:37
Easy way out: just deactivaye warnings messages in your compiler and you’ll be fine. I had problems during decoding though.
October 14th, 2007 at 21:17
please make a huffmantree program using c++ that will accept a binary number and display its equivalent string.thanks…
February 1st, 2008 at 4:09
Thanks for sharing
February 9th, 2008 at 1:56
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:
March 7th, 2008 at 10:51
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
March 17th, 2008 at 17:50
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
March 23rd, 2008 at 21:00
I’d prefer reading in my native language, because my knowledge of your languange is no so well.
June 16th, 2008 at 4:02
nice blog