diff options
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/dec_ans.cc')
-rw-r--r-- | third_party/jpeg-xl/lib/jxl/dec_ans.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/dec_ans.cc b/third_party/jpeg-xl/lib/jxl/dec_ans.cc index 29d41c8062..8b7b54ce91 100644 --- a/third_party/jpeg-xl/lib/jxl/dec_ans.cc +++ b/third_party/jpeg-xl/lib/jxl/dec_ans.cc @@ -154,7 +154,7 @@ Status ReadHistogram(int precision_bits, std::vector<int32_t>* counts, (*counts)[i] = prev; numsame--; } else { - int code = logcounts[i]; + unsigned int code = logcounts[i]; // omit_pos may not be negative at this point (checked before). if (i == static_cast<size_t>(omit_pos)) { continue; @@ -164,7 +164,7 @@ Status ReadHistogram(int precision_bits, std::vector<int32_t>* counts, (*counts)[i] = 1; } else { int bitcount = GetPopulationCountPrecision(code - 1, shift); - (*counts)[i] = (1 << (code - 1)) + + (*counts)[i] = (1u << (code - 1)) + (input->ReadBits(bitcount) << (code - 1 - bitcount)); } } @@ -260,7 +260,8 @@ Status DecodeUintConfig(size_t log_alpha_size, HybridUintConfig* uint_config, BitReader* br) { br->Refill(); size_t split_exponent = br->ReadBits(CeilLog2Nonzero(log_alpha_size + 1)); - size_t msb_in_token = 0, lsb_in_token = 0; + size_t msb_in_token = 0; + size_t lsb_in_token = 0; if (split_exponent != log_alpha_size) { // otherwise, msb/lsb don't matter. size_t nbits = CeilLog2Nonzero(split_exponent + 1); @@ -284,9 +285,8 @@ Status DecodeUintConfigs(size_t log_alpha_size, std::vector<HybridUintConfig>* uint_config, BitReader* br) { // TODO(veluca): RLE? - for (size_t i = 0; i < uint_config->size(); i++) { - JXL_RETURN_IF_ERROR( - DecodeUintConfig(log_alpha_size, &(*uint_config)[i], br)); + for (auto& cfg : *uint_config) { + JXL_RETURN_IF_ERROR(DecodeUintConfig(log_alpha_size, &cfg, br)); } return true; } @@ -345,7 +345,7 @@ Status DecodeHistograms(BitReader* br, size_t num_contexts, ANSCode* code, 4, "Decoded context map of size %" PRIuS " and %" PRIuS " histograms", num_contexts, num_histograms); code->lz77.nonserialized_distance_context = context_map->back(); - code->use_prefix_code = br->ReadFixedBits<1>(); + code->use_prefix_code = static_cast<bool>(br->ReadFixedBits<1>()); if (code->use_prefix_code) { code->log_alpha_size = PREFIX_MAX_BITS; } else { |