[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.
This commit is contained in:
parent
de9e1a0693
commit
f16216e270
@ -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;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
||||
|
186
libopenjpeg/pi.c
186
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,
|
||||
|
@ -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);
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);*/ \
|
||||
|
@ -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).
|
||||
|
Loading…
Reference in New Issue
Block a user