| 1 |
/* |
| 2 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 |
* All rights reserved. |
| 4 |
* |
| 5 |
* This source code is licensed under both the BSD-style license (found in the |
| 6 |
* LICENSE file in the root directory of this source tree) and the GPLv2 (found |
| 7 |
* in the COPYING file in the root directory of this source tree). |
| 8 |
* You may select, at your option, one of the above-listed licenses. |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef ZSTD_LAZY_H |
| 12 |
#define ZSTD_LAZY_H |
| 13 |
|
| 14 |
#include "zstd_compress_internal.h" |
| 15 |
|
| 16 |
/** |
| 17 |
* Dedicated Dictionary Search Structure bucket log. In the |
| 18 |
* ZSTD_dedicatedDictSearch mode, the hashTable has |
| 19 |
* 2 ** ZSTD_LAZY_DDSS_BUCKET_LOG entries in each bucket, rather than just |
| 20 |
* one. |
| 21 |
*/ |
| 22 |
#define ZSTD_LAZY_DDSS_BUCKET_LOG 2 |
| 23 |
|
| 24 |
#define ZSTD_ROW_HASH_TAG_BITS 8 /* nb bits to use for the tag */ |
| 25 |
|
| 26 |
#if !defined(ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR) \ |
| 27 |
|| !defined(ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR) \ |
| 28 |
|| !defined(ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR) \ |
| 29 |
|| !defined(ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR) |
| 30 |
U32 ZSTD_insertAndFindFirstIndex(ZSTD_MatchState_t* ms, const BYTE* ip); |
| 31 |
void ZSTD_row_update(ZSTD_MatchState_t* const ms, const BYTE* ip); |
| 32 |
|
| 33 |
void ZSTD_dedicatedDictSearch_lazy_loadDictionary(ZSTD_MatchState_t* ms, const BYTE* const ip); |
| 34 |
|
| 35 |
void ZSTD_preserveUnsortedMark (U32* const table, U32 const size, U32 const reducerValue); /*! used in ZSTD_reduceIndex(). preemptively increase value of ZSTD_DUBT_UNSORTED_MARK */ |
| 36 |
#endif |
| 37 |
|
| 38 |
#ifndef ZSTD_EXCLUDE_GREEDY_BLOCK_COMPRESSOR |
| 39 |
size_t ZSTD_compressBlock_greedy( |
| 40 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 41 |
void const* src, size_t srcSize); |
| 42 |
size_t ZSTD_compressBlock_greedy_row( |
| 43 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 44 |
void const* src, size_t srcSize); |
| 45 |
size_t ZSTD_compressBlock_greedy_dictMatchState( |
| 46 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 47 |
void const* src, size_t srcSize); |
| 48 |
size_t ZSTD_compressBlock_greedy_dictMatchState_row( |
| 49 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 50 |
void const* src, size_t srcSize); |
| 51 |
size_t ZSTD_compressBlock_greedy_dedicatedDictSearch( |
| 52 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 53 |
void const* src, size_t srcSize); |
| 54 |
size_t ZSTD_compressBlock_greedy_dedicatedDictSearch_row( |
| 55 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 56 |
void const* src, size_t srcSize); |
| 57 |
size_t ZSTD_compressBlock_greedy_extDict( |
| 58 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 59 |
void const* src, size_t srcSize); |
| 60 |
size_t ZSTD_compressBlock_greedy_extDict_row( |
| 61 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 62 |
void const* src, size_t srcSize); |
| 63 |
|
| 64 |
#define ZSTD_COMPRESSBLOCK_GREEDY ZSTD_compressBlock_greedy |
| 65 |
#define ZSTD_COMPRESSBLOCK_GREEDY_ROW ZSTD_compressBlock_greedy_row |
| 66 |
#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE ZSTD_compressBlock_greedy_dictMatchState |
| 67 |
#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE_ROW ZSTD_compressBlock_greedy_dictMatchState_row |
| 68 |
#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH ZSTD_compressBlock_greedy_dedicatedDictSearch |
| 69 |
#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_greedy_dedicatedDictSearch_row |
| 70 |
#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT ZSTD_compressBlock_greedy_extDict |
| 71 |
#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT_ROW ZSTD_compressBlock_greedy_extDict_row |
| 72 |
#else |
| 73 |
#define ZSTD_COMPRESSBLOCK_GREEDY NULL |
| 74 |
#define ZSTD_COMPRESSBLOCK_GREEDY_ROW NULL |
| 75 |
#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE NULL |
| 76 |
#define ZSTD_COMPRESSBLOCK_GREEDY_DICTMATCHSTATE_ROW NULL |
| 77 |
#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH NULL |
| 78 |
#define ZSTD_COMPRESSBLOCK_GREEDY_DEDICATEDDICTSEARCH_ROW NULL |
| 79 |
#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT NULL |
| 80 |
#define ZSTD_COMPRESSBLOCK_GREEDY_EXTDICT_ROW NULL |
| 81 |
#endif |
| 82 |
|
| 83 |
#ifndef ZSTD_EXCLUDE_LAZY_BLOCK_COMPRESSOR |
| 84 |
size_t ZSTD_compressBlock_lazy( |
| 85 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 86 |
void const* src, size_t srcSize); |
| 87 |
size_t ZSTD_compressBlock_lazy_row( |
| 88 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 89 |
void const* src, size_t srcSize); |
| 90 |
size_t ZSTD_compressBlock_lazy_dictMatchState( |
| 91 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 92 |
void const* src, size_t srcSize); |
| 93 |
size_t ZSTD_compressBlock_lazy_dictMatchState_row( |
| 94 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 95 |
void const* src, size_t srcSize); |
| 96 |
size_t ZSTD_compressBlock_lazy_dedicatedDictSearch( |
| 97 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 98 |
void const* src, size_t srcSize); |
| 99 |
size_t ZSTD_compressBlock_lazy_dedicatedDictSearch_row( |
| 100 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 101 |
void const* src, size_t srcSize); |
| 102 |
size_t ZSTD_compressBlock_lazy_extDict( |
| 103 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 104 |
void const* src, size_t srcSize); |
| 105 |
size_t ZSTD_compressBlock_lazy_extDict_row( |
| 106 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 107 |
void const* src, size_t srcSize); |
| 108 |
|
| 109 |
#define ZSTD_COMPRESSBLOCK_LAZY ZSTD_compressBlock_lazy |
| 110 |
#define ZSTD_COMPRESSBLOCK_LAZY_ROW ZSTD_compressBlock_lazy_row |
| 111 |
#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE ZSTD_compressBlock_lazy_dictMatchState |
| 112 |
#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE_ROW ZSTD_compressBlock_lazy_dictMatchState_row |
| 113 |
#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH ZSTD_compressBlock_lazy_dedicatedDictSearch |
| 114 |
#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_lazy_dedicatedDictSearch_row |
| 115 |
#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT ZSTD_compressBlock_lazy_extDict |
| 116 |
#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT_ROW ZSTD_compressBlock_lazy_extDict_row |
| 117 |
#else |
| 118 |
#define ZSTD_COMPRESSBLOCK_LAZY NULL |
| 119 |
#define ZSTD_COMPRESSBLOCK_LAZY_ROW NULL |
| 120 |
#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE NULL |
| 121 |
#define ZSTD_COMPRESSBLOCK_LAZY_DICTMATCHSTATE_ROW NULL |
| 122 |
#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH NULL |
| 123 |
#define ZSTD_COMPRESSBLOCK_LAZY_DEDICATEDDICTSEARCH_ROW NULL |
| 124 |
#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT NULL |
| 125 |
#define ZSTD_COMPRESSBLOCK_LAZY_EXTDICT_ROW NULL |
| 126 |
#endif |
| 127 |
|
| 128 |
#ifndef ZSTD_EXCLUDE_LAZY2_BLOCK_COMPRESSOR |
| 129 |
size_t ZSTD_compressBlock_lazy2( |
| 130 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 131 |
void const* src, size_t srcSize); |
| 132 |
size_t ZSTD_compressBlock_lazy2_row( |
| 133 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 134 |
void const* src, size_t srcSize); |
| 135 |
size_t ZSTD_compressBlock_lazy2_dictMatchState( |
| 136 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 137 |
void const* src, size_t srcSize); |
| 138 |
size_t ZSTD_compressBlock_lazy2_dictMatchState_row( |
| 139 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 140 |
void const* src, size_t srcSize); |
| 141 |
size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch( |
| 142 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 143 |
void const* src, size_t srcSize); |
| 144 |
size_t ZSTD_compressBlock_lazy2_dedicatedDictSearch_row( |
| 145 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 146 |
void const* src, size_t srcSize); |
| 147 |
size_t ZSTD_compressBlock_lazy2_extDict( |
| 148 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 149 |
void const* src, size_t srcSize); |
| 150 |
size_t ZSTD_compressBlock_lazy2_extDict_row( |
| 151 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 152 |
void const* src, size_t srcSize); |
| 153 |
|
| 154 |
#define ZSTD_COMPRESSBLOCK_LAZY2 ZSTD_compressBlock_lazy2 |
| 155 |
#define ZSTD_COMPRESSBLOCK_LAZY2_ROW ZSTD_compressBlock_lazy2_row |
| 156 |
#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE ZSTD_compressBlock_lazy2_dictMatchState |
| 157 |
#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE_ROW ZSTD_compressBlock_lazy2_dictMatchState_row |
| 158 |
#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH ZSTD_compressBlock_lazy2_dedicatedDictSearch |
| 159 |
#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH_ROW ZSTD_compressBlock_lazy2_dedicatedDictSearch_row |
| 160 |
#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT ZSTD_compressBlock_lazy2_extDict |
| 161 |
#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT_ROW ZSTD_compressBlock_lazy2_extDict_row |
| 162 |
#else |
| 163 |
#define ZSTD_COMPRESSBLOCK_LAZY2 NULL |
| 164 |
#define ZSTD_COMPRESSBLOCK_LAZY2_ROW NULL |
| 165 |
#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE NULL |
| 166 |
#define ZSTD_COMPRESSBLOCK_LAZY2_DICTMATCHSTATE_ROW NULL |
| 167 |
#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH NULL |
| 168 |
#define ZSTD_COMPRESSBLOCK_LAZY2_DEDICATEDDICTSEARCH_ROW NULL |
| 169 |
#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT NULL |
| 170 |
#define ZSTD_COMPRESSBLOCK_LAZY2_EXTDICT_ROW NULL |
| 171 |
#endif |
| 172 |
|
| 173 |
#ifndef ZSTD_EXCLUDE_BTLAZY2_BLOCK_COMPRESSOR |
| 174 |
size_t ZSTD_compressBlock_btlazy2( |
| 175 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 176 |
void const* src, size_t srcSize); |
| 177 |
size_t ZSTD_compressBlock_btlazy2_dictMatchState( |
| 178 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 179 |
void const* src, size_t srcSize); |
| 180 |
size_t ZSTD_compressBlock_btlazy2_extDict( |
| 181 |
ZSTD_MatchState_t* ms, SeqStore_t* seqStore, U32 rep[ZSTD_REP_NUM], |
| 182 |
void const* src, size_t srcSize); |
| 183 |
|
| 184 |
#define ZSTD_COMPRESSBLOCK_BTLAZY2 ZSTD_compressBlock_btlazy2 |
| 185 |
#define ZSTD_COMPRESSBLOCK_BTLAZY2_DICTMATCHSTATE ZSTD_compressBlock_btlazy2_dictMatchState |
| 186 |
#define ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT ZSTD_compressBlock_btlazy2_extDict |
| 187 |
#else |
| 188 |
#define ZSTD_COMPRESSBLOCK_BTLAZY2 NULL |
| 189 |
#define ZSTD_COMPRESSBLOCK_BTLAZY2_DICTMATCHSTATE NULL |
| 190 |
#define ZSTD_COMPRESSBLOCK_BTLAZY2_EXTDICT NULL |
| 191 |
#endif |
| 192 |
|
| 193 |
#endif /* ZSTD_LAZY_H */ |