| 1 | /* NOLINT(build/header_guard) */cxx . . $ `<file>/c/enc/block_encoder_inc.h`/ |
| 2 | /* Copyright 2014 Google Inc. All Rights Reserved. |
| 3 | |
| 4 | Distributed under MIT license. |
| 5 | See file LICENSE for detail or copy at https://opensource.org/licenses/MIT |
| 6 | */ |
| 7 | |
| 8 | /* template parameters: FN */ |
| 9 | |
| 10 | #define HistogramTypecxx . . $ `c/enc/block_encoder_inc.h:10:9`! FNcxx . . $ `c/enc/brotli_bit_stream.c:925:9`!(Histogram) |
| 11 | |
| 12 | /* Creates entropy codes for all block types and stores them to the bit |
| 13 | stream. */ |
| 14 | static void FNcxx . . $ `c/enc/brotli_bit_stream.c:925:9`!(BuildAndStoreEntropyCodes)(MemoryManagercxx . . $ MemoryManager#* m, BlockEncodercxx . . $ BlockEncoder#* self, |
| 15 | const HistogramTypecxx . . $ `c/enc/block_encoder_inc.h:10:9`!* histograms, const size_t histograms_size, |
| 16 | const size_t alphabet_size, HuffmanTreecxx . . $ HuffmanTree#* tree, |
| 17 | size_t* storage_ix, uint8_tcxx . . $ uint8_t#* storage) { |
| 18 | const size_t table_size = histograms_size * self->histogram_length_cxx . . $ BlockEncoder#histogram_length_.; |
| 19 | self->depths_cxx . . $ BlockEncoder#depths_. = BROTLI_ALLOCcxx . . $ `c/enc/memory.h:51:9`!(m, uint8_t, table_size); |
| 20 | self->bits_cxx . . $ BlockEncoder#bits_. = BROTLI_ALLOCcxx . . $ `c/enc/memory.h:51:9`!(m, uint16_t, table_size); |
| 21 | if (BROTLI_IS_OOMcxx . . $ `c/enc/memory.h:61:9`!(m)) return; |
| 22 | |
| 23 | { |
| 24 | size_t i; |
| 25 | for (i = 0; i < histograms_size; ++i) { |
| 26 | size_t ix = i * self->histogram_length_cxx . . $ BlockEncoder#histogram_length_.; |
| 27 | BuildAndStoreHuffmanTreecxx . . $ BuildAndStoreHuffmanTree(a115412a92217ef9).(&histograms[i].data_cxx . . $ HistogramCommand#data_.[0], self->histogram_length_cxx . . $ BlockEncoder#histogram_length_., |
| 28 | alphabet_size, tree, &self->depths_cxx . . $ BlockEncoder#depths_.[ix], &self->bits_cxx . . $ BlockEncoder#bits_.[ix], |
| 29 | storage_ix, storage); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | #undef HistogramTypecxx . . $ `c/enc/block_encoder_inc.h:10:9`! |