JP3D Module. Fixed issue when computing the number of elements in an array that leads to crash (thanks Kristof). Updated JP3D makefiles.

This commit is contained in:
Francois-Olivier Devaux 2010-02-18 16:36:21 +00:00
parent fdf20c7b7a
commit 372eab810b
3 changed files with 98 additions and 78 deletions

150
Makefile
View File

@ -1,72 +1,78 @@
# Linux makefile for OpenJPEG # Linux makefile for JP3DVM
VER_MAJOR = 1 VER_MAJOR = 2
VER_MINOR = 0.0 VER_MINOR = 1.3.0
SRCS = ./libopenjpeg/bio.c ./libopenjpeg/cio.c ./libopenjpeg/dwt.c ./libopenjpeg/event.c ./libopenjpeg/image.c ./libopenjpeg/j2k.c ./libopenjpeg/j2k_lib.c ./libopenjpeg/jp2.c ./libopenjpeg/jpt.c ./libopenjpeg/mct.c ./libopenjpeg/mqc.c ./libopenjpeg/openjpeg.c ./libopenjpeg/pi.c ./libopenjpeg/raw.c ./libopenjpeg/t1.c ./libopenjpeg/t2.c ./libopenjpeg/tcd.c ./libopenjpeg/tgt.c SRCS = ./libjp3dvm/bio.c ./libjp3dvm/cio.c ./libjp3dvm/dwt.c ./libjp3dvm/event.c ./libjp3dvm/jp3d.c ./libjp3dvm/jp3d_lib.c ./libjp3dvm/volume.c ./libjp3dvm/mct.c ./libjp3dvm/mqc.c ./libjp3dvm/openjpeg.c ./libjp3dvm/pi.c ./libjp3dvm/raw.c ./libjp3dvm/t1.c ./libjp3dvm/t1_3d.c ./libjp3dvm/t2.c ./libjp3dvm/tcd.c ./libjp3dvm/tgt.c
INCLS = ./libopenjpeg/bio.h ./libopenjpeg/cio.h ./libopenjpeg/dwt.h ./libopenjpeg/event.h ./libopenjpeg/fix.h ./libopenjpeg/image.h ./libopenjpeg/int.h ./libopenjpeg/j2k.h ./libopenjpeg/j2k_lib.h ./libopenjpeg/jp2.h ./libopenjpeg/jpt.h ./libopenjpeg/mct.h ./libopenjpeg/mqc.h ./libopenjpeg/openjpeg.h ./libopenjpeg/pi.h ./libopenjpeg/raw.h ./libopenjpeg/t1.h ./libopenjpeg/t2.h ./libopenjpeg/tcd.h ./libopenjpeg/tgt.h ./libopenjpeg/opj_includes.h INCLS = ./libjp3dvm/t1_3d.h ./libjp3dvm/bio.h ./libjp3dvm/cio.h ./libjp3dvm/dwt.h ./libjp3dvm/event.h ./libjp3dvm/fix.h ./libjp3dvm/int.h ./libjp3dvm/jp3d.h ./libjp3dvm/jp3d_lib.h ./libjp3dvm/volume.h ./libjp3dvm/mct.h ./libjp3dvm/mqc.h ./libjp3dvm/openjpeg.h ./libjp3dvm/pi.h ./libjp3dvm/raw.h ./libjp3dvm/t1.h ./libjp3dvm/t2.h ./libjp3dvm/tcd.h ./libjp3dvm/tgt.h ./libjp3dvm/opj_includes.h
INCLUDE = -Ilibopenjpeg INCLUDE = -Ilibjp3dvm
# General configuration variables: # General configuration variables:
CC = gcc CC = gcc
AR = ar AR = ar
INSTALLDIR = /usr/lib PREFIX = /usr
INSTALL_LIBDIR = $(PREFIX)/lib
# Converts cr/lf to just lf INSTALL_INCLUDE = $(PREFIX)/include
DOS2UNIX = dos2unix
# Converts cr/lf to just lf
COMPILERFLAGS = -O3 DOS2UNIX = dos2unix
LIBRARIES = -lstdc++
COMPILERFLAGS = -Wall -O3 -ffast-math -std=c99 -fPIC
MODULES = $(SRCS:.c=.o) LIBRARIES = -lstdc++
CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
MODULES = $(SRCS:.c=.o)
TARGET = openjpeg CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
STATICLIB = lib$(TARGET).a
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so TARGET = jp3dvm
LIBNAME = lib$(TARGET).so.$(VER_MAJOR) STATICLIB = lib$(TARGET).a
SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
LIBNAME = lib$(TARGET).so.$(VER_MAJOR)
default: all
all: dist default: all
dist: OpenJPEG all: Jp3dVM
mkdir dist
cp *.a dist/ dist: Jp3dVM
cp *.so dist/ install -d dist
cp libopenjpeg/openjpeg.h dist/ install -m 644 $(STATICLIB) dist
install -m 755 $(SHAREDLIB) dist
dos2unix: ln -sf $(SHAREDLIB) dist/$(LIBNAME)
@$(DOS2UNIX) $(SRCS) $(INCLS) install libjp3dvm/openjpeg.h dist
OpenJPEG: $(STATICLIB) $(SHAREDLIB) dos2unix:
@$(DOS2UNIX) $(SRCS) $(INCLS)
.c.o:
$(CC) $(CFLAGS) -c $< -o $@ Jp3dVM: $(STATICLIB) $(SHAREDLIB)
$(STATICLIB): $(MODULES) .c.o:
$(AR) r $@ $(MODULES) $(CC) $(CFLAGS) -c $< -o $@
$(SHAREDLIB): $(MODULES) $(STATICLIB): $(MODULES)
$(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES) $(AR) r $@ $(MODULES)
install: $(SHAREDLIB): $(MODULES)
install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR) $(CC) -s -shared -Wl,-soname,$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)
install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME) install: Jp3dVM
ldconfig install -d '$(DESTDIR)$(INSTALL_LIBDIR)' '$(DESTDIR)$(INSTALL_INCLUDE)'
install -m 644 -o root -g root $(STATICLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
clean: ranlib '$(DESTDIR)$(INSTALL_LIBDIR)/$(STATICLIB)'
rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME) install -m 755 -o root -g root $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)'
ln -sf $(SHAREDLIB) '$(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)'
osx: install -m 644 -o root -g root libjp3dvm/openjpeg.h '$(DESTDIR)$(INSTALL_INCLUDE)'
make -f Makefile.osx -ldconfig
osxinstall: clean:
make -f Makefile.osx install rm -rf core dist/ u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
osxclean: osx:
make -f Makefile.osx clean make -f Makefile.osx
osxinstall:
make -f Makefile.osx install
osxclean:
make -f Makefile.osx clean

14
codec/Makefile Normal file
View File

@ -0,0 +1,14 @@
# Makefile for the main OpenJPEG codecs: jp3d_to_volume and volume_to_jp3d
CFLAGS = -O3 -lstdc++ # -g -p -pg
all: jp3d_to_volume volume_to_jp3d
jp3d_to_volume: jp3d_to_volume.c ../libjp3dvm.a
gcc $(CFLAGS) getopt.c convert.c jp3d_to_volume.c -o jp3d_to_volume -L.. -ljp3dvm -I ../libjp3dvm/ -lm -ltiff
volume_to_jp3d: volume_to_jp3d.c ../libjp3dvm.a
gcc $(CFLAGS) getopt.c convert.c volume_to_jp3d.c -o volume_to_jp3d -L.. -ljp3dvm -I ../libjp3dvm/ -lm -ltiff
clean:
rm -f jp3d_to_volume volume_to_jp3d

View File

@ -177,12 +177,12 @@ void decode_help_display() {
fprintf(stdout," Set the maximum number of quality layers to decode. If there are\n"); fprintf(stdout," Set the maximum number of quality layers to decode. If there are\n");
fprintf(stdout," less quality layers than the specified number, all the quality layers\n"); fprintf(stdout," less quality layers than the specified number, all the quality layers\n");
fprintf(stdout," are decoded. \n"); fprintf(stdout," are decoded. \n");
fprintf(stdout," -O original-file \n"); fprintf(stdout," -O original-file \n");
fprintf(stdout," This option offers the possibility to compute some quality results \n"); fprintf(stdout," This option offers the possibility to compute some quality results \n");
fprintf(stdout," for the decompressed volume, like the PSNR value achieved or the global SSIM value. \n"); fprintf(stdout," for the decompressed volume, like the PSNR value achieved or the global SSIM value. \n");
fprintf(stdout," Needs the original file in order to compare with the new one.\n"); fprintf(stdout," Needs the original file in order to compare with the new one.\n");
fprintf(stdout," NOTE: Only valid when -r option is 0,0,0 (both original and decompressed volumes have same resolutions) \n"); fprintf(stdout," NOTE: Only valid when -r option is 0,0,0 (both original and decompressed volumes have same resolutions) \n");
fprintf(stdout," NOTE: If original file is .BIN file, the volume characteristics file shall be defined with the -m option. \n"); fprintf(stdout," NOTE: If original file is .BIN file, the volume characteristics file shall be defined with the -m option. \n");
fprintf(stdout," (i.e. -O original-BIN-file -m original-IMG-file) \n"); fprintf(stdout," (i.e. -O original-BIN-file -m original-IMG-file) \n");
fprintf(stdout," -BE \n"); fprintf(stdout," -BE \n");
fprintf(stdout," Define that the recovered volume data will be saved with big endian byte order.\n"); fprintf(stdout," Define that the recovered volume data will be saved with big endian byte order.\n");