xref: /freebsd/contrib/xz/src/liblzma/api/lzma/delta.h (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1 /**
2  * \file        lzma/delta.h
3  * \brief       Delta filter
4  */
5 
6 /*
7  * Author: Lasse Collin
8  *
9  * This file has been put into the public domain.
10  * You can do whatever you want with this file.
11  *
12  * See ../lzma.h for information about liblzma as a whole.
13  */
14 
15 #ifndef LZMA_H_INTERNAL
16 #	error Never include this file directly. Use <lzma.h> instead.
17 #endif
18 
19 
20 /**
21  * \brief       Filter ID
22  *
23  * Filter ID of the Delta filter. This is used as lzma_filter.id.
24  */
25 #define LZMA_FILTER_DELTA       LZMA_VLI_C(0x03)
26 
27 
28 /**
29  * \brief       Type of the delta calculation
30  *
31  * Currently only byte-wise delta is supported. Other possible types could
32  * be, for example, delta of 16/32/64-bit little/big endian integers, but
33  * these are not currently planned since byte-wise delta is almost as good.
34  */
35 typedef enum {
36 	LZMA_DELTA_TYPE_BYTE
37 } lzma_delta_type;
38 
39 
40 /**
41  * \brief       Options for the Delta filter
42  *
43  * These options are needed by both encoder and decoder.
44  */
45 typedef struct {
46 	/** For now, this must always be LZMA_DELTA_TYPE_BYTE. */
47 	lzma_delta_type type;
48 
49 	/**
50 	 * \brief       Delta distance
51 	 *
52 	 * With the only currently supported type, LZMA_DELTA_TYPE_BYTE,
53 	 * the distance is as bytes.
54 	 *
55 	 * Examples:
56 	 *  - 16-bit stereo audio: distance = 4 bytes
57 	 *  - 24-bit RGB image data: distance = 3 bytes
58 	 */
59 	uint32_t dist;
60 #	define LZMA_DELTA_DIST_MIN 1
61 #	define LZMA_DELTA_DIST_MAX 256
62 
63 	/*
64 	 * Reserved space to allow possible future extensions without
65 	 * breaking the ABI. You should not touch these, because the names
66 	 * of these variables may change. These are and will never be used
67 	 * when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these
68 	 * uninitialized.
69 	 */
70 	uint32_t reserved_int1;
71 	uint32_t reserved_int2;
72 	uint32_t reserved_int3;
73 	uint32_t reserved_int4;
74 	void *reserved_ptr1;
75 	void *reserved_ptr2;
76 
77 } lzma_options_delta;
78