2 * \file lzma/alignment.h
3 * \brief Calculating input and output alignment of filter chains
5 * \author Copyright (C) 1999-2006 Igor Pavlov
6 * \author Copyright (C) 2007 Lasse Collin
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
19 #ifndef LZMA_H_INTERNAL
20 # error Never include this file directly. Use <lzma.h> instead.
25 * \brief Calculates the preferred alignment of the input data
29 extern uint32_t lzma_alignment_input(
30 const lzma_filter *filters, uint32_t guess);
34 * \brief Calculates the alignment of the encoded output
36 * Knowing the alignment of the output data is useful e.g. in the Block
37 * encoder which tries to align the Compressed Data field optimally.
39 * \param filters Pointer to lzma_filter array, whose last
40 * member must have .id = LZMA_VLI_UNKNOWN.
41 * \param guess The value to return if the alignment of the output
42 * is the same as the alignment of the input data.
43 * If you want to always detect this special case,
44 * this guess to zero; this function never returns
45 * zero unless guess is zero.
47 * \return In most cases, a small positive integer is returned;
48 * for optimal use, the encoded output of this filter
49 * chain should start at on offset that is a multiple of
50 * the returned integer value.
52 * If the alignment of the output is the same as the input
53 * data (which this function cannot know), \a guess is
56 * If an error occurs (that is, unknown Filter IDs or filter
57 * options), UINT32_MAX is returned.
59 extern uint32_t lzma_alignment_output(
60 const lzma_filter *filters, uint32_t guess);