FreeImage: Update to 3.17.0

This commit is contained in:
Alexey Pavlov
2015-12-29 22:52:20 +03:00
parent f5dc561575
commit b45bbb6c17
7 changed files with 975 additions and 1129 deletions

View File

@@ -1,64 +0,0 @@
diff -rupN FreeImage/FreeImage.2008.vcproj FreeImage-new/FreeImage.2008.vcproj
--- FreeImage/FreeImage.2008.vcproj 2014-01-16 00:27:04.000000000 +0100
+++ FreeImage-new/FreeImage.2008.vcproj 2014-01-16 00:49:42.334523250 +0100
@@ -832,10 +828,6 @@
>
</File>
<File
- RelativePath="Source\FreeImageToolkit\JPEGTransform.cpp"
- >
- </File>
- <File
RelativePath="Source\FreeImageToolkit\MultigridPoissonSolver.cpp"
>
</File>
diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
--- FreeImage/Source/FreeImage.h 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage.h 2014-01-16 00:49:42.338523316 +0100
@@ -456,6 +461,10 @@ FI_ENUM(FREE_IMAGE_DITHER) {
FID_BAYER16x16 = 6 // Bayer ordered dispersed dot dithering (order 4 dithering matrix)
};
+/* The FreeImage_JPEGTransform functions are deliberately disabled in the
+ Fedora build of FreeImage as they require that FreeImage uses a private copy
+ of libjpeg which is a no no because of security reasons. */
+#if 0
/** Lossless JPEG transformations
Constants used in FreeImage_JPEGTransform
*/
@@ -469,6 +478,7 @@ FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
FIJPEG_OP_ROTATE_180 = 6, // 180-degree rotation
FIJPEG_OP_ROTATE_270 = 7 // 270-degree clockwise (or 90 ccw)
};
+#endif
/** Tone mapping operators.
Constants used in FreeImage_ToneMapping.
@@ -704,7 +714,6 @@ typedef void (DLL_CALLCONV *FI_InitProc)
#define PNG_DEFAULT 0
#define PNG_IGNOREGAMMA 1 //! loading: avoid gamma correction
#define PNG_Z_BEST_SPEED 0x0001 //! save using ZLib level 1 compression flag (default value is 6)
-#define PNG_Z_DEFAULT_COMPRESSION 0x0006 //! save using ZLib level 6 compression flag (default recommended value)
#define PNG_Z_BEST_COMPRESSION 0x0009 //! save using ZLib level 9 compression flag (default value is 6)
#define PNG_Z_NO_COMPRESSION 0x0100 //! save without ZLib compression
#define PNG_INTERLACED 0x0200 //! save using Adam7 interlacing (use | to combine with other save flags)
@@ -1048,14 +1057,19 @@ DLL_API FIBITMAP *DLL_CALLCONV FreeImage
// JPEG lossless transformation routines
// --------------------------------------------------------------------------
+/* The FreeImage_JPEGTransform functions are deliberately disabled in the
+ Fedora build of FreeImage as they require that FreeImage uses a private copy
+ of libjpeg which is a no no because of security reasons. */
+#if 0
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCropU(const wchar_t *src_file, const wchar_t *dst_file, int left, int top, int right, int bottom);
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformFromHandle(FreeImageIO* src_io, fi_handle src_handle, FreeImageIO* dst_io, fi_handle dst_handle, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombined(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* src_stream, FIMEMORY* dst_stream, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
+#endif
// --------------------------------------------------------------------------

View File

@@ -1,405 +0,0 @@
--- FreeImage/Makefile.fip.orig 2014-04-16 18:58:24.825800000 +0400
+++ FreeImage/Makefile.fip 2014-04-16 19:12:58.956000000 +0400
@@ -1,81 +1,97 @@
-# Linux makefile for FreeImagePlus
+# Mingw makefile for FreeImagePlus
# This file can be generated by ./genfipsrclist.sh
include fipMakefile.srcs
-# General configuration variables:
-DESTDIR ?= /
-INCDIR ?= $(DESTDIR)/usr/include
-INSTALLDIR ?= $(DESTDIR)/usr/lib
-
-# Converts cr/lf to just lf
-DOS2UNIX = dos2unix
-
-LIBRARIES = -lstdc++
-
-MODULES = $(SRCS:.c=.o)
-MODULES := $(MODULES:.cpp=.o)
-CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
-# OpenJPEG
-CFLAGS += -DOPJ_STATIC
-# LibRaw
-CFLAGS += -DNO_LCMS
-# LibJXR
-CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
-CFLAGS += $(INCLUDE)
-CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
-# LibJXR
-CXXFLAGS += -D__ANSI__
-CXXFLAGS += $(INCLUDE)
-
-ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
- CFLAGS += -fPIC
- CXXFLAGS += -fPIC
-endif
+CC = $(MINGW_TARGET)-gcc
+CXX = $(MINGW_TARGET)-g++
+LD = $(MINGW_TARGET)-g++
+AR = ar
+DLLTOOL = dlltool
+RC = windres
+PKGCONFIG = pkg-config
+
+CP = cp
+MD = mkdir
+RM = rm
+
+# General configuration variables.
+DESTDIR ?= $(SystemRoot)
+INSTALLDIR ?= $(DESTDIR)/system32
+DISTDIR ?= Dist
+SRCDIR ?= Wrapper/FreeImagePlus/
+HEADER = FreeImagePlus.h
+RCFILE = Wrapper/FreeImagePlus/FreeImagePlus.rc
+
+# Uncomment this variable to make a static library. This may
+# also be specified as an environment variable and can hold
+# any of STATIC and SHARED and must be in uppercase letters.
+# The FreeImage library type defaults to SHARED.
+FREEIMAGE_LIBRARY_TYPE ?= SHARED
+
+WIN32_STATIC_FLAGS = -DFREEIMAGE_LIB
+WIN32_SHARED_FLAGS = -DFIP_EXPORTS
+
+# Converts cr/lf to just lf
+DOS2UNIX = dos2unix
+
+LIBRARIES = -lstdc++ -lfreeimage-$(VER_MAJOR).$(VER_MINOR) -L.
+MODULES = $(SRCS:.c=.o)
+MODULES := $(MODULES:.cpp=.o)
+RESOURCE = $(RCFILE:.rc=.coff)
+CFLAGS += -ISource $(INCLUDE) -DDISABLE_PERF_MEASUREMENT $(WIN32_$(FREEIMAGE_LIBRARY_TYPE)_FLAGS)
+CXXFLAGS += -ISource $(INCLUDE) $(WIN32_$(FREEIMAGE_LIBRARY_TYPE)_FLAGS)
+LDFLAGS += -shared -Wl,-soname,$(SOLIBNAME)
+LDFLAGS += -LDist -lfreeimage -lgdi32
-TARGET = freeimageplus
+TARGET = freeimageplus
STATICLIB = lib$(TARGET).a
-SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
-LIBNAME = lib$(TARGET).so
-VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
-HEADER = Source/FreeImage.h
-HEADERFIP = Wrapper/FreeImagePlus/FreeImagePlus.h
+SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).dll
+IMPORTLIB = lib$(TARGET).dll.a
+EXPORTLIB = $(TARGET).exp
+SOLIBNAME = $(SHAREDLIB)
+DISTSHARED = $(addprefix $(DISTDIR)/, $(SHAREDLIB) $(IMPORTLIB) $(HEADER))
+DISTSTATIC = $(addprefix $(DISTDIR)/, $(STATICLIB) $(HEADER))
-default: all
-
-all: dist
+TARGETLIB = $($(FREEIMAGE_LIBRARY_TYPE)LIB)
+TARGETDIST = $(DIST$(FREEIMAGE_LIBRARY_TYPE))
-dist: FreeImage
- cp *.a Dist
- cp *.so Dist
- cp Source/FreeImage.h Dist
- cp Wrapper/FreeImagePlus/FreeImagePlus.h Dist
+default: all
-dos2unix:
- @$(DOS2UNIX) $(SRCS)
+all: $(TARGETLIB) $(TARGETDIST)
-FreeImage: $(STATICLIB) $(SHAREDLIB)
+rebuild: clean all
-.c.o:
+%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
-.cpp.o:
+%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
+%.coff: %.rc
+ $(RC) $(RCFLAGS) -o $@ $<
+
+$(DISTDIR)/%: %
+ $(CP) $< $@
+
+$(DISTDIR)/%: $(SRCDIR)/%
+ $(CP) $< $@
+
$(STATICLIB): $(MODULES)
- $(AR) r $@ $(MODULES)
+ $(AR) rs $@ $(MODULES)
+
+$(IMPORTLIB) $(EXPORTLIB): $(MODULES)
+ $(DLLTOOL) -e $(EXPORTLIB) -l $(IMPORTLIB) -D $(SHAREDLIB) $(DLLTOOLFLAGS) $(MODULES)
+
+$(SHAREDLIB): $(EXPORTLIB) $(RESOURCE)
+ $(LD) -o $@ $(EXPORTLIB) $(MODULES) $(RESOURCE) $(LDFLAGS)
-$(SHAREDLIB): $(MODULES)
- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+$(DISTDIR):
+ $(MD) $(DISTDIR)
-install:
- install -d $(INCDIR) $(INSTALLDIR)
- install -m 644 -o root -g root $(HEADER) $(INCDIR)
- install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
+$(TARGETDIST): $(DISTDIR)
clean:
- rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
+ $(RM) -f core $(DISTDIR)/*.* $(MODULES) $(RESOURCE) $(STATICLIB) $(SHAREDLIB) $(IMPORTLIB) $(EXPORTLIB)
diff -rupN FreeImage/Makefile.gnu FreeImage-new/Makefile.gnu
--- FreeImage/Makefile.gnu 2014-01-16 00:27:04.000000000 +0100
+++ FreeImage-new/Makefile.gnu 2014-01-16 00:49:42.335523267 +0100
@@ -11,7 +11,8 @@ INSTALLDIR ?= $(DESTDIR)/usr/lib
# Converts cr/lf to just lf
DOS2UNIX = dos2unix
-LIBRARIES = -lstdc++
+INCLUDE += $(shell pkg-config --cflags libopenjp2 libpng libraw OpenEXR zlib libtiff-4 libwebp)
+LIBRARIES = -lstdc++ $(shell pkg-config --libs libopenjp2 libpng libraw OpenEXR zlib libtiff-4 libwebp libwebpdecoder libwebpdemux libwebpmux) -ljpeg -lwebp
MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
--- FreeImage/Makefile.mingw.orig 2014-03-15 22:52:28.000000000 +0400
+++ FreeImage/Makefile.mingw 2014-04-16 19:12:32.030400000 +0400
@@ -1,136 +1,94 @@
-# MinGW makefile for FreeImage
-
-# This file can be generated by ./gensrclist.sh
-include Makefile.srcs
-
-# General configuration variables.
-DESTDIR ?= $(SystemRoot)
-INSTALLDIR ?= $(DESTDIR)/system32
-DISTDIR ?= Dist
-SRCDIR ?= Source
-HEADER = FreeImage.h
-RCFILE = FreeImage.rc
-
-# Uncomment this variable to make a static library. This may
-# also be specified as an environment variable and can hold
-# any of STATIC and SHARED and must be in uppercase letters.
-# Default: SHARED
-#FREEIMAGE_LIBRARY_TYPE = STATIC
-
-# Redefine the compiler (CC defaults to ´cc´ for MinGW's make,
-# however there's only ´gcc´ available with MinGW).
-CC = gcc
-
-# Redefine the linker (we use ´g++´ for linking, since MinGW's
-# command ´ld´ comes with wrong (Linux) standard library search
-# paths).
-LD = g++
-
-#Define the ´dlltool´ command.
-DLLTOOL = dlltool
-
-#Define the resource compiler.
-RC = windres
-
-# Define the ´copy´ command.
-CP = cp
-
-# Define the ´mkdir´ command.
-MD = mkdir
-
-# Define the ´remove´ command.
-RM = rm
-
-# Define additional libraries needed.
-# libstdc++ is included by default with MinGW, however for
-# WIN32 based builds, LibRawLite needs the winsock libraries.
-LIBRARIES = -lws2_32
-
-# Define some additional symboles needed for WIN32 based builds.
-WIN32_CFLAGS = -DWINVER=0x0500 $(LIB_TYPE_FLAGS) -DOPJ_STATIC
-WIN32_CXXFLAGS = $(WIN32_CFLAGS) -DLIBRAW_NODLL
-
-# Workaround for LibRawLite, which does not include C++ header
-# file stdexcept, which is casually included with MSVC but not
-# with MinGW. This can be removed after LibRawLite got control
-# over its includes again.
-WIN32_CXXFLAGS += -include stdexcept
-
-# Define DLL image header information flags for the linker.
-WIN32_LDFLAGS = -Wl,--subsystem,windows:5.0,--major-os-version,5
-
-WIN32_STATIC_FLAGS = -DFREEIMAGE_LIB
-WIN32_SHARED_FLAGS = -DFREEIMAGE_EXPORTS
-
-MODULES = $(SRCS:.c=.o)
-MODULES := $(MODULES:.cpp=.o)
-RESOURCE = $(RCFILE:.rc=.coff)
-CFLAGS ?= -O3 -fexceptions -DNDEBUG -DDISABLE_PERF_MEASUREMENT $(WIN32_CFLAGS)
-CFLAGS += $(INCLUDE)
-CXXFLAGS ?= -O3 -fexceptions -Wno-ctor-dtor-privacy -DNDEBUG $(WIN32_CXXFLAGS)
-CXXFLAGS += $(INCLUDE)
-RCFLAGS ?= -DNDEBUG
-LDFLAGS ?= -s -shared -static -Wl,-soname,$(SOLIBNAME) $(WIN32_LDFLAGS)
-DLLTOOLFLAGS ?= --add-stdcall-underscore
-
-TARGET = FreeImage
-STATICLIB = lib$(TARGET).a
-SHAREDLIB = $(TARGET).dll
-IMPORTLIB = $(TARGET).lib
-EXPORTLIB = $(TARGET).exp
-SOLIBNAME = $(SHAREDLIB).$(VER_MAJOR)
-
-DISTSHARED = $(addprefix $(DISTDIR)/, $(SHAREDLIB) $(IMPORTLIB) $(HEADER))
-DISTSTATIC = $(addprefix $(DISTDIR)/, $(STATICLIB) $(HEADER))
-
-# The FreeImage library type defaults to SHARED.
-FREEIMAGE_LIBRARY_TYPE ?= SHARED
-
-TARGETLIB = $($(FREEIMAGE_LIBRARY_TYPE)LIB)
-TARGETDIST = $(DIST$(FREEIMAGE_LIBRARY_TYPE))
-LIB_TYPE_FLAGS = $(WIN32_$(FREEIMAGE_LIBRARY_TYPE)_FLAGS)
-
-default: all
-
-all: mkdist
-
-rebuild: clean all
-
-mkdist: FreeImage $(TARGETDIST)
-
-FreeImage: $(TARGETLIB)
-
-%.o: %.c
- $(CC) $(CFLAGS) -c $< -o $@
-
-%.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $< -o $@
-
-%.coff: %.rc
- $(RC) $(RCFLAGS) -o $@ $<
-
-$(DISTDIR)/%: %
- $(CP) $< $@
-
-$(DISTDIR)/%: $(SRCDIR)/%
- $(CP) $< $@
-
-$(STATICLIB): $(MODULES)
- $(AR) rs $@ $(MODULES)
-
-$(IMPORTLIB) $(EXPORTLIB): $(MODULES)
- $(DLLTOOL) -e $(EXPORTLIB) -l $(IMPORTLIB) -D $(SHAREDLIB) $(DLLTOOLFLAGS) $(MODULES)
-
-$(SHAREDLIB): $(EXPORTLIB) $(RESOURCE)
- $(LD) $(LDFLAGS) -o $@ $(EXPORTLIB) $(MODULES) $(RESOURCE) $(LIBRARIES)
-
-$(DISTDIR):
- $(MD) $(DISTDIR)
-
-$(TARGETDIST): $(DISTDIR)
-
-install:
- $(CP) $(SHAREDLIB) $(INSTALLDIR)
-
-clean:
- $(RM) -f core $(DISTDIR)/*.* $(MODULES) $(RESOURCE) $(STATICLIB) $(SHAREDLIB) $(IMPORTLIB) $(EXPORTLIB)
+# MinGW makefile for FreeImage
+
+# This file can be generated by ./gensrclist.sh
+include Makefile.srcs
+
+CC = gcc
+CXX = g++
+LD = g++
+AR = ar
+DLLTOOL = dlltool
+RC = windres
+PKGCONFIG = pkg-config
+
+CP = cp
+MD = mkdir
+RM = rm
+
+# General configuration variables.
+DESTDIR ?= $(SystemRoot)
+INSTALLDIR ?= $(DESTDIR)/system32
+DISTDIR ?= Dist
+SRCDIR ?= Source
+HEADER = FreeImage.h
+RCFILE = FreeImage.rc
+
+# Uncomment this variable to make a static library. This may
+# also be specified as an environment variable and can hold
+# any of STATIC and SHARED and must be in uppercase letters.
+# The FreeImage library type defaults to SHARED.
+FREEIMAGE_LIBRARY_TYPE ?= SHARED
+
+WIN32_STATIC_FLAGS = -DFREEIMAGE_LIB
+WIN32_SHARED_FLAGS = -DFREEIMAGE_EXPORTS
+
+MODULES = $(SRCS:.c=.o)
+MODULES := $(MODULES:.cpp=.o)
+RESOURCE = $(RCFILE:.rc=.coff)
+CFLAGS += $(INCLUDE) -DDISABLE_PERF_MEASUREMENT $(WIN32_$(FREEIMAGE_LIBRARY_TYPE)_FLAGS)
+CFLAGS += $(shell $(PKGCONFIG) --cflags libopenjp2 OpenEXR libpng libraw zlib libtiff-4 libwebp)
+CXXFLAGS += $(INCLUDE) $(WIN32_$(FREEIMAGE_LIBRARY_TYPE)_FLAGS)
+CXXFLAGS += $(shell $(PKGCONFIG) --cflags libopenjp2 OpenEXR libpng libraw zlib libtiff-4 libwebp)
+LDFLAGS += -shared -Wl,-soname,$(SOLIBNAME)
+LDFLAGS += $(shell $(PKGCONFIG) --libs libopenjp2 OpenEXR libpng libraw zlib libtiff-4 libwebp libwebpdecoder libwebpdemux libwebpmux) -ljpeg
+
+TARGET = freeimage
+STATICLIB = lib$(TARGET).a
+SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).dll
+IMPORTLIB = lib$(TARGET).dll.a
+EXPORTLIB = $(TARGET).exp
+SOLIBNAME = $(SHAREDLIB)
+
+DISTSHARED = $(addprefix $(DISTDIR)/, $(SHAREDLIB) $(IMPORTLIB) $(HEADER))
+DISTSTATIC = $(addprefix $(DISTDIR)/, $(STATICLIB) $(HEADER))
+
+TARGETLIB = $($(FREEIMAGE_LIBRARY_TYPE)LIB)
+TARGETDIST = $(DIST$(FREEIMAGE_LIBRARY_TYPE))
+
+default: all
+
+all: $(TARGETLIB) $(TARGETDIST)
+
+rebuild: clean all
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+
+%.o: %.cpp
+ $(CXX) $(CXXFLAGS) -c $< -o $@
+
+%.coff: %.rc
+ $(RC) $(RCFLAGS) -o $@ $<
+
+$(DISTDIR)/%: %
+ $(CP) $< $@
+
+$(DISTDIR)/%: $(SRCDIR)/%
+ $(CP) $< $@
+
+$(STATICLIB): $(MODULES)
+ $(AR) rs $@ $(MODULES)
+
+$(IMPORTLIB) $(EXPORTLIB): $(MODULES)
+ $(DLLTOOL) -e $(EXPORTLIB) -l $(IMPORTLIB) -D $(SHAREDLIB) $(DLLTOOLFLAGS) $(MODULES)
+
+$(SHAREDLIB): $(EXPORTLIB) $(RESOURCE)
+ $(LD) -o $@ $(EXPORTLIB) $(MODULES) $(RESOURCE) $(LDFLAGS)
+
+$(DISTDIR):
+ $(MD) $(DISTDIR)
+
+$(TARGETDIST): $(DISTDIR)
+
+clean:
+ $(RM) -f core $(DISTDIR)/*.* $(MODULES) $(RESOURCE) $(STATICLIB) $(SHAREDLIB) $(IMPORTLIB) $(EXPORTLIB)

View File

@@ -1,594 +0,0 @@
diff -rupN FreeImage/genfipsrclist.sh FreeImage-new/genfipsrclist.sh
--- FreeImage/genfipsrclist.sh 2014-01-16 00:27:04.000000000 +0100
+++ FreeImage-new/genfipsrclist.sh 2014-01-16 00:49:42.334523250 +0100
@@ -1,6 +1,6 @@
#!/bin/sh
-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibPNG Source/LibTIFF4 Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath Source/LibRawLite Source/LibRawLite/dcraw Source/LibRawLite/internal Source/LibRawLite/libraw Source/LibRawLite/src Source/LibWebP Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib Wrapper/FreeImagePlus"
+DIRLIST=" Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib Wrapper/FreeImagePlus"
echo "VER_MAJOR = 3" > fipMakefile.srcs
diff -rupN FreeImage/gensrclist.sh FreeImage-new/gensrclist.sh
--- FreeImage/gensrclist.sh 2014-01-16 00:27:04.000000000 +0100
+++ FreeImage-new/gensrclist.sh 2014-01-16 00:49:42.335523267 +0100
@@ -1,6 +1,6 @@
#!/bin/sh
-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibPNG Source/LibTIFF4 Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath Source/LibRawLite Source/LibRawLite/dcraw Source/LibRawLite/internal Source/LibRawLite/libraw Source/LibRawLite/src Source/LibWebP Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib"
+DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib"
echo "VER_MAJOR = 3" > Makefile.srcs
echo "VER_MINOR = 16.0" >> Makefile.srcs
diff -rupN FreeImage/Source/FreeImage/J2KHelper.cpp FreeImage-new/Source/FreeImage/J2KHelper.cpp
--- FreeImage/Source/FreeImage/J2KHelper.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/J2KHelper.cpp 2014-01-16 00:49:42.335523267 +0100
@@ -21,7 +21,7 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibOpenJPEG/openjpeg.h"
+#include <openjpeg.h>
#include "J2KHelper.h"
// --------------------------------------------------------------------------
diff -rupN FreeImage/Source/FreeImage/PluginEXR.cpp FreeImage-new/Source/FreeImage/PluginEXR.cpp
--- FreeImage/Source/FreeImage/PluginEXR.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginEXR.cpp 2014-01-16 00:49:42.336523283 +0100
@@ -22,16 +22,16 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../OpenEXR/IlmImf/ImfIO.h"
-#include "../OpenEXR/Iex/Iex.h"
-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
-#include "../OpenEXR/IlmImf/ImfInputFile.h"
-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
-#include "../OpenEXR/IlmImf/ImfChannelList.h"
-#include "../OpenEXR/IlmImf/ImfRgba.h"
-#include "../OpenEXR/IlmImf/ImfArray.h"
-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
-#include "../OpenEXR/Half/half.h"
+#include <OpenEXR/ImfIO.h>
+#include <OpenEXR/Iex.h>
+#include <OpenEXR/ImfOutputFile.h>
+#include <OpenEXR/ImfInputFile.h>
+#include <OpenEXR/ImfRgbaFile.h>
+#include <OpenEXR/ImfChannelList.h>
+#include <OpenEXR/ImfRgba.h>
+#include <OpenEXR/ImfArray.h>
+#include <OpenEXR/ImfPreviewImage.h>
+#include <OpenEXR/half.h>
// ==========================================================
diff -rupN FreeImage/Source/FreeImage/PluginJ2K.cpp FreeImage-new/Source/FreeImage/PluginJ2K.cpp
--- FreeImage/Source/FreeImage/PluginJ2K.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJ2K.cpp 2014-01-16 00:49:42.336523283 +0100
@@ -21,7 +21,7 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibOpenJPEG/openjpeg.h"
+#include <openjpeg.h>
#include "J2KHelper.h"
// ==========================================================
diff -rupN FreeImage/Source/FreeImage/PluginJP2.cpp FreeImage-new/Source/FreeImage/PluginJP2.cpp
--- FreeImage/Source/FreeImage/PluginJP2.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJP2.cpp 2014-01-16 00:49:42.336523283 +0100
@@ -21,7 +21,7 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibOpenJPEG/openjpeg.h"
+#include <openjpeg.h>
#include "J2KHelper.h"
// ==========================================================
diff -rupN FreeImage/Source/FreeImage/PluginJPEG.cpp FreeImage-new/Source/FreeImage/PluginJPEG.cpp
--- FreeImage/Source/FreeImage/PluginJPEG.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJPEG.cpp 2014-01-16 00:49:42.336523283 +0100
@@ -35,9 +35,9 @@ extern "C" {
#undef FAR
#include <setjmp.h>
-#include "../LibJPEG/jinclude.h"
-#include "../LibJPEG/jpeglib.h"
-#include "../LibJPEG/jerror.h"
+#include <stdio.h>
+#include <jpeglib.h>
+#include <jerror.h>
}
#include "FreeImage.h"
diff -rupN FreeImage/Source/FreeImage/PluginPNG.cpp FreeImage-new/Source/FreeImage/PluginPNG.cpp
--- FreeImage/Source/FreeImage/PluginPNG.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginPNG.cpp 2014-01-16 00:49:42.337523300 +0100
@@ -37,8 +37,8 @@
// ----------------------------------------------------------
-#include "../ZLib/zlib.h"
-#include "../LibPNG/png.h"
+#include <zlib.h>
+#include <png.h>
// ----------------------------------------------------------
@@ -106,7 +106,11 @@ ReadMetadata(png_structp png_ptr, png_in
tag = FreeImage_CreateTag();
if(!tag) return FALSE;
+#ifdef PNG_iTXt_SUPPORTED
DWORD tag_length = (DWORD) MAX(text_ptr[i].text_length, text_ptr[i].itxt_length);
+#else
+ DWORD tag_length = text_ptr[i].text_length;
+#endif
FreeImage_SetTagLength(tag, tag_length);
FreeImage_SetTagCount(tag, tag_length);
@@ -153,10 +157,11 @@ WriteMetadata(png_structp png_ptr, png_i
text_metadata.key = (char*)FreeImage_GetTagKey(tag); // keyword, 1-79 character description of "text"
text_metadata.text = (char*)FreeImage_GetTagValue(tag); // comment, may be an empty string (ie "")
text_metadata.text_length = FreeImage_GetTagLength(tag);// length of the text string
+#ifdef PNG_iTXt_SUPPORTED
text_metadata.itxt_length = FreeImage_GetTagLength(tag);// length of the itxt string
text_metadata.lang = 0; // language code, 0-79 characters or a NULL pointer
text_metadata.lang_key = 0; // keyword translated UTF-8 string, 0 or more chars or a NULL pointer
-
+#endif
// set the tag
png_set_text(png_ptr, info_ptr, &text_metadata, 1);
@@ -175,10 +180,11 @@ WriteMetadata(png_structp png_ptr, png_i
text_metadata.key = (char*)g_png_xmp_keyword; // keyword, 1-79 character description of "text"
text_metadata.text = (char*)FreeImage_GetTagValue(tag); // comment, may be an empty string (ie "")
text_metadata.text_length = FreeImage_GetTagLength(tag);// length of the text string
+#ifdef PNG_iTXt_SUPPORTED
text_metadata.itxt_length = FreeImage_GetTagLength(tag);// length of the itxt string
text_metadata.lang = 0; // language code, 0-79 characters or a NULL pointer
text_metadata.lang_key = 0; // keyword translated UTF-8 string, 0 or more chars or a NULL pointer
-
+#endif
// set the tag
png_set_text(png_ptr, info_ptr, &text_metadata, 1);
bResult &= TRUE;
diff -rupN FreeImage/Source/FreeImage/PluginRAW.cpp FreeImage-new/Source/FreeImage/PluginRAW.cpp
--- FreeImage/Source/FreeImage/PluginRAW.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginRAW.cpp 2014-01-16 00:55:13.692904877 +0100
@@ -19,7 +19,7 @@
// Use at your own risk!
// ==========================================================
-#include "../LibRawLite/libraw/libraw.h"
+#include <libraw/libraw.h>
#include "FreeImage.h"
#include "Utilities.h"
diff -rupN FreeImage/Source/FreeImage/PluginTIFF.cpp FreeImage-new/Source/FreeImage/PluginTIFF.cpp
--- FreeImage/Source/FreeImage/PluginTIFF.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginTIFF.cpp 2014-01-16 00:49:42.337523300 +0100
@@ -37,9 +37,9 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibTIFF4/tiffiop.h"
+#include <tiffio.h>
#include "../Metadata/FreeImageTag.h"
-#include "../OpenEXR/Half/half.h"
+#include <half.h>
#include "FreeImageIO.h"
#include "PSDParser.h"
@@ -202,27 +202,9 @@ TIFFFdOpen(thandle_t handle, const char
_tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
_tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
- // Warning: tif_fd is declared as 'int' currently (see libTIFF),
- // may result in incorrect file pointers inside libTIFF on
- // 64bit machines (sizeof(int) != sizeof(long)).
- // Needs to be fixed within libTIFF.
- if (tif) {
- tif->tif_fd = (long)handle;
- }
-
return tif;
}
-/**
-Open a TIFF file for reading or writing
-@param name
-@param mode
-*/
-TIFF*
-TIFFOpen(const char* name, const char* mode) {
- return 0;
-}
-
// ----------------------------------------------------------
// TIFF library FreeImage-specific routines.
// ----------------------------------------------------------
diff -rupN FreeImage/Source/FreeImage/PluginG3.cpp FreeImage-new/Source/FreeImage/PluginG3.cpp
--- FreeImage/Source/FreeImage/PluginG3.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginG3.cpp 2014-01-16 00:49:42.336523283 +0100
@@ -20,7 +20,7 @@
// Use at your own risk!
// ==========================================================
-#include "../LibTIFF4/tiffiop.h"
+#include <tiffiop.h>
#include "FreeImage.h"
#include "Utilities.h"
diff -rupN FreeImage/Source/FreeImage/PluginWebP.cpp FreeImage-new/Source/FreeImage/PluginWebP.cpp
--- FreeImage/Source/FreeImage/PluginWebP.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginWebP.cpp 2014-01-16 00:49:42.337523300 +0100
@@ -37,10 +37,10 @@
#include "../Metadata/FreeImageTag.h"
-#include "../LibWebP/src/webp/decode.h"
-#include "../LibWebP/src/webp/encode.h"
-#include "../LibWebP/src/enc/vp8enci.h"
-#include "../LibWebP/src/webp/mux.h"
+#include <webp/decode.h>
+#include <webp/encode.h>
+//#include "../LibWebP/src/enc/vp8enci.h"
+#include <webp/mux.h>
// ==========================================================
// Plugin Interface
diff -rupN FreeImage/Source/FreeImage/ZLibInterface.cpp FreeImage-new/Source/FreeImage/ZLibInterface.cpp
--- FreeImage/Source/FreeImage/ZLibInterface.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImage/ZLibInterface.cpp 2014-01-16 00:49:42.338523316 +0100
@@ -19,10 +19,9 @@
// Use at your own risk!
// ==========================================================
-#include "../ZLib/zlib.h"
+#include <zlib.h>
#include "FreeImage.h"
#include "Utilities.h"
-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
/**
Compresses a source buffer into a target buffer, using the ZLib library.
@@ -115,7 +114,7 @@ FreeImage_ZLibGZip(BYTE *target, DWORD t
return 0;
case Z_OK: {
// patch header, setup crc and length (stolen from mod_trace_output)
- BYTE *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code
+ BYTE *p = target + 8; *p++ = 2; *p = 0x03; // xflags, os_code (unix)
crc = crc32(crc, source, source_size);
memcpy(target + 4 + dest_len, &crc, 4);
memcpy(target + 8 + dest_len, &source_size, 4);
diff -rupN FreeImage/Source/Metadata/XTIFF.cpp FreeImage-new/Source/Metadata/XTIFF.cpp
--- FreeImage/Source/Metadata/XTIFF.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/Metadata/XTIFF.cpp 2014-01-16 00:49:42.338523316 +0100
@@ -29,13 +29,22 @@
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
#endif
-#include "../LibTIFF4/tiffiop.h"
+#include <tiffiop.h>
#include "FreeImage.h"
#include "Utilities.h"
#include "FreeImageTag.h"
#include "FIRational.h"
+/*
+ * Caveat emperor this is a private libtiff functions which we need,
+ * there is no better solution I'm afraid.
+ */
+extern "C"
+{
+ int _TIFFDataSize(TIFFDataType type);
+}
+
// ----------------------------------------------------------
// Extended TIFF Directory GEO Tag Support
// ----------------------------------------------------------
@@ -205,7 +214,7 @@ tiff_write_geotiff_profile(TIFF *tif, FI
Read a single exif tag
*/
static BOOL
-tiff_read_exif_tag(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib, TagLib& tagLib, TIFFDirectory *td, uint32 tag) {
+tiff_read_exif_tag(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib, TagLib& tagLib, uint32 tag) {
const TIFFField *fip;
uint32 value_count;
int mem_alloc = 0;
@@ -226,8 +235,8 @@ tiff_read_exif_tag(TIFF *tif, TagLib::MD
return TRUE;
}
- if(fip->field_passcount) { //<- "passcount" means "returns count"
- if (fip->field_readcount != TIFF_VARIABLE2) { //<- TIFF_VARIABLE2 means "uses LONG count"
+ if(TIFFFieldPassCount(fip)) { //<- "passcount" means "returns count"
+ if (TIFFFieldReadCount(fip) != TIFF_VARIABLE2) { //<- TIFF_VARIABLE2 means "uses LONG count"
// assume TIFF_VARIABLE (uses SHORT count)
uint16 value_count16;
@@ -244,35 +253,37 @@ tiff_read_exif_tag(TIFF *tif, TagLib::MD
// determine count
- if (fip->field_readcount == TIFF_VARIABLE || fip->field_readcount == TIFF_VARIABLE2) {
+ if (TIFFFieldReadCount(fip) == TIFF_VARIABLE || TIFFFieldReadCount(fip) == TIFF_VARIABLE2) {
value_count = 1;
- } else if (fip->field_readcount == TIFF_SPP) {
- value_count = td->td_samplesperpixel;
+ } else if (TIFFFieldReadCount(fip) == TIFF_SPP) {
+ uint16 spp;
+ TIFFGetFieldDefaulted(tif, TIFFTAG_SAMPLESPERPIXEL, &spp);
+ value_count = spp;
} else {
- value_count = fip->field_readcount;
+ value_count = TIFFFieldReadCount(fip);
}
// access fields as pointers to data
// (### determining this is NOT robust... and hardly can be. It is implemented looking the _TIFFVGetField code)
- if(fip->field_tag == TIFFTAG_TRANSFERFUNCTION) {
+ if(TIFFFieldTag(fip) == TIFFTAG_TRANSFERFUNCTION) {
// reading this tag cause a bug probably located somewhere inside libtiff
return TRUE;
}
- if ((fip->field_type == TIFF_ASCII
- || fip->field_readcount == TIFF_VARIABLE
- || fip->field_readcount == TIFF_VARIABLE2
- || fip->field_readcount == TIFF_SPP
+ if ((TIFFFieldDataType(fip) == TIFF_ASCII
+ || TIFFFieldReadCount(fip) == TIFF_VARIABLE
+ || TIFFFieldReadCount(fip) == TIFF_VARIABLE2
+ || TIFFFieldReadCount(fip) == TIFF_SPP
|| value_count > 1)
- && fip->field_tag != TIFFTAG_PAGENUMBER
- && fip->field_tag != TIFFTAG_HALFTONEHINTS
- && fip->field_tag != TIFFTAG_YCBCRSUBSAMPLING
- && fip->field_tag != TIFFTAG_DOTRANGE
+ && TIFFFieldTag(fip) != TIFFTAG_PAGENUMBER
+ && TIFFFieldTag(fip) != TIFFTAG_HALFTONEHINTS
+ && TIFFFieldTag(fip) != TIFFTAG_YCBCRSUBSAMPLING
+ && TIFFFieldTag(fip) != TIFFTAG_DOTRANGE
- && fip->field_tag != TIFFTAG_BITSPERSAMPLE //<- these two are tricky -
- && fip->field_tag != TIFFTAG_COMPRESSION //<- they are defined as TIFF_VARIABLE but in reality return a single value
+ && TIFFFieldTag(fip) != TIFFTAG_BITSPERSAMPLE //<- these two are tricky:
+ && TIFFFieldTag(fip) != TIFFTAG_COMPRESSION //<- they are defined as TIFF_VARIABLE but in reality return a single value
) {
if(TIFFGetField(tif, tag, &raw_data) != 1) {
return TRUE;
@@ -281,7 +292,7 @@ tiff_read_exif_tag(TIFF *tif, TagLib::MD
// access fields as values
- const int value_size = _TIFFDataSize(fip->field_type);
+ const int value_size = _TIFFDataSize((TIFFFieldDataType(fip)));
raw_data = _TIFFmalloc(value_size * value_count);
mem_alloc = 1;
int ok = FALSE;
@@ -302,7 +313,7 @@ tiff_read_exif_tag(TIFF *tif, TagLib::MD
break;
*/
default:
- FreeImage_OutputMessageProc(FIF_TIFF, "Unimplemented variable number of parameters for Tiff Tag %s", fip->field_name);
+ FreeImage_OutputMessageProc(FIF_TIFF, "Unimplemented variable number of parameters for Tiff Tag %s", TIFFFieldName(fip));
break;
}
if(ok != 1) {
@@ -325,59 +336,59 @@ tiff_read_exif_tag(TIFF *tif, TagLib::MD
FreeImage_SetTagID(fitag, (WORD)tag);
FreeImage_SetTagKey(fitag, key);
- switch(fip->field_type) {
+ switch(TIFFFieldDataType(fip)) {
case TIFF_BYTE:
FreeImage_SetTagType(fitag, FIDT_BYTE);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_UNDEFINED:
FreeImage_SetTagType(fitag, FIDT_UNDEFINED);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_SBYTE:
FreeImage_SetTagType(fitag, FIDT_SBYTE);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_SHORT:
FreeImage_SetTagType(fitag, FIDT_SHORT);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_SSHORT:
FreeImage_SetTagType(fitag, FIDT_SSHORT);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_LONG:
FreeImage_SetTagType(fitag, FIDT_LONG);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_IFD:
FreeImage_SetTagType(fitag, FIDT_IFD);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_SLONG:
FreeImage_SetTagType(fitag, FIDT_SLONG);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
@@ -392,7 +403,7 @@ tiff_read_exif_tag(TIFF *tif, TagLib::MD
rvalue[2*i+1] = rational.getDenominator();
}
FreeImage_SetTagType(fitag, FIDT_RATIONAL);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, rvalue);
free(rvalue);
@@ -409,7 +420,7 @@ tiff_read_exif_tag(TIFF *tif, TagLib::MD
rvalue[2*i+1] = rational.getDenominator();
}
FreeImage_SetTagType(fitag, FIDT_RATIONAL);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, rvalue);
free(rvalue);
@@ -418,35 +429,35 @@ tiff_read_exif_tag(TIFF *tif, TagLib::MD
case TIFF_FLOAT:
FreeImage_SetTagType(fitag, FIDT_FLOAT);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_DOUBLE:
FreeImage_SetTagType(fitag, FIDT_DOUBLE);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_LONG8: // BigTIFF 64-bit unsigned integer
FreeImage_SetTagType(fitag, FIDT_LONG8);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_IFD8: // BigTIFF 64-bit unsigned integer (offset)
FreeImage_SetTagType(fitag, FIDT_IFD8);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
case TIFF_SLONG8: // BigTIFF 64-bit signed integer
FreeImage_SetTagType(fitag, FIDT_SLONG8);
- FreeImage_SetTagLength(fitag, TIFFDataWidth(fip->field_type) * value_count);
+ FreeImage_SetTagLength(fitag, TIFFDataWidth(TIFFFieldDataType(fip)) * value_count);
FreeImage_SetTagCount(fitag, value_count);
FreeImage_SetTagValue(fitag, raw_data);
break;
@@ -489,16 +500,16 @@ tiff_read_exif_tags(TIFF *tif, TagLib::M
TagLib& tagLib = TagLib::instance();
- TIFFDirectory *td = &tif->tif_dir;
-
count = (short) TIFFGetTagListCount(tif);
for(i = 0; i < count; i++) {
uint32 tag = TIFFGetTagListEntry(tif, i);
// read the tag
- if (!tiff_read_exif_tag(tif, md_model, dib, tagLib, td, tag))
+ if (!tiff_read_exif_tag(tif, md_model, dib, tagLib, tag))
return FALSE;
}
+/* Disabled for Fedora as it is using internal library structures. */
+#if 0
// we want to know values of standard tags too!!
// loop over all Core Directory Tags
@@ -533,13 +544,14 @@ tiff_read_exif_tags(TIFF *tif, TagLib::M
// process *all* other tags (some will be ignored)
- tiff_read_exif_tag(tif, md_model, dib, tagLib, td, fld->field_tag);
+ tiff_read_exif_tag(tif, md_model, dib, tagLib, fld->field_tag);
lastTag = fld->field_tag;
}
}
+#endif
return TRUE;
@@ -611,6 +623,10 @@ Write all known exif tags
*/
BOOL
tiff_write_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib) {
+/* Disabled for Fedora as it is using internal library structures. Siberia
+ * winter on upstream developer! :-) */
+ return FALSE;
+#if 0
char defaultKey[16];
// only EXIF_MAIN so far
@@ -662,4 +678,5 @@ tiff_write_exif_tags(TIFF *tif, TagLib::
}
return TRUE;
+#endif
}
diff -rupN FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp
--- FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp 2014-01-16 00:49:42.338523316 +0100
@@ -26,10 +26,10 @@
#undef FAR
#include <setjmp.h>
-#include "../LibJPEG/jinclude.h"
-#include "../LibJPEG/jpeglib.h"
-#include "../LibJPEG/jerror.h"
-#include "../LibJPEG/transupp.h"
+#include <jinclude.h>
+#include <jpeglib.h>
+#include <jerror.h>
+#include <transupp.h>
}
#include "FreeImage.h"
diff -rupN FreeImage/Source/LibJXR/image/sys/strcodec.c FreeImage-new/Source/LibJXR/image/sys/strcodec.c
--- FreeImage/Source/LibJXR/image/sys/strcodec.c 2014-01-16 00:27:03.000000000 +0100
+++ FreeImage-new/Source/LibJXR/image/sys/strcodec.c 2014-01-16 00:49:42.338523316 +0100
@@ -664,7 +664,7 @@
//================================================================
// Memory access functions
//================================================================
-#if (defined(WIN32) && !defined(UNDER_CE) && !defined(__MINGW32__)) || (defined(UNDER_CE) && defined(_ARM_))
+#if (defined(WIN32) && !defined(UNDER_CE)) || (defined(UNDER_CE) && defined(_ARM_))
// WinCE ARM and Desktop x86
#else
// other platform

View File

@@ -0,0 +1,216 @@
diff -rupN FreeImage/Source/FreeImage/PluginPCX.cpp FreeImage-new/Source/FreeImage/PluginPCX.cpp
--- FreeImage/Source/FreeImage/PluginPCX.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginPCX.cpp 2015-09-05 02:44:55.429436425 +0200
@@ -30,7 +30,7 @@
// Constants + headers
// ----------------------------------------------------------
-#define IO_BUF_SIZE 2048
+#define PCX_IO_BUF_SIZE 2048
// ----------------------------------------------------------
@@ -120,17 +120,17 @@ readline(FreeImageIO &io, fi_handle hand
while (length--) {
if (count == 0) {
- if (*ReadPos >= IO_BUF_SIZE - 1 ) {
- if (*ReadPos == IO_BUF_SIZE - 1) {
+ if (*ReadPos >= PCX_IO_BUF_SIZE - 1 ) {
+ if (*ReadPos == PCX_IO_BUF_SIZE - 1) {
// we still have one BYTE, copy it to the start pos
- *ReadBuf = ReadBuf[IO_BUF_SIZE - 1];
+ *ReadBuf = ReadBuf[PCX_IO_BUF_SIZE - 1];
- io.read_proc(ReadBuf + 1, 1, IO_BUF_SIZE - 1, handle);
+ io.read_proc(ReadBuf + 1, 1, PCX_IO_BUF_SIZE - 1, handle);
} else {
// read the complete buffer
- io.read_proc(ReadBuf, 1, IO_BUF_SIZE, handle);
+ io.read_proc(ReadBuf, 1, PCX_IO_BUF_SIZE, handle);
}
*ReadPos = 0;
@@ -346,19 +346,9 @@ Load(FreeImageIO *io, fi_handle handle,
BOOL header_only = (flags & FIF_LOAD_NOPIXELS) == FIF_LOAD_NOPIXELS;
try {
- // check PCX identifier
-
- long start_pos = io->tell_proc(handle);
- BOOL validated = pcx_validate(io, handle);
- io->seek_proc(handle, start_pos, SEEK_SET);
- if(!validated) {
- throw FI_MSG_ERROR_MAGIC_NUMBER;
- }
-
- // process the header
-
PCXHEADER header;
+ // process the header
if(io->read_proc(&header, sizeof(PCXHEADER), 1, handle) != 1) {
throw FI_MSG_ERROR_PARSING;
}
@@ -366,20 +356,38 @@ Load(FreeImageIO *io, fi_handle handle,
SwapHeader(&header);
#endif
- // allocate a new DIB
+ // process the window
+ const WORD *window = header.window; // left, upper, right,lower pixel coord.
+ const int left = window[0];
+ const int top = window[1];
+ const int right = window[2];
+ const int bottom = window[3];
- unsigned width = header.window[2] - header.window[0] + 1;
- unsigned height = header.window[3] - header.window[1] + 1;
- unsigned bitcount = header.bpp * header.planes;
-
- if (bitcount == 24) {
- dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
- } else {
- dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);
+ // check image size
+ if((left >= right) || (top >= bottom)) {
+ throw FI_MSG_ERROR_PARSING;
}
- // if the dib couldn't be allocated, throw an error
+ const unsigned width = right - left + 1;
+ const unsigned height = bottom - top + 1;
+ const unsigned bitcount = header.bpp * header.planes;
+ // allocate a new dib
+ switch(bitcount) {
+ case 1:
+ case 4:
+ case 8:
+ dib = FreeImage_AllocateHeader(header_only, width, height, bitcount);
+ break;
+ case 24:
+ dib = FreeImage_AllocateHeader(header_only, width, height, bitcount, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
+ break;
+ default:
+ throw FI_MSG_ERROR_DIB_MEMORY;
+ break;
+ }
+
+ // if the dib couldn't be allocated, throw an error
if (!dib) {
throw FI_MSG_ERROR_DIB_MEMORY;
}
@@ -426,19 +434,23 @@ Load(FreeImageIO *io, fi_handle handle,
if (palette_id == 0x0C) {
BYTE *cmap = (BYTE*)malloc(768 * sizeof(BYTE));
- io->read_proc(cmap, 768, 1, handle);
- pal = FreeImage_GetPalette(dib);
- BYTE *pColormap = &cmap[0];
+ if(cmap) {
+ io->read_proc(cmap, 768, 1, handle);
- for(int i = 0; i < 256; i++) {
- pal[i].rgbRed = pColormap[0];
- pal[i].rgbGreen = pColormap[1];
- pal[i].rgbBlue = pColormap[2];
- pColormap += 3;
+ pal = FreeImage_GetPalette(dib);
+ BYTE *pColormap = &cmap[0];
+
+ for(int i = 0; i < 256; i++) {
+ pal[i].rgbRed = pColormap[0];
+ pal[i].rgbGreen = pColormap[1];
+ pal[i].rgbBlue = pColormap[2];
+ pColormap += 3;
+ }
+
+ free(cmap);
}
- free(cmap);
}
// wrong palette ID, perhaps a gray scale is needed ?
@@ -463,12 +475,12 @@ Load(FreeImageIO *io, fi_handle handle,
return dib;
}
- // calculate the line length for the PCX and the DIB
+ // calculate the line length for the PCX and the dib
// length of raster line in bytes
- unsigned linelength = header.bytes_per_line * header.planes;
- // length of DIB line (rounded to DWORD) in bytes
- unsigned pitch = FreeImage_GetPitch(dib);
+ const unsigned linelength = header.bytes_per_line * header.planes;
+ // length of dib line (rounded to DWORD) in bytes
+ const unsigned pitch = FreeImage_GetPitch(dib);
// run-length encoding ?
@@ -478,14 +490,18 @@ Load(FreeImageIO *io, fi_handle handle,
// ---------------
line = (BYTE*)malloc(linelength * sizeof(BYTE));
- if(!line) throw FI_MSG_ERROR_MEMORY;
+ if(!line) {
+ throw FI_MSG_ERROR_MEMORY;
+ }
- ReadBuf = (BYTE*)malloc(IO_BUF_SIZE * sizeof(BYTE));
- if(!ReadBuf) throw FI_MSG_ERROR_MEMORY;
+ ReadBuf = (BYTE*)malloc(PCX_IO_BUF_SIZE * sizeof(BYTE));
+ if(!ReadBuf) {
+ throw FI_MSG_ERROR_MEMORY;
+ }
bits = FreeImage_GetScanLine(dib, height - 1);
- int ReadPos = IO_BUF_SIZE;
+ int ReadPos = PCX_IO_BUF_SIZE;
if ((header.planes == 1) && ((header.bpp == 1) || (header.bpp == 8))) {
BYTE skip;
@@ -497,7 +513,7 @@ Load(FreeImageIO *io, fi_handle handle,
// skip trailing garbage at the end of the scanline
for (unsigned count = written; count < linelength; count++) {
- if (ReadPos < IO_BUF_SIZE) {
+ if (ReadPos < PCX_IO_BUF_SIZE) {
ReadPos++;
} else {
io->read_proc(&skip, sizeof(BYTE), 1, handle);
@@ -513,7 +529,9 @@ Load(FreeImageIO *io, fi_handle handle,
unsigned x, y, written;
buffer = (BYTE*)malloc(width * sizeof(BYTE));
- if(!buffer) throw FI_MSG_ERROR_MEMORY;
+ if(!buffer) {
+ throw FI_MSG_ERROR_MEMORY;
+ }
for (y = 0; y < height; y++) {
written = readline(*io, handle, line, linelength, bIsRLE, ReadBuf, &ReadPos);
@@ -532,7 +550,7 @@ Load(FreeImageIO *io, fi_handle handle,
}
}
- // then write the DIB row
+ // then write the dib row
for (x = 0; x < width / 2; x++) {
bits[x] = (buffer[2*x] << 4) | buffer[2*x+1];
@@ -541,7 +559,7 @@ Load(FreeImageIO *io, fi_handle handle,
// skip trailing garbage at the end of the scanline
for (unsigned count = written; count < linelength; count++) {
- if (ReadPos < IO_BUF_SIZE) {
+ if (ReadPos < PCX_IO_BUF_SIZE) {
ReadPos++;
} else {
io->read_proc(&skip, sizeof(BYTE), 1, handle);

View File

@@ -0,0 +1,167 @@
diff -rupN FreeImage/Makefile.fip FreeImage-new/Makefile.fip
--- FreeImage/Makefile.fip 2015-09-17 22:51:21.797196208 +0200
+++ FreeImage-new/Makefile.fip 2015-09-24 01:18:01.576395215 +0200
@@ -3,6 +3,14 @@
# This file can be generated by ./genfipsrclist.sh
include fipMakefile.srcs
+CC = gcc
+CXX = g++
+LD = g++
+AR = ar
+DLLTOOL = dlltool
+RC = windres
+PKGCONFIG = pkg-config
+
# General configuration variables:
DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
@@ -24,24 +32,21 @@ override CFLAGS += -DNO_LCMS
override CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
override CFLAGS += $(INCLUDE)
CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
+override CXXFLAGS += -DFIP_EXPORTS
# LibJXR
override CXXFLAGS += -D__ANSI__
override CXXFLAGS += $(INCLUDE)
LDFLAGS ?=
-override LDFLAGS += -LDist -lfreeimage-$(VER_MAJOR).$(VER_MINOR)
-
-ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
- override CFLAGS += -fPIC
- override CXXFLAGS += -fPIC
-endif
+override LDFLAGS += -LDist -lfreeimage-$(VER_MAJOR) -lgdi32
TARGET = freeimageplus
STATICLIB = lib$(TARGET).a
-SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
-LIBNAME = lib$(TARGET).so
-VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
+SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).dll
+IMPORTLIB = lib$(TARGET).dll.a
+EXPORTLIB = lib$(TARGET).exp
HEADER = Source/FreeImage.h
HEADERFIP = Wrapper/FreeImagePlus/FreeImagePlus.h
+RCFILE = Wrapper/FreeImagePlus/FreeImagePlus.rc
default: all
@@ -51,7 +56,8 @@ all: dist
dist: FreeImage
mkdir -p Dist
cp *.a Dist/
- cp *.so Dist/
+ cp *.dll Dist/
+ cp *.dll.a Dist/
cp Source/FreeImage.h Dist/
cp Wrapper/FreeImagePlus/FreeImagePlus.h Dist/
@@ -66,21 +72,14 @@ FreeImage: $(STATICLIB) $(SHAREDLIB)
.cpp.o:
$(CXX) $(CXXFLAGS) -c $< -o $@
-$(STATICLIB): $(MODULES)
- $(AR) r $@ $(MODULES)
+%.coff: %.rc
+ $(RC) $(RCFLAGS) -o $@ $<
-$(SHAREDLIB): $(MODULES)
- $(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
-
-install:
- install -d $(INCDIR) $(INSTALLDIR)
- install -m 644 -o root -g root $(HEADER) $(INCDIR)
- install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
- ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
- ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
+$(STATICLIB): $(MODULES)
+ $(AR) rs $@ $(MODULES)
-clean:
- rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
+$(IMPORTLIB) $(EXPORTLIB): $(MODULES)
+ $(DLLTOOL) -e $(EXPORTLIB) -l $(IMPORTLIB) -D $(SHAREDLIB) $(DLLTOOLFLAGS) $(MODULES)
+$(SHAREDLIB): $(EXPORTLIB) $(RESOURCE)
+ $(LD) -shared -o $@ $(EXPORTLIB) $(MODULES) $(RESOURCE) $(LDFLAGS)
diff -rupN FreeImage/Makefile.gnu FreeImage-new/Makefile.gnu
--- FreeImage/Makefile.gnu 2015-09-17 22:51:21.798196232 +0200
+++ FreeImage-new/Makefile.gnu 2015-09-24 01:24:52.381788259 +0200
@@ -3,6 +3,14 @@
# This file can be generated by ./gensrclist.sh
include Makefile.srcs
+CC = gcc
+CXX = g++
+LD = g++
+AR = ar
+DLLTOOL = dlltool
+RC = windres
+PKGCONFIG = pkg-config
+
# General configuration variables:
DESTDIR ?= /
INCDIR ?= $(DESTDIR)/usr/include
@@ -16,18 +24,14 @@ LIBRARIES = -lstdc++
MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
-override CFLAGS += $(INCLUDE) -D__ANSI__ -I/usr/include/jxrlib $(shell pkg-config --cflags OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp zlib)
-override LDFLAGS += -ljpeg -ljpegxr $(shell pkg-config --libs OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp zlib)
-
-ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
- override CFLAGS += -fPIC
-endif
+override CFLAGS += $(INCLUDE) -D__ANSI__ -DFREEIMAGE_EXPORTS -I/mingw32/include/jxrlib -I/mingw64/include/jxrlib $(shell ${PKGCONFIG} --cflags OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
+override LDFLAGS += -ljpeg -ljpegxr -ljxrglue $(shell ${PKGCONFIG} --libs OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp libwebpmux zlib)
TARGET = freeimage
STATICLIB = lib$(TARGET).a
-SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so
-LIBNAME = lib$(TARGET).so
-VERLIBNAME = $(LIBNAME).$(VER_MAJOR)
+SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).dll
+IMPORTLIB = lib$(TARGET).dll.a
+EXPORTLIB = lib$(TARGET).exp
HEADER = Source/FreeImage.h
@@ -39,7 +43,8 @@ all: dist
dist: FreeImage
mkdir -p Dist
cp *.a Dist/
- cp *.so Dist/
+ cp *.dll Dist/
+ cp *.dll.a Dist/
cp Source/FreeImage.h Dist/
dos2unix:
@@ -54,20 +59,10 @@ FreeImage: $(STATICLIB) $(SHAREDLIB)
$(CXX) $(CFLAGS) -c $< -o $@
$(STATICLIB): $(MODULES)
- $(AR) r $@ $(MODULES)
-
-$(SHAREDLIB): $(MODULES)
- $(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
-
-install:
- install -d $(INCDIR) $(INSTALLDIR)
- install -m 644 -o root -g root $(HEADER) $(INCDIR)
- install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
- install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
- ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
- ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
-# ldconfig
+ $(AR) rs $@ $(MODULES)
-clean:
- rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
+$(IMPORTLIB) $(EXPORTLIB): $(MODULES)
+ $(DLLTOOL) -e $(EXPORTLIB) -l $(IMPORTLIB) -D $(SHAREDLIB) $(DLLTOOLFLAGS) $(MODULES)
+$(SHAREDLIB): $(EXPORTLIB) $(RESOURCE)
+ $(LD) -shared -o $@ $(EXPORTLIB) $(MODULES) $(RESOURCE) $(LDFLAGS)

View File

@@ -0,0 +1,548 @@
diff -rupN FreeImage/genfipsrclist.sh FreeImage-new/genfipsrclist.sh
--- FreeImage/genfipsrclist.sh 2015-02-20 10:52:16.000000000 +0100
+++ FreeImage-new/genfipsrclist.sh 2015-09-05 02:13:52.041353305 +0200
@@ -1,6 +1,6 @@
#!/bin/sh
-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibPNG Source/LibTIFF4 Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath Source/OpenEXR/IexMath Source/LibRawLite Source/LibRawLite/dcraw Source/LibRawLite/internal Source/LibRawLite/libraw Source/LibRawLite/src Source/LibWebP Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib Wrapper/FreeImagePlus"
+DIRLIST="Wrapper/FreeImagePlus"
echo "VER_MAJOR = 3" > fipMakefile.srcs
@@ -19,5 +19,6 @@ echo -n "INCLUDE =" >> fipMakefile.srcs
for DIR in $DIRLIST; do
echo -n " -I$DIR" >> fipMakefile.srcs
done
+echo -n " -IDist" >> fipMakefile.srcs
echo >> fipMakefile.srcs
diff -rupN FreeImage/gensrclist.sh FreeImage-new/gensrclist.sh
--- FreeImage/gensrclist.sh 2015-02-20 10:51:50.000000000 +0100
+++ FreeImage-new/gensrclist.sh 2015-09-05 02:13:52.041353305 +0200
@@ -1,6 +1,6 @@
#!/bin/sh
-DIRLIST=". Source Source/Metadata Source/FreeImageToolkit Source/LibJPEG Source/LibPNG Source/LibTIFF4 Source/ZLib Source/LibOpenJPEG Source/OpenEXR Source/OpenEXR/Half Source/OpenEXR/Iex Source/OpenEXR/IlmImf Source/OpenEXR/IlmThread Source/OpenEXR/Imath Source/OpenEXR/IexMath Source/LibRawLite Source/LibRawLite/dcraw Source/LibRawLite/internal Source/LibRawLite/libraw Source/LibRawLite/src Source/LibWebP Source/LibJXR Source/LibJXR/common/include Source/LibJXR/image/sys Source/LibJXR/jxrgluelib"
+DIRLIST=". Source Source/Metadata Source/FreeImageToolkit"
echo "VER_MAJOR = 3" > Makefile.srcs
echo "VER_MINOR = 17.0" >> Makefile.srcs
diff -rupN FreeImage/Makefile.fip FreeImage-new/Makefile.fip
--- FreeImage/Makefile.fip 2015-03-08 18:03:56.000000000 +0100
+++ FreeImage-new/Makefile.fip 2015-09-05 02:14:09.212684028 +0200
@@ -17,20 +17,22 @@ MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
# OpenJPEG
-CFLAGS += -DOPJ_STATIC
+override CFLAGS += -DOPJ_STATIC
# LibRaw
-CFLAGS += -DNO_LCMS
+override CFLAGS += -DNO_LCMS
# LibJXR
-CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
-CFLAGS += $(INCLUDE)
+override CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
+override CFLAGS += $(INCLUDE)
CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
# LibJXR
-CXXFLAGS += -D__ANSI__
-CXXFLAGS += $(INCLUDE)
+override CXXFLAGS += -D__ANSI__
+override CXXFLAGS += $(INCLUDE)
+LDFLAGS ?=
+override LDFLAGS += -LDist -lfreeimage-$(VER_MAJOR).$(VER_MINOR)
ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
- CFLAGS += -fPIC
- CXXFLAGS += -fPIC
+ override CFLAGS += -fPIC
+ override CXXFLAGS += -fPIC
endif
TARGET = freeimageplus
@@ -68,7 +70,7 @@ $(STATICLIB): $(MODULES)
$(AR) r $@ $(MODULES)
$(SHAREDLIB): $(MODULES)
- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+ $(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
install:
install -d $(INCDIR) $(INSTALLDIR)
diff -rupN FreeImage/Makefile.gnu FreeImage-new/Makefile.gnu
--- FreeImage/Makefile.gnu 2015-03-08 18:04:00.000000000 +0100
+++ FreeImage-new/Makefile.gnu 2015-09-05 02:14:04.810599259 +0200
@@ -16,21 +16,11 @@ LIBRARIES = -lstdc++
MODULES = $(SRCS:.c=.o)
MODULES := $(MODULES:.cpp=.o)
CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden
-# OpenJPEG
-CFLAGS += -DOPJ_STATIC
-# LibRaw
-CFLAGS += -DNO_LCMS
-# LibJXR
-CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
-CFLAGS += $(INCLUDE)
-CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy
-# LibJXR
-CXXFLAGS += -D__ANSI__
-CXXFLAGS += $(INCLUDE)
+override CFLAGS += $(INCLUDE) -D__ANSI__ -I/usr/include/jxrlib $(shell pkg-config --cflags OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp zlib)
+override LDFLAGS += -ljpeg -ljpegxr $(shell pkg-config --libs OpenEXR libopenjp2 libraw libpng libtiff-4 libwebp zlib)
ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)
- CFLAGS += -fPIC
- CXXFLAGS += -fPIC
+ override CFLAGS += -fPIC
endif
TARGET = freeimage
@@ -61,13 +51,13 @@ FreeImage: $(STATICLIB) $(SHAREDLIB)
$(CC) $(CFLAGS) -c $< -o $@
.cpp.o:
- $(CXX) $(CXXFLAGS) -c $< -o $@
+ $(CXX) $(CFLAGS) -c $< -o $@
$(STATICLIB): $(MODULES)
$(AR) r $@ $(MODULES)
$(SHAREDLIB): $(MODULES)
- $(CC) -s -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
+ $(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)
install:
install -d $(INCDIR) $(INSTALLDIR)
diff -rupN FreeImage/Source/FreeImage/J2KHelper.cpp FreeImage-new/Source/FreeImage/J2KHelper.cpp
--- FreeImage/Source/FreeImage/J2KHelper.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/J2KHelper.cpp 2015-09-05 02:13:52.042353324 +0200
@@ -21,7 +21,7 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibOpenJPEG/openjpeg.h"
+#include <openjpeg.h>
#include "J2KHelper.h"
// --------------------------------------------------------------------------
diff -rupN FreeImage/Source/FreeImage/Plugin.cpp FreeImage-new/Source/FreeImage/Plugin.cpp
--- FreeImage/Source/FreeImage/Plugin.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/Plugin.cpp 2015-09-05 02:13:52.042353324 +0200
@@ -263,7 +263,12 @@ FreeImage_Initialise(BOOL load_local_plu
s_plugins->AddNode(InitDDS);
s_plugins->AddNode(InitGIF);
s_plugins->AddNode(InitHDR);
- s_plugins->AddNode(InitG3);
+/* The G3 fax format plugin is deliberately disabled in the Fedora build of
+ FreeImage as it requires that FreeImage uses a private copy of libtiff
+ which is a no no because of security reasons. */
+#if 0
+ s_plugins->AddNode(InitG3);
+#endif
s_plugins->AddNode(InitSGI);
s_plugins->AddNode(InitEXR);
s_plugins->AddNode(InitJ2K);
diff -rupN FreeImage/Source/FreeImage/PluginEXR.cpp FreeImage-new/Source/FreeImage/PluginEXR.cpp
--- FreeImage/Source/FreeImage/PluginEXR.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginEXR.cpp 2015-09-05 02:13:52.042353324 +0200
@@ -28,16 +28,16 @@
#pragma warning (disable : 4800) // ImfVersion.h - 'const int' : forcing value to bool 'true' or 'false' (performance warning)
#endif
-#include "../OpenEXR/IlmImf/ImfIO.h"
-#include "../OpenEXR/Iex/Iex.h"
-#include "../OpenEXR/IlmImf/ImfOutputFile.h"
-#include "../OpenEXR/IlmImf/ImfInputFile.h"
-#include "../OpenEXR/IlmImf/ImfRgbaFile.h"
-#include "../OpenEXR/IlmImf/ImfChannelList.h"
-#include "../OpenEXR/IlmImf/ImfRgba.h"
-#include "../OpenEXR/IlmImf/ImfArray.h"
-#include "../OpenEXR/IlmImf/ImfPreviewImage.h"
-#include "../OpenEXR/Half/half.h"
+#include <OpenEXR/ImfIO.h>
+#include <OpenEXR/Iex.h>
+#include <OpenEXR/ImfOutputFile.h>
+#include <OpenEXR/ImfInputFile.h>
+#include <OpenEXR/ImfRgbaFile.h>
+#include <OpenEXR/ImfChannelList.h>
+#include <OpenEXR/ImfRgba.h>
+#include <OpenEXR/ImfArray.h>
+#include <OpenEXR/ImfPreviewImage.h>
+#include <OpenEXR/half.h>
// ==========================================================
diff -rupN FreeImage/Source/FreeImage/PluginJ2K.cpp FreeImage-new/Source/FreeImage/PluginJ2K.cpp
--- FreeImage/Source/FreeImage/PluginJ2K.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJ2K.cpp 2015-09-05 02:13:52.043353343 +0200
@@ -21,7 +21,7 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibOpenJPEG/openjpeg.h"
+#include <openjpeg.h>
#include "J2KHelper.h"
// ==========================================================
diff -rupN FreeImage/Source/FreeImage/PluginJP2.cpp FreeImage-new/Source/FreeImage/PluginJP2.cpp
--- FreeImage/Source/FreeImage/PluginJP2.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJP2.cpp 2015-09-05 02:13:52.043353343 +0200
@@ -21,7 +21,7 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibOpenJPEG/openjpeg.h"
+#include <openjpeg.h>
#include "J2KHelper.h"
// ==========================================================
diff -rupN FreeImage/Source/FreeImage/PluginJPEG.cpp FreeImage-new/Source/FreeImage/PluginJPEG.cpp
--- FreeImage/Source/FreeImage/PluginJPEG.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJPEG.cpp 2015-09-05 02:13:52.043353343 +0200
@@ -35,9 +35,9 @@ extern "C" {
#undef FAR
#include <setjmp.h>
-#include "../LibJPEG/jinclude.h"
-#include "../LibJPEG/jpeglib.h"
-#include "../LibJPEG/jerror.h"
+#include <stdio.h>
+#include <jpeglib.h>
+#include <jerror.h>
}
#include "FreeImage.h"
diff -rupN FreeImage/Source/FreeImage/PluginJXR.cpp FreeImage-new/Source/FreeImage/PluginJXR.cpp
--- FreeImage/Source/FreeImage/PluginJXR.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginJXR.cpp 2015-09-05 02:13:52.043353343 +0200
@@ -23,7 +23,7 @@
#include "Utilities.h"
#include "../Metadata/FreeImageTag.h"
-#include "../LibJXR/jxrgluelib/JXRGlue.h"
+#include <JXRGlue.h>
// ==========================================================
// Plugin Interface
diff -rupN FreeImage/Source/FreeImage/PluginPNG.cpp FreeImage-new/Source/FreeImage/PluginPNG.cpp
--- FreeImage/Source/FreeImage/PluginPNG.cpp 2015-03-10 20:16:12.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginPNG.cpp 2015-09-05 02:13:52.044353363 +0200
@@ -40,8 +40,8 @@
// ----------------------------------------------------------
-#include "../ZLib/zlib.h"
-#include "../LibPNG/png.h"
+#include <zlib.h>
+#include <png.h>
// ----------------------------------------------------------
diff -rupN FreeImage/Source/FreeImage/PluginRAW.cpp FreeImage-new/Source/FreeImage/PluginRAW.cpp
--- FreeImage/Source/FreeImage/PluginRAW.cpp 2015-03-08 20:12:04.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginRAW.cpp 2015-09-05 02:13:52.044353363 +0200
@@ -19,7 +19,7 @@
// Use at your own risk!
// ==========================================================
-#include "../LibRawLite/libraw/libraw.h"
+#include <libraw/libraw.h>
#include "FreeImage.h"
#include "Utilities.h"
diff -rupN FreeImage/Source/FreeImage/PluginTIFF.cpp FreeImage-new/Source/FreeImage/PluginTIFF.cpp
--- FreeImage/Source/FreeImage/PluginTIFF.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginTIFF.cpp 2015-09-05 02:13:52.044353363 +0200
@@ -37,9 +37,9 @@
#include "FreeImage.h"
#include "Utilities.h"
-#include "../LibTIFF4/tiffiop.h"
+#include <tiffio.h>
#include "../Metadata/FreeImageTag.h"
-#include "../OpenEXR/Half/half.h"
+#include <OpenEXR/half.h>
#include "FreeImageIO.h"
#include "PSDParser.h"
@@ -194,16 +194,6 @@ TIFFFdOpen(thandle_t handle, const char
return tif;
}
-/**
-Open a TIFF file for reading or writing
-@param name
-@param mode
-*/
-TIFF*
-TIFFOpen(const char* name, const char* mode) {
- return 0;
-}
-
// ----------------------------------------------------------
// TIFF library FreeImage-specific routines.
// ----------------------------------------------------------
diff -rupN FreeImage/Source/FreeImage/PluginWebP.cpp FreeImage-new/Source/FreeImage/PluginWebP.cpp
--- FreeImage/Source/FreeImage/PluginWebP.cpp 2015-03-02 02:07:08.000000000 +0100
+++ FreeImage-new/Source/FreeImage/PluginWebP.cpp 2015-09-05 02:13:52.044353363 +0200
@@ -24,10 +24,10 @@
#include "../Metadata/FreeImageTag.h"
-#include "../LibWebP/src/webp/decode.h"
-#include "../LibWebP/src/webp/encode.h"
-#include "../LibWebP/src/enc/vp8enci.h"
-#include "../LibWebP/src/webp/mux.h"
+#include <webp/decode.h>
+#include <webp/encode.h>
+// #include "../LibWebP/src/enc/vp8enci.h"
+#include <webp/mux.h>
// ==========================================================
// Plugin Interface
diff -rupN FreeImage/Source/FreeImage/ZLibInterface.cpp FreeImage-new/Source/FreeImage/ZLibInterface.cpp
--- FreeImage/Source/FreeImage/ZLibInterface.cpp 2015-03-02 02:07:10.000000000 +0100
+++ FreeImage-new/Source/FreeImage/ZLibInterface.cpp 2015-09-05 02:13:52.044353363 +0200
@@ -19,10 +19,9 @@
// Use at your own risk!
// ==========================================================
-#include "../ZLib/zlib.h"
+#include <zlib.h>
#include "FreeImage.h"
#include "Utilities.h"
-#include "../ZLib/zutil.h" /* must be the last header because of error C3163 in VS2008 (_vsnprintf defined in stdio.h) */
/**
Compresses a source buffer into a target buffer, using the ZLib library.
@@ -115,7 +114,7 @@ FreeImage_ZLibGZip(BYTE *target, DWORD t
return 0;
case Z_OK: {
// patch header, setup crc and length (stolen from mod_trace_output)
- BYTE *p = target + 8; *p++ = 2; *p = OS_CODE; // xflags, os_code
+ BYTE *p = target + 8; *p++ = 2; *p = 0x03; // xflags, os_code (unix)
crc = crc32(crc, source, source_size);
memcpy(target + 4 + dest_len, &crc, 4);
memcpy(target + 8 + dest_len, &source_size, 4);
diff -rupN FreeImage/Source/FreeImage.h FreeImage-new/Source/FreeImage.h
--- FreeImage/Source/FreeImage.h 2015-03-04 02:17:54.000000000 +0100
+++ FreeImage-new/Source/FreeImage.h 2015-09-05 02:13:52.045353382 +0200
@@ -155,8 +155,11 @@ typedef uint8_t BYTE;
typedef uint16_t WORD;
typedef uint32_t DWORD;
typedef int32_t LONG;
+// Disable these, they conflict with the (wrong) ones of libraw
+#if 0
typedef int64_t INT64;
typedef uint64_t UINT64;
+#endif
#else
// MS is not C99 ISO compliant
typedef long BOOL;
@@ -410,7 +413,12 @@ FI_ENUM(FREE_IMAGE_FORMAT) {
FIF_DDS = 24,
FIF_GIF = 25,
FIF_HDR = 26,
- FIF_FAXG3 = 27,
+/* The G3 fax format plugin is deliberately disabled in the Fedora build of
+ FreeImage as it requires that FreeImage uses a private copy of libtiff
+ which is a no no because of security reasons. */
+#if 0
+ FIF_FAXG3 = 27,
+#endif
FIF_SGI = 28,
FIF_EXR = 29,
FIF_J2K = 30,
@@ -473,6 +481,10 @@ FI_ENUM(FREE_IMAGE_DITHER) {
FID_BAYER16x16 = 6 //! Bayer ordered dispersed dot dithering (order 4 dithering matrix)
};
+/* The FreeImage_JPEGTransform functions are deliberately disabled in the
+ Fedora build of FreeImage as they require that FreeImage uses a private copy
+ of libjpeg which is a no no because of security reasons. */
+#if 0
/** Lossless JPEG transformations
Constants used in FreeImage_JPEGTransform
*/
@@ -486,6 +498,7 @@ FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
FIJPEG_OP_ROTATE_180 = 6, //! 180-degree rotation
FIJPEG_OP_ROTATE_270 = 7 //! 270-degree clockwise (or 90 ccw)
};
+#endif
/** Tone mapping operators.
Constants used in FreeImage_ToneMapping.
@@ -1076,7 +1089,10 @@ DLL_API const char* DLL_CALLCONV FreeIma
// --------------------------------------------------------------------------
// JPEG lossless transformation routines
// --------------------------------------------------------------------------
-
+/* The FreeImage_JPEGTransform functions are deliberately disabled in the
++ Fedora build of FreeImage as they require that FreeImage uses a private copy
++ of libjpeg which is a no no because of security reasons. */
+#if 0
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
@@ -1085,6 +1101,7 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEG
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombined(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* src_stream, FIMEMORY* dst_stream, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
+#endif
// --------------------------------------------------------------------------
diff -rupN FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp
--- FreeImage/Source/FreeImageToolkit/JPEGTransform.cpp 2015-03-02 02:07:10.000000000 +0100
+++ FreeImage-new/Source/FreeImageToolkit/JPEGTransform.cpp 2015-09-05 02:13:52.045353382 +0200
@@ -26,10 +26,10 @@ extern "C" {
#undef FAR
#include <setjmp.h>
-#include "../LibJPEG/jinclude.h"
-#include "../LibJPEG/jpeglib.h"
-#include "../LibJPEG/jerror.h"
-#include "../LibJPEG/transupp.h"
+#include <jinclude.h>
+#include <jpeglib.h>
+#include <jerror.h>
+#include <transupp.h>
}
#include "FreeImage.h"
diff -rupN FreeImage/Source/Metadata/TagConversion.cpp FreeImage-new/Source/Metadata/TagConversion.cpp
--- FreeImage/Source/Metadata/TagConversion.cpp 2015-03-02 02:07:10.000000000 +0100
+++ FreeImage-new/Source/Metadata/TagConversion.cpp 2015-09-05 02:13:52.045353382 +0200
@@ -30,6 +30,11 @@
#define MAX_TEXT_EXTENT 512
+// These were in FreeImage.h, but are moved here to avoid conflicts (see note in FreeImage.h)
+typedef int64_t INT64;
+typedef uint64_t UINT64;
+
+
/**
Convert a tag to a C string
*/
diff -rupN FreeImage/Source/Metadata/XTIFF.cpp FreeImage-new/Source/Metadata/XTIFF.cpp
--- FreeImage/Source/Metadata/XTIFF.cpp 2015-03-02 02:07:10.000000000 +0100
+++ FreeImage-new/Source/Metadata/XTIFF.cpp 2015-09-05 02:13:52.045353382 +0200
@@ -29,13 +29,18 @@
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
#endif
-#include "../LibTIFF4/tiffiop.h"
+#include <tiffio.h>
#include "FreeImage.h"
#include "Utilities.h"
#include "FreeImageTag.h"
#include "FIRational.h"
+extern "C"
+{
+ int _TIFFDataSize(TIFFDataType type);
+}
+
// ----------------------------------------------------------
// Extended TIFF Directory GEO Tag Support
// ----------------------------------------------------------
@@ -224,6 +229,33 @@ tiff_write_geotiff_profile(TIFF *tif, FI
// TIFF EXIF tag reading & writing
// ----------------------------------------------------------
+static uint32 exif_tag_ids[] = {
+ EXIFTAG_EXPOSURETIME, EXIFTAG_FNUMBER, EXIFTAG_EXPOSUREPROGRAM,
+ EXIFTAG_SPECTRALSENSITIVITY, EXIFTAG_ISOSPEEDRATINGS, EXIFTAG_OECF,
+ EXIFTAG_EXIFVERSION, EXIFTAG_DATETIMEORIGINAL, EXIFTAG_DATETIMEDIGITIZED,
+ EXIFTAG_COMPONENTSCONFIGURATION, EXIFTAG_COMPRESSEDBITSPERPIXEL,
+ EXIFTAG_SHUTTERSPEEDVALUE, EXIFTAG_APERTUREVALUE,
+ EXIFTAG_BRIGHTNESSVALUE, EXIFTAG_EXPOSUREBIASVALUE,
+ EXIFTAG_MAXAPERTUREVALUE, EXIFTAG_SUBJECTDISTANCE, EXIFTAG_METERINGMODE,
+ EXIFTAG_LIGHTSOURCE, EXIFTAG_FLASH, EXIFTAG_FOCALLENGTH,
+ EXIFTAG_SUBJECTAREA, EXIFTAG_MAKERNOTE, EXIFTAG_USERCOMMENT,
+ EXIFTAG_SUBSECTIME, EXIFTAG_SUBSECTIMEORIGINAL,
+ EXIFTAG_SUBSECTIMEDIGITIZED, EXIFTAG_FLASHPIXVERSION, EXIFTAG_COLORSPACE,
+ EXIFTAG_PIXELXDIMENSION, EXIFTAG_PIXELYDIMENSION,
+ EXIFTAG_RELATEDSOUNDFILE, EXIFTAG_FLASHENERGY,
+ EXIFTAG_SPATIALFREQUENCYRESPONSE, EXIFTAG_FOCALPLANEXRESOLUTION,
+ EXIFTAG_FOCALPLANEYRESOLUTION, EXIFTAG_FOCALPLANERESOLUTIONUNIT,
+ EXIFTAG_SUBJECTLOCATION, EXIFTAG_EXPOSUREINDEX, EXIFTAG_SENSINGMETHOD,
+ EXIFTAG_FILESOURCE, EXIFTAG_SCENETYPE, EXIFTAG_CFAPATTERN,
+ EXIFTAG_CUSTOMRENDERED, EXIFTAG_EXPOSUREMODE, EXIFTAG_WHITEBALANCE,
+ EXIFTAG_DIGITALZOOMRATIO, EXIFTAG_FOCALLENGTHIN35MMFILM,
+ EXIFTAG_SCENECAPTURETYPE, EXIFTAG_GAINCONTROL, EXIFTAG_CONTRAST,
+ EXIFTAG_SATURATION, EXIFTAG_SHARPNESS, EXIFTAG_DEVICESETTINGDESCRIPTION,
+ EXIFTAG_SUBJECTDISTANCERANGE, EXIFTAG_GAINCONTROL, EXIFTAG_GAINCONTROL,
+ EXIFTAG_IMAGEUNIQUEID
+};
+static int nExifTags = sizeof(exif_tag_ids) / sizeof(exif_tag_ids[0]);
+
/**
Read a single Exif tag
@@ -575,45 +607,11 @@ tiff_read_exif_tags(TIFF *tif, TagLib::M
// loop over all Core Directory Tags
// ### uses private data, but there is no other way
+ // -> Fedora: Best we can do without private headers is to hard-code a list of known EXIF tags and read those
if(md_model == TagLib::EXIF_MAIN) {
- const TIFFDirectory *td = &tif->tif_dir;
-
- uint32 lastTag = 0; //<- used to prevent reading some tags twice (as stored in tif_fieldinfo)
-
- for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) {
- const TIFFField *fld = tif->tif_fields[fi];
-
- const uint32 tag_id = TIFFFieldTag(fld);
-
- if(tag_id == lastTag) {
- continue;
- }
-
- // test if tag value is set
- // (lifted directly from LibTiff _TIFFWriteDirectory)
-
- if( fld->field_bit == FIELD_CUSTOM ) {
- int is_set = FALSE;
-
- for(int ci = 0; ci < td->td_customValueCount; ci++ ) {
- is_set |= (td->td_customValues[ci].info == fld);
- }
-
- if( !is_set ) {
- continue;
- }
-
- } else if(!TIFFFieldSet(tif, fld->field_bit)) {
- continue;
- }
-
- // process *all* other tags (some will be ignored)
-
- tiff_read_exif_tag(tif, tag_id, dib, md_model);
-
- lastTag = tag_id;
+ for (int i = 0; i < nExifTags; ++i) {
+ tiff_read_exif_tag(tif, exif_tag_ids[i], dib, md_model);
}
-
}
return TRUE;
@@ -723,10 +721,9 @@ tiff_write_exif_tags(TIFF *tif, TagLib::
TagLib& tag_lib = TagLib::instance();
- for (int fi = 0, nfi = (int)tif->tif_nfields; nfi > 0; nfi--, fi++) {
- const TIFFField *fld = tif->tif_fields[fi];
-
- const uint32 tag_id = TIFFFieldTag(fld);
+ for (int fi = 0; fi < nExifTags; fi++) {
+ const uint32 tag_id = exif_tag_ids[fi];
+ const TIFFField *fld = TIFFFieldWithTag(tif, tag_id);
if(skip_write_field(tif, tag_id)) {
// skip tags that are already handled by the LibTIFF writing process

View File

@@ -1,64 +1,58 @@
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
_realname=FreeImage
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.16.0
pkgrel=7
pkgver=3.17.0
pkgrel=1
pkgdesc="Library project for developers who would like to support popular graphics image formats (mingw-w64)."
arch=('any')
license=('GPL' 'custom:FIPL')
url="http://freeimage.sourceforge.net/"
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
"${MINGW_PACKAGE_PREFIX}-libpng"
"${MINGW_PACKAGE_PREFIX}-libtiff"
"${MINGW_PACKAGE_PREFIX}-LibRaw"
"${MINGW_PACKAGE_PREFIX}-openjpeg2"
"${MINGW_PACKAGE_PREFIX}-openexr"
"${MINGW_PACKAGE_PREFIX}-libwebp")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config")
"${MINGW_PACKAGE_PREFIX}-jxrlib"
"${MINGW_PACKAGE_PREFIX}-libjpeg-turbo"
"${MINGW_PACKAGE_PREFIX}-libpng"
"${MINGW_PACKAGE_PREFIX}-libtiff"
"${MINGW_PACKAGE_PREFIX}-LibRaw"
"${MINGW_PACKAGE_PREFIX}-libwebp"
"${MINGW_PACKAGE_PREFIX}-openjpeg2"
"${MINGW_PACKAGE_PREFIX}-openexr")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-iconv"
"${MINGW_PACKAGE_PREFIX}-pkg-config"
"dos2unix" "make")
options=('strip' 'staticlibs' '!buildflags')
source=("http://downloads.sourceforge.net/sourceforge/freeimage/FreeImage${pkgver//./}.zip"
'FreeImage-3.16.0_mingw-makefiles.patch'
'FreeImage-3.16.0_unbundle.patch'
'FreeImage-3.16.0_disable-some-plugins.patch')
md5sums=('1a2d1fff6204adbd479cc98818892fc1'
'20a0a9f7257df79bbcbdec62ed2446d9'
'824115841c4a5be8aa98a7b31ce07d79'
'ffd4a31d2d1c2cf19af3a1e6232f8fd6')
'FreeImage-3.17.0_mingw-makefiles.patch'
'FreeImage-3.17.0_unbundle.patch'
'FreeImage-3.17.0_CVE-2015-0852.patch')
md5sums=('459e15f0ec75d6efa3c7bd63277ead86'
'6510a7f7c715acf7bd182cd888d4787d'
'b81acf43a202d03573932e1f98d63a60'
'b21385e2da5dcdf4aa4e98d11150115d')
prepare() {
cd ${srcdir}/FreeImage
# Convert to utf-8
#iconv -f ISO-8859-15 -t UTF-8 Whatsnew.txt
#iconv -f WINDOWS-1252 -t UTF-8 license-gplv3.txt
#iconv -f ISO-8859-15 -t UTF-8 -o Whatsnew.txt.new Whatsnew.txt && \
# touch -r Whatsnew.txt Whatsnew.txt.new && \
# mv Whatsnew.txt.new Whatsnew.txt
patch -p1 -i ${srcdir}/FreeImage-3.17.0_unbundle.patch
patch -p1 -i ${srcdir}/FreeImage-3.17.0_mingw-makefiles.patch
patch -p1 -i ${srcdir}/FreeImage-3.17.0_CVE-2015-0852.patch
#iconv -f WINDOWS-1252 -t UTF-8 -o license-gplv3.txt.new license-gplv3.txt && \
# touch -r license-gplv3.txt license-gplv3.txt.new && \
# mv license-gplv3.txt.new license-gplv3.txt
patch -p1 -i ${srcdir}/FreeImage-3.16.0_mingw-makefiles.patch
patch -p1 -i ${srcdir}/FreeImage-3.16.0_unbundle.patch
patch -p1 -i ${srcdir}/FreeImage-3.16.0_disable-some-plugins.patch
# Remove bundled libraries
rm -rf Source/OpenEXR
rm -rf Source/LibMNG
rm -rf Source/LibOpenJPEG
rm -rf Source/LibPNG
rm -rf Source/LibRawLite
rm -rf Source/LibTIFF
rm -rf Source/LibJPEG
rm -rf Source/LibTIFF4
rm -rf Source/ZLib
rm -rf Source/LibWebP
# Mingw-w64 has its own header
rm -rf Source/LibJXR/common/include/guiddef.h
# remove all included libs to make sure these don't get used during compile
rm -r Source/Lib* Source/ZLib Source/OpenEXR
# clear files which cannot be built due to dependencies on private headers
# (see also unbundle patch)
> Source/FreeImage/PluginG3.cpp
> Source/FreeImageToolkit/JPEGTransform.cpp
# sanitize encodings / line endings
for file in `find . -type f -name '*.c' -or -name '*.cpp' -or -name '*.h' -or -name '*.txt' -or -name Makefile`; do
${MINGW_PREFIX}/bin/iconv -f ISO-8859-15 -t UTF-8 ${file} > ${file}.new && \
sed -i 's|\r||g' ${file}.new && \
touch -r ${file} ${file}.new && mv ${file}.new ${file}
done
#cp -f ${srcdir}/Makefile.mingw-w64 ${srcdir}/FreeImage/Makefile.mingw-w64
@@ -70,32 +64,17 @@ prepare() {
build() {
cd ${srcdir}/FreeImage
mkdir -p ${srcdir}/build-{shared,static}-${CARCH}
lndir ${srcdir}/FreeImage ${srcdir}/build-shared-${CARCH}
lndir ${srcdir}/FreeImage ${srcdir}/build-static-${CARCH}
mkdir -p ${srcdir}/build-${CARCH}
lndir ${srcdir}/FreeImage ${srcdir}/build-${CARCH}
plain "Build shared version..."
cd ${srcdir}/build-shared-${CARCH}
cd ${srcdir}/build-${CARCH}
make \
MINGW_TARGET=${MINGW_CHOST} \
FREEIMAGE_LIBRARY_TYPE="SHARED" \
-f Makefile.mingw
-f Makefile.gnu
make \
MINGW_TARGET=${MINGW_CHOST} \
FREEIMAGE_LIBRARY_TYPE="SHARED" \
-f Makefile.fip
plain "Build static version..."
cd ${srcdir}/build-static-${CARCH}
make \
MINGW_TARGET=${MINGW_CHOST} \
FREEIMAGE_LIBRARY_TYPE="STATIC" \
-f Makefile.mingw
make \
MINGW_TARGET=${MINGW_CHOST} \
FREEIMAGE_LIBRARY_TYPE="STATIC" \
-f Makefile.fip
}
@@ -105,7 +84,7 @@ package() {
install -d "${pkgdir}${MINGW_PREFIX}"/include
install -d "${pkgdir}${MINGW_PREFIX}"/share/doc/FreeImage
cd ${srcdir}/build-shared-${CARCH}
cd ${srcdir}/build-${CARCH}
install -m755 Dist/libfreeimage-*.dll "${pkgdir}${MINGW_PREFIX}"/bin/
install -m644 Dist/libfreeimage.dll.a "${pkgdir}${MINGW_PREFIX}"/lib/
install -m755 Dist/libfreeimageplus-*.dll "${pkgdir}${MINGW_PREFIX}"/bin/
@@ -118,7 +97,6 @@ package() {
install -m644 license-gplv2.txt "${pkgdir}${MINGW_PREFIX}"/share/doc/FreeImage/
install -m644 license-gplv3.txt "${pkgdir}${MINGW_PREFIX}"/share/doc/FreeImage/
cd ${srcdir}/build-static-${CARCH}
install -m644 Dist/libfreeimage.a "${pkgdir}${MINGW_PREFIX}"/lib/
install -m644 Dist/libfreeimageplus.a "${pkgdir}${MINGW_PREFIX}"/lib/
}