libjxl

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

decode.h (3716B)


      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 // This file contains the C API of the decoder part of the libjpegli library,
      7 // which is based on the C API of libjpeg, with the function names changed from
      8 // jpeg_* to jpegli_*, while decompressor object definitions are included
      9 // directly from jpeglib.h
     10 //
     11 // Applications can use the libjpegli library in one of the following ways:
     12 //
     13 //  (1) Include jpegli/encode.h and/or jpegli/decode.h, update the function
     14 //      names of the API and link against libjpegli.
     15 //
     16 //  (2) Leave the application code unchanged, but replace the libjpeg.so library
     17 //      with the one built by this project that is API- and ABI-compatible with
     18 //      libjpeg-turbo's version of libjpeg.so.
     19 
     20 #ifndef LIB_JPEGLI_DECODE_H_
     21 #define LIB_JPEGLI_DECODE_H_
     22 
     23 #include "lib/jpegli/common.h"
     24 
     25 #if defined(__cplusplus) || defined(c_plusplus)
     26 extern "C" {
     27 #endif
     28 
     29 #define jpegli_create_decompress(cinfo)              \
     30   jpegli_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
     31                           (size_t)sizeof(struct jpeg_decompress_struct))
     32 
     33 void jpegli_CreateDecompress(j_decompress_ptr cinfo, int version,
     34                              size_t structsize);
     35 
     36 void jpegli_stdio_src(j_decompress_ptr cinfo, FILE *infile);
     37 
     38 void jpegli_mem_src(j_decompress_ptr cinfo, const unsigned char *inbuffer,
     39                     unsigned long insize);
     40 
     41 int jpegli_read_header(j_decompress_ptr cinfo, boolean require_image);
     42 
     43 boolean jpegli_start_decompress(j_decompress_ptr cinfo);
     44 
     45 JDIMENSION jpegli_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines,
     46                                  JDIMENSION max_lines);
     47 
     48 JDIMENSION jpegli_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines);
     49 
     50 void jpegli_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
     51                           JDIMENSION *width);
     52 
     53 boolean jpegli_finish_decompress(j_decompress_ptr cinfo);
     54 
     55 JDIMENSION jpegli_read_raw_data(j_decompress_ptr cinfo, JSAMPIMAGE data,
     56                                 JDIMENSION max_lines);
     57 
     58 jvirt_barray_ptr *jpegli_read_coefficients(j_decompress_ptr cinfo);
     59 
     60 boolean jpegli_has_multiple_scans(j_decompress_ptr cinfo);
     61 
     62 boolean jpegli_start_output(j_decompress_ptr cinfo, int scan_number);
     63 
     64 boolean jpegli_finish_output(j_decompress_ptr cinfo);
     65 
     66 boolean jpegli_input_complete(j_decompress_ptr cinfo);
     67 
     68 int jpegli_consume_input(j_decompress_ptr cinfo);
     69 
     70 #if JPEG_LIB_VERSION >= 80
     71 void jpegli_core_output_dimensions(j_decompress_ptr cinfo);
     72 #endif
     73 void jpegli_calc_output_dimensions(j_decompress_ptr cinfo);
     74 
     75 void jpegli_save_markers(j_decompress_ptr cinfo, int marker_code,
     76                          unsigned int length_limit);
     77 
     78 void jpegli_set_marker_processor(j_decompress_ptr cinfo, int marker_code,
     79                                  jpeg_marker_parser_method routine);
     80 
     81 boolean jpegli_resync_to_restart(j_decompress_ptr cinfo, int desired);
     82 
     83 boolean jpegli_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr,
     84                                 unsigned int *icc_data_len);
     85 
     86 void jpegli_abort_decompress(j_decompress_ptr cinfo);
     87 
     88 void jpegli_destroy_decompress(j_decompress_ptr cinfo);
     89 
     90 void jpegli_new_colormap(j_decompress_ptr cinfo);
     91 
     92 //
     93 // New API functions that are not available in libjpeg
     94 //
     95 // NOTE: This part of the API is still experimental and will probably change in
     96 // the future.
     97 //
     98 
     99 void jpegli_set_output_format(j_decompress_ptr cinfo, JpegliDataType data_type,
    100                               JpegliEndianness endianness);
    101 
    102 #if defined(__cplusplus) || defined(c_plusplus)
    103 }  // extern "C"
    104 #endif
    105 
    106 #endif  // LIB_JPEGLI_DECODE_H_