Details
-
Type:
Bug
-
Status: Resolved
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: 4.0
-
Fix Version/s: 4.1
-
Component/s: .compression
-
Labels:None
Description
The Elias delta coding implemented in BitOutputStream.java/BitInBase.java does not seem to work properly in cases where the rest (unary, gamma and a fixed version of Golomb) work fine. For instance when X = 3309, the coding/decoding process results in X'=6618. I've tried to debug it, but I don't understand exactly what is happening. It looks like a problem when retrieving the gamma representation of the msb, but I cannot see why.
FIXED! See the original, commented line and the next one with the fix. Don't forget to fix it in BitOutputStream.java and BitFile.java (duplicated code, WHY?).
/**
{@inheritDoc}**/
{ final int msb = BitUtilities.mostSignificantBit( ++x ); final int l = writeGamma( msb ); // return l + ( msb != 0 ? writeInt( x, msb ) : 0 ); return l + ( msb != 0 ? writeInt( x & ((2 << (msb - 1)) - 1), msb ) : 0 ); }public int writeDelta( int x ) throws IOException