patches for cmake and autotool are applied

This commit is contained in:
Kaori Hagihara 2011-10-25 21:10:48 +00:00
parent f1c8dd887b
commit 8d7073abf6
20 changed files with 218 additions and 285 deletions

View File

@ -5,6 +5,9 @@ What's New for OpenJPIP
! : changed
+ : added
October 25, 2011
* [kaori] patches for cmake and autotool are applied
October 20, 2011
+ [added] API style in openJPIP library
! [kaori] rearranged directories, applications are all under util/ directory, currently only 'make -f Makefile.nix' works

View File

@ -1,5 +1,3 @@
ADD_SUBDIRECTORY(libopenjpip)
ADD_SUBDIRECTORY(opj_server)
ADD_SUBDIRECTORY(opj_client)
ADD_SUBDIRECTORY(tools)
ADD_SUBDIRECTORY(util)

View File

@ -1,3 +1,3 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = libopenjpip opj_server opj_client tools
SUBDIRS = libopenjpip util

View File

@ -24,10 +24,23 @@ ${CMAKE_CURRENT_SOURCE_DIR}/target_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/cachemodel_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/j2kheader_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_encoder.c
${CMAKE_CURRENT_SOURCE_DIR}/openjpip.c
${CMAKE_CURRENT_SOURCE_DIR}/query_parser.c
${CMAKE_CURRENT_SOURCE_DIR}/channel_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/session_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jpip_parser.c
)
SET(LOCAL_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_decoder.c
${CMAKE_CURRENT_SOURCE_DIR}/imgsock_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jpipstream_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/cache_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/dec_clientmsg_handler.c
)
# Build the library
ADD_LIBRARY(openjpip_local STATIC ${OPENJPIP_SRCS})
ADD_LIBRARY(openjpip_local STATIC ${OPENJPIP_SRCS} ${LOCAL_SRCS})
ADD_LIBRARY(openjpip_server STATIC ${OPENJPIP_SRCS})
TARGET_LINK_LIBRARIES(openjpip_server ${FCGI_LIBNAME})
@ -36,12 +49,12 @@ SET_TARGET_PROPERTIES(openjpip_server
# Install library
INSTALL(TARGETS openjpip_local
INSTALL(TARGETS openjpip_local
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
)
INSTALL(TARGETS openjpip_server
INSTALL(TARGETS openjpip_server
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} COMPONENT Libraries
)
)

View File

@ -6,6 +6,11 @@ includes_HEADERS =
lib_LTLIBRARIES = libopenjpip_server.la libopenjpip_local.la
JPIP_SRC = \
openjpip.c \
query_parser.c \
channel_manager.c \
session_manager.c \
jpip_parser.c \
boxheader_manager.c \
codestream_manager.c \
imgreg_manager.c \
@ -42,7 +47,21 @@ placeholder_manager.h \
target_manager.h \
cachemodel_manager.h \
j2kheader_manager.h \
jp2k_encoder.h
jp2k_encoder.h \
query_parser.h \
channel_manager.h \
session_manager.h \
jpip_parser.h
LOCAL_SRC = jp2k_decoder.c \
imgsock_manager.c \
jpipstream_manager.c \
cache_manager.c \
dec_clientmsg_handler.c \
imgsock_manager.h \
jpipstream_manager.h \
cache_manager.h \
dec_clientmsg_handler.h
libopenjpip_server_la_CPPFLAGS = \
-I. \
@ -62,7 +81,7 @@ libopenjpip_local_la_CPPFLAGS = \
libopenjpip_local_la_CFLAGS =
libopenjpip_local_la_LIBADD = -lm
libopenjpip_local_la_LDFLAGS = -no-undefined -version-info @lt_version@
libopenjpip_local_la_SOURCES = $(JPIP_SRC)
libopenjpip_local_la_SOURCES = $(JPIP_SRC) $(LOCAL_SRC)
install-data-hook:
@echo -e " (LA)\t$(libdir)/libopenjpip_server.la" >> $(top_builddir)/report.txt

View File

@ -1 +0,0 @@
ADD_SUBDIRECTORY(opj_dec_server)

View File

@ -1,3 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = opj_dec_server

View File

@ -1,29 +0,0 @@
SET(OPJ_DEC_SERVER_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/cache_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/opj_dec_server.c
${CMAKE_CURRENT_SOURCE_DIR}/jp2k_decoder.c
${CMAKE_CURRENT_SOURCE_DIR}/imgsock_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/jpipstream_manager.c
${CMAKE_CURRENT_SOURCE_DIR}/dec_clientmsg_handler.c
)
INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/libopenjpeg
${OPENJPEG_SOURCE_DIR}/applications/jpip/libopenjpip
)
# Build executable
ADD_EXECUTABLE(opj_dec_server ${OPJ_DEC_SERVER_SRCS})
TARGET_LINK_LIBRARIES(opj_dec_server openjpip_local ${OPENJPEG_LIBRARY_NAME})
# On unix you need to link to the math library:
IF(UNIX)
TARGET_LINK_LIBRARIES(opj_dec_server m)
ENDIF(UNIX)
# Install exe
INSTALL(TARGETS opj_dec_server
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)

View File

@ -1,32 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
bin_PROGRAMS = opj_dec_server
opj_dec_server_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/opj_server \
-I$(top_builddir)/applications/jpip/opj_server \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip \
-I$(top_srcdir)/libopenjpeg \
-I$(top_builddir)/libopenjpeg \
@FCGI_CFLAGS@ \
-DSERVER
opj_dec_server_CFLAGS =
opj_dec_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_server.la $(top_builddir)/libopenjpeg/libopenjpeg.la @FCGI_LIBS@ -lm
opj_dec_server_SOURCES = \
cache_manager.c \
cache_manager.h \
imgsock_manager.c \
imgsock_manager.h \
jp2k_decoder.c \
dec_clientmsg_handler.c \
dec_clientmsg_handler.h \
jp2k_decoder.h \
jpipstream_manager.c \
jpipstream_manager.h \
opj_dec_server.c
install-data-hook:
@echo -e " (B)\t$(bindir)/opj_dec_server$(EXEEXT)" >> $(top_builddir)/report.txt

View File

@ -1,17 +0,0 @@
J2KINCDIR = ../../../../libopenjpeg
J2KLIBDIR = $(J2KINCDIR)/.libs
JPIPLIBDIR = ../../libopenjpip
LIBFNAME = $(JPIPLIBDIR)/libopenjpip_local.a $(J2KLIBDIR)/libopenjpeg.a
CFLAGS = -O3 -Wall -I$(JPIPLIBDIR)
LDFLAGS = -L$(JPIPLIBDIR) -L$(J2KLIBDIR) -lm -lopenjpip_local
#-lws2_32
ALL = opj_dec_server
all: $(ALL)
opj_dec_server: opj_dec_server.o $(LIBFNAME)
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LIBFNAME) -o $@
clean:
rm -f $(ALL) *.o *~

View File

@ -1,26 +0,0 @@
# Headers file are located here:
INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/applications/jpip/libopenjpip
${FCGI_INCLUDE_DIRNAME}
)
SET(OPJ_SERVER_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/opj_server.c
)
# Build executable
ADD_DEFINITIONS(-DSERVER)
ADD_EXECUTABLE(opj_server ${OPJ_SERVER_SRCS})
TARGET_LINK_LIBRARIES(opj_server openjpip_server ${FCGI_LIBNAME})
# On unix you need to link to the math library:
IF(UNIX)
TARGET_LINK_LIBRARIES(opj_server m)
ENDIF(UNIX)
# Install exe
INSTALL(TARGETS opj_server
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)

View File

@ -1,20 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
bin_PROGRAMS = opj_server
opj_server_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/opj_server \
-I$(top_builddir)/applications/jpip/opj_server \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip \
@FCGI_CFLAGS@ \
-DSERVER \
-DQUIT_SIGNAL=\"quitJPIP\"
opj_server_CFLAGS =
opj_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_server.la @FCGI_LIBS@ -lm
opj_server_SOURCES = \
opj_server.c
install-data-hook:
@echo -e " (B)\t$(bindir)/opj_server$(EXEEXT)" >> $(top_builddir)/report.txt

View File

