2 * Copyright (c) 2016 Umair Khan <omerjerk@gmail.com>
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #define CODE_BIT_INIT 9
28 #define DIC_INDEX_INIT 512 // 2^9
29 #define DIC_INDEX_MAX 32768 // 2^15
30 #define FLUSH_CODE 256
31 #define FREEZE_CODE 257
32 #define FIRST_CODE 258
33 #define MAX_CODE 32767
34 #define TABLE_SIZE 35023 // TABLE_SIZE must be a prime number
36 /** Dictionary structure for mlz decompression
38 typedef struct MLZDict {
49 int current_dic_index_max;
50 unsigned int bump_code;
51 unsigned int flush_code;
58 /** Initialize the dictionary
60 void ff_mlz_init_dict(void* context, MLZ *mlz);
62 /** Flush the dictionary
64 void ff_mlz_flush_dict(MLZ *dict);
66 /** Run mlz decompression on the next size bits and the output will be stored in buff
68 int ff_mlz_decompression(MLZ* mlz, GetBitContext* gb, int size, unsigned char *buff);
70 #endif /*AVCODEC_MLZ_H*/