#define OPJ_TRUE 1
#define OPJ_FALSE 0
-typedef unsigned int OPJ_UINT32;
-typedef int OPJ_INT32;
-typedef unsigned short OPJ_UINT16;
-typedef short OPJ_INT16;
-typedef char OPJ_CHAR;
+typedef char OPJ_CHAR;
+typedef float OPJ_FLOAT32;
+typedef double OPJ_FLOAT64;
typedef unsigned char OPJ_BYTE;
-typedef unsigned int OPJ_SIZE_T;
-typedef double OPJ_FLOAT64;
-typedef float OPJ_FLOAT32;
+typedef size_t OPJ_SIZE_T;
+
+#include "opj_config.h"
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+typedef int8_t OPJ_INT8;
+typedef uint8_t OPJ_UINT8;
+typedef int16_t OPJ_INT16;
+typedef uint16_t OPJ_UINT16;
+typedef int32_t OPJ_INT32;
+typedef uint32_t OPJ_UINT32;
+typedef int64_t OPJ_INT64;
+typedef uint64_t OPJ_UINT64;
+#define OPJ_INT64_F "ll"
+#define OPJ_UINT64_F "ll"
+#else
+#if defined(_WIN32)
+typedef signed __int8 OPJ_INT8;
+typedef unsigned __int8 OPJ_UINT8;
+typedef signed __int16 OPJ_INT16;
+typedef unsigned __int16 OPJ_UINT16;
+typedef signed __int32 OPJ_INT32;
+typedef unsigned __int32 OPJ_UINT32;
+typedef signed __int64 OPJ_INT64;
+typedef unsigned __int64 OPJ_UINT64;
+#define OPJ_INT64_F "I64"
+#define OPJ_UINT64_F "I64"
+#else
+#error unsupported platform
+#endif
+#endif
+
+/* 64-bit file offset type */
+typedef OPJ_INT64 OPJ_OFF_T;
+#define OPJ_OFF_F OPJ_INT64_F
-// Avoid compile-time warning because parameter is not used
+/* Avoid compile-time warning because parameter is not used */
#define OPJ_ARG_NOT_USED(x) (void)(x)
/*
CODEC_UNKNOWN = -1, /**< place-holder */
CODEC_J2K = 0, /**< JPEG-2000 codestream : read/write */
CODEC_JPT = 1, /**< JPT-stream (JPEG 2000, JPIP) : read only */
- CODEC_JP2 = 2, /**< JPEG-2000 file format : read/write */
+ CODEC_JP2 = 2 /**< JPEG-2000 file format : read/write */
} OPJ_CODEC_FORMAT;
/**
opj_bool jpip_on;
} opj_cparameters_t;
+#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
+
/**
* Decompression parameters
* */
*/
OPJ_LIMIT_DECODING cp_limit_decoding;
+ unsigned int flags;
} opj_dparameters_t;
/*
* FIXME DOC
*/
-typedef OPJ_UINT32 (* opj_stream_read_fn) (void * p_buffer, OPJ_UINT32 p_nb_bytes, void * p_user_data) ;
-typedef OPJ_UINT32 (* opj_stream_write_fn) (void * p_buffer, OPJ_UINT32 p_nb_bytes, void * p_user_data) ;
-typedef OPJ_SIZE_T (* opj_stream_skip_fn) (OPJ_SIZE_T p_nb_bytes, void * p_user_data) ;
-typedef opj_bool (* opj_stream_seek_fn) (OPJ_SIZE_T p_nb_bytes, void * p_user_data) ;
+typedef OPJ_SIZE_T (* opj_stream_read_fn) (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data) ;
+typedef OPJ_SIZE_T (* opj_stream_write_fn) (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data) ;
+typedef OPJ_OFF_T (* opj_stream_skip_fn) (OPJ_OFF_T p_nb_bytes, void * p_user_data) ;
+typedef opj_bool (* opj_stream_seek_fn) (OPJ_OFF_T p_nb_bytes, void * p_user_data) ;
/*
* JPEG2000 Stream.
* */
typedef struct opj_packet_info {
/** packet start position (including SOP marker if it exists) */
- int start_pos;
+ OPJ_OFF_T start_pos;
/** end of packet header position (including EPH marker if it exists)*/
- int end_ph_pos;
+ OPJ_OFF_T end_ph_pos;
/** packet end position */
- int end_pos;
+ OPJ_OFF_T end_pos;
/** packet distorsion */
double disto;
} opj_packet_info_t;
/** marker type */
unsigned short int type;
/** position in codestream */
- int pos;
+ OPJ_OFF_T pos;
/** length, marker val included */
int len;
} opj_marker_info_t;
*/
typedef struct opj_tp_index {
/** start position */
- OPJ_UINT32 start_pos;
+ OPJ_OFF_T start_pos;
/** end position of the header */
- OPJ_UINT32 end_header;
+ OPJ_OFF_T end_header;
/** end position */
- OPJ_UINT32 end_pos;
-
-
-
+ OPJ_OFF_T end_pos;
} opj_tp_index_t;
*/
typedef struct opj_codestream_index_ {
/** main header start position (SOC position) */
- OPJ_UINT32 main_head_start;
+ OPJ_OFF_T main_head_start;
/** main header end position (first SOT position) */
- OPJ_UINT32 main_head_end;
+ OPJ_OFF_T main_head_end;
/** codestream's size */
- OPJ_UINT32 codestream_size;
+ OPJ_UINT64 codestream_size;
/* UniPG>> */
/** number of markers */
* @return a stream object.
*/
OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_default_create(opj_bool p_is_input);
-OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_UINT32 p_size, opj_bool p_is_input);
+OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size, opj_bool p_is_input);
/**
* Destroys a stream created by opj_create_stream. This function does NOT close the abstract stream. If needed the user must
* @param p_stream the stream to modify
* @param data_length length of the user_data.
*/
-OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream, OPJ_UINT32 data_length);
+OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream, OPJ_UINT64 data_length);
/**
* Helper function.
* Sets the stream to be a file stream. The FILE must have been open previously.
- * @param p_stream the stream to modify
- * @param p_file handler to an already open file.
+ * @param p_file the file stream to operate on
+ * @param p_is_read_stream whether the stream is a read stream (true) or not (false)
*/
OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream (FILE * p_file, opj_bool p_is_read_stream);
-OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (FILE * p_file, OPJ_UINT32 p_buffer_size, opj_bool p_is_read_stream);
+OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (FILE * p_file, OPJ_SIZE_T p_buffer_size, opj_bool p_is_read_stream);
/* -----------> */
/**
* Decode an image from a JPEG-2000 codestream
- * @param dinfo decompressor handle
+ * @param p_decompressor decompressor handle
* @param cio Input buffer stream
- * @return Returns a decoded image if successful, returns NULL otherwise
+ * @param p_image the decoded image
+ * @return Returns a true on success, otherwise false
* */
OPJ_API opj_bool OPJ_CALLCONV opj_decode_v2(opj_codec_t *p_decompressor,
opj_stream_t * cio,
/**
* Destroy a decompressor handle
*
- * @param dinfo decompressor handle to destroy
+ * @param p_codec decompressor handle to destroy
*/
OPJ_API void OPJ_CALLCONV opj_destroy_codec(opj_codec_t * p_codec);