2011-04-14 20:37:47 +02:00
|
|
|
/*
|
2011-05-09 20:11:40 +02:00
|
|
|
* $Id: msgqueue_manager.h 53 2011-05-09 16:55:39Z kaori $
|
2011-04-14 20:37:47 +02:00
|
|
|
*
|
|
|
|
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
|
|
|
|
* Copyright (c) 2002-2011, Professor Benoit Macq
|
|
|
|
* Copyright (c) 2010-2011, Kaori Hagihara
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MSGQUEUE_MANAGER_H_
|
|
|
|
# define MSGQUEUE_MANAGER_H_
|
|
|
|
|
2011-05-09 20:11:40 +02:00
|
|
|
#include "bool.h"
|
2011-04-14 20:37:47 +02:00
|
|
|
#include "byte_manager.h"
|
2011-08-27 14:53:38 +02:00
|
|
|
#include "cachemodel_manager.h"
|
2011-04-14 20:37:47 +02:00
|
|
|
#include "placeholder_manager.h"
|
|
|
|
|
|
|
|
//! message parameters
|
|
|
|
typedef struct message_param{
|
|
|
|
bool last_byte; //!< if message contains the last byte of the data-bin
|
|
|
|
Byte8_t in_class_id; //!< in-class identifier A.2.3
|
|
|
|
Byte8_t class_id; //!< class identifiers
|
|
|
|
Byte8_t csn; //!< index of the codestream
|
|
|
|
Byte8_t bin_offset; //!< offset of the data in this message from the start of the data-bin
|
|
|
|
Byte8_t length; //!< message byte length
|
|
|
|
Byte8_t aux; //!<
|
|
|
|
Byte8_t res_offset; //!< offset in the resource
|
|
|
|
placeholder_param_t *phld; //!< placeholder pointer in index
|
|
|
|
struct message_param *next; //!< pointer to the next message
|
|
|
|
} message_param_t;
|
|
|
|
|
|
|
|
//! message queue parameters
|
|
|
|
typedef struct msgqueue_param{
|
|
|
|
message_param_t *first; //!< first message pointer of the list
|
|
|
|
message_param_t *last; //!< last message pointer of the list
|
|
|
|
bool stateless; //!< if this is a stateless message queue
|
2011-08-27 14:53:38 +02:00
|
|
|
cachemodel_param_t *cachemodel; //!< reference cachemodel pointer
|
2011-04-14 20:37:47 +02:00
|
|
|
} msgqueue_param_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* generate message queue
|
|
|
|
*
|
2011-08-27 14:53:38 +02:00
|
|
|
* @param[in] stateless if this is a stateless message queue
|
|
|
|
* @param[in] cachemodel cachemodel pointer
|
|
|
|
* @return generated message queue pointer
|
2011-04-14 20:37:47 +02:00
|
|
|
*/
|
2011-08-27 14:53:38 +02:00
|
|
|
msgqueue_param_t * gene_msgqueue( bool stateless, cachemodel_param_t *cachemodel);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* delete message queue
|
|
|
|
*
|
|
|
|
* @param[in] msgqueue address of the message queue pointer
|
|
|
|
*/
|
|
|
|
void delete_msgqueue( msgqueue_param_t **msgqueue);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* print message queue
|
|
|
|
*
|
|
|
|
* @param[in] msgqueue message queue pointer
|
|
|
|
*/
|
|
|
|
void print_msgqueue( msgqueue_param_t *msgqueue);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enqueue main header data-bin into message queue
|
|
|
|
*
|
|
|
|
* @param[in,out] msgqueue message queue pointer
|
|
|
|
*/
|
|
|
|
void enqueue_mainheader( msgqueue_param_t *msgqueue);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enqueue tile data-bin into message queue
|
|
|
|
*
|
|
|
|
* @param[in] tile_id tile id starting from 0
|
|
|
|
* @param[in] level decomposition level
|
|
|
|
* @param[in,out] msgqueue message queue pointer
|
|
|
|
*/
|
|
|
|
void enqueue_tile( int tile_id, int level, msgqueue_param_t *msgqueue);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enqueue Metadata-bin into message queue
|
|
|
|
*
|
|
|
|
* @param[in] meta_id metadata-bin id
|
|
|
|
* @param[in,out] msgqueue message queue pointer
|
|
|
|
*/
|
|
|
|
void enqueue_metadata( int meta_id, msgqueue_param_t *msgqueue);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* emit stream from message queue
|
|
|
|
*
|
|
|
|
* @param[in] msgqueue message queue pointer
|
|
|
|
*/
|
|
|
|
void emit_stream_from_msgqueue( msgqueue_param_t *msgqueue);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-07-05 01:00:21 +02:00
|
|
|
* parse JPT- JPP- stream to message queue
|
2011-04-14 20:37:47 +02:00
|
|
|
*
|
2011-07-05 01:00:21 +02:00
|
|
|
* @param[in] JPIPstream JPT- JPP- stream data pointer
|
|
|
|
* @param[in] streamlen JPIPstream length
|
|
|
|
* @param[in] offset offset of the stream from the whole beginning
|
2011-04-14 20:37:47 +02:00
|
|
|
* @param[in,out] msgqueue adding message queue pointer
|
|
|
|
*/
|
2011-07-05 01:00:21 +02:00
|
|
|
void parse_JPIPstream( Byte_t *JPIPstream, Byte8_t streamlen, Byte8_t offset, msgqueue_param_t *msgqueue);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
/**
|
2011-07-05 01:00:21 +02:00
|
|
|
* parse JPT- JPP- stream to message queue
|
2011-04-14 20:37:47 +02:00
|
|
|
*
|
|
|
|
* @param[in] msgqueue reference message queue pointer
|
2011-07-05 01:00:21 +02:00
|
|
|
* @param[in] stream stream data pointer
|
|
|
|
* @param[in] streamlen stream length
|
2011-04-14 20:37:47 +02:00
|
|
|
* @param[in] metadatalist adding metadata list pointer
|
|
|
|
*/
|
2011-07-05 01:00:21 +02:00
|
|
|
void parse_metamsg( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* reconstruct j2k codestream from message queue
|
|
|
|
*
|
2011-07-05 14:25:37 +02:00
|
|
|
* @param[in] msgqueue message queue pointer
|
|
|
|
* @param[in] jpipstream original jpt- jpp- stream
|
|
|
|
* @param[in] csn codestream number
|
|
|
|
* @param[in] minlev minimum decomposition level
|
|
|
|
* @param[out] j2klen pointer to the j2k codestream length
|
|
|
|
* @return generated reconstructed j2k codestream
|
2011-04-14 20:37:47 +02:00
|
|
|
*/
|
2011-07-05 14:25:37 +02:00
|
|
|
Byte_t * recons_j2k( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int minlev, Byte8_t *j2klen);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* reconstruct jp2 file codestream from message queue
|
|
|
|
*
|
2011-07-05 14:25:37 +02:00
|
|
|
* @param[in] msgqueue message queue pointer
|
|
|
|
* @param[in] jpipstream original jpt- jpp- stream
|
|
|
|
* @param[in] csn codestream number
|
|
|
|
* @param[out] jp2len pointer to the jp2 codestream length
|
|
|
|
* @return generated reconstructed jp2 codestream
|
2011-04-14 20:37:47 +02:00
|
|
|
*/
|
2011-07-05 14:25:37 +02:00
|
|
|
Byte_t * recons_jp2( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *jp2len);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* !MSGQUEUE_MANAGER_H_ */
|