Lines Matching +full:count +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
48 U32 count = 0; in FSE_ctz()
51 ++count; in FSE_ctz()
53 return count; in FSE_ctz()
67 int threshold; in FSE_readNCount_body() local
95 threshold = 1<<nbBits; in FSE_readNCount_body()
100 /* Count the number of repeats. Each time the in FSE_readNCount_body()
101 * 2-bit repeat code is 0b11 there is another in FSE_readNCount_body()
108 if (LIKELY(ip <= iend-7)) { in FSE_readNCount_body()
111 bitCount -= (int)(8 * (iend - 7 - ip)); in FSE_readNCount_body()
113 ip = iend - 4; in FSE_readNCount_body()
133 /* We don't need to set the normalized count to 0 in FSE_readNCount_body()
137 if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { in FSE_readNCount_body()
142 bitCount -= (int)(8 * (iend - 4 - ip)); in FSE_readNCount_body()
144 ip = iend - 4; in FSE_readNCount_body()
149 int const max = (2*threshold-1) - remaining; in FSE_readNCount_body()
150 int count; in FSE_readNCount_body() local
152 if ((bitStream & (threshold-1)) < (U32)max) { in FSE_readNCount_body()
153 count = bitStream & (threshold-1); in FSE_readNCount_body()
154 bitCount += nbBits-1; in FSE_readNCount_body()
156 count = bitStream & (2*threshold-1); in FSE_readNCount_body()
157 if (count >= threshold) count -= max; in FSE_readNCount_body()
161 count--; /* extra accuracy */ in FSE_readNCount_body()
163 * predictable branch, because we don't use -1. in FSE_readNCount_body()
165 if (count >= 0) { in FSE_readNCount_body()
166 remaining -= count; in FSE_readNCount_body()
168 assert(count == -1); in FSE_readNCount_body()
169 remaining += count; in FSE_readNCount_body()
171 normalizedCounter[charnum++] = (short)count; in FSE_readNCount_body()
172 previous0 = !count; in FSE_readNCount_body()
174 assert(threshold > 1); in FSE_readNCount_body()
175 if (remaining < threshold) { in FSE_readNCount_body()
177 * threshold update condition because we in FSE_readNCount_body()
178 * know that threshold > 1. in FSE_readNCount_body()
182 threshold = 1 << (nbBits - 1); in FSE_readNCount_body()
186 if (LIKELY(ip <= iend-7) || (ip + (bitCount>>3) <= iend-4)) { in FSE_readNCount_body()
190 bitCount -= (int)(8 * (iend - 4 - ip)); in FSE_readNCount_body()
192 ip = iend - 4; in FSE_readNCount_body()
200 *maxSVPtr = charnum-1; in FSE_readNCount_body()
203 return ip-istart; in FSE_readNCount_body()
276 oSize = iSize - 127; in HUF_readStats_body()
288 /* max (hwSize-1) values decoded, as last one is implied */ in HUF_readStats_body()
289 … oSize = FSE_decompress_wksp_bmi2(huffWeight, hwSize-1, ip+1, iSize, 6, workSpace, wkspSize, bmi2); in HUF_readStats_body()
303 /* get last non-null symbol weight (implied, total must be 2^n) */ in HUF_readStats_body()
309 U32 const rest = total - weightTotal; in HUF_readStats_body()