コード例 #1
0
ファイル: compress_fragment.c プロジェクト: MattDevo/edk2
static BROTLI_INLINE uint32_t HashBytesAtOffset(
    uint64_t v, int offset, size_t shift) {
  BROTLI_DCHECK(offset >= 0);
  BROTLI_DCHECK(offset <= 3);
  {
    const uint64_t h = ((v >> (8 * offset)) << 24) * kHashMul32;
    return (uint32_t)(h >> shift);
  }
}
コード例 #2
0
ファイル: huffman.c プロジェクト: FeodorFitsner/brotli
void BrotliBuildCodeLengthsHuffmanTable(HuffmanCode* table,
                                        const uint8_t* const code_lengths,
                                        uint16_t* count) {
  HuffmanCode code;   /* current table entry */
  int symbol;         /* symbol index in original or sorted table */
  uint32_t key;       /* prefix code */
  uint32_t key_step;  /* prefix code addend */
  int step;           /* step size to replicate values in current table */
  int table_size;     /* size of current table */
  int sorted[BROTLI_CODE_LENGTH_CODES];  /* symbols sorted by code length */
  /* offsets in sorted table for each length */
  int offset[BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH + 1];
  int bits;
  int bits_count;
  BROTLI_DCHECK(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH <=
                BROTLI_REVERSE_BITS_MAX);

  /* generate offsets into sorted symbol table by code length */
  symbol = -1;
  bits = 1;
  BROTLI_REPEAT(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH, {
    symbol += count[bits];
    offset[bits] = symbol;
    bits++;
  });
コード例 #3
0
static BROTLI_INLINE uint32_t HashBytesAtOffset(uint64_t v, size_t offset,
    size_t shift, size_t length) {
  BROTLI_DCHECK(offset <= 8 - length);
  {
    const uint64_t h = ((v >> (8 * offset)) << ((8 - length) * 8)) * kHashMul32;
    return (uint32_t)(h >> shift);
  }
}
コード例 #4
0
ファイル: bit_reader.c プロジェクト: niltsh/brotli
void BrotliInitBitReader(BrotliBitReader* const br, BrotliInput input) {
  BROTLI_DCHECK(br != NULL);

  br->input_ = input;
  br->val_ = 0;
  br->bit_pos_ = sizeof(br->val_) << 3;
  br->avail_in = 0;
  br->eos_ = 0;
  br->next_in = br->buf_;
}