From f16216e2708c3b480f726d64b589f092bbc48b02 Mon Sep 17 00:00:00 2001 From: Mickael Savinaud Date: Thu, 30 Aug 2012 16:56:31 +0000 Subject: [PATCH] [trunk] STYLE: Clean up documentation errors Functions should only have formal documentation in one place, and preferably in the declaration (i.e. repeated documentaiton should not be at both the declaration and the definition, because it causes too much maintenance to keep them syncronized). In cases where the definition is also the declaration (as is often the case for static functions in the .c files) the documentation was preserved at the first use of the function signature. Functions that are formally documented should contain documentation for each function argument. The clang 3.1 compiler issues documentation warnings when the documentation block with @params preceeding a declaration does not match the argument list. This patch set follows a convention used elsewere in openjpeg to add a placeholder FIXME DOC description where one was previously missing. Thanks to Hans Johnson. --- libopenjpeg/cio.c | 197 -------- libopenjpeg/j2k.c | 973 ++++++---------------------------------- libopenjpeg/j2k.h | 46 +- libopenjpeg/jp2.c | 443 +++--------------- libopenjpeg/jp2.h | 58 ++- libopenjpeg/jpwl/jpwl.c | 5 +- libopenjpeg/openjpeg.c | 105 +---- libopenjpeg/openjpeg.h | 38 +- libopenjpeg/pi.c | 186 +------- libopenjpeg/pi.h | 29 +- libopenjpeg/t1.h | 1 + libopenjpeg/t2.c | 21 +- libopenjpeg/t2.h | 13 +- libopenjpeg/tcd.c | 223 +++++---- libopenjpeg/tcd.h | 6 +- 15 files changed, 477 insertions(+), 1867 deletions(-) diff --git a/libopenjpeg/cio.c b/libopenjpeg/cio.c index 21ef55a9..bd0ab15c 100644 --- a/libopenjpeg/cio.c +++ b/libopenjpeg/cio.c @@ -91,7 +91,6 @@ void OPJ_CALLCONV opj_cio_close(opj_cio_t *cio) { } } - /* ----------------------------------------------------------------------- */ /* @@ -191,16 +190,8 @@ void cio_skip(opj_cio_t *cio, int n) { cio->bp += n; } - /* ----------------------------------------------------------------------- */ - -/** - * Write some bytes to the given data buffer, this function is used in Big Endian cpus. - * @param p_buffer pointer the data buffer to write data to. - * @param p_value the value to write - * @param p_nb_bytes the number of bytes to write -*/ void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes) { const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + p_nb_bytes; @@ -210,13 +201,6 @@ void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n memcpy(p_buffer,l_data_ptr,p_nb_bytes); } -/** - * Write some bytes to the given data buffer, this function is used in Little Endian cpus. - * @param p_buffer pointer the data buffer to write data to. - * @param p_value the value to write - * @param p_nb_bytes the number of bytes to write - * @return the number of bytes written or -1 if an error occured -*/ void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes) { const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + p_nb_bytes - 1; @@ -229,13 +213,6 @@ void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n } } -/** - * Reads some bytes from the given data buffer, this function is used in Big Endian cpus. - * @param p_buffer pointer the data buffer to read data from. - * @param p_value pointer to the value that will store the data. - * @param p_nb_bytes the nb bytes to read. - * @return the number of bytes read or -1 if an error occured. - */ void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes) { OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value); @@ -246,13 +223,6 @@ void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT memcpy(l_data_ptr+4-p_nb_bytes,p_buffer,p_nb_bytes); } -/** - * Reads some bytes from the given data buffer, this function is used in Little Endian cpus. - * @param p_buffer pointer the data buffer to read data from. - * @param p_value pointer to the value that will store the data. - * @param p_nb_bytes the nb bytes to read. - * @return the number of bytes read or -1 if an error occured. - */ void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes) { OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + p_nb_bytes-1; @@ -266,23 +236,12 @@ void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT } } -/** - * Write some bytes to the given data buffer, this function is used in Big Endian cpus. - * @param p_buffer pointer the data buffer to write data to. - * @param p_value the value to write - * @return the number of bytes written or -1 if an error occured - */ void opj_write_double_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value) { const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value); memcpy(p_buffer,l_data_ptr,sizeof(OPJ_FLOAT64)); } -/** - * Write some bytes to the given data buffer, this function is used in Little Endian cpus. - * @param p_buffer pointer the data buffer to write data to. - * @param p_value the value to write - */ void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value) { const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + sizeof(OPJ_FLOAT64) - 1; @@ -292,23 +251,12 @@ void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value) } } -/** - * Reads some bytes from the given data buffer, this function is used in Big Endian cpus. - * @param p_buffer pointer the data buffer to read data from. - * @param p_value pointer to the value that will store the data. - */ void opj_read_double_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value) { OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value); memcpy(l_data_ptr,p_buffer,sizeof(OPJ_FLOAT64)); } - -/** - * Reads some bytes from the given data buffer, this function is used in Little Endian cpus. - * @param p_buffer pointer the data buffer to read data from. - * @param p_value pointer to the value that will store the data. - */ void opj_read_double_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value) { OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + sizeof(OPJ_FLOAT64)-1; @@ -318,23 +266,12 @@ void opj_read_double_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT64 * p_value) } } -/** - * Write some bytes to the given data buffer, this function is used in Big Endian cpus. - * @param p_buffer pointer the data buffer to write data to. - * @param p_value the value to write - * @return the number of bytes written or -1 if an error occured - */ void opj_write_float_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value) { const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value); memcpy(p_buffer,l_data_ptr,sizeof(OPJ_FLOAT32)); } -/** - * Write some bytes to the given data buffer, this function is used in Little Endian cpus. - * @param p_buffer pointer the data buffer to write data to. - * @param p_value the value to write - */ void opj_write_float_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value) { const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + sizeof(OPJ_FLOAT32) - 1; @@ -344,23 +281,12 @@ void opj_write_float_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value) } } -/** - * Reads some bytes from the given data buffer, this function is used in Big Endian cpus. - * @param p_buffer pointer the data buffer to read data from. - * @param p_value pointer to the value that will store the data. - */ void opj_read_float_BE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value) { OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value); memcpy(l_data_ptr,p_buffer,sizeof(OPJ_FLOAT32)); } - -/** - * Reads some bytes from the given data buffer, this function is used in Little Endian cpus. - * @param p_buffer pointer the data buffer to read data from. - * @param p_value pointer to the value that will store the data. - */ void opj_read_float_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value) { OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + sizeof(OPJ_FLOAT32)-1; @@ -370,11 +296,6 @@ void opj_read_float_LE(const OPJ_BYTE * p_buffer, OPJ_FLOAT32 * p_value) } } - -/** - * Creates an abstract stream. This function does nothing except allocating memory and initializing the abstract stream. - * @return a stream object. -*/ opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size,opj_bool l_is_input) { opj_stream_private_t * l_stream = 00; @@ -412,19 +333,11 @@ opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size,opj_bool l return (opj_stream_t *) l_stream; } -/** - * Creates an abstract stream. This function does nothing except allocating memory and initializing the abstract stream. - * @return a stream object. -*/ opj_stream_t* OPJ_CALLCONV opj_stream_default_create(opj_bool l_is_input) { return opj_stream_create(J2K_STREAM_CHUNK_SIZE,l_is_input); } -/** - * Destroys a stream created by opj_create_stream. This function does NOT close the abstract stream. If needed the user must - * close its own implementation of the stream. - */ OPJ_API void OPJ_CALLCONV opj_stream_destroy(opj_stream_t* p_stream) { opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; @@ -436,11 +349,6 @@ OPJ_API void OPJ_CALLCONV opj_stream_destroy(opj_stream_t* p_stream) } } -/** - * Sets the given function to be used as a read function. - * @param p_stream the stream to modify - * @param p_function the function to use a read function. -*/ OPJ_API void OPJ_CALLCONV opj_stream_set_read_function(opj_stream_t* p_stream, opj_stream_read_fn p_function) { opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; @@ -462,11 +370,6 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_seek_function(opj_stream_t* p_stream, o l_stream->m_seek_fn = p_function; } -/** - * Sets the given function to be used as a write function. - * @param p_stream the stream to modify - * @param p_function the function to use a write function. -*/ OPJ_API void OPJ_CALLCONV opj_stream_set_write_function(opj_stream_t* p_stream, opj_stream_write_fn p_function) { opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; @@ -478,11 +381,6 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_write_function(opj_stream_t* p_stream, l_stream->m_write_fn = p_function; } -/** - * Sets the given function to be used as a skip function. - * @param p_stream the stream to modify - * @param p_function the function to use a skip function. -*/ OPJ_API void OPJ_CALLCONV opj_stream_set_skip_function(opj_stream_t* p_stream, opj_stream_skip_fn p_function) { opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; @@ -494,36 +392,18 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_skip_function(opj_stream_t* p_stream, o l_stream->m_skip_fn = p_function; } -/** - * Sets the given data to be used as a user data for the stream. - * @param p_stream the stream to modify - * @param p_data the data to set. -*/ OPJ_API void OPJ_CALLCONV opj_stream_set_user_data(opj_stream_t* p_stream, void * p_data) { opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; l_stream->m_user_data = p_data; } -/** - * Sets the given data to be used as a user data for the stream. - * @param p_stream the stream to modify - * @param p_data the data to set. -*/ OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream, OPJ_UINT64 data_length) { opj_stream_private_t* l_stream = (opj_stream_private_t*) p_stream; l_stream->m_user_data_length = data_length; } -/** - * Reads some bytes from the stream. - * @param p_stream the stream to read data from. - * @param p_buffer pointer to the data buffer that will receive the data. - * @param p_size number of bytes to read. - * @param p_event_mgr the user event manager to be notified of special events. - * @return the number of bytes read, or -1 if an error occured or if the stream is at the end. - */ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, opj_event_mgr_t * p_event_mgr) { OPJ_SIZE_T l_read_nb_bytes = 0; @@ -563,7 +443,6 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu p_stream->m_current_data = p_stream->m_stored_data; } - while(1){ /* we should read less than a chunk -> read a chunk */ if (p_size < p_stream->m_buffer_size) { @@ -632,14 +511,6 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu } } -/** - * Writes some bytes from the stream. - * @param p_stream the stream to write data to. - * @param p_buffer pointer to the data buffer holds the data to be writtent. - * @param p_size number of bytes to write. - * @param p_event_mgr the user event manager to be notified of special events. - * @return the number of bytes writtent, or -1 if an error occured. - */ OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream, const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, @@ -688,12 +559,6 @@ OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream, } -/** - * Writes the content of the stream buffer to the stream. - * @param p_stream the stream to write data to. - * @param p_event_mgr the user event manager to be notified of special events. - * @return the number of bytes written, or -1 if an error occured. - */ opj_bool opj_stream_flush (opj_stream_private_t * p_stream, opj_event_mgr_t * p_event_mgr) { /* the number of bytes written on the media. */ @@ -723,13 +588,6 @@ opj_bool opj_stream_flush (opj_stream_private_t * p_stream, opj_event_mgr_t * p_ return OPJ_TRUE; } -/** - * Skips a number of bytes from the stream. - * @param p_stream the stream to skip data from. - * @param p_size the number of bytes to skip. - * @param p_event_mgr the user event manager to be notified of special events. - * @return the number of bytes skipped, or -1 if an error occured. - */ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr) { OPJ_OFF_T l_skip_nb_bytes = 0; @@ -784,13 +642,6 @@ OPJ_OFF_T opj_stream_read_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz return l_skip_nb_bytes; } -/** - * Skips a number of bytes from the stream. - * @param p_stream the stream to skip data from. - * @param p_size the number of bytes to skip. - * @param p_event_mgr the user event manager to be notified of special events. - * @return the number of bytes skipped, or -1 if an error occured. - */ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr) { opj_bool l_is_written = 0; @@ -832,26 +683,11 @@ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_si return l_skip_nb_bytes; } -/** - * Tells the byte offset on the stream (similar to ftell). - * - * @param p_stream the stream to get the information from. - * - * @return the current position of the stream. - */ OPJ_OFF_T opj_stream_tell (const opj_stream_private_t * p_stream) { return p_stream->m_byte_offset; } - -/** - * Get the number of bytes left before the end of the stream (similar to cio_numbytesleft). - * - * @param p_stream the stream to get the information from. - * - * @return Number of bytes left before the end of the stream. - */ OPJ_OFF_T opj_stream_get_number_byte_left (const opj_stream_private_t * p_stream) { assert( p_stream->m_byte_offset >= 0 ); @@ -861,27 +697,12 @@ OPJ_OFF_T opj_stream_get_number_byte_left (const opj_stream_private_t * p_stream 0; } -/** - * Skips a number of bytes from the stream. - * @param p_stream the stream to skip data from. - * @param p_size the number of bytes to skip. - * @param p_event_mgr the user event manager to be notified of special events. - * @return the number of bytes skipped, or -1 if an error occured. - */ OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr) { assert(p_size >= 0); return p_stream->m_opj_skip(p_stream,p_size,p_event_mgr); } - -/** - * Skips a number of bytes from the stream. - * @param p_stream the stream to skip data from. - * @param p_size the number of bytes to skip. - * @param p_event_mgr the user event manager to be notified of special events. - * @return OPJ_TRUE if success, or OPJ_FALSE if an error occured. - */ opj_bool opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr) { OPJ_ARG_NOT_USED(p_event_mgr); @@ -902,13 +723,6 @@ opj_bool opj_stream_read_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size return OPJ_TRUE; } -/** - * Skips a number of bytes from the stream. - * @param p_stream the stream to skip data from. - * @param p_size the number of bytes to skip. - * @param p_event_mgr the user event manager to be notified of special events. - * @return the number of bytes skipped, or -1 if an error occured. - */ opj_bool opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr) { if (! opj_stream_flush(p_stream,p_event_mgr)) { @@ -930,23 +744,12 @@ opj_bool opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz return OPJ_TRUE; } - -/** - * Seeks a number of bytes from the stream. - * @param p_stream the stream to skip data from. - * @param p_size the number of bytes to skip. - * @param p_event_mgr the user event manager to be notified of special events. - * @return true if the stream is seekable. - */ opj_bool opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr) { assert(p_size >= 0); return p_stream->m_opj_seek(p_stream,p_size,p_event_mgr); } -/** - * Tells if the given stream is seekable. - */ opj_bool opj_stream_has_seek (const opj_stream_private_t * p_stream) { return p_stream->m_seek_fn != opj_stream_default_seek; diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index ff13d877..98675f92 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -205,15 +205,17 @@ static void opj_j2k_tcp_data_destroy (opj_tcp_v2_t *p_tcp); */ static void opj_j2k_cp_destroy (opj_cp_v2_t *p_cp); - /** * Writes a SPCod or SPCoc element, i.e. the coding style of a given component of a tile. * + * @param p_j2k J2K codec. + * @param p_tile_no FIXME DOC * @param p_comp_no the component number to output. - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. + * @param p_data FIXME DOC + * @param p_header_size FIXME DOC * @param p_manager the user event manager. * + * @return FIXME DOC */ static opj_bool opj_j2k_write_SPCod_SPCoc( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_tile_no, @@ -225,9 +227,9 @@ static opj_bool opj_j2k_write_SPCod_SPCoc( opj_j2k_v2_t *p_j2k, /** * Gets the size taken by writing a SPCod or SPCoc for the given tile and component. * + * @param p_j2k the J2K codec. * @param p_tile_no the tile index. * @param p_comp_no the component being outputted. - * @param p_j2k the J2K codec. * * @return the number of bytes taken by the SPCod element. */ @@ -237,10 +239,11 @@ static OPJ_UINT32 opj_j2k_get_SPCod_SPCoc_size (opj_j2k_v2_t *p_j2k, /** * Reads a SPCod or SPCoc element, i.e. the coding style of a given component of a tile. + * @param p_j2k the jpeg2000 codec. + * @param compno FIXME DOC * @param p_header_data the data contained in the COM box. - * @param p_j2k the jpeg2000 codec. * @param p_header_size the size of the data contained in the COM marker. - * @param p_manager the user event manager. + * @param p_manager the user event manager. */ static opj_bool opj_j2k_read_SPCod_SPCoc( opj_j2k_v2_t *p_j2k, OPJ_UINT32 compno, @@ -287,12 +290,11 @@ static void opj_j2k_update_tlm ( opj_j2k_v2_t * p_j2k, OPJ_UINT32 p_tile_part_si /** * Reads a SQcd or SQcc element, i.e. the quantization values of a band in the QCD or QCC. * - * @param p_tile_no the tile to output. - * @param p_comp_no the component number to output. - * @param p_data the data buffer. + * @param p_j2k J2K codec. + * @param compno the component number to output. + * @param p_header_data the data buffer. * @param p_header_size pointer to the size of the data buffer, it is changed by the function. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. + * @param p_manager the user event manager. * */ static opj_bool opj_j2k_read_SQcd_SQcc( opj_j2k_v2_t *p_j2k, @@ -322,7 +324,6 @@ static opj_bool opj_j2k_decode_tiles ( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager); - static opj_bool opj_j2k_pre_write_tile ( opj_j2k_v2_t * p_j2k, OPJ_UINT32 p_tile_index, opj_stream_private_t *p_stream, @@ -390,10 +391,9 @@ static opj_bool opj_j2k_write_soc( opj_j2k_v2_t *p_j2k, /** * Reads a SOC marker (Start of Codestream) - * @param p_header_data the data contained in the SOC box. - * @param jp2 the jpeg2000 file codec. - * @param p_header_size the size of the data contained in the SOC marker. - * @param p_manager the user event manager. + * @param p_j2k the jpeg2000 file codec. + * @param p_stream XXX needs data + * @param p_manager the user event manager. */ static opj_bool opj_j2k_read_soc( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, @@ -402,8 +402,8 @@ static opj_bool opj_j2k_read_soc( opj_j2k_v2_t *p_j2k, /** * Writes the SIZ marker (image and tile size) * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. + * @param p_j2k J2K codec. + * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ static opj_bool opj_j2k_write_siz( opj_j2k_v2_t *p_j2k, @@ -412,10 +412,10 @@ static opj_bool opj_j2k_write_siz( opj_j2k_v2_t *p_j2k, /** * Reads a SIZ marker (image and tile size) + * @param p_j2k the jpeg2000 file codec. * @param p_header_data the data contained in the SIZ box. - * @param jp2 the jpeg2000 file codec. * @param p_header_size the size of the data contained in the SIZ marker. - * @param p_manager the user event manager. + * @param p_manager the user event manager. */ static opj_bool opj_j2k_read_siz(opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, @@ -424,7 +424,7 @@ static opj_bool opj_j2k_read_siz(opj_j2k_v2_t *p_j2k, /** * Writes the COM marker (comment) - * + * * @param p_stream the stream to write data to. * @param p_j2k J2K codec. * @param p_manager the user event manager. @@ -435,10 +435,10 @@ static opj_bool opj_j2k_write_com( opj_j2k_v2_t *p_j2k, /** * Reads a COM marker (comments) + * @param p_j2k the jpeg2000 file codec. * @param p_header_data the data contained in the COM box. - * @param jp2 the jpeg2000 file codec. * @param p_header_size the size of the data contained in the COM marker. - * @param p_manager the user event manager. + * @param p_manager the user event manager. */ static opj_bool opj_j2k_read_com ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, @@ -470,10 +470,10 @@ static opj_bool opj_j2k_read_cod ( opj_j2k_v2_t *p_j2k, /** * Writes the COC marker (Coding style component) * - * @param p_comp_number the index of the component to output. - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. + * @param p_j2k J2K codec. + * @param p_comp_no the index of the component to output. + * @param p_stream the stream to write data to. + * @param p_manager the user event manager. */ static opj_bool opj_j2k_write_coc( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_comp_no, @@ -482,9 +482,10 @@ static opj_bool opj_j2k_write_coc( opj_j2k_v2_t *p_j2k, /** * Writes the COC marker (Coding style component) * - * @param p_comp_no the index of the component to output. - * @param p_stream the stream to write data to. * @param p_j2k J2K codec. + * @param p_comp_no the index of the component to output. + * @param p_data FIXME DOC + * @param p_data_written FIXME DOC * @param p_manager the user event manager. */ static void opj_j2k_write_coc_in_memory(opj_j2k_v2_t *p_j2k, @@ -500,7 +501,6 @@ static void opj_j2k_write_coc_in_memory(opj_j2k_v2_t *p_j2k, */ static OPJ_UINT32 opj_j2k_get_max_coc_size(opj_j2k_v2_t *p_j2k); - /** * Reads a COC marker (Coding Style Component) * @param p_header_data the data contained in the COC box. @@ -516,9 +516,8 @@ static opj_bool opj_j2k_read_coc ( opj_j2k_v2_t *p_j2k, /** * Writes the QCD marker (quantization default) * - * @param p_comp_number the index of the component to output. - * @param p_stream the stream to write data to. * @param p_j2k J2K codec. + * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ static opj_bool opj_j2k_write_qcd( opj_j2k_v2_t *p_j2k, @@ -552,10 +551,11 @@ static opj_bool opj_j2k_write_qcc( opj_j2k_v2_t *p_j2k, /** * Writes the QCC marker (quantization component) * + * @param p_j2k J2K codec. * @param p_comp_no the index of the component to output. - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. + * @param p_data FIXME DOC + * @param p_data_written the stream to write data to. + * @param p_manager the user event manager. */ static void opj_j2k_write_qcc_in_memory(opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_comp_no, @@ -581,7 +581,7 @@ static opj_bool opj_j2k_read_qcc( opj_j2k_v2_t *p_j2k, opj_event_mgr_t * p_manager); /** * Writes the POC marker (Progression Order Change) - * + * * @param p_stream the stream to write data to. * @param p_j2k J2K codec. * @param p_manager the user event manager. @@ -592,9 +592,10 @@ static opj_bool opj_j2k_write_poc( opj_j2k_v2_t *p_j2k, /** * Writes the POC marker (Progression Order Change) * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. + * @param p_j2k J2K codec. + * @param p_data FIXME DOC + * @param p_data_written the stream to write data to. + * @param p_manager the user event manager. */ static void opj_j2k_write_poc_in_memory(opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_data, @@ -630,7 +631,6 @@ static OPJ_UINT32 opj_j2k_get_max_toc_size (opj_j2k_v2_t *p_j2k); */ static OPJ_UINT32 opj_j2k_get_specific_header_sizes(opj_j2k_v2_t *p_j2k); - /** * Reads a CRG marker (Component registration) * @@ -692,7 +692,7 @@ static opj_bool opj_j2k_read_plt ( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_header_size, opj_event_mgr_t * p_manager ); - +#if 0 /** * Reads a PPM marker (Packed packet headers, main header) * @@ -701,7 +701,6 @@ static opj_bool opj_j2k_read_plt ( opj_j2k_v2_t *p_j2k, * @param p_header_size the size of the data contained in the POC marker. * @param p_manager the user event manager. */ -#if 0 static opj_bool j2k_read_ppm_v2 ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, @@ -716,7 +715,6 @@ static opj_bool j2k_read_ppm_v3 ( OPJ_UINT32 p_header_size, opj_event_mgr_t * p_manager ); - /** * Reads a PPT marker (Packed packet headers, tile-part header) * @@ -731,7 +729,7 @@ static opj_bool opj_j2k_read_ppt ( opj_j2k_v2_t *p_j2k, opj_event_mgr_t * p_manager ); /** * Writes the TLM marker (Tile Length Marker) - * + * * @param p_stream the stream to write data to. * @param p_j2k J2K codec. * @param p_manager the user event manager. @@ -743,9 +741,11 @@ static opj_bool opj_j2k_write_tlm( opj_j2k_v2_t *p_j2k, /** * Writes the SOT marker (Start of tile-part) * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. + * @param p_j2k J2K codec. + * @param p_data FIXME DOC + * @param p_data_written FIXME DOC + * @param p_stream the stream to write data to. + * @param p_manager the user event manager. */ static opj_bool opj_j2k_write_sot( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_data, @@ -768,9 +768,13 @@ static opj_bool opj_j2k_read_sot ( opj_j2k_v2_t *p_j2k, /** * Writes the SOD marker (Start of data) * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. + * @param p_j2k J2K codec. + * @param p_tile_coder FIXME DOC + * @param p_data FIXME DOC + * @param p_data_written FIXME DOC + * @param p_total_data_size FIXME DOC + * @param p_stream the stream to write data to. + * @param p_manager the user event manager. */ static opj_bool opj_j2k_write_sod( opj_j2k_v2_t *p_j2k, opj_tcd_v2_t * p_tile_coder, @@ -783,18 +787,14 @@ static opj_bool opj_j2k_write_sod( opj_j2k_v2_t *p_j2k, /** * Reads a SOD marker (Start Of Data) * - * @param p_header_data the data contained in the SOD box. * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the SOD marker. + * @param p_stream FIXME DOC * @param p_manager the user event manager. */ static opj_bool opj_j2k_read_sod( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ); -/** - * Updates the Tile Length Marker. - */ void opj_j2k_update_tlm (opj_j2k_v2_t * p_j2k, OPJ_UINT32 p_tile_part_size ) { opj_write_bytes(p_j2k->m_specific_param.m_encoder.m_tlm_sot_offsets_current,p_j2k->m_current_tile_number,1); /* PSOT */ @@ -834,7 +834,7 @@ static opj_bool opj_j2k_read_rgn (opj_j2k_v2_t *p_j2k, /** * Writes the EOC marker (End of Codestream) - * + * * @param p_stream the stream to write data to. * @param p_j2k J2K codec. * @param p_manager the user event manager. @@ -846,9 +846,8 @@ static opj_bool opj_j2k_write_eoc( opj_j2k_v2_t *p_j2k, /** * Reads a EOC marker (End Of Codestream) * - * @param p_header_data the data contained in the SOD box. * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the SOD marker. + * @param p_stream FIXME DOC * @param p_manager the user event manager. */ static opj_bool opj_j2k_read_eoc ( opj_j2k_v2_t *p_j2k, @@ -879,7 +878,7 @@ static opj_bool opj_j2k_init_info( opj_j2k_v2_t *p_j2k, /** Add main header marker information -@param cstr_info Codestream information structure +@param cstr_index Codestream information structure @param type marker type @param pos byte offset of marker segment @param len length of marker segment @@ -888,7 +887,7 @@ static opj_bool opj_j2k_add_mhmarker(opj_codestream_index_t *cstr_index, OPJ_UIN /** Add tile header marker information @param tileno tile index number -@param cstr_info Codestream information structure +@param cstr_index Codestream information structure @param type marker type @param pos byte offset of marker segment @param len length of marker segment @@ -898,23 +897,25 @@ static opj_bool opj_j2k_add_tlmarker(OPJ_UINT32 tileno, opj_codestream_index_t * /** * Reads an unknown marker * - * @param p_stream the stream object to read from. * @param p_j2k the jpeg2000 codec. + * @param p_stream the stream object to read from. + * @param output_marker FIXME DOC * @param p_manager the user event manager. * * @return true if the marker could be deduced. */ -static opj_bool opj_j2k_read_unk ( opj_j2k_v2_t *p_j2k, - opj_stream_private_t *p_stream, - OPJ_UINT32 *output_marker, - opj_event_mgr_t * p_manager ); +static opj_bool opj_j2k_read_unk( opj_j2k_v2_t *p_j2k, + opj_stream_private_t *p_stream, + OPJ_UINT32 *output_marker, + opj_event_mgr_t * p_manager ); /** * Writes the MCT marker (Multiple Component Transform) * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. + * @param p_j2k J2K codec. + * @param p_mct_record FIXME DOC + * @param p_stream the stream to write data to. + * @param p_manager the user event manager. */ static opj_bool opj_j2k_write_mct_record( opj_j2k_v2_t *p_j2k, opj_mct_data_t * p_mct_record, @@ -937,16 +938,16 @@ static opj_bool opj_j2k_read_mct ( opj_j2k_v2_t *p_j2k, /** * Writes the MCC marker (Multiple Component Collection) * - * @param p_stream the stream to write data to. * @param p_j2k J2K codec. + * @param p_mcc_record FIXME DOC + * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ -static opj_bool opj_j2k_write_mcc_record( opj_j2k_v2_t *p_j2k, - opj_simple_mcc_decorrelation_data_t * p_mcc_record, +static opj_bool opj_j2k_write_mcc_record( opj_j2k_v2_t *p_j2k, + opj_simple_mcc_decorrelation_data_t * p_mcc_record, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ); - /** * Reads a MCC marker (Multiple Component Collection) * @@ -1001,7 +1002,6 @@ static void opj_j2k_write_float_to_int32 (const void * p_src_data, void * p_des static void opj_j2k_write_float_to_float (const void * p_src_data, void * p_dest_data, OPJ_UINT32 p_nb_elem); static void opj_j2k_write_float_to_float64 (const void * p_src_data, void * p_dest_data, OPJ_UINT32 p_nb_elem); - /** * Ends the encoding, i.e. frees memory. * @@ -1073,11 +1073,12 @@ static opj_bool opj_j2k_write_epc( opj_j2k_v2_t *p_j2k, * Checks the progression order changes values. Tells of the poc given as input are valid. * A nice message is outputted at errors. * - * @param p_pocs the progression order changes. - * @param p_nb_pocs the number of progression order changes. + * @param p_pocs the progression order changes. + * @param p_nb_pocs the number of progression order changes. * @param p_nb_resolutions the number of resolutions. - * @param numcomps the number of components - * @param numlayers the number of layers. + * @param numcomps the number of components + * @param numlayers the number of layers. + * @param p_manager the user event manager. * * @return true if the pocs are valid. */ @@ -1146,8 +1147,6 @@ j2k_prog_order_t j2k_prog_order_list[] = { {(OPJ_PROG_ORDER)-1, ""} }; - - /** * FIXME DOC */ @@ -1428,14 +1427,6 @@ void opj_j2k_write_float_to_float64 (const void * p_src_data, void * p_dest_dat } } - -/** - * Converts an enum type progression order to string type. - * - * @param prg_order the progression order to get. - * - * @return the string representation of the given progression order. - */ char *opj_j2k_convert_progression_order(OPJ_PROG_ORDER prg_order){ j2k_prog_order_t *po; for(po = j2k_prog_order_list; po->enum_prog != -1; po++ ){ @@ -1446,18 +1437,6 @@ char *opj_j2k_convert_progression_order(OPJ_PROG_ORDER prg_order){ return po->str_prog; } -/** - * Checks the progression order changes values. Tells if the poc given as input are valid. - * - * @param p_pocs the progression order changes. - * @param p_nb_pocs the number of progression order changes. - * @param p_nb_resolutions the number of resolutions. - * @param numcomps the number of components - * @param numlayers the number of layers. - * @param p_manager the user event manager. - * - * @return true if the pocs are valid. - */ opj_bool opj_j2k_check_poc_val( const opj_poc_t *p_pocs, OPJ_UINT32 p_nb_pocs, OPJ_UINT32 p_nb_resolutions, @@ -1562,15 +1541,6 @@ opj_bool opj_j2k_check_poc_val( const opj_poc_t *p_pocs, /* ----------------------------------------------------------------------- */ -/** - * Gets the number of tile parts used for the given change of progression (if any) and the given tile. - * - * @param cp the coding parameters. - * @param pino the offset of the given poc (i.e. its position in the coding parameter). - * @param tileno the given tile. - * - * @return the number of tile parts. - */ OPJ_UINT32 opj_j2k_get_num_tp(opj_cp_v2_t *cp, OPJ_UINT32 pino, OPJ_UINT32 tileno) { const OPJ_CHAR *prog = 00; @@ -1629,18 +1599,6 @@ OPJ_UINT32 opj_j2k_get_num_tp(opj_cp_v2_t *cp, OPJ_UINT32 pino, OPJ_UINT32 tilen return tpnum; } -/** - * Calculates the total number of tile parts needed by the encoder to - * encode such an image. If not enough memory is available, then the function return false. - * - * @param p_nb_tiles pointer that will hold the number of tile parts. - * @param cp the coding parameters for the image. - * @param image the image to encode. - * @param p_j2k the p_j2k encoder. - * @param p_manager the user event manager. - * - * @return true if the function was successful, false else. - */ opj_bool opj_j2k_calculate_tp( opj_j2k_v2_t *p_j2k, opj_cp_v2_t *cp, OPJ_UINT32 * p_nb_tiles, @@ -1719,13 +1677,6 @@ opj_bool opj_j2k_calculate_tp( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the SOC marker (Start Of Codestream) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_soc( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -1760,18 +1711,15 @@ opj_bool opj_j2k_write_soc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - - /** * Reads a SOC marker (Start of Codestream) - * @param p_header_data the data contained in the SOC box. - * @param jp2 the jpeg2000 file codec. - * @param p_header_size the size of the data contained in the SOC marker. - * @param p_manager the user event manager. + * @param p_j2k the jpeg2000 file codec. + * @param p_stream FIXME DOC + * @param p_manager the user event manager. */ static opj_bool opj_j2k_read_soc( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_BYTE l_data [2]; @@ -1807,14 +1755,6 @@ static opj_bool opj_j2k_read_soc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - -/** - * Writes the SIZ marker (image and tile size) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_siz( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -1910,14 +1850,12 @@ opj_bool opj_j2k_write_siz( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - - /** * Reads a SIZ marker (image and tile size) + * @param p_j2k the jpeg2000 file codec. * @param p_header_data the data contained in the SIZ box. - * @param jp2 the jpeg2000 file codec. * @param p_header_size the size of the data contained in the SIZ marker. - * @param p_manager the user event manager. + * @param p_manager the user event manager. */ static opj_bool opj_j2k_read_siz(opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, @@ -2226,16 +2164,9 @@ static opj_bool opj_j2k_read_siz(opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the COM marker (comment) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_com( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_comment_size; @@ -2247,7 +2178,7 @@ opj_bool opj_j2k_write_com( opj_j2k_v2_t *p_j2k, assert(p_j2k != 00); assert(p_stream != 00); assert(p_manager != 00); - + l_comment = p_j2k->m_cp.comment; l_comment_size = strlen(l_comment); l_total_com_size = l_comment_size + 6; @@ -2266,18 +2197,18 @@ opj_bool opj_j2k_write_com( opj_j2k_v2_t *p_j2k, } l_current_ptr = p_j2k->m_specific_param.m_encoder.m_header_tile_data; - + opj_write_bytes(l_current_ptr,J2K_MS_COM , 2); /* COM */ l_current_ptr+=2; - + opj_write_bytes(l_current_ptr,l_total_com_size - 2 , 2); /* L_COM */ l_current_ptr+=2; - + opj_write_bytes(l_current_ptr,1 , 2); /* General use (IS 8859-15:1999 (Latin) values) */ l_current_ptr+=2; - + memcpy( l_current_ptr,l_comment,l_comment_size); - + if (opj_stream_write_data(p_stream,p_j2k->m_specific_param.m_encoder.m_header_tile_data,l_total_com_size,p_manager) != l_total_com_size) { return OPJ_FALSE; } @@ -2287,15 +2218,15 @@ opj_bool opj_j2k_write_com( opj_j2k_v2_t *p_j2k, /** * Reads a COM marker (comments) + * @param p_j2k the jpeg2000 file codec. * @param p_header_data the data contained in the COM box. - * @param jp2 the jpeg2000 file codec. * @param p_header_size the size of the data contained in the COM marker. * @param p_manager the user event manager. */ static opj_bool opj_j2k_read_com ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { /* preconditions */ @@ -2307,13 +2238,6 @@ static opj_bool opj_j2k_read_com ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the COD marker (Coding style default) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_cod( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -2385,7 +2309,6 @@ opj_bool opj_j2k_write_cod( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - /** * Reads a COD marker (Coding Styke defaults) * @param p_header_data the data contained in the COD box. @@ -2478,14 +2401,6 @@ static opj_bool opj_j2k_read_cod ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the COC marker (Coding style component) - * - * @param p_comp_no the index of the component to output. - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_coc( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_comp_no, opj_stream_private_t *p_stream, @@ -2530,19 +2445,11 @@ opj_bool opj_j2k_write_coc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the COC marker (Coding style component) - * - * @param p_comp_no the index of the component to output. - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ void opj_j2k_write_coc_in_memory( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_comp_no, OPJ_BYTE * p_data, OPJ_UINT32 * p_data_written, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_cp_v2_t *l_cp = 00; @@ -2583,11 +2490,6 @@ void opj_j2k_write_coc_in_memory( opj_j2k_v2_t *p_j2k, * p_data_written = l_coc_size; } -/** - * Gets the maximum size taken by a coc. - * - * @param p_j2k the jpeg2000 codec to use. - */ OPJ_UINT32 opj_j2k_get_max_coc_size(opj_j2k_v2_t *p_j2k) { OPJ_UINT32 i,j; @@ -2609,7 +2511,6 @@ OPJ_UINT32 opj_j2k_get_max_coc_size(opj_j2k_v2_t *p_j2k) return 6 + l_max; } - /** * Reads a COC marker (Coding Style Component) * @param p_header_data the data contained in the COC box. @@ -2620,7 +2521,7 @@ OPJ_UINT32 opj_j2k_get_max_coc_size(opj_j2k_v2_t *p_j2k) static opj_bool opj_j2k_read_coc ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_cp_v2_t *l_cp = NULL; @@ -2671,17 +2572,9 @@ static opj_bool opj_j2k_read_coc ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the QCD marker (quantization default) - * - * @param p_comp_number the index of the component to output. - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_qcd( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_cp_v2_t *l_cp = 00; @@ -2749,7 +2642,7 @@ opj_bool opj_j2k_write_qcd( opj_j2k_v2_t *p_j2k, static opj_bool opj_j2k_read_qcd ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { /* preconditions */ @@ -2773,18 +2666,10 @@ static opj_bool opj_j2k_read_qcd ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the QCC marker (quantization component) - * - * @param p_comp_no the index of the component to output. - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_qcc( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_comp_no, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_qcc_size,l_remaining_size; @@ -2819,14 +2704,6 @@ opj_bool opj_j2k_write_qcc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the QCC marker (quantization component) - * - * @param p_comp_no the index of the component to output. - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ void opj_j2k_write_qcc_in_memory( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_comp_no, OPJ_BYTE * p_data, @@ -2876,9 +2753,6 @@ void opj_j2k_write_qcc_in_memory( opj_j2k_v2_t *p_j2k, *p_data_written = l_qcc_size; } -/** - * Gets the maximum size taken by a qcc. - */ OPJ_UINT32 opj_j2k_get_max_qcc_size (opj_j2k_v2_t *p_j2k) { return opj_j2k_get_max_coc_size(p_j2k); @@ -2964,16 +2838,9 @@ static opj_bool opj_j2k_read_qcc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the POC marker (Progression Order Change) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_poc( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_nb_comp; @@ -2993,7 +2860,7 @@ opj_bool opj_j2k_write_poc( opj_j2k_v2_t *p_j2k, l_tccp = &l_tcp->tccps[0]; l_nb_comp = p_j2k->m_private_image->numcomps; l_nb_poc = 1 + l_tcp->numpocs; - + if (l_nb_comp <= 256) { l_poc_room = 1; } @@ -3001,7 +2868,7 @@ opj_bool opj_j2k_write_poc( opj_j2k_v2_t *p_j2k, l_poc_room = 2; } l_poc_size = 4 + (5 + 2 * l_poc_room) * l_nb_poc; - + if (l_poc_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) { OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc(p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_poc_size); if (! new_header_tile_data) { @@ -3024,18 +2891,10 @@ opj_bool opj_j2k_write_poc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - -/** - * Writes the POC marker (Progression Order Change) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ void opj_j2k_write_poc_in_memory( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_data, OPJ_UINT32 * p_data_written, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 i; @@ -3107,9 +2966,6 @@ void opj_j2k_write_poc_in_memory( opj_j2k_v2_t *p_j2k, *p_data_written = l_poc_size; } -/** - * Gets the maximum size taken by the writing of a POC. - */ OPJ_UINT32 opj_j2k_get_max_poc_size(opj_j2k_v2_t *p_j2k) { opj_tcp_v2_t * l_tcp = 00; @@ -3130,9 +2986,6 @@ OPJ_UINT32 opj_j2k_get_max_poc_size(opj_j2k_v2_t *p_j2k) return 4 + 9 * l_max_poc; } -/** - * Gets the maximum size taken by the toc headers of all the tile parts of any given tile. - */ OPJ_UINT32 opj_j2k_get_max_toc_size (opj_j2k_v2_t *p_j2k) { OPJ_UINT32 i; @@ -3152,12 +3005,6 @@ OPJ_UINT32 opj_j2k_get_max_toc_size (opj_j2k_v2_t *p_j2k) return 12 * l_max; } - -/** - * Gets the maximum size taken by the headers of the SOT. - * - * @param p_j2k the jpeg2000 codec to use. - */ OPJ_UINT32 opj_j2k_get_specific_header_sizes(opj_j2k_v2_t *p_j2k) { OPJ_UINT32 l_nb_bytes = 0; @@ -3182,7 +3029,6 @@ OPJ_UINT32 opj_j2k_get_specific_header_sizes(opj_j2k_v2_t *p_j2k) return l_nb_bytes; } - /** * Reads a POC marker (Progression Order Change) * @@ -3194,7 +3040,7 @@ OPJ_UINT32 opj_j2k_get_specific_header_sizes(opj_j2k_v2_t *p_j2k) static opj_bool opj_j2k_read_poc ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 i, l_nb_comp, l_tmp; @@ -3275,7 +3121,7 @@ static opj_bool opj_j2k_read_poc ( opj_j2k_v2_t *p_j2k, static opj_bool opj_j2k_read_crg ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_nb_comp; @@ -3361,7 +3207,6 @@ static opj_bool opj_j2k_read_tlm ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - /** * Reads a PLM marker (Packet length, main header marker) * @@ -3484,15 +3329,6 @@ static opj_bool opj_j2k_read_plt ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - -/** - * Reads a PPM marker (Packed packet headers, main header) - * - * @param p_header_data the data contained in the POC box. - * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the POC marker. - * @param p_manager the user event manager. -*/ #if 0 opj_bool j2k_read_ppm_v2 ( opj_j2k_v2_t *p_j2k, @@ -3596,16 +3432,6 @@ opj_bool j2k_read_ppm_v2 ( } #endif - - -/** - * Reads a PPM marker (Packed packet headers, main header) - * - * @param p_header_data the data contained in the POC box. - * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the POC marker. - * @param p_manager the user event manager. -*/ opj_bool j2k_read_ppm_v3 ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, @@ -3651,7 +3477,7 @@ opj_bool j2k_read_ppm_v3 ( l_cp->ppm_data_read = 0; l_cp->ppm_data = (OPJ_BYTE *) opj_malloc(l_cp->ppm_len); - l_cp->ppm_buffer = l_cp->ppm_data; + l_cp->ppm_buffer = l_cp->ppm_data; if (l_cp->ppm_data == 00) { opj_event_msg_v2(p_manager, EVT_ERROR, "Not enough memory to read ppm marker\n"); return OPJ_FALSE; @@ -3691,7 +3517,7 @@ opj_bool j2k_read_ppm_v3 ( return OPJ_FALSE; } l_cp->ppm_data = new_ppm_data; - l_cp->ppm_buffer = l_cp->ppm_data; + l_cp->ppm_buffer = l_cp->ppm_data; /* Keep the position of the place where concatenate the new series*/ l_cp->ppm_data_current = &(l_cp->ppm_data[l_cp->ppm_len]); @@ -3737,7 +3563,7 @@ opj_bool j2k_read_ppm_v3 ( return OPJ_FALSE; } l_cp->ppm_data = new_ppm_data; - l_cp->ppm_buffer = l_cp->ppm_data; + l_cp->ppm_buffer = l_cp->ppm_data; /* Keep the position of the place where concatenate the new series */ l_cp->ppm_data_current = &(l_cp->ppm_data[l_cp->ppm_len]); @@ -3759,7 +3585,7 @@ opj_bool j2k_read_ppm_v3 ( return OPJ_FALSE; } l_cp->ppm_data = new_ppm_data; - l_cp->ppm_buffer = l_cp->ppm_data; + l_cp->ppm_buffer = l_cp->ppm_data; /* Keep the position of the place where concatenate the new series*/ l_cp->ppm_data_current = &(l_cp->ppm_data[l_cp->ppm_len]); @@ -3833,7 +3659,7 @@ opj_bool j2k_read_ppm_v3 ( static opj_bool opj_j2k_read_ppt ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_cp_v2_t *l_cp = 00; @@ -3904,16 +3730,9 @@ static opj_bool opj_j2k_read_ppt ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the TLM marker (Tile Length Marker) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_tlm( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_BYTE * l_current_data = 00; @@ -3925,7 +3744,7 @@ opj_bool opj_j2k_write_tlm( opj_j2k_v2_t *p_j2k, assert(p_stream != 00); l_tlm_size = 6 + (5*p_j2k->m_specific_param.m_encoder.m_total_tile_parts); - + if (l_tlm_size > p_j2k->m_specific_param.m_encoder.m_header_tile_data_size) { OPJ_BYTE *new_header_tile_data = (OPJ_BYTE *) opj_realloc(p_j2k->m_specific_param.m_encoder.m_header_tile_data, l_tlm_size); if (! new_header_tile_data) { @@ -3944,19 +3763,19 @@ opj_bool opj_j2k_write_tlm( opj_j2k_v2_t *p_j2k, /* change the way data is written to avoid seeking if possible */ // TODO p_j2k->m_specific_param.m_encoder.m_tlm_start = opj_stream_tell(p_stream); - + opj_write_bytes(l_current_data,J2K_MS_TLM,2); /* TLM */ l_current_data += 2; - + opj_write_bytes(l_current_data,l_tlm_size-2,2); /* Lpoc */ l_current_data += 2; - + opj_write_bytes(l_current_data,0,1); /* Ztlm=0*/ ++l_current_data; - + opj_write_bytes(l_current_data,0x50,1); /* Stlm ST=1(8bits-255 tiles max),SP=1(Ptlm=32bits) */ ++l_current_data; - + /* do nothing on the 5 * l_j2k->m_specific_param.m_encoder.m_total_tile_parts remaining data */ if (opj_stream_write_data(p_stream,p_j2k->m_specific_param.m_encoder.m_header_tile_data,l_tlm_size,p_manager) != l_tlm_size) { return OPJ_FALSE; @@ -3965,18 +3784,11 @@ opj_bool opj_j2k_write_tlm( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the SOT marker (Start of tile-part) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_sot( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_data, OPJ_UINT32 * p_data_written, const opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { /* preconditions */ @@ -4016,17 +3828,6 @@ opj_bool opj_j2k_write_sot( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - - - -/** - * Reads a PPT marker (Packed packet headers, tile-part header) - * - * @param p_header_data the data contained in the PPT box. - * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the PPT marker. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_read_sot ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, @@ -4098,7 +3899,6 @@ opj_bool opj_j2k_read_sot ( opj_j2k_v2_t *p_j2k, return OPJ_FALSE; } - #ifdef USE_JPWL if (l_cp->correct) { @@ -4190,7 +3990,6 @@ opj_bool opj_j2k_read_sot ( opj_j2k_v2_t *p_j2k, p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].nb_tps = l_num_parts; p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].current_nb_tps = l_num_parts; - if (!p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index) { p_j2k->cstr_index->tile_index[p_j2k->m_current_tile_number].tp_index = (opj_tp_index_t*)opj_calloc(l_num_parts, sizeof(opj_tp_index_t)); @@ -4237,7 +4036,6 @@ opj_bool opj_j2k_read_sot ( opj_j2k_v2_t *p_j2k, } - /* FIXME move this onto a separate method to call before reading any SOT, remove part about main_end header, use a index struct inside p_j2k */ /* if (p_j2k->cstr_info) { if (l_tcp->first) { @@ -4268,20 +4066,13 @@ opj_bool opj_j2k_read_sot ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the SOD marker (Start of data) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_sod( opj_j2k_v2_t *p_j2k, opj_tcd_v2_t * p_tile_coder, OPJ_BYTE * p_data, OPJ_UINT32 * p_data_written, OPJ_UINT32 p_total_data_size, const opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_tcp_v2_t *l_tcp = 00; @@ -4305,7 +4096,6 @@ opj_bool opj_j2k_write_sod( opj_j2k_v2_t *p_j2k, l_cp = &(p_j2k->m_cp); l_tcp = &l_cp->tcps[p_j2k->m_current_tile_number]; - /* update tile coder */ p_tile_coder->tp_num = p_j2k->m_specific_param.m_encoder.m_current_poc_tile_part_number ; p_tile_coder->cur_tp_num = p_j2k->m_specific_param.m_encoder.m_current_tile_part_number; @@ -4359,17 +4149,6 @@ opj_bool opj_j2k_write_sod( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - - - -/** - * Reads a SOD marker (Start Of Data) - * - * @param p_header_data the data contained in the SOD box. - * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the SOD marker. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_read_sod (opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager @@ -4424,7 +4203,6 @@ opj_bool opj_j2k_read_sod (opj_j2k_v2_t *p_j2k, return OPJ_FALSE; } - /* Index */ l_cstr_index = p_j2k->cstr_index; if (l_cstr_index) { @@ -4448,7 +4226,7 @@ opj_bool opj_j2k_read_sod (opj_j2k_v2_t *p_j2k, /*l_cstr_index->packno = 0;*/ } - l_current_read_size = opj_stream_read_data( + l_current_read_size = opj_stream_read_data( p_stream, *l_current_data + *l_tile_len, p_j2k->m_specific_param.m_decoder.m_sot_length, @@ -4466,20 +4244,11 @@ opj_bool opj_j2k_read_sod (opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the RGN marker (Region Of Interest) - * - * @param p_tile_no the tile to output - * @param p_comp_no the component to output - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_rgn(opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_tile_no, OPJ_UINT32 p_comp_no, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_BYTE * l_current_data = 00; @@ -4535,25 +4304,17 @@ opj_bool opj_j2k_read_sod (opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the EOC marker (End of Codestream) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_eoc( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { /* preconditions */ assert(p_j2k != 00); assert(p_manager != 00); assert(p_stream != 00); - + opj_write_bytes(p_j2k->m_specific_param.m_encoder.m_header_tile_data,J2K_MS_EOC,2); /* EOC */ - /* UniPG>> */ #ifdef USE_JPWL @@ -4574,7 +4335,6 @@ opj_bool opj_j2k_write_eoc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - /** * Reads a RGN marker (Region Of Interest) * @@ -4586,7 +4346,7 @@ opj_bool opj_j2k_write_eoc( opj_j2k_v2_t *p_j2k, static opj_bool opj_j2k_read_rgn (opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_nb_comp; @@ -4657,13 +4417,6 @@ OPJ_FLOAT32 opj_j2k_get_default_stride (opj_tcp_v2_t * p_tcp) return 0; } -/** - * Updates the rates of the tcp. - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_update_rates( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -4687,7 +4440,6 @@ opj_bool opj_j2k_update_rates( opj_j2k_v2_t *p_j2k, assert(p_manager != 00); assert(p_stream != 00); - l_cp = &(p_j2k->m_cp); l_image = p_j2k->m_private_image; l_tcp = l_cp->tcps; @@ -4827,15 +4579,6 @@ opj_bool opj_j2k_update_rates( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - -/** - * Reads a EOC marker (End Of Codestream) - * - * @param p_header_data the data contained in the SOD box. - * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the SOD marker. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_read_eoc ( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -4885,13 +4628,6 @@ opj_bool opj_j2k_read_eoc ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Gets the offset of the header. - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_get_end_header(opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) @@ -4906,13 +4642,6 @@ opj_bool opj_j2k_get_end_header(opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the MCT marker (Multiple Component Transform) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_mct_data_group( opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) @@ -4961,13 +4690,6 @@ opj_bool opj_j2k_write_mct_data_group( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the image components. - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_image_components(opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) @@ -4993,13 +4715,6 @@ opj_bool opj_j2k_write_image_components(opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes regions of interests. - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_regions( opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) @@ -5028,13 +4743,6 @@ opj_bool opj_j2k_write_regions( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes EPC ???? - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_epc( opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) @@ -5073,19 +4781,6 @@ opj_bool opj_j2k_write_epc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - - - - -/** - * Reads an unknown marker - * - * @param p_stream the stream object to read from. - * @param p_j2k the jpeg2000 codec. - * @param p_manager the user event manager. - * - * @return true if the marker could be deduced. -*/ opj_bool opj_j2k_read_unk ( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, OPJ_UINT32 *output_marker, @@ -5148,13 +4843,6 @@ opj_bool opj_j2k_read_unk ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the MCT marker (Multiple Component Transform) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_mct_record( opj_j2k_v2_t *p_j2k, opj_mct_data_t * p_mct_record, struct opj_stream_private *p_stream, @@ -5224,7 +4912,7 @@ opj_bool opj_j2k_write_mct_record( opj_j2k_v2_t *p_j2k, static opj_bool opj_j2k_read_mct ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 i; @@ -5326,13 +5014,6 @@ static opj_bool opj_j2k_read_mct ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the MCC marker (Multiple Component Collection) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_mcc_record( opj_j2k_v2_t *p_j2k, struct opj_simple_mcc_decorrelation_data * p_mcc_record, struct opj_stream_private *p_stream, @@ -5436,14 +5117,6 @@ opj_bool opj_j2k_write_mcc_record( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Reads a MCC marker (Multiple Component Collection) - * - * @param p_header_data the data contained in the MCC box. - * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the MCC marker. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_read_mcc ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, @@ -5459,7 +5132,6 @@ opj_bool opj_j2k_read_mcc ( opj_j2k_v2_t *p_j2k, OPJ_UINT32 l_nb_comps; OPJ_UINT32 l_nb_bytes_by_comp; - /* preconditions */ assert(p_header_data != 00); assert(p_j2k != 00); @@ -5659,14 +5331,6 @@ opj_bool opj_j2k_read_mcc ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - -/** - * Writes the MCO marker (Multiple component transformation ordering) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_mco( opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager @@ -5736,7 +5400,7 @@ opj_bool opj_j2k_write_mco( opj_j2k_v2_t *p_j2k, static opj_bool opj_j2k_read_mco ( opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_tmp, i; @@ -5881,13 +5545,6 @@ opj_bool opj_j2k_add_mct(opj_tcp_v2_t * p_tcp, opj_image_t * p_image, OPJ_UINT32 return OPJ_TRUE; } -/** - * Writes the CBD marker (Component bit depth definition) - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_cbd( opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) @@ -5996,7 +5653,6 @@ static opj_bool opj_j2k_read_cbd ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - /* ----------------------------------------------------------------------- */ /* J2K / JPT decoder interface */ /* ----------------------------------------------------------------------- */ @@ -6015,7 +5671,6 @@ void opj_j2k_setup_decoder(opj_j2k_v2_t *j2k, opj_dparameters_t *parameters) } } - /* ----------------------------------------------------------------------- */ /* J2K encoder interface */ /* ----------------------------------------------------------------------- */ @@ -6057,7 +5712,6 @@ opj_j2k_v2_t* opj_j2k_create_compress(void) return l_j2k; } - void opj_j2k_setup_encoder( opj_j2k_v2_t *p_j2k, opj_cparameters_t *parameters, opj_image_t *image, @@ -6184,7 +5838,6 @@ void opj_j2k_setup_encoder( opj_j2k_v2_t *p_j2k, } #endif /* USE_JPWL */ - /* initialize the mutiple tiles */ /* ---------------------------- */ cp->tcps = (opj_tcp_v2_t*) opj_calloc(cp->tw * cp->th, sizeof(opj_tcp_v2_t)); @@ -6373,8 +6026,6 @@ void opj_j2k_setup_encoder( opj_j2k_v2_t *p_j2k, } } - - static opj_bool opj_j2k_add_mhmarker(opj_codestream_index_t *cstr_index, OPJ_UINT32 type, OPJ_OFF_T pos, OPJ_UINT32 len) { assert(cstr_index != 00); @@ -6440,17 +6091,12 @@ static opj_bool opj_j2k_add_tlmarker(OPJ_UINT32 tileno, opj_codestream_index_t * return OPJ_TRUE; } - /* * ----------------------------------------------------------------------- * ----------------------------------------------------------------------- * ----------------------------------------------------------------------- */ -/** - * Ends the decompression procedures and possibiliy add data to be read after the - * codestream. - */ opj_bool opj_j2k_end_decompress(opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager @@ -6462,16 +6108,6 @@ opj_bool opj_j2k_end_decompress(opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Reads a jpeg2000 codestream header structure. - - * - * @param p_stream the stream to read data from. - * @param p_j2k the jpeg2000 codec. - * @param p_manager the user event manager. - * - * @return true if the box is valid. - */ opj_bool opj_j2k_read_header( opj_stream_private_t *p_stream, opj_j2k_v2_t* p_j2k, opj_image_t** p_image, @@ -6524,9 +6160,6 @@ opj_bool opj_j2k_read_header( opj_stream_private_t *p_stream, return OPJ_TRUE; } -/** - * Sets up the procedures to do on reading header. Developpers wanting to extend the library can add their own reading procedures. - */ void opj_j2k_setup_header_reading (opj_j2k_v2_t *p_j2k) { /* preconditions*/ @@ -6539,10 +6172,6 @@ void opj_j2k_setup_header_reading (opj_j2k_v2_t *p_j2k) } -/** - * Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters - * are valid. Developpers wanting to extend the library can add their own validation procedures. - */ void opj_j2k_setup_decoding_validation (opj_j2k_v2_t *p_j2k) { /* preconditions*/ @@ -6554,16 +6183,6 @@ void opj_j2k_setup_decoding_validation (opj_j2k_v2_t *p_j2k) } - -/** - * The mct encoding validation procedure. - * - * @param p_j2k the jpeg2000 codec to validate. - * @param p_stream the input stream to validate. - * @param p_manager the user event manager. - * - * @return true if the parameters are correct. - */ opj_bool opj_j2k_mct_validation ( opj_j2k_v2_t * p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -6747,9 +6366,6 @@ opj_bool opj_j2k_setup_mct_encoding(opj_tcp_v2_t * p_tcp, opj_image_t * p_image) return OPJ_TRUE; } -/** - * Builds the cp decoder parameters to use to decode tile. - */ opj_bool opj_j2k_build_decoder (opj_j2k_v2_t * p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -6762,9 +6378,6 @@ opj_bool opj_j2k_build_decoder (opj_j2k_v2_t * p_j2k, return OPJ_TRUE; } -/** - * Builds the cp encoder parameters to use to encode tile. - */ opj_bool opj_j2k_build_encoder (opj_j2k_v2_t * p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -6775,17 +6388,8 @@ opj_bool opj_j2k_build_encoder (opj_j2k_v2_t * p_j2k, (void)p_stream; (void)p_manager; return OPJ_TRUE; -} - -/** - * The default encoding validation procedure without any extension. - * - * @param p_j2k the jpeg2000 codec to validate. - * @param p_stream the input stream to validate. - * @param p_manager the user event manager. - * - * @return true if the parameters are correct. - */ +} + opj_bool opj_j2k_encoding_validation ( opj_j2k_v2_t * p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -6821,15 +6425,6 @@ opj_bool opj_j2k_encoding_validation ( opj_j2k_v2_t * p_j2k, return l_is_valid; } -/** - * The default decoding validation procedure without any extension. - * - * @param p_j2k the jpeg2000 codec to validate. - * @param p_stream the input stream to validate. - * @param p_manager the user event manager. - * - * @return true if the parameters are correct. - */ opj_bool opj_j2k_decoding_validation ( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager @@ -6842,7 +6437,6 @@ opj_bool opj_j2k_decoding_validation ( opj_j2k_v2_t *p_j2k, assert(p_stream != 00); assert(p_manager != 00); - /* STATE checking */ /* make sure the state is at 0 */ #ifdef TODO_MSD @@ -6990,16 +6584,6 @@ opj_bool opj_j2k_read_header_procedure( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Excutes the given procedures on the given codec. - * - * @param p_procedure_list the list of procedures to execute - * @param p_j2k the jpeg2000 codec to execute the procedures on. - * @param p_stream the stream to execute the procedures on. - * @param p_manager the user manager. - * - * @return true if all the procedures were successfully executed. - */ opj_bool opj_j2k_exec ( opj_j2k_v2_t * p_j2k, opj_procedure_list_t * p_procedure_list, opj_stream_private_t *p_stream, @@ -7015,7 +6599,6 @@ opj_bool opj_j2k_exec ( opj_j2k_v2_t * p_j2k, assert(p_stream != 00); assert(p_manager != 00); - l_nb_proc = opj_procedure_list_get_nb_procedures(p_procedure_list); l_procedure = (opj_bool (**) (opj_j2k_v2_t * ,opj_stream_private_t *,opj_event_mgr_t *)) opj_procedure_list_get_first_procedure(p_procedure_list); @@ -7032,7 +6615,7 @@ opj_bool opj_j2k_exec ( opj_j2k_v2_t * p_j2k, /* FIXME DOC*/ static opj_bool opj_j2k_copy_default_tcp_and_create_tcd ( opj_j2k_v2_t * p_j2k, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_tcp_v2_t * l_tcp = 00; @@ -7159,13 +6742,6 @@ static opj_bool opj_j2k_copy_default_tcp_and_create_tcd ( opj_j2k_v2_t * p return OPJ_TRUE; } -/** - * Reads the lookup table containing all the marker, status and action, and returns the handler associated - * with the marker value. - * @param p_id Marker value to look up - * - * @return the handler associated with the id. -*/ const opj_dec_memory_marker_handler_t * opj_j2k_get_marker_handler (OPJ_UINT32 p_id) { const opj_dec_memory_marker_handler_t *e; @@ -7177,12 +6753,6 @@ const opj_dec_memory_marker_handler_t * opj_j2k_get_marker_handler (OPJ_UINT32 p return e; } - -/** - * Destroys a jpeg2000 codec. - * - * @param p_j2k the jpeg20000 structure to destroy. - */ void opj_j2k_destroy (opj_j2k_v2_t *p_j2k) { if (p_j2k == 00) { @@ -7285,13 +6855,6 @@ void j2k_destroy_cstr_index (opj_codestream_index_t *p_cstr_ind) } } - - -/** - * Destroys a tile coding parameter structure. - * - * @param p_tcp the tile coding parameter to destroy. - */ void opj_j2k_tcp_destroy (opj_tcp_v2_t *p_tcp) { if (p_tcp == 00) { @@ -7351,11 +6914,6 @@ void opj_j2k_tcp_destroy (opj_tcp_v2_t *p_tcp) } -/** - * Destroys the data inside a tile coding parameter structure. - * - * @param p_tcp the tile coding parameter which contain data to destroy. - */ void opj_j2k_tcp_data_destroy (opj_tcp_v2_t *p_tcp) { if (p_tcp->m_data) { @@ -7365,11 +6923,6 @@ void opj_j2k_tcp_data_destroy (opj_tcp_v2_t *p_tcp) } } -/** - * Destroys a coding parameter structure. - * - * @param p_cp the coding parameter to destroy. - */ void opj_j2k_cp_destroy (opj_cp_v2_t *p_cp) { OPJ_UINT32 l_nb_tiles; @@ -7405,14 +6958,6 @@ void opj_j2k_cp_destroy (opj_cp_v2_t *p_cp) } } - - -/** - * Reads a tile header. - * @param p_j2k the jpeg2000 codec. - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. - */ opj_bool opj_j2k_read_tile_header( opj_j2k_v2_t * p_j2k, OPJ_UINT32 * p_tile_index, OPJ_UINT32 * p_data_size, @@ -7519,7 +7064,6 @@ opj_bool opj_j2k_read_tile_header( opj_j2k_v2_t * p_j2k, } } - if (p_j2k->m_specific_param.m_decoder.m_skip_data) { /* Skip the rest of the tile part header*/ if (opj_stream_skip(p_stream,p_j2k->m_specific_param.m_decoder.m_sot_length,p_manager) != p_j2k->m_specific_param.m_decoder.m_sot_length) { @@ -7546,8 +7090,6 @@ opj_bool opj_j2k_read_tile_header( opj_j2k_v2_t * p_j2k, return OPJ_FALSE; } - - if (! p_j2k->m_specific_param.m_decoder.m_can_decode){ /* Try to read 2 bytes (the next marker ID) from stream and copy them into the buffer */ if (opj_stream_read_data(p_stream,p_j2k->m_specific_param.m_decoder.m_header_data,2,p_manager) != 2) { @@ -7623,7 +7165,6 @@ opj_bool opj_j2k_read_tile_header( opj_j2k_v2_t * p_j2k, return OPJ_TRUE; } - opj_bool opj_j2k_decode_tile ( opj_j2k_v2_t * p_j2k, OPJ_UINT32 p_tile_index, OPJ_BYTE * p_data, @@ -7696,7 +7237,6 @@ opj_bool opj_j2k_decode_tile ( opj_j2k_v2_t * p_j2k, return OPJ_TRUE; } - opj_bool opj_j2k_update_image_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data, opj_image_t* p_output_image) { OPJ_UINT32 i,j,k = 0; @@ -7866,7 +7406,6 @@ opj_bool opj_j2k_update_image_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data, opj l_start_x_dest, l_start_y_dest, l_width_dest, l_height_dest, l_start_offset_dest, l_line_offset_dest); }*/ - switch (l_size_comp) { case 1: { @@ -7956,18 +7495,6 @@ opj_bool opj_j2k_update_image_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data, opj return OPJ_TRUE; } -/** - * Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading. - * - * @param p_j2k the jpeg2000 codec. - * @param p_start_x the left position of the rectangle to decode (in image coordinates). - * @param p_end_x the right position of the rectangle to decode (in image coordinates). - * @param p_start_y the up position of the rectangle to decode (in image coordinates). - * @param p_end_y the bottom position of the rectangle to decode (in image coordinates). - * @param p_manager the user event manager - * - * @return true if the area could be set. - */ opj_bool opj_j2k_set_decode_area( opj_j2k_v2_t *p_j2k, opj_image_t* p_image, OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, @@ -8121,19 +7648,9 @@ opj_bool opj_j2k_set_decode_area( opj_j2k_v2_t *p_j2k, opj_event_msg_v2( p_manager, EVT_INFO,"Setting decoding area to %d,%d,%d,%d\n", p_image->x0, p_image->y0, p_image->x1, p_image->y1); - return OPJ_TRUE; } - -/* ----------------------------------------------------------------------- */ -/* J2K / JPT decoder interface */ -/* ----------------------------------------------------------------------- */ -/** - * Creates a J2K decompression structure. - * - * @return a handle to a J2K decompressor if successful, NULL otherwise. -*/ opj_j2k_v2_t* opj_j2k_create_decompress(void) { opj_j2k_v2_t *l_j2k = (opj_j2k_v2_t*) opj_malloc(sizeof(opj_j2k_v2_t)); @@ -8193,7 +7710,6 @@ opj_j2k_v2_t* opj_j2k_create_decompress(void) return l_j2k; } - opj_codestream_index_t* opj_j2k_create_cstr_index(void) { opj_codestream_index_t* cstr_index = (opj_codestream_index_t*) @@ -8213,16 +7729,6 @@ opj_codestream_index_t* opj_j2k_create_cstr_index(void) return cstr_index; } - -/** - * Gets the size taken by writing a SPCod or SPCoc for the given tile and component. - * - * @param p_tile_no the tile index. - * @param p_comp_no the component being outputted. - * @param p_j2k the J2K codec. - * - * @return the number of bytes taken by the SPCod element. - */ OPJ_UINT32 opj_j2k_get_SPCod_SPCoc_size ( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_tile_no, OPJ_UINT32 p_comp_no ) @@ -8250,15 +7756,6 @@ OPJ_UINT32 opj_j2k_get_SPCod_SPCoc_size ( opj_j2k_v2_t *p_j2k, } } -/** - * Writes a SPCod or SPCoc element, i.e. the coding style of a given component of a tile. - * - * @param p_comp_no the component number to output. - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. - * -*/ opj_bool opj_j2k_write_SPCod_SPCoc( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_tile_no, OPJ_UINT32 p_comp_no, @@ -8325,13 +7822,6 @@ opj_bool opj_j2k_write_SPCod_SPCoc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Reads a SPCod or SPCoc element, i.e. the coding style of a given component of a tile. - * @param p_header_data the data contained in the COM box. - * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the COM marker. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_read_SPCod_SPCoc( opj_j2k_v2_t *p_j2k, OPJ_UINT32 compno, OPJ_BYTE * p_header_data, @@ -8429,7 +7919,6 @@ opj_bool opj_j2k_read_SPCod_SPCoc( opj_j2k_v2_t *p_j2k, p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].cblksty = l_tccp->cblksty; p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].tccp_info[compno].qmfbid = l_tccp->qmfbid; - memcpy(p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].pdx,l_tccp->prcw, l_data_size); memcpy(p_j2k->cstr_info->tile[p_j2k->m_current_tile_number].pdy,l_tccp->prch, l_data_size); } @@ -8439,11 +7928,6 @@ opj_bool opj_j2k_read_SPCod_SPCoc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Copies the tile component parameters of all the component from the first tile component. - * - * @param p_j2k the J2k codec. - */ void opj_j2k_copy_tile_component_parameters( opj_j2k_v2_t *p_j2k ) { /* loop */ @@ -8477,15 +7961,6 @@ void opj_j2k_copy_tile_component_parameters( opj_j2k_v2_t *p_j2k ) } } -/** - * Gets the size taken by writing SQcd or SQcc element, i.e. the quantization values of a band in the QCD or QCC. - * - * @param p_tile_no the tile index. - * @param p_comp_no the component being outputted. - * @param p_j2k the J2K codec. - * - * @return the number of bytes taken by the SPCod element. - */ OPJ_UINT32 opj_j2k_get_SQcd_SQcc_size ( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_tile_no, OPJ_UINT32 p_comp_no ) @@ -8517,17 +7992,6 @@ OPJ_UINT32 opj_j2k_get_SQcd_SQcc_size ( opj_j2k_v2_t *p_j2k, } } -/** - * Writes a SQcd or SQcc element, i.e. the quantization values of a band. - * - * @param p_tile_no the tile to output. - * @param p_comp_no the component number to output. - * @param p_data the data buffer. - * @param p_header_size pointer to the size of the data buffer, it is changed by the function. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. - * -*/ opj_bool opj_j2k_write_SQcd_SQcc( opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_tile_no, OPJ_UINT32 p_comp_no, @@ -8601,15 +8065,6 @@ opj_bool opj_j2k_write_SQcd_SQcc( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Reads a SQcd or SQcc element, i.e. the quantization values of a band. - * - * @param p_comp_no the component being targeted. - * @param p_header_data the data contained in the COM box. - * @param p_j2k the jpeg2000 codec. - * @param p_header_size the size of the data contained in the COM marker. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_read_SQcd_SQcc(opj_j2k_v2_t *p_j2k, OPJ_UINT32 p_comp_no, OPJ_BYTE* p_header_data, @@ -8727,11 +8182,6 @@ opj_bool opj_j2k_read_SQcd_SQcc(opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Copies the tile component parameters of all the component from the first tile component. - * - * @param p_j2k the J2k codec. - */ void opj_j2k_copy_tile_quantization_parameters( opj_j2k_v2_t *p_j2k ) { OPJ_UINT32 i; @@ -8761,14 +8211,6 @@ void opj_j2k_copy_tile_quantization_parameters( opj_j2k_v2_t *p_j2k ) } } -/** - * Dump some elements from the J2K decompression structure . - * - *@param p_j2k the jpeg2000 codec. - *@param flag flag to describe what elments are dump. - *@param out_stream output stream where dump the elements. - * -*/ void j2k_dump (opj_j2k_v2_t* p_j2k, OPJ_INT32 flag, FILE* out_stream) { /* Check if the flag is compatible with j2k file*/ @@ -8788,7 +8230,6 @@ void j2k_dump (opj_j2k_v2_t* p_j2k, OPJ_INT32 flag, FILE* out_stream) opj_j2k_dump_MH_info(p_j2k, out_stream); } - /* Dump the codestream info of the current tile */ if (flag & OPJ_J2K_TH_INFO){ @@ -8806,13 +8247,6 @@ void j2k_dump (opj_j2k_v2_t* p_j2k, OPJ_INT32 flag, FILE* out_stream) } -/** - * Dump index elements of the codestream extract from the main header. - * - *@param p_j2k the jpeg2000 codec. - *@param out_stream output stream where dump the elements. - * -*/ void opj_j2k_dump_MH_index(opj_j2k_v2_t* p_j2k, FILE* out_stream) { opj_codestream_index_t* cstr_index = p_j2k->cstr_index; @@ -8837,7 +8271,6 @@ void opj_j2k_dump_MH_index(opj_j2k_v2_t* p_j2k, FILE* out_stream) fprintf(out_stream, "\t }\n"); - if (cstr_index->tile_index){ /* Simple test to avoid to write empty information*/ @@ -8849,7 +8282,7 @@ void opj_j2k_dump_MH_index(opj_j2k_v2_t* p_j2k, FILE* out_stream) if (l_acc_nb_of_tile_part) { fprintf(out_stream, "\t Tile index: {\n"); - + for (it_tile=0; it_tile < cstr_index->nb_of_tiles ; it_tile++){ OPJ_UINT32 nb_of_tile_part = cstr_index->tile_index[it_tile].nb_tps; @@ -8882,13 +8315,6 @@ void opj_j2k_dump_MH_index(opj_j2k_v2_t* p_j2k, FILE* out_stream) } -/** - * Dump info elements of the codestream extract from the main header. - * - *@param p_j2k the jpeg2000 codec. - *@param out_stream output stream where dump the elements. - * -*/ void opj_j2k_dump_MH_info(opj_j2k_v2_t* p_j2k, FILE* out_stream) { opj_tcp_v2_t * l_default_tile=NULL; @@ -8955,13 +8381,6 @@ void opj_j2k_dump_MH_info(opj_j2k_v2_t* p_j2k, FILE* out_stream) } -/** - * Dump an image header structure. - * - *@param img_header the image header to dump. - *@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function - *@param out_stream output stream where dump the elements. - */ void j2k_dump_image_header(opj_image_t* img_header, opj_bool dev_dump_flag, FILE* out_stream) { char tab[2]; @@ -8991,13 +8410,6 @@ void j2k_dump_image_header(opj_image_t* img_header, opj_bool dev_dump_flag, FILE fprintf(out_stream, "}\n"); } -/** - * Dump a component image header structure. - * - *@param comp_header the component image header to dump. - *@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function - *@param out_stream output stream where dump the elements. - */ void j2k_dump_image_comp_header(opj_image_comp_t* comp_header, opj_bool dev_dump_flag, FILE* out_stream) { char tab[3]; @@ -9017,14 +8429,6 @@ void j2k_dump_image_comp_header(opj_image_comp_t* comp_header, opj_bool dev_dump fprintf(out_stream, "}\n"); } - -/** - * Get the codestream info from a JPEG2000 codec. - * - *@param p_j2k the component image header to dump. - * - *@return the codestream information extract from the jpg2000 codec - */ opj_codestream_info_v2_t* j2k_get_cstr_info(opj_j2k_v2_t* p_j2k) { OPJ_UINT16 compno; @@ -9086,17 +8490,9 @@ opj_codestream_info_v2_t* j2k_get_cstr_info(opj_j2k_v2_t* p_j2k) l_tccp_info->roishift = l_tccp->roishift; } - return cstr_info; } -/** - * Get the codestream index from a JPEG2000 codec. - * - *@param p_j2k the component image header to dump. - * - *@return the codestream index extract from the jpg2000 codec - */ opj_codestream_index_t* j2k_get_cstr_index(opj_j2k_v2_t* p_j2k) { opj_codestream_index_t* l_cstr_index = (opj_codestream_index_t*) @@ -9227,9 +8623,6 @@ opj_bool opj_j2k_allocate_tile_element_cstr_index(opj_j2k_v2_t *p_j2k) return OPJ_TRUE; } -/** - * Reads the tiles. - */ opj_bool opj_j2k_decode_tiles ( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager) @@ -9248,8 +8641,6 @@ opj_bool opj_j2k_decode_tiles ( opj_j2k_v2_t *p_j2k, } l_max_data_size = 1000; - - while (OPJ_TRUE) { if (! opj_j2k_read_tile_header( p_j2k, &l_current_tile_no, @@ -9379,7 +8770,6 @@ static opj_bool opj_j2k_decode_one_tile ( opj_j2k_v2_t *p_j2k, return OPJ_FALSE; } - if (! l_go_on) { break; } @@ -9398,8 +8788,6 @@ static opj_bool opj_j2k_decode_one_tile ( opj_j2k_v2_t *p_j2k, l_max_data_size = l_data_size; } - - if (! opj_j2k_decode_tile(p_j2k,l_current_tile_no,l_current_data,l_data_size,p_stream,p_manager)) { opj_free(l_current_data); return OPJ_FALSE; @@ -9432,7 +8820,6 @@ static opj_bool opj_j2k_decode_one_tile ( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - /** * Sets up the procedures to do on decoding one tile. Developpers wanting to extend the library can add their own reading procedures. */ @@ -9446,10 +8833,6 @@ static void opj_j2k_setup_decoding_tile (opj_j2k_v2_t *p_j2k) } - -/** - * Decodes the tiles of the stream. - */ opj_bool opj_j2k_decode(opj_j2k_v2_t * p_j2k, opj_stream_private_t * p_stream, opj_image_t * p_image, @@ -9486,18 +8869,6 @@ opj_bool opj_j2k_decode(opj_j2k_v2_t * p_j2k, return OPJ_TRUE; } - -/** - * Get the decoded tile. - * - * @param p_j2k the jpeg2000 codestream codec. - * @param p_stream input_stream - * @param p_image output image. . - * @param p_manager the user event manager - * @param tile_index index of the tile we want decode - * - * @return true if succeed. - */ opj_bool opj_j2k_get_tile( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_image_t* p_image, @@ -9592,8 +8963,8 @@ opj_bool opj_j2k_get_tile( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -opj_bool opj_j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, - OPJ_UINT32 res_factor, +opj_bool opj_j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, + OPJ_UINT32 res_factor, opj_event_mgr_t * p_manager) { OPJ_UINT32 it_comp; @@ -9621,10 +8992,6 @@ opj_bool opj_j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, return OPJ_FALSE; } - -/** - * Encodes all the tiles in a row. - */ opj_bool opj_j2k_encode_v2( opj_j2k_v2_t * p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager ) @@ -9676,10 +9043,6 @@ opj_bool opj_j2k_encode_v2( opj_j2k_v2_t * p_j2k, return OPJ_TRUE; } -/** - * Ends the compression procedures and possibility add data to be read after the - * codestream. - */ opj_bool opj_j2k_end_compress( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_event_mgr_t * p_manager) @@ -9695,16 +9058,6 @@ opj_bool opj_j2k_end_compress( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - -/** - * Starts a compression scheme, i.e. validates the codec parameters, writes the header. - * - * @param p_j2k the jpeg2000 codec. - * @param p_stream the stream object. - * @param p_manager the user event manager. - * - * @return true if the codec is valid. - */ opj_bool opj_j2k_start_compress(opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, opj_image_t * p_image, @@ -9749,9 +9102,6 @@ opj_bool opj_j2k_start_compress(opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/* - * - */ opj_bool opj_j2k_pre_write_tile ( opj_j2k_v2_t * p_j2k, OPJ_UINT32 p_tile_index, opj_stream_private_t *p_stream, @@ -9777,9 +9127,6 @@ opj_bool opj_j2k_pre_write_tile ( opj_j2k_v2_t * p_j2k, return OPJ_TRUE; } -/* - * - */ void opj_j2k_get_tile_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data) { OPJ_UINT32 i,j,k = 0; @@ -9883,13 +9230,6 @@ void opj_j2k_get_tile_data (opj_tcd_v2_t * p_tcd, OPJ_BYTE * p_data) } } - -/** - * Write a tile. - * @param p_j2k the jpeg2000 codec. - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. - */ opj_bool opj_j2k_post_write_tile ( opj_j2k_v2_t * p_j2k, OPJ_BYTE * p_data, OPJ_UINT32 p_data_size, @@ -9946,11 +9286,6 @@ opj_bool opj_j2k_post_write_tile ( opj_j2k_v2_t * p_j2k, return OPJ_TRUE; } - -/** - * Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters - * are valid. Developers wanting to extend the library can add their own validation procedures. - */ void opj_j2k_setup_end_compress (opj_j2k_v2_t *p_j2k) { /* preconditions */ @@ -9968,10 +9303,6 @@ void opj_j2k_setup_end_compress (opj_j2k_v2_t *p_j2k) opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_destroy_header_memory); } -/** - * Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters - * are valid. Developers wanting to extend the library can add their own validation procedures. - */ void opj_j2k_setup_encoding_validation (opj_j2k_v2_t *p_j2k) { /* preconditions */ @@ -9984,11 +9315,6 @@ void opj_j2k_setup_encoding_validation (opj_j2k_v2_t *p_j2k) opj_procedure_list_add_procedure(p_j2k->m_validation_list, (opj_procedure)opj_j2k_mct_validation); } - -/** - * Sets up the procedures to do on writing header. - * Developers wanting to extend the library can add their own writing procedures. - */ void opj_j2k_setup_header_writting (opj_j2k_v2_t *p_j2k) { /* preconditions */ @@ -10000,7 +9326,6 @@ void opj_j2k_setup_header_writting (opj_j2k_v2_t *p_j2k) opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_cod ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_qcd ); - if (p_j2k->m_cp.m_specific_param.m_enc.m_cinema) { opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_image_components ); opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_write_tlm ); @@ -10030,7 +9355,6 @@ void opj_j2k_setup_header_writting (opj_j2k_v2_t *p_j2k) opj_procedure_list_add_procedure(p_j2k->m_procedure_list,(opj_procedure)opj_j2k_update_rates); } - opj_bool opj_j2k_write_first_tile_part (opj_j2k_v2_t *p_j2k, OPJ_BYTE * p_data, OPJ_UINT32 * p_data_written, @@ -10132,7 +9456,6 @@ opj_bool opj_j2k_write_all_tile_parts( opj_j2k_v2_t *p_j2k, opj_tcd_v2_t * l_tcd = 00; opj_cp_v2_t * l_cp = 00; - l_tcd = p_j2k->m_tcd; l_cp = &(p_j2k->m_cp); l_tcp = l_cp->tcps + p_j2k->m_current_tile_number; @@ -10222,13 +9545,6 @@ opj_bool opj_j2k_write_all_tile_parts( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } -/** - * Writes the updated tlm. - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_write_updated_tlm( opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) @@ -10260,14 +9576,6 @@ opj_bool opj_j2k_write_updated_tlm( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - -/** - * Ends the encoding, i.e. frees memory. - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_end_encoding( opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) @@ -10301,7 +9609,7 @@ opj_bool opj_j2k_end_encoding( opj_j2k_v2_t *p_j2k, */ static opj_bool opj_j2k_destroy_header_memory ( opj_j2k_v2_t * p_j2k, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { /* preconditions */ @@ -10319,14 +9627,6 @@ static opj_bool opj_j2k_destroy_header_memory ( opj_j2k_v2_t * p_j2k, return OPJ_TRUE; } - -/** - * Inits the Info - * - * @param p_stream the stream to write data to. - * @param p_j2k J2K codec. - * @param p_manager the user event manager. -*/ opj_bool opj_j2k_init_info( opj_j2k_v2_t *p_j2k, struct opj_stream_private *p_stream, struct opj_event_mgr * p_manager ) @@ -10390,7 +9690,7 @@ opj_bool opj_j2k_init_info( opj_j2k_v2_t *p_j2k, */ static opj_bool opj_j2k_create_tcd( opj_j2k_v2_t *p_j2k, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { /* preconditions */ @@ -10414,13 +9714,6 @@ static opj_bool opj_j2k_create_tcd( opj_j2k_v2_t *p_j2k, return OPJ_TRUE; } - -/** - * Writes a tile. - * @param p_j2k the jpeg2000 codec. - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. - */ opj_bool opj_j2k_write_tile (opj_j2k_v2_t * p_j2k, OPJ_UINT32 p_tile_index, OPJ_BYTE * p_data, diff --git a/libopenjpeg/j2k.h b/libopenjpeg/j2k.h index 344b5cf9..2782a096 100644 --- a/libopenjpeg/j2k.h +++ b/libopenjpeg/j2k.h @@ -788,9 +788,9 @@ Decoding parameters are returned in j2k->cp. void opj_j2k_setup_decoder(opj_j2k_v2_t *j2k, opj_dparameters_t *parameters); /** -Creates a J2K compression structure -@param cinfo Codec context info -@return Returns a handle to a J2K compressor if successful, returns NULL otherwise + * Creates a J2K compression structure + * + * @return Returns a handle to a J2K compressor if successful, returns NULL otherwise */ opj_j2k_v2_t* opj_j2k_create_compress(void); @@ -821,8 +821,9 @@ opj_bool opj_j2k_end_decompress(opj_j2k_v2_t *j2k, /** * Reads a jpeg2000 codestream header structure. * - * @param cio the stream to read data from. + * @param p_stream the stream to read data from. * @param p_j2k the jpeg2000 codec. + * @param p_image FIXME DOC * @param p_manager the user event manager. * * @return true if the box is valid. @@ -850,6 +851,9 @@ void j2k_destroy_cstr_index (opj_codestream_index_t *p_cstr_ind); /** * Decode tile data. * @param p_j2k the jpeg2000 codec. + * @param p_tile_index + * @param p_data FIXME DOC + * @param p_data_size FIXME DOC * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ @@ -863,6 +867,14 @@ opj_bool opj_j2k_decode_tile ( opj_j2k_v2_t * p_j2k, /** * Reads a tile header. * @param p_j2k the jpeg2000 codec. + * @param p_tile_index FIXME DOC + * @param p_data_size FIXME DOC + * @param p_tile_x0 FIXME DOC + * @param p_tile_y0 FIXME DOC + * @param p_tile_x1 FIXME DOC + * @param p_tile_y1 FIXME DOC + * @param p_nb_comps FIXME DOC + * @param p_go_on FIXME DOC * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ @@ -883,9 +895,10 @@ opj_bool opj_j2k_read_tile_header ( opj_j2k_v2_t * p_j2k, * Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading. * * @param p_j2k the jpeg2000 codec. + * @param p_image FIXME DOC * @param p_start_x the left position of the rectangle to decode (in image coordinates). - * @param p_end_x the right position of the rectangle to decode (in image coordinates). * @param p_start_y the up position of the rectangle to decode (in image coordinates). + * @param p_end_x the right position of the rectangle to decode (in image coordinates). * @param p_end_y the bottom position of the rectangle to decode (in image coordinates). * @param p_manager the user event manager * @@ -920,7 +933,7 @@ void j2k_dump (opj_j2k_v2_t* p_j2k, OPJ_INT32 flag, FILE* out_stream); /** * Dump an image header structure. * - *@param img_header the image header to dump. + *@param image the image header to dump. *@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function *@param out_stream output stream where dump the elements. */ @@ -929,7 +942,7 @@ void j2k_dump_image_header(opj_image_t* image, opj_bool dev_dump_flag, FILE* out /** * Dump a component image header structure. * - *@param comp_header the component image header to dump. + *@param comp the component image header to dump. *@param dev_dump_flag flag to describe if we are in the case of this function is use outside j2k_dump function *@param out_stream output stream where dump the elements. */ @@ -956,13 +969,14 @@ opj_codestream_index_t* j2k_get_cstr_index(opj_j2k_v2_t* p_j2k); /** * Decode an image from a JPEG-2000 codestream * @param j2k J2K decompressor handle - * @param cio Input buffer stream - * @param cstr_info Codestream information structure if required, NULL otherwise - * @return Returns a decoded image if successful, returns NULL otherwise + * @param p_stream FIXME DOC + * @param p_image FIXME DOC + * @param p_manager FIXME DOC + * @return FIXME DOC */ -opj_bool opj_j2k_decode(opj_j2k_v2_t *j2k, - opj_stream_private_t *p_stream, - opj_image_t *p_image, +opj_bool opj_j2k_decode(opj_j2k_v2_t *j2k, + opj_stream_private_t *p_stream, + opj_image_t *p_image, opj_event_mgr_t *p_manager); @@ -980,6 +994,9 @@ opj_bool opj_j2k_set_decoded_resolution_factor(opj_j2k_v2_t *p_j2k, /** * Writes a tile. * @param p_j2k the jpeg2000 codec. + * @param p_tile_index FIXME DOC + * @param p_data FIXME DOC + * @param p_data_size FIXME DOC * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ @@ -1001,7 +1018,8 @@ opj_bool opj_j2k_encode_v2( opj_j2k_v2_t * p_j2k, * Starts a compression scheme, i.e. validates the codec parameters, writes the header. * * @param p_j2k the jpeg2000 codec. - * @param cio the stream object. + * @param p_stream the stream object. + * @param p_image FIXME DOC * @param p_manager the user event manager. * * @return true if the codec is valid. diff --git a/libopenjpeg/jp2.c b/libopenjpeg/jp2.c index 1fc26e0e..0d76eb44 100644 --- a/libopenjpeg/jp2.c +++ b/libopenjpeg/jp2.c @@ -39,7 +39,6 @@ /** @name Local static functions */ /*@{*/ - /*static void jp2_write_url(opj_cio_t *cio, char *Idx_file);*/ /** @@ -62,10 +61,10 @@ static opj_bool opj_jp2_read_ihdr( opj_jp2_v2_t *jp2, * * @param jp2 jpeg2000 file codec. * @param p_nb_bytes_written pointer to store the nb of bytes written by the function. - * + * * @return the data being copied. */ -static OPJ_BYTE * opj_jp2_write_ihdr(opj_jp2_v2_t *jp2, +static OPJ_BYTE * opj_jp2_write_ihdr(opj_jp2_v2_t *jp2, OPJ_UINT32 * p_nb_bytes_written ); /** @@ -73,10 +72,10 @@ static OPJ_BYTE * opj_jp2_write_ihdr(opj_jp2_v2_t *jp2, * * @param jp2 jpeg2000 file codec. * @param p_nb_bytes_written pointer to store the nb of bytes written by the function. - * + * * @return the data being copied. */ -static OPJ_BYTE * opj_jp2_write_bpcc( opj_jp2_v2_t *jp2, +static OPJ_BYTE * opj_jp2_write_bpcc( opj_jp2_v2_t *jp2, OPJ_UINT32 * p_nb_bytes_written ); /** @@ -106,10 +105,10 @@ static void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color); * * @param jp2 jpeg2000 file codec. * @param p_nb_bytes_written pointer to store the nb of bytes written by the function. - * + * * @return the data being copied. */ -static OPJ_BYTE * opj_jp2_write_colr( opj_jp2_v2_t *jp2, +static OPJ_BYTE * opj_jp2_write_colr( opj_jp2_v2_t *jp2, OPJ_UINT32 * p_nb_bytes_written ); /** @@ -118,7 +117,7 @@ static OPJ_BYTE * opj_jp2_write_colr( opj_jp2_v2_t *jp2, * @param cio the stream to write data to. * @param jp2 the jpeg2000 file codec. * @param p_manager the user event manager. - * + * * @return true if writting was successful. */ static opj_bool opj_jp2_write_ftyp( opj_jp2_v2_t *jp2, @@ -140,15 +139,6 @@ static opj_bool opj_jp2_read_ftyp( opj_jp2_v2_t *jp2, OPJ_UINT32 p_header_size, opj_event_mgr_t * p_manager ); -/** - * Skips the Jpeg2000 Codestream Header box - JP2C Header box. - * - * @param cio the stream to write data to. - * @param jp2 the jpeg2000 file codec. - * @param p_manager user event manager. - * - * @return true if writting was successful. -*/ opj_bool opj_jp2_skip_jp2c( opj_jp2_v2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t * p_manager ); @@ -202,7 +192,7 @@ static opj_bool opj_jp2_read_jp(opj_jp2_v2_t *jp2, * @param cio the stream to write data to. * @param jp2 the jpeg2000 file codec. * @param p_manager the user event manager. - * + * * @return true if writting was successful. */ static opj_bool opj_jp2_write_jp( opj_jp2_v2_t *jp2, @@ -212,19 +202,21 @@ static opj_bool opj_jp2_write_jp( opj_jp2_v2_t *jp2, /** Apply collected palette data @param color Collector for profile, cdef and pclr data -@param image +@param image */ static void opj_jp2_apply_pclr(opj_image_t *image, opj_jp2_color_t *color); static void opj_jp2_free_pclr(opj_jp2_color_t *color); /** -Collect palette data -@param jp2 JP2 handle -@param cio Input buffer stream -@param box -@param color Collector for profile, cdef and pclr data -@return Returns true if successful, returns false otherwise + * Collect palette data + * + * @param jp2 JP2 handle + * @param p_pclr_header_data FIXME DOC + * @param p_pclr_header_size FIXME DOC + * @param p_manager + * + * @return Returns true if successful, returns false otherwise */ static opj_bool opj_jp2_read_pclr( opj_jp2_v2_t *jp2, OPJ_BYTE * p_pclr_header_data, @@ -232,12 +224,14 @@ static opj_bool opj_jp2_read_pclr( opj_jp2_v2_t *jp2, opj_event_mgr_t * p_manager ); /** -Collect component mapping data -@param jp2 JP2 handle -@param cio Input buffer stream -@param box -@param color Collector for profile, cdef and pclr data -@return Returns true if successful, returns false otherwise + * Collect component mapping data + * + * @param jp2 JP2 handle + * @param p_cmap_header_data FIXME DOC + * @param p_cmap_header_size FIXME DOC + * @param p_manager FIXME DOC + * + * @return Returns true if successful, returns false otherwise */ static opj_bool opj_jp2_read_cmap( opj_jp2_v2_t * jp2, @@ -270,7 +264,6 @@ static opj_bool opj_jp2_read_colr( opj_jp2_v2_t *jp2, */ static void opj_jp2_setup_end_header_writting (opj_jp2_v2_t *jp2); - /** * Sets up the procedures to do on reading header after the codestream. * Developpers wanting to extend the library can add their own writting procedures. @@ -280,8 +273,8 @@ static void opj_jp2_setup_end_header_reading (opj_jp2_v2_t *jp2); /** * Reads a jpeg2000 file header structure. * - * @param cio the stream to read data from. * @param jp2 the jpeg2000 file header structure. + * @param stream the stream to read data from. * @param p_manager the user event manager. * * @return true if the box is valid. @@ -326,21 +319,11 @@ static opj_bool opj_jp2_read_boxhdr(opj_jp2_box_t *box, */ static void opj_jp2_setup_encoding_validation (opj_jp2_v2_t *jp2); - /** * Sets up the procedures to do on writting header. Developpers wanting to extend the library can add their own writting procedures. */ static void opj_jp2_setup_header_writting (opj_jp2_v2_t *jp2); -/** - * The default validation procedure without any extension. - * - * @param jp2 the jpeg2000 codec to validate. - * @param cio the input stream to validate. - * @param p_manager the user event manager. - * - * @return true if the parameters are correct. - */ opj_bool opj_jp2_default_validation ( opj_jp2_v2_t * jp2, opj_stream_private_t *cio, opj_event_mgr_t * p_manager ); @@ -384,10 +367,11 @@ const opj_jp2_header_handler_t jp2_img_header [] = /** * Reads a box header. The box is the way data is packed inside a jpeg2000 file structure. Data is read from a character string * - * @param p_data the character string to read data from. * @param box the box structure to fill. + * @param p_data the character string to read data from. * @param p_number_bytes_read pointer to an int that will store the number of bytes read from the stream (shoul usually be 2). * @param p_box_max_size the maximum number of bytes in the box. + * @param p_manager FIXME DOC * * @return true if the box is reconized, false otherwise */ @@ -409,20 +393,8 @@ static void opj_jp2_setup_decoding_validation (opj_jp2_v2_t *jp2); */ static void opj_jp2_setup_header_reading (opj_jp2_v2_t *jp2); - - /* ----------------------------------------------------------------------- */ -/** - * Reads a box header. The box is the way data is packed inside a jpeg2000 file structure. - * - * @param cio the input stream to read data from. - * @param box the box structure to fill. - * @param p_number_bytes_read pointer to an int that will store the number of bytes read from the stream (should usually be 8). - * @param p_manager user event manager. - * - * @return true if the box is reconized, false otherwise -*/ opj_bool opj_jp2_read_boxhdr(opj_jp2_box_t *box, OPJ_UINT32 * p_number_bytes_read, opj_stream_private_t *cio, @@ -495,17 +467,6 @@ static void jp2_write_url(opj_cio_t *cio, char *Idx_file) { } #endif - -/** - * Reads a IHDR box - Image Header box - * - * @param jp2 the jpeg2000 file codec. - * @param p_image_header_data pointer to actual data (already read from file) - * @param p_image_header_size the size of the image header - * @param p_manager the user event manager. - * - * @return true if the image header is valid, fale else. - */ opj_bool opj_jp2_read_ihdr( opj_jp2_v2_t *jp2, OPJ_BYTE *p_image_header_data, OPJ_UINT32 p_image_header_size, @@ -541,7 +502,7 @@ opj_bool opj_jp2_read_ihdr( opj_jp2_v2_t *jp2, /* if equal to 0 then need a BPC box (cf. chapter about image header box of the norm) */ /*if (jp2->bpc == 0){ - indicate with a flag that we will wait a BPC box + indicate with a flag that we will wait a BPC box }*/ opj_read_bytes(p_image_header_data,&(jp2->C),1); /* C */ @@ -560,16 +521,8 @@ opj_bool opj_jp2_read_ihdr( opj_jp2_v2_t *jp2, return OPJ_TRUE; } -/** - * Writes the Image Header box - Image Header box. - * - * @param jp2 jpeg2000 file codec. - * @param p_nb_bytes_written pointer to store the nb of bytes written by the function. - * - * @return the data being copied. -*/ -OPJ_BYTE * opj_jp2_write_ihdr(opj_jp2_v2_t *jp2, - OPJ_UINT32 * p_nb_bytes_written +OPJ_BYTE * opj_jp2_write_ihdr(opj_jp2_v2_t *jp2, + OPJ_UINT32 * p_nb_bytes_written ) { unsigned char * l_ihdr_data,* l_current_ihdr_ptr; @@ -619,16 +572,8 @@ OPJ_BYTE * opj_jp2_write_ihdr(opj_jp2_v2_t *jp2, return l_ihdr_data; } -/** - * Writes the Bit per Component box. - * - * @param jp2 jpeg2000 file codec. - * @param p_nb_bytes_written pointer to store the nb of bytes written by the function. - * - * @return the data being copied. -*/ -OPJ_BYTE * opj_jp2_write_bpcc( opj_jp2_v2_t *jp2, - OPJ_UINT32 * p_nb_bytes_written +OPJ_BYTE * opj_jp2_write_bpcc( opj_jp2_v2_t *jp2, + OPJ_UINT32 * p_nb_bytes_written ) { unsigned int i; @@ -664,21 +609,10 @@ OPJ_BYTE * opj_jp2_write_bpcc( opj_jp2_v2_t *jp2, return l_bpcc_data; } - -/** - * Reads a Bit per Component box. - * - * @param jp2 the jpeg2000 file codec. - * @param p_bpc_header_data pointer to actual data (already read from file) - * @param p_bpc_header_size pointer that will hold the size of the bpc header - * @param p_manager the user event manager. - * - * @return true if the bpc header is valid, false otherwise. - */ opj_bool opj_jp2_read_bpcc( opj_jp2_v2_t *jp2, OPJ_BYTE * p_bpc_header_data, OPJ_UINT32 p_bpc_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 i; @@ -708,16 +642,8 @@ opj_bool opj_jp2_read_bpcc( opj_jp2_v2_t *jp2, return OPJ_TRUE; } -/** - * Writes the Colour Specification box. - * - * @param jp2 jpeg2000 file codec. - * @param p_nb_bytes_written pointer to store the nb of bytes written by the function. - * - * @return the data being copied. -*/ -OPJ_BYTE * opj_jp2_write_colr( opj_jp2_v2_t *jp2, - OPJ_UINT32 * p_nb_bytes_written +OPJ_BYTE * opj_jp2_write_colr( opj_jp2_v2_t *jp2, + OPJ_UINT32 * p_nb_bytes_written ) { /* room for 8 bytes for box 3 for common data and variable upon profile*/ @@ -764,7 +690,7 @@ OPJ_BYTE * opj_jp2_write_colr( opj_jp2_v2_t *jp2, if (jp2->meth == 1) { opj_write_bytes(l_current_colr_ptr, jp2->enumcs,4); /* EnumCS */ - } + } else { opj_write_bytes(l_current_colr_ptr, 0, 1); /* PROFILE (??) */ } @@ -785,8 +711,6 @@ void opj_jp2_free_pclr(opj_jp2_color_t *color) opj_free(color->jp2_pclr); color->jp2_pclr = NULL; } - - void opj_jp2_apply_pclr(opj_image_t *image, opj_jp2_color_t *color) { opj_image_comp_t *old_comps, *new_comps; @@ -860,20 +784,10 @@ void opj_jp2_apply_pclr(opj_image_t *image, opj_jp2_color_t *color) }/* apply_pclr() */ -/** - * Reads a palette box. - * - * @param jp2 the jpeg2000 file codec. - * @param p_pclr_header_data pointer to actual data (already read from file) - * @param p_pclr_header_size pointer that will hold the size of the PCLR header - * @param p_manager the user event manager. - * - * @return true if the bpc header is valid, fale else. - */ opj_bool opj_jp2_read_pclr( opj_jp2_v2_t *jp2, OPJ_BYTE * p_pclr_header_data, OPJ_UINT32 p_pclr_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_jp2_pclr_t *jp2_pclr; @@ -936,20 +850,10 @@ opj_bool opj_jp2_read_pclr( opj_jp2_v2_t *jp2, return OPJ_TRUE; } -/** - * Reads the Component Mapping box. - * - * @param p_cmap_header_data pointer to actual data (already read from file) - * @param jp2 the jpeg2000 file codec. - * @param p_cmap_header_size pointer that will hold the size of the color header - * @param p_manager the user event manager. - * - * @return true if the cdef header is valid, false else. -*/ opj_bool opj_jp2_read_cmap( opj_jp2_v2_t * jp2, OPJ_BYTE * p_cmap_header_data, OPJ_UINT32 p_cmap_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_jp2_cmap_comp_t *cmap; @@ -1034,20 +938,10 @@ void opj_jp2_apply_cdef(opj_image_t *image, opj_jp2_color_t *color) }/* jp2_apply_cdef() */ -/** - * Reads the Component Definition box. - * - * @param p_cdef_header_data pointer to actual data (already read from file) - * @param jp2 the jpeg2000 file codec. - * @param p_cdef_header_size pointer that will hold the size of the color header - * @param p_manager the user event manager. - * - * @return true if the cdef header is valid, false else. -*/ opj_bool opj_jp2_read_cdef( opj_jp2_v2_t * jp2, OPJ_BYTE * p_cdef_header_data, OPJ_UINT32 p_cdef_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_jp2_cdef_info_t *cdef_info; @@ -1095,21 +989,10 @@ opj_bool opj_jp2_read_cdef( opj_jp2_v2_t * jp2, return OPJ_TRUE; } -/** - * Reads the Colour Specification box. - * - * @param p_colr_header_data pointer to actual data (already read from file) - * @param jp2 the jpeg2000 file codec. - * @param p_colr_header_size pointer that will hold the size of the color header - * @param p_colr_header_max_size maximum size of the header, any size bigger than this value should result the function to output false. - * @param p_manager the user event manager. - * - * @return true if the bpc header is valid, fale else. -*/ opj_bool opj_jp2_read_colr( opj_jp2_v2_t *jp2, OPJ_BYTE * p_colr_header_data, OPJ_UINT32 p_colr_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_value; @@ -1176,7 +1059,6 @@ opj_bool opj_jp2_read_colr( opj_jp2_v2_t *jp2, return OPJ_TRUE; } - opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2, opj_stream_private_t *p_stream, opj_image_t* p_image, @@ -1190,7 +1072,7 @@ opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2, opj_event_msg_v2(p_manager, EVT_ERROR, "Failed to decode the codestream in the JP2 file\n"); return OPJ_FALSE; } - + if (!jp2->ignore_pclr_cmap_cdef){ /* Set Image Color Space */ @@ -1226,19 +1108,9 @@ opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2, return OPJ_TRUE; } - -/** - * Writes the Jpeg2000 file Header box - JP2 Header box (warning, this is a super box). - * - * @param cio the stream to write data to. - * @param jp2 the jpeg2000 file codec. - * @param p_manager user event manager. - * - * @return true if writting was successful. -*/ opj_bool opj_jp2_write_jp2h(opj_jp2_v2_t *jp2, opj_stream_private_t *stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_jp2_img_header_writer_handler_t l_writers [3]; @@ -1334,15 +1206,6 @@ opj_bool opj_jp2_write_jp2h(opj_jp2_v2_t *jp2, return l_result; } -/** - * Writes a FTYP box - File type box - * - * @param cio the stream to write data to. - * @param jp2 the jpeg2000 file codec. - * @param p_manager the user event manager. - * - * @return true if writting was successful. - */ opj_bool opj_jp2_write_ftyp(opj_jp2_v2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t * p_manager ) @@ -1395,18 +1258,9 @@ opj_bool opj_jp2_write_ftyp(opj_jp2_v2_t *jp2, return l_result; } -/** - * Writes the Jpeg2000 codestream Header box - JP2C Header box. - * - * @param cio the stream to write data to. - * @param jp2 the jpeg2000 file codec. - * @param p_manager user event manager. - * - * @return true if writting was successful. -*/ opj_bool opj_jp2_write_jp2c(opj_jp2_v2_t *jp2, opj_stream_private_t *cio, - opj_event_mgr_t * p_manager ) + opj_event_mgr_t * p_manager ) { OPJ_OFF_T j2k_codestream_exit; OPJ_BYTE l_data_header [8]; @@ -1441,18 +1295,9 @@ opj_bool opj_jp2_write_jp2c(opj_jp2_v2_t *jp2, return OPJ_TRUE; } -/** - * Writes a jpeg2000 file signature box. - * - * @param cio the stream to write data to. - * @param jp2 the jpeg2000 file codec. - * @param p_manager the user event manager. - * - * @return true if writting was successful. - */ opj_bool opj_jp2_write_jp( opj_jp2_v2_t *jp2, opj_stream_private_t *cio, - opj_event_mgr_t * p_manager ) + opj_event_mgr_t * p_manager ) { /* 12 bytes will be read */ unsigned char l_signature_data [12]; @@ -1476,12 +1321,10 @@ opj_bool opj_jp2_write_jp( opj_jp2_v2_t *jp2, return OPJ_TRUE; } - /* ----------------------------------------------------------------------- */ /* JP2 decoder interface */ /* ----------------------------------------------------------------------- */ - void opj_jp2_setup_decoder(opj_jp2_v2_t *jp2, opj_dparameters_t *parameters) { /* setup the J2K codec */ @@ -1492,16 +1335,15 @@ void opj_jp2_setup_decoder(opj_jp2_v2_t *jp2, opj_dparameters_t *parameters) jp2->ignore_pclr_cmap_cdef = parameters->flags & OPJ_DPARAMETERS_IGNORE_PCLR_CMAP_CDEF_FLAG; } - /* ----------------------------------------------------------------------- */ /* JP2 encoder interface */ /* ----------------------------------------------------------------------- */ -void opj_jp2_setup_encoder( opj_jp2_v2_t *jp2, - opj_cparameters_t *parameters, - opj_image_t *image, - opj_event_mgr_t * p_manager) -{ +void opj_jp2_setup_encoder( opj_jp2_v2_t *jp2, + opj_cparameters_t *parameters, + opj_image_t *image, + opj_event_mgr_t * p_manager) +{ OPJ_UINT32 i; int depth_0, sign; @@ -1577,20 +1419,14 @@ void opj_jp2_setup_encoder( opj_jp2_v2_t *jp2, // jp2->jpip_on = parameters->jpip_on; } - -opj_bool opj_jp2_encode(opj_jp2_v2_t *jp2, - opj_stream_private_t *stream, +opj_bool opj_jp2_encode(opj_jp2_v2_t *jp2, + opj_stream_private_t *stream, opj_event_mgr_t * p_manager) { return opj_j2k_encode_v2(jp2->j2k, stream, p_manager); } - -/** - * Ends the decompression procedures and possibiliy add data to be read after the - * codestream. - */ -opj_bool opj_jp2_end_decompress(opj_jp2_v2_t *jp2, +opj_bool opj_jp2_end_decompress(opj_jp2_v2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t * p_manager ) @@ -1611,10 +1447,6 @@ opj_bool opj_jp2_end_decompress(opj_jp2_v2_t *jp2, return opj_j2k_end_decompress(jp2->j2k, cio, p_manager); } -/** - * Ends the compression procedures and possibility add data to be read after the - * codestream. - */ opj_bool opj_jp2_end_compress( opj_jp2_v2_t *jp2, opj_stream_private_t *cio, opj_event_mgr_t * p_manager @@ -1636,11 +1468,6 @@ opj_bool opj_jp2_end_compress( opj_jp2_v2_t *jp2, return opj_jp2_exec(jp2,jp2->m_procedure_list,cio,p_manager); } - -/** - * Sets up the procedures to do on writing header after the codestream. - * Developers wanting to extend the library can add their own writing procedures. - */ void opj_jp2_setup_end_header_writting (opj_jp2_v2_t *jp2) { /* preconditions */ @@ -1650,10 +1477,6 @@ void opj_jp2_setup_end_header_writting (opj_jp2_v2_t *jp2) /* DEVELOPER CORNER, add your custom procedures */ } -/** - * Sets up the procedures to do on reading header after the codestream. - * Developers wanting to extend the library can add their own writing procedures. - */ void opj_jp2_setup_end_header_reading (opj_jp2_v2_t *jp2) { /* preconditions */ @@ -1662,18 +1485,9 @@ void opj_jp2_setup_end_header_reading (opj_jp2_v2_t *jp2) /* DEVELOPER CORNER, add your custom procedures */ } -/** - * The default validation procedure without any extension. - * - * @param jp2 the jpeg2000 codec to validate. - * @param cio the input stream to validate. - * @param p_manager the user event manager. - * - * @return true if the parameters are correct. - */ opj_bool opj_jp2_default_validation ( opj_jp2_v2_t * jp2, opj_stream_private_t *cio, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_bool l_is_valid = OPJ_TRUE; @@ -1726,18 +1540,9 @@ opj_bool opj_jp2_default_validation ( opj_jp2_v2_t * jp2, return l_is_valid; } -/** - * Reads a jpeg2000 file header structure. - * - * @param stream the stream to read data from. - * @param jp2 the jpeg2000 file header structure. - * @param p_manager the user event manager. - * - * @return true if the box is valid. - */ -static opj_bool opj_jp2_read_header_procedure( opj_jp2_v2_t *jp2, +opj_bool opj_jp2_read_header_procedure( opj_jp2_v2_t *jp2, opj_stream_private_t *stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { opj_jp2_box_t box; @@ -1837,7 +1642,7 @@ static opj_bool opj_jp2_read_header_procedure( opj_jp2_v2_t *jp2, static opj_bool opj_jp2_exec ( opj_jp2_v2_t * jp2, opj_procedure_list_t * p_procedure_list, opj_stream_private_t *stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { @@ -1864,14 +1669,6 @@ static opj_bool opj_jp2_exec ( opj_jp2_v2_t * jp2, return l_result; } -/** - * Starts a compression scheme, i.e. validates the codec parameters, writes the header. - * - * @param jp2 the jpeg2000 file codec. - * @param cio the stream object. - * - * @return true if the codec is valid. - */ opj_bool opj_jp2_start_compress(opj_jp2_v2_t *jp2, opj_stream_private_t *stream, opj_image_t * p_image, @@ -1902,13 +1699,6 @@ opj_bool opj_jp2_start_compress(opj_jp2_v2_t *jp2, return opj_j2k_start_compress(jp2->j2k,stream,p_image,p_manager); } -/** - * Finds the execution function related to the given box id. - * - * @param p_id the id of the handler to fetch. - * - * @return the given handler or 00 if it could not be found. - */ const opj_jp2_header_handler_t * opj_jp2_find_handler (OPJ_UINT32 p_id) { OPJ_UINT32 i, l_handler_size = sizeof(jp2_header) / sizeof(opj_jp2_header_handler_t); @@ -1941,7 +1731,6 @@ static const opj_jp2_header_handler_t * opj_jp2_img_find_handler (OPJ_UINT32 p_i return NULL; } - /** * Reads a jpeg2000 file signature box. * @@ -1989,7 +1778,6 @@ static opj_bool opj_jp2_read_jp(opj_jp2_v2_t *jp2, return OPJ_TRUE; } - /** * Reads a a FTYP box - File type box * @@ -2003,7 +1791,7 @@ static opj_bool opj_jp2_read_jp(opj_jp2_v2_t *jp2, static opj_bool opj_jp2_read_ftyp( opj_jp2_v2_t *jp2, OPJ_BYTE * p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 i, l_remaining_bytes; @@ -2060,15 +1848,6 @@ static opj_bool opj_jp2_read_ftyp( opj_jp2_v2_t *jp2, return OPJ_TRUE; } -/** - * Skips the Jpeg2000 Codestream Header box - JP2C Header box. - * - * @param cio the stream to write data to. - * @param jp2 the jpeg2000 file codec. - * @param p_manager user event manager. - * - * @return true if writting was successful. -*/ opj_bool opj_jp2_skip_jp2c( opj_jp2_v2_t *jp2, opj_stream_private_t *stream, opj_event_mgr_t * p_manager ) @@ -2100,7 +1879,7 @@ opj_bool opj_jp2_skip_jp2c( opj_jp2_v2_t *jp2, static opj_bool opj_jp2_read_jp2h( opj_jp2_v2_t *jp2, OPJ_BYTE *p_header_data, OPJ_UINT32 p_header_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_box_size=0, l_current_data_size = 0; @@ -2155,21 +1934,11 @@ static opj_bool opj_jp2_read_jp2h( opj_jp2_v2_t *jp2, return OPJ_TRUE; } -/** - * Reads a box header. The box is the way data is packed inside a jpeg2000 file structure. Data is read from a character string - * - * @param p_data the character string to read data from. - * @param box the box structure to fill. - * @param p_number_bytes_read pointer to an int that will store the number of bytes read from the stream (shoul usually be 2). - * @param p_box_max_size the maximum number of bytes in the box. - * - * @return true if the box is reconized, false otherwise -*/ opj_bool opj_jp2_read_boxhdr_char( opj_jp2_box_t *box, OPJ_BYTE * p_data, OPJ_UINT32 * p_number_bytes_read, OPJ_UINT32 p_box_max_size, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { OPJ_UINT32 l_value; @@ -2232,20 +2001,10 @@ opj_bool opj_jp2_read_boxhdr_char( opj_jp2_box_t *box, return OPJ_TRUE; } - -/** - * Reads a jpeg2000 file header structure. - * - * @param cio the stream to read data from. - * @param jp2 the jpeg2000 file header structure. - * @param p_manager the user event manager. - * - * @return true if the box is valid. - */ opj_bool opj_jp2_read_header( opj_stream_private_t *p_stream, opj_jp2_v2_t *jp2, opj_image_t ** p_image, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { /* preconditions */ @@ -2275,10 +2034,6 @@ opj_bool opj_jp2_read_header( opj_stream_private_t *p_stream, p_manager); } -/** - * Sets up the validation ,i.e. adds the procedures to launch to make sure the codec parameters - * are valid. Developers wanting to extend the library can add their own validation procedures. - */ void opj_jp2_setup_encoding_validation (opj_jp2_v2_t *jp2) { /* preconditions */ @@ -2288,10 +2043,6 @@ void opj_jp2_setup_encoding_validation (opj_jp2_v2_t *jp2) /* DEVELOPER CORNER, add your custom validation procedure */ } -/** - * Sets up the validation ,i.e. adds the procedures to lauch to make sure the codec parameters - * are valid. Developpers wanting to extend the library can add their own validation procedures. - */ void opj_jp2_setup_decoding_validation (opj_jp2_v2_t *jp2) { /* preconditions */ @@ -2299,10 +2050,6 @@ void opj_jp2_setup_decoding_validation (opj_jp2_v2_t *jp2) /* DEVELOPER CORNER, add your custom validation procedure */ } -/** - * Sets up the procedures to do on writting header. - * Developers wanting to extend the library can add their own writing procedures. - */ void opj_jp2_setup_header_writting (opj_jp2_v2_t *jp2) { /* preconditions */ @@ -2317,10 +2064,6 @@ void opj_jp2_setup_header_writting (opj_jp2_v2_t *jp2) } -/** - * Sets up the procedures to do on reading header. - * Developpers wanting to extend the library can add their own writting procedures. - */ void opj_jp2_setup_header_reading (opj_jp2_v2_t *jp2) { /* preconditions */ @@ -2330,13 +2073,6 @@ void opj_jp2_setup_header_reading (opj_jp2_v2_t *jp2) /* DEVELOPER CORNER, add your custom procedures */ } - -/** - * Reads a tile header. - * @param p_j2k the jpeg2000 codec. - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. - */ opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2, OPJ_UINT32 * p_tile_index, OPJ_UINT32 * p_data_size, @@ -2347,7 +2083,7 @@ opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2, OPJ_UINT32 * p_nb_comps, opj_bool * p_go_on, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { return opj_j2k_read_tile_header(p_jp2->j2k, @@ -2361,46 +2097,29 @@ opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2, p_manager); } -/** - * Writes a tile. - * @param p_j2k the jpeg2000 codec. - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. - */ opj_bool opj_jp2_write_tile ( opj_jp2_v2_t *p_jp2, OPJ_UINT32 p_tile_index, OPJ_BYTE * p_data, OPJ_UINT32 p_data_size, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) - + { return opj_j2k_write_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager); } -/** - * Decode tile data. - * @param p_j2k the jpeg2000 codec. - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. - */ opj_bool opj_jp2_decode_tile ( opj_jp2_v2_t * p_jp2, OPJ_UINT32 p_tile_index, OPJ_BYTE * p_data, OPJ_UINT32 p_data_size, opj_stream_private_t *p_stream, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { return opj_j2k_decode_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager); } -/** - * Destroys a jpeg2000 file decompressor. - * - * @param jp2 a jpeg2000 file decompressor. - */ void opj_jp2_destroy(opj_jp2_v2_t *jp2) { if (jp2) { @@ -2469,43 +2188,21 @@ void opj_jp2_destroy(opj_jp2_v2_t *jp2) } } -/** - * Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading. - * - * @param p_jp2 the jpeg2000 codec. - * @param p_end_x the right position of the rectangle to decode (in image coordinates). - * @param p_start_y the up position of the rectangle to decode (in image coordinates). - * @param p_end_y the bottom position of the rectangle to decode (in image coordinates). - * @param p_manager the user event manager - * - * @return true if the area could be set. - */ opj_bool opj_jp2_set_decode_area( opj_jp2_v2_t *p_jp2, opj_image_t* p_image, OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, OPJ_INT32 p_end_x, OPJ_INT32 p_end_y, - opj_event_mgr_t * p_manager + opj_event_mgr_t * p_manager ) { return opj_j2k_set_decode_area(p_jp2->j2k, p_image, p_start_x, p_start_y, p_end_x, p_end_y, p_manager); } -/** - * Get the decoded tile. - * - * @param jp2 the jpeg2000 codec. - * @param p_stream input_stream - * @param p_image output image. . - * @param p_manager the user event manager - * @param tile_index index of the tile we want decode - * - * @return true if succeed. - */ opj_bool opj_jp2_get_tile( opj_jp2_v2_t *p_jp2, opj_stream_private_t *p_stream, opj_image_t* p_image, opj_event_mgr_t * p_manager, - OPJ_UINT32 tile_index + OPJ_UINT32 tile_index ) { if (!p_image) @@ -2550,8 +2247,6 @@ opj_bool opj_jp2_get_tile( opj_jp2_v2_t *p_jp2, return OPJ_TRUE; } - - /* ----------------------------------------------------------------------- */ /* JP2 encoder interface */ /* ----------------------------------------------------------------------- */ @@ -2620,8 +2315,8 @@ opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_v2_t* p_jp2) return j2k_get_cstr_info(p_jp2->j2k); } -opj_bool opj_jp2_set_decoded_resolution_factor(opj_jp2_v2_t *p_jp2, - OPJ_UINT32 res_factor, +opj_bool opj_jp2_set_decoded_resolution_factor(opj_jp2_v2_t *p_jp2, + OPJ_UINT32 res_factor, opj_event_mgr_t * p_manager) { return opj_j2k_set_decoded_resolution_factor(p_jp2->j2k, res_factor, p_manager); diff --git a/libopenjpeg/jp2.h b/libopenjpeg/jp2.h index 512b268c..f2f3c757 100644 --- a/libopenjpeg/jp2.h +++ b/libopenjpeg/jp2.h @@ -254,8 +254,8 @@ opj_jp2_img_header_writer_handler_t; /** * Writes the Jpeg2000 file Header box - JP2 Header box (warning, this is a super box). * - * @param cio the stream to write data to. * @param jp2 the jpeg2000 file codec. + * @param stream the stream to write data to. * @param p_manager user event manager. * * @return true if writting was successful. @@ -275,8 +275,10 @@ void opj_jp2_setup_decoder(opj_jp2_v2_t *jp2, opj_dparameters_t *parameters); /** * Decode an image from a JPEG-2000 file stream * @param jp2 JP2 decompressor handle - * @param cio Input buffer stream - * @param cstr_info Codestream information structure if required, NULL otherwise + * @param p_stream FIXME DOC + * @param p_image FIXME DOC + * @param p_manager FIXME DOC + * * @return Returns a decoded image if successful, returns NULL otherwise */ opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2, @@ -285,11 +287,13 @@ opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2, opj_event_mgr_t * p_manager); /** -Setup the encoder parameters using the current image and using user parameters. -Coding parameters are returned in jp2->j2k->cp. -@param jp2 JP2 compressor handle -@param parameters compression parameters -@param image input filled image + * Setup the encoder parameters using the current image and using user parameters. + * Coding parameters are returned in jp2->j2k->cp. + * + * @param jp2 JP2 compressor handle + * @param parameters compression parameters + * @param image input filled image + * @param p_manager FIXME DOC */ void opj_jp2_setup_encoder( opj_jp2_v2_t *jp2, opj_cparameters_t *parameters, @@ -312,7 +316,9 @@ opj_bool opj_jp2_encode( opj_jp2_v2_t *jp2, * Starts a compression scheme, i.e. validates the codec parameters, writes the header. * * @param jp2 the jpeg2000 file codec. - * @param cio the stream object. + * @param stream the stream object. + * @param p_image FIXME DOC + * @param p_manager FIXME DOC * * @return true if the codec is valid. */ @@ -343,8 +349,9 @@ opj_bool opj_jp2_end_decompress(opj_jp2_v2_t *jp2, /** * Reads a jpeg2000 file header structure. * - * @param cio the stream to read data from. + * @param p_stream the stream to read data from. * @param jp2 the jpeg2000 file header structure. + * @param p_image FIXME DOC * @param p_manager the user event manager. * * @return true if the box is valid. @@ -356,9 +363,17 @@ opj_bool opj_jp2_read_header( opj_stream_private_t *p_stream, /** * Reads a tile header. - * @param p_j2k the jpeg2000 codec. - * @param p_stream the stream to write data to. - * @param p_manager the user event manager. + * @param p_jp2 the jpeg2000 codec. + * @param p_tile_index FIXME DOC + * @param p_data_size FIXME DOC + * @param p_tile_x0 FIXME DOC + * @param p_tile_y0 FIXME DOC + * @param p_tile_x1 FIXME DOC + * @param p_tile_y1 FIXME DOC + * @param p_nb_comps FIXME DOC + * @param p_go_on FIXME DOC + * @param p_stream the stream to write data to. + * @param p_manager the user event manager. */ opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2, OPJ_UINT32 * p_tile_index, @@ -374,7 +389,11 @@ opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2, /** * Writes a tile. - * @param p_j2k the jpeg2000 codec. + * + * @param p_jp2 the jpeg2000 codec. + * @param p_tile_index FIXME DOC + * @param p_data FIXME DOC + * @param p_data_size FIXME DOC * @param p_stream the stream to write data to. * @param p_manager the user event manager. */ @@ -387,9 +406,14 @@ opj_bool opj_jp2_write_tile ( opj_jp2_v2_t *p_jp2, /** * Decode tile data. - * @param p_j2k the jpeg2000 codec. + * @param p_jp2 the jpeg2000 codec. + * @param p_tile_index FIXME DOC + * @param p_data FIXME DOC + * @param p_data_size FIXME DOC * @param p_stream the stream to write data to. * @param p_manager the user event manager. + * + * @return FIXME DOC */ opj_bool opj_jp2_decode_tile ( opj_jp2_v2_t * p_jp2, OPJ_UINT32 p_tile_index, @@ -416,8 +440,10 @@ void opj_jp2_destroy(opj_jp2_v2_t *jp2); * Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading. * * @param p_jp2 the jpeg2000 codec. - * @param p_end_x the right position of the rectangle to decode (in image coordinates). + * @param p_image FIXME DOC + * @param p_start_x the left position of the rectangle to decode (in image coordinates). * @param p_start_y the up position of the rectangle to decode (in image coordinates). + * @param p_end_x the right position of the rectangle to decode (in image coordinates). * @param p_end_y the bottom position of the rectangle to decode (in image coordinates). * @param p_manager the user event manager * diff --git a/libopenjpeg/jpwl/jpwl.c b/libopenjpeg/jpwl/jpwl.c index abbeb2d6..a7e124c1 100644 --- a/libopenjpeg/jpwl/jpwl.c +++ b/libopenjpeg/jpwl/jpwl.c @@ -102,9 +102,10 @@ void jpwl_epb_write(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf); */ void jpwl_epc_write(opj_j2k_t *j2k, jpwl_epc_ms_t *epcmark, unsigned char *buf); -/** write an ESD MS to a buffer +/** + * write an ESD MS to a buffer @param j2k J2K compressor handle -@param esdmark pointer to the ESD MS +@param esd pointer to the ESD MS @param buf pointer to the memory buffer */ void jpwl_esd_write(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *buf); diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c index 2c2941fb..8d879f21 100644 --- a/libopenjpeg/openjpeg.c +++ b/libopenjpeg/openjpeg.c @@ -31,7 +31,6 @@ #include "opj_config.h" #include "opj_includes.h" - /** * Decompression handler. */ @@ -200,7 +199,6 @@ opj_bool OPJ_CALLCONV opj_set_error_handler(opj_codec_t * p_codec, /* ---------------------------------------------------------------------- */ - OPJ_SIZE_T opj_read_from_file (void * p_buffer, OPJ_SIZE_T p_nb_bytes, FILE * p_file) { OPJ_SIZE_T l_nb_read = fread(p_buffer,1,p_nb_bytes,p_file); @@ -267,7 +265,6 @@ DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { /* ---------------------------------------------------------------------- */ - const char* OPJ_CALLCONV opj_version(void) { return PACKAGE_VERSION; } @@ -513,10 +510,6 @@ opj_bool OPJ_CALLCONV opj_read_header ( opj_stream_t *p_stream, return OPJ_FALSE; } -/* - * - * - */ opj_bool OPJ_CALLCONV opj_decode( opj_codec_t *p_codec, opj_stream_t *p_stream, opj_image_t* p_image) @@ -538,18 +531,6 @@ opj_bool OPJ_CALLCONV opj_decode( opj_codec_t *p_codec, return OPJ_FALSE; } - -/** - * Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading. - * - * @param p_codec the jpeg2000 codec. - * @param p_start_x the left position of the rectangle to decode (in image coordinates). - * @param p_end_x the right position of the rectangle to decode (in image coordinates). - * @param p_start_y the up position of the rectangle to decode (in image coordinates). - * @param p_end_y the bottom position of the rectangle to decode (in image coordinates). - * - * @return true if the area could be set. - */ opj_bool OPJ_CALLCONV opj_set_decode_area( opj_codec_t *p_codec, opj_image_t* p_image, OPJ_INT32 p_start_x, OPJ_INT32 p_start_y, @@ -572,27 +553,6 @@ opj_bool OPJ_CALLCONV opj_set_decode_area( opj_codec_t *p_codec, return OPJ_FALSE; } -/** - * 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. - * - * @param p_codec the jpeg2000 codec. - * @param p_tile_index pointer to a value that will hold the index of the tile being decoded, in case of success. - * @param p_data_size pointer to a value that will hold the maximum size of the decoded data, in case of success. In case - * of truncated codestreams, the actual number of bytes decoded may be lower. - * The computation of the size is the same as depicted in opj_write_tile. - * @param p_tile_x0 pointer to a value that will hold the x0 pos of the tile (in the image). - * @param p_tile_y0 pointer to a value that will hold the y0 pos of the tile (in the image). - * @param p_tile_x1 pointer to a value that will hold the x1 pos of the tile (in the image). - * @param p_tile_y1 pointer to a value that will hold the y1 pos of the tile (in the image). - * @param p_nb_comps pointer to a value that will hold the number of components in the tile. - * @param p_should_go_on pointer to a boolean that will hold the fact that the decoding should go on. In case the - * codestream is over at the time of the call, the value will be set to false. The user should then stop - * the decoding. - * @param p_stream the stream to decode. - * @return true if the tile header could be decoded. In case the decoding should end, the returned value is still true. - * returning false may be the result of a shortage of memory or an internal error. - */ opj_bool OPJ_CALLCONV opj_read_tile_header( opj_codec_t *p_codec, opj_stream_t * p_stream, OPJ_UINT32 * p_tile_index, @@ -623,18 +583,6 @@ opj_bool OPJ_CALLCONV opj_read_tile_header( opj_codec_t *p_codec, return OPJ_FALSE; } -/** - * Reads a tile data. This function is compulsory and allows one to decode tile data. opj_read_tile_header should be called before. - * The user may need to refer to the image got by opj_read_header to understand the size being taken by the tile. - * - * @param p_codec the jpeg2000 codec. - * @param p_tile_index the index of the tile being decoded, this should be the value set by opj_read_tile_header. - * @param p_data pointer to a memory block that will hold the decoded data. - * @param p_data_size size of p_data. p_data_size should be bigger or equal to the value set by opj_read_tile_header. - * @param p_stream the stream to decode. - * - * @return true if the data could be decoded. - */ opj_bool OPJ_CALLCONV opj_decode_tile_data( opj_codec_t *p_codec, OPJ_UINT32 p_tile_index, OPJ_BYTE * p_data, @@ -660,10 +608,6 @@ opj_bool OPJ_CALLCONV opj_decode_tile_data( opj_codec_t *p_codec, return OPJ_FALSE; } -/* - * - * - */ opj_bool OPJ_CALLCONV opj_get_decoded_tile( opj_codec_t *p_codec, opj_stream_t *p_stream, opj_image_t *p_image, @@ -687,10 +631,6 @@ opj_bool OPJ_CALLCONV opj_get_decoded_tile( opj_codec_t *p_codec, return OPJ_FALSE; } -/* - * - * - */ opj_bool OPJ_CALLCONV opj_set_decoded_resolution_factor(opj_codec_t *p_codec, OPJ_UINT32 res_factor ) { @@ -938,10 +878,6 @@ opj_bool OPJ_CALLCONV opj_end_compress (opj_codec_t *p_codec, } -/* - * - * - */ opj_bool OPJ_CALLCONV opj_end_decompress ( opj_codec_t *p_codec, opj_stream_t *p_stream) { @@ -961,7 +897,6 @@ opj_bool OPJ_CALLCONV opj_end_decompress ( opj_codec_t *p_codec, return OPJ_FALSE; } - opj_bool OPJ_CALLCONV opj_set_MCT(opj_cparameters_t *parameters, OPJ_FLOAT32 * pEncodingMatrix, OPJ_INT32 * p_dc_shift,OPJ_UINT32 pNbComp) @@ -988,18 +923,6 @@ opj_bool OPJ_CALLCONV opj_set_MCT(opj_cparameters_t *parameters, return OPJ_TRUE; } -/** - * Writes a tile with the given data. - * - * @param p_compressor the jpeg2000 codec. - * @param p_tile_index the index of the tile to write. At the moment, the tiles must be written from 0 to n-1 in sequence. - * @param p_data pointer to the data to write. Data is arranged in sequence, data_comp0, then data_comp1, - * then ... NO INTERLEAVING should be set. - * @param p_data_size this value os used to make sure the data being written is correct. The size must be - * equal to the sum for each component of tile_width * tile_height * component_size. - * component_size can be 1,2 or 4 bytes, depending on the precision of the given component. - * @param p_stream the stream to write data to. - */ opj_bool OPJ_CALLCONV opj_write_tile ( opj_codec_t *p_codec, OPJ_UINT32 p_tile_index, OPJ_BYTE * p_data, @@ -1046,10 +969,6 @@ void OPJ_CALLCONV opj_destroy_codec(opj_codec_t *p_codec) /* ---------------------------------------------------------------------- */ -/* - * - * - */ void OPJ_CALLCONV opj_dump_codec( opj_codec_t *p_codec, OPJ_INT32 info_flag, FILE* output_stream) @@ -1065,10 +984,6 @@ void OPJ_CALLCONV opj_dump_codec( opj_codec_t *p_codec, return; } -/* - * - * - */ opj_codestream_info_v2_t* OPJ_CALLCONV opj_get_cstr_info(opj_codec_t *p_codec) { if (p_codec) { @@ -1080,10 +995,6 @@ opj_codestream_info_v2_t* OPJ_CALLCONV opj_get_cstr_info(opj_codec_t *p_codec) return NULL; } -/* - * - * - */ void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_v2_t **cstr_info) { if (cstr_info) { @@ -1100,10 +1011,6 @@ void OPJ_CALLCONV opj_destroy_cstr_info(opj_codestream_info_v2_t **cstr_info) { } } -/* - * - * - */ opj_codestream_index_t * OPJ_CALLCONV opj_get_cstr_index(opj_codec_t *p_codec) { if (p_codec) { @@ -1115,10 +1022,6 @@ opj_codestream_index_t * OPJ_CALLCONV opj_get_cstr_index(opj_codec_t *p_codec) return NULL; } -/* - * - * - */ void OPJ_CALLCONV opj_destroy_cstr_index(opj_codestream_index_t **p_cstr_index) { if (*p_cstr_index){ @@ -1128,12 +1031,6 @@ void OPJ_CALLCONV opj_destroy_cstr_index(opj_codestream_index_t **p_cstr_index) } /* ---------------------------------------------------------------------- */ -/** - * 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. -*/ opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream (FILE * p_file, opj_bool p_is_read_stream) { return opj_stream_create_file_stream(p_file,J2K_STREAM_CHUNK_SIZE,p_is_read_stream); @@ -1162,4 +1059,4 @@ opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream ( FILE * p_file, opj_stream_set_seek_function(l_stream, (opj_stream_seek_fn) opj_seek_from_file); return l_stream; -} \ No newline at end of file +} diff --git a/libopenjpeg/openjpeg.h b/libopenjpeg/openjpeg.h index 7e2f56a3..6e56f51a 100644 --- a/libopenjpeg/openjpeg.h +++ b/libopenjpeg/openjpeg.h @@ -1051,9 +1051,9 @@ OPJ_API void OPJ_CALLCONV opj_image_destroy(opj_image_t *image); /** * Creates an image without allocating memory for the image (used in the new version of the library). * - * @param p_num_cmpts the number of components - * @param p_cmpt_parms the components parameters - * @param p_clr_spc the image color space + * @param numcmpts the number of components + * @param cmptparms the components parameters + * @param clrspc the image color space * * @return a new image structure if successful, NULL otherwise. */ @@ -1104,11 +1104,20 @@ OPJ_API void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos); /** * Creates an abstract stream. This function does nothing except allocating memory and initializing the abstract stream. * - * @param l_is_reader if set to true then the stream will be an input stream, an output stream else. + * @param p_is_input if set to true then the stream will be an input stream, an output stream else. * * @return a stream object. */ OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_default_create(opj_bool p_is_input); + +/** + * Creates an abstract stream. This function does nothing except allocating memory and initializing the abstract stream. + * + * @param p_buffer_size FIXME DOC + * @param p_is_input if set to true then the stream will be an input stream, an output stream else. + * + * @return a stream object. +*/ OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size, opj_bool p_is_input); /** @@ -1156,8 +1165,9 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_user_data (opj_stream_t* p_stream, void /** * 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. + * + * @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_UINT64 data_length); @@ -1168,6 +1178,13 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream * @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); + +/** + * FIXME DOC + * @param p_file the file stream to operate on + * @param p_buffer_size FIXME DOC + * @param p_is_read_stream FIXME DOC +*/ 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); /* -----------> */ @@ -1246,6 +1263,7 @@ OPJ_API opj_bool OPJ_CALLCONV opj_read_header ( opj_stream_t *p_stream, * Sets the given area to be decoded. This function should be called right after opj_read_header and before any tile header reading. * * @param p_codec the jpeg2000 codec. + * @param p_image FIXME DOC * @param p_start_x the left position of the rectangle to decode (in image coordinates). * @param p_end_x the right position of the rectangle to decode (in image coordinates). * @param p_start_y the up position of the rectangle to decode (in image coordinates). @@ -1295,11 +1313,10 @@ OPJ_API opj_bool OPJ_CALLCONV opj_set_decoded_resolution_factor(opj_codec_t *p_c /** * Writes a tile with the given data. * - * @param p_compressor the jpeg2000 codec. + * @param p_codec the jpeg2000 codec. * @param p_tile_index the index of the tile to write. At the moment, the tiles must be written from 0 to n-1 in sequence. * @param p_data pointer to the data to write. Data is arranged in sequence, data_comp0, then data_comp1, then ... NO INTERLEAVING should be set. - * @param p_data_size this value os used to make sure the data being written is correct. The size must be equal to the sum for each component of tile_width * tile_height * component_size. component_size can be 1,2 or 4 bytes, - * depending on the precision of the given component. + * @param p_data_size this value os used to make sure the data being written is correct. The size must be equal to the sum for each component of tile_width * tile_height * component_size. component_size can be 1,2 or 4 bytes, depending on the precision of the given component. * @param p_stream the stream to write data to. * * @return true if the data could be written. @@ -1415,11 +1432,10 @@ OPJ_API opj_bool OPJ_CALLCONV opj_end_compress (opj_codec_t *p_codec, * Encode an image into a JPEG-2000 codestream * @param p_codec compressor handle * @param p_stream Output buffer stream - * @param image Image to encode * * @return Returns true if successful, returns false otherwise */ -OPJ_API opj_bool OPJ_CALLCONV opj_encode(opj_codec_t *p_codec, +OPJ_API opj_bool OPJ_CALLCONV opj_encode(opj_codec_t *p_codec, opj_stream_t *p_stream); diff --git a/libopenjpeg/pi.c b/libopenjpeg/pi.c index c8a32fdf..a2f691ce 100644 --- a/libopenjpeg/pi.c +++ b/libopenjpeg/pi.c @@ -41,31 +41,31 @@ /** Get next packet in layer-resolution-component-precinct order. @param pi packet iterator to modify -@return returns false if pi pointed to the last packet or else returns true +@return returns false if pi pointed to the last packet or else returns true */ static opj_bool pi_next_lrcp(opj_pi_iterator_t * pi); /** Get next packet in resolution-layer-component-precinct order. @param pi packet iterator to modify -@return returns false if pi pointed to the last packet or else returns true +@return returns false if pi pointed to the last packet or else returns true */ static opj_bool pi_next_rlcp(opj_pi_iterator_t * pi); /** Get next packet in resolution-precinct-component-layer order. @param pi packet iterator to modify -@return returns false if pi pointed to the last packet or else returns true +@return returns false if pi pointed to the last packet or else returns true */ static opj_bool pi_next_rpcl(opj_pi_iterator_t * pi); /** Get next packet in precinct-component-resolution-layer order. @param pi packet iterator to modify -@return returns false if pi pointed to the last packet or else returns true +@return returns false if pi pointed to the last packet or else returns true */ static opj_bool pi_next_pcrl(opj_pi_iterator_t * pi); /** Get next packet in component-precinct-resolution-layer order. @param pi packet iterator to modify -@return returns false if pi pointed to the last packet or else returns true +@return returns false if pi pointed to the last packet or else returns true */ static opj_bool pi_next_cprl(opj_pi_iterator_t * pi); @@ -80,10 +80,10 @@ static opj_bool pi_next_cprl(opj_pi_iterator_t * pi); * @param p_ty1 Y1 parameter for the tile * @param p_max_prec the maximum precision for all the bands of the tile * @param p_max_res the maximum number of resolutions for all the poc inside the tile. - * @param dx_min the minimum dx of all the components of all the resolutions for the tile. - * @param dy_min the minimum dy of all the components of all the resolutions for the tile. + * @param p_dx_min the minimum dx of all the components of all the resolutions for the tile. + * @param p_dy_min the minimum dy of all the components of all the resolutions for the tile. */ -void pi_update_encode_poc_and_final (opj_cp_v2_t *p_cp, +static void pi_update_encode_poc_and_final (opj_cp_v2_t *p_cp, OPJ_UINT32 p_tileno, OPJ_INT32 p_tx0, OPJ_INT32 p_tx1, @@ -94,20 +94,6 @@ void pi_update_encode_poc_and_final (opj_cp_v2_t *p_cp, OPJ_UINT32 p_dx_min, OPJ_UINT32 p_dy_min); -/** - * Updates the coding parameters if the encoding is not used with Progression order changes and final (and cinema parameters are used). - * - * @param p_cp the coding parameters to modify - * @param p_tileno the tile index being concerned. - * @param p_tx0 X0 parameter for the tile - * @param p_tx1 X1 parameter for the tile - * @param p_ty0 Y0 parameter for the tile - * @param p_ty1 Y1 parameter for the tile - * @param p_max_prec the maximum precision for all the bands of the tile - * @param p_max_res the maximum number of resolutions for all the poc inside the tile. - * @param dx_min the minimum dx of all the components of all the resolutions for the tile. - * @param dy_min the minimum dy of all the components of all the resolutions for the tile. - */ void pi_update_encode_not_poc ( opj_cp_v2_t *p_cp, OPJ_UINT32 p_num_comps, OPJ_UINT32 p_tileno, @@ -120,21 +106,6 @@ void pi_update_encode_not_poc ( opj_cp_v2_t *p_cp, OPJ_UINT32 p_dx_min, OPJ_UINT32 p_dy_min); -/** - * Gets the encoding parameters needed to update the coding parameters and all the pocs. - * - * @param p_image the image being encoded. - * @param p_cp the coding parameters. - * @param tileno the tile index of the tile being encoded. - * @param p_tx0 pointer that will hold the X0 parameter for the tile - * @param p_tx1 pointer that will hold the X1 parameter for the tile - * @param p_ty0 pointer that will hold the Y0 parameter for the tile - * @param p_ty1 pointer that will hold the Y1 parameter for the tile - * @param p_max_prec pointer that will hold the the maximum precision for all the bands of the tile - * @param p_max_res pointer that will hold the the maximum number of resolutions for all the poc inside the tile. - * @param dx_min pointer that will hold the the minimum dx of all the components of all the resolutions for the tile. - * @param dy_min pointer that will hold the the minimum dy of all the components of all the resolutions for the tile. - */ void get_encoding_parameters( const opj_image_t *p_image, const opj_cp_v2_t *p_cp, OPJ_UINT32 tileno, @@ -147,26 +118,6 @@ void get_encoding_parameters( const opj_image_t *p_image, OPJ_UINT32 * p_max_prec, OPJ_UINT32 * p_max_res ); -/** - * Gets the encoding parameters needed to update the coding parameters and all the pocs. - * The precinct widths, heights, dx and dy for each component at each resolution will be stored as well. - * the last parameter of the function should be an array of pointers of size nb components, each pointer leading - * to an area of size 4 * max_res. The data is stored inside this area with the following pattern : - * dx_compi_res0 , dy_compi_res0 , w_compi_res0, h_compi_res0 , dx_compi_res1 , dy_compi_res1 , w_compi_res1, h_compi_res1 , ... - * - * @param p_image the image being encoded. - * @param p_cp the coding parameters. - * @param tileno the tile index of the tile being encoded. - * @param p_tx0 pointer that will hold the X0 parameter for the tile - * @param p_tx1 pointer that will hold the X1 parameter for the tile - * @param p_ty0 pointer that will hold the Y0 parameter for the tile - * @param p_ty1 pointer that will hold the Y1 parameter for the tile - * @param p_max_prec pointer that will hold the the maximum precision for all the bands of the tile - * @param p_max_res pointer that will hold the the maximum number of resolutions for all the poc inside the tile. - * @param p_dx_min pointer that will hold the the minimum dx of all the components of all the resolutions for the tile. - * @param p_dy_min pointer that will hold the the minimum dy of all the components of all the resolutions for the tile. - * @param p_resolutions pointer to an area corresponding to the one described above. - */ void get_all_encoding_parameters( const opj_image_t *p_image, const opj_cp_v2_t *p_cp, @@ -182,15 +133,6 @@ void get_all_encoding_parameters( OPJ_UINT32 ** p_resolutions ); - -/** - * Allocates memory for a packet iterator. Data and data sizes are set by this operation. - * No other data is set. The include section of the packet iterator is not allocated. - * - * @param image the image used to initialize the packet iterator (only the number of components is relevant). - * @param cp the coding parameters. - * @param tileno the index of the tile from which creating the packet iterator. - */ opj_pi_iterator_t * pi_create( const opj_image_t *image, const opj_cp_v2_t *cp, OPJ_UINT32 tileno ); @@ -198,7 +140,6 @@ opj_pi_iterator_t * pi_create( const opj_image_t *image, void pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,opj_tcp_v2_t * p_tcp,OPJ_UINT32 p_max_precision,OPJ_UINT32 p_max_res); void pi_update_decode_poc (opj_pi_iterator_t * p_pi,opj_tcp_v2_t * p_tcp,OPJ_UINT32 p_max_precision,OPJ_UINT32 p_max_res); - OPJ_INT32 pi_check_next_level( OPJ_INT32 pos, opj_cp_v2_t *cp, OPJ_UINT32 tileno, @@ -209,7 +150,7 @@ OPJ_INT32 pi_check_next_level( OPJ_INT32 pos, /*@}*/ -/* +/* ========================================================== local functions ========================================================== @@ -349,16 +290,16 @@ if (!pi->tp_on){ continue; } if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){ - continue; + continue; } if ((res->pw==0)||(res->ph==0)) continue; if ((trx0==trx1)||(try0==try1)) continue; - prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx) + prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx) - int_floordivpow2(trx0, res->pdx); - prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy) + prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy) - int_floordivpow2(try0, res->pdy); pi->precno = prci + prcj * res->pw; for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) { @@ -430,16 +371,16 @@ static opj_bool pi_next_pcrl(opj_pi_iterator_t * pi) { continue; } if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){ - continue; + continue; } if ((res->pw==0)||(res->ph==0)) continue; if ((trx0==trx1)||(try0==try1)) continue; - prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx) + prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx) - int_floordivpow2(trx0, res->pdx); - prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy) + prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy) - int_floordivpow2(try0, res->pdy); pi->precno = prci + prcj * res->pw; for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) { @@ -509,16 +450,16 @@ static opj_bool pi_next_cprl(opj_pi_iterator_t * pi) { continue; } if (!((pi->x % (comp->dx << rpx) == 0) || ((pi->x == pi->tx0) && ((trx0 << levelno) % (1 << rpx))))){ - continue; + continue; } if ((res->pw==0)||(res->ph==0)) continue; if ((trx0==trx1)||(try0==try1)) continue; - prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx) + prci = int_floordivpow2(int_ceildiv(pi->x, comp->dx << levelno), res->pdx) - int_floordivpow2(trx0, res->pdx); - prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy) + prcj = int_floordivpow2(int_ceildiv(pi->y, comp->dy << levelno), res->pdy) - int_floordivpow2(try0, res->pdy); pi->precno = prci + prcj * res->pw; for (pi->layno = pi->poc.layno0; pi->layno < pi->poc.layno1; pi->layno++) { @@ -537,7 +478,7 @@ LABEL_SKIP:; return OPJ_FALSE; } -/* +/* ========================================================== Packet iterator interface ========================================================== @@ -667,7 +608,7 @@ opj_pi_iterator_t *pi_create_decode(opj_image_t *image, opj_cp_t *cp, int tileno pi[pino].poc.prg = tcp->pocs[pino].prg; } pi[pino].poc.layno0 = 0; - pi[pino].poc.precno0 = 0; + pi[pino].poc.precno0 = 0; pi[pino].poc.precno1 = maxprec; } @@ -675,7 +616,6 @@ opj_pi_iterator_t *pi_create_decode(opj_image_t *image, opj_cp_t *cp, int tileno return pi; } - opj_pi_iterator_t *pi_create_decode_v2( opj_image_t *p_image, opj_cp_v2_t *p_cp, OPJ_UINT32 p_tile_no @@ -877,7 +817,7 @@ opj_pi_iterator_t *pi_create_decode_v2( opj_image_t *p_image, return l_pi; } -opj_pi_iterator_t *pi_initialise_encode(opj_image_t *image, opj_cp_t *cp, int tileno, J2K_T2_MODE t2_mode){ +opj_pi_iterator_t *pi_initialise_encode(opj_image_t *image, opj_cp_t *cp, int tileno, J2K_T2_MODE t2_mode){ int p, q, pino; int compno, resno; int maxres = 0; @@ -1020,15 +960,6 @@ opj_pi_iterator_t *pi_initialise_encode(opj_image_t *image, opj_cp_t *cp, int ti return pi; } -/** - * Creates a packet iterator for encoding. - * - * @param p_image the image being encoded. - * @param p_cp the coding parameters. - * @param p_tile_no index of the tile being encoded. - * @param p_t2_mode the type of pass for generating the packet iterator - * @return a list of packet iterator that points to the first packet of the tile (not true). -*/ opj_pi_iterator_t *pi_initialise_encode_v2( const opj_image_t *p_image, opj_cp_v2_t *p_cp, @@ -1217,7 +1148,6 @@ opj_pi_iterator_t *pi_initialise_encode_v2( return l_pi; } - void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno) { int compno, pino; opj_tcp_t *tcp = &cp->tcps[tileno]; @@ -1280,7 +1210,7 @@ opj_bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int p break; case RPCL: strncpy(prog, "RPCL",4); break; - case PROG_UNKNOWN: + case PROG_UNKNOWN: return OPJ_TRUE; } @@ -1409,7 +1339,7 @@ opj_bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int p tcp->prc_t = tcp->prcS; pi[pino].poc.precno0 = tcp->prc_t; pi[pino].poc.precno1 = tcp->prc_t+1; - tcp->prc_t+=1; + tcp->prc_t+=1; }else{ if (incr_top == 1){ if(tcp->prc_t == tcp->prcE){ @@ -1488,19 +1418,12 @@ opj_bool pi_create_encode( opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int p } break; } - } + } } } return OPJ_FALSE; } -/** - * Updates the encoding parameters of the codec. - * - * @param p_image the image being encoded. - * @param p_cp the coding parameters. - * @param p_tile_no index of the tile being encoded. -*/ void pi_update_encoding_parameters( const opj_image_t *p_image, opj_cp_v2_t *p_cp, OPJ_UINT32 p_tile_no ) @@ -1533,21 +1456,6 @@ void pi_update_encoding_parameters( const opj_image_t *p_image, } -/** - * Gets the encoding parameters needed to update the coding parameters and all the pocs. - * - * @param p_image the image being encoded. - * @param p_cp the coding parameters. - * @param p_tileno the tile index of the tile being encoded. - * @param p_tx0 pointer that will hold the X0 parameter for the tile - * @param p_tx1 pointer that will hold the X1 parameter for the tile - * @param p_ty0 pointer that will hold the Y0 parameter for the tile - * @param p_ty1 pointer that will hold the Y1 parameter for the tile - * @param p_max_prec pointer that will hold the the maximum precision for all the bands of the tile - * @param p_max_res pointer that will hold the the maximum number of resolutions for all the poc inside the tile. - * @param dx_min pointer that will hold the the minimum dx of all the components of all the resolutions for the tile. - * @param dy_min pointer that will hold the the minimum dy of all the components of all the resolutions for the tile. - */ void get_encoding_parameters( const opj_image_t *p_image, const opj_cp_v2_t *p_cp, OPJ_UINT32 p_tileno, @@ -1806,14 +1714,6 @@ void get_all_encoding_parameters( } } -/** - * Allocates memory for a packet iterator. Data and data sizes are set by this operation. - * No other data is set. The include section of the packet iterator is not allocated. - * - * @param image the image used to initialize the packet iterator (only the number of components is relevant. - * @param cp the coding parameters. - * @param tileno the index of the tile from which creating the packet iterator. - */ opj_pi_iterator_t * pi_create( const opj_image_t *image, const opj_cp_v2_t *cp, OPJ_UINT32 tileno ) @@ -1878,20 +1778,6 @@ opj_pi_iterator_t * pi_create( const opj_image_t *image, return l_pi; } -/** - * Updates the coding parameters if the encoding is used with Progression order changes and final (or cinema parameters are used). - * - * @param p_cp the coding parameters to modify - * @param p_tileno the tile index being concerned. - * @param p_tx0 X0 parameter for the tile - * @param p_tx1 X1 parameter for the tile - * @param p_ty0 Y0 parameter for the tile - * @param p_ty1 Y1 parameter for the tile - * @param p_max_prec the maximum precision for all the bands of the tile - * @param p_max_res the maximum number of resolutions for all the poc inside the tile. - * @param dx_min the minimum dx of all the components of all the resolutions for the tile. - * @param dy_min the minimum dy of all the components of all the resolutions for the tile. - */ void pi_update_encode_poc_and_final (opj_cp_v2_t *p_cp, OPJ_UINT32 p_tileno, OPJ_INT32 p_tx0, @@ -1968,20 +1854,6 @@ void pi_update_encode_poc_and_final (opj_cp_v2_t *p_cp, } } -/** - * Updates the coding parameters if the encoding is not used with Progression order changes and final (and cinema parameters are used). - * - * @param p_cp the coding parameters to modify - * @param p_tileno the tile index being concerned. - * @param p_tx0 X0 parameter for the tile - * @param p_tx1 X1 parameter for the tile - * @param p_ty0 Y0 parameter for the tile - * @param p_ty1 Y1 parameter for the tile - * @param p_max_prec the maximum precision for all the bands of the tile - * @param p_max_res the maximum number of resolutions for all the poc inside the tile. - * @param dx_min the minimum dx of all the components of all the resolutions for the tile. - * @param dy_min the minimum dy of all the components of all the resolutions for the tile. - */ void pi_update_encode_not_poc ( opj_cp_v2_t *p_cp, OPJ_UINT32 p_num_comps, OPJ_UINT32 p_tileno, @@ -2037,12 +1909,6 @@ void pi_update_encode_not_poc ( opj_cp_v2_t *p_cp, } } -/** - * Destroys a packet iterator array. - * - * @param p_pi the packet iterator array to destroy. - * @param p_nb_elements the number of elements in the array. - */ void pi_destroy_v2( opj_pi_iterator_t *p_pi, OPJ_UINT32 p_nb_elements) @@ -2086,8 +1952,6 @@ void pi_destroy_v2( } } - - void pi_update_decode_poc (opj_pi_iterator_t * p_pi,opj_tcp_v2_t * p_tcp,OPJ_UINT32 p_max_precision,OPJ_UINT32 p_max_res) { // loop @@ -2127,7 +1991,6 @@ void pi_update_decode_poc (opj_pi_iterator_t * p_pi,opj_tcp_v2_t * p_tcp,OPJ_UIN } } - void pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,opj_tcp_v2_t * p_tcp,OPJ_UINT32 p_max_precision,OPJ_UINT32 p_max_res) { // loop @@ -2162,7 +2025,6 @@ void pi_update_decode_not_poc (opj_pi_iterator_t * p_pi,opj_tcp_v2_t * p_tcp,OPJ } } - void pi_create_encode_v2( opj_pi_iterator_t *pi, opj_cp_v2_t *cp, OPJ_UINT32 tileno, diff --git a/libopenjpeg/pi.h b/libopenjpeg/pi.h index d1c8abf5..4d61e4b3 100644 --- a/libopenjpeg/pi.h +++ b/libopenjpeg/pi.h @@ -61,8 +61,8 @@ typedef struct opj_pi_comp { opj_pi_resolution_t *resolutions; } opj_pi_comp_t; -/** -Packet iterator +/** +Packet iterator */ typedef struct opj_pi_iterator { /** Enabling Tile part generation*/ @@ -84,7 +84,7 @@ typedef struct opj_pi_iterator { /** precinct that identify the packet */ int precno; /** layer that identify the packet */ - int layno; + int layno; /** 0 if the first packet */ int first; /** progression order change information */ @@ -114,10 +114,11 @@ opj_pi_iterator_t *pi_initialise_encode(opj_image_t *image, opj_cp_t *cp, int ti /** * Creates a packet iterator for encoding. * - * @param p_image the image being encoded. - * @param p_cp the coding parameters. - * @param p_tile_no index of the tile being encoded. - * @param p_t2_mode the type of pass for generating the packet iterator + * @param image the image being encoded. + * @param cp the coding parameters. + * @param tileno index of the tile being encoded. + * @param t2_mode the type of pass for generating the packet iterator + * * @return a list of packet iterator that points to the first packet of the tile (not true). */ opj_pi_iterator_t *pi_initialise_encode_v2( const struct opj_image *image, @@ -125,7 +126,6 @@ opj_pi_iterator_t *pi_initialise_encode_v2( const struct opj_image *image, OPJ_UINT32 tileno, J2K_T2_MODE t2_mode); - /** * Updates the encoding parameters of the codec. * @@ -139,7 +139,7 @@ void pi_update_encoding_parameters( const struct opj_image *p_image, /** Modify the packet iterator for enabling tile part generation -@param pi Handle to the packet iterator generated in pi_initialise_encode +@param pi Handle to the packet iterator generated in pi_initialise_encode @param cp Coding parameters @param tileno Number that identifies the tile for which to list the packets @param pino Iterator index for pi @@ -147,7 +147,7 @@ Modify the packet iterator for enabling tile part generation @param tppos The position of the tile part flag in the progression order @param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass @param cur_totnum_tp The total number of tile parts in the current tile -@return Returns true if an error is detected +@return Returns true if an error is detected */ opj_bool pi_create_encode(opj_pi_iterator_t *pi, opj_cp_t *cp,int tileno, int pino,int tpnum, int tppos, J2K_T2_MODE t2_mode,int cur_totnum_tp); @@ -156,13 +156,13 @@ Modify the packet iterator for enabling tile part generation @param pi Handle to the packet iterator generated in pi_initialise_encode @param cp Coding parameters @param tileno Number that identifies the tile for which to list the packets +@param pino FIXME DOC @param tpnum Tile part number of the current tile @param tppos The position of the tile part flag in the progression order +@param t2_mode FIXME DOC */ void pi_create_encode_v2( opj_pi_iterator_t *pi, struct opj_cp_v2 *cp,OPJ_UINT32 tileno, OPJ_UINT32 pino,OPJ_UINT32 tpnum, OPJ_INT32 tppos, J2K_T2_MODE t2_mode); - - /** Create a packet iterator for Decoder @param image Raw image for which the packets will be listed @@ -173,7 +173,6 @@ Create a packet iterator for Decoder */ opj_pi_iterator_t *pi_create_decode(opj_image_t * image, opj_cp_t * cp, int tileno); - /** Create a packet iterator for Decoder @param image Raw image for which the packets will be listed @@ -184,7 +183,6 @@ Create a packet iterator for Decoder */ opj_pi_iterator_t *pi_create_decode_v2(struct opj_image * image, struct opj_cp_v2 * cp, OPJ_UINT32 tileno); - /** Destroy a packet iterator @param pi Previously created packet iterator @@ -194,7 +192,6 @@ Destroy a packet iterator */ void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno); - /** * Destroys a packet iterator array. * @@ -208,7 +205,7 @@ void pi_destroy_v2( /** Modify the packet iterator to point to the next packet @param pi Packet iterator to modify -@return Returns false if pi pointed to the last packet or else returns true +@return Returns false if pi pointed to the last packet or else returns true */ opj_bool pi_next(opj_pi_iterator_t * pi); /* ----------------------------------------------------------------------- */ diff --git a/libopenjpeg/t1.h b/libopenjpeg/t1.h index 3963e738..02fab4ed 100644 --- a/libopenjpeg/t1.h +++ b/libopenjpeg/t1.h @@ -119,6 +119,7 @@ Encode the code-blocks of a tile @param t1 T1 handle @param tile The tile to encode @param tcp Tile coding parameters +@param mct_norms FIXME DOC */ opj_bool opj_t1_encode_cblks( opj_t1_t *t1, opj_tcd_tile_v2_t *tile, diff --git a/libopenjpeg/t2.c b/libopenjpeg/t2.c index 37d64b1a..644fbce9 100644 --- a/libopenjpeg/t2.c +++ b/libopenjpeg/t2.c @@ -61,13 +61,14 @@ static int t2_encode_packet(opj_tcd_tile_t *tile, opj_tcp_t *tcp, opj_pi_iterato /** Encode a packet of a tile to a destination buffer +@param tileno Number of the tile encoded @param tile Tile for which to write the packets @param tcp Tile coding parameters @param pi Packet identity @param dest Destination buffer +@param p_data_written FIXME DOC @param len Length of the destination buffer @param cstr_info Codestream information structure -@param tileno Number of the tile encoded @return */ static opj_bool t2_encode_packet_v2( @@ -109,19 +110,21 @@ Decode a packet of a tile from a source buffer @param tcp Tile coding parameters @param pi Packet identity @param src Source buffer +@param data_read FIXME DOC +@param max_length FIXME DOC @param pack_info Packet information -@return +@return FIXME DOC */ static opj_bool t2_decode_packet_v2( - opj_t2_v2_t* t2, - opj_tcd_tile_v2_t *tile, + opj_t2_v2_t* t2, + opj_tcd_tile_v2_t *tile, opj_tcp_v2_t *tcp, - opj_pi_iterator_t *pi, - OPJ_BYTE *src, - OPJ_UINT32 * data_read, - OPJ_UINT32 max_length, - opj_packet_info_t *pack_info); + opj_pi_iterator_t *pi, + OPJ_BYTE *src, + OPJ_UINT32 * data_read, + OPJ_UINT32 max_length, + opj_packet_info_t *pack_info); static opj_bool t2_skip_packet( opj_t2_v2_t* p_t2, diff --git a/libopenjpeg/t2.h b/libopenjpeg/t2.h index 2273c44e..99b747fa 100644 --- a/libopenjpeg/t2.h +++ b/libopenjpeg/t2.h @@ -93,10 +93,12 @@ Encode the packets of a tile to a destination buffer @param tile the tile for which to write the packets @param maxlayers maximum number of layers @param dest the destination buffer +@param p_data_written FIXME DOC @param len the length of the destination buffer @param cstr_info Codestream information structure @param tpnum Tile part number of the current tile @param tppos The position of the tile part flag in the progression order +@param pino FIXME DOC @param t2_mode If == 0 In Threshold calculation ,If == 1 Final pass */ opj_bool t2_encode_packets_v2( opj_t2_v2_t* t2, @@ -126,15 +128,20 @@ int t2_decode_packets(opj_t2_t *t2, unsigned char *src, int len, int tileno, opj /** Decode the packets of a tile from a source buffer @param t2 T2 handle -@param src the source buffer -@param len length of the source buffer @param tileno number that identifies the tile for which to decode the packets @param tile tile for which to decode the packets +@param src FIXME DOC +@param p_data_read the source buffer +@param len length of the source buffer +@param cstr_info FIXME DOC + +@return FIXME DOC */ opj_bool t2_decode_packets_v2( opj_t2_v2_t *t2, OPJ_UINT32 tileno, struct opj_tcd_tile_v2 *tile, - OPJ_BYTE *src, OPJ_UINT32 * p_data_read, + OPJ_BYTE *src, + OPJ_UINT32 * p_data_read, OPJ_UINT32 len, opj_codestream_index_t *cstr_info); diff --git a/libopenjpeg/tcd.c b/libopenjpeg/tcd.c index b0da9ca5..b753f649 100644 --- a/libopenjpeg/tcd.c +++ b/libopenjpeg/tcd.c @@ -605,154 +605,145 @@ void opj_tcd_destroy(opj_tcd_v2_t *tcd) { } /* ----------------------------------------------------------------------- */ -/** - * Initialize the tile coder and may reuse some meory. - * @param p_tcd TCD handle. - * @param p_image raw image. - * @param p_cp coding parameters. - * @param p_tile_no current tile index to encode. - * - * @return true if the encoding values could be set (false otherwise). -*/ #define MACRO_TCD_ALLOCATE(FUNCTION,TYPE,FRACTION,ELEMENT,FUNCTION_ELEMENT) \ - opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \ - OPJ_UINT32 p_tile_no \ - ) \ -{ \ - OPJ_UINT32 (*l_gain_ptr)(OPJ_UINT32) = 00; \ - OPJ_UINT32 compno, resno, bandno, precno, cblkno; \ - opj_tcp_v2_t * l_tcp = 00; \ - opj_cp_v2_t * l_cp = 00; \ - opj_tcd_tile_v2_t * l_tile = 00; \ - opj_tccp_t *l_tccp = 00; \ - opj_tcd_tilecomp_v2_t *l_tilec = 00; \ - opj_image_comp_t * l_image_comp = 00; \ - opj_tcd_resolution_v2_t *l_res = 00; \ - opj_tcd_band_v2_t *l_band = 00; \ - opj_stepsize_t * l_step_size = 00; \ - opj_tcd_precinct_v2_t *l_current_precinct = 00; \ - TYPE* l_code_block = 00; \ - opj_image_t *l_image = 00; \ - OPJ_UINT32 p,q; \ - OPJ_UINT32 l_level_no; \ - OPJ_UINT32 l_pdx, l_pdy; \ - OPJ_UINT32 l_gain; \ - OPJ_INT32 l_x0b, l_y0b; \ - /* extent of precincts , top left, bottom right**/ \ +opj_bool FUNCTION ( opj_tcd_v2_t *p_tcd, \ + OPJ_UINT32 p_tile_no \ + ) \ +{ \ + OPJ_UINT32 (*l_gain_ptr)(OPJ_UINT32) = 00; \ + OPJ_UINT32 compno, resno, bandno, precno, cblkno; \ + opj_tcp_v2_t * l_tcp = 00; \ + opj_cp_v2_t * l_cp = 00; \ + opj_tcd_tile_v2_t * l_tile = 00; \ + opj_tccp_t *l_tccp = 00; \ + opj_tcd_tilecomp_v2_t *l_tilec = 00; \ + opj_image_comp_t * l_image_comp = 00; \ + opj_tcd_resolution_v2_t *l_res = 00; \ + opj_tcd_band_v2_t *l_band = 00; \ + opj_stepsize_t * l_step_size = 00; \ + opj_tcd_precinct_v2_t *l_current_precinct = 00; \ + TYPE* l_code_block = 00; \ + opj_image_t *l_image = 00; \ + OPJ_UINT32 p,q; \ + OPJ_UINT32 l_level_no; \ + OPJ_UINT32 l_pdx, l_pdy; \ + OPJ_UINT32 l_gain; \ + OPJ_INT32 l_x0b, l_y0b; \ + /* extent of precincts , top left, bottom right**/ \ OPJ_INT32 l_tl_prc_x_start, l_tl_prc_y_start, l_br_prc_x_end, l_br_prc_y_end; \ - /* number of precinct for a resolution */ \ - OPJ_UINT32 l_nb_precincts; \ + /* number of precinct for a resolution */ \ + OPJ_UINT32 l_nb_precincts; \ /* room needed to store l_nb_precinct precinct for a resolution */ \ - OPJ_UINT32 l_nb_precinct_size; \ - /* number of code blocks for a precinct*/ \ - OPJ_UINT32 l_nb_code_blocks; \ + OPJ_UINT32 l_nb_precinct_size; \ + /* number of code blocks for a precinct*/ \ + OPJ_UINT32 l_nb_code_blocks; \ /* room needed to store l_nb_code_blocks code blocks for a precinct*/ \ - OPJ_UINT32 l_nb_code_blocks_size; \ - /* size of data for a tile */ \ - OPJ_UINT32 l_data_size; \ - \ - l_cp = p_tcd->cp; \ - l_tcp = &(l_cp->tcps[p_tile_no]); \ - l_tile = p_tcd->tcd_image->tiles; \ - l_tccp = l_tcp->tccps; \ - l_tilec = l_tile->comps; \ - l_image = p_tcd->image; \ - l_image_comp = p_tcd->image->comps; \ - \ - p = p_tile_no % l_cp->tw; /* tile coordinates */ \ - q = p_tile_no / l_cp->tw; \ - /*fprintf(stderr, "Tile coordinate = %d,%d\n", p, q);*/ \ - \ + OPJ_UINT32 l_nb_code_blocks_size; \ + /* size of data for a tile */ \ + OPJ_UINT32 l_data_size; \ + \ + l_cp = p_tcd->cp; \ + l_tcp = &(l_cp->tcps[p_tile_no]); \ + l_tile = p_tcd->tcd_image->tiles; \ + l_tccp = l_tcp->tccps; \ + l_tilec = l_tile->comps; \ + l_image = p_tcd->image; \ + l_image_comp = p_tcd->image->comps; \ + \ + p = p_tile_no % l_cp->tw; /* tile coordinates */ \ + q = p_tile_no / l_cp->tw; \ + /*fprintf(stderr, "Tile coordinate = %d,%d\n", p, q);*/ \ + \ /* 4 borders of the tile rescale on the image if necessary */ \ l_tile->x0 = int_max(l_cp->tx0 + p * l_cp->tdx, l_image->x0); \ l_tile->y0 = int_max(l_cp->ty0 + q * l_cp->tdy, l_image->y0); \ l_tile->x1 = int_min(l_cp->tx0 + (p + 1) * l_cp->tdx, l_image->x1); \ l_tile->y1 = int_min(l_cp->ty0 + (q + 1) * l_cp->tdy, l_image->y1); \ /*fprintf(stderr, "Tile border = %d,%d,%d,%d\n", l_tile->x0, l_tile->y0,l_tile->x1,l_tile->y1);*/ \ - \ - /*tile->numcomps = image->numcomps; */ \ - for(compno = 0; compno < l_tile->numcomps; ++compno) { \ + \ + /*tile->numcomps = image->numcomps; */ \ + for(compno = 0; compno < l_tile->numcomps; ++compno) { \ /*fprintf(stderr, "compno = %d/%d\n", compno, l_tile->numcomps);*/ \ - \ - /* border of each l_tile component (global) */ \ + \ + /* border of each l_tile component (global) */ \ l_tilec->x0 = int_ceildiv(l_tile->x0, l_image_comp->dx); \ l_tilec->y0 = int_ceildiv(l_tile->y0, l_image_comp->dy); \ l_tilec->x1 = int_ceildiv(l_tile->x1, l_image_comp->dx); \ l_tilec->y1 = int_ceildiv(l_tile->y1, l_image_comp->dy); \ /*fprintf(stderr, "\tTile compo border = %d,%d,%d,%d\n", l_tilec->x0, l_tilec->y0,l_tilec->x1,l_tilec->y1);*/ \ - \ - l_data_size = (l_tilec->x1 - l_tilec->x0) \ - * (l_tilec->y1 - l_tilec->y0) * sizeof(OPJ_UINT32 ); \ - l_tilec->numresolutions = l_tccp->numresolutions; \ + \ + l_data_size = (l_tilec->x1 - l_tilec->x0) \ + * (l_tilec->y1 - l_tilec->y0) * sizeof(OPJ_UINT32 );\ + l_tilec->numresolutions = l_tccp->numresolutions; \ if (l_tccp->numresolutions < l_cp->m_specific_param.m_dec.m_reduce) { \ - l_tilec->minimum_num_resolutions = 1; \ - } \ - else { \ + l_tilec->minimum_num_resolutions = 1; \ + } \ + else { \ l_tilec->minimum_num_resolutions = l_tccp->numresolutions \ - - l_cp->m_specific_param.m_dec.m_reduce; \ - } \ - \ - if (l_tilec->data == 00) { \ + - l_cp->m_specific_param.m_dec.m_reduce; \ + } \ + \ + if (l_tilec->data == 00) { \ l_tilec->data = (OPJ_INT32 *) opj_malloc(l_data_size); \ - if (! l_tilec->data ) { \ - return OPJ_FALSE; \ - } \ + if (! l_tilec->data ) { \ + return OPJ_FALSE; \ + } \ /*fprintf(stderr, "\tAllocate data of tilec (int): %d x OPJ_UINT32\n",l_data_size);*/ \ - \ - l_tilec->data_size = l_data_size; \ - } \ - else if (l_data_size > l_tilec->data_size) { \ + \ + l_tilec->data_size = l_data_size; \ + } \ + else if (l_data_size > l_tilec->data_size) { \ OPJ_INT32 * new_data = (OPJ_INT32 *) opj_realloc(l_tilec->data, l_data_size); \ /* opj_event_msg_v2(p_manager, EVT_ERROR, "Not enough memory to handle tile data\n"); */ \ fprintf(stderr, "Not enough memory to handle tile data\n"); \ - if (! new_data) { \ - opj_free(l_tilec->data); \ - l_tilec->data = NULL; \ - l_tilec->data_size = 0; \ - return OPJ_FALSE; \ - } \ - l_tilec->data = new_data; \ + if (! new_data) { \ + opj_free(l_tilec->data); \ + l_tilec->data = NULL; \ + l_tilec->data_size = 0; \ + return OPJ_FALSE; \ + } \ + l_tilec->data = new_data; \ /*fprintf(stderr, "\tReallocate data of tilec (int): from %d to %d x OPJ_UINT32\n", l_tilec->data_size, l_data_size);*/ \ - l_tilec->data_size = l_data_size; \ - } \ - \ + l_tilec->data_size = l_data_size; \ + } \ + \ l_data_size = l_tilec->numresolutions * sizeof(opj_tcd_resolution_v2_t); \ - \ - if (l_tilec->resolutions == 00) { \ + \ + if (l_tilec->resolutions == 00) { \ l_tilec->resolutions = (opj_tcd_resolution_v2_t *) opj_malloc(l_data_size); \ - if (! l_tilec->resolutions ) { \ - return OPJ_FALSE; \ - } \ + if (! l_tilec->resolutions ) { \ + return OPJ_FALSE; \ + } \ /*fprintf(stderr, "\tAllocate resolutions of tilec (opj_tcd_resolution_v2_t): %d\n",l_data_size);*/ \ - l_tilec->resolutions_size = l_data_size; \ - memset(l_tilec->resolutions,0,l_data_size); \ - } \ - else if (l_data_size > l_tilec->resolutions_size) { \ + l_tilec->resolutions_size = l_data_size; \ + memset(l_tilec->resolutions,0,l_data_size); \ + } \ + else if (l_data_size > l_tilec->resolutions_size) { \ opj_tcd_resolution_v2_t* new_resolutions = (opj_tcd_resolution_v2_t *) opj_realloc(l_tilec->resolutions, l_data_size); \ - if (! new_resolutions) { \ + if (! new_resolutions) { \ /* opj_event_msg_v2(p_manager, EVT_ERROR, "Not enough memory to tile resolutions\n"); */ \ fprintf(stderr, "Not enough memory to tile resolutions\n"); \ - opj_free(l_tilec->resolutions); \ - l_tilec->resolutions = NULL; \ - l_tilec->resolutions_size = 0; \ - return OPJ_FALSE; \ - } \ - l_tilec->resolutions = new_resolutions; \ + opj_free(l_tilec->resolutions); \ + l_tilec->resolutions = NULL; \ + l_tilec->resolutions_size = 0; \ + return OPJ_FALSE; \ + } \ + l_tilec->resolutions = new_resolutions; \ /*fprintf(stderr, "\tReallocate data of tilec (int): from %d to %d x OPJ_UINT32\n", l_tilec->resolutions_size, l_data_size);*/ \ memset(((OPJ_BYTE*) l_tilec->resolutions)+l_tilec->resolutions_size,0,l_data_size - l_tilec->resolutions_size); \ - l_tilec->resolutions_size = l_data_size; \ - } \ - \ - l_level_no = l_tilec->numresolutions - 1; \ - l_res = l_tilec->resolutions; \ - l_step_size = l_tccp->stepsizes; \ - if (l_tccp->qmfbid == 0) { \ - l_gain_ptr = &opj_dwt_getgain_real; \ - } \ - else { \ - l_gain_ptr = &opj_dwt_getgain; \ - } \ - /*fprintf(stderr, "\tlevel_no=%d\n",l_level_no);*/ \ + l_tilec->resolutions_size = l_data_size; \ + } \ + \ + l_level_no = l_tilec->numresolutions - 1; \ + l_res = l_tilec->resolutions; \ + l_step_size = l_tccp->stepsizes; \ + if (l_tccp->qmfbid == 0) { \ + l_gain_ptr = &opj_dwt_getgain_real; \ + } \ + else { \ + l_gain_ptr = &opj_dwt_getgain; \ + } \ + /*fprintf(stderr, "\tlevel_no=%d\n",l_level_no);*/ \ \ for(resno = 0; resno < l_tilec->numresolutions; ++resno) { \ /*fprintf(stderr, "\t\tresno = %d/%d\n", resno, l_tilec->numresolutions);*/ \ diff --git a/libopenjpeg/tcd.h b/libopenjpeg/tcd.h index 0a60b408..b43d2850 100644 --- a/libopenjpeg/tcd.h +++ b/libopenjpeg/tcd.h @@ -350,7 +350,7 @@ void tcd_dump(FILE *fd, opj_tcd_t *tcd, opj_tcd_image_t *img); /** Create a new TCD handle -@param FIXME +@param p_is_decoder FIXME DOC @return Returns a new TCD handle if successful returns NULL otherwise */ opj_tcd_v2_t* opj_tcd_create(opj_bool p_is_decoder); @@ -428,6 +428,7 @@ Decode a tile from a buffer into a raw image @param src Source buffer @param len Length of source buffer @param tileno Number that identifies one of the tiles to be decoded +@param cstr_info FIXME DOC */ opj_bool opj_tcd_decode_tile( opj_tcd_v2_t *tcd, OPJ_BYTE *src, @@ -450,9 +451,8 @@ OPJ_UINT32 opj_tcd_get_encoded_tile_size ( opj_tcd_v2_t *p_tcd ); /** * Initialize the tile coder and may reuse some meory. + * * @param p_tcd TCD handle. - * @param p_image raw image. - * @param p_cp coding parameters. * @param p_tile_no current tile index to encode. * * @return true if the encoding values could be set (false otherwise). -- 2.40.0