@ -1,37 +0,0 @@
INCLUDE_DIRECTORIES(
../libopenjpip
)
ADD_EXECUTABLE(jpip_to_j2k jpip_to_j2k.c)
TARGET_LINK_LIBRARIES(jpip_to_j2k openjpip_local)
IF(UNIX)
TARGET_LINK_LIBRARIES(jpip_to_j2k m)
ENDIF(UNIX)
# Install exe
INSTALL(TARGETS jpip_to_j2k
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
ADD_EXECUTABLE(jpip_to_jp2 jpip_to_jp2.c)
TARGET_LINK_LIBRARIES(jpip_to_jp2 openjpip_local)
IF(UNIX)
TARGET_LINK_LIBRARIES(jpip_to_jp2 m)
ENDIF(UNIX)
# Install exe
INSTALL(TARGETS jpip_to_jp2
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
ADD_EXECUTABLE(test_index test_index.c)
TARGET_LINK_LIBRARIES(test_index openjpip_local)
IF(UNIX)
TARGET_LINK_LIBRARIES(test_index m)
ENDIF(UNIX)
# Install exe
INSTALL(TARGETS test_index
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)

View File

@ -1,47 +0,0 @@
MAINTAINERCLEANFILES = Makefile.in
bin_PROGRAMS = jpip_to_jp2 jpip_to_j2k test_index addXMLinJP2
jpip_to_jp2_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip \
-I$(top_srcdir)/applications/jpip/libopenjpip/tools \
-I$(top_builddir)/applications/jpip/libopenjpip/tools
jpip_to_jp2_CFLAGS =
jpip_to_jp2_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
jpip_to_jp2_SOURCES = jpip_to_jp2.c
jpip_to_j2k_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip \
-I$(top_srcdir)/applications/jpip/libopenjpip/tools \
-I$(top_builddir)/applications/jpip/libopenjpip/tools
jpip_to_j2k_CFLAGS =
jpip_to_j2k_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
jpip_to_j2k_SOURCES = jpip_to_j2k.c
test_index_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip \
-I$(top_srcdir)/applications/jpip/libopenjpip/tools \
-I$(top_builddir)/applications/jpip/libopenjpip/tools
test_index_CFLAGS =
test_index_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
test_index_SOURCES = test_index.c
addXMLinJP2_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip/tools \
-I$(top_builddir)/applications/jpip/libopenjpip/tools
addXMLinJP2_CFLAGS =
addXMLinJP2_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la
addXMLinJP2_SOURCES = addXMLinJP2.c
install-data-hook:
@echo -e " (B)\t$(bindir)/jpip_to_jp2$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/jpip_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/test_index$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/addXMLinJP2$(EXEEXT)" >> $(top_builddir)/report.txt

View File

@ -1,22 +0,0 @@
J2KINCDIR = ../../../libopenjpeg
J2KLIBDIR = $(J2KINCDIR)/.libs
LIBDIR = ../libopenjpip
LIBFNAME = $(LIBDIR)/libopenjpip_local.a $(J2KLIBDIR)/libopenjpeg.a
CFLAGS = -O3 -Wall -I$(LIBDIR) -I$(J2KINCDIR)
LDFLAGS = -L$(LIBDIR) -L$(J2KLIBDIR) -lm -lopenjpip_local
ALL = jpip_to_jp2 jpip_to_j2k test_index addXMLinJP2
all: $(ALL)
jpip_to_jp2: jpip_to_jp2.o $(LIBFNAME)
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LIBFNAME) -o $@
jpip_to_j2k: jpip_to_j2k.o $(LIBFNAME)
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LIBFNAME) -o $@
test_index: test_index.o $(LIBFNAME)
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LIBFNAME) -o $@
clean:
rm -f $(ALL) *.o *~

View File

