Lines Matching refs:dtable

150 static inline u8 HUF_decode_symbol(const HUF_dtable *const dtable,
154 static inline void HUF_init_state(const HUF_dtable *const dtable,
160 static size_t HUF_decompress_1stream(const HUF_dtable *const dtable,
165 static size_t HUF_decompress_4stream(const HUF_dtable *const dtable,
178 static void HUF_free_dtable(HUF_dtable *const dtable);
203 static inline u8 FSE_peek_symbol(const FSE_dtable *const dtable,
207 static inline void FSE_update_state(const FSE_dtable *const dtable,
212 static inline u8 FSE_decode_symbol(const FSE_dtable *const dtable,
217 static inline void FSE_init_state(const FSE_dtable *const dtable,
224 static size_t FSE_decompress_interleaved2(const FSE_dtable *const dtable,
229 static void FSE_init_dtable(FSE_dtable *const dtable,
235 static void FSE_decode_header(FSE_dtable *const dtable, istream_t *const in,
240 static void FSE_init_dtable_rle(FSE_dtable *const dtable, const u8 symb);
243 static void FSE_free_dtable(FSE_dtable *const dtable);
729 static void decode_huf_table(HUF_dtable *const dtable, istream_t *const in);
900 static void decode_huf_table(HUF_dtable *const dtable, istream_t *const in) { in decode_huf_table() argument
944 HUF_init_dtable_usingweights(dtable, weights, num_symbs); in decode_huf_table()
951 FSE_dtable dtable; in fse_decode_hufweights() local
956 FSE_decode_header(&dtable, in, MAX_ACCURACY_LOG); in fse_decode_hufweights()
959 *num_symbs = FSE_decompress_interleaved2(&dtable, weights, in); in fse_decode_hufweights()
961 FSE_free_dtable(&dtable); in fse_decode_hufweights()
1733 static inline u8 HUF_decode_symbol(const HUF_dtable *const dtable, in HUF_decode_symbol() argument
1737 const u8 symb = dtable->symbols[*state]; in HUF_decode_symbol()
1738 const u8 bits = dtable->num_bits[*state]; in HUF_decode_symbol()
1743 *state = ((*state << bits) + rest) & (((u16)1 << dtable->max_bits) - 1); in HUF_decode_symbol()
1748 static inline void HUF_init_state(const HUF_dtable *const dtable, in HUF_init_state() argument
1752 const u8 bits = dtable->max_bits; in HUF_init_state()
1756 static size_t HUF_decompress_1stream(const HUF_dtable *const dtable, in HUF_decompress_1stream() argument
1780 HUF_init_state(dtable, &state, src, &bit_offset); in HUF_decompress_1stream()
1783 while (bit_offset > -dtable->max_bits) { in HUF_decompress_1stream()
1785 IO_write_byte(out, HUF_decode_symbol(dtable, &state, src, &bit_offset)); in HUF_decompress_1stream()
1798 if (bit_offset != -dtable->max_bits) { in HUF_decompress_1stream()
1805 static size_t HUF_decompress_4stream(const HUF_dtable *const dtable, in HUF_decompress_4stream() argument
1825 total_output += HUF_decompress_1stream(dtable, out, &in1); in HUF_decompress_4stream()
1826 total_output += HUF_decompress_1stream(dtable, out, &in2); in HUF_decompress_4stream()
1827 total_output += HUF_decompress_1stream(dtable, out, &in3); in HUF_decompress_4stream()
1828 total_output += HUF_decompress_1stream(dtable, out, &in4); in HUF_decompress_4stream()
1943 static void HUF_free_dtable(HUF_dtable *const dtable) { in HUF_free_dtable() argument
1944 free(dtable->symbols); in HUF_free_dtable()
1945 free(dtable->num_bits); in HUF_free_dtable()
1946 memset(dtable, 0, sizeof(HUF_dtable)); in HUF_free_dtable()
1975 static inline u8 FSE_peek_symbol(const FSE_dtable *const dtable, in FSE_peek_symbol() argument
1977 return dtable->symbols[state]; in FSE_peek_symbol()
1982 static inline void FSE_update_state(const FSE_dtable *const dtable, in FSE_update_state() argument
1985 const u8 bits = dtable->num_bits[*state]; in FSE_update_state()
1987 *state = dtable->new_state_base[*state] + rest; in FSE_update_state()
1991 static inline u8 FSE_decode_symbol(const FSE_dtable *const dtable, in FSE_decode_symbol() argument
1994 const u8 symb = FSE_peek_symbol(dtable, *state); in FSE_decode_symbol()
1995 FSE_update_state(dtable, state, src, offset); in FSE_decode_symbol()
1999 static inline void FSE_init_state(const FSE_dtable *const dtable, in FSE_init_state() argument
2003 const u8 bits = dtable->accuracy_log; in FSE_init_state()
2007 static size_t FSE_decompress_interleaved2(const FSE_dtable *const dtable, in FSE_decompress_interleaved2() argument
2033 FSE_init_state(dtable, &state1, src, &offset); in FSE_decompress_interleaved2()
2034 FSE_init_state(dtable, &state2, src, &offset); in FSE_decompress_interleaved2()
2046 IO_write_byte(out, FSE_decode_symbol(dtable, &state1, src, &offset)); in FSE_decompress_interleaved2()
2050 IO_write_byte(out, FSE_peek_symbol(dtable, state2)); in FSE_decompress_interleaved2()
2055 IO_write_byte(out, FSE_decode_symbol(dtable, &state2, src, &offset)); in FSE_decompress_interleaved2()
2059 IO_write_byte(out, FSE_peek_symbol(dtable, state1)); in FSE_decompress_interleaved2()
2068 static void FSE_init_dtable(FSE_dtable *const dtable, in FSE_init_dtable() argument
2078 dtable->accuracy_log = accuracy_log; in FSE_init_dtable()
2081 dtable->symbols = malloc(size * sizeof(u8)); in FSE_init_dtable()
2082 dtable->num_bits = malloc(size * sizeof(u8)); in FSE_init_dtable()
2083 dtable->new_state_base = malloc(size * sizeof(u16)); in FSE_init_dtable()
2085 if (!dtable->symbols || !dtable->num_bits || !dtable->new_state_base) { in FSE_init_dtable()
2103 dtable->symbols[--high_threshold] = s; in FSE_init_dtable()
2124 dtable->symbols[pos] = s; in FSE_init_dtable()
2142 u8 symbol = dtable->symbols[i]; in FSE_init_dtable()
2146 dtable->num_bits[i] = (u8)(accuracy_log - highest_set_bit(next_state_desc)); in FSE_init_dtable()
2149 dtable->new_state_base[i] = in FSE_init_dtable()
2150 ((u16)next_state_desc << dtable->num_bits[i]) - size; in FSE_init_dtable()
2156 static void FSE_decode_header(FSE_dtable *const dtable, istream_t *const in, in FSE_decode_header() argument
2256 FSE_init_dtable(dtable, frequencies, symb, accuracy_log); in FSE_decode_header()
2259 static void FSE_init_dtable_rle(FSE_dtable *const dtable, const u8 symb) { in FSE_init_dtable_rle() argument
2260 dtable->symbols = malloc(sizeof(u8)); in FSE_init_dtable_rle()
2261 dtable->num_bits = malloc(sizeof(u8)); in FSE_init_dtable_rle()
2262 dtable->new_state_base = malloc(sizeof(u16)); in FSE_init_dtable_rle()
2264 if (!dtable->symbols || !dtable->num_bits || !dtable->new_state_base) { in FSE_init_dtable_rle()
2270 dtable->symbols[0] = symb; in FSE_init_dtable_rle()
2271 dtable->num_bits[0] = 0; in FSE_init_dtable_rle()
2272 dtable->new_state_base[0] = 0; in FSE_init_dtable_rle()
2273 dtable->accuracy_log = 0; in FSE_init_dtable_rle()
2276 static void FSE_free_dtable(FSE_dtable *const dtable) { in FSE_free_dtable() argument
2277 free(dtable->symbols); in FSE_free_dtable()
2278 free(dtable->num_bits); in FSE_free_dtable()
2279 free(dtable->new_state_base); in FSE_free_dtable()
2280 memset(dtable, 0, sizeof(FSE_dtable)); in FSE_free_dtable()