2011-04-14 20:37:47 +02:00
|
|
|
/*
|
2012-10-01 10:43:02 +02:00
|
|
|
* $Id$
|
2011-04-14 20:37:47 +02:00
|
|
|
*
|
2014-04-03 17:30:57 +02:00
|
|
|
* Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
|
|
|
|
* Copyright (c) 2002-2014, Professor Benoit Macq
|
2011-04-14 20:37:47 +02:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2017-05-15 12:21:30 +02:00
|
|
|
#ifndef INDEX_MANAGER_H_
|
|
|
|
# define INDEX_MANAGER_H_
|
2011-04-14 20:37:47 +02:00
|
|
|
|
2012-10-08 17:59:17 +02:00
|
|
|
#include "opj_config.h"
|
|
|
|
#include "opj_includes.h"
|
|
|
|
|
2011-04-14 20:37:47 +02:00
|
|
|
#include "byte_manager.h"
|
|
|
|
#include "faixbox_manager.h"
|
|
|
|
#include "metadata_manager.h"
|
2011-09-30 17:31:06 +02:00
|
|
|
#include "mhixbox_manager.h"
|
2011-04-14 20:37:47 +02:00
|
|
|
|
2012-03-02 12:09:16 +01:00
|
|
|
/** progression order */
|
2012-10-08 17:59:17 +02:00
|
|
|
#if 0
|
2011-09-30 17:31:06 +02:00
|
|
|
typedef enum porder {
|
2017-05-15 12:21:30 +02:00
|
|
|
PROG_UNKNOWN = -1, /**< place-holder */
|
|
|
|
LRCP = 0, /**< layer-resolution-component-precinct order */
|
|
|
|
RLCP = 1, /**< resolution-layer-component-precinct order */
|
|
|
|
RPCL = 2, /**< resolution-precinct-component-layer order */
|
|
|
|
PCRL = 3, /**< precinct-component-resolution-layer order */
|
|
|
|
CPRL = 4 /**< component-precinct-resolution-layer order */
|
2011-09-30 17:31:06 +02:00
|
|
|
} porder_t;
|
2012-10-08 17:59:17 +02:00
|
|
|
#endif
|
2011-09-30 17:31:06 +02:00
|
|
|
|
2012-03-02 12:09:16 +01:00
|
|
|
/** A.5.1 Image and tile size (SIZ)*/
|
2017-05-15 12:21:30 +02:00
|
|
|
typedef struct SIZmarker_param {
|
|
|
|
Byte2_t Lsiz; /**< length of marker segment excluding the marker*/
|
|
|
|
Byte2_t Rsiz; /**< capabilities that a decoder needs*/
|
|
|
|
Byte4_t Xsiz; /**< width of the reference grid*/
|
|
|
|
Byte4_t Ysiz; /**< height of the reference grid*/
|
|
|
|
Byte4_t XOsiz; /**< horizontal offset from the origin of the reference grid to the left side of the image area*/
|
|
|
|
Byte4_t YOsiz; /**< vertical offset from the origin of the reference grid to the top side of the image area*/
|
|
|
|
Byte4_t XTsiz; /**< width of one reference tile with respect to the reference grid*/
|
|
|
|
Byte4_t YTsiz; /**< height of one reference tile with respect to the reference grid*/
|
|
|
|
Byte4_t XTOsiz; /**< horizontal offset from the origin of the reference grid to the left side of the first tile*/
|
|
|
|
Byte4_t YTOsiz; /**< vertical offset from the origin of the reference grid to the top side of the first tile*/
|
|
|
|
Byte4_t XTnum; /**< number of tiles in horizontal direction*/
|
|
|
|
Byte4_t YTnum; /**< number of tiles in vertical direction*/
|
|
|
|
Byte2_t Csiz; /**< number of the components in the image*/
|
|
|
|
Byte_t Ssiz[3]; /**< precision (depth) in bits and sign of the component samples*/
|
|
|
|
Byte_t XRsiz[3]; /**< horizontal separation of a sample of component with respect to the reference grid*/
|
|
|
|
Byte_t YRsiz[3]; /**< vertical separation of a sample of component with respect to the reference grid*/
|
2011-09-30 17:31:06 +02:00
|
|
|
} SIZmarker_param_t;
|
2011-04-14 20:37:47 +02:00
|
|
|
|
2012-03-02 12:09:16 +01:00
|
|
|
/** A.6.1 Coding style default (COD)*/
|
2017-05-15 12:21:30 +02:00
|
|
|
typedef struct CODmarker_param {
|
|
|
|
Byte2_t Lcod; /**< length of marker segment excluding the marker*/
|
|
|
|
Byte_t Scod; /**< Coding style for all components*/
|
|
|
|
OPJ_PROG_ORDER prog_order; /**< progression order*/
|
|
|
|
Byte2_t numOflayers; /**< number of layers*/
|
|
|
|
Byte_t numOfdecomp; /**< number of decompositions levels*/
|
|
|
|
Byte4_t *XPsiz; /**< dynamic array of precinct width at successive resolution level in order*/
|
|
|
|
Byte4_t *YPsiz; /**< dynamic array of precinct height at successive resolution level in order*/
|
2011-09-30 17:31:06 +02:00
|
|
|
} CODmarker_param_t;
|
|
|
|
|
2012-03-02 12:09:16 +01:00
|
|
|
/** index parameters*/
|
2017-05-15 12:21:30 +02:00
|
|
|
typedef struct index_param {
|
|
|
|
metadatalist_param_t *metadatalist; /**< metadata-bin list*/
|
|
|
|
OPJ_OFF_T offset; /**< codestream offset*/
|
|
|
|
Byte8_t length; /**< codestream length */
|
|
|
|
Byte8_t mhead_length; /**< main header length */
|
|
|
|
SIZmarker_param_t SIZ; /**< SIZ marker information*/
|
|
|
|
CODmarker_param_t COD; /**< COD marker information*/
|
|
|
|
faixbox_param_t *tilepart; /**< tile part information from tpix box*/
|
|
|
|
mhixbox_param_t
|
|
|
|
**tileheader; /**< dynamic array of tile header information from thix box*/
|
|
|
|
faixbox_param_t
|
|
|
|
**precpacket; /**< dynamic array of precint packet information from ppix box*/
|
2011-04-14 20:37:47 +02:00
|
|
|
} index_param_t;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* parse JP2 file
|
|
|
|
* AnnexI: Indexing JPEG2000 files for JPIP
|
|
|
|
*
|
|
|
|
* @param[in] fd file descriptor of the JP2 file
|
|
|
|
* @return pointer to the generated structure of index parameters
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
index_param_t * parse_jp2file(int fd);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* print index parameters
|
|
|
|
*
|
|
|
|
* @param[in] index index parameters
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void print_index(index_param_t index);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
2011-09-30 17:31:06 +02:00
|
|
|
/**
|
|
|
|
* print Image and Tile SIZ parameters
|
|
|
|
*
|
|
|
|
* @param[in] SIZ SIZ marker information
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void print_SIZ(SIZmarker_param_t SIZ);
|
2011-09-30 17:31:06 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* print Coding style default COD parameters
|
|
|
|
*
|
|
|
|
* @param[in] COD COD marker information
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void print_COD(CODmarker_param_t COD);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* delete index
|
|
|
|
*
|
|
|
|
* @param[in,out] index addressof the index pointer
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void delete_index(index_param_t **index);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
2012-03-02 12:09:16 +01:00
|
|
|
/**
|
|
|
|
* delete dynamic arrays in COD marker
|
|
|
|
*
|
|
|
|
* @param[in] COD COD marker information
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
void delete_COD(CODmarker_param_t COD);
|
2012-03-02 12:09:16 +01:00
|
|
|
|
|
|
|
|
|
|
|
/** 1-dimensional range parameters*/
|
2017-05-15 12:21:30 +02:00
|
|
|
typedef struct range_param {
|
|
|
|
Byte4_t minvalue; /**< minimal value*/
|
|
|
|
Byte4_t maxvalue; /**< maximal value*/
|
2011-04-14 20:37:47 +02:00
|
|
|
} range_param_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* get horizontal range of the tile in reference grid
|
|
|
|
*
|
2011-09-30 17:31:06 +02:00
|
|
|
* @param[in] SIZ SIZ marker information
|
|
|
|
* @param[in] tile_id tile id
|
2011-04-14 20:37:47 +02:00
|
|
|
* @param[in] level decomposition level
|
|
|
|
* @return structured range parameter
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
range_param_t get_tile_Xrange(SIZmarker_param_t SIZ, Byte4_t tile_id,
|
|
|
|
int level);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* get vertical range of the tile in reference grid
|
|
|
|
*
|
2011-09-30 17:31:06 +02:00
|
|
|
* @param[in] SIZ SIZ marker information
|
|
|
|
* @param[in] tile_id tile id
|
2011-04-14 20:37:47 +02:00
|
|
|
* @param[in] level decomposition level
|
|
|
|
* @return structured range parameter
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
range_param_t get_tile_Yrange(SIZmarker_param_t SIZ, Byte4_t tile_id,
|
|
|
|
int level);
|
2011-09-30 17:31:06 +02:00
|
|
|
|
2011-04-14 20:37:47 +02:00
|
|
|
|
2011-09-30 17:31:06 +02:00
|
|
|
/**
|
|
|
|
* get tile wdith at the decomposition level
|
|
|
|
*
|
|
|
|
* @param[in] SIZ SIZ marker information
|
|
|
|
* @param[in] tile_id tile id
|
|
|
|
* @param[in] level decomposition level
|
|
|
|
* @return tile width
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
Byte4_t get_tile_XSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
|
|
|
|
Byte4_t get_tile_YSiz(SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
|
2011-04-14 20:37:47 +02:00
|
|
|
|
2011-10-10 15:15:18 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* answers if the target is feasible to JPT-stream
|
|
|
|
*
|
|
|
|
* @param[in] index index parameters
|
|
|
|
* @return true if JPT-stream is feasible
|
|
|
|
*/
|
2017-05-15 12:21:30 +02:00
|
|
|
OPJ_BOOL isJPTfeasible(index_param_t index);
|
2011-10-10 15:15:18 +02:00
|
|
|
|
2017-05-15 12:21:30 +02:00
|
|
|
#endif /* !INDEX_MANAGER_H_ */
|