#define OPJ_TRUE 1
#define OPJ_FALSE 0
-// FIXME : should be better defined by configure/CMake test
-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;
-
-#if (defined(WIN32) || defined(WIN64)) && !defined(__MINGW32__)
-typedef signed __int64 OPJ_INT64;
-typedef unsigned __int64 OPJ_UINT64;
+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
-typedef long long OPJ_INT64;
-typedef unsigned long long OPJ_UINT64;
+#error unsupported platform
+#endif
#endif
-/* 64-bit file and blob offset type */
+/* 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;
/**
* 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);