Lines Matching refs:counts
79 // especially when population counts are longer than 2**tree_limit, but
245 int OptimizeHuffmanCountsForRle(int length, int* counts) {
256 if (counts[length - 1] != 0) {
257 // Now counts[0..length - 1] does not have trailing zeros.
265 if (counts[i] != 0) {
267 if (smallest_nonzero > counts[i]) {
268 smallest_nonzero = counts[i];
280 if (counts[i - 1] != 0 && counts[i] == 0 && counts[i + 1] != 0) {
281 counts[i] = 1;
290 // 2) Let's mark all population counts that already can be encoded
300 int symbol = counts[0];
303 if (i == length || counts[i] != symbol) {
313 symbol = counts[i];
320 // 3) Let's replace those population counts that lead to more rle codes.
324 limit = 256 * (counts[0] + counts[1] + counts[2]) / 3 + 420;
329 abs(256 * counts[i] - limit) >= streak_limit) {
342 // We don't want to change value at counts[i],
344 counts[i - k - 1] = count;
352 limit = 256 * (counts[i] + counts[i + 1] + counts[i + 2]) / 3 + 420;
354 limit = 256 * counts[i];
361 sum += counts[i];