@ -0,0 +1,38 @@
# Headers file are located here:
INCLUDE_DIRECTORIES(
${OPENJPEG_SOURCE_DIR}/applications/jpip/libopenjpip
${FCGI_INCLUDE_DIRNAME}
)
SET(OPJ_SERVER_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/opj_server.c
)
# Build executable
ADD_DEFINITIONS(-DSERVER -DQUIT_SIGNAL="quitJPIP")
#
ADD_EXECUTABLE(opj_server ${OPJ_SERVER_SRCS})
TARGET_LINK_LIBRARIES(opj_server openjpip_server ${FCGI_LIBNAME})
# On unix you need to link to the math library:
IF(UNIX)
TARGET_LINK_LIBRARIES(opj_server m)
ENDIF(UNIX)
# Install exe
INSTALL(TARGETS opj_server
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
#
REMOVE_DEFINITIONS(-DSERVER -DQUIT_SIGNAL="quitJPIP")
#
FOREACH(exe opj_dec_server jpip_to_jp2 jpip_to_j2k test_index)
#
ADD_EXECUTABLE(${exe} ${exe}.c)
TARGET_LINK_LIBRARIES(${exe} openjpip_local ${OPENJPEG_LIBRARY_NAME})
INSTALL(TARGETS ${exe}
EXPORT OpenJPEGTargets
DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
)
ENDFOREACH(exe)

View File

@ -0,0 +1,59 @@
MAINTAINERCLEANFILES = Makefile.in
bin_PROGRAMS = opj_server opj_dec_server jpip_to_jp2 jpip_to_j2k test_index
opj_server_CPPFLAGS = \
@FCGI_CFLAGS@ \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip
#
opj_server_CFLAGS = -m32 -DServer -DQUIT_SIGNAL=\"quitJPIP\"
#
opj_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_server.la @FCGI_LIBS@ -lm
#
opj_server_SOURCES = \
opj_server.c
#-------------
opj_dec_server_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip
#
opj_dec_server_CFLAGS =
opj_dec_server_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la $(top_builddir)/libopenjpeg/libopenjpeg.la
opj_dec_server_SOURCES = opj_dec_server.c
#-------------
jpip_to_jp2_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip
#
jpip_to_jp2_CFLAGS =
jpip_to_jp2_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la $(top_builddir)/libopenjpeg/libopenjpeg.la
jpip_to_jp2_SOURCES = jpip_to_jp2.c
#-------------
jpip_to_j2k_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip
#
jpip_to_j2k_CFLAGS =
jpip_to_j2k_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la $(top_builddir)/libopenjpeg/libopenjpeg.la
jpip_to_j2k_SOURCES = jpip_to_j2k.c
#-------------
test_index_CPPFLAGS = \
-I. \
-I$(top_srcdir)/applications/jpip/libopenjpip \
-I$(top_builddir)/applications/jpip/libopenjpip
#
test_index_CFLAGS =
test_index_LDADD = $(top_builddir)/applications/jpip/libopenjpip/libopenjpip_local.la $(top_builddir)/libopenjpeg/libopenjpeg.la
test_index_SOURCES = test_index.c
#-------------
install-data-hook:
@echo -e " (B)\t$(bindir)/opj_server$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/opj_dec_server$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/jpip_to_jp2$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/jpip_to_j2k$(EXEEXT)" >> $(top_builddir)/report.txt
@echo -e " (B)\t$(bindir)/test_index$(EXEEXT)" >> $(top_builddir)/report.txt

View File

@ -411,10 +411,7 @@ applications/codec/Makefile
applications/mj2/Makefile
applications/jpip/Makefile
applications/jpip/libopenjpip/Makefile
applications/jpip/opj_server/Makefile
applications/jpip/opj_client/Makefile
applications/jpip/opj_client/opj_dec_server/Makefile
applications/jpip/tools/Makefile
applications/jpip/util/Makefile
doc/Makefile
])

View File

