#ifndef DFLTCC_COMMON_H
#define DFLTCC_COMMON_H
#include "zutil.h"
struct dfltcc_qaf_param {
char fns[16];
char reserved1[8];
char fmts[2];
char reserved2[6];
} ALIGNED_(8);
struct dfltcc_param_v0 {
uint16_t pbvn;
uint8_t mvn;
uint8_t ribm;
uint32_t reserved32 : 31;
uint32_t cf : 1;
uint8_t reserved64[8];
uint32_t nt : 1;
uint32_t reserved129 : 1;
uint32_t cvt : 1;
uint32_t reserved131 : 1;
uint32_t htt : 1;
uint32_t bcf : 1;
uint32_t bcc : 1;
uint32_t bhf : 1;
uint32_t reserved136 : 1;
uint32_t reserved137 : 1;
uint32_t dhtgc : 1;
uint32_t reserved139 : 5;
uint32_t reserved144 : 5;
uint32_t sbb : 3;
uint8_t oesc;
uint32_t reserved160 : 12;
uint32_t ifs : 4;
uint16_t ifl;
uint8_t reserved192[8];
uint8_t reserved256[8];
uint8_t reserved320[4];
uint16_t hl;
uint32_t reserved368 : 1;
uint16_t ho : 15;
uint32_t cv;
uint32_t eobs : 15;
uint32_t reserved431: 1;
uint8_t eobl : 4;
uint32_t reserved436 : 12;
uint32_t reserved448 : 4;
uint16_t cdhtl : 12;
uint8_t reserved464[6];
uint8_t cdht[288];
uint8_t reserved[24];
uint8_t ribm2[8];
uint8_t csb[1152];
} ALIGNED_(8);
struct dfltcc_state {
struct dfltcc_param_v0 param;
struct dfltcc_qaf_param af;
char msg[64];
};
typedef struct {
struct dfltcc_state common;
uint16_t level_mask;
uint32_t block_size;
size_t block_threshold;
uint32_t dht_threshold;
} arch_deflate_state;
typedef struct {
struct dfltcc_state common;
} arch_inflate_state;
#define HB_BITS 15
#define HB_SIZE (1 << HB_BITS)
#define DFLTCC_BLOCK_HEADER_BITS 3
#define DFLTCC_HLITS_COUNT_BITS 5
#define DFLTCC_HDISTS_COUNT_BITS 5
#define DFLTCC_HCLENS_COUNT_BITS 4
#define DFLTCC_MAX_HCLENS 19
#define DFLTCC_HCLEN_BITS 3
#define DFLTCC_MAX_HLITS 286
#define DFLTCC_MAX_HDISTS 30
#define DFLTCC_MAX_HLIT_HDIST_BITS 7
#define DFLTCC_MAX_SYMBOL_BITS 16
#define DFLTCC_MAX_EOBS_BITS 15
#define DFLTCC_MAX_PADDING_BITS 7
#define DEFLATE_BOUND_COMPLEN(source_len) \
((DFLTCC_BLOCK_HEADER_BITS + \
DFLTCC_HLITS_COUNT_BITS + \
DFLTCC_HDISTS_COUNT_BITS + \
DFLTCC_HCLENS_COUNT_BITS + \
DFLTCC_MAX_HCLENS * DFLTCC_HCLEN_BITS + \
(DFLTCC_MAX_HLITS + DFLTCC_MAX_HDISTS) * DFLTCC_MAX_HLIT_HDIST_BITS + \
(source_len) * DFLTCC_MAX_SYMBOL_BITS + \
DFLTCC_MAX_EOBS_BITS + \
DFLTCC_MAX_PADDING_BITS) >> 3)
#endif