libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

jpegli.h (1640B)


      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_ENC_JPEGLI_H_
      7 #define LIB_EXTRAS_ENC_JPEGLI_H_
      8 
      9 // Encodes JPG pixels and metadata in memory using the libjpegli library.
     10 
     11 #include <stdint.h>
     12 
     13 #include <string>
     14 #include <vector>
     15 
     16 #include "lib/extras/packed_image.h"
     17 #include "lib/jxl/base/data_parallel.h"
     18 #include "lib/jxl/base/status.h"
     19 
     20 namespace jxl {
     21 namespace extras {
     22 
     23 struct JpegSettings {
     24   bool xyb = false;
     25   size_t target_size = 0;
     26   float quality = 0.0f;
     27   float distance = 1.f;
     28   bool use_adaptive_quantization = true;
     29   bool use_std_quant_tables = false;
     30   int progressive_level = 2;
     31   bool optimize_coding = true;
     32   std::string chroma_subsampling;
     33   int libjpeg_quality = 0;
     34   std::string libjpeg_chroma_subsampling;
     35   // Parameters for selecting distance based on PSNR target.
     36   float psnr_target = 0.0f;
     37   float search_tolerance = 0.01;
     38   float min_distance = 0.1f;
     39   float max_distance = 25.0f;
     40   // If not empty, must contain concatenated APP marker segments. In this case,
     41   // these and only these APP marker segments will be written to the JPEG
     42   // output. In xyb mode app_data must not contain an ICC profile, in this
     43   // case an additional APP2 ICC profile for the XYB colorspace will be emitted.
     44   std::vector<uint8_t> app_data;
     45 };
     46 
     47 Status EncodeJpeg(const PackedPixelFile& ppf, const JpegSettings& jpeg_settings,
     48                   ThreadPool* pool, std::vector<uint8_t>* compressed);
     49 
     50 }  // namespace extras
     51 }  // namespace jxl
     52 
     53 #endif  // LIB_EXTRAS_ENC_JPEGLI_H_