diff options
Diffstat (limited to 'lib/extras/dec/pnm.h')
-rw-r--r-- | lib/extras/dec/pnm.h | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/lib/extras/dec/pnm.h b/lib/extras/dec/pnm.h index f637483..9b68e56 100644 --- a/lib/extras/dec/pnm.h +++ b/lib/extras/dec/pnm.h @@ -17,21 +17,43 @@ #include "lib/extras/dec/color_hints.h" #include "lib/extras/packed_image.h" #include "lib/jxl/base/data_parallel.h" -#include "lib/jxl/base/padded_bytes.h" #include "lib/jxl/base/span.h" #include "lib/jxl/base/status.h" -#include "lib/jxl/codec_in_out.h" namespace jxl { + +struct SizeConstraints; + namespace extras { // Decodes `bytes` into `ppf`. color_hints may specify "color_space", which // defaults to sRGB. Status DecodeImagePNM(Span<const uint8_t> bytes, const ColorHints& color_hints, - const SizeConstraints& constraints, PackedPixelFile* ppf); + PackedPixelFile* ppf, + const SizeConstraints* constraints = nullptr); void TestCodecPNM(); +struct HeaderPNM { + size_t xsize; + size_t ysize; + bool is_gray; // PGM + bool has_alpha; // PAM + size_t bits_per_sample; + bool floating_point; + bool big_endian; + std::vector<JxlExtraChannelType> ec_types; // PAM +}; + +struct ChunkedPNMDecoder { + FILE* f; + HeaderPNM header = {}; + size_t data_start; +}; + +Status DecodeImagePNM(ChunkedPNMDecoder* dec, const ColorHints& color_hints, + PackedPixelFile* ppf); + } // namespace extras } // namespace jxl |