@ -85,13 +85,11 @@ int write_phix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int
int write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
{
int len, lenp;
int size_of_coding; // 4 or 8
int version;
int tileno, resno, precno, layno, num_packet=0;
int i,nmax=0;
int len, lenp, tileno, version, i, nmax, size_of_coding; // 4 or 8
opj_tile_info_t *tile_Idx;
opj_packet_info_t packet;
int resno, precno, layno, num_packet;
int numOfres, numOfprec, numOflayers;
if( j2klen > pow( 2, 32)){
size_of_coding = 8;
@ -107,6 +105,7 @@ int write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_b
cio_write( cio, JPIP_FAIX, 4); /* FAIX */
cio_write( cio, version,1); /* Version 0 = 4 bytes */
nmax = 0;
for( i=0; i<=cstr_info.numdecompos[compno]; i++)
nmax += cstr_info.tile[0].ph[i] * cstr_info.tile[0].pw[i] * cstr_info.numlayers;
@ -114,15 +113,37 @@ int write_phixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_b
cio_write( cio, cstr_info.tw*cstr_info.th, size_of_coding); /* M */
for( tileno=0; tileno<cstr_info.tw*cstr_info.th; tileno++){
tile_Idx = &cstr_info.tile[ tileno];
// int correction = EPHused ? 3 : 1;
num_packet = 0;
for( resno=0; resno<=cstr_info.numdecompos[compno]; resno++){
for( precno=0; precno<tile_Idx->pw[resno]*tile_Idx->ph[resno]; precno++){
for( layno=0; layno<cstr_info.numlayers; layno++){
packet = tile_Idx->packet[num_packet * cstr_info.numcomps + compno];
num_packet = 0;
numOfres = cstr_info.numdecompos[compno] + 1;
for( resno=0; resno<numOfres ; resno++){
numOfprec = tile_Idx->pw[resno]*tile_Idx->ph[resno];
for( precno=0; precno<numOfprec; precno++){
numOflayers = cstr_info.numlayers;
for( layno=0; layno<numOflayers; layno++){
switch ( cstr_info.prog){
case LRCP:
packet = tile_Idx->packet[ ((layno*numOfres+resno)*cstr_info.numcomps+compno)*numOfprec+precno];
break;
case RLCP:
packet = tile_Idx->packet[ ((resno*numOflayers+layno)*cstr_info.numcomps+compno)*numOfprec+precno];
break;
case RPCL:
packet = tile_Idx->packet[ ((resno*numOfprec+precno)*cstr_info.numcomps+compno)*numOflayers+layno];
break;
case PCRL:
packet = tile_Idx->packet[ ((precno*cstr_info.numcomps+compno)*numOfres+resno)*numOflayers + layno];
break;
case CPRL:
packet = tile_Idx->packet[ ((compno*numOfprec+precno)*numOfres+resno)*numOflayers + layno];
break;
default:
fprintf( stderr, "failed to ppix indexing\n");
}
cio_write( cio, packet.start_pos-coff, size_of_coding); /* start position */
cio_write( cio, packet.end_ph_pos-packet.start_pos+1, size_of_coding); /* length */

View File

@ -87,13 +87,11 @@ int write_ppix( int coff, opj_codestream_info_t cstr_info, opj_bool EPHused, int
int write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_bool EPHused, int j2klen, opj_cio_t *cio)
{
int len, lenp;
int tileno, resno, precno, layno, num_packet=0;
int size_of_coding; // 4 or 8
int version;
int i,nmax=0;
int len, lenp, tileno, version, i, nmax, size_of_coding; // 4 or 8
opj_tile_info_t *tile_Idx;
opj_packet_info_t packet;
int resno, precno, layno, num_packet;
int numOfres, numOfprec, numOflayers;
if( j2klen > pow( 2, 32)){
size_of_coding = 8;
@ -109,6 +107,7 @@ int write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_b
cio_write( cio, JPIP_FAIX, 4); /* FAIX */
cio_write( cio, version, 1); /* Version 0 = 4 bytes */
nmax = 0;
for( i=0; i<=cstr_info.numdecompos[compno]; i++)
nmax += cstr_info.tile[0].ph[i] * cstr_info.tile[0].pw[i] * cstr_info.numlayers;
@ -116,15 +115,37 @@ int write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_b
cio_write( cio, cstr_info.tw*cstr_info.th, size_of_coding); /* M */
for( tileno=0; tileno<cstr_info.tw*cstr_info.th; tileno++){
tile_Idx = &cstr_info.tile[ tileno];
// int correction = EPHused ? 3 : 1;
num_packet=0;
for( resno=0; resno<=cstr_info.numdecompos[compno]; resno++){
for( precno=0; precno<tile_Idx->pw[resno]*tile_Idx->ph[resno]; precno++){
for( layno=0; layno<cstr_info.numlayers; layno++){
packet = tile_Idx->packet[num_packet * cstr_info.numcomps + compno];
num_packet=0;
numOfres = cstr_info.numdecompos[compno] + 1;
for( resno=0; resno<numOfres ; resno++){
numOfprec = tile_Idx->pw[resno]*tile_Idx->ph[resno];
for( precno=0; precno<numOfprec; precno++){
numOflayers = cstr_info.numlayers;
for( layno=0; layno<numOflayers; layno++){
switch ( cstr_info.prog){
case LRCP:
packet = tile_Idx->packet[ ((layno*numOfres+resno)*cstr_info.numcomps+compno)*numOfprec+precno];
break;
case RLCP:
packet = tile_Idx->packet[ ((resno*numOflayers+layno)*cstr_info.numcomps+compno)*numOfprec+precno];
break;
case RPCL:
packet = tile_Idx->packet[ ((resno*numOfprec+precno)*cstr_info.numcomps+compno)*numOflayers+layno];
break;
case PCRL:
packet = tile_Idx->packet[ ((precno*cstr_info.numcomps+compno)*numOfres+resno)*numOflayers + layno];
break;
case CPRL:
packet = tile_Idx->packet[ ((compno*numOfprec+precno)*numOfres+resno)*numOflayers + layno];
break;
default:
fprintf( stderr, "failed to ppix indexing\n");
}
cio_write( cio, packet.start_pos-coff, size_of_coding); /* start position */
cio_write( cio, packet.end_pos-packet.start_pos+1, size_of_coding); /* length */
@ -133,8 +154,7 @@ int write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_b
}
}
/* PADDING */
while( num_packet < nmax){
while( num_packet < nmax){ /* PADDING */
cio_write( cio, 0, size_of_coding); /* start position */
cio_write( cio, 0, size_of_coding); /* length */
num_packet++;
@ -147,5 +167,4 @@ int write_ppixfaix( int coff, int compno, opj_codestream_info_t cstr_info, opj_b
cio_seek( cio, lenp+len);
return len;
}