Coverage Report

Created: 2025-12-31 06:23

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
23.6k
bool ANSDecodingData::Init(const std::vector<uint32_t>& counts) {
16
23.6k
  size_t pos = 0;
17
449k
  for (size_t i = 0; i < counts.size(); ++i) {
18
24.6M
    for (size_t j = 0; j < counts[i]; ++j, ++pos) {
19
24.2M
      map_[pos].symbol_ = static_cast<uint8_t>(i);
20
24.2M
      map_[pos].freq_ = static_cast<uint16_t>(counts[i]);
21
24.2M
      map_[pos].offset_ = static_cast<uint16_t>(j);
22
24.2M
    }
23
425k
  }
24
23.6k
  return (pos == BRUNSLI_ANS_TAB_SIZE);
25
23.6k
}
26
27
}  // namespace brunsli