Get number for dynamic huffman tree
This commit is contained in:
parent
090e17b3d9
commit
a0b4fe5433
2 changed files with 20 additions and 2 deletions
|
|
@ -66,8 +66,8 @@ typedef struct ISH
|
|||
int raw;
|
||||
struct
|
||||
{
|
||||
unsigned last_block : 1;
|
||||
unsigned block_type : 2;
|
||||
unsigned last_block : 1;
|
||||
unsigned block_type : 2;
|
||||
};
|
||||
};
|
||||
} ISH;
|
||||
|
|
@ -98,6 +98,9 @@ void get_cdh(zip* out);
|
|||
char* get_encoded_block(zip* in, int n);
|
||||
void deflate(zip* in);
|
||||
|
||||
int get_number_bit_length_code(DHCH* dhch);
|
||||
int get_number_dist_code(DHCH* dhch);
|
||||
int get_number_litteral_code(DHCH* dhch);
|
||||
|
||||
short decode_length_token(bitstream* bs, int token);
|
||||
int decode_distance_token(bitstream* bs, int token);
|
||||
|
|
|
|||
|
|
@ -143,6 +143,21 @@ char* decode_type1_block_v2(
|
|||
}
|
||||
}
|
||||
|
||||
int get_number_bit_length_code(DHCH* dhch)
|
||||
{
|
||||
return (dhch->bit_length_code & 0b1111) + 4;
|
||||
}
|
||||
|
||||
int get_number_dist_code(DHCH* dhch)
|
||||
{
|
||||
return (dhch->dist_codes & 0b11111) + 1;
|
||||
}
|
||||
|
||||
int get_number_litteral_code(DHCH* dhch)
|
||||
{
|
||||
return (dhch->literal_codes & 0b11111) + 257;
|
||||
}
|
||||
|
||||
short decode_length_token(bitstream* bs, int token)
|
||||
{
|
||||
token -= END_OF_BLOCK + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue