bitstream.h (1572B)
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_JPEGLI_BITSTREAM_H_ 7 #define LIB_JPEGLI_BITSTREAM_H_ 8 9 #include <initializer_list> 10 #include <vector> 11 12 #include "lib/jpegli/encode_internal.h" 13 14 namespace jpegli { 15 16 void WriteOutput(j_compress_ptr cinfo, const uint8_t* buf, size_t bufsize); 17 void WriteOutput(j_compress_ptr cinfo, const std::vector<uint8_t>& bytes); 18 void WriteOutput(j_compress_ptr cinfo, std::initializer_list<uint8_t> bytes); 19 20 void EncodeAPP0(j_compress_ptr cinfo); 21 void EncodeAPP14(j_compress_ptr cinfo); 22 void WriteFileHeader(j_compress_ptr cinfo); 23 24 // Returns true of only baseline 8-bit tables are used. 25 bool EncodeDQT(j_compress_ptr cinfo, bool write_all_tables); 26 void EncodeSOF(j_compress_ptr cinfo, bool is_baseline); 27 void WriteFrameHeader(j_compress_ptr cinfo); 28 29 void EncodeDRI(j_compress_ptr cinfo); 30 void EncodeDHT(j_compress_ptr cinfo, size_t offset, size_t num); 31 void EncodeSOS(j_compress_ptr cinfo, int scan_index); 32 void WriteScanHeader(j_compress_ptr cinfo, int scan_index); 33 34 void WriteBlock(const int32_t* JXL_RESTRICT symbols, 35 const int32_t* JXL_RESTRICT extra_bits, int num_nonzeros, 36 bool emit_eob, const HuffmanCodeTable* JXL_RESTRICT dc_code, 37 const HuffmanCodeTable* JXL_RESTRICT ac_code, 38 JpegBitWriter* JXL_RESTRICT bw); 39 void WriteScanData(j_compress_ptr cinfo, int scan_index); 40 41 } // namespace jpegli 42 43 #endif // LIB_JPEGLI_BITSTREAM_H_