OpenJPEG 2.1.0

index_manager.h

Go to the documentation of this file.
00001 /*
00002  * $Id: index_manager.h 2835 2014-04-03 15:30:57Z antonin $
00003  *
00004  * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
00005  * Copyright (c) 2002-2014, Professor Benoit Macq
00006  * Copyright (c) 2010-2011, Kaori Hagihara
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions
00011  * are met:
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer.
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in the
00016  *    documentation and/or other materials provided with the distribution.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
00019  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00022  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028  * POSSIBILITY OF SUCH DAMAGE.
00029  */
00030 
00031 #ifndef         INDEX_MANAGER_H_
00032 # define        INDEX_MANAGER_H_
00033 
00034 #include "opj_config.h"
00035 #include "opj_includes.h"
00036 
00037 #include "byte_manager.h"
00038 #include "faixbox_manager.h"
00039 #include "metadata_manager.h"
00040 #include "mhixbox_manager.h"
00041 
00043 #if 0
00044 typedef enum porder {
00045   PROG_UNKNOWN = -1,      
00046   LRCP = 0,               
00047   RLCP = 1,               
00048   RPCL = 2,               
00049   PCRL = 3,               
00050   CPRL = 4                
00051 } porder_t;
00052 #endif
00053 
00055 typedef struct SIZmarker_param{
00056   Byte2_t Lsiz;              
00057   Byte2_t Rsiz;              
00058   Byte4_t Xsiz;              
00059   Byte4_t Ysiz;              
00060   Byte4_t XOsiz;             
00061   Byte4_t YOsiz;             
00062   Byte4_t XTsiz;             
00063   Byte4_t YTsiz;             
00064   Byte4_t XTOsiz;            
00065   Byte4_t YTOsiz;            
00066   Byte4_t XTnum;             
00067   Byte4_t YTnum;             
00068   Byte2_t Csiz;              
00069   Byte_t  Ssiz[3];           
00070   Byte_t  XRsiz[3];          
00071   Byte_t  YRsiz[3];          
00072 } SIZmarker_param_t;
00073 
00075 typedef struct CODmarker_param{
00076   Byte2_t  Lcod;             
00077   Byte_t   Scod;             
00078   OPJ_PROG_ORDER prog_order;       
00079   Byte2_t  numOflayers;      
00080   Byte_t   numOfdecomp;      
00081   Byte4_t  *XPsiz;           
00082   Byte4_t  *YPsiz;           
00083 } CODmarker_param_t;
00084 
00086 typedef struct index_param{
00087   metadatalist_param_t *metadatalist; 
00088   OPJ_OFF_T offset;                     
00089   Byte8_t length;                     
00090   Byte8_t mhead_length;               
00091   SIZmarker_param_t SIZ;              
00092   CODmarker_param_t COD;              
00093   faixbox_param_t *tilepart;          
00094   mhixbox_param_t **tileheader;       
00095   faixbox_param_t **precpacket;       
00096 } index_param_t;
00097 
00098 
00106 index_param_t * parse_jp2file( int fd);
00107 
00113 void print_index( index_param_t index);
00114 
00120 void print_SIZ( SIZmarker_param_t SIZ);
00121 
00127 void print_COD( CODmarker_param_t COD);
00128 
00134 void delete_index( index_param_t **index);
00135 
00141 void delete_COD( CODmarker_param_t COD);
00142 
00143 
00145 typedef struct range_param{
00146   Byte4_t minvalue; 
00147   Byte4_t maxvalue; 
00148 } range_param_t;
00149 
00158 range_param_t get_tile_Xrange( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
00159 
00168 range_param_t get_tile_Yrange( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
00169 
00170 
00179 Byte4_t get_tile_XSiz( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
00180 Byte4_t get_tile_YSiz( SIZmarker_param_t SIZ, Byte4_t tile_id, int level);
00181 
00182 
00189 OPJ_BOOL isJPTfeasible( index_param_t index);
00190 
00191 #endif      /* !INDEX_MANAGER_H_ */