enc_quant_weights.h (1702B)
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_ENC_QUANT_WEIGHTS_H_ 7 #define LIB_JXL_ENC_QUANT_WEIGHTS_H_ 8 9 #include <jxl/memory_manager.h> 10 11 #include <cstdint> 12 #include <vector> 13 14 #include "lib/jxl/base/status.h" 15 #include "lib/jxl/quant_weights.h" 16 17 namespace jxl { 18 19 struct AuxOut; 20 enum class LayerType : uint8_t; 21 struct BitWriter; 22 23 Status DequantMatricesEncode( 24 JxlMemoryManager* memory_manager, const DequantMatrices& matrices, 25 BitWriter* writer, LayerType layer, AuxOut* aux_out, 26 ModularFrameEncoder* modular_frame_encoder = nullptr); 27 Status DequantMatricesEncodeDC(const DequantMatrices& matrices, 28 BitWriter* writer, LayerType layer, 29 AuxOut* aux_out); 30 // For consistency with QuantEncoding, higher values correspond to more 31 // precision. 32 Status DequantMatricesSetCustomDC(JxlMemoryManager* memory_manager, 33 DequantMatrices* matrices, const float* dc); 34 35 Status DequantMatricesScaleDC(JxlMemoryManager* memory_manager, 36 DequantMatrices* matrices, float scale); 37 38 Status DequantMatricesSetCustom(DequantMatrices* matrices, 39 const std::vector<QuantEncoding>& encodings, 40 ModularFrameEncoder* encoder); 41 42 // Roundtrip encode/decode the matrices to ensure same values as decoder. 43 Status DequantMatricesRoundtrip(JxlMemoryManager* memory_manager, 44 DequantMatrices* matrices); 45 46 } // namespace jxl 47 48 #endif // LIB_JXL_ENC_QUANT_WEIGHTS_H_