OpenJPEG  2.5.0
index_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  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  * notice, this list of conditions and the following disclaimer in the
16  * documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef INDEX_MANAGER_H_
32 # define INDEX_MANAGER_H_
33 
34 #include "opj_config.h"
35 #include "opj_includes.h"
36 
37 #include "byte_manager.h"
38 #include "faixbox_manager.h"
39 #include "metadata_manager.h"
40 #include "mhixbox_manager.h"
41 
43 #if 0
44 typedef enum porder {
45  PROG_UNKNOWN = -1,
46  LRCP = 0,
47  RLCP = 1,
48  RPCL = 2,
49  PCRL = 3,
50  CPRL = 4
51 } porder_t;
52 #endif
53 
55 typedef struct SIZmarker_param {
69  Byte_t Ssiz[3];
73 
75 typedef struct CODmarker_param {
84 
86 typedef struct index_param {
99 
100 
108 index_param_t * parse_jp2file(int fd);
109 
115 void print_index(index_param_t index);
116 
122 void print_SIZ(SIZmarker_param_t SIZ);
123 
129 void print_COD(CODmarker_param_t COD);
130 
136 void delete_index(index_param_t **index);
137 
143 void delete_COD(CODmarker_param_t COD);
144 
145 
147 typedef struct range_param {
150 } range_param_t;
151 
161  int level);
162 
172  int level);
173 
174 
183 Byte4_t get_tile_XSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
184 Byte4_t get_tile_YSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
185 
186 
194 
195 #endif /* !INDEX_MANAGER_H_ */
get_filesize
OPJ_OFF_T get_filesize(int fd)
Get file size.
Definition: byte_manager.c:167
print_COD
void print_COD(CODmarker_param_t COD)
print Coding style default COD parameters
Definition: index_manager.c:175
get_tile_range
range_param_t get_tile_range(Byte4_t Osiz, Byte4_t siz, Byte4_t TOsiz, Byte4_t Tsiz, Byte4_t tile_XYid, int level)
Definition: index_manager.c:741
boxheader_param::headlen
Byte_t headlen
header length 8 or 16
Definition: boxheader_manager.h:40
get_tile_Yrange
range_param_t get_tile_Yrange(SIZmarker_param_t SIZ, Byte4_t tile_id, int level)
get vertical range of the tile in reference grid
Definition: index_manager.c:735
boxheader_param::next
struct boxheader_param * next
pointer to the next header box
Definition: boxheader_manager.h:43
OPJ_PROG_ORDER
enum PROG_ORDER OPJ_PROG_ORDER
Progression order.
print_index
void print_index(index_param_t index)
print index parameters
Definition: index_manager.c:122
fetch_marker1byte
Byte_t fetch_marker1byte(marker_param_t marker, OPJ_OFF_T offset)
fetch marker content 1-bytes of data in file stream
Definition: marker_manager.c:56
gene_boxbyType
box_param_t * gene_boxbyType(int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
generate(search) box from JP2 file
Definition: box_manager.c:173
boxheader_param
box header parameters
Definition: boxheader_manager.h:39
set_tpixdata
OPJ_BOOL set_tpixdata(box_param_t *cidx_box, index_param_t *jp2idx)
set code index parameters from tpix box I.3.2.4.4 Tile-part Index Table box
Definition: index_manager.c:491
SIZmarker_param::Lsiz
Byte2_t Lsiz
length of marker segment excluding the marker
Definition: index_manager.h:56
CODmarker_param::numOflayers
Byte2_t numOflayers
number of layers
Definition: index_manager.h:79
range_param::minvalue
Byte4_t minvalue
minimal value
Definition: index_manager.h:148
CODmarker_param::Lcod
Byte2_t Lcod
length of marker segment excluding the marker
Definition: index_manager.h:76
get_tile_YSiz
Byte4_t get_tile_YSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level)
Definition: index_manager.c:765
SIZmarker_param::XTsiz
Byte4_t XTsiz
width of one reference tile with respect to the reference grid
Definition: index_manager.h:62
CODmarker_param::Scod
Byte_t Scod
Coding style for all components.
Definition: index_manager.h:77
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
delete_COD
void delete_COD(CODmarker_param_t COD)
delete dynamic arrays in COD marker
Definition: index_manager.c:215
set_thixdata
OPJ_BOOL set_thixdata(box_param_t *cidx_box, index_param_t *jp2idx)
set code index parameters from thix box I.3.2.4.5 Tile Header Index Table box
Definition: index_manager.c:517
CODmarker_param::XPsiz
Byte4_t * XPsiz
dynamic array of precinct width at successive resolution level in order
Definition: index_manager.h:81
get_tile_Xrange
range_param_t get_tile_Xrange(SIZmarker_param_t SIZ, Byte4_t tile_id, int level)
get horizontal range of the tile in reference grid
Definition: index_manager.c:729
print_mhixbox
void print_mhixbox(mhixbox_param_t *mhix)
print mhix box parameters
Definition: mhixbox_manager.c:98
manfbox_manager.h
metadata_manager.h
gene_mhixbox
mhixbox_param_t * gene_mhixbox(box_param_t *box)
generate mhix box
Definition: mhixbox_manager.c:47
Byte_t
uint8_t Byte_t
Definition: byte_manager.h:37
set_mainmhixdata
OPJ_BOOL set_mainmhixdata(box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx)
set code index parameters from mhix box for main header I.3.2.4.3 Header Index Table box
Definition: index_manager.c:462
mhixbox_manager.h
search_boxheader
boxheader_param_t * search_boxheader(const char type[], manfbox_param_t *manf)
search a boxheader by box type from manifest box
Definition: manfbox_manager.c:100
fetch_marker4bytebigendian
Byte4_t fetch_marker4bytebigendian(marker_param_t marker, OPJ_OFF_T offset)
fetch marker content 4-byte big endian Byte codes in file stream
Definition: marker_manager.c:66
index_param::offset
OPJ_OFF_T offset
codestream offset
Definition: index_manager.h:88
fetch_DBox2bytebigendian
Byte2_t fetch_DBox2bytebigendian(box_param_t *box, OPJ_OFF_T offset)
fetch DBox (Box Contents) 2-byte big endian Byte codes in file stream
Definition: box_manager.c:331
OPJ_OFF_T
int64_t OPJ_OFF_T
Definition: openjpeg.h:136
SIZmarker_param::Xsiz
Byte4_t Xsiz
width of the reference grid
Definition: index_manager.h:58
box_param
box parameters
Definition: box_manager.h:37
CODmarker_param::prog_order
OPJ_PROG_ORDER prog_order
progression order
Definition: index_manager.h:78
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
get_tile_Yrange
range_param_t get_tile_Yrange(SIZmarker_param_t SIZ, Byte4_t tile_id, int level)
get vertical range of the tile in reference grid
Definition: index_manager.c:735
SIZmarker_param::Ysiz
Byte4_t Ysiz
height of the reference grid
Definition: index_manager.h:59
set_cptrdata
OPJ_BOOL set_cptrdata(box_param_t *cidx_box, index_param_t *jp2idx)
set code index parameters from cptr box I.3.2.2 Codestream Finder box
Definition: index_manager.c:400
index_param::tilepart
faixbox_param_t * tilepart
tile part information from tpix box
Definition: index_manager.h:93
SIZmarker_param::XOsiz
Byte4_t XOsiz
horizontal offset from the origin of the reference grid to the left side of the image area
Definition: index_manager.h:60
delete_boxlist
void delete_boxlist(boxlist_param_t **boxlist)
delete box list
Definition: box_manager.c:423
delete_index
void delete_index(index_param_t **index)
delete index
Definition: index_manager.c:192
get_boxstructure
boxlist_param_t * get_boxstructure(int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
get box structure of JP2 file
Definition: box_manager.c:60
SIZmarker_param::YRsiz
Byte_t YRsiz[3]
vertical separation of a sample of component with respect to the reference grid
Definition: index_manager.h:71
SIZmarker_param::Ssiz
Byte_t Ssiz[3]
precision (depth) in bits and sign of the component samples
Definition: index_manager.h:69
markeridx_param::length
Byte2_t length
codestream ( including the length
Definition: mhixbox_manager.h:44
manfbox_param
manifest box parameters
Definition: manfbox_manager.h:41
metadatalist_param
metadata-bin list parameters
Definition: metadata_manager.h:54
fetch_DBox1byte
Byte_t fetch_DBox1byte(box_param_t *box, OPJ_OFF_T offset)
fetch DBox (Box Contents) 1-byte Byte codes in file stream
Definition: box_manager.c:326
range_param_t
struct range_param range_param_t
1-dimensional range parameters
set_codestream
codestream_param_t set_codestream(int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
set codestream parameters from inputs
Definition: codestream_manager.c:44
isJPTfeasible
OPJ_BOOL isJPTfeasible(index_param_t index)
answers if the target is feasible to JPT-stream
Definition: index_manager.c:792
parse_jp2file
index_param_t * parse_jp2file(int fd)
parse JP2 file AnnexI: Indexing JPEG2000 files for JPIP
Definition: index_manager.c:73
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
SIZmarker_param::YOsiz
Byte4_t YOsiz
vertical offset from the origin of the reference grid to the top side of the image area
Definition: index_manager.h:61
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
SIZmarker_param::XRsiz
Byte_t XRsiz[3]
horizontal separation of a sample of component with respect to the reference grid
Definition: index_manager.h:70
index_param::COD
CODmarker_param_t COD
COD marker information.
Definition: index_manager.h:92
opj_includes.h
codestream_param
codestream parameters
Definition: codestream_manager.h:37
CODmarker_param
A.6.1 Coding style default (COD)
Definition: index_manager.h:75
print_index
void print_index(index_param_t index)
print index parameters
Definition: index_manager.c:122
SIZmarker_param_t
struct SIZmarker_param SIZmarker_param_t
progression order
print_SIZ
void print_SIZ(SIZmarker_param_t SIZ)
print Image and Tile SIZ parameters
Definition: index_manager.c:151
CODmarker_param::numOfdecomp
Byte_t numOfdecomp
number of decompositions levels
Definition: index_manager.h:80
SIZmarker_param::YTsiz
Byte4_t YTsiz
height of one reference tile with respect to the reference grid
Definition: index_manager.h:63
set_ppixdata
OPJ_BOOL set_ppixdata(box_param_t *cidx_box, index_param_t *jp2idx)
set code index parameters from ppix box I.3.2.4.6 Precinct Packet Index Table box
Definition: index_manager.c:573
codestream_manager.h
logstream
#define logstream
Definition: index_manager.c:52
max
Byte4_t max(Byte4_t n1, Byte4_t n2)
Definition: index_manager.c:774
CODmarker_param::YPsiz
Byte4_t * YPsiz
dynamic array of precinct height at successive resolution level in order
Definition: index_manager.h:82
delete_index
void delete_index(index_param_t **index)
delete index
Definition: index_manager.c:192
FCGI_stderr
#define FCGI_stderr
Definition: index_manager.c:51
delete_COD
void delete_COD(CODmarker_param_t COD)
delete dynamic arrays in COD marker
Definition: index_manager.c:215
set_cidxdata
OPJ_BOOL set_cidxdata(box_param_t *cidx_box, index_param_t *codeidx)
set code index parameters (parse cidx box) Annex I
Definition: index_manager.c:348
delete_faixbox
void delete_faixbox(faixbox_param_t **faix)
delete faix box
Definition: faixbox_manager.c:145
get_tile_Xrange
range_param_t get_tile_Xrange(SIZmarker_param_t SIZ, Byte4_t tile_id, int level)
get horizontal range of the tile in reference grid
Definition: index_manager.c:729
OPJ_TRUE
#define OPJ_TRUE
Definition: openjpeg.h:117
set_SIZmkrdata
OPJ_BOOL set_SIZmkrdata(markeridx_param_t *sizmkidx, codestream_param_t codestream, SIZmarker_param_t *SIZ)
set SIZ marker information A.5 Fixed information marker segment A.5.1 Image and tile size (SIZ)
Definition: index_manager.c:633
opj_malloc
void * opj_malloc(size_t size)
Allocate an uninitialized memory block.
Definition: opj_malloc.c:191
marker_param
Marker parameters.
Definition: marker_manager.h:38
set_marker
marker_param_t set_marker(codestream_param_t cs, Byte2_t code, OPJ_OFF_T offset, Byte2_t length)
set marker parameters from inputs
Definition: marker_manager.c:42
get_DBoxlen
OPJ_SIZE_T get_DBoxlen(box_param_t *box)
get DBox length
Definition: box_manager.c:311
index_param::tileheader
mhixbox_param_t ** tileheader
dynamic array of tile header information from thix box
Definition: index_manager.h:95
Byte4_t
uint32_t Byte4_t
Definition: byte_manager.h:39
print_COD
void print_COD(CODmarker_param_t COD)
print Coding style default COD parameters
Definition: index_manager.c:175
opj_free
void opj_free(void *ptr)
Deallocates or frees a memory block.
Definition: opj_malloc.c:246
delete_metadatalist
void delete_metadatalist(metadatalist_param_t **list)
delete metadata list
Definition: metadata_manager.c:114
CODmarker_param_t
struct CODmarker_param CODmarker_param_t
A.6.1 Coding style default (COD)
marker_manager.h
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
box_param::length
Byte8_t length
length of the whole Box
Definition: box_manager.h:41
delete_manfbox
void delete_manfbox(manfbox_param_t **manf)
delete manifest box
Definition: manfbox_manager.c:73
gene_faixbox
faixbox_param_t * gene_faixbox(box_param_t *box)
generate faix box
Definition: faixbox_manager.c:45
min
Byte4_t min(Byte4_t n1, Byte4_t n2)
Definition: index_manager.c:783
print_allmetadata
void print_allmetadata(metadatalist_param_t *list)
print all metadata parameters
Definition: metadata_manager.c:182
set_CODmkrdata
OPJ_BOOL set_CODmkrdata(markeridx_param_t *codmkidx, codestream_param_t codestream, CODmarker_param_t *COD)
set code index parameters from COD marker in codestream A.6 Functional marker segments A....
Definition: index_manager.c:672
range_param::maxvalue
Byte4_t maxvalue
maximal value
Definition: index_manager.h:149
print_SIZ
void print_SIZ(SIZmarker_param_t SIZ)
print Image and Tile SIZ parameters
Definition: index_manager.c:151
markeridx_param::offset
OPJ_OFF_T offset
offset relative to the start of the
Definition: mhixbox_manager.h:41
index_param::SIZ
SIZmarker_param_t SIZ
SIZ marker information.
Definition: index_manager.h:91
SIZmarker_param
progression order
Definition: index_manager.h:55
gene_childboxheader
boxheader_param_t * gene_childboxheader(box_param_t *superbox, OPJ_OFF_T offset)
generate a child box header at the given offset
Definition: boxheader_manager.c:74
SIZmarker_param::Csiz
Byte2_t Csiz
number of the components in the image
Definition: index_manager.h:68
index_param::metadatalist
metadatalist_param_t * metadatalist
metadata-bin list
Definition: index_manager.h:87
byte_manager.h
SIZmarker_param::XTOsiz
Byte4_t XTOsiz
horizontal offset from the origin of the reference grid to the left side of the first tile
Definition: index_manager.h:64
fetch_marker2bytebigendian
Byte2_t fetch_marker2bytebigendian(marker_param_t marker, OPJ_OFF_T offset)
fetch marker content 2-byte big endian Byte codes in file stream
Definition: marker_manager.c:61
range_param
1-dimensional range parameters
Definition: index_manager.h:147
isJPTfeasible
OPJ_BOOL isJPTfeasible(index_param_t index)
answers if the target is feasible to JPT-stream
Definition: index_manager.c:792
parse_jp2file
index_param_t * parse_jp2file(int fd)
parse JP2 file AnnexI: Indexing JPEG2000 files for JPIP
Definition: index_manager.c:73
delete_mhixbox
void delete_mhixbox(mhixbox_param_t **mhix)
delete mhix box
Definition: mhixbox_manager.c:128
markeridx_param::code
Byte2_t code
marker code
Definition: mhixbox_manager.h:39
check_JP2boxidx
OPJ_BOOL check_JP2boxidx(boxlist_param_t *toplev_boxlist)
check JP2 box indexing
Definition: index_manager.c:225
Byte2_t
uint16_t Byte2_t
Definition: byte_manager.h:38
boxlist_param
Box list parameters.
Definition: box_manager.h:48
fetch_DBox8bytebigendian
Byte8_t fetch_DBox8bytebigendian(box_param_t *box, OPJ_OFF_T offset)
fetch DBox (Box Contents) 8-byte big endian Byte codes in file stream
Definition: box_manager.c:341
mhixbox_param
header index table box parameters
Definition: mhixbox_manager.h:52
index_param::precpacket
faixbox_param_t ** precpacket
dynamic array of precint packet information from ppix box
Definition: index_manager.h:97
manfbox_param::first
boxheader_param_t * first
top of the box header list
Definition: manfbox_manager.h:42
opj_inttypes.h
OPJ_FALSE
#define OPJ_FALSE
Definition: openjpeg.h:118
search_box
box_param_t * search_box(const char type[], boxlist_param_t *boxlist)
search a box by box type
Definition: box_manager.c:346
get_tile_YSiz
Byte4_t get_tile_YSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level)
Definition: index_manager.c:765
index_param_t
struct index_param index_param_t
index parameters
index_param::length
Byte8_t length
codestream length
Definition: index_manager.h:89
index_manager.h
gene_manfbox
manfbox_param_t * gene_manfbox(box_param_t *box)
generate manifest box
Definition: manfbox_manager.c:45
box_manager.h
box_param::fd
int fd
file descriptor
Definition: box_manager.h:38
get_DBoxoff
OPJ_OFF_T get_DBoxoff(box_param_t *box)
get DBox offset
Definition: box_manager.c:306
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
const_metadatalist
metadatalist_param_t * const_metadatalist(int fd)
construct metadata-bin list of JP2 file
Definition: metadata_manager.c:61
boxheader_param::length
Byte8_t length
length of the reference Box
Definition: boxheader_manager.h:41
boxheader_manager.h
faixbox_manager.h
markeridx_param
Marker index parameters.
Definition: mhixbox_manager.h:38
boxheader_param::type
char type[4]
type of information in the DBox
Definition: boxheader_manager.h:42
gene_childboxbyType
box_param_t * gene_childboxbyType(box_param_t *superbox, OPJ_OFF_T offset, const char TBox[])
generate(search) box from JP2 file
Definition: box_manager.c:293
SIZmarker_param::Rsiz
Byte2_t Rsiz
capabilities that a decoder needs
Definition: index_manager.h:57
SIZmarker_param::YTOsiz
Byte4_t YTOsiz
vertical offset from the origin of the reference grid to the top side of the first tile
Definition: index_manager.h:65
search_markeridx
markeridx_param_t * search_markeridx(Byte2_t code, mhixbox_param_t *mhix)
search a marker index by marker code from mhix box
Definition: mhixbox_manager.c:78
print_faixbox
void print_faixbox(faixbox_param_t *faix)
print faix box parameters
Definition: faixbox_manager.c:120
gene_boxbyOffset
box_param_t * gene_boxbyOffset(int fd, OPJ_OFF_T offset)
generate box from JP2 file at the given offset
Definition: box_manager.c:86