Lines Matching +full:int +full:- +full:threshold

6  *  - FSE+HUF source repository : https://github.com/Cyan4973/FiniteStateEntropy
7 * - Public forum : https://groups.google.com/forum/#!forum/lz4c
9 * This source code is licensed under both the BSD-style license (found in the
12 * You may select, at your option, one of the above-listed licenses.
38 /*-**************************************************************
39 * FSE NCount encoding-decoding
76 int nbBits; in FSE_readNCount_body()
77 int remaining; in FSE_readNCount_body()
78 int threshold; in FSE_readNCount_body() local
80 int bitCount; in FSE_readNCount_body()
83 int previous0 = 0; in FSE_readNCount_body()
106 threshold = 1<<nbBits; in FSE_readNCount_body()
112 * 2-bit repeat code is 0b11 there is another in FSE_readNCount_body()
116 int repeats = FSE_ctz(~bitStream | 0x80000000) >> 1; in FSE_readNCount_body()
119 if (LIKELY(ip <= iend-7)) { in FSE_readNCount_body()
122 bitCount -= (int)(8 * (iend - 7 - ip)); in FSE_readNCount_body()
124 ip = iend - 4; in FSE_readNCount_body()
148 if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { in FSE_readNCount_body()
153 bitCount -= (int)(8 * (iend - 4 - ip)); in FSE_readNCount_body()
155 ip = iend - 4; in FSE_readNCount_body()
160 int const max = (2*threshold-1) - remaining; in FSE_readNCount_body()
161 int count; in FSE_readNCount_body()
163 if ((bitStream & (threshold-1)) < (U32)max) { in FSE_readNCount_body()
164 count = bitStream & (threshold-1); in FSE_readNCount_body()
165 bitCount += nbBits-1; in FSE_readNCount_body()
167 count = bitStream & (2*threshold-1); in FSE_readNCount_body()
168 if (count >= threshold) count -= max; in FSE_readNCount_body()
172 count--; /* extra accuracy */ in FSE_readNCount_body()
174 * predictable branch, because we don't use -1. in FSE_readNCount_body()
177 remaining -= count; in FSE_readNCount_body()
179 assert(count == -1); in FSE_readNCount_body()
185 assert(threshold > 1); in FSE_readNCount_body()
186 if (remaining < threshold) { in FSE_readNCount_body()
188 * threshold update condition because we in FSE_readNCount_body()
189 * know that threshold > 1. in FSE_readNCount_body()
193 threshold = 1 << (nbBits - 1); in FSE_readNCount_body()
197 if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { in FSE_readNCount_body()
201 bitCount -= (int)(8 * (iend - 4 - ip)); in FSE_readNCount_body()
203 ip = iend - 4; in FSE_readNCount_body()
211 *maxSVPtr = charnum-1; in FSE_readNCount_body()
214 return ip-istart; in FSE_readNCount_body()
236 const void* headerBuffer, size_t hbSize, int bmi2) in FSE_readNCount_bmi2()
275 int bmi2) in HUF_readStats_body()
287 oSize = iSize - 127; in HUF_readStats_body()
299 /* max (hwSize-1) values decoded, as last one is implied */ in HUF_readStats_body()
300 … oSize = FSE_decompress_wksp_bmi2(huffWeight, hwSize-1, ip+1, iSize, 6, workSpace, wkspSize, bmi2); in HUF_readStats_body()
314 /* get last non-null symbol weight (implied, total must be 2^n) */ in HUF_readStats_body()
320 U32 const rest = total - weightTotal; in HUF_readStats_body()
359 int bmi2) in HUF_readStats_wksp()