#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 double OPJ_FLOAT64;
typedef float OPJ_FLOAT32;
-// Avoid compile-time warning because parameter is not used
+#if (defined(WIN32) || defined(WIN64)) && !defined(__MINGW32__)
+
+typedef signed __int64 OPJ_INT64;
+#define OPJ_INT64_F "I64"
+typedef unsigned __int64 OPJ_UINT64;
+#define OPJ_UINT64_F "I64"
+
+#else
+
+typedef long long OPJ_INT64;
+#define OPJ_INT64_F "ll"
+
+typedef unsigned long long OPJ_UINT64;
+#define OPJ_UINT64_F "ll"
+
+#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 */
#define OPJ_ARG_NOT_USED(x) (void)(x)
/*
opj_bool jpip_on;
} opj_cparameters_t;
+#define OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG 0x0001
+
/**
* Decompression parameters
* */
/** Verbose mode */
opj_bool m_verbose;
+ /** tile number ot the decoded tile*/
+ OPJ_UINT32 tile_index;
+ /** Nb of tile to decode */
+ OPJ_UINT32 nb_tile_to_decode;
+
/*@}*/
/* UniPG>> */
*/
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);
/**
* 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,
* @param p_image output image
* @param tile_index index of the tile which will be decode
*
- * @return a pointer to a JP2 index structure.
+ * @return opj_true if all is ok.
*/
OPJ_API opj_bool OPJ_CALLCONV opj_get_decoded_tile( opj_codec_t *p_codec,
opj_stream_t *p_cio,
opj_image_t *p_image,
OPJ_UINT32 tile_index);
+
+/**
+ * Set the resolution factor of the decoded image
+ * @param p_codec the jpeg2000 codec.
+ * @param res_factor resolution factor to set
+ *
+ * @return opj_true if all is ok.
+ */
+OPJ_API opj_bool OPJ_CALLCONV opj_set_decoded_resolution_factor(opj_codec_t *p_codec, OPJ_UINT32 res_factor);
+
+
+
/**
* Reads a tile header. This function is compulsory and allows one to know the size of the tile thta will be decoded.
* The user may need to refer to the image got by opj_read_header to understand the size being taken by the tile.
/**
* 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);