Home | History | Annotate | Line # | Download | only in lzma
      1 /* SPDX-License-Identifier: 0BSD */
      2 
      3 /**
      4  * \file        lzma/delta.h
      5  * \brief       Delta filter
      6  * \note        Never include this file directly. Use <lzma.h> instead.
      7  */
      8 
      9 /*
     10  * Author: Lasse Collin
     11  */
     12 
     13 #ifndef LZMA_H_INTERNAL
     14 #	error Never include this file directly. Use <lzma.h> instead.
     15 #endif
     16 
     17 
     18 /**
     19  * \brief       Filter ID
     20  *
     21  * Filter ID of the Delta filter. This is used as lzma_filter.id.
     22  */
     23 #define LZMA_FILTER_DELTA       LZMA_VLI_C(0x03)
     24 
     25 
     26 /**
     27  * \brief       Type of the delta calculation
     28  *
     29  * Currently only byte-wise delta is supported. Other possible types could
     30  * be, for example, delta of 16/32/64-bit little/big endian integers, but
     31  * these are not currently planned since byte-wise delta is almost as good.
     32  */
     33 typedef enum {
     34 	LZMA_DELTA_TYPE_BYTE
     35 } lzma_delta_type;
     36 
     37 
     38 /**
     39  * \brief       Options for the Delta filter
     40  *
     41  * These options are needed by both encoder and decoder.
     42  */
     43 typedef struct {
     44 	/** For now, this must always be LZMA_DELTA_TYPE_BYTE. */
     45 	lzma_delta_type type;
     46 
     47 	/**
     48 	 * \brief       Delta distance
     49 	 *
     50 	 * With the only currently supported type, LZMA_DELTA_TYPE_BYTE,
     51 	 * the distance is as bytes.
     52 	 *
     53 	 * Examples:
     54 	 *  - 16-bit stereo audio: distance = 4 bytes
     55 	 *  - 24-bit RGB image data: distance = 3 bytes
     56 	 */
     57 	uint32_t dist;
     58 
     59 	/**
     60 	 * \brief       Minimum value for lzma_options_delta.dist.
     61 	 */
     62 #	define LZMA_DELTA_DIST_MIN 1
     63 
     64 	/**
     65 	 * \brief       Maximum value for lzma_options_delta.dist.
     66 	 */
     67 #	define LZMA_DELTA_DIST_MAX 256
     68 
     69 	/*
     70 	 * Reserved space to allow possible future extensions without
     71 	 * breaking the ABI. You should not touch these, because the names
     72 	 * of these variables may change. These are and will never be used
     73 	 * when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these
     74 	 * uninitialized.
     75 	 */
     76 
     77 	/** \private     Reserved member. */
     78 	uint32_t reserved_int1;
     79 
     80 	/** \private     Reserved member. */
     81 	uint32_t reserved_int2;
     82 
     83 	/** \private     Reserved member. */
     84 	uint32_t reserved_int3;
     85 
     86 	/** \private     Reserved member. */
     87 	uint32_t reserved_int4;
     88 
     89 	/** \private     Reserved member. */
     90 	void *reserved_ptr1;
     91 
     92 	/** \private     Reserved member. */
     93 	void *reserved_ptr2;
     94 
     95 } lzma_options_delta;
     96