[TR-337] Elias delta coding not working Created: 16/Jun/15  Updated: 06/Nov/15  Resolved: 06/Nov/15

Status: Resolved
Project: Terrier Core
Component/s: .compression
Affects Version/s: 4.0
Fix Version/s: 4.1

Type: Bug Priority: Trivial
Reporter: Saúl Vargas Assignee: Craig Macdonald
Resolution: Fixed  
Labels: None

Attachments: Java Source File TestCompressedBitFilesDelta.java    

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.

Comment by Saúl Vargas [ 18/Jun/15 ]

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?).



public int writeDelta( int x ) throws IOException

{ 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 ); }
Comment by Saúl Vargas [ 18/Jun/15 ]

...and the corresponding test.

Comment by Craig Macdonald [ 06/Nov/15 ]

Fixed for 4.1

Generated at Sat Oct 24 12:19:34 BST 2020 using JIRA 7.1.1#71004-sha1:d6b2c0d9b7051e9fb5e4eb8ce177ca56d91d7bd8.