DESY ACOP Beans Home

de.desy.acop.video.displayer
Class HuffmanDecompression

java.lang.Object
  extended by de.desy.acop.video.displayer.HuffmanDecompression

public final class HuffmanDecompression
extends java.lang.Object

HuffmanDecompression is a wrapper class around HuffYUV open source video codec v1.2.3 huffman-based video data decompression.

It basically is a pure Java rewrite of simple C++ source code of HuffYUV 1.2.3. The HuffYUV site where the original C++ code was taken from in 2002 was situated at Berkeley University, but is no longer available. A archived version of it can be found at http://neuron2.net/www.math.berkeley.edu/benrg/huffyuv.html (last checked July 19, 2008). The original author of the C++ source is Ben Rudiak-Gould.

This so-called HuffYUV compression is lossless and was adapted and used at Video System v2 in order to compress/uncompress grayscale data before/after transferring it over the network.

Speed of pure Java implementation was (after optimization) much better than thought. I could not believe how fast Java code can get. Only necessary method to call is (DecompressHuffYUV( byte[], int, byte [], int, int)).

Version:
$Id: Templates.xml,v 1.10 2008/06/19 17:40:13 sweisse Exp $
Author:
Stefan Weisse

Constructor Summary
HuffmanDecompression()
           
 
Method Summary
static void decompressHuffYUV(byte[] aCompressedBuffer, int aCompressedOffset, byte[] aUncompressedBuffer, int aUncompressedOffset, int aSizeImage)
          Decompresses HuffYUV compressed data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HuffmanDecompression

public HuffmanDecompression()
Method Detail

decompressHuffYUV

public static final void decompressHuffYUV(byte[] aCompressedBuffer,
                                           int aCompressedOffset,
                                           byte[] aUncompressedBuffer,
                                           int aUncompressedOffset,
                                           int aSizeImage)
Decompresses HuffYUV compressed data.

Parameters:
aCompressedBuffer - byte array containing the compressed bits, see Remark
aCompressedOffset - offset of first byte where compressed bits start
aUncompressedBuffer - see Remark, byte array of exact size to hold uncompressed frame bits
aUncompressedOffset - offset in uncompressed buffer where uncompressed bytes should start
aSizeImage - size of uncompressed frame bits (usually pxwidth*pxheight*bytes_per_px)

Remarks:
  • aCompressedBuffer must be at least [aConmpressedOffset+size_compressed_bits+4] bytes big because it is read 32-bit wise so under rare occassions the loop needs up to four extra bytes at end of buffer.
  • aUncompressedBuffer must be exactly [aUncompressedOffset+aSizeImage] bytes big! This is due to optimisation. As a side-effect of this, aSizeImage is not used at the moment.


Copyright © 2010. All Rights Reserved.