Coverage Report

Created: 2026-10-28 08:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/ghostpdl/brotli/c/enc/block_encoder_inc.h
Line
Count
Source
1
#if !defined(BROTLI_BASE64_LUT_)
2
#define BROTLI_BASE64_LUT_
3
BROTLI_INTERNAL extern const BROTLI_MODEL("small") uint8_t kIsBase64[256];
4
#endif
5
6
#define HistogramType FN(Histogram)
7
8
static void FN(BuildAndStoreEntropyCodes)(
9
    MemoryManager* m, BlockEncoder* self, const HistogramType* histograms,
10
    const size_t histograms_size, const size_t alphabet_size, HuffmanTree* tree,
11
0
    const uint8_t* is_base64_histogram, size_t* storage_ix, uint8_t* storage) {
12
0
  const size_t table_size = histograms_size * self->histogram_length_;
13
0
  self->depths_ = BROTLI_ALLOC(m, uint8_t, table_size);
14
0
  self->bits_ = BROTLI_ALLOC(m, uint16_t, table_size);
15
0
  if (BROTLI_IS_OOM(m)) return;
16
17
0
  {
18
0
    size_t i;
19
0
    for (i = 0; i < histograms_size; ++i) {
20
0
      size_t ix = i * self->histogram_length_;
21
0
      if (self->histogram_length_ == 256 && is_base64_histogram && i < 256 &&
22
0
          is_base64_histogram[i]) {
23
0
        size_t k;
24
0
        BROTLI_BOOL all_base64 = BROTLI_TRUE;
25
0
        for (k = 0; k < 256; ++k) {
26
0
          if (histograms[i].data_[k] > 0 && !kIsBase64[k]) {
27
0
            all_base64 = BROTLI_FALSE;
28
0
            break;
29
0
          }
30
0
        }
31
0
        if (all_base64) {
32
0
          memset(&self->depths_[ix], 0, 256);
33
0
          for (k = 0; k < 256; ++k) {
34
0
            if (kIsBase64[k]) {
35
0
              self->depths_[ix + k] = 6;
36
0
            }
37
0
          }
38
0
          BrotliConvertBitDepthsToSymbols(&self->depths_[ix], 256,
39
0
                                          &self->bits_[ix]);
40
0
          BrotliStoreHuffmanTree(&self->depths_[ix], 256, tree, storage_ix,
41
0
                                 storage);
42
0
        } else {
43
0
          BuildAndStoreHuffmanTree(
44
0
              &histograms[i].data_[0], self->histogram_length_, alphabet_size,
45
0
              tree, &self->depths_[ix], &self->bits_[ix], storage_ix, storage);
46
0
        }
47
0
      } else {
48
0
        BuildAndStoreHuffmanTree(
49
0
            &histograms[i].data_[0], self->histogram_length_, alphabet_size,
50
0
            tree, &self->depths_[ix], &self->bits_[ix], storage_ix, storage);
51
0
      }
52
0
    }
53
0
  }
54
0
}
Unexecuted instantiation: brotli_bit_stream.c:BuildAndStoreEntropyCodesLiteral
Unexecuted instantiation: brotli_bit_stream.c:BuildAndStoreEntropyCodesCommand
Unexecuted instantiation: brotli_bit_stream.c:BuildAndStoreEntropyCodesDistance
55
56
#undef HistogramType