1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file       filter_common.h
4 /// \brief      Filter-specific stuff common for both encoder and decoder
5 //
6 //  Author:     Lasse Collin
7 //
8 //  This file has been put into the public domain.
9 //  You can do whatever you want with this file.
10 //
11 ///////////////////////////////////////////////////////////////////////////////
12 
13 #ifndef LZMA_FILTER_COMMON_H
14 #define LZMA_FILTER_COMMON_H
15 
16 #include "common.h"
17 
18 
19 /// Both lzma_filter_encoder and lzma_filter_decoder begin with these members.
20 typedef struct {
21 	/// Filter ID
22 	lzma_vli id;
23 
24 	/// Initializes the filter encoder and calls lzma_next_filter_init()
25 	/// for filters + 1.
26 	lzma_init_function init;
27 
28 	/// Calculates memory usage of the encoder. If the options are
29 	/// invalid, UINT64_MAX is returned.
30 	uint64_t (*memusage)(const void *options);
31 
32 } lzma_filter_coder;
33 
34 
35 typedef const lzma_filter_coder *(*lzma_filter_find)(lzma_vli id);
36 
37 
38 extern lzma_ret lzma_raw_coder_init(
39 		lzma_next_coder *next, const lzma_allocator *allocator,
40 		const lzma_filter *filters,
41 		lzma_filter_find coder_find, bool is_encoder);
42 
43 
44 extern uint64_t lzma_raw_coder_memusage(lzma_filter_find coder_find,
45 		const lzma_filter *filters);
46 
47 
48 #endif
49