return -1;
}
- dec = init_jpipdecoder( true);
+ dec = init_jpipdecoder( OPJ_TRUE);
if(!( fread_jpip( argv[1], dec)))
return -1;
if(!(fwrite_jp2k( argv[2], dec)))
return -1;
- output_log( true, false, true, dec);
+ output_log( OPJ_TRUE, OPJ_FALSE, OPJ_TRUE, dec);
destroy_jpipdecoder( &dec);
return -1;
}
- dec = init_jpipdecoder( false);
+ dec = init_jpipdecoder( OPJ_FALSE);
if(!( fread_jpip( argv[1], dec)))
return -1;
if(!( fwrite_jp2k( argv[2], dec)))
return -1;
- /* output_log( true, false, false, dec); */
+ /* output_log( OPJ_TRUE, OPJ_FALSE, OPJ_FALSE, dec); */
destroy_jpipdecoder( &dec);
#endif
{
QR_t *qr;
- bool parse_status;
+ opj_bool parse_status;
#ifdef SERVER
query_string = getenv("QUERY_STRING");
parse_status = process_JPIPrequest( server_record, qr);
#ifndef SERVER
- local_log( true, true, parse_status, false, qr, server_record);
+ local_log( OPJ_TRUE, OPJ_TRUE, parse_status, OPJ_FALSE, qr, server_record);
#endif
if( parse_status)
#endif
} aux_response_param_t;
-aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame);
+aux_response_param_t * gene_auxresponse( opj_bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame);
void delete_auxresponse( aux_response_param_t **auxresponse);
void * aux_streaming( void *arg);
#endif
-void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
+void send_responsedata_on_aux( opj_bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
{
aux_response_param_t *auxresponse;
#ifdef _WIN32
fprintf( FCGI_stderr, "Error: error in send_responsedata_on_aux(), udp not implemented\n");
}
-aux_response_param_t * gene_auxresponse( bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
+aux_response_param_t * gene_auxresponse( opj_bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T datalen, OPJ_SIZE_T maxlenPerFrame)
{
aux_response_param_t *auxresponse;
- auxresponse = (aux_response_param_t *)malloc( sizeof(aux_response_param_t));
+ auxresponse = (aux_response_param_t *)opj_malloc( sizeof(aux_response_param_t));
auxresponse->cid = strdup( cid);
auxresponse->data = data;
void delete_auxresponse( aux_response_param_t **auxresponse)
{
- free( (*auxresponse)->cid);
- free( (*auxresponse)->data);
- free( *auxresponse);
+ opj_free( (*auxresponse)->cid);
+ opj_free( (*auxresponse)->data);
+ opj_free( *auxresponse);
}
/**
* @param [in] fp file pointer for log of aux stream
* @return true if identified, false otherwise
*/
-bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp);
+opj_bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp);
-bool recv_ack( SOCKET connected_socket, void *data);
+opj_bool recv_ack( SOCKET connected_socket, void *data);
#ifdef _WIN32
unsigned __stdcall aux_streaming( void *arg)
pthread_detach( pthread_self());
#endif
- chunk = (unsigned char *)malloc( auxresponse->maxlenPerFrame);
+ chunk = (unsigned char *)opj_malloc( auxresponse->maxlenPerFrame);
maxLenOfBody = auxresponse->maxlenPerFrame - headlen;
remlen = auxresponse->datalen;
break;
}
}
- free( chunk);
+ opj_free( chunk);
delete_auxresponse( &auxresponse);
}
-bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp)
+opj_bool identify_cid( SOCKET connected_socket, char refcid[], FILE *fp)
{
char *cid;
- bool succeed;
+ opj_bool succeed;
if(!(cid = receive_string( connected_socket))){
fprintf( fp, "Error: error in identify_cid(), while receiving cid from client\n");
- return false;
+ return OPJ_FALSE;
}
- succeed = false;
+ succeed = OPJ_FALSE;
if( strncmp( refcid, cid, strlen( refcid)) == 0)
- succeed = true;
+ succeed = OPJ_TRUE;
- free( cid);
+ opj_free( cid);
return succeed;
}
-bool recv_ack( SOCKET connected_socket, void *data)
+opj_bool recv_ack( SOCKET connected_socket, void *data)
{
char *header;
- bool succeed;
+ opj_bool succeed;
header = receive_stream( connected_socket, 8);
if( memcmp( header, data, 8) != 0)
- succeed = false;
+ succeed = OPJ_FALSE;
else
- succeed = true;
+ succeed = OPJ_TRUE;
- free( header);
+ opj_free( header);
return succeed;
}
# define AUXTRANS_MANAGER_H_
#include "sock_manager.h"
+#include "opj_includes.h"
/** auxiliary transport setting parameters*/
typedef struct auxtrans_param{
* @param[in] length length of data
* @param[in] maxlenPerFrame maximum data length to send per frame
*/
-void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
+void send_responsedata_on_aux( opj_bool istcp, auxtrans_param_t auxtrans, const char cid[], void *data, OPJ_SIZE_T length, OPJ_SIZE_T maxlenPerFrame);
#endif /* !AUXTRANS_MANAGER_H_ */
+++ /dev/null
-/*
- * $Id$
- *
- * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
- * Copyright (c) 2002-2011, Professor Benoit Macq
- * 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.
- */
-
-#ifndef BOOL_H_
-# define BOOL_H_
-
-#ifndef false
-#define false 0
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef true
-#define true (!false)
-#endif
-
-#ifndef TRUE
-#define TRUE (!FALSE)
-#endif
-
-typedef char bool;
-
-#endif /* !BOOL_H_ */
return cachemodellist;
}
-cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, bool reqJPP)
+cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, opj_bool reqJPP)
{
cachemodel_param_t *cachemodel;
faixbox_param_t *tilepart;
if( reqJPP){
if( target->jppstream)
- cachemodel->jppstream = true;
+ cachemodel->jppstream = OPJ_TRUE;
else
- cachemodel->jppstream = false;
+ cachemodel->jppstream = OPJ_FALSE;
} else{ /* reqJPT */
if( target->jptstream)
- cachemodel->jppstream = false;
+ cachemodel->jppstream = OPJ_FALSE;
else
- cachemodel->jppstream = true;
+ cachemodel->jppstream = OPJ_TRUE;
}
- cachemodel->mhead_model = false;
+ cachemodel->mhead_model = OPJ_FALSE;
tilepart = target->codeidx->tilepart;
numOftiles = get_m( tilepart);
numOfelem = get_nmax( tilepart)*numOftiles;
- cachemodel->tp_model = (bool *)opj_calloc( 1, numOfelem*sizeof(bool));
- cachemodel->th_model = (bool *)opj_calloc( 1, numOftiles*sizeof(bool));
- cachemodel->pp_model = (bool **)opj_malloc( target->codeidx->SIZ.Csiz*sizeof(bool *));
+ cachemodel->tp_model = (opj_bool *)opj_calloc( 1, numOfelem*sizeof(opj_bool));
+ cachemodel->th_model = (opj_bool *)opj_calloc( 1, numOftiles*sizeof(opj_bool));
+ cachemodel->pp_model = (opj_bool **)opj_malloc( target->codeidx->SIZ.Csiz*sizeof(opj_bool *));
for( i=0; i<target->codeidx->SIZ.Csiz; i++){
precpacket = target->codeidx->precpacket[i];
- cachemodel->pp_model[i] = (bool *)opj_calloc( 1, get_nmax(precpacket)*get_m(precpacket)*sizeof(bool));
+ cachemodel->pp_model[i] = (opj_bool *)opj_calloc( 1, get_nmax(precpacket)*get_m(precpacket)*sizeof(opj_bool));
}
cachemodel->next = NULL;
opj_free( *cachemodel);
}
-bool is_allsent( cachemodel_param_t cachemodel)
+opj_bool is_allsent( cachemodel_param_t cachemodel)
{
target_param_t *target;
Byte8_t TPnum; /* num of tile parts in each tile */
target = cachemodel.target;
if( !cachemodel.mhead_model)
- return false;
+ return OPJ_FALSE;
TPnum = get_nmax( target->codeidx->tilepart);
if( cachemodel.jppstream){
for( i=0; i<target->codeidx->SIZ.XTnum*target->codeidx->SIZ.YTnum; i++){
if( !cachemodel.th_model[i])
- return false;
+ return OPJ_FALSE;
for( j=0; j<target->codeidx->SIZ.Csiz; j++){
Pmax = get_nmax( target->codeidx->precpacket[j]);
for( k=0; k<Pmax; k++)
if( !cachemodel.pp_model[j][i*Pmax+k])
- return false;
+ return OPJ_FALSE;
}
}
- return true;
+ return OPJ_TRUE;
}
else{
for( i=0, n=0; i<target->codeidx->SIZ.YTnum; i++)
for( j=0; j<target->codeidx->SIZ.XTnum; j++)
for( k=0; k<TPnum; k++)
if( !cachemodel.tp_model[n++])
- return false;
- return true;
+ return OPJ_FALSE;
+ return OPJ_TRUE;
}
}
#ifndef CACHEMODEL_MANAGER_H_
# define CACHEMODEL_MANAGER_H_
-#include "bool.h"
#include "target_manager.h"
/** Cache model parameters*/
typedef struct cachemodel_param{
target_param_t *target; /**< reference pointer to the target*/
- bool jppstream; /**< return type, true: JPP-stream, false: JPT-stream*/
- bool mhead_model; /**< main header model, if sent, 1, else 0*/
- bool *tp_model; /**< dynamic array pointer of tile part model, if sent, 1, else 0*/
- bool *th_model; /**< dynamic array pointer of tile header model*/
- bool **pp_model; /**< dynamic array pointer of precint packet model*/
+ opj_bool jppstream; /**< return type, true: JPP-stream, false: JPT-stream*/
+ opj_bool mhead_model; /**< main header model, if sent, 1, else 0*/
+ opj_bool *tp_model; /**< dynamic array pointer of tile part model, if sent, 1, else 0*/
+ opj_bool *th_model; /**< dynamic array pointer of tile header model*/
+ opj_bool **pp_model; /**< dynamic array pointer of precint packet model*/
struct cachemodel_param *next; /**< pointer to the next cache model*/
} cachemodel_param_t;
* @param[in] reqJPP if JPP-stream is desired true, JPT-stream false
* @return pointer to the generated cache model
*/
-cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, bool reqJPP);
+cachemodel_param_t * gene_cachemodel( cachemodellist_param_t *cachemodellist, target_param_t *target, opj_bool reqJPP);
/**
* @param[in] cachemodel cache model
* @return true if sent all, false otherwise
*/
-bool is_allsent( cachemodel_param_t cachemodel);
+opj_bool is_allsent( cachemodel_param_t cachemodel);
/**
if( tid) opj_free( tid);
if( cid) opj_free( cid);
- response_signal( connected_socket, true);
+ response_signal( connected_socket, OPJ_TRUE);
}
void handle_PNMreqMSG( SOCKET connected_socket, Byte_t *jpipstream, msgqueue_param_t *msgqueue, cachelist_param_t *cachelist)
cid = receive_string( connected_socket);
remove_cachecid( cid, cachelist);
- response_signal( connected_socket, true);
+ response_signal( connected_socket, OPJ_TRUE);
opj_free( cid);
}
send_stream( connected_socket, responce, 9);
}
-void response_signal( SOCKET connected_socket, bool succeed)
+void response_signal( SOCKET connected_socket, opj_bool succeed)
{
Byte_t code;
#ifndef IMGSOCK_MANAGER_H_
# define IMGSOCK_MANAGER_H_
-#include "bool.h"
#include "byte_manager.h"
#include "sock_manager.h"
+#include "opj_includes.h"
#define NUM_OF_MSGTYPES 9
typedef enum eMSGTYPE{ JPIPSTREAM, PNMREQ, XMLREQ, TIDREQ, CIDREQ, CIDDST, SIZREQ, JP2SAVE, QUIT, MSGERROR} msgtype_t;
* @param [in] connected_socket file descriptor of the connected socket
* @param [in] succeed whether if the requested process succeeded
*/
-void response_signal( SOCKET connected_socket, bool succeed);
+void response_signal( SOCKET connected_socket, opj_bool succeed);
#endif /* !IMGSOCK_MANAGER_H_ */
#include <math.h>
#include <string.h>
-#include "bool.h"
#include "opj_inttypes.h"
#include "index_manager.h"
#include "box_manager.h"
* @param[in] toplev_boxlist top level box list
* @return if correct (true) or wrong (false)
*/
-bool check_JP2boxidx( boxlist_param_t *toplev_boxlist);
+opj_bool check_JP2boxidx( boxlist_param_t *toplev_boxlist);
/**
* set code index parameters (parse cidx box)
* @param[out] codeidx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
-bool set_cidxdata( box_param_t *cidx_box, index_param_t *codeidx);
+opj_bool set_cidxdata( box_param_t *cidx_box, index_param_t *codeidx);
index_param_t * parse_jp2file( int fd)
{
if( COD.YPsiz) opj_free( COD.YPsiz);
}
-bool check_JP2boxidx( boxlist_param_t *toplev_boxlist)
+opj_bool check_JP2boxidx( boxlist_param_t *toplev_boxlist)
{
box_param_t *iptr, *fidx, *prxy;
box_param_t *cidx, *jp2c;
ni = fetch_DBox1byte( prxy, pos);
if( ni != 1){
fprintf( FCGI_stderr, "Multiple indexes not supported\n");
- return false;
+ return OPJ_FALSE;
}
pos += 1;
opj_free(prxy);
- return true;
+ return OPJ_TRUE;
}
/**
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
-bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx);
+opj_bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx);
/**
* set code index parameters from mhix box for main header
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
-bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx);
+opj_bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx);
/**
* set code index parameters from tpix box
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
-bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx);
+opj_bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx);
/**
* set code index parameters from thix box
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
-bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx);
+opj_bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx);
/**
* set code index parameters from ppix box
* @param[out] jp2idx pointer to index parameters
* @return if succeeded (true) or failed (false)
*/
-bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx);
+opj_bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx);
-bool set_cidxdata( box_param_t *cidx_box, index_param_t *jp2idx)
+opj_bool set_cidxdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *manf_box;
manfbox_param_t *manf;
if( !search_boxheader( "mhix", manf)){
fprintf( FCGI_stderr, "Error: mhix box not present in manfbox\n");
opj_free(jp2idx);
- return false;
+ return OPJ_FALSE;
}
set_mainmhixdata( cidx_box, codestream, jp2idx);
if( !search_boxheader( "tpix", manf)){
fprintf( FCGI_stderr, "Error: tpix box not present in manfbox\n");
opj_free(jp2idx);
- return false;
+ return OPJ_FALSE;
}
set_tpixdata( cidx_box, jp2idx);
if( !search_boxheader( "thix", manf)){
fprintf( FCGI_stderr, "Error: thix box not present in manfbox\n");
opj_free(jp2idx);
- return false;
+ return OPJ_FALSE;
}
set_thixdata( cidx_box, jp2idx);
if( !search_boxheader( "ppix", manf)){
fprintf( FCGI_stderr, "Error: ppix box not present in manfbox\n");
opj_free(jp2idx);
- return false;
+ return OPJ_FALSE;
}
set_ppixdata( cidx_box, jp2idx);
delete_manfbox( &manf);
opj_free( manf_box);
- return true;
+ return OPJ_TRUE;
}
-bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx)
+opj_bool set_cptrdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *box; /**< cptr box*/
Byte2_t dr, cont;
if( !(box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "cptr")))
- return false;
+ return OPJ_FALSE;
/* DR: Data Reference. */
/* If 0, the codestream or its Fragment Table box exists in the current file*/
if(( dr = fetch_DBox2bytebigendian( box, 0))){
fprintf( FCGI_stderr, "Error: Codestream not present in current file\n");
opj_free( box);
- return false;
+ return OPJ_FALSE;
}
/* CONT: Container Type*/
if(( cont = fetch_DBox2bytebigendian( box, 2))){
fprintf( FCGI_stderr, "Error: Can't cope with fragmented codestreams yet\n");
opj_free( box);
- return false;
+ return OPJ_FALSE;
}
jp2idx->offset = (OPJ_OFF_T)fetch_DBox8bytebigendian( box, 4);
opj_free( box);
- return true;
+ return OPJ_TRUE;
}
* @param[out] SIZ SIZ marker parameters pointer
* @return if succeeded (true) or failed (false)
*/
-bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, SIZmarker_param_t *SIZ);
+opj_bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, SIZmarker_param_t *SIZ);
/**
* set code index parameters from COD marker in codestream
* @param[out] COD COD marker parameters pointer
* @return if succeeded (true) or failed (false)
*/
-bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream, CODmarker_param_t *COD);
+opj_bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream, CODmarker_param_t *COD);
-bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx)
+opj_bool set_mainmhixdata( box_param_t *cidx_box, codestream_param_t codestream, index_param_t *jp2idx)
{
box_param_t *mhix_box;
mhixbox_param_t *mhix;
markeridx_param_t *codmkidx;
if( !(mhix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "mhix")))
- return false;
+ return OPJ_FALSE;
jp2idx->mhead_length = fetch_DBox8bytebigendian( mhix_box, 0);
delete_mhixbox( &mhix);
- return true;
+ return OPJ_TRUE;
}
-bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx)
+opj_bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *tpix_box; /**< tpix box*/
box_param_t *faix_box; /**< faix box*/
if( !(tpix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "tpix"))){
fprintf( FCGI_stderr, "Error: tpix box not present in cidx box\n");
- return false;
+ return OPJ_FALSE;
}
if( !(faix_box = gene_boxbyType( tpix_box->fd, get_DBoxoff( tpix_box), get_DBoxlen( tpix_box), "faix"))){
fprintf( FCGI_stderr, "Error: faix box not present in tpix box\n");
- return false;
+ return OPJ_FALSE;
}
jp2idx->tilepart = gene_faixbox( faix_box);
opj_free( tpix_box);
opj_free( faix_box);
- return true;
+ return OPJ_TRUE;
}
-bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx)
+opj_bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *thix_box, *manf_box, *mhix_box;
manfbox_param_t *manf;
if( !(thix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "thix"))){
fprintf( FCGI_stderr, "Error: thix box not present in cidx box\n");
- return false;
+ return OPJ_FALSE;
}
if( !(manf_box = gene_boxbyType( thix_box->fd, get_DBoxoff( thix_box), get_DBoxlen( thix_box), "manf"))){
fprintf( FCGI_stderr, "Error: manf box not present in thix box\n");
opj_free( thix_box);
- return false;
+ return OPJ_FALSE;
}
manf = gene_manfbox( manf_box);
delete_manfbox( &manf);
opj_free( manf_box);
opj_free( thix_box);
- return false;
+ return OPJ_FALSE;
}
mhix = gene_mhixbox( mhix_box);
opj_free( manf_box);
opj_free( thix_box);
- return true;
+ return OPJ_TRUE;
}
-bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx)
+opj_bool set_ppixdata( box_param_t *cidx_box, index_param_t *jp2idx)
{
box_param_t *ppix_box, *faix_box, *manf_box;
manfbox_param_t *manf; /**< manf*/
if( !(ppix_box = gene_boxbyType( cidx_box->fd, get_DBoxoff( cidx_box), get_DBoxlen( cidx_box), "ppix"))){
fprintf( FCGI_stderr, "Error: ppix box not present in cidx box\n");
- return false;
+ return OPJ_FALSE;
}
inbox_offset = get_DBoxoff( ppix_box);
if( !(manf_box = gene_boxbyType( ppix_box->fd, inbox_offset, get_DBoxlen( ppix_box), "manf"))){
fprintf( FCGI_stderr, "Error: manf box not present in ppix box\n");
opj_free( ppix_box);
- return false;
+ return OPJ_FALSE;
}
opj_free( ppix_box);
for( comp_idx=0; bh!=NULL; bh=bh->next, comp_idx++){
if( jp2idx->SIZ.Csiz <= comp_idx ){
fprintf( FCGI_stderr, "Error: num of faix boxes is not identical to num of components in ppix box\n");
- return false;
+ return OPJ_FALSE;
}
if( !(faix_box = gene_boxbyOffset( cidx_box->fd, inbox_offset))){
fprintf( FCGI_stderr, "Error: faix box not present in ppix box\n");
- return false;
+ return OPJ_FALSE;
}
faix = gene_faixbox( faix_box);
delete_manfbox( &manf);
- return true;
+ return OPJ_TRUE;
}
-bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, SIZmarker_param_t *SIZ)
+opj_bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, SIZmarker_param_t *SIZ)
{
marker_param_t sizmkr;
int i;
if( sizmkidx->length != SIZ->Lsiz){
fprintf( FCGI_stderr, "Error: marker %#x index is not correct\n", sizmkidx->code);
- return false;
+ return OPJ_FALSE;
}
SIZ->Rsiz = fetch_marker2bytebigendian( sizmkr, 2);
SIZ->XRsiz[i] = fetch_marker1byte( sizmkr, 39+i*3);
SIZ->YRsiz[i] = fetch_marker1byte( sizmkr, 40+i*3);
}
- return true;
+ return OPJ_TRUE;
}
-bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream, CODmarker_param_t *COD)
+opj_bool set_CODmkrdata( markeridx_param_t *codmkidx, codestream_param_t codestream, CODmarker_param_t *COD)
{
marker_param_t codmkr;
int i;
if( codmkidx->length != COD->Lcod){
fprintf( FCGI_stderr, "Error: marker %#x index is not correct\n", codmkidx->code);
- return false;
+ return OPJ_FALSE;
}
COD->Scod = fetch_marker1byte( codmkr, 2);
COD->XPsiz[0] = COD->YPsiz[0] = pow(2,15);
}
- return true;
+ return OPJ_TRUE;
}
return n2;
}
-bool isJPTfeasible( index_param_t index)
+opj_bool isJPTfeasible( index_param_t index)
{
if( 1 < get_nmax( index.tilepart))
- return true;
+ return OPJ_TRUE;
else
- return false;
+ return OPJ_FALSE;
}
#include "faixbox_manager.h"
#include "metadata_manager.h"
#include "mhixbox_manager.h"
-#include "bool.h"
/** progression order */
#if 0
* @param[in] index index parameters
* @return true if JPT-stream is feasible
*/
-bool isJPTfeasible( index_param_t index);
+opj_bool isJPTfeasible( index_param_t index);
#endif /* !INDEX_MANAGER_H_ */
SIZmarker_param_t get_SIZmkrdata_from_j2kstream( Byte_t *SIZstream);
CODmarker_param_t get_CODmkrdata_from_j2kstream( Byte_t *CODstream);
-bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD)
+opj_bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD)
{
if( *j2kstream++ != 0xff || *j2kstream++ != 0x4f){
fprintf( FCGI_stderr, "Error, j2kstream is not starting with SOC marker\n");
- return false;
+ return OPJ_FALSE;
}
if( SIZ){
*SIZ = get_SIZmkrdata_from_j2kstream( j2kstream);
if( SIZ->Lsiz == 0)
- return false;
+ return OPJ_FALSE;
j2kstream += (SIZ->Lsiz+2);
}
*COD = get_CODmkrdata_from_j2kstream( j2kstream);
if( COD->Lcod == 0)
- return false;
+ return OPJ_FALSE;
}
- return true;
+ return OPJ_TRUE;
}
SIZmarker_param_t get_SIZmkrdata_from_j2kstream( Byte_t *SIZstream)
}
-bool modify_SIZmkrstream( SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZstream);
+opj_bool modify_SIZmkrstream( SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZstream);
Byte2_t modify_CODmkrstream( CODmarker_param_t COD, int numOfdecomp, Byte_t *CODstream);
-bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen)
+opj_bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen)
{
Byte2_t newLcod;
if( *j2kstream++ != 0xff || *j2kstream++ != 0x4f){
fprintf( FCGI_stderr, "Error, j2kstream is not starting with SOC marker\n");
- return false;
+ return OPJ_FALSE;
}
if(!modify_SIZmkrstream( SIZ, COD.numOfdecomp-numOfdecomp, j2kstream))
- return false;
+ return OPJ_FALSE;
j2kstream += SIZ.Lsiz+2;
if( !(newLcod = modify_CODmkrstream( COD, numOfdecomp, j2kstream)))
- return false;
+ return OPJ_FALSE;
memmove( j2kstream+2+newLcod, j2kstream+2+COD.Lcod, *j2klen - (Byte8_t)(SIZ.Lsiz+COD.Lcod+6));
*j2klen -= (Byte8_t)( COD.Lcod - newLcod);
- return true;
+ return OPJ_TRUE;
}
-bool modify_SIZmkrstream( SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZstream)
+opj_bool modify_SIZmkrstream( SIZmarker_param_t SIZ, int difOfdecomplev, Byte_t *SIZstream)
{
int i;
if( *SIZstream++ != 0xff || *SIZstream++ != 0x51){
fprintf( FCGI_stderr, "Error, SIZ marker not found in the reconstructed j2kstream\n");
- return false;
+ return OPJ_FALSE;
}
for( i=0; i<difOfdecomplev; i++){
modify_4Bytecode( SIZ.XTOsiz, SIZstream+24);
modify_4Bytecode( SIZ.YTOsiz, SIZstream+28);
- return true;
+ return OPJ_TRUE;
}
Byte2_t modify_CODmkrstream( CODmarker_param_t COD, int numOfdecomp, Byte_t *CODstream)
return newLcod;
}
-bool modify_COCmkrstream( int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte2_t *oldLcoc, Byte2_t *newLcoc);
+opj_bool modify_COCmkrstream( int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte2_t *oldLcoc, Byte2_t *newLcoc);
-bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen)
+opj_bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen)
{
Byte4_t Psot; /* tile part length ref A.4.2 Start of tile-part SOT */
Byte_t *thstream, *SOTstream, *Psot_stream;
if( *SOTstream++ != 0xff || *SOTstream++ != 0x90){
fprintf( FCGI_stderr, "Error, thstream is not starting with SOT marker\n");
- return false;
+ return OPJ_FALSE;
}
SOTstream += 4; /* skip Lsot & Isot */
while( !( *thstream == 0xff && *(thstream+1) == 0x93)){ /* search SOD */
if( numOfdecomp != -1 && *thstream == 0xff && *(thstream+1) == 0x53){ /* COC */
if( !modify_COCmkrstream( numOfdecomp, thstream, Csiz, &oldLcoc, &newLcoc))
- return false;
+ return OPJ_FALSE;
memmove( thstream+newLcoc+2, thstream+oldLcoc+2, *j2klen - (Byte8_t)(thstream-j2kstream+oldLcoc+2));
*j2klen -= (Byte8_t)( oldLcoc - newLcoc);
Psot = (Byte4_t)((*j2klen)-SOToffset);
modify_4Bytecode( Psot, Psot_stream);
}
- return true;
+ return OPJ_TRUE;
}
-bool modify_COCmkrstream( int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte2_t *oldLcoc, Byte2_t *newLcoc)
+opj_bool modify_COCmkrstream( int numOfdecomp, Byte_t *COCstream, Byte2_t Csiz, Byte2_t *oldLcoc, Byte2_t *newLcoc)
{
- if( numOfdecomp < 0 || numOfdecomp > 255 ) return false;
+ if( numOfdecomp < 0 || numOfdecomp > 255 ) return OPJ_FALSE;
if( *COCstream++ != 0xff || *COCstream++ != 0x53){
fprintf( FCGI_stderr, "Error, COC marker not found in the reconstructed j2kstream\n");
- return false;
+ return OPJ_FALSE;
}
*oldLcoc = big2( COCstream);
*COCstream = (Byte_t)numOfdecomp;
- return true;
+ return OPJ_TRUE;
}
#ifndef J2KHEADER_MANAGER_H_
# define J2KHEADER_MANAGER_H_
-#include "bool.h"
#include "byte_manager.h"
#include "index_manager.h"
* @param[out] COD COD marker pointer
* @return if succeeded (true) or failed (false)
*/
-bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD);
+opj_bool get_mainheader_from_j2kstream( Byte_t *j2kstream, SIZmarker_param_t *SIZ, CODmarker_param_t *COD);
/**
* modify main header in j2k codestream to fit with the new number of decompositions
* @param[out] j2klen pointer to the length of j2k code stream
* @return if succeeded (true) or failed (false)
*/
-bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen);
+opj_bool modify_mainheader( Byte_t *j2kstream, int numOfdecomp, SIZmarker_param_t SIZ, CODmarker_param_t COD, Byte8_t *j2klen);
/**
* modify tile header in j2k codestream to fit with the tile part length, and new number of decompositions for multi-componet images
* @param[out] j2klen pointer to the length of j2k code stream
* @return if succeeded (true) or failed (false)
*/
-bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen);
+opj_bool modify_tileheader( Byte_t *j2kstream, Byte8_t SOToffset, int numOfdecomp, Byte2_t Csiz, Byte8_t *j2klen);
#endif /* !J2KHEADER_MANAGER_H_ */
return jp2stream;
}
-bool isJPPstream( Byte8_t csn, msgqueue_param_t *msgqueue);
+opj_bool isJPPstream( Byte8_t csn, msgqueue_param_t *msgqueue);
Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen);
Byte_t * recons_codestream_from_JPPstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen);
return recons_codestream_from_JPTstream( msgqueue, jpipstream, csn, fw, fh, codelen);
}
-bool isJPPstream( Byte8_t csn, msgqueue_param_t *msgqueue)
+opj_bool isJPPstream( Byte8_t csn, msgqueue_param_t *msgqueue)
{
message_param_t *msg;
while( msg){
if( msg->csn == csn){
if( msg->class_id <= 2)
- return true;
+ return OPJ_TRUE;
else
if( msg->class_id == 4 || msg->class_id == 5)
- return false;
+ return OPJ_FALSE;
}
msg = msg->next;
}
fprintf( FCGI_stderr, "Error, message of csn %" PRId64 " not found\n", csn);
- return false;
+ return OPJ_FALSE;
}
Byte_t * add_mainhead_msgstream( msgqueue_param_t *msgqueue, Byte_t *origstream, Byte_t *j2kstream, Byte8_t csn, Byte8_t *j2klen);
-Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, bool isJPPstream);
+Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, opj_bool isJPPstream);
Byte_t * add_emptytilestream( const Byte8_t tileID, Byte_t *j2kstream, Byte8_t *j2klen);
Byte_t * recons_codestream_from_JPTstream( msgqueue_param_t *msgqueue, Byte_t *jpipstream, Byte8_t csn, int fw, int fh, Byte8_t *j2klen)
{
Byte_t *j2kstream = NULL;
Byte8_t last_tileID, tileID;
- bool found;
+ opj_bool found;
Byte8_t binOffset;
message_param_t *ptr;
SIZmarker_param_t SIZ;
else
mindeclev = (OPJ_SIZE_T)comp_decomplev( fw, fh, (int)SIZ.Xsiz, (int)SIZ.Ysiz);
- last_tileID = get_last_tileID( msgqueue, csn, false);
+ last_tileID = get_last_tileID( msgqueue, csn, OPJ_FALSE);
for( tileID=0; tileID <= last_tileID; tileID++){
- found = false;
+ found = OPJ_FALSE;
binOffset = 0;
ptr = msgqueue->first;
while(( ptr = search_message( TILE_MSG, tileID, csn, ptr))!=NULL){
if( ptr->bin_offset == binOffset){
- found = true;
+ found = OPJ_TRUE;
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
binOffset += ptr->length;
}
while(( ptr = search_message( EXT_TILE_MSG, tileID, csn, ptr))!=NULL){
if( ptr->aux > mindeclev){ /* FIXME: pointer comparison ? */
if( ptr->bin_offset == binOffset){
- found = true;
+ found = OPJ_TRUE;
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
binOffset += ptr->length;
}
Byte_t *j2kstream = NULL;
Byte8_t tileID, last_tileID;
Byte8_t SOToffset;
- bool foundTH;
+ opj_bool foundTH;
Byte8_t binOffset;
message_param_t *ptr;
SIZmarker_param_t SIZ;
mindeclev = comp_decomplev( fw, fh, (int)SIZ.Xsiz, (int)SIZ.Ysiz);
max_reslev = -1;
- last_tileID = get_last_tileID( msgqueue, csn, true);
+ last_tileID = get_last_tileID( msgqueue, csn, OPJ_TRUE);
for( tileID=0; tileID <= last_tileID; tileID++){
ptr = msgqueue->first;
binOffset = 0;
- foundTH = false;
+ foundTH = OPJ_FALSE;
SOToffset = *j2klen;
while(( ptr = search_message( TILE_HEADER_MSG, tileID, csn, ptr))!=NULL){
if( ptr->bin_offset == binOffset){
j2kstream = add_SOTmkr( j2kstream, j2klen);
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
- foundTH = true;
+ foundTH = OPJ_TRUE;
binOffset += ptr->length;
}
ptr = ptr->next;
{
Byte8_t seqID, precID, binOffset;
message_param_t *ptr;
- bool foundPrec;
+ opj_bool foundPrec;
int l;
seqID = comp_seqID( tileID, SIZ, COD, res_idx, prct_idx);
ptr = msgqueue->first;
binOffset = 0;
- foundPrec = false;
+ foundPrec = OPJ_FALSE;
l = 0;
while(( ptr = search_message( PRECINCT_MSG, precID, csn, ptr))!=NULL){
if( ptr->bin_offset == binOffset){
if( lay_idx == l){
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
- foundPrec = true;
+ foundPrec = OPJ_TRUE;
if( *max_reslev < res_idx)
*max_reslev = res_idx;
{
Byte8_t precID, binOffset;
message_param_t *ptr;
- bool foundPrec;
+ opj_bool foundPrec;
precID = comp_precinct_id( (int)tileID, comp_idx, (int)seqID, (int)SIZ.Csiz, (int)SIZ.XTnum*(int)SIZ.YTnum);
ptr = msgqueue->first;
binOffset = 0;
- foundPrec = false;
+ foundPrec = OPJ_FALSE;
while(( ptr = search_message( PRECINCT_MSG, precID, csn, ptr))!=NULL){
if( ptr->bin_offset == binOffset){
j2kstream = add_msgstream( ptr, jpipstream, j2kstream, j2klen);
- foundPrec = true;
+ foundPrec = OPJ_TRUE;
binOffset += ptr->length;
if( *max_reslev < res_idx)
*max_reslev = res_idx;
return seqID;
}
-Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, bool isJPPstream)
+Byte8_t get_last_tileID( msgqueue_param_t *msgqueue, Byte8_t csn, opj_bool isJPPstream)
{
Byte8_t last_tileID = 0;
message_param_t *msg;
#endif /*SERVER*/
-bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target)
+opj_bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target)
{
if( query_param.tid){
if( strcmp( query_param.tid, "0") != 0 ){
if( query_param.cid[0] != '\0'){
fprintf( FCGI_stdout, "Reason: Target can not be specified both through tid and cid\r\n");
fprintf( FCGI_stdout, "Status: 400\r\n");
- return false;
+ return OPJ_FALSE;
}
if( ( *target = search_targetBytid( query_param.tid, targetlist)))
- return true;
+ return OPJ_TRUE;
}
}
if( query_param.target)
if( !( *target = search_target( query_param.target, targetlist)))
if(!( *target = gene_target( targetlist, query_param.target)))
- return false;
+ return OPJ_FALSE;
if( *target){
fprintf( FCGI_stdout, "JPIP-tid: %s\r\n", (*target)->tid);
- return true;
+ return OPJ_TRUE;
}
else{
fprintf( FCGI_stdout, "Reason: target not found\r\n");
fprintf( FCGI_stdout, "Status: 400\r\n");
- return false;
+ return OPJ_FALSE;
}
}
-bool associate_channel( query_param_t query_param,
+opj_bool associate_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel)
}
else{
fprintf( FCGI_stderr, "Error: process canceled\n");
- return false;
+ return OPJ_FALSE;
}
- return true;
+ return OPJ_TRUE;
}
-bool open_channel( query_param_t query_param,
+opj_bool open_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
auxtrans_param_t auxtrans,
target_param_t *target,
*cursession = gene_session( sessionlist);
if( !( cachemodel = search_cachemodel( target, (*cursession)->cachemodellist)))
if( !(cachemodel = gene_cachemodel( (*cursession)->cachemodellist, target, query_param.return_type==JPPstream)))
- return false;
+ return OPJ_FALSE;
}
else
if( *curchannel)
*curchannel = gene_channel( query_param, auxtrans, cachemodel, (*cursession)->channellist);
if( *curchannel == NULL)
- return false;
+ return OPJ_FALSE;
- return true;
+ return OPJ_TRUE;
}
-bool close_channel( query_param_t query_param,
+opj_bool close_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel)
#endif
/* all channels associatd with the session will be closed */
if( !delete_session( cursession, sessionlist))
- return false;
+ return OPJ_FALSE;
}
else{
/* check if all entry belonging to the same session */
/* In case of the first entry of close cid */
if( *cursession == NULL){
if( !search_session_and_channel( cclose, sessionlist, cursession, curchannel))
- return false;
+ return OPJ_FALSE;
}
else /* second or more entry of close cid */
if( !(*curchannel=search_channel( cclose, (*cursession)->channellist))){
fprintf( FCGI_stdout, "Reason: Cclose id %s is from another session\r\n", cclose);
- return false;
+ return OPJ_FALSE;
}
}
/* In case of empty session */
delete_session( cursession, sessionlist);
}
- return true;
+ return OPJ_TRUE;
}
* @param[in,out] msgqueue message queue pointer
* @return if succeeded (true) or failed (false)
*/
-bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue);
+opj_bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue);
-bool gene_JPIPstream( query_param_t query_param,
+opj_bool gene_JPIPstream( query_param_t query_param,
target_param_t *target,
session_param_t *cursession,
channel_param_t *curchannel,
if( !cursession || !curchannel){ /* stateless */
if( !target)
- return false;
+ return OPJ_FALSE;
if( !(cachemodel = gene_cachemodel( NULL, target, query_param.return_type==JPPstream)))
- return false;
- *msgqueue = gene_msgqueue( true, cachemodel);
+ return OPJ_FALSE;
+ *msgqueue = gene_msgqueue( OPJ_TRUE, cachemodel);
}
else{ /* session */
cachemodel = curchannel->cachemodel;
target = cachemodel->target;
- *msgqueue = gene_msgqueue( false, cachemodel);
+ *msgqueue = gene_msgqueue( OPJ_FALSE, cachemodel);
}
codeidx = target->codeidx;
/*meta*/
if( query_param.box_type[0][0] != 0 && query_param.len != 0)
if( !enqueue_metabins( query_param, codeidx->metadatalist, *msgqueue))
- return false;
+ return OPJ_FALSE;
if( query_param.metadata_only)
- return true;
+ return OPJ_TRUE;
/* main header */
if( !cachemodel->mhead_model && query_param.len != 0)
if( (query_param.fx > 0 && query_param.fy > 0))
enqueue_imagedata( query_param, *msgqueue);
- return true;
+ return OPJ_TRUE;
}
* @param[in] msgqueue message queue
* @return
*/
-void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int level, int lastcomp, bool *comps, int layers, msgqueue_param_t *msgqueue);
+void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int level, int lastcomp, opj_bool *comps, int layers, msgqueue_param_t *msgqueue);
/**
* enqueue all precincts inside a tile into the queue
* @param[in] msgqueue message queue
* @return
*/
-void enqueue_allprecincts( int tile_id, int level, int lastcomp, bool *comps, int layers, msgqueue_param_t *msgqueue);
+void enqueue_allprecincts( int tile_id, int level, int lastcomp, opj_bool *comps, int layers, msgqueue_param_t *msgqueue);
void enqueue_imagedata( query_param_t query_param, msgqueue_param_t *msgqueue)
{
}
-void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int level, int lastcomp, bool *comps, int layers, msgqueue_param_t *msgqueue)
+void enqueue_precincts( int xmin, int xmax, int ymin, int ymax, int tile_id, int level, int lastcomp, opj_bool *comps, int layers, msgqueue_param_t *msgqueue)
{
index_param_t *codeidx;
int c, u, v, res_lev, dec_lev;
}
}
-void enqueue_allprecincts( int tile_id, int level, int lastcomp, bool *comps, int layers, msgqueue_param_t *msgqueue)
+void enqueue_allprecincts( int tile_id, int level, int lastcomp, opj_bool *comps, int layers, msgqueue_param_t *msgqueue)
{
index_param_t *codeidx;
int c, i, res_lev, dec_lev;
}
}
-bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue)
+opj_bool enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue)
{
int i;
for( i=0; query_param.box_type[i][0]!=0 && i<MAX_NUMOFBOX; i++){
if( query_param.box_type[i][0] == '*'){
fprintf( FCGI_stdout, "Status: 501\r\n");
fprintf( FCGI_stdout, "Reason: metareq with all box-property * not implemented\r\n");
- return false;
+ return OPJ_FALSE;
}
else{
Byte8_t idx = search_metadataidx( query_param.box_type[i], metadatalist);
else{
fprintf( FCGI_stdout, "Status: 400\r\n");
fprintf( FCGI_stdout, "Reason: box-type %.4s not found\r\n", query_param.box_type[i]);
- return false;
+ return OPJ_FALSE;
}
}
}
- return true;
+ return OPJ_TRUE;
}
#ifndef JPIP_PARSER_H_
# define JPIP_PARSER_H_
-#include "bool.h"
#include "query_parser.h"
#include "session_manager.h"
#include "target_manager.h"
* @param[out] target address of target pointer
* @return if succeeded (true) or failed (false)
*/
-bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target);
+opj_bool identify_target( query_param_t query_param, targetlist_param_t *targetlist, target_param_t **target);
/**
* REQUEST: channel association
* @param[out] curchannel address of the associated channel pointer
* @return if succeeded (true) or failed (false)
*/
-bool associate_channel( query_param_t query_param,
+opj_bool associate_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel);
* @param[in,out] curchannel address of the associated/opened channel pointer
* @return if succeeded (true) or failed (false)
*/
-bool open_channel( query_param_t query_param,
+opj_bool open_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
auxtrans_param_t auxtrans,
target_param_t *target,
* @param[in,out] curchannel address of the deleting channel pointer
* @return if succeeded (true) or failed (false)
*/
-bool close_channel( query_param_t query_param,
+opj_bool close_channel( query_param_t query_param,
sessionlist_param_t *sessionlist,
session_param_t **cursession,
channel_param_t **curchannel);
* @param[out] msgqueue address of the message queue pointer
* @return if succeeded (true) or failed (false)
*/
-bool gene_JPIPstream( query_param_t query_param,
+opj_bool gene_JPIPstream( query_param_t query_param,
target_param_t *target,
session_param_t *cursession,
channel_param_t *curchannel,
#define logstream stderr
#endif /*SERVER*/
-msgqueue_param_t * gene_msgqueue( bool stateless, cachemodel_param_t *cachemodel)
+msgqueue_param_t * gene_msgqueue( opj_bool stateless, cachemodel_param_t *cachemodel)
{
msgqueue_param_t *msgqueue;
msg = (message_param_t *)opj_malloc( sizeof(message_param_t));
- msg->last_byte = true;
+ msg->last_byte = OPJ_TRUE;
msg->in_class_id = 0;
msg->class_id = MAINHEADER_MSG;
assert( target->csn >= 0 );
enqueue_message( msg, msgqueue);
- cachemodel->mhead_model = true;
+ cachemodel->mhead_model = OPJ_TRUE;
}
void enqueue_tileheader( int tile_id, msgqueue_param_t *msgqueue)
if( !cachemodel->th_model[ tile_id]){
msg = (message_param_t *)opj_malloc( sizeof(message_param_t));
- msg->last_byte = true;
+ msg->last_byte = OPJ_TRUE;
assert( tile_id >= 0 );
msg->in_class_id = (Byte8_t)tile_id;
msg->class_id = TILE_HEADER_MSG;
msg->next = NULL;
enqueue_message( msg, msgqueue);
- cachemodel->th_model[ tile_id] = true;
+ cachemodel->th_model[ tile_id] = OPJ_TRUE;
}
}
{
cachemodel_param_t *cachemodel;
target_param_t *target;
- bool *tp_model;
+ opj_bool *tp_model;
Byte8_t numOftparts; /* num of tile parts par tile*/
Byte8_t numOftiles;
index_param_t *codeidx;
enqueue_message( msg, msgqueue);
- tp_model[i] = true;
+ tp_model[i] = OPJ_TRUE;
}
binOffset += binLength;
}
enqueue_message( msg, msgqueue);
- cachemodel->pp_model[comp_id][tile_id*(int)nmax+seq_id*numOflayers+layer_id] = true;
+ cachemodel->pp_model[comp_id][tile_id*(int)nmax+seq_id*numOflayers+layer_id] = OPJ_TRUE;
}
binOffset += binLength;
}
if( metadata->boxcontents)
enqueue_boxcontents( meta_id, metadata->boxcontents, msgqueue, &binOffset);
- msgqueue->last->last_byte = true;
+ msgqueue->last->last_byte = OPJ_TRUE;
}
message_param_t * gene_metamsg( Byte8_t meta_id, Byte8_t binoffset, Byte8_t length, OPJ_OFF_T res_offset, placeholder_param_t *phld, Byte8_t csn);
msg = (message_param_t *)opj_malloc( sizeof(message_param_t));
- msg->last_byte = false;
+ msg->last_byte = OPJ_FALSE;
msg->in_class_id = meta_id;
msg->class_id = METADATA_MSG;
msg->csn = csn;
ptr = parse_bin_id_vbas( ptr, &bb, &c, &msg->in_class_id);
- msg->last_byte = c == 1 ? true : false;
+ msg->last_byte = c == 1 ? OPJ_TRUE : OPJ_FALSE;
if( bb >= 2)
ptr = parse_vbas( ptr, &class_id);
#ifndef MSGQUEUE_MANAGER_H_
# define MSGQUEUE_MANAGER_H_
-#include "bool.h"
#include "byte_manager.h"
#include "cachemodel_manager.h"
#include "placeholder_manager.h"
/** message parameters */
typedef struct message_param{
- bool last_byte; /**< if message contains the last byte of the data-bin*/
+ opj_bool last_byte; /**< if message contains the last byte of the data-bin*/
Byte8_t in_class_id; /**< in-class identifier A.2.3*/
Byte8_t class_id; /**< class identifiers */
Byte8_t csn; /**< index of the codestream*/
typedef struct msgqueue_param{
message_param_t *first; /**< first message pointer of the list*/
message_param_t *last; /**< last message pointer of the list*/
- bool stateless; /**< if this is a stateless message queue*/
+ opj_bool stateless; /**< if this is a stateless message queue*/
cachemodel_param_t *cachemodel; /**< reference cachemodel pointer*/
} msgqueue_param_t;
* @param[in] cachemodel cachemodel pointer
* @return generated message queue pointer
*/
-msgqueue_param_t * gene_msgqueue( bool stateless, cachemodel_param_t *cachemodel);
+msgqueue_param_t * gene_msgqueue( opj_bool stateless, cachemodel_param_t *cachemodel);
/**
* delete message queue
return qr;
}
-bool process_JPIPrequest( server_record_t *rec, QR_t *qr)
+opj_bool process_JPIPrequest( server_record_t *rec, QR_t *qr)
{
target_param_t *target = NULL;
session_param_t *cursession = NULL;
if( qr->query->target || qr->query->tid){
if( !identify_target( *(qr->query), rec->targetlist, &target))
- return false;
+ return OPJ_FALSE;
}
if( qr->query->cid){
if( !associate_channel( *(qr->query), rec->sessionlist, &cursession, &curchannel))
- return false;
+ return OPJ_FALSE;
qr->channel = curchannel;
}
if( qr->query->cnew != non){
if( !open_channel( *(qr->query), rec->sessionlist, rec->auxtrans, target, &cursession, &curchannel))
- return false;
+ return OPJ_FALSE;
qr->channel = curchannel;
}
if( qr->query->cclose)
if( !close_channel( *(qr->query), rec->sessionlist, &cursession, &curchannel))
- return false;
+ return OPJ_FALSE;
if( (qr->query->fx > 0 && qr->query->fy > 0) || qr->query->box_type[0][0] != 0 || qr->query->len > 0)
if( !gene_JPIPstream( *(qr->query), target, cursession, curchannel, &qr->msgqueue))
- return false;
+ return OPJ_FALSE;
- return true;
+ return OPJ_TRUE;
}
void add_EORmsg( int fd, QR_t *qr);
}
-void local_log( bool query, bool messages, bool sessions, bool targets, QR_t *qr, server_record_t *rec)
+void local_log( opj_bool query, opj_bool messages, opj_bool sessions, opj_bool targets, QR_t *qr, server_record_t *rec)
{
if( query)
print_queryparam( *qr->query);
record->cachelist = gene_cachelist();
record->jpipstream = NULL;
record->jpipstreamlen = 0;
- record->msgqueue = gene_msgqueue( true, NULL);
+ record->msgqueue = gene_msgqueue( OPJ_TRUE, NULL);
record->listening_socket = open_listeningsocket( (uint16_t)port);
return record;
return client;
}
-bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec)
+opj_bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec)
{
- bool quit = false;
+ opj_bool quit = OPJ_FALSE;
msgtype_t msgtype = identify_clientmsg( client);
switch( msgtype){
break;
case QUIT:
- quit = true;
+ quit = OPJ_TRUE;
save_codestream( rec->jpipstream, rec->jpipstreamlen, "jpt");
break;
case MSGERROR:
fprintf( stderr, "\t end of the connection\n\n");
if( close_socket(client) != 0){
perror("close");
- return false;
+ return OPJ_FALSE;
}
if( quit)
- return false;
+ return OPJ_FALSE;
- return true;
+ return OPJ_TRUE;
}
-jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( bool jp2)
+jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( opj_bool jp2)
{
jpip_dec_param_t *dec;
dec = (jpip_dec_param_t *)opj_calloc( 1, sizeof(jpip_dec_param_t));
- dec->msgqueue = gene_msgqueue( true, NULL);
+ dec->msgqueue = gene_msgqueue( OPJ_TRUE, NULL);
if( jp2)
dec->metadatalist = gene_metadatalist();
}
-bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec)
+opj_bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec)
{
int infd;
if(( infd = open( fname, O_RDONLY)) == -1){
fprintf( stderr, "file %s not exist\n", fname);
- return false;
+ return OPJ_FALSE;
}
if(!(dec->jpiplen = (Byte8_t)get_filesize(infd)))
- return false;
+ return OPJ_FALSE;
dec->jpipstream = (Byte_t *)opj_malloc( dec->jpiplen);
if( read( infd, dec->jpipstream, dec->jpiplen) != (int)dec->jpiplen){
fprintf( stderr, "file reading error\n");
opj_free( dec->jpipstream);
- return false;
+ return OPJ_FALSE;
}
close(infd);
- return true;
+ return OPJ_TRUE;
}
void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec)
dec->jp2kstream = recons_j2k( dec->msgqueue, dec->jpipstream, dec->msgqueue->first->csn, 0, 0, &dec->jp2klen);
}
-bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
+opj_bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
{
int outfd;
if(( outfd = open( fname, O_WRONLY|O_CREAT, S_IRWXU|S_IRWXG)) == -1){
#endif
fprintf( stderr, "file %s open error\n", fname);
- return false;
+ return OPJ_FALSE;
}
if( write( outfd, dec->jp2kstream, dec->jp2klen) != (int)dec->jp2klen)
close(outfd);
- return true;
+ return OPJ_TRUE;
}
-void OPJ_CALLCONV output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec)
+void OPJ_CALLCONV output_log( opj_bool messages, opj_bool metadata, opj_bool ihdrbox, jpip_dec_param_t *dec)
{
if( messages)
print_msgqueue( dec->msgqueue);
#include "target_manager.h"
#include "query_parser.h"
#include "msgqueue_manager.h"
-#include "bool.h"
#include "sock_manager.h"
#include "auxtrans_manager.h"
* @param[in] qr query/response data pointer
* @return true if succeed, otherwise false
*/
-bool process_JPIPrequest( server_record_t *rec, QR_t *qr);
+opj_bool process_JPIPrequest( server_record_t *rec, QR_t *qr);
/**
* 3rd process; send response data JPT/JPP-stream
* @param[in] qr query/response data pointer
* @param[in] rec server static record pinter
*/
-void local_log( bool query, bool messages, bool sessions, bool targets, QR_t *qr, server_record_t *rec);
+void local_log( opj_bool query, opj_bool messages, opj_bool sessions, opj_bool targets, QR_t *qr, server_record_t *rec);
#endif /*SERVER*/
* @param[in] rec decoding server static record pointer
* @return true if succeed
*/
-OPJ_API bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec);
+OPJ_API opj_bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec);
#endif /*SERVER*/
* @param[in] jp2 true in case of jp2 file encoding, else j2k file encoding
* @return JPIP decoding parameters pointer
*/
-OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( bool jp2);
+OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( opj_bool jp2);
/**
* Destroy jpip decoding parameters
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
-OPJ_API bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec);
+OPJ_API opj_bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec);
/**
* Decode jpip codestream
* @param[in] dec JPIP decoding parameters pointer
* @return true if succeed
*/
-OPJ_API bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
+OPJ_API opj_bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
/**
* Option; print out parameter values to stderr
* @param[in] ihdrbox true if image header data is to be printed out
* @param[in] dec JPIP decoding parameters pointer
*/
-OPJ_API void OPJ_CALLCONV output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec);
+OPJ_API void OPJ_CALLCONV output_log( opj_bool messages, opj_bool metadata, opj_bool ihdrbox, jpip_dec_param_t *dec);
/*
* test the format of index (cidx) box in JP2 file
query_param_t *query;
int i;
- query = (query_param_t *)malloc( sizeof(query_param_t));
+ query = (query_param_t *)opj_malloc( sizeof(query_param_t));
query->target = NULL;
query->tid = NULL;
memset( query->box_type, 0, MAX_NUMOFBOX*4);
memset( query->limit, 0, MAX_NUMOFBOX*sizeof(int));
for( i=0; i<MAX_NUMOFBOX; i++){
- query->w[i] = false;
- query->s[i] = false;
- query->g[i] = false;
- query->a[i] = false;
- query->priority[i] = false;
+ query->w[i] = OPJ_FALSE;
+ query->s[i] = OPJ_FALSE;
+ query->g[i] = OPJ_FALSE;
+ query->a[i] = OPJ_FALSE;
+ query->priority[i] = OPJ_FALSE;
}
query->root_bin = 0;
query->max_depth = -1;
- query->metadata_only = false;
+ query->metadata_only = OPJ_FALSE;
query->return_type = UNKNOWN;
query->len = -1;
sscanf( ptr+1, "%d", &(query_param->max_depth));
if(( ptr = strstr( field, "!!")))
- query_param->metadata_only = true;
+ query_param->metadata_only = OPJ_TRUE;
}
void parse_req_box_prop( char *req_box_prop, int idx, query_param_t *query_param)
ptr++;
while( *ptr=='w' || *ptr=='s' || *ptr=='g' || *ptr=='a'){
switch( *ptr){
- case 'w': query_param->w[idx] = true; break;
- case 's': query_param->s[idx] = true; break;
- case 'g': query_param->g[idx] = true; break;
- case 'a': query_param->a[idx] = true; break;
+ case 'w': query_param->w[idx] = OPJ_TRUE; break;
+ case 's': query_param->s[idx] = OPJ_TRUE; break;
+ case 'g': query_param->g[idx] = OPJ_TRUE; break;
+ case 'a': query_param->a[idx] = OPJ_TRUE; break;
}
ptr++;
}
}
else{
- query_param->g[idx] = true;
- query_param->s[idx] = true;
- query_param->w[idx] = true;
+ query_param->g[idx] = OPJ_TRUE;
+ query_param->s[idx] = OPJ_TRUE;
+ query_param->w[idx] = OPJ_TRUE;
}
if((ptr = strchr( req_box_prop, '!')))
- query_param->priority[idx] = true;
+ query_param->priority[idx] = OPJ_TRUE;
idx++;
}
}
query_param->lastcomp = stop > aux ? stop : aux;
- query_param->comps = (bool *)calloc( 1, (OPJ_SIZE_T)(query_param->lastcomp+1)*sizeof(bool));
+ query_param->comps = (opj_bool *)opj_calloc( 1, (OPJ_SIZE_T)(query_param->lastcomp+1)*sizeof(opj_bool));
for( i=start; i<=stop; i++)
- query_param->comps[i]=true;
+ query_param->comps[i]=OPJ_TRUE;
if(aux!=-1)
- query_param->comps[aux] = true;
+ query_param->comps[aux] = OPJ_TRUE;
}
void delete_query( query_param_t **query)
{
if( (*query)->target)
- free( (*query)->target);
+ opj_free( (*query)->target);
if( (*query)->tid)
- free( (*query)->tid);
+ opj_free( (*query)->tid);
if( (*query)->comps)
- free((*query)->comps);
+ opj_free((*query)->comps);
if( (*query)->cid)
- free( (*query)->cid);
+ opj_free( (*query)->cid);
if( (*query)->cclose)
- free( (*query)->cclose);
+ opj_free( (*query)->cclose);
- free( *query);
+ opj_free( *query);
}
#ifndef QUERY_PARSER_H_
# define QUERY_PARSER_H_
-#include "bool.h"
+#include "opj_includes.h"
/** maximum number of meta request box */
#define MAX_NUMOFBOX 10
int rx, ry, rw, rh; /**< roi region */
int layers; /**< quality layers */
int lastcomp; /**< last component number */
- bool *comps; /**< components (dynamic array) for jpp-stream, null means all components */
+ opj_bool *comps; /**< components (dynamic array) for jpp-stream, null means all components */
char *cid; /**< channel identifier */
cnew_transport_t cnew; /**< transport name if there is new channel request, else non */
char *cclose; /**< list of closing channel identifiers, separated by '\\0' */
int numOfcclose; /**< number of closing channels */
char box_type[MAX_NUMOFBOX][4]; /**< interested box-types */
int limit[MAX_NUMOFBOX]; /**< limit value, -1: skeleton request "r", 0: entire contents */
- bool w[MAX_NUMOFBOX]; /**< Metadata request qualifier flags */
- bool s[MAX_NUMOFBOX];
- bool g[MAX_NUMOFBOX];
- bool a[MAX_NUMOFBOX];
- bool priority[MAX_NUMOFBOX]; /**< priority flag */
+ opj_bool w[MAX_NUMOFBOX]; /**< Metadata request qualifier flags */
+ opj_bool s[MAX_NUMOFBOX];
+ opj_bool g[MAX_NUMOFBOX];
+ opj_bool a[MAX_NUMOFBOX];
+ opj_bool priority[MAX_NUMOFBOX]; /**< priority flag */
int root_bin; /**< root-bin */
int max_depth; /**< max-depth */
- bool metadata_only; /**< metadata-only request */
+ opj_bool metadata_only; /**< metadata-only request */
image_return_t return_type; /**< image return type */
int len; /**< maximum response length */
} query_param_t;
return session;
}
-bool search_session_and_channel( char cid[],
+opj_bool search_session_and_channel( char cid[],
sessionlist_param_t *sessionlist,
session_param_t **foundsession,
channel_param_t **foundchannel)
while( *foundchannel != NULL){
if( strcmp( cid, (*foundchannel)->cid) == 0)
- return true;
+ return OPJ_TRUE;
*foundchannel = (*foundchannel)->next;
}
fprintf( FCGI_stdout, "Status: 503\r\n");
fprintf( FCGI_stdout, "Reason: Channel %s not found\r\n", cid);
- return false;
+ return OPJ_FALSE;
}
void insert_cachemodel_into_session( session_param_t *session, cachemodel_param_t *cachemodel)
session->cachemodellist->last = cachemodel;
}
-bool delete_session( session_param_t **session, sessionlist_param_t *sessionlist)
+opj_bool delete_session( session_param_t **session, sessionlist_param_t *sessionlist)
{
session_param_t *ptr;
if( *session == NULL)
- return false;
+ return OPJ_FALSE;
if( *session == sessionlist->first)
#endif
opj_free( *session);
- return true;
+ return OPJ_TRUE;
}
void delete_sessionlist( sessionlist_param_t **sessionlist)
#ifndef SESSION_MANAGER_H_
# define SESSION_MANAGER_H_
-#include "bool.h"
#include "channel_manager.h"
#include "cachemodel_manager.h"
* @param[in,out] foundchannel address of the found channel pointer
* @return if the channel is found (true) or not (false)
*/
-bool search_session_and_channel( char cid[],
+opj_bool search_session_and_channel( char cid[],
sessionlist_param_t *sessionlist,
session_param_t **foundsession,
channel_param_t **foundchannel);
* @param[in] sessionlist session list pointer
* @return if succeeded (true) or failed (false)
*/
-bool delete_session( session_param_t **session, sessionlist_param_t *sessionlist);
+opj_bool delete_session( session_param_t **session, sessionlist_param_t *sessionlist);
/**
#ifndef SOCK_MANAGER_H_
# define SOCK_MANAGER_H_
-#include "bool.h"
#include "byte_manager.h"
#include "opj_stdint.h"
target->csn = last_csn++;
target->codeidx = jp2idx;
target->num_of_use = 0;
- target->jppstream = true;
+ target->jppstream = OPJ_TRUE;
target->jptstream = isJPTfeasible( *jp2idx);
target->next=NULL;
#ifndef TARGET_MANAGER_H_
# define TARGET_MANAGER_H_
-#include "bool.h"
#include "index_manager.h"
/** maximum length of target identifier*/
int csn; /**< codestream number */
index_param_t *codeidx; /**< index information of codestream */
int num_of_use; /**< numbers of sessions refering to this target */
- bool jppstream; /**< if this target can return JPP-stream */
- bool jptstream; /**< if this target can return JPP-stream */
+ opj_bool jppstream; /**< if this target can return JPP-stream */
+ opj_bool jptstream; /**< if this target can return JPP-stream */
struct target_param *next; /**< pointer to the next target */
} target_param_t;