Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/brotli/c/enc/block_encoder_inc.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 /* NOLINT(build/header_guard) */ | |
| 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 HistogramType FN(Histogram) | |
| 11 | |
| 12 /* Creates entropy codes for all block types and stores them to the bit | |
| 13 stream. */ | |
| 14 static void FN(BuildAndStoreEntropyCodes)(MemoryManager* m, BlockEncoder* self, | |
| 15 const HistogramType* histograms, const size_t histograms_size, | |
| 16 const size_t alphabet_size, HuffmanTree* tree, | |
| 17 size_t* storage_ix, uint8_t* storage) { | |
| 18 const size_t table_size = histograms_size * self->histogram_length_; | |
| 19 self->depths_ = BROTLI_ALLOC(m, uint8_t, table_size); | |
| 20 self->bits_ = BROTLI_ALLOC(m, uint16_t, table_size); | |
| 21 if (BROTLI_IS_OOM(m)) return; | |
| 22 | |
| 23 { | |
| 24 size_t i; | |
| 25 for (i = 0; i < histograms_size; ++i) { | |
| 26 size_t ix = i * self->histogram_length_; | |
| 27 BuildAndStoreHuffmanTree(&histograms[i].data_[0], self->histogram_length_, | |
| 28 alphabet_size, tree, &self->depths_[ix], &self->bits_[ix], | |
| 29 storage_ix, storage); | |
| 30 } | |
| 31 } | |
| 32 } | |
| 33 | |
| 34 #undef HistogramType |
