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