Removal of c99 from the compile option (to be compatible to win platform) and bool definition in libopenjpip/bool.h

This commit is contained in:
Kaori Hagihara 2011-05-09 18:11:40 +00:00
parent fb29d47f0c
commit 081178cd9a
21 changed files with 174 additions and 72 deletions

20
applications/jpip/CHANGES Normal file
View File

@ -0,0 +1,20 @@
What's New for OpenJPIP
* : fixed
- : removed
! : changed
+ : added
May 9, 2011
* [kaori] Removal of c99 from the compile option (to be compatible to win platform) and bool definition in libopenjpip/bool.h
May 9, 2011
* [antonin] OpenJPIP: small bug fixes to compile on win platform
May 8, 2011
* [antonin] OpenJPIP: fixed several bugs in opj_server (removal of strsep function, duplication of query string) + some changes to compile opj_server under windows (replacement of strcasecmp(), bzero()).
April 14, 2011
+ [antonin] initial commit of OpenJPIP 1.0, a JPIP client-server architecture based on OpenJPEG (see README file in jpip directory for more details)
* [antonin] fixed applications/codec/CMakeLists.txt that prevented JPWL executables to be built with JPWL functionalities.
! [antonin] changed make all behaviour : DOC target removed from ALL.

View File

@ -0,0 +1,52 @@
/*
* $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_ */

View File

@ -1,8 +1,8 @@
ifdef jpipserver ifdef jpipserver
CFLAGS = -O3 -Wall -std=c99 -pedantic -m32 -DSERVER CFLAGS = -O3 -Wall -m32 -DSERVER
LIBNAME = libopenjpip_server.a LIBNAME = libopenjpip_server.a
else else
CFLAGS = -O3 -Wall -std=c99 -pedantic CFLAGS = -O3 -Wall
LIBNAME = libopenjpip_local.a LIBNAME = libopenjpip_local.a
endif endif

View File

@ -1,5 +1,5 @@
/* /*
* $Id: faixbox_manager.c 44 2011-02-15 12:32:29Z kaori $ * $Id: faixbox_manager.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -59,6 +59,7 @@ faixbox_param_t * gene_faixbox( box_param_t *box)
if( faix->version%2){ if( faix->version%2){
subfaixbox8_param_t *subfaixbox; subfaixbox8_param_t *subfaixbox;
int i;
faix->subfaixbox.byte8_params = (subfaixbox8_param_t *)malloc( sizeof(subfaixbox8_param_t)); faix->subfaixbox.byte8_params = (subfaixbox8_param_t *)malloc( sizeof(subfaixbox8_param_t));
@ -73,7 +74,7 @@ faixbox_param_t * gene_faixbox( box_param_t *box)
if( faix->version == 3) if( faix->version == 3)
subfaixbox->aux = ( Byte4_t *)malloc( numOfelem*sizeof(Byte4_t)); subfaixbox->aux = ( Byte4_t *)malloc( numOfelem*sizeof(Byte4_t));
for( int i=0; i<numOfelem; i++){ for( i=0; i<numOfelem; i++){
subfaixbox->elem[i].off = fetch_DBox8bytebigendian( box, (pos+=8)-8); subfaixbox->elem[i].off = fetch_DBox8bytebigendian( box, (pos+=8)-8);
subfaixbox->elem[i].len = fetch_DBox8bytebigendian( box, (pos+=8)-8); subfaixbox->elem[i].len = fetch_DBox8bytebigendian( box, (pos+=8)-8);
if( faix->version == 3) if( faix->version == 3)
@ -82,6 +83,7 @@ faixbox_param_t * gene_faixbox( box_param_t *box)
} }
else{ else{
subfaixbox4_param_t *subfaixbox; subfaixbox4_param_t *subfaixbox;
int i;
faix->subfaixbox.byte4_params = (subfaixbox4_param_t *)malloc( sizeof(subfaixbox4_param_t)); faix->subfaixbox.byte4_params = (subfaixbox4_param_t *)malloc( sizeof(subfaixbox4_param_t));
@ -96,7 +98,7 @@ faixbox_param_t * gene_faixbox( box_param_t *box)
if( faix->version == 2) if( faix->version == 2)
subfaixbox->aux = ( Byte4_t *)malloc( numOfelem*sizeof(Byte4_t)); subfaixbox->aux = ( Byte4_t *)malloc( numOfelem*sizeof(Byte4_t));
for( int i=0; i<numOfelem; i++){ for( i=0; i<numOfelem; i++){
subfaixbox->elem[i].off = fetch_DBox4bytebigendian( box, (pos+=4)-4); subfaixbox->elem[i].off = fetch_DBox4bytebigendian( box, (pos+=4)-4);
subfaixbox->elem[i].len = fetch_DBox4bytebigendian( box, (pos+=4)-4); subfaixbox->elem[i].len = fetch_DBox4bytebigendian( box, (pos+=4)-4);
if( faix->version == 2) if( faix->version == 2)
@ -108,14 +110,16 @@ faixbox_param_t * gene_faixbox( box_param_t *box)
void print_faixbox( faixbox_param_t *faix) void print_faixbox( faixbox_param_t *faix)
{ {
Byte8_t i, j;
fprintf( logstream, "faix box info\n"); fprintf( logstream, "faix box info\n");
fprintf( logstream, "\tversion: %d\n", faix->version); fprintf( logstream, "\tversion: %d\n", faix->version);
fprintf( logstream, "\t nmax: %#llx = %lld\n", get_nmax( faix), get_nmax( faix)); fprintf( logstream, "\t nmax: %#llx = %lld\n", get_nmax( faix), get_nmax( faix));
fprintf( logstream, "\t m: %#llx = %lld\n", get_m( faix), get_m( faix)); fprintf( logstream, "\t m: %#llx = %lld\n", get_m( faix), get_m( faix));
for( Byte8_t i=0; i<get_m( faix); i++){ for( i=0; i<get_m( faix); i++){
for( Byte8_t j=0; j<get_nmax( faix); j++){ for( j=0; j<get_nmax( faix); j++){
fprintf( logstream, "\t off = %#llx, len = %#llx", get_elemOff( faix, j, i), get_elemLen( faix, j, i)); fprintf( logstream, "\t off = %#llx, len = %#llx", get_elemOff( faix, j, i), get_elemLen( faix, j, i));
if( 2 <= faix->version) if( 2 <= faix->version)
fprintf( logstream, ", aux = %#x", get_elemAux( faix, j, i)); fprintf( logstream, ", aux = %#x", get_elemAux( faix, j, i));

View File

@ -1,5 +1,5 @@
/* /*
* $Id: index_manager.c 44 2011-02-15 12:32:29Z kaori $ * $Id: index_manager.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -28,14 +28,13 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#include <stdbool.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h>
#include <math.h> #include <math.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include "index_manager.h" #include "index_manager.h"
#include "box_manager.h" #include "box_manager.h"
#include "manfbox_manager.h" #include "manfbox_manager.h"
@ -124,6 +123,8 @@ index_param_t * parse_jp2file( int fd)
void print_index( index_param_t index) void print_index( index_param_t index)
{ {
int i;
fprintf( logstream, "index info:\n"); fprintf( logstream, "index info:\n");
fprintf( logstream, "\tCodestream Offset: %#llx\n", index.offset); fprintf( logstream, "\tCodestream Offset: %#llx\n", index.offset);
fprintf( logstream, "\t Length: %#llx\n", index.length); fprintf( logstream, "\t Length: %#llx\n", index.length);
@ -136,7 +137,7 @@ void print_index( index_param_t index)
fprintf( logstream, "\t XTnum, YTnum: (%d,%d)\n", index.XTnum, index.YTnum); fprintf( logstream, "\t XTnum, YTnum: (%d,%d)\n", index.XTnum, index.YTnum);
fprintf( logstream, "\t Num of Components: %d\n", index.Csiz); fprintf( logstream, "\t Num of Components: %d\n", index.Csiz);
for( int i=0; i<index.Csiz; i++) for( i=0; i<index.Csiz; i++)
fprintf( logstream, "\t[%d] (Ssiz, XRsiz, YRsiz): (%d, %d, %d) = (%#x, %#x, %#x)\n", i, index.Ssiz[i], index.XRsiz[i], index.YRsiz[i], index.Ssiz[i], index.XRsiz[i], index.YRsiz[i]); fprintf( logstream, "\t[%d] (Ssiz, XRsiz, YRsiz): (%d, %d, %d) = (%#x, %#x, %#x)\n", i, index.Ssiz[i], index.XRsiz[i], index.YRsiz[i], index.Ssiz[i], index.XRsiz[i], index.YRsiz[i]);
print_faixbox( index.tilepart); print_faixbox( index.tilepart);
@ -147,15 +148,16 @@ void print_index( index_param_t index)
void print_cachemodel( index_param_t index) void print_cachemodel( index_param_t index)
{ {
Byte8_t TPnum; // num of tile parts in each tile Byte8_t TPnum; // num of tile parts in each tile
int i, j, k, n;
TPnum = get_nmax( index.tilepart); TPnum = get_nmax( index.tilepart);
fprintf( logstream, "\t main header model: %d\n", index.mhead_model); fprintf( logstream, "\t main header model: %d\n", index.mhead_model);
fprintf( logstream, "\t tile part model:\n"); fprintf( logstream, "\t tile part model:\n");
for( int i=0, n=0; i<index.YTnum; i++){ for( i=0, n=0; i<index.YTnum; i++){
for( int j=0; j<index.XTnum; j++){ for( j=0; j<index.XTnum; j++){
for( int k=0; k<TPnum; k++) for( k=0; k<TPnum; k++)
fprintf( logstream, "%d", index.tp_model[n++]); fprintf( logstream, "%d", index.tp_model[n++]);
fprintf( logstream, " "); fprintf( logstream, " ");
} }
@ -395,7 +397,7 @@ bool set_tpixdata( box_param_t *cidx_box, index_param_t *jp2idx)
numOfelem = get_nmax( faix)*get_m( faix); numOfelem = get_nmax( faix)*get_m( faix);
jp2idx->tp_model = (bool *)malloc( numOfelem*sizeof(bool)); jp2idx->tp_model = (bool *)malloc( numOfelem*sizeof(bool));
bzero( jp2idx->tp_model, numOfelem*sizeof(bool)); memset( jp2idx->tp_model, 0, numOfelem*sizeof(bool));
//delete_faixbox( &faix); // currently the jp2idx element //delete_faixbox( &faix); // currently the jp2idx element
free( tpix_box); free( tpix_box);
@ -447,6 +449,7 @@ bool set_thixdata( box_param_t *cidx_box, index_param_t *jp2idx)
bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, index_param_t *jp2idx) bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream, index_param_t *jp2idx)
{ {
marker_param_t sizmkr; marker_param_t sizmkr;
int i;
sizmkr = set_marker( codestream, sizmkidx->code, sizmkidx->offset, sizmkidx->length); sizmkr = set_marker( codestream, sizmkidx->code, sizmkidx->offset, sizmkidx->length);
@ -469,7 +472,7 @@ bool set_SIZmkrdata( markeridx_param_t *sizmkidx, codestream_param_t codestream,
jp2idx->XTnum = ( jp2idx->Xsiz-jp2idx->XTOsiz+jp2idx->XTsiz-1)/jp2idx->XTsiz; jp2idx->XTnum = ( jp2idx->Xsiz-jp2idx->XTOsiz+jp2idx->XTsiz-1)/jp2idx->XTsiz;
jp2idx->YTnum = ( jp2idx->Ysiz-jp2idx->YTOsiz+jp2idx->YTsiz-1)/jp2idx->YTsiz; jp2idx->YTnum = ( jp2idx->Ysiz-jp2idx->YTOsiz+jp2idx->YTsiz-1)/jp2idx->YTsiz;
for( int i=0; i<(int)jp2idx->Csiz; i++){ for( i=0; i<(int)jp2idx->Csiz; i++){
jp2idx->Ssiz[i] = fetch_marker1byte( sizmkr, 38+i*3); jp2idx->Ssiz[i] = fetch_marker1byte( sizmkr, 38+i*3);
jp2idx->XRsiz[i] = fetch_marker1byte( sizmkr, 39+i*3); jp2idx->XRsiz[i] = fetch_marker1byte( sizmkr, 39+i*3);
jp2idx->YRsiz[i] = fetch_marker1byte( sizmkr, 40+i*3); jp2idx->YRsiz[i] = fetch_marker1byte( sizmkr, 40+i*3);
@ -496,11 +499,12 @@ range_param_t get_tile_Yrange( index_param_t index, Byte4_t tile_yid, int level)
range_param_t get_tile_range( Byte4_t Osiz, Byte4_t siz, Byte4_t TOsiz, Byte4_t Tsiz, Byte4_t tile_id, int level) range_param_t get_tile_range( Byte4_t Osiz, Byte4_t siz, Byte4_t TOsiz, Byte4_t Tsiz, Byte4_t tile_id, int level)
{ {
range_param_t range; range_param_t range;
int n;
range.minvalue = max( Osiz, TOsiz+tile_id*Tsiz); range.minvalue = max( Osiz, TOsiz+tile_id*Tsiz);
range.maxvalue = min( siz, TOsiz+(tile_id+1)*Tsiz); range.maxvalue = min( siz, TOsiz+(tile_id+1)*Tsiz);
for( int n=0; n<level; n++){ for( n=0; n<level; n++){
range.minvalue = ceil(range.minvalue/2.0); range.minvalue = ceil(range.minvalue/2.0);
range.maxvalue = ceil(range.maxvalue/2.0); range.maxvalue = ceil(range.maxvalue/2.0);
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: index_manager.h 44 2011-02-15 12:32:29Z kaori $ * $Id: index_manager.h 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -32,7 +32,7 @@
# define INDEX_MANAGER_H_ # define INDEX_MANAGER_H_
#include <stdio.h> #include <stdio.h>
#include <stdbool.h> #include "bool.h"
#include "byte_manager.h" #include "byte_manager.h"
#include "faixbox_manager.h" #include "faixbox_manager.h"
#include "metadata_manager.h" #include "metadata_manager.h"

View File

@ -1,5 +1,5 @@
/* /*
* $Id: metadata_manager.c 44 2011-02-15 12:32:29Z kaori $ * $Id: metadata_manager.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -218,8 +218,9 @@ metadata_param_t * search_metadata( int idx, metadatalist_param_t *list)
int search_metadataidx( char boxtype[4], metadatalist_param_t *list) int search_metadataidx( char boxtype[4], metadatalist_param_t *list)
{ {
metadata_param_t *ptr; metadata_param_t *ptr;
int i;
for( int i=0; i<4; i++) for( i=0; i<4; i++)
if( boxtype[i] == '_') if( boxtype[i] == '_')
boxtype[i] = ' '; boxtype[i] = ' ';

View File

@ -1,5 +1,5 @@
/* /*
* $Id: msgqueue_manager.c 44 2011-02-15 12:32:29Z kaori $ * $Id: msgqueue_manager.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -154,6 +154,7 @@ void enqueue_tile( int tile_id, int level, msgqueue_param_t *msgqueue)
faixbox_param_t *tilepart; faixbox_param_t *tilepart;
message_param_t *msg; message_param_t *msg;
Byte8_t binOffset, binLength; Byte8_t binOffset, binLength;
int i;
target = msgqueue->target; target = msgqueue->target;
codeidx = target->codeidx; codeidx = target->codeidx;
@ -170,7 +171,7 @@ void enqueue_tile( int tile_id, int level, msgqueue_param_t *msgqueue)
tp_model = &codeidx->tp_model[ tile_id*numOftparts]; tp_model = &codeidx->tp_model[ tile_id*numOftparts];
binOffset=0; binOffset=0;
for( int i=0; i<numOftparts-level; i++){ for( i=0; i<numOftparts-level; i++){
binLength = get_elemLen( tilepart, i, tile_id); binLength = get_elemLen( tilepart, i, tile_id);
if( !tp_model[i]){ if( !tp_model[i]){
@ -466,15 +467,16 @@ void emit_bigendian_bytes( Byte8_t code, int bytelength)
void print_binarycode( Byte8_t n, int segmentlen) void print_binarycode( Byte8_t n, int segmentlen)
{ {
char buf[256]; char buf[256];
int i=0; int i=0, j, k;
do{ do{
buf[i++] = n%2 ? '1' : '0'; buf[i++] = n%2 ? '1' : '0';
}while((n=n/2)); }while((n=n/2));
for( int j=segmentlen-1; j>=i; j--) for( j=segmentlen-1; j>=i; j--)
putchar('0'); putchar('0');
for( int j=i-1, k=0; j>=0; j--, k++){ for( j=i-1, k=0; j>=0; j--, k++){
putchar( buf[j]); putchar( buf[j]);
if( !((k+1)%segmentlen)) if( !((k+1)%segmentlen))
printf(" "); printf(" ");
@ -721,6 +723,7 @@ Byte_t * recons_codestream( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t
message_param_t *ptr; message_param_t *ptr;
Byte_t *codestream = NULL; Byte_t *codestream = NULL;
int last_tileID; int last_tileID;
int tileID;
*codelen = 0; *codelen = 0;
@ -733,7 +736,7 @@ Byte_t * recons_codestream( msgqueue_param_t *msgqueue, Byte_t *stream, Byte8_t
last_tileID = get_last_tileID( msgqueue, csn); last_tileID = get_last_tileID( msgqueue, csn);
for( int tileID=0; tileID <= last_tileID; tileID++){ for( tileID=0; tileID <= last_tileID; tileID++){
bool found = false; bool found = false;
ptr = msgqueue->first; ptr = msgqueue->first;
while(( ptr = search_message( TILE_MSG, tileID, csn, ptr))!=NULL){ while(( ptr = search_message( TILE_MSG, tileID, csn, ptr))!=NULL){

View File

@ -1,5 +1,5 @@
/* /*
* $Id: msgqueue_manager.h 44 2011-02-15 12:32:29Z kaori $ * $Id: msgqueue_manager.h 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -31,8 +31,8 @@
#ifndef MSGQUEUE_MANAGER_H_ #ifndef MSGQUEUE_MANAGER_H_
# define MSGQUEUE_MANAGER_H_ # define MSGQUEUE_MANAGER_H_
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include "bool.h"
#include "byte_manager.h" #include "byte_manager.h"
#include "target_manager.h" #include "target_manager.h"
#include "placeholder_manager.h" #include "placeholder_manager.h"

View File

@ -1,5 +1,5 @@
/* /*
* $Id: placeholder_manager.c 44 2011-02-15 12:32:29Z kaori $ * $Id: placeholder_manager.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -108,16 +108,20 @@ void insert_placeholder_into_list( placeholder_param_t *phld, placeholderlist_pa
void print_placeholder( placeholder_param_t *phld) void print_placeholder( placeholder_param_t *phld)
{ {
int i;
fprintf( logstream, "placeholder info:\n"); fprintf( logstream, "placeholder info:\n");
fprintf( logstream, "\t LBox: %d %#x\n", phld->LBox, phld->LBox); fprintf( logstream, "\t LBox: %d %#x\n", phld->LBox, phld->LBox);
fprintf( logstream, "\t TBox: %.4s\n", phld->TBox); fprintf( logstream, "\t TBox: %.4s\n", phld->TBox);
fprintf( logstream, "\t Flags: %#x %#x\n", phld->Flags, phld->Flags); fprintf( logstream, "\t Flags: %#x %#x\n", phld->Flags, phld->Flags);
fprintf( logstream, "\t OrigID: %lld\n", phld->OrigID); fprintf( logstream, "\t OrigID: %lld\n", phld->OrigID);
fprintf( logstream, "\t OrigBH: "); fprintf( logstream, "\t OrigBH: ");
for( int i=0; i< phld->OrigBHlen; i++)
for( i=0; i< phld->OrigBHlen; i++)
fprintf( logstream, "%02x ", phld->OrigBH[i]); fprintf( logstream, "%02x ", phld->OrigBH[i]);
fprintf( logstream, "\t"); fprintf( logstream, "\t");
for( int i=0; i< phld->OrigBHlen; i++)
for( i=0; i< phld->OrigBHlen; i++)
fprintf( logstream, "%c", phld->OrigBH[i]); fprintf( logstream, "%c", phld->OrigBH[i]);
fprintf( logstream, "\n"); fprintf( logstream, "\n");
} }

View File

@ -1,6 +1,6 @@
LIBDIR = ../../libopenjpip LIBDIR = ../../libopenjpip
LIBFNAME = $(LIBDIR)/libopenjpip_local.a LIBFNAME = $(LIBDIR)/libopenjpip_local.a
CFLAGS = -O3 -Wall -std=c99 -pedantic -I$(LIBDIR) CFLAGS = -O3 -Wall -I$(LIBDIR)
LDFLAGS = -L$(LIBDIR) -lm -lopenjpeg -lopenjpip_local LDFLAGS = -L$(LIBDIR) -lm -lopenjpeg -lopenjpip_local

View File

@ -1,5 +1,5 @@
/* /*
* $Id: cache_manager.c 44 2011-02-15 12:32:29Z kaori $ * $Id: cache_manager.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -85,11 +85,13 @@ cache_param_t * gene_cache( char *targetname, int csn, char *cid)
void delete_cache( cache_param_t **cache) void delete_cache( cache_param_t **cache)
{ {
int i;
delete_metadatalist( &(*cache)->metadatalist); delete_metadatalist( &(*cache)->metadatalist);
if((*cache)->ihdrbox) if((*cache)->ihdrbox)
free((*cache)->ihdrbox); free((*cache)->ihdrbox);
for( int i=0; i<(*cache)->numOfcid; i++) for( i=0; i<(*cache)->numOfcid; i++)
free( (*cache)->cid[i]); free( (*cache)->cid[i]);
free( (*cache)->cid); free( (*cache)->cid);
free( *cache); free( *cache);
@ -138,11 +140,12 @@ cache_param_t * search_cacheBycsn( int csn, cachelist_param_t *cachelist)
cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist) cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist)
{ {
cache_param_t *foundcache; cache_param_t *foundcache;
int i;
foundcache = cachelist->first; foundcache = cachelist->first;
while( foundcache != NULL){ while( foundcache != NULL){
for( int i=0; i<foundcache->numOfcid; i++) for( i=0; i<foundcache->numOfcid; i++)
if( strcmp( cid, foundcache->cid[i]) == 0) if( strcmp( cid, foundcache->cid[i]) == 0)
return foundcache; return foundcache;
foundcache = foundcache->next; foundcache = foundcache->next;
@ -153,12 +156,13 @@ cache_param_t * search_cacheBycid( char cid[], cachelist_param_t *cachelist)
void add_cachecid( char *cid, cache_param_t *cache) void add_cachecid( char *cid, cache_param_t *cache)
{ {
char **tmp; char **tmp;
int i;
tmp = cache->cid; tmp = cache->cid;
cache->cid = (char **)malloc( (cache->numOfcid+1)*sizeof(char *)); cache->cid = (char **)malloc( (cache->numOfcid+1)*sizeof(char *));
for( int i=0; i<cache->numOfcid; i++){ for( i=0; i<cache->numOfcid; i++){
cache->cid[i] = (char *)malloc( MAX_LENOFCID); cache->cid[i] = (char *)malloc( MAX_LENOFCID);
strcpy( cache->cid[i], tmp[i]); strcpy( cache->cid[i], tmp[i]);
free( tmp[i]); free( tmp[i]);
@ -185,8 +189,9 @@ void remove_cidInCache( char *cid, cache_param_t *cache)
{ {
int idx = -1; int idx = -1;
char **tmp; char **tmp;
int i, j;
for( int i=0; i<cache->numOfcid; i++) for( i=0; i<cache->numOfcid; i++)
if( strcmp( cid, cache->cid[i]) == 0){ if( strcmp( cid, cache->cid[i]) == 0){
idx = i; idx = i;
break; break;
@ -201,7 +206,7 @@ void remove_cidInCache( char *cid, cache_param_t *cache)
cache->cid = (char **)malloc( (cache->numOfcid-1)*sizeof(char *)); cache->cid = (char **)malloc( (cache->numOfcid-1)*sizeof(char *));
for( int i=0, j=0; i<cache->numOfcid; i++){ for( i=0, j=0; i<cache->numOfcid; i++){
if( i != idx){ if( i != idx){
cache->cid[j] = (char *)malloc( MAX_LENOFCID); cache->cid[j] = (char *)malloc( MAX_LENOFCID);
strcpy( cache->cid[j], tmp[i]); strcpy( cache->cid[j], tmp[i]);
@ -216,11 +221,14 @@ void remove_cidInCache( char *cid, cache_param_t *cache)
void print_cache( cache_param_t *cache) void print_cache( cache_param_t *cache)
{ {
int i;
fprintf( stdout,"cache\n"); fprintf( stdout,"cache\n");
fprintf( stdout,"\t filename: %s\n", cache->filename); fprintf( stdout,"\t filename: %s\n", cache->filename);
fprintf( stdout,"\t csn: %d\n", cache->csn); fprintf( stdout,"\t csn: %d\n", cache->csn);
fprintf( stdout,"\t cid:"); fprintf( stdout,"\t cid:");
for( int i=0; i<cache->numOfcid; i++)
for( i=0; i<cache->numOfcid; i++)
fprintf( stdout," %s", cache->cid[i]); fprintf( stdout," %s", cache->cid[i]);
fprintf( stdout,"\n"); fprintf( stdout,"\n");
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: imgsock_manager.c 44 2011-02-15 12:32:29Z kaori $ * $Id: imgsock_manager.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -28,9 +28,15 @@
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifdef _WIN32
#include <windows.h>
#define strcasecmp _stricmp
#else
#include <strings.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <strings.h>
#include <stdlib.h> #include <stdlib.h>
#include <netdb.h> #include <netdb.h>
#include <sys/types.h> #include <sys/types.h>
@ -86,6 +92,7 @@ msgtype_t identify_clientmsg( int connected_socket)
int read_size; int read_size;
char buf[BUF_LEN]; char buf[BUF_LEN];
char *magicid[] = { "JPT-stream", "PNM request", "XML request", "CID request", "CID destroy", "JP2 save", "QUIT"}; char *magicid[] = { "JPT-stream", "PNM request", "XML request", "CID request", "CID destroy", "JP2 save", "QUIT"};
int i;
read_size = read_line( connected_socket, buf); read_size = read_line( connected_socket, buf);
@ -94,7 +101,7 @@ msgtype_t identify_clientmsg( int connected_socket)
return ERROR; return ERROR;
} }
for( int i=0; i<NUM_OF_MSGTYPES; i++){ for( i=0; i<NUM_OF_MSGTYPES; i++){
if( strncasecmp( magicid[i], buf, strlen(magicid[i])) == 0){ if( strncasecmp( magicid[i], buf, strlen(magicid[i])) == 0){
printf("Client message: %s\n", magicid[i]); printf("Client message: %s\n", magicid[i]);
return i; return i;
@ -207,7 +214,7 @@ void send_PNMstream( int connected_socket, Byte_t *pnmstream, unsigned int width
void send_stream( int connected_socket, void *stream, int length) void send_stream( int connected_socket, void *stream, int length)
{ {
Byte_t *ptr = (Byte_t*)stream; void *ptr = stream;
int remlen = length; int remlen = length;
while( remlen > 0){ while( remlen > 0){

View File

@ -1,5 +1,5 @@
/* /*
* $Id: imgsock_manager.h 44 2011-02-15 12:32:29Z kaori $ * $Id: imgsock_manager.h 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -31,7 +31,7 @@
#ifndef IMGSOCK_MANAGER_H_ #ifndef IMGSOCK_MANAGER_H_
# define IMGSOCK_MANAGER_H_ # define IMGSOCK_MANAGER_H_
#include <stdbool.h> #include "bool.h"
#include "byte_manager.h" #include "byte_manager.h"
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* $Id: jp2k_decoder.c 44 2011-02-15 12:32:29Z kaori $ * $Id: jp2k_decoder.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -129,6 +129,7 @@ Byte_t * imagetopnm(opj_image_t *image, ihdrbox_param_t **ihdrbox)
int adjustR, adjustG=0, adjustB=0; int adjustR, adjustG=0, adjustB=0;
int datasize; int datasize;
Byte_t *pix=NULL, *ptr=NULL; Byte_t *pix=NULL, *ptr=NULL;
int i;
if(*ihdrbox){ if(*ihdrbox){
if( (*ihdrbox)->nc != image->numcomps) if( (*ihdrbox)->nc != image->numcomps)
@ -179,7 +180,7 @@ Byte_t * imagetopnm(opj_image_t *image, ihdrbox_param_t **ihdrbox)
pix = (Byte_t *)malloc( datasize); pix = (Byte_t *)malloc( datasize);
ptr = pix; ptr = pix;
for( int i = 0; i < image->comps[0].w * image->comps[0].h; i++){ for( i = 0; i < image->comps[0].w * image->comps[0].h; i++){
int r, g, b; int r, g, b;
r = image->comps[0].data[i]; r = image->comps[0].data[i];
r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0); r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);

View File

@ -1,6 +1,6 @@
LIBDIR = ../libopenjpip LIBDIR = ../libopenjpip
LIBFNAME = $(LIBDIR)/libopenjpip_server.a LIBFNAME = $(LIBDIR)/libopenjpip_server.a
CFLAGS = -O3 -Wall -std=c99 -pedantic -m32 -DSERVER -I$(LIBDIR) CFLAGS = -O3 -Wall -m32 -DSERVER -I$(LIBDIR)
LDFLAGS = -L$(LIBDIR) -lm -lfcgi -lopenjpip_server LDFLAGS = -L$(LIBDIR) -lm -lfcgi -lopenjpip_server
ALL = opj_server ALL = opj_server

View File

@ -1,5 +1,5 @@
/* /*
* $Id: opj_server.c 46 2011-02-17 14:50:55Z kaori $ * $Id: opj_server.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -373,6 +373,7 @@ void enqueue_tiles( query_param_t query_param, index_param_t *codeidx, msgqueue_
{ {
imgreg_param_t imgreg; imgreg_param_t imgreg;
range_param_t tile_Xrange, tile_Yrange; range_param_t tile_Xrange, tile_Yrange;
int u, v, tile_id;
imgreg = map_viewin2imgreg( query_param.fx, query_param.fy, imgreg = map_viewin2imgreg( query_param.fx, query_param.fy,
query_param.rx, query_param.ry, query_param.rw, query_param.rh, query_param.rx, query_param.ry, query_param.rw, query_param.rh,
@ -380,10 +381,10 @@ void enqueue_tiles( query_param_t query_param, index_param_t *codeidx, msgqueue_
get_nmax( codeidx->tilepart)); get_nmax( codeidx->tilepart));
for( int u=0, tile_id=0; u<codeidx->YTnum; u++){ for( u=0, tile_id=0; u<codeidx->YTnum; u++){
tile_Yrange = get_tile_Yrange( *codeidx, u, imgreg.level); tile_Yrange = get_tile_Yrange( *codeidx, u, imgreg.level);
for( int v=0; v<codeidx->XTnum; v++, tile_id++){ for( v=0; v<codeidx->XTnum; v++, tile_id++){
tile_Xrange = get_tile_Xrange( *codeidx, v, imgreg.level); tile_Xrange = get_tile_Xrange( *codeidx, v, imgreg.level);
if( tile_Xrange.minvalue < tile_Xrange.maxvalue && tile_Yrange.minvalue < tile_Yrange.maxvalue){ if( tile_Xrange.minvalue < tile_Xrange.maxvalue && tile_Yrange.minvalue < tile_Yrange.maxvalue){
@ -416,7 +417,8 @@ void enqueue_tiles( query_param_t query_param, index_param_t *codeidx, msgqueue_
void enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue) void enqueue_metabins( query_param_t query_param, metadatalist_param_t *metadatalist, msgqueue_param_t *msgqueue)
{ {
for( int i=0; query_param.box_type[i][0]!=0 && i<MAX_NUMOFBOX; i++){ int i;
for( i=0; query_param.box_type[i][0]!=0 && i<MAX_NUMOFBOX; i++){
if( query_param.box_type[i][0] == '*'){ if( query_param.box_type[i][0] == '*'){
// not implemented // not implemented
} }

View File

@ -1,5 +1,5 @@
/* /*
* $Id: query_parser.c 44 2011-02-15 12:32:29Z kaori $ * $Id: query_parser.c 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -27,18 +27,19 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _WIN32
#include <strings.h>
#endif
#include <stdio.h>
#include <string.h>
#include "query_parser.h"
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#define strcasecmp _stricmp #define strcasecmp _stricmp
#else
#include <strings.h>
#endif #endif
#include <stdio.h>
#include <string.h>
#include "query_parser.h"
#ifdef SERVER #ifdef SERVER
#include "fcgi_stdio.h" #include "fcgi_stdio.h"
#define logstream FCGI_stdout #define logstream FCGI_stdout
@ -205,6 +206,7 @@ void print_queryparam( query_param_t query_param)
void str2cclose( char *src, char cclose[][MAX_LENOFCID]) void str2cclose( char *src, char cclose[][MAX_LENOFCID])
{ {
int i, u, v; int i, u, v;
size_t len = strlen( src); size_t len = strlen( src);
for( i=0, u=0, v=0; i<len; i++){ for( i=0, u=0, v=0; i<len; i++){

View File

@ -1,5 +1,5 @@
/* /*
* $Id: query_parser.h 44 2011-02-15 12:32:29Z kaori $ * $Id: query_parser.h 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -31,13 +31,7 @@
#ifndef QUERY_PARSER_H_ #ifndef QUERY_PARSER_H_
# define QUERY_PARSER_H_ # define QUERY_PARSER_H_
#ifdef _WIN32 #include "bool.h"
#define bool int
#define true 1
#define false 0
#else
#include <stdbool.h>
#endif
//! maximum length of target name //! maximum length of target name
#define MAX_LENOFTARGET 128 #define MAX_LENOFTARGET 128

View File

@ -1,5 +1,5 @@
/* /*
* $Id: session_manager.h 44 2011-02-15 12:32:29Z kaori $ * $Id: session_manager.h 53 2011-05-09 16:55:39Z kaori $
* *
* Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium
* Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2002-2011, Professor Benoit Macq
@ -31,7 +31,7 @@
#ifndef SESSION_MANAGER_H_ #ifndef SESSION_MANAGER_H_
# define SESSION_MANAGER_H_ # define SESSION_MANAGER_H_
#include <stdbool.h> #include "bool.h"
#include "channel_manager.h" #include "channel_manager.h"
#include "target_manager.h" #include "target_manager.h"

View File

@ -1,6 +1,6 @@
LIBDIR = ../libopenjpip LIBDIR = ../libopenjpip
LIBFNAME = $(LIBDIR)/libopenjpip_local.a LIBFNAME = $(LIBDIR)/libopenjpip_local.a
CFLAGS = -O3 -Wall -std=c99 -pedantic -I$(LIBDIR) CFLAGS = -O3 -Wall -I$(LIBDIR)
LDFLAGS = -L$(LIBDIR) -lm -lopenjpip_local LDFLAGS = -L$(LIBDIR) -lm -lopenjpip_local
ALL = jpt_to_jp2 jpt_to_j2k test_index addXMLinJP2 ALL = jpt_to_jp2 jpt_to_j2k test_index addXMLinJP2