forked from mirror/brotli
Remove duplicate kBlockLengthPrefixCode constants.
This commit is contained in:
parent
7b66c0a2f2
commit
4e6528a75b
|
@ -925,8 +925,8 @@ func readBlockLength(table []huffmanCode, br *bitReader) uint32 {
|
||||||
var code uint32
|
var code uint32
|
||||||
var nbits uint32
|
var nbits uint32
|
||||||
code = readSymbol(table, br)
|
code = readSymbol(table, br)
|
||||||
nbits = uint32(kBlockLengthPrefixCode1[code].nbits) /* nbits == 2..24 */
|
nbits = kBlockLengthPrefixCode[code].nbits /* nbits == 2..24 */
|
||||||
return uint32(kBlockLengthPrefixCode1[code].offset) + readBits(br, nbits)
|
return kBlockLengthPrefixCode[code].offset + readBits(br, nbits)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WARNING: if state is not BROTLI_STATE_READ_BLOCK_LENGTH_NONE, then
|
/* WARNING: if state is not BROTLI_STATE_READ_BLOCK_LENGTH_NONE, then
|
||||||
|
@ -942,14 +942,14 @@ func safeReadBlockLength(s *Reader, result *uint32, table []huffmanCode, br *bit
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
var bits uint32 /* nbits == 2..24 */
|
var bits uint32 /* nbits == 2..24 */
|
||||||
var nbits uint32 = uint32(kBlockLengthPrefixCode1[index].nbits)
|
var nbits uint32 = kBlockLengthPrefixCode[index].nbits
|
||||||
if !safeReadBits(br, nbits, &bits) {
|
if !safeReadBits(br, nbits, &bits) {
|
||||||
s.block_length_index = index
|
s.block_length_index = index
|
||||||
s.substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_SUFFIX
|
s.substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_SUFFIX
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
*result = uint32(kBlockLengthPrefixCode1[index].offset) + bits
|
*result = kBlockLengthPrefixCode[index].offset + bits
|
||||||
s.substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE
|
s.substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
120
prefix_dec.go
120
prefix_dec.go
|
@ -6,126 +6,6 @@ package brotli
|
||||||
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Lookup tables to map prefix codes to value ranges. This is used during
|
|
||||||
decoding of the block lengths, literal insertion lengths and copy lengths. */
|
|
||||||
|
|
||||||
/* Represents the range of values belonging to a prefix code:
|
|
||||||
[offset, offset + 2^nbits) */
|
|
||||||
type prefixCodeRange1 struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}
|
|
||||||
|
|
||||||
var kBlockLengthPrefixCode1 = [numBlockLenSymbols]struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{1, 2},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{5, 2},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{9, 2},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{13, 2},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{17, 3},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{25, 3},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{33, 3},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{41, 3},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{49, 4},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{65, 4},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{81, 4},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{97, 4},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{113, 5},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{145, 5},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{177, 5},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{209, 5},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{241, 6},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{305, 6},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{369, 7},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{497, 8},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{753, 9},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{1265, 10},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{2289, 11},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{4337, 12},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{8433, 13},
|
|
||||||
struct {
|
|
||||||
offset uint16
|
|
||||||
nbits byte
|
|
||||||
}{16625, 24},
|
|
||||||
}
|
|
||||||
|
|
||||||
type CmdLutElement struct {
|
type CmdLutElement struct {
|
||||||
insert_len_extra_bits byte
|
insert_len_extra_bits byte
|
||||||
copy_len_extra_bits byte
|
copy_len_extra_bits byte
|
||||||
|
|
Loading…
Reference in New Issue