*/
typedef struct opj_image_comp {
/** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
- int dx;
+ OPJ_UINT32 dx;
/** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
- int dy;
+ OPJ_UINT32 dy;
/** data width */
- int w;
+ OPJ_UINT32 w;
/** data height */
- int h;
+ OPJ_UINT32 h;
/** x component offset compared to the whole image */
- int x0;
+ OPJ_UINT32 x0;
/** y component offset compared to the whole image */
- int y0;
+ OPJ_UINT32 y0;
/** precision */
- int prec;
+ OPJ_UINT32 prec;
/** image depth in bits */
- int bpp;
+ OPJ_UINT32 bpp;
/** signed (1) / unsigned (0) */
- int sgnd;
+ OPJ_UINT32 sgnd;
/** number of decoded resolution */
- int resno_decoded;
+ OPJ_UINT32 resno_decoded;
/** number of division by 2 of the out image compared to the original size of image */
- int factor;
+ OPJ_UINT32 factor;
/** image component data */
- int *data;
+ OPJ_INT32 *data;
} opj_image_comp_t;
/**
/** Ysiz: height of the reference grid */
OPJ_UINT32 y1;
/** number of components in the image */
- OPJ_UINT16 numcomps;
+ OPJ_UINT32 numcomps;
/** color space: sRGB, Greyscale or YUV */
OPJ_COLOR_SPACE color_space;
/** image components */
opj_image_comp_t *comps;
/** 'restricted' ICC profile */
- unsigned char *icc_profile_buf;
+ OPJ_BYTE *icc_profile_buf;
/** size of ICC profile */
- int icc_profile_len;
+ OPJ_INT32 icc_profile_len;
} opj_image_t;
-/**
-Defines a single image component characteristics (uses in new API)
-*/
-typedef struct opj_image_comp_header {
- /** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */
- int dx;
- /** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */
- int dy;
- /** data width */
- int w;
- /** data height */
- int h;
- /** x component offset compared to the whole image */
- int x0;
- /** y component offset compared to the whole image */
- int y0;
- /** precision */
- int prec;
- /** image depth in bits */
- int bpp;
- /** signed (1) / unsigned (0) */
- int sgnd;
- /** number of decoded resolution */
- int resno_decoded;
- /** number of division by 2 of the out image compared to the original size of image */
- int factor;
-} opj_image_comp_header_t;
-
-/**
-Defines image characteristics (uses in new API)
-*/
-typedef struct opj_image_header {
- /** XOsiz: horizontal offset from the origin of the reference grid to the left side of the image area */
- OPJ_UINT32 x0;
- /** YOsiz: vertical offset from the origin of the reference grid to the top side of the image area */
- OPJ_UINT32 y0;
- /** Xsiz: width of the reference grid */
- OPJ_UINT32 x1;
- /** Ysiz: height of the reference grid */
- OPJ_UINT32 y1;
- /** number of components in the image */
- OPJ_UINT16 numcomps;
- /** color space: sRGB, Greyscale or YUV */
- OPJ_COLOR_SPACE color_space;
- /** image components */
- opj_image_comp_header_t *comps;
-
- /** 'restricted' ICC profile */
- unsigned char *icc_profile_buf;
- /** size of ICC profile */
- int icc_profile_len;
-} opj_image_header_t;
/*
OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc);
/**
-Deallocate any resources associated with an image
-@param image image to be destroyed
-*/
+ * Deallocate any resources associated with an image
+ * @param image image to be destroyed
+ */
OPJ_API void OPJ_CALLCONV opj_image_destroy(opj_image_t *image);
-/**
- * Deallocate any resources associated with an image header
- *
- * @param image_header image header to be destroyed
- */
-OPJ_API void OPJ_CALLCONV opj_image_header_destroy(opj_image_header_t *image_header);
-
/*
==========================================================
stream functions definitions
*/
OPJ_API void OPJ_CALLCONV opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data);
+/**
+ * Sets the length of the user data for the stream.
+ * @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);
+
/**
* Helper function.
/**
* FIXME DOC
- * FIXME Need to adapt this function to the V2 framework
+ * FIXME DEPRECATED
*/
OPJ_API opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context);
/**
- * Set the default event handler. This function set the output of message event to be stderr for warning and error output
- * and stdout for info output. It is optional, you can set your own event handler or provide a null structure to the
- * opj_setup_decoder function. In this last case no output will be displayed.
+ * Initialize a default event handler. This function set the output of message event to be stderr for warning and error output
+ * and stdout for info output in the verbose mode. In the case of the non-verbose mode only the error message are displayed.
+ * You can initialize your own event handler struct when you fill the field of the event structure. If you provide a null
+ * structure to the opj_setup_decoder function, no output will be displayed.
*
* @param p_manager a opj_event_mgr structure which will be pass to the codec.
*
*/
-OPJ_API void OPJ_CALLCONV opj_set_default_event_handler(opj_event_mgr_t * p_manager, opj_bool verbose);
+OPJ_API void OPJ_CALLCONV opj_initialize_default_event_handler(opj_event_mgr_t * p_manager, opj_bool verbose);
/*
*
* @param dinfo decompressor handlers
* @param parameters decompression parameters
- * @param vent_mgr message handler
+ * @param event_mgr message handler
*
* @return true if the decoder is correctly set
*/
*/
OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_t *cstr_info);
+OPJ_API void OPJ_CALLCONV opj_destroy_cstr_info_v2(opj_codestream_info_v2_t **cstr_info);
/**
* Decodes an image header.
*
* @param p_cio the jpeg2000 stream.
* @param p_codec the jpeg2000 codec to read.
- * @param p_image header of the image hold in the codestream.
+ * @param p_image the image structure initialized with the characteristics of encoded image.
*
* @return true if the main header of the codestream and the JP2 header is correctly read.
*/
OPJ_API opj_bool OPJ_CALLCONV opj_read_header ( opj_stream_t *p_cio,
opj_codec_t *p_codec,
- opj_image_header_t * p_img_header);
+ opj_image_t **p_image);
/**
* Destroy a decompressor handle
*/
OPJ_API opj_codestream_index_t * OPJ_CALLCONV opj_get_cstr_index(opj_codec_t *p_codec);
+OPJ_API void OPJ_CALLCONV opj_destroy_cstr_index(opj_codestream_index_t **p_cstr_index);
+
+
/**
* Get the JP2 file information from the codec FIXME
*
*/
OPJ_API opj_jp2_index_t* OPJ_CALLCONV opj_get_jp2_index(opj_codec_t *p_codec);
+/**
+Decode an image from a JPEG-2000 codestream
+@param dinfo decompressor handle
+@param cio Input buffer stream
+@return Returns a decoded image if successful, returns NULL otherwise
+*/
+OPJ_API opj_bool OPJ_CALLCONV opj_decode_v2(opj_codec_t *p_decompressor,
+ opj_stream_t * cio,
+ opj_image_t *p_image);
+
+OPJ_API opj_bool OPJ_CALLCONV opj_end_decompress ( opj_codec_t *p_codec,
+ opj_stream_t *p_cio);
+
#ifdef __cplusplus
}