tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

decode.h (3701B)


      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 #include "lib/jpegli/types.h"
     25 
     26 #ifdef __cplusplus
     27 extern "C" {
     28 #endif
     29 
     30 #define jpegli_create_decompress(cinfo)              \
     31  jpegli_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
     32                          (size_t)sizeof(struct jpeg_decompress_struct))
     33 
     34 void jpegli_CreateDecompress(j_decompress_ptr cinfo, int version,
     35                             size_t structsize);
     36 
     37 void jpegli_stdio_src(j_decompress_ptr cinfo, FILE *infile);
     38 
     39 void jpegli_mem_src(j_decompress_ptr cinfo, const unsigned char *inbuffer,
     40                    unsigned long insize /* NOLINT */);
     41 
     42 int jpegli_read_header(j_decompress_ptr cinfo, boolean require_image);
     43 
     44 boolean jpegli_start_decompress(j_decompress_ptr cinfo);
     45 
     46 JDIMENSION jpegli_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines,
     47                                 JDIMENSION max_lines);
     48 
     49 JDIMENSION jpegli_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines);
     50 
     51 void jpegli_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
     52                          JDIMENSION *width);
     53 
     54 boolean jpegli_finish_decompress(j_decompress_ptr cinfo);
     55 
     56 JDIMENSION jpegli_read_raw_data(j_decompress_ptr cinfo, JSAMPIMAGE data,
     57                                JDIMENSION max_lines);
     58 
     59 jvirt_barray_ptr *jpegli_read_coefficients(j_decompress_ptr cinfo);
     60 
     61 boolean jpegli_has_multiple_scans(j_decompress_ptr cinfo);
     62 
     63 boolean jpegli_start_output(j_decompress_ptr cinfo, int scan_number);
     64 
     65 boolean jpegli_finish_output(j_decompress_ptr cinfo);
     66 
     67 boolean jpegli_input_complete(j_decompress_ptr cinfo);
     68 
     69 int jpegli_consume_input(j_decompress_ptr cinfo);
     70 
     71 #if JPEG_LIB_VERSION >= 80
     72 void jpegli_core_output_dimensions(j_decompress_ptr cinfo);
     73 #endif
     74 void jpegli_calc_output_dimensions(j_decompress_ptr cinfo);
     75 
     76 void jpegli_save_markers(j_decompress_ptr cinfo, int marker_code,
     77                         unsigned int length_limit);
     78 
     79 void jpegli_set_marker_processor(j_decompress_ptr cinfo, int marker_code,
     80                                 jpeg_marker_parser_method routine);
     81 
     82 boolean jpegli_resync_to_restart(j_decompress_ptr cinfo, int desired);
     83 
     84 boolean jpegli_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr,
     85                                unsigned int *icc_data_len);
     86 
     87 void jpegli_abort_decompress(j_decompress_ptr cinfo);
     88 
     89 void jpegli_destroy_decompress(j_decompress_ptr cinfo);
     90 
     91 void jpegli_new_colormap(j_decompress_ptr cinfo);
     92 
     93 //
     94 // New API functions that are not available in libjpeg
     95 //
     96 // NOTE: This part of the API is still experimental and will probably change in
     97 // the future.
     98 //
     99 
    100 void jpegli_set_output_format(j_decompress_ptr cinfo, JpegliDataType data_type,
    101                              JpegliEndianness endianness);
    102 
    103 #ifdef __cplusplus
    104 }  // extern "C"
    105 #endif
    106 
    107 #endif  // LIB_JPEGLI_DECODE_H_