common.h (1503B)
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 common encoder/decoder part of libjpegli 7 // library, which is based on the C API of libjpeg, with the function names 8 // changed from jpeg_* to jpegli_*, while compressor and decompressor object 9 // definitions are included 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_COMMON_H_ 21 #define LIB_JPEGLI_COMMON_H_ 22 23 /* clang-format off */ 24 #include <stdio.h> 25 #include <jpeglib.h> 26 /* clang-format on */ 27 28 #include "lib/jpegli/types.h" 29 30 #if defined(__cplusplus) || defined(c_plusplus) 31 extern "C" { 32 #endif 33 34 struct jpeg_error_mgr* jpegli_std_error(struct jpeg_error_mgr* err); 35 36 void jpegli_abort(j_common_ptr cinfo); 37 38 void jpegli_destroy(j_common_ptr cinfo); 39 40 JQUANT_TBL* jpegli_alloc_quant_table(j_common_ptr cinfo); 41 42 JHUFF_TBL* jpegli_alloc_huff_table(j_common_ptr cinfo); 43 44 #if defined(__cplusplus) || defined(c_plusplus) 45 } // extern "C" 46 #endif 47 48 #endif // LIB_JPEGLI_COMMON_H_