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_EXTRAS_CODEC_PGX_H_ 7 #define LIB_EXTRAS_CODEC_PGX_H_ 8 9 // Encodes/decodes PGX pixels in memory. 10 11 #include <stddef.h> 12 #include <stdint.h> 13 14 #include "lib/jxl/base/data_parallel.h" 15 #include "lib/jxl/base/padded_bytes.h" 16 #include "lib/jxl/base/span.h" 17 #include "lib/jxl/base/status.h" 18 #include "lib/jxl/codec_in_out.h" 19 #include "lib/jxl/color_encoding_internal.h" 20 21 namespace jxl { 22 23 // Decodes `bytes` into `io`. io->dec_hints may specify "color_space", which 24 // defaults to sRGB. 25 Status DecodeImagePGX(const Span<const uint8_t> bytes, ThreadPool* pool, 26 CodecInOut* io); 27 28 // Transforms from io->c_current to `c_desired` and encodes into `bytes`. 29 Status EncodeImagePGX(const CodecInOut* io, const ColorEncoding& c_desired, 30 size_t bits_per_sample, ThreadPool* pool, 31 PaddedBytes* bytes); 32 33 void TestCodecPGX(); 34 } // namespace jxl 35 36 #endif // LIB_EXTRAS_CODEC_PGX_H_ 37