Tabnine Logo
CanonicalFast64CodeWordDecoder
Code IndexAdd Tabnine to your IDE (free)

How to use
CanonicalFast64CodeWordDecoder
in
it.unimi.dsi.compression

Best Java code snippets using it.unimi.dsi.compression.CanonicalFast64CodeWordDecoder (Showing top 12 results out of 315)

origin: blazegraph/database

public int decode( final BooleanIterator iterator ) {
  final int[] lengthIncrement = this.lengthIncrement;
  final long[] lastCodeWordPlusOne = this.lastCodeWordPlusOne;
  int curr = 0, l; 
  long x;
  x = readLong( iterator, lengthIncrement[ curr ] );
  
  for(;;) {
    if ( x < lastCodeWordPlusOne[ curr ] ) return symbol[ (int)( howManyUpToBlock[ curr ] - lastCodeWordPlusOne[ curr ] + x ) ];
    l = lengthIncrement[ ++curr ];
    x = x << l | readLong( iterator, l );
  }
}
origin: blazegraph/database

/**
 * This verifies that a code book constructed from a given set of
 * frequencies may be reconstructed from the cord word bit lengths, given in
 * a non-decreasing order, together with the symbols in a correlated array.
 * 
 * @param frequency
 */
public void doRoundTripTest(final int[] frequency) {
  
  final DecoderInputs decoderInputs = new DecoderInputs();
  
  final HuffmanCodec codec = new HuffmanCodec(frequency, decoderInputs);
  if (log.isDebugEnabled()) {
    log.debug(printCodeBook(codec.codeWords()) + "\nlength[]="
        + Arrays.toString(decoderInputs.getLengths()) + "\nsymbol[]="
        + Arrays.toString(decoderInputs.getSymbols()));
  }
  
  final CanonicalFast64CodeWordDecoder actualDecoder = new CanonicalFast64CodeWordDecoder(
      decoderInputs.getLengths(), decoderInputs.getSymbols());
  for (int i = 0; i < frequency.length; i++) {
    final BooleanIterator coded = codec.coder().encode(i/*symbol*/);
    
    assertEquals(i, actualDecoder.decode(coded));
    
  }
}
origin: blazegraph/database

this.decoder = new CanonicalFast64CodeWordDecoder(
    decoderInputs.getLengths(), decoderInputs
        .getSymbols());
origin: com.blazegraph/bigdata-core-test

/**
 * This verifies that a code book constructed from a given set of
 * frequencies may be reconstructed from the cord word bit lengths, given in
 * a non-decreasing order, together with the symbols in a correlated array.
 * 
 * @param frequency
 */
public void doRoundTripTest(final int[] frequency) {
  
  final DecoderInputs decoderInputs = new DecoderInputs();
  
  final HuffmanCodec codec = new HuffmanCodec(frequency, decoderInputs);
  if (log.isDebugEnabled()) {
    log.debug(printCodeBook(codec.codeWords()) + "\nlength[]="
        + Arrays.toString(decoderInputs.getLengths()) + "\nsymbol[]="
        + Arrays.toString(decoderInputs.getSymbols()));
  }
  
  final CanonicalFast64CodeWordDecoder actualDecoder = new CanonicalFast64CodeWordDecoder(
      decoderInputs.getLengths(), decoderInputs.getSymbols());
  for (int i = 0; i < frequency.length; i++) {
    final BooleanIterator coded = codec.coder().encode(i/*symbol*/);
    
    assertEquals(i, actualDecoder.decode(coded));
    
  }
}
origin: com.blazegraph/bigdata-core

this.decoder = new CanonicalFast64CodeWordDecoder(
    decoderInputs.getLengths(), decoderInputs
        .getSymbols());
origin: com.blazegraph/bigdata-core-test

final CanonicalFast64CodeWordDecoder actualDecoder = new CanonicalFast64CodeWordDecoder(
    decoderInputs.getLengths(), decoderInputs.getSymbols());
    assertEquals(value[i]/* symbol */, actualDecoder.decode(ibs));
origin: it.unimi.dsi/dsiutils

  if (size == 1) codeWord[0] = LongArrayBitVector.getInstance();
  coder = new Fast64CodeWordCoder(codeWord, new long[size]);
  decoder = new CanonicalFast64CodeWordDecoder(new int[size], new int[size]);
  return;
decoder = new CanonicalFast64CodeWordDecoder(length, symbol);
origin: com.blazegraph/dsi-utils

public int decode( final BooleanIterator iterator ) {
  final int[] lengthIncrement = this.lengthIncrement;
  final long[] lastCodeWordPlusOne = this.lastCodeWordPlusOne;
  int curr = 0, l; 
  long x;
  x = readLong( iterator, lengthIncrement[ curr ] );
  
  for(;;) {
    if ( x < lastCodeWordPlusOne[ curr ] ) return symbol[ (int)( howManyUpToBlock[ curr ] - lastCodeWordPlusOne[ curr ] + x ) ];
    l = lengthIncrement[ ++curr ];
    x = x << l | readLong( iterator, l );
  }
}
origin: blazegraph/database

final CanonicalFast64CodeWordDecoder actualDecoder = new CanonicalFast64CodeWordDecoder(
    decoderInputs.getLengths(), decoderInputs.getSymbols());
    assertEquals(value[i]/* symbol */, actualDecoder.decode(ibs));
origin: blazegraph/database

  decoderInputs.length = new int[size];
  decoderInputs.symbol = new int[size];
  decoder = new CanonicalFast64CodeWordDecoder( decoderInputs.length, decoderInputs.symbol );
  return;
    + ", but length[0]="
    + length[0]; 
decoder = new CanonicalFast64CodeWordDecoder( decoderInputs.length, decoderInputs.symbol);
origin: it.unimi.dsi/dsiutils

@Override
public int decode(final BooleanIterator iterator) {
  final int[] lengthIncrement = this.lengthIncrement;
  final long[] lastCodeWordPlusOne = this.lastCodeWordPlusOne;
  int curr = 0, l;
  long x;
  x = readLong(iterator, lengthIncrement[curr]);
  for(;;) {
    if (x < lastCodeWordPlusOne[curr]) return symbol[(int)(howManyUpToBlock[curr] - lastCodeWordPlusOne[curr] + x)];
    l = lengthIncrement[++curr];
    x = x << l | readLong(iterator, l);
  }
}
origin: com.blazegraph/dsi-utils

  decoderInputs.length = new int[size];
  decoderInputs.symbol = new int[size];
  decoder = new CanonicalFast64CodeWordDecoder( decoderInputs.length, decoderInputs.symbol );
  return;
    + ", but length[0]="
    + length[0]; 
decoder = new CanonicalFast64CodeWordDecoder( decoderInputs.length, decoderInputs.symbol);
it.unimi.dsi.compressionCanonicalFast64CodeWordDecoder

Javadoc

A fast table-based decoder for canonical Huffman codes supporting only codes with limited (less than 64 bits) codewords. We use the technique described by Daniel S. Hirschberg and Debra A. Lelewer, “Efficient Decoding of Prefix Codes”, Comm. ACM, 33(4): 449−459, 1990.

Most used methods

  • <init>
    Creates a new codeword-based decoder using the given vector of codewords lengths and a symbol array.
  • readLong
    Reads a specified number of bits from a Boolean iterator and stores them into a long.
  • decode

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • getApplicationContext (Context)
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now