1 // SPDX-License-Identifier: 0BSD
3 ///////////////////////////////////////////////////////////////////////////////
5 /// \file simple_private.h
6 /// \brief Private definitions for so called simple filters
8 // Author: Lasse Collin
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef LZMA_SIMPLE_PRIVATE_H
13 #define LZMA_SIMPLE_PRIVATE_H
15 #include "simple_coder.h"
19 /// Next filter in the chain
22 /// True if the next coder in the chain has returned LZMA_STREAM_END.
25 /// True if filter() should encode the data; false to decode.
26 /// Currently all simple filters use the same function for encoding
27 /// and decoding, because the difference between encoders and decoders
31 /// Pointer to filter-specific function, which does
32 /// the actual filtering.
33 size_t (*filter
)(void *simple
, uint32_t now_pos
,
34 bool is_encoder
, uint8_t *buffer
, size_t size
);
36 /// Pointer to filter-specific data, or NULL if filter doesn't need
40 /// The lowest 32 bits of the current position in the data. Most
41 /// filters need this to do conversions between absolute and relative
45 /// Size of the memory allocated for the buffer.
48 /// Flushing position in the temporary buffer. buffer[pos] is the
49 /// next byte to be copied to out[].
52 /// buffer[filtered] is the first unfiltered byte. When pos is smaller
53 /// than filtered, there is unflushed filtered data in the buffer.
56 /// Total number of bytes (both filtered and unfiltered) currently
57 /// in the temporary buffer.
65 extern lzma_ret
lzma_simple_coder_init(lzma_next_coder
*next
,
66 const lzma_allocator
*allocator
,
67 const lzma_filter_info
*filters
,
68 size_t (*filter
)(void *simple
, uint32_t now_pos
,
69 bool is_encoder
, uint8_t *buffer
, size_t size
),
70 size_t simple_size
, size_t unfiltered_max
,
71 uint32_t alignment
, bool is_encoder
);