tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

icc_codec.h (1125B)


      1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file.
      5 
      6 #ifndef LIB_JXL_ICC_CODEC_H_
      7 #define LIB_JXL_ICC_CODEC_H_
      8 
      9 // Compressed representation of ICC profiles.
     10 
     11 #include <jxl/memory_manager.h>
     12 
     13 #include <cstddef>
     14 #include <cstdint>
     15 #include <vector>
     16 
     17 #include "lib/jxl/base/status.h"
     18 #include "lib/jxl/dec_ans.h"
     19 #include "lib/jxl/dec_bit_reader.h"
     20 #include "lib/jxl/padded_bytes.h"
     21 
     22 namespace jxl {
     23 
     24 struct ICCReader {
     25  explicit ICCReader(JxlMemoryManager* memory_manager)
     26      : decompressed_(memory_manager) {}
     27 
     28  Status Init(BitReader* reader);
     29  Status Process(BitReader* reader, PaddedBytes* icc);
     30  void Reset() {
     31    bits_to_skip_ = 0;
     32    decompressed_.clear();
     33  }
     34 
     35 private:
     36  static Status CheckEOI(BitReader* reader);
     37  size_t i_ = 0;
     38  size_t bits_to_skip_ = 0;
     39  size_t used_bits_base_ = 0;
     40  uint64_t enc_size_ = 0;
     41  std::vector<uint8_t> context_map_;
     42  ANSCode code_;
     43  ANSSymbolReader ans_reader_;
     44  PaddedBytes decompressed_;
     45 };
     46 
     47 }  // namespace jxl
     48 
     49 #endif  // LIB_JXL_ICC_CODEC_H_