67static int decode_string(
MLZ* mlz,
unsigned char *buff,
int string_code,
int *first_char_code,
unsigned long bufsize) {
69 unsigned long count,
offset;
70 int current_code, parent_code, tmp_code;
73 current_code = string_code;
76 while (count < bufsize) {
77 switch (current_code) {
83 *first_char_code = current_code;
84 buff[0] = current_code;
98 if ((current_code < 0) || (current_code > (
DIC_INDEX_MAX - 1))) {
123 for (
i = 0;
i <
len; ++
i) {
131 unsigned long output_chars;
132 int string_code, last_string_code, char_code;
136 last_string_code = -1;
139 while (output_chars <
size) {
141 switch (string_code) {
146 last_string_code = -1;
156 if (string_code == (
int) mlz->
bump_code) {
162 int ret =
decode_string(mlz, &buff[output_chars], last_string_code, &char_code,
size - output_chars);
163 if (ret < 0 || ret >
size - output_chars) {
168 ret =
decode_string(mlz, &buff[output_chars], char_code, &char_code,
size - output_chars);
169 if (ret < 0 || ret >
size - output_chars) {
181 int ret =
decode_string(mlz, &buff[output_chars], string_code, &char_code,
size - output_chars);
182 if (ret < 0 || ret >
size - output_chars) {
187 if (output_chars <= size && !mlz->freeze_flag) {
188 if (last_string_code != -1) {
200 last_string_code = string_code;
#define i(width, name, range_min, range_max)
static unsigned int get_bits1(GetBitContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Memory handling functions.
av_cold void ff_mlz_flush_dict(MLZ *mlz)
Flush the dictionary.
int ff_mlz_decompression(MLZ *mlz, GetBitContext *gb, int size, unsigned char *buff)
Run mlz decompression on the next size bits and the output will be stored in buff.
av_cold int ff_mlz_init_dict(void *context, MLZ *mlz)
Initialize the dictionary.
static void set_new_entry_dict(MLZDict *dict, int string_code, int parent_code, int char_code)
static int decode_string(MLZ *mlz, unsigned char *buff, int string_code, int *first_char_code, unsigned long bufsize)
static int input_code(GetBitContext *gb, int len)
Dictionary structure for mlz decompression.
int current_dic_index_max