Lines Matching refs:window

203     ZSTD_window_t window;   /* State for window round buffer management */
222 U32 forceNonContiguous; /* Non-zero if we should force non-contiguous load for the next window update. */
254 ZSTD_window_t window; /* State for the window round buffer management */
863 * over a window of length bytes.
896 * Clears the window containing the history by simply setting it to empty.
898 MEM_STATIC void ZSTD_window_clear(ZSTD_window_t* window)
900 size_t const endT = (size_t)(window->nextSrc - window->base);
903 window->lowLimit = end;
904 window->dictLimit = end;
907 MEM_STATIC U32 ZSTD_window_isEmpty(ZSTD_window_t const window)
909 return window.dictLimit == ZSTD_WINDOW_START_INDEX &&
910 window.lowLimit == ZSTD_WINDOW_START_INDEX &&
911 (window.nextSrc - window.base) == ZSTD_WINDOW_START_INDEX;
916 * Returns non-zero if the window has a non-empty extDict.
918 MEM_STATIC U32 ZSTD_window_hasExtDict(ZSTD_window_t const window)
920 return window.lowLimit < window.dictLimit;
930 return ZSTD_window_hasExtDict(ms->window) ?
954 MEM_STATIC U32 ZSTD_window_canOverflowCorrect(ZSTD_window_t const window,
961 U32 const curr = (U32)((BYTE const*)src - window.base);
971 U32 const adjustment = window.nbOverflowCorrections + 1;
989 MEM_STATIC U32 ZSTD_window_needOverflowCorrection(ZSTD_window_t const window,
996 U32 const curr = (U32)((BYTE const*)srcEnd - window.base);
998 if (ZSTD_window_canOverflowCorrect(window, cycleLog, maxDist, loadedDictEnd, src)) {
1014 MEM_STATIC U32 ZSTD_window_correctOverflow(ZSTD_window_t* window, U32 cycleLog,
1038 U32 const curr = (U32)((BYTE const*)src - window->base);
1060 window->base += correction;
1061 window->dictBase += correction;
1062 if (window->lowLimit < correction + ZSTD_WINDOW_START_INDEX) {
1063 window->lowLimit = ZSTD_WINDOW_START_INDEX;
1065 window->lowLimit -= correction;
1067 if (window->dictLimit < correction + ZSTD_WINDOW_START_INDEX) {
1068 window->dictLimit = ZSTD_WINDOW_START_INDEX;
1070 window->dictLimit -= correction;
1073 /* Ensure we can still reference the full window. */
1077 assert(window->lowLimit <= newCurrent);
1078 assert(window->dictLimit <= newCurrent);
1080 ++window->nbOverflowCorrections;
1083 window->lowLimit);
1102 * as long as the last byte of the dictionary is in the window.
1103 * Once input has progressed beyond window size, dictionary cannot be referenced anymore.
1111 ZSTD_window_enforceMaxDist(ZSTD_window_t* window,
1117 U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base);
1137 if (window->lowLimit < newLowLimit) window->lowLimit = newLowLimit;
1138 if (window->dictLimit < window->lowLimit) {
1140 (unsigned)window->dictLimit, (unsigned)window->lowLimit);
1141 window->dictLimit = window->lowLimit;
1143 /* On reaching window size, dictionaries are invalidated */
1151 * when input progresses beyond window size.
1153 * loadedDictEnd uses same referential as window->base
1154 * maxDist is the window size */
1156 ZSTD_checkDictValidity(const ZSTD_window_t* window,
1164 { U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base);
1171 /* On reaching window size, dictionaries are invalidated.
1172 * For simplification, if window size is reached anywhere within next block,
1184 MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) {
1185 ZSTD_memset(window, 0, sizeof(*window));
1186 window->base = (BYTE const*)" ";
1187 window->dictBase = (BYTE const*)" ";
1189 window->dictLimit = ZSTD_WINDOW_START_INDEX; /* start from >0, so that 1st position is valid */
1190 window->lowLimit = ZSTD_WINDOW_START_INDEX; /* it ensures first and later CCtx usages compress the same */
1191 window->nextSrc = window->base + ZSTD_WINDOW_START_INDEX; /* see issue #1241 */
1192 window->nbOverflowCorrections = 0;
1197 * Updates the window by appending [src, src + srcSize) to the window.
1202 MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window,
1211 assert(window->base != NULL);
1212 assert(window->dictBase != NULL);
1214 if (src != window->nextSrc || forceNonContiguous) {
1216 size_t const distanceFromBase = (size_t)(window->nextSrc - window->base);
1217 DEBUGLOG(5, "Non contiguous blocks, new segment starts at %u", window->dictLimit);
1218 window->lowLimit = window->dictLimit;
1220 window->dictLimit = (U32)distanceFromBase;
1221 window->dictBase = window->base;
1222 window->base = ip - distanceFromBase;
1223 /* ms->nextToUpdate = window->dictLimit; */
1224 if (window->dictLimit - window->lowLimit < HASH_READ_SIZE) window->lowLimit = window->dictLimit; /* too small extDict */
1227 window->nextSrc = ip + srcSize;
1229 if ( (ip+srcSize > window->dictBase + window->lowLimit)
1230 & (ip < window->dictBase + window->dictLimit)) {
1231 ptrdiff_t const highInputIdx = (ip + srcSize) - window->dictBase;
1232 U32 const lowLimitMax = (highInputIdx > (ptrdiff_t)window->dictLimit) ? window->dictLimit : (U32)highInputIdx;
1233 window->lowLimit = lowLimitMax;
1234 DEBUGLOG(5, "Overlapping extDict and input : new lowLimit = %u", window->lowLimit);
1245 U32 const lowestValid = ms->window.lowLimit;
1249 * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't
1262 U32 const lowestValid = ms->window.dictLimit;