OpenJPEG 2.3.1

msgqueue_manager.h
Go to the documentation of this file.
1 /*
2 * $Id$
3 *
4 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
5 * Copyright (c) 2002-2014, Professor Benoit Macq
6 * Copyright (c) 2010-2011, Kaori Hagihara
7 * Copyright (c) 2011, Lucian Corlaciu, GSoC
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef MSGQUEUE_MANAGER_H_
33 # define MSGQUEUE_MANAGER_H_
34
35 #include "byte_manager.h"
36 #include "cachemodel_manager.h"
37 #include "placeholder_manager.h"
38
39 #define PRECINCT_MSG 0
40 #define EXT_PRECINCT_MSG 1
41 #define TILE_HEADER_MSG 2
42 #define TILE_MSG 4
43 #define EXT_TILE_MSG 5
44 #define MAINHEADER_MSG 6
45 #define METADATA_MSG 8
46
48 typedef struct message_param {
49 OPJ_BOOL
50 last_byte;
51 Byte8_t in_class_id;
52 Byte8_t class_id;
53 Byte8_t csn;
54 Byte8_t bin_offset;
55 Byte8_t length;
56 Byte8_t aux;
57 OPJ_OFF_T res_offset;
58 placeholder_param_t *phld;
59 struct message_param *next;
60 } message_param_t;
61
63 typedef struct msgqueue_param {
64 message_param_t *first;
65 message_param_t *last;
66 OPJ_BOOL stateless;
67 cachemodel_param_t *cachemodel;
68 } msgqueue_param_t;
69
77 msgqueue_param_t * gene_msgqueue(OPJ_BOOL stateless,
78 cachemodel_param_t *cachemodel);
79
85 void delete_msgqueue(msgqueue_param_t **msgqueue);
86
93 void delete_message_in_msgqueue(message_param_t **message,
94 msgqueue_param_t *msgqueue);
95
101 void print_msgqueue(msgqueue_param_t *msgqueue);
102
103
109 void enqueue_mainheader(msgqueue_param_t *msgqueue);
110
117 void enqueue_tileheader(int tile_id, msgqueue_param_t *msgqueue);
118
126 void enqueue_tile(Byte4_t tile_id, int level, msgqueue_param_t *msgqueue);
127
137 void enqueue_precinct(int seq_id, int tile_id, int comp_id, int layers,
138 msgqueue_param_t *msgqueue);
139
140
147 void enqueue_metadata(Byte8_t meta_id, msgqueue_param_t *msgqueue);
148
149
156 void recons_stream_from_msgqueue(msgqueue_param_t *msgqueue, int tmpfd);
157
158
167 void parse_JPIPstream(Byte_t *JPIPstream, Byte8_t streamlen, OPJ_OFF_T offset,
168 msgqueue_param_t *msgqueue);
169
178 void parse_metamsg(msgqueue_param_t *msgqueue, Byte_t *stream,
179 Byte8_t streamlen, metadatalist_param_t *metadatalist);
180
191 Byte8_t comp_precinct_id(int t, int c, int s, int num_components,
192 int num_tiles);
193
194 #endif /* !MSGQUEUE_MANAGER_H_ */
METADATA_MSG
#define METADATA_MSG
Definition: msgqueue_manager.h:45
enqueue_tileheader
void enqueue_tileheader(int tile_id, msgqueue_param_t *msgqueue)
enqueue tile headers data-bin into message queue
Definition: msgqueue_manager.c:165
gene_boxcontents
boxcontents_param_t * gene_boxcontents(OPJ_OFF_T offset, OPJ_SIZE_T length)
generate box contents
Definition: metadata_manager.c:194
cachemodel_param
Cache model parameters.
Definition: cachemodel_manager.h:37
cachemodel_param::pp_model
OPJ_BOOL ** pp_model
dynamic array pointer of precint packet model
Definition: cachemodel_manager.h:43
enqueue_precinct
void enqueue_precinct(int seq_id, int tile_id, int comp_id, int layers, msgqueue_param_t *msgqueue)
enqueue precinct data-bin into message queue
Definition: msgqueue_manager.c:256
comp_precinct_id
Byte8_t comp_precinct_id(int t, int c, int s, int num_components, int num_tiles)
compute precinct ID A.3.2.1
Definition: msgqueue_manager.c:311
box_param::next
struct box_param * next
pointer to the next box
Definition: box_manager.h:43
TILE_MSG
#define TILE_MSG
Definition: msgqueue_manager.h:42
add_bigendian_bytestream
void add_bigendian_bytestream(Byte8_t code, int bytelength, int tmpfd)
Definition: msgqueue_manager.c:589
target_param::codeidx
index_param_t * codeidx
index information of codestream
Definition: target_manager.h:49
parse_JPIPstream
void parse_JPIPstream(Byte_t *JPIPstream, Byte8_t streamlen, OPJ_OFF_T offset, msgqueue_param_t *msgqueue)
parse JPT- JPP- stream to message queue
Definition: msgqueue_manager.c:631
recons_stream_from_msgqueue
void recons_stream_from_msgqueue(msgqueue_param_t *msgqueue, int tmpfd)
reconstruct JPT/JPP-stream from message queue
Definition: msgqueue_manager.c:443
delete_message_in_msgqueue
void delete_message_in_msgqueue(message_param_t **message, msgqueue_param_t *msgqueue)
delete a message in msgqueue
Definition: msgqueue_manager.c:795
CODmarker_param::numOflayers
Byte2_t numOflayers
number of layers
Definition: index_manager.h:79
metadata_param::placeholderlist
placeholderlist_param_t * placeholderlist
placeholder box list
Definition: metadata_manager.h:46
delete_message_in_msgqueue
void delete_message_in_msgqueue(message_param_t **msg, msgqueue_param_t *msgqueue)
delete a message in msgqueue
Definition: msgqueue_manager.c:795
delete_cachemodel
void delete_cachemodel(cachemodel_param_t **cachemodel)
delete a cache model
Definition: cachemodel_manager.c:191
target_param::csn
int csn
codestream number
Definition: target_manager.h:47
placeholder_param::OrigBHlen
Byte_t OrigBHlen
length of OrigBH
Definition: placeholder_manager.h:45
box_param::offset
OPJ_OFF_T offset
byte position of the whole Box (LBox) in the file
Definition: box_manager.h:39
SIZmarker_param::XTnum
Byte4_t XTnum
number of tiles in horizontal direction
Definition: index_manager.h:66
big4
Byte4_t big4(Byte_t *buf)
convert 4-byte big endian Byte codes to number
Definition: byte_manager.c:147
logstream
#define logstream
Definition: msgqueue_manager.c:56
EXT_TILE_MSG
#define EXT_TILE_MSG
Definition: msgqueue_manager.h:43
metadata_manager.h
placeholder_param
A.3.6.3 Placeholder box format.
Definition: placeholder_manager.h:39
Byte_t
uint8_t Byte_t
Definition: byte_manager.h:37
delete_msgqueue
void delete_msgqueue(msgqueue_param_t **msgqueue)
delete message queue
Definition: msgqueue_manager.c:75
index_param::offset
OPJ_OFF_T offset
codestream offset
Definition: index_manager.h:88
print_msgqueue
void print_msgqueue(msgqueue_param_t *msgqueue)
print message queue
Definition: msgqueue_manager.c:97
msgqueue_param::stateless
OPJ_BOOL stateless
if this is a stateless message queue
Definition: msgqueue_manager.h:66
PRECINCT_MSG
#define PRECINCT_MSG
Definition: msgqueue_manager.h:39
OPJ_OFF_T
int64_t OPJ_OFF_T
Definition: openjpeg.h:130
boxcontents_param::offset
OPJ_OFF_T offset
byte position of the box contents in the file
Definition: metadata_manager.h:38
box_param
box parameters
Definition: box_manager.h:37
index_param
index parameters
Definition: index_manager.h:86
faixbox_param
fragment array index box parameters
Definition: faixbox_manager.h:77
get_nmax
Byte8_t get_nmax(faixbox_param_t *faix)
get nmax parameter value from faix box
Definition: faixbox_manager.c:163
gene_msgqueue
msgqueue_param_t * gene_msgqueue(OPJ_BOOL stateless, cachemodel_param_t *cachemodel)
generate message queue
Definition: msgqueue_manager.c:59
add_vbas_stream
void add_vbas_stream(Byte8_t code, int tmpfd)
Definition: msgqueue_manager.c:521
comp_precinct_id
Byte8_t comp_precinct_id(int t, int c, int s, int num_components, int num_tiles)
compute precinct ID A.3.2.1
Definition: msgqueue_manager.c:311
enqueue_box
void enqueue_box(Byte8_t meta_id, boxlist_param_t *boxlist, msgqueue_param_t *msgqueue, Byte8_t *binOffset)
Definition: msgqueue_manager.c:356
add_body_stream
void add_body_stream(message_param_t *msg, int fd, int tmpfd)
Definition: msgqueue_manager.c:554
search_metadata
metadata_param_t * search_metadata(Byte8_t idx, metadatalist_param_t *list)
search a metadata bin by index
Definition: metadata_manager.c:206
add_placeholder_stream
void add_placeholder_stream(placeholder_param_t *phld, int tmpfd)
Definition: msgqueue_manager.c:573
index_param::tilepart
faixbox_param_t * tilepart
tile part information from tpix box
Definition: index_manager.h:93
placeholder_param::OrigID
Byte8_t OrigID
Definition: placeholder_manager.h:43
metadata_param::boxlist
boxlist_param_t * boxlist
box list
Definition: metadata_manager.h:45
print_placeholder
void print_placeholder(placeholder_param_t *phld)
print placeholder parameters
Definition: placeholder_manager.c:115
metadatalist_param
metadata-bin list parameters
Definition: metadata_manager.h:54
message_param::last_byte
OPJ_BOOL last_byte
if message contains the last byte of the data-bin
Definition: msgqueue_manager.h:50
message_param::length
Byte8_t length
message byte length
Definition: msgqueue_manager.h:55
enqueue_message
void enqueue_message(message_param_t *msg, msgqueue_param_t *msgqueue)
Definition: msgqueue_manager.c:426
enqueue_mainheader
void enqueue_mainheader(msgqueue_param_t *msgqueue)
enqueue main header data-bin into message queue
Definition: msgqueue_manager.c:135
SIZmarker_param::YTnum
Byte4_t YTnum
number of tiles in vertical direction
Definition: index_manager.h:67
OPJ_BOOL
int OPJ_BOOL
Definition: openjpeg.h:110
enqueue_tile
void enqueue_tile(Byte4_t tile_id, int level, msgqueue_param_t *msgqueue)
enqueue tile data-bin into message queue
Definition: msgqueue_manager.c:198
FCGI_stderr
#define FCGI_stderr
Definition: msgqueue_manager.c:55
index_param::COD
CODmarker_param_t COD
COD marker information.
Definition: index_manager.h:92
message_param::bin_offset
Byte8_t bin_offset
offset of the data in this message from the start of the data-bin
Definition: msgqueue_manager.h:54
enqueue_tileheader
void enqueue_tileheader(int tile_id, msgqueue_param_t *msgqueue)
enqueue tile headers data-bin into message queue
Definition: msgqueue_manager.c:165
get_elemOff
Byte8_t get_elemOff(faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id)
get offset of a element from faix box
Definition: faixbox_manager.c:181
placeholder_manager.h
get_elemLen
Byte8_t get_elemLen(faixbox_param_t *faix, Byte8_t elem_id, Byte8_t row_id)
get length of a element from faix box
Definition: faixbox_manager.c:192
enqueue_precinct
void enqueue_precinct(int seq_id, int tile_id, int comp_id, int layers, msgqueue_param_t *msgqueue)
enqueue precinct data-bin into message queue
Definition: msgqueue_manager.c:256
message_param
message parameters
Definition: msgqueue_manager.h:48
gene_boxlist
boxlist_param_t * gene_boxlist(void)
generate a box list
Definition: box_manager.c:48
parse_vbas
Byte_t * parse_vbas(Byte_t *streamptr, Byte8_t *elem)
Definition: msgqueue_manager.c:780
enqueue_boxcontents
void enqueue_boxcontents(Byte8_t meta_id, boxcontents_param_t *boxcontents, msgqueue_param_t *msgqueue, Byte8_t *binOffset)
Definition: msgqueue_manager.c:392
boxcontents_param
Definition: metadata_manager.h:37
gene_msgqueue
msgqueue_param_t * gene_msgqueue(OPJ_BOOL stateless, cachemodel_param_t *cachemodel)
generate message queue
Definition: msgqueue_manager.c:59
placeholder_param::next
struct placeholder_param * next
pointer to the next placeholder
Definition: placeholder_manager.h:53
gene_boxbyOffinStream
box_param_t * gene_boxbyOffinStream(Byte_t *stream, OPJ_OFF_T offset)
generate box from code stream (JPP or JPT stream) at the given offset
Definition: box_manager.c:138
msgqueue_manager.h
insert_metadata_into_list
void insert_metadata_into_list(metadata_param_t *metabin, metadatalist_param_t *metadatalist)
insert a metadata-bin into list
Definition: metadata_manager.c:156
enqueue_phld
void enqueue_phld(Byte8_t meta_id, placeholderlist_param_t *phldlist, msgqueue_param_t *msgqueue, Byte8_t *binOffset)
Definition: msgqueue_manager.c:374
metadata_param
metadata-bin parameters
Definition: metadata_manager.h:43
fetch_bytes
Byte_t * fetch_bytes(int fd, OPJ_OFF_T offset, OPJ_SIZE_T size)
fetch bytes of data in file stream
Definition: byte_manager.c:52
message_param::next
struct message_param * next
pointer to the next message
Definition: msgqueue_manager.h:59
parse_metamsg
void parse_metamsg(msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist)
parse JPT- JPP- stream to message queue
Definition: msgqueue_manager.c:687
OPJ_TRUE
#define OPJ_TRUE
Definition: openjpeg.h:111
placeholderlist_param::first
placeholder_param_t * first
first placeholder pointer of the list
Definition: placeholder_manager.h:59
opj_malloc
void * opj_malloc(size_t size)
Allocate an uninitialized memory block.
Definition: opj_malloc.c:191
insert_placeholder_into_list
void insert_placeholder_into_list(placeholder_param_t *phld, placeholderlist_param_t *phldlist)
Definition: placeholder_manager.c:104
msgqueue_param::cachemodel
cachemodel_param_t * cachemodel
reference cachemodel pointer
Definition: msgqueue_manager.h:67
enqueue_metadata
void enqueue_metadata(Byte8_t meta_id, msgqueue_param_t *msgqueue)
enqueue Metadata-bin into message queue
Definition: msgqueue_manager.c:323
index_param::tileheader
mhixbox_param_t ** tileheader
dynamic array of tile header information from thix box
Definition: index_manager.h:95
cachemodel_param::target
target_param_t * target
reference pointer to the target
Definition: cachemodel_manager.h:38
Byte4_t
uint32_t Byte4_t
Definition: byte_manager.h:39
opj_free
void opj_free(void *ptr)
Deallocates or frees a memory block.
Definition: opj_malloc.c:246
get_m
Byte8_t get_m(faixbox_param_t *faix)
get m parameter value from faix box
Definition: faixbox_manager.c:172
add_bin_id_vbas_stream
void add_bin_id_vbas_stream(Byte_t bb, Byte_t c, Byte8_t in_class_id, int tmpfd)
Definition: msgqueue_manager.c:501
message_param::res_offset
OPJ_OFF_T res_offset
offset in the resource
Definition: msgqueue_manager.h:57
enqueue_tile
void enqueue_tile(Byte4_t tile_id, int level, msgqueue_param_t *msgqueue)
enqueue tile data-bin into message queue
Definition: msgqueue_manager.c:198
cachemodel_param::tp_model
OPJ_BOOL * tp_model
dynamic array pointer of tile part model, if sent, 1, else 0
Definition: cachemodel_manager.h:41
parse_phld
placeholder_param_t * parse_phld(Byte_t *datastream, Byte8_t metalength)
Definition: msgqueue_manager.c:741
cachemodel_param::th_model
OPJ_BOOL * th_model
dynamic array pointer of tile header model
Definition: cachemodel_manager.h:42
box_param::length
Byte8_t length
length of the whole Box
Definition: box_manager.h:41
parse_JPIPstream
void parse_JPIPstream(Byte_t *JPIPstream, Byte8_t streamlen, OPJ_OFF_T offset, msgqueue_param_t *msgqueue)
parse JPT- JPP- stream to message queue
Definition: msgqueue_manager.c:631
message_param::in_class_id
Byte8_t in_class_id
in-class identifier A.2.3
Definition: msgqueue_manager.h:51
message_param::aux
Byte8_t aux
Definition: msgqueue_manager.h:56
recons_stream_from_msgqueue
void recons_stream_from_msgqueue(msgqueue_param_t *msgqueue, int tmpfd)
reconstruct JPT/JPP-stream from message queue
Definition: msgqueue_manager.c:443
msgqueue_param::last
message_param_t * last
last message pointer of the list
Definition: msgqueue_manager.h:65
placeholder_param::TBox
char TBox[4]
Definition: placeholder_manager.h:41
message_param::csn
Byte8_t csn
index of the codestream
Definition: msgqueue_manager.h:53
message_param_t
struct message_param message_param_t
message parameters
parse_metadata
void parse_metadata(metadata_param_t *metadata, message_param_t *msg, Byte_t *stream)
Definition: msgqueue_manager.c:710
insert_box_into_list
void insert_box_into_list(box_param_t *box, boxlist_param_t *boxlist)
insert a box into list
Definition: box_manager.c:440
index_param::SIZ
SIZmarker_param_t SIZ
SIZ marker information.
Definition: index_manager.h:91
big8
Byte8_t big8(Byte_t *buf)
convert 8-byte big endian Byte codes to number
Definition: byte_manager.c:153
gene_metadata
metadata_param_t * gene_metadata(Byte8_t idx, boxlist_param_t *boxlist, placeholderlist_param_t *phldlist, boxcontents_param_t *boxcontents)
generate a metadata bin
Definition: metadata_manager.c:128
metadata_param::boxcontents
boxcontents_param_t * boxcontents
box contens in case of no boxlist and placeholderlist
Definition: metadata_manager.h:48
SIZmarker_param::Csiz
Byte2_t Csiz
number of the components in the image
Definition: index_manager.h:68
placeholder_param::LBox
Byte4_t LBox
Definition: placeholder_manager.h:40
index_param::metadatalist
metadatalist_param_t * metadatalist
metadata-bin list
Definition: index_manager.h:87
print_binarycode
void print_binarycode(Byte8_t n, int segmentlen)
Definition: msgqueue_manager.c:605
MAINHEADER_MSG
#define MAINHEADER_MSG
Definition: msgqueue_manager.h:44
byte_manager.h
mhixbox_param::tlen
Byte8_t tlen
length ( total length of the main
Definition: mhixbox_manager.h:53
gene_placeholderlist
placeholderlist_param_t * gene_placeholderlist(void)
generate a placeholder list
Definition: placeholder_manager.c:48
parse_metamsg
void parse_metamsg(msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t streamlen, metadatalist_param_t *metadatalist)
parse JPT- JPP- stream to message queue
Definition: msgqueue_manager.c:687
parse_bin_id_vbas
Byte_t * parse_bin_id_vbas(Byte_t *streamptr, Byte_t *bb, Byte_t *c, Byte8_t *in_class_id)
Definition: msgqueue_manager.c:759
message_param::class_id
Byte8_t class_id
class identifiers
Definition: msgqueue_manager.h:52
msgqueue_param_t
struct msgqueue_param msgqueue_param_t
message queue parameters
enqueue_mainheader
void enqueue_mainheader(msgqueue_param_t *msgqueue)
enqueue main header data-bin into message queue
Definition: msgqueue_manager.c:135
target_param::fd
int fd
file descriptor
Definition: target_manager.h:43
target_param
target parameters
Definition: target_manager.h:40
msgqueue_param
message queue parameters
Definition: msgqueue_manager.h:63
enqueue_metadata
void enqueue_metadata(Byte8_t meta_id, msgqueue_param_t *msgqueue)
enqueue Metadata-bin into message queue
Definition: msgqueue_manager.c:323
boxlist_param
Box list parameters.
Definition: box_manager.h:48
index_param::precpacket
faixbox_param_t ** precpacket
dynamic array of precint packet information from ppix box
Definition: index_manager.h:97
placeholderlist_param
placeholder box list parameters
Definition: placeholder_manager.h:58
opj_inttypes.h
boxcontents_param::length
Byte8_t length
length of the box contents
Definition: metadata_manager.h:39
message_param::phld
placeholder_param_t * phld
placeholder pointer in index
Definition: msgqueue_manager.h:58
OPJ_FALSE
#define OPJ_FALSE
Definition: openjpeg.h:112
boxlist_param::first
box_param_t * first
first box pointer of the list
Definition: box_manager.h:49
cachemodel_manager.h
index_manager.h
cachemodel_param::mhead_model
OPJ_BOOL mhead_model
main header model, if sent, 1, else 0
Definition: cachemodel_manager.h:40
index_param::mhead_length
Byte8_t mhead_length
main header length
Definition: index_manager.h:90
Byte8_t
uint64_t Byte8_t
Definition: byte_manager.h:40
placeholder_param::Flags
Byte4_t Flags
Definition: placeholder_manager.h:42
TILE_HEADER_MSG
#define TILE_HEADER_MSG
Definition: msgqueue_manager.h:41
placeholder_param::OrigBH
Byte_t * OrigBH
dynamic memory pointer
Definition: placeholder_manager.h:44
gene_metamsg
message_param_t * gene_metamsg(Byte8_t meta_id, Byte8_t binoffset, Byte8_t length, OPJ_OFF_T res_offset, placeholder_param_t *phld, Byte8_t csn)
Definition: msgqueue_manager.c:405
msgqueue_param::first
message_param_t * first
first message pointer of the list
Definition: msgqueue_manager.h:64
delete_msgqueue
void delete_msgqueue(msgqueue_param_t **msgqueue)
delete message queue
Definition: msgqueue_manager.c:75
add_vbas_with_bytelen_stream
void add_vbas_with_bytelen_stream(Byte8_t code, int bytelength, int tmpfd)
Definition: msgqueue_manager.c:535
print_msgqueue
void print_msgqueue(msgqueue_param_t *msgqueue)
print message queue
Definition: msgqueue_manager.c:97