Backed out 3 changesets (bug 1790375) for causing wd failures on fetch_error.py....
[gecko.git] / third_party / jpeg-xl / lib / jpegli / decode.h
blob9800ebf67a210f03b51b43d77e853db442c2cb03
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
11 // Applications can use the libjpegli library in one of the following ways:
13 // (1) Include jpegli/encode.h and/or jpegli/decode.h, update the function
14 // names of the API and link against libjpegli.
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.
20 #ifndef LIB_JPEGLI_DECODE_H_
21 #define LIB_JPEGLI_DECODE_H_
23 #include "lib/jpegli/common.h"
25 #if defined(__cplusplus) || defined(c_plusplus)
26 extern "C" {
27 #endif
29 #define jpegli_create_decompress(cinfo) \
30 jpegli_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
31 (size_t)sizeof(struct jpeg_decompress_struct))
33 void jpegli_CreateDecompress(j_decompress_ptr cinfo, int version,
34 size_t structsize);
36 void jpegli_stdio_src(j_decompress_ptr cinfo, FILE *infile);
38 void jpegli_mem_src(j_decompress_ptr cinfo, const unsigned char *inbuffer,
39 unsigned long insize);
41 int jpegli_read_header(j_decompress_ptr cinfo, boolean require_image);
43 boolean jpegli_start_decompress(j_decompress_ptr cinfo);
45 JDIMENSION jpegli_read_scanlines(j_decompress_ptr cinfo, JSAMPARRAY scanlines,
46 JDIMENSION max_lines);
48 JDIMENSION jpegli_skip_scanlines(j_decompress_ptr cinfo, JDIMENSION num_lines);
50 void jpegli_crop_scanline(j_decompress_ptr cinfo, JDIMENSION *xoffset,
51 JDIMENSION *width);
53 boolean jpegli_finish_decompress(j_decompress_ptr cinfo);
55 JDIMENSION jpegli_read_raw_data(j_decompress_ptr cinfo, JSAMPIMAGE data,
56 JDIMENSION max_lines);
58 jvirt_barray_ptr *jpegli_read_coefficients(j_decompress_ptr cinfo);
60 boolean jpegli_has_multiple_scans(j_decompress_ptr cinfo);
62 boolean jpegli_start_output(j_decompress_ptr cinfo, int scan_number);
64 boolean jpegli_finish_output(j_decompress_ptr cinfo);
66 boolean jpegli_input_complete(j_decompress_ptr cinfo);
68 int jpegli_consume_input(j_decompress_ptr cinfo);
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);
75 void jpegli_save_markers(j_decompress_ptr cinfo, int marker_code,
76 unsigned int length_limit);
78 void jpegli_set_marker_processor(j_decompress_ptr cinfo, int marker_code,
79 jpeg_marker_parser_method routine);
81 boolean jpegli_resync_to_restart(j_decompress_ptr cinfo, int desired);
83 boolean jpegli_read_icc_profile(j_decompress_ptr cinfo, JOCTET **icc_data_ptr,
84 unsigned int *icc_data_len);
86 void jpegli_abort_decompress(j_decompress_ptr cinfo);
88 void jpegli_destroy_decompress(j_decompress_ptr cinfo);
90 void jpegli_new_colormap(j_decompress_ptr cinfo);
93 // New API functions that are not available in libjpeg
95 // NOTE: This part of the API is still experimental and will probably change in
96 // the future.
99 void jpegli_set_output_format(j_decompress_ptr cinfo, JpegliDataType data_type,
100 JpegliEndianness endianness);
102 #if defined(__cplusplus) || defined(c_plusplus)
103 } // extern "C"
104 #endif
106 #endif // LIB_JPEGLI_DECODE_H_