Lines Matching full:window
147 ZSTD_window_t window; /* State for window round buffer management */ member
190 ZSTD_window_t window; /* State for the window round buffer management */ member
204 U32 windowLog; /* Window log for the LDM */
737 * over a window of length bytes.
770 * Clears the window containing the history by simply setting it to empty.
772 MEM_STATIC void ZSTD_window_clear(ZSTD_window_t* window) in ZSTD_window_clear() argument
774 size_t const endT = (size_t)(window->nextSrc - window->base); in ZSTD_window_clear()
777 window->lowLimit = end; in ZSTD_window_clear()
778 window->dictLimit = end; in ZSTD_window_clear()
783 * Returns non-zero if the window has a non-empty extDict.
785 MEM_STATIC U32 ZSTD_window_hasExtDict(ZSTD_window_t const window) in ZSTD_window_hasExtDict() argument
787 return window.lowLimit < window.dictLimit; in ZSTD_window_hasExtDict()
797 return ZSTD_window_hasExtDict(ms->window) ? in ZSTD_matchState_dictMode()
809 MEM_STATIC U32 ZSTD_window_needOverflowCorrection(ZSTD_window_t const window, in ZSTD_window_needOverflowCorrection() argument
812 U32 const curr = (U32)((BYTE const*)srcEnd - window.base); in ZSTD_window_needOverflowCorrection()
826 MEM_STATIC U32 ZSTD_window_correctOverflow(ZSTD_window_t* window, U32 cycleLog, in ZSTD_window_correctOverflow() argument
849 U32 const curr = (U32)((BYTE const*)src - window->base); in ZSTD_window_correctOverflow()
860 window->base += correction; in ZSTD_window_correctOverflow()
861 window->dictBase += correction; in ZSTD_window_correctOverflow()
862 if (window->lowLimit <= correction) window->lowLimit = 1; in ZSTD_window_correctOverflow()
863 else window->lowLimit -= correction; in ZSTD_window_correctOverflow()
864 if (window->dictLimit <= correction) window->dictLimit = 1; in ZSTD_window_correctOverflow()
865 else window->dictLimit -= correction; in ZSTD_window_correctOverflow()
867 /* Ensure we can still reference the full window. */ in ZSTD_window_correctOverflow()
871 assert(window->lowLimit <= newCurrent); in ZSTD_window_correctOverflow()
872 assert(window->dictLimit <= newCurrent); in ZSTD_window_correctOverflow()
875 window->lowLimit); in ZSTD_window_correctOverflow()
894 * as long as the last byte of the dictionary is in the window.
895 * Once input has progressed beyond window size, dictionary cannot be referenced anymore.
903 ZSTD_window_enforceMaxDist(ZSTD_window_t* window, in ZSTD_window_enforceMaxDist() argument
909 U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); in ZSTD_window_enforceMaxDist()
929 if (window->lowLimit < newLowLimit) window->lowLimit = newLowLimit; in ZSTD_window_enforceMaxDist()
930 if (window->dictLimit < window->lowLimit) { in ZSTD_window_enforceMaxDist()
932 (unsigned)window->dictLimit, (unsigned)window->lowLimit); in ZSTD_window_enforceMaxDist()
933 window->dictLimit = window->lowLimit; in ZSTD_window_enforceMaxDist()
935 /* On reaching window size, dictionaries are invalidated */ in ZSTD_window_enforceMaxDist()
943 * when input progresses beyond window size.
945 * loadedDictEnd uses same referential as window->base
946 * maxDist is the window size */
948 ZSTD_checkDictValidity(const ZSTD_window_t* window, in ZSTD_checkDictValidity() argument
956 { U32 const blockEndIdx = (U32)((BYTE const*)blockEnd - window->base); in ZSTD_checkDictValidity()
963 /* On reaching window size, dictionaries are invalidated. in ZSTD_checkDictValidity()
964 * For simplification, if window size is reached anywhere within next block, in ZSTD_checkDictValidity()
976 MEM_STATIC void ZSTD_window_init(ZSTD_window_t* window) { in ZSTD_window_init() argument
977 ZSTD_memset(window, 0, sizeof(*window)); in ZSTD_window_init()
978 window->base = (BYTE const*)""; in ZSTD_window_init()
979 window->dictBase = (BYTE const*)""; in ZSTD_window_init()
980 window->dictLimit = 1; /* start from 1, so that 1st position is valid */ in ZSTD_window_init()
981 window->lowLimit = 1; /* it ensures first and later CCtx usages compress the same */ in ZSTD_window_init()
982 window->nextSrc = window->base + 1; /* see issue #1241 */ in ZSTD_window_init()
987 * Updates the window by appending [src, src + srcSize) to the window.
992 MEM_STATIC U32 ZSTD_window_update(ZSTD_window_t* window, in ZSTD_window_update() argument
1000 assert(window->base != NULL); in ZSTD_window_update()
1001 assert(window->dictBase != NULL); in ZSTD_window_update()
1003 if (src != window->nextSrc) { in ZSTD_window_update()
1005 size_t const distanceFromBase = (size_t)(window->nextSrc - window->base); in ZSTD_window_update()
1006 DEBUGLOG(5, "Non contiguous blocks, new segment starts at %u", window->dictLimit); in ZSTD_window_update()
1007 window->lowLimit = window->dictLimit; in ZSTD_window_update()
1009 window->dictLimit = (U32)distanceFromBase; in ZSTD_window_update()
1010 window->dictBase = window->base; in ZSTD_window_update()
1011 window->base = ip - distanceFromBase; in ZSTD_window_update()
1012 /* ms->nextToUpdate = window->dictLimit; */ in ZSTD_window_update()
1013 …if (window->dictLimit - window->lowLimit < HASH_READ_SIZE) window->lowLimit = window->dictLimit; … in ZSTD_window_update()
1016 window->nextSrc = ip + srcSize; in ZSTD_window_update()
1018 if ( (ip+srcSize > window->dictBase + window->lowLimit) in ZSTD_window_update()
1019 & (ip < window->dictBase + window->dictLimit)) { in ZSTD_window_update()
1020 ptrdiff_t const highInputIdx = (ip + srcSize) - window->dictBase; in ZSTD_window_update()
1021 …U32 const lowLimitMax = (highInputIdx > (ptrdiff_t)window->dictLimit) ? window->dictLimit : (U32)h… in ZSTD_window_update()
1022 window->lowLimit = lowLimitMax; in ZSTD_window_update()
1023 DEBUGLOG(5, "Overlapping extDict and input : new lowLimit = %u", window->lowLimit); in ZSTD_window_update()
1034 U32 const lowestValid = ms->window.lowLimit; in ZSTD_getLowestMatchIndex()
1038 * is within the window. We invalidate the dictionary (and set loadedDictEnd to 0) when it isn't in ZSTD_getLowestMatchIndex()
1051 U32 const lowestValid = ms->window.dictLimit; in ZSTD_getLowestPrefixIndex()