Coverage Report

Created: 2026-01-10 06:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/brunsli/c/dec/ans_decode.cc
Line
Count
Source
1
// Copyright (c) Google LLC 2019
2
//
3
// Use of this source code is governed by an MIT-style
4
// license that can be found in the LICENSE file or at
5
// https://opensource.org/licenses/MIT.
6
7
#include "./ans_decode.h"
8
9
#include <vector>
10
11
#include <brunsli/types.h>
12
13
namespace brunsli {
14
15
11.3k
bool ANSDecodingData::Init(const std::vector<uint32_t>& counts) {
16
11.3k
  size_t pos = 0;
17
215k
  for (size_t i = 0; i < counts.size(); ++i) {
18
11.8M
    for (size_t j = 0; j < counts[i]; ++j, ++pos) {
19
11.6M
      map_[pos].symbol_ = static_cast<uint8_t>(i);
20
11.6M
      map_[pos].freq_ = static_cast<uint16_t>(counts[i]);
21
11.6M
      map_[pos].offset_ = static_cast<uint16_t>(j);
22
11.6M
    }
23
204k
  }
24
11.3k
  return (pos == BRUNSLI_ANS_TAB_SIZE);
25
11.3k
}
26
27
}  // namespace brunsli