Lines Matching refs:dtable

168 static inline u8 HUF_decode_symbol(const HUF_dtable *const dtable,
172 static inline void HUF_init_state(const HUF_dtable *const dtable,
178 static size_t HUF_decompress_1stream(const HUF_dtable *const dtable,
183 static size_t HUF_decompress_4stream(const HUF_dtable *const dtable,
196 static void HUF_free_dtable(HUF_dtable *const dtable);
217 static inline u8 FSE_peek_symbol(const FSE_dtable *const dtable,
221 static inline void FSE_update_state(const FSE_dtable *const dtable,
226 static inline u8 FSE_decode_symbol(const FSE_dtable *const dtable,
231 static inline void FSE_init_state(const FSE_dtable *const dtable,
238 static size_t FSE_decompress_interleaved2(const FSE_dtable *const dtable,
243 static void FSE_init_dtable(FSE_dtable *const dtable,
249 static void FSE_decode_header(FSE_dtable *const dtable, istream_t *const in,
254 static void FSE_init_dtable_rle(FSE_dtable *const dtable, const u8 symb);
257 static void FSE_free_dtable(FSE_dtable *const dtable);
697 static void decode_huf_table(HUF_dtable *const dtable, istream_t *const in);
868 static void decode_huf_table(HUF_dtable *const dtable, istream_t *const in) { in decode_huf_table() argument
912 HUF_init_dtable_usingweights(dtable, weights, num_symbs); in decode_huf_table()
919 FSE_dtable dtable; in fse_decode_hufweights() local
924 FSE_decode_header(&dtable, in, MAX_ACCURACY_LOG); in fse_decode_hufweights()
927 *num_symbs = FSE_decompress_interleaved2(&dtable, weights, in); in fse_decode_hufweights()
929 FSE_free_dtable(&dtable); in fse_decode_hufweights()
1791 static inline u8 HUF_decode_symbol(const HUF_dtable *const dtable, in HUF_decode_symbol() argument
1795 const u8 symb = dtable->symbols[*state]; in HUF_decode_symbol()
1796 const u8 bits = dtable->num_bits[*state]; in HUF_decode_symbol()
1801 *state = ((*state << bits) + rest) & (((u16)1 << dtable->max_bits) - 1); in HUF_decode_symbol()
1806 static inline void HUF_init_state(const HUF_dtable *const dtable, in HUF_init_state() argument
1810 const u8 bits = dtable->max_bits; in HUF_init_state()
1814 static size_t HUF_decompress_1stream(const HUF_dtable *const dtable, in HUF_decompress_1stream() argument
1838 HUF_init_state(dtable, &state, src, &bit_offset); in HUF_decompress_1stream()
1841 while (bit_offset > -dtable->max_bits) { in HUF_decompress_1stream()
1843 IO_write_byte(out, HUF_decode_symbol(dtable, &state, src, &bit_offset)); in HUF_decompress_1stream()
1856 if (bit_offset != -dtable->max_bits) { in HUF_decompress_1stream()
1863 static size_t HUF_decompress_4stream(const HUF_dtable *const dtable, in HUF_decompress_4stream() argument
1883 total_output += HUF_decompress_1stream(dtable, out, &in1); in HUF_decompress_4stream()
1884 total_output += HUF_decompress_1stream(dtable, out, &in2); in HUF_decompress_4stream()
1885 total_output += HUF_decompress_1stream(dtable, out, &in3); in HUF_decompress_4stream()
1886 total_output += HUF_decompress_1stream(dtable, out, &in4); in HUF_decompress_4stream()
2001 static void HUF_free_dtable(HUF_dtable *const dtable) { in HUF_free_dtable() argument
2002 free(dtable->symbols); in HUF_free_dtable()
2003 free(dtable->num_bits); in HUF_free_dtable()
2004 memset(dtable, 0, sizeof(HUF_dtable)); in HUF_free_dtable()
2013 static inline u8 FSE_peek_symbol(const FSE_dtable *const dtable, in FSE_peek_symbol() argument
2015 return dtable->symbols[state]; in FSE_peek_symbol()
2020 static inline void FSE_update_state(const FSE_dtable *const dtable, in FSE_update_state() argument
2023 const u8 bits = dtable->num_bits[*state]; in FSE_update_state()
2025 *state = dtable->new_state_base[*state] + rest; in FSE_update_state()
2029 static inline u8 FSE_decode_symbol(const FSE_dtable *const dtable, in FSE_decode_symbol() argument
2032 const u8 symb = FSE_peek_symbol(dtable, *state); in FSE_decode_symbol()
2033 FSE_update_state(dtable, state, src, offset); in FSE_decode_symbol()
2037 static inline void FSE_init_state(const FSE_dtable *const dtable, in FSE_init_state() argument
2041 const u8 bits = dtable->accuracy_log; in FSE_init_state()
2045 static size_t FSE_decompress_interleaved2(const FSE_dtable *const dtable, in FSE_decompress_interleaved2() argument
2071 FSE_init_state(dtable, &state1, src, &offset); in FSE_decompress_interleaved2()
2072 FSE_init_state(dtable, &state2, src, &offset); in FSE_decompress_interleaved2()
2084 IO_write_byte(out, FSE_decode_symbol(dtable, &state1, src, &offset)); in FSE_decompress_interleaved2()
2088 IO_write_byte(out, FSE_peek_symbol(dtable, state2)); in FSE_decompress_interleaved2()
2093 IO_write_byte(out, FSE_decode_symbol(dtable, &state2, src, &offset)); in FSE_decompress_interleaved2()
2097 IO_write_byte(out, FSE_peek_symbol(dtable, state1)); in FSE_decompress_interleaved2()
2106 static void FSE_init_dtable(FSE_dtable *const dtable, in FSE_init_dtable() argument
2116 dtable->accuracy_log = accuracy_log; in FSE_init_dtable()
2119 dtable->symbols = malloc(size * sizeof(u8)); in FSE_init_dtable()
2120 dtable->num_bits = malloc(size * sizeof(u8)); in FSE_init_dtable()
2121 dtable->new_state_base = malloc(size * sizeof(u16)); in FSE_init_dtable()
2123 if (!dtable->symbols || !dtable->num_bits || !dtable->new_state_base) { in FSE_init_dtable()
2141 dtable->symbols[--high_threshold] = s; in FSE_init_dtable()
2162 dtable->symbols[pos] = s; in FSE_init_dtable()
2180 u8 symbol = dtable->symbols[i]; in FSE_init_dtable()
2184 dtable->num_bits[i] = (u8)(accuracy_log - highest_set_bit(next_state_desc)); in FSE_init_dtable()
2187 dtable->new_state_base[i] = in FSE_init_dtable()
2188 ((u16)next_state_desc << dtable->num_bits[i]) - size; in FSE_init_dtable()
2194 static void FSE_decode_header(FSE_dtable *const dtable, istream_t *const in, in FSE_decode_header() argument
2294 FSE_init_dtable(dtable, frequencies, symb, accuracy_log); in FSE_decode_header()
2297 static void FSE_init_dtable_rle(FSE_dtable *const dtable, const u8 symb) { in FSE_init_dtable_rle() argument
2298 dtable->symbols = malloc(sizeof(u8)); in FSE_init_dtable_rle()
2299 dtable->num_bits = malloc(sizeof(u8)); in FSE_init_dtable_rle()
2300 dtable->new_state_base = malloc(sizeof(u16)); in FSE_init_dtable_rle()
2302 if (!dtable->symbols || !dtable->num_bits || !dtable->new_state_base) { in FSE_init_dtable_rle()
2308 dtable->symbols[0] = symb; in FSE_init_dtable_rle()
2309 dtable->num_bits[0] = 0; in FSE_init_dtable_rle()
2310 dtable->new_state_base[0] = 0; in FSE_init_dtable_rle()
2311 dtable->accuracy_log = 0; in FSE_init_dtable_rle()
2314 static void FSE_free_dtable(FSE_dtable *const dtable) { in FSE_free_dtable() argument
2315 free(dtable->symbols); in FSE_free_dtable()
2316 free(dtable->num_bits); in FSE_free_dtable()
2317 free(dtable->new_state_base); in FSE_free_dtable()
2318 memset(dtable, 0, sizeof(FSE_dtable)); in FSE_free_dtable()