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.

        Attachments

          Activity

          Hide
          saulvargas Saúl Vargas added a comment -

          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}

          **/
          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 ); }
          Show
          saulvargas Saúl Vargas added a comment - 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} **/ 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 ); }
          Hide
          saulvargas Saúl Vargas added a comment -

          ...and the corresponding test.

          Show
          saulvargas Saúl Vargas added a comment - ...and the corresponding test.
          Hide
          craigm Craig Macdonald added a comment -

          Fixed for 4.1

          Show
          craigm Craig Macdonald added a comment - Fixed for 4.1

            People

            • Assignee:
              craigm Craig Macdonald
              Reporter:
              saulvargas Saúl Vargas
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: