jpg.h (1259B)
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_DEC_JPG_H_ 7 #define LIB_EXTRAS_DEC_JPG_H_ 8 9 // Decodes JPG pixels and metadata in memory. 10 11 #include <stdint.h> 12 13 #include "lib/extras/codec.h" 14 #include "lib/extras/dec/color_hints.h" 15 #include "lib/jxl/base/data_parallel.h" 16 #include "lib/jxl/base/span.h" 17 #include "lib/jxl/base/status.h" 18 19 namespace jxl { 20 21 struct SizeConstraints; 22 23 namespace extras { 24 25 bool CanDecodeJPG(); 26 27 struct JPGDecompressParams { 28 int num_colors = 0; 29 bool two_pass_quant = false; 30 // 0 = none, 1 = ordered, 2 = Floyd-Steinberg 31 int dither_mode = 0; 32 }; 33 34 // Decodes `bytes` into `ppf`. color_hints are ignored. 35 // `elapsed_deinterleave`, if non-null, will be set to the time (in seconds) 36 // that it took to deinterleave the raw JSAMPLEs to planar floats. 37 Status DecodeImageJPG(Span<const uint8_t> bytes, const ColorHints& color_hints, 38 PackedPixelFile* ppf, 39 const SizeConstraints* constraints = nullptr, 40 const JPGDecompressParams* dparams = nullptr); 41 42 } // namespace extras 43 } // namespace jxl 44 45 #endif // LIB_EXTRAS_DEC_JPG_H_