1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
|
/*
* LZFSE decoder functions
*
* Copyright (C) 2019-2024, Joachim Metz <joachim.metz@gmail.com>
*
* Refer to AUTHORS for acknowledgements.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#if !defined( _LIBFMOS_LZFSE_DECODER_H )
#define _LIBFMOS_LZFSE_DECODER_H
#include <common.h>
#include <types.h>
#include "libfmos_definitions.h"
#include "libfmos_extern.h"
#include "libfmos_libcerror.h"
#include "libfmos_lzfse_bit_stream.h"
#if defined( __cplusplus )
extern "C" {
#endif
typedef struct libfmos_lzfse_decoder_entry libfmos_lzfse_decoder_entry_t;
struct libfmos_lzfse_decoder_entry
{
/* The number of bits
*/
int8_t number_of_bits;
/* The symbol
*/
uint8_t symbol;
/* The delta to compute the next state
*/
int16_t delta;
};
typedef struct libfmos_lzfse_value_decoder_entry libfmos_lzfse_value_decoder_entry_t;
struct libfmos_lzfse_value_decoder_entry
{
/* The (total) number of bits
*/
uint8_t number_of_bits;
/* The value bits
*/
uint8_t value_bits;
/* The delta
*/
int16_t delta;
/* The value base
*/
int32_t value_base;
/* The value bitmask
*/
uint32_t value_bitmask;
};
typedef struct libfmos_lzfse_decoder libfmos_lzfse_decoder_t;
struct libfmos_lzfse_decoder
{
/* The number of literals
*/
uint32_t number_of_literals;
/* The number of L, M, D values
*/
uint32_t number_of_lmd_values;
/* The literals data size
*/
uint32_t literals_data_size;
/* The L, M, D values data size
*/
uint32_t lmd_values_data_size;
/* The literal states
*/
uint16_t literal_states[ 4 ];
/* The L value states
*/
uint16_t l_value_state;
/* The M value states
*/
uint16_t m_value_state;
/* The D value states
*/
uint16_t d_value_state;
/* TODO
*/
int32_t literal_bits;
/* TODO
*/
int32_t lmd_values_bits;
/* The literal decoder table
*/
libfmos_lzfse_decoder_entry_t literal_decoder_table[ LIBFMOS_LZFSE_NUMBER_OF_LITERAL_STATES ];
/* The L value decoder table
*/
libfmos_lzfse_value_decoder_entry_t l_value_decoder_table[ LIBFMOS_LZFSE_NUMBER_OF_L_VALUE_STATES ];
/* The M value decoder table
*/
libfmos_lzfse_value_decoder_entry_t m_value_decoder_table[ LIBFMOS_LZFSE_NUMBER_OF_M_VALUE_STATES ];
/* The D value decoder table
*/
libfmos_lzfse_value_decoder_entry_t d_value_decoder_table[ LIBFMOS_LZFSE_NUMBER_OF_D_VALUE_STATES ];
};
int libfmos_lzfse_decoder_initialize(
libfmos_lzfse_decoder_t **decoder,
libcerror_error_t **error );
int libfmos_lzfse_decoder_free(
libfmos_lzfse_decoder_t **decoder,
libcerror_error_t **error );
#if defined( __cplusplus )
}
#endif
#endif /* !defined( _LIBFMOS_LZFSE_DECODER_H ) */
|