OpenJPEG
2.2.0
|
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "opj_inttypes.h"
#include "index_manager.h"
#include "box_manager.h"
#include "manfbox_manager.h"
#include "mhixbox_manager.h"
#include "codestream_manager.h"
#include "marker_manager.h"
#include "faixbox_manager.h"
#include "boxheader_manager.h"
Macros | |
#define | FCGI_stdout stdout |
#define | FCGI_stderr stderr |
#define | logstream stderr |
Functions | |
OPJ_BOOL | check_JP2boxidx (boxlist_param_t *toplev_boxlist) |
chekc JP2 box indexing More... | |
OPJ_BOOL | set_cidxdata (box_param_t *cidx_box, index_param_t *codeidx) |
set code index parameters (parse cidx box) Annex I More... | |
index_param_t * | parse_jp2file (int fd) |
parse JP2 file AnnexI: Indexing JPEG2000 files for JPIP More... | |
void | print_index (index_param_t index) |
print index parameters More... | |
void | print_SIZ (SIZmarker_param_t SIZ) |
print Image and Tile SIZ parameters More... | |
void | print_COD (CODmarker_param_t COD) |
print Coding style default COD parameters More... | |
void | delete_index (index_param_t **index) |
delete index More... | |
void | delete_COD (CODmarker_param_t COD) |
delete dynamic arrays in COD marker More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
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) More... | |
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.6.1 Coding style default (COD) More... | |
Byte4_t | max (Byte4_t n1, Byte4_t n2) |
Byte4_t | min (Byte4_t n1, Byte4_t n2) |
range_param_t | get_tile_range (Byte4_t Osiz, Byte4_t siz, Byte4_t TOsiz, Byte4_t Tsiz, Byte4_t tile_XYid, int level) |
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 More... | |
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 More... | |
Byte4_t | get_tile_XSiz (SIZmarker_param_t SIZ, Byte4_t tile_id, int level) |
get tile wdith at the decomposition level More... | |
Byte4_t | get_tile_YSiz (SIZmarker_param_t SIZ, Byte4_t tile_id, int level) |
OPJ_BOOL | isJPTfeasible (index_param_t index) |
answers if the target is feasible to JPT-stream More... | |
#define FCGI_stderr stderr |
Referenced by check_JP2boxidx(), parse_jp2file(), set_cidxdata(), set_CODmkrdata(), set_cptrdata(), set_ppixdata(), set_SIZmkrdata(), set_thixdata(), and set_tpixdata().
#define FCGI_stdout stdout |
#define logstream stderr |
Referenced by parse_jp2file(), print_COD(), print_index(), and print_SIZ().
OPJ_BOOL check_JP2boxidx | ( | boxlist_param_t * | toplev_boxlist | ) |
chekc JP2 box indexing
[in] | toplev_boxlist | top level box list |
References FCGI_stderr, fetch_DBox1byte(), fetch_DBox8bytebigendian(), gene_childboxbyType(), gene_childboxheader(), boxheader_param::headlen, boxheader_param::length, box_param::length, box_param::offset, OPJ_FALSE, opj_free(), OPJ_TRUE, search_box(), and boxheader_param::type.
Referenced by parse_jp2file().
void delete_COD | ( | CODmarker_param_t | COD | ) |
delete dynamic arrays in COD marker
[in] | COD | COD marker information |
References opj_free(), CODmarker_param::XPsiz, and CODmarker_param::YPsiz.
Referenced by delete_index(), and recons_codestream_from_JPPstream().
void delete_index | ( | index_param_t ** | index | ) |
delete index
[in,out] | index | addressof the index pointer |
References delete_COD(), delete_faixbox(), delete_metadatalist(), delete_mhixbox(), and opj_free().
Referenced by delete_target(), and destroy_index().
range_param_t get_tile_range | ( | Byte4_t | Osiz, |
Byte4_t | siz, | ||
Byte4_t | TOsiz, | ||
Byte4_t | Tsiz, | ||
Byte4_t | tile_XYid, | ||
int | level | ||
) |
References max(), range_param::maxvalue, min(), and range_param::minvalue.
Referenced by get_tile_Xrange(), and get_tile_Yrange().
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
[in] | SIZ | SIZ marker information |
[in] | tile_id | tile id |
[in] | level | decomposition level |
References get_tile_range(), SIZmarker_param::XOsiz, SIZmarker_param::Xsiz, SIZmarker_param::XTnum, SIZmarker_param::XTOsiz, and SIZmarker_param::XTsiz.
Referenced by enqueue_imagedata(), and 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
[in] | SIZ | SIZ marker information |
[in] | tile_id | tile id |
[in] | level | decomposition level |
References get_tile_Xrange(), range_param::maxvalue, and range_param::minvalue.
Referenced by comp_numOfprcts(), enqueue_allprecincts(), and enqueue_precincts().
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
[in] | SIZ | SIZ marker information |
[in] | tile_id | tile id |
[in] | level | decomposition level |
References get_tile_range(), SIZmarker_param::XTnum, SIZmarker_param::YOsiz, SIZmarker_param::Ysiz, SIZmarker_param::YTOsiz, and SIZmarker_param::YTsiz.
Referenced by enqueue_imagedata(), and get_tile_YSiz().
Byte4_t get_tile_YSiz | ( | SIZmarker_param_t | SIZ, |
Byte4_t | tile_id, | ||
int | level | ||
) |
References get_tile_Yrange(), range_param::maxvalue, and range_param::minvalue.
Referenced by comp_numOfprcts(), enqueue_allprecincts(), and enqueue_precincts().
OPJ_BOOL isJPTfeasible | ( | index_param_t | index | ) |
answers if the target is feasible to JPT-stream
[in] | index | index parameters |
References get_nmax(), OPJ_FALSE, OPJ_TRUE, and index_param::tilepart.
Referenced by gene_target().
Referenced by get_tile_range(), opj_int_clamp(), opj_jp2_apply_pclr(), opj_t1_encode_cblk(), and opj_tcd_rateallocate().
Referenced by get_tile_range(), opj_int_clamp(), and opj_tcd_rateallocate().
index_param_t* parse_jp2file | ( | int | fd | ) |
parse JP2 file AnnexI: Indexing JPEG2000 files for JPIP
[in] | fd | file descriptor of the JP2 file |
References check_JP2boxidx(), const_metadatalist(), delete_boxlist(), FCGI_stderr, get_boxstructure(), get_filesize(), logstream, index_param::metadatalist, opj_free(), opj_malloc(), search_box(), and set_cidxdata().
Referenced by gene_target(), and get_index_from_JP2file().
void print_COD | ( | CODmarker_param_t | COD | ) |
print Coding style default COD parameters
[in] | COD | COD marker information |
References logstream, CODmarker_param::numOfdecomp, CODmarker_param::numOflayers, CODmarker_param::prog_order, CODmarker_param::Scod, CODmarker_param::XPsiz, and CODmarker_param::YPsiz.
Referenced by print_index().
void print_index | ( | index_param_t | index | ) |
print index parameters
[in] | index | index parameters |
References index_param::COD, SIZmarker_param::Csiz, index_param::length, logstream, index_param::metadatalist, index_param::mhead_length, index_param::offset, index_param::precpacket, print_allmetadata(), print_COD(), print_faixbox(), print_mhixbox(), print_SIZ(), index_param::SIZ, index_param::tileheader, index_param::tilepart, SIZmarker_param::XTnum, and SIZmarker_param::YTnum.
Referenced by output_index().
void print_SIZ | ( | SIZmarker_param_t | SIZ | ) |
print Image and Tile SIZ parameters
[in] | SIZ | SIZ marker information |
References SIZmarker_param::Csiz, logstream, SIZmarker_param::Rsiz, SIZmarker_param::Ssiz, SIZmarker_param::XOsiz, SIZmarker_param::XRsiz, SIZmarker_param::Xsiz, SIZmarker_param::XTnum, SIZmarker_param::XTOsiz, SIZmarker_param::XTsiz, SIZmarker_param::YOsiz, SIZmarker_param::YRsiz, SIZmarker_param::Ysiz, SIZmarker_param::YTnum, SIZmarker_param::YTOsiz, and SIZmarker_param::YTsiz.
Referenced by print_index().
OPJ_BOOL set_cidxdata | ( | box_param_t * | cidx_box, |
index_param_t * | codeidx | ||
) |
set code index parameters (parse cidx box) Annex I
[in] | cidx_box | pointer to the reference cidx_box |
[out] | codeidx | pointer to index parameters |
References delete_manfbox(), FCGI_stderr, box_param::fd, gene_boxbyType(), gene_manfbox(), get_DBoxlen(), get_DBoxoff(), index_param::length, index_param::offset, OPJ_FALSE, opj_free(), OPJ_TRUE, search_boxheader(), set_codestream(), set_cptrdata(), set_mainmhixdata(), set_ppixdata(), set_thixdata(), and set_tpixdata().
Referenced by parse_jp2file().
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.6.1 Coding style default (COD)
[in] | codmkidx | pointer to COD marker index in mhix box |
[in] | codestream | codestream parameters |
[out] | COD | COD marker parameters pointer |
References markeridx_param::code, FCGI_stderr, fetch_marker1byte(), fetch_marker2bytebigendian(), CODmarker_param::Lcod, markeridx_param::length, CODmarker_param::numOfdecomp, CODmarker_param::numOflayers, markeridx_param::offset, OPJ_FALSE, opj_malloc(), OPJ_TRUE, CODmarker_param::prog_order, CODmarker_param::Scod, set_marker(), CODmarker_param::XPsiz, and CODmarker_param::YPsiz.
Referenced by set_mainmhixdata().
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
[in] | cidx_box | pointer to the reference cidx_box |
[out] | jp2idx | pointer to index parameters |
< cptr box
References FCGI_stderr, box_param::fd, fetch_DBox2bytebigendian(), fetch_DBox8bytebigendian(), gene_boxbyType(), get_DBoxlen(), get_DBoxoff(), index_param::length, index_param::offset, OPJ_FALSE, opj_free(), and OPJ_TRUE.
Referenced by set_cidxdata().
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
[in] | cidx_box | pointer to the reference cidx_box |
[in] | codestream | codestream parameters |
[out] | jp2idx | pointer to index parameters |
References index_param::COD, delete_mhixbox(), box_param::fd, fetch_DBox8bytebigendian(), gene_boxbyType(), gene_mhixbox(), get_DBoxlen(), get_DBoxoff(), index_param::mhead_length, OPJ_FALSE, opj_free(), OPJ_TRUE, search_markeridx(), set_CODmkrdata(), set_SIZmkrdata(), and index_param::SIZ.
Referenced by set_cidxdata().
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
[in] | cidx_box | pointer to the reference cidx_box |
[out] | jp2idx | pointer to index parameters |
< manf
< box headers
< faix
References SIZmarker_param::Csiz, delete_manfbox(), FCGI_stderr, box_param::fd, gene_boxbyOffset(), gene_boxbyType(), gene_faixbox(), gene_manfbox(), get_DBoxlen(), get_DBoxoff(), box_param::length, boxheader_param::next, box_param::offset, OPJ_FALSE, opj_free(), opj_malloc(), OPJ_TRUE, index_param::precpacket, search_boxheader(), and index_param::SIZ.
Referenced by set_cidxdata().
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)
[in] | sizmkidx | pointer to SIZ marker index in mhix box |
[in] | codestream | codestream parameters |
[out] | SIZ | SIZ marker parameters pointer |
References markeridx_param::code, SIZmarker_param::Csiz, FCGI_stderr, fetch_marker1byte(), fetch_marker2bytebigendian(), fetch_marker4bytebigendian(), markeridx_param::length, SIZmarker_param::Lsiz, markeridx_param::offset, OPJ_FALSE, OPJ_TRUE, SIZmarker_param::Rsiz, set_marker(), SIZmarker_param::Ssiz, SIZmarker_param::XOsiz, SIZmarker_param::XRsiz, SIZmarker_param::Xsiz, SIZmarker_param::XTnum, SIZmarker_param::XTOsiz, SIZmarker_param::XTsiz, SIZmarker_param::YOsiz, SIZmarker_param::YRsiz, SIZmarker_param::Ysiz, SIZmarker_param::YTnum, SIZmarker_param::YTOsiz, and SIZmarker_param::YTsiz.
Referenced by set_mainmhixdata().
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
[in] | cidx_box | pointer to the reference cidx_box |
[out] | jp2idx | pointer to index parameters |
References delete_manfbox(), FCGI_stderr, box_param::fd, manfbox_param::first, gene_boxbyType(), gene_manfbox(), gene_mhixbox(), get_DBoxlen(), get_DBoxoff(), box_param::length, boxheader_param::next, box_param::offset, OPJ_FALSE, opj_free(), opj_malloc(), OPJ_TRUE, index_param::SIZ, index_param::tileheader, SIZmarker_param::XTnum, and SIZmarker_param::YTnum.
Referenced by set_cidxdata().
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
[in] | cidx_box | pointer to the reference cidx_box |
[out] | jp2idx | pointer to index parameters |
< tpix box
< faix box
References FCGI_stderr, box_param::fd, gene_boxbyType(), gene_faixbox(), get_DBoxlen(), get_DBoxoff(), OPJ_FALSE, opj_free(), OPJ_TRUE, and index_param::tilepart.
Referenced by set_cidxdata().