OpenJPEG  2.5.0
jp2k_encoder.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 JP2K_ENCODER_H_
33 # define JP2K_ENCODER_H_
34 
35 #include "byte_manager.h"
36 #include "msgqueue_manager.h"
37 
49 Byte_t * recons_j2k(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn,
50  int fw, int fh, Byte8_t *j2klen);
51 
52 
62 Byte_t * recons_jp2(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn,
63  Byte8_t *jp2len);
64 
74 Byte_t * recons_j2kmainhead(msgqueue_param_t *msgqueue, Byte_t *jpipstream,
75  Byte8_t csn, Byte8_t *j2klen);
76 
77 #endif /* !JP2K_ENCODER_H_ */
METADATA_MSG
#define METADATA_MSG
Definition: msgqueue_manager.h:45
comp_numOfprcts
int comp_numOfprcts(Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int r)
Definition: jp2k_encoder.c:576
TILE_MSG
#define TILE_MSG
Definition: msgqueue_manager.h:42
add_padding
Byte_t * add_padding(Byte8_t padding, Byte_t *j2kstream, Byte8_t *j2klen)
Definition: jp2k_encoder.c:826
gene_emptytilestream
Byte_t * gene_emptytilestream(const Byte8_t tileID, Byte8_t *length)
Definition: jp2k_encoder.c:880
CODmarker_param::numOflayers
Byte2_t numOflayers
number of layers
Definition: index_manager.h:79
recons_codestream_from_JPTstream
Byte_t * recons_codestream_from_JPTstream(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen)
Definition: jp2k_encoder.c:189
placeholder_param::OrigBHlen
Byte_t OrigBHlen
length of OrigBH
Definition: placeholder_manager.h:45
CODmarker_param::Scod
Byte_t Scod
Coding style for all components.
Definition: index_manager.h:77
recons_j2kmainhead
Byte_t * recons_j2kmainhead(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *j2klen)
reconstruct j2k codestream of mainheader from message queue
Definition: jp2k_encoder.c:906
SIZmarker_param::XTnum
Byte4_t XTnum
number of tiles in horizontal direction
Definition: index_manager.h:66
delete_COD
void delete_COD(CODmarker_param_t COD)
delete dynamic arrays in COD marker
Definition: index_manager.c:215
big4
Byte4_t big4(Byte_t *buf)
convert 4-byte big endian Byte codes to number
Definition: byte_manager.c:147
CODmarker_param::XPsiz
Byte4_t * XPsiz
dynamic array of precinct width at successive resolution level in order
Definition: index_manager.h:81
EXT_TILE_MSG
#define EXT_TILE_MSG
Definition: msgqueue_manager.h:43
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
imgreg_manager.h
recons_jp2
Byte_t * recons_jp2(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *jp2len)
reconstruct jp2 file codestream from message queue
Definition: jp2k_encoder.c:98
modify_tileheader
OPJ_BOOL modify_tileheader(Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen)
modify tile header in j2k codestream to fit with the tile part length, and new number of decompositio...
Definition: j2kheader_manager.c:256
PRECINCT_MSG
#define PRECINCT_MSG
Definition: msgqueue_manager.h:39
recons_CPRLbitstream
Byte_t * recons_CPRLbitstream(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen)
Definition: jp2k_encoder.c:542
SIZmarker_param::Xsiz
Byte4_t Xsiz
width of the reference grid
Definition: index_manager.h:58
OPJ_RLCP
@ OPJ_RLCP
resolution-layer-component-precinct order
Definition: openjpeg.h:306
CODmarker_param::prog_order
OPJ_PROG_ORDER prog_order
progression order
Definition: index_manager.h:78
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
recons_j2k
Byte_t * recons_j2k(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen)
reconstruct j2k codestream from message queue
Definition: jp2k_encoder.c:79
SIZmarker_param::Ysiz
Byte4_t Ysiz
height of the reference grid
Definition: index_manager.h:59
add_EOC
Byte_t * add_EOC(Byte_t *j2kstream, Byte8_t *j2klen)
Definition: jp2k_encoder.c:844
OPJ_CPRL
@ OPJ_CPRL
component-precinct-resolution-layer order
Definition: openjpeg.h:309
j2kheader_manager.h
FCGI_stderr
#define FCGI_stderr
Definition: jp2k_encoder.c:48
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
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:116
OPJ_SIZE_T
size_t OPJ_SIZE_T
Definition: openjpeg.h:139
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
get_mainheader_from_j2kstream
OPJ_BOOL get_mainheader_from_j2kstream(Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD)
get main header information from j2k codestream
Definition: j2kheader_manager.c:52
CODmarker_param
A.6.1 Coding style default (COD)
Definition: index_manager.h:75
OPJ_PCRL
@ OPJ_PCRL
precinct-component-resolution-layer order
Definition: openjpeg.h:308
message_param
message parameters
Definition: msgqueue_manager.h:48
add_SOTmkr
Byte_t * add_SOTmkr(Byte_t *j2kstream, Byte8_t *j2klen)
Definition: jp2k_encoder.c:345
CODmarker_param::numOfdecomp
Byte_t numOfdecomp
number of decompositions levels
Definition: index_manager.h:80
msgqueue_manager.h
comp_seqID
Byte8_t comp_seqID(Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int r, int p)
Definition: jp2k_encoder.c:675
comp_decomplev
int comp_decomplev(int fw, int fh, int Xsiz, int Ysiz)
compute decomposition level (only to get the level use find_level for all parameters
Definition: imgreg_manager.c:134
CODmarker_param::YPsiz
Byte4_t * YPsiz
dynamic array of precinct height at successive resolution level in order
Definition: index_manager.h:82
message_param::next
struct message_param * next
pointer to the next message
Definition: msgqueue_manager.h:59
recons_precinct
Byte_t * recons_precinct(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int *max_reslev, int comp_idx, int res_idx, Byte8_t seqID, Byte8_t *j2klen)
Definition: jp2k_encoder.c:636
OPJ_TRUE
#define OPJ_TRUE
Definition: openjpeg.h:117
recons_packet
Byte_t * recons_packet(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int *max_reslev, int comp_idx, int res_idx, int prct_idx, int lay_idx, Byte8_t *j2klen)
Definition: jp2k_encoder.c:593
opj_malloc
void * opj_malloc(size_t size)
Allocate an uninitialized memory block.
Definition: opj_malloc.c:191
jp2k_encoder.h
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
message_param::res_offset
OPJ_OFF_T res_offset
offset in the resource
Definition: msgqueue_manager.h:57
recons_codestream
Byte_t * recons_codestream(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *codelen)
reconstruct j2k codestream from JPT- (in future, JPP-) stream
Definition: jp2k_encoder.c:149
recons_jp2
Byte_t * recons_jp2(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *jp2len)
reconstruct jp2 file codestream from message queue
Definition: jp2k_encoder.c:98
OPJ_RPCL
@ OPJ_RPCL
resolution-precinct-component-layer order
Definition: openjpeg.h:307
gene_msgstream
Byte_t * gene_msgstream(message_param_t *message, Byte_t *stream, Byte8_t *length)
Definition: jp2k_encoder.c:864
get_tile_XSiz
Byte4_t get_tile_XSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level)
get tile wdith at the decomposition level
Definition: index_manager.c:757
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_LRCPbitstream
Byte_t * recons_LRCPbitstream(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen)
Definition: jp2k_encoder.c:426
message_param::csn
Byte8_t csn
index of the codestream
Definition: msgqueue_manager.h:53
SIZmarker_param
progression order
Definition: index_manager.h:55
big8
Byte8_t big8(Byte_t *buf)
convert 8-byte big endian Byte codes to number
Definition: byte_manager.c:153
add_msgstream
Byte_t * add_msgstream(message_param_t *message, Byte_t *origstream, Byte_t *j2kstream, Byte8_t *j2klen)
Definition: jp2k_encoder.c:741
recons_RPCLbitstream
Byte_t * recons_RPCLbitstream(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen)
Definition: jp2k_encoder.c:481
SIZmarker_param::Csiz
Byte2_t Csiz
number of the components in the image
Definition: index_manager.h:68
MAINHEADER_MSG
#define MAINHEADER_MSG
Definition: msgqueue_manager.h:44
byte_manager.h
modify_mainheader
OPJ_BOOL modify_mainheader(Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen)
modify main header in j2k codestream to fit with the new number of decompositions
Definition: j2kheader_manager.c:161
message_param::class_id
Byte8_t class_id
class identifiers
Definition: msgqueue_manager.h:52
msgqueue_param
message queue parameters
Definition: msgqueue_manager.h:63
get_last_tileID
Byte8_t get_last_tileID(msgqueue_param_t *msgqueue, Byte8_t csn, OPJ_BOOL isJPPstream)
Definition: jp2k_encoder.c:692
Byte2_t
uint16_t Byte2_t
Definition: byte_manager.h:38
opj_inttypes.h
recons_bitstream
Byte_t * recons_bitstream(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen)
Definition: jp2k_encoder.c:389
message_param::phld
placeholder_param_t * phld
placeholder pointer in index
Definition: msgqueue_manager.h:58
recons_RLCPbitstream
Byte_t * recons_RLCPbitstream(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen)
Definition: jp2k_encoder.c:451
OPJ_FALSE
#define OPJ_FALSE
Definition: openjpeg.h:118
recons_j2k
Byte_t * recons_j2k(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen)
reconstruct j2k codestream from message queue
Definition: jp2k_encoder.c:79
add_mainhead_msgstream
Byte_t * add_mainhead_msgstream(msgqueue_param_t *msgqueue, Byte_t *origstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t *j2klen)
Definition: jp2k_encoder.c:325
recons_codestream_from_JPPstream
Byte_t * recons_codestream_from_JPPstream(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen)
Definition: jp2k_encoder.c:257
get_tile_YSiz
Byte4_t get_tile_YSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level)
Definition: index_manager.c:765
add_emptytilestream
Byte_t * add_emptytilestream(const Byte8_t tileID, Byte_t *j2kstream, Byte8_t *j2klen)
Definition: jp2k_encoder.c:802
OPJ_LRCP
@ OPJ_LRCP
layer-resolution-component-precinct order
Definition: openjpeg.h:305
isJPPstream
OPJ_BOOL isJPPstream(Byte8_t csn, msgqueue_param_t *msgqueue)
Definition: jp2k_encoder.c:161
recons_PCRLbitstream
Byte_t * recons_PCRLbitstream(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t tileID, SIZmarker_param_t SIZ, CODmarker_param_t COD, int mindeclev, int *max_reslev, Byte8_t *j2klen)
Definition: jp2k_encoder.c:507
recons_j2kmainhead
Byte_t * recons_j2kmainhead(msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, Byte8_t *j2klen)
reconstruct j2k codestream of mainheader from message queue
Definition: jp2k_encoder.c:906
Byte8_t
uint64_t Byte8_t
Definition: byte_manager.h:40
TILE_HEADER_MSG
#define TILE_HEADER_MSG
Definition: msgqueue_manager.h:41
search_message
message_param_t * search_message(Byte8_t class_id, Byte8_t in_class_id, Byte8_t csn, message_param_t *msg)
search a message by class_id
Definition: jp2k_encoder.c:717
placeholder_param::OrigBH
Byte_t * OrigBH
dynamic memory pointer
Definition: placeholder_manager.h:44
msgqueue_param::first
message_param_t * first
first message pointer of the list
Definition: msgqueue_manager.h:64
add_emptyboxstream
Byte_t * add_emptyboxstream(placeholder_param_t *phld, Byte_t *jp2stream, Byte8_t *jp2len)
Definition: jp2k_encoder.c:770