X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fopenjp2%2Fopenjpeg.h;h=a421143a53f0c09299ea7f84226ff557bcf56c8d;hb=c4b3a91ede1d0301f7f5f50287c0bda35aa7ca7e;hp=3b773e977364ed40b74c904714bc225264a6b8e3;hpb=774889a328abd5d3c280d9a897f1ac4c672cb0e5;p=openjpeg.git diff --git a/src/lib/openjp2/openjpeg.h b/src/lib/openjp2/openjpeg.h index 3b773e97..a421143a 100644 --- a/src/lib/openjp2/openjpeg.h +++ b/src/lib/openjp2/openjpeg.h @@ -76,9 +76,15 @@ Most compilers implement their own version of this keyword ... #define OPJ_DEPRECATED(func) func #endif +#if defined(__GNUC__) && __GNUC__ >= 6 +#define OPJ_DEPRECATED_STRUCT_MEMBER(memb, msg) __attribute__ ((deprecated(msg))) memb +#else +#define OPJ_DEPRECATED_STRUCT_MEMBER(memb, msg) memb +#endif + #if defined(OPJ_STATIC) || !defined(_WIN32) /* http://gcc.gnu.org/wiki/Visibility */ -# if __GNUC__ >= 4 +# if !defined(_WIN32) && __GNUC__ >= 4 # if defined(OPJ_STATIC) /* static library uses "hidden" */ # define OPJ_API __attribute__ ((visibility ("hidden"))) # else @@ -116,7 +122,7 @@ typedef float OPJ_FLOAT32; typedef double OPJ_FLOAT64; typedef unsigned char OPJ_BYTE; -#include "opj_stdint.h" +#include typedef int8_t OPJ_INT8; typedef uint8_t OPJ_UINT8; @@ -399,7 +405,7 @@ typedef struct opj_cparameters { int cp_disto_alloc; /** allocation by fixed layer */ int cp_fixed_alloc; - /** add fixed_quality */ + /** allocation by fixed quality (PSNR) */ int cp_fixed_quality; /** fixed layer */ int *cp_matrice; @@ -449,9 +455,9 @@ typedef struct opj_cparameters { char infile[OPJ_PATH_LEN]; /** output file name */ char outfile[OPJ_PATH_LEN]; - /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ + /** DEPRECATED. Index generation is now handled with the opj_encode_with_info() function. Set to NULL */ int index_on; - /** DEPRECATED. Index generation is now handeld with the opj_encode_with_info() function. Set to NULL */ + /** DEPRECATED. Index generation is now handled with the opj_encode_with_info() function. Set to NULL */ char index[OPJ_PATH_LEN]; /** subimage encoding: origin image offset in x direction */ int image_offset_x0; @@ -681,10 +687,10 @@ typedef struct opj_image_comp { OPJ_UINT32 x0; /** y component offset compared to the whole image */ OPJ_UINT32 y0; - /** precision */ + /** precision: number of bits per component per pixel */ OPJ_UINT32 prec; - /** image depth in bits */ - OPJ_UINT32 bpp; + /** obsolete: use prec instead */ + OPJ_DEPRECATED_STRUCT_MEMBER(OPJ_UINT32 bpp, "Use prec instead"); /** signed (1) / unsigned (0) */ OPJ_UINT32 sgnd; /** number of decoded resolution */ @@ -738,10 +744,10 @@ typedef struct opj_image_comptparm { OPJ_UINT32 x0; /** y component offset compared to the whole image */ OPJ_UINT32 y0; - /** precision */ + /** precision: number of bits per component per pixel */ OPJ_UINT32 prec; - /** image depth in bits */ - OPJ_UINT32 bpp; + /** obsolete: use prec instead */ + OPJ_DEPRECATED_STRUCT_MEMBER(OPJ_UINT32 bpp, "Use prec instead"); /** signed (1) / unsigned (0) */ OPJ_UINT32 sgnd; } opj_image_cmptparm_t; @@ -823,9 +829,9 @@ typedef struct opj_tile_info { int pdy[33]; /** information concerning packets inside tile */ opj_packet_info_t *packet; - /** add fixed_quality */ + /** number of pixels of the tile */ int numpix; - /** add fixed_quality */ + /** distortion of the tile */ double distotile; /** number of markers */ int marknum; @@ -1339,6 +1345,20 @@ OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters( OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, opj_dparameters_t *parameters); +/** + * Set strict decoding parameter for this decoder. If strict decoding is enabled, partial bit + * streams will fail to decode. If strict decoding is disabled, the decoder will decode partial + * bitstreams as much as possible without erroring + * + * @param p_codec decompressor handler + * @param strict OPJ_TRUE to enable strict decoding, OPJ_FALSE to disable + * + * @return true if the decoder is correctly set + */ + +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec, + OPJ_BOOL strict); + /** * Allocates worker threads for the compressor/decompressor. * @@ -1348,15 +1368,14 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, * number, or "ALL_CPUS". If OPJ_NUM_THREADS is set and this function is called, * this function will override the behaviour of the environment variable. * - * Currently this function must be called after opj_setup_decoder() and - * before opj_read_header(). - * - * Note: currently only has effect on the decompressor. + * This function must be called after opj_setup_decoder() and + * before opj_read_header() for the decoding side, or after opj_setup_encoder() + * and before opj_start_compress() for the encoding side. * - * @param p_codec decompressor handler + * @param p_codec decompressor or compressor handler * @param num_threads number of threads. * - * @return OPJ_TRUE if the decoder is correctly set + * @return OPJ_TRUE if the function is successful. */ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_codec_set_threads(opj_codec_t *p_codec, int num_threads); @@ -1448,7 +1467,7 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decode(opj_codec_t *p_decompressor, * Get the decoded tile from the codec * * @param p_codec the jpeg2000 codec. - * @param p_stream input streamm + * @param p_stream input stream * @param p_image output image * @param tile_index index of the tile which will be decode * @@ -1580,6 +1599,39 @@ OPJ_API OPJ_BOOL OPJ_CALLCONV opj_setup_encoder(opj_codec_t *p_codec, opj_cparameters_t *parameters, opj_image_t *image); + +/** + * Specify extra options for the encoder. + * + * This may be called after opj_setup_encoder() and before opj_start_compress() + * + * This is the way to add new options in a fully ABI compatible way, without + * extending the opj_cparameters_t structure. + * + * Currently supported options are: + * + * + * @param p_codec Compressor handle + * @param p_options Compression options. This should be a NULL terminated + * array of strings. Each string is of the form KEY=VALUE. + * + * @return OPJ_TRUE in case of success. + * @since 2.4.0 + */ +OPJ_API OPJ_BOOL OPJ_CALLCONV opj_encoder_set_extra_options( + opj_codec_t *p_codec, + const char* const* p_options); + /** * Start to compress the current image. * @param p_codec Compressor handle