Hi to all FreeImage developers,
The CVS now contains two brand new plugins :
- a WebP loading & saving plugin
- a JPEG-XR loading & saving plugin
The WebP format is technically limited to 24- and 32-bit RGB[A] bitmaps (it seems that the format was specified without possible extension beyond these bit depths).
On the other hand, the JPEG-XR format can handle almost any format you could imagine, with very good compression rates. It can be seen as a modern TIF format.
Before the next FreeImage release, I would be happy to have some help to test the compilation under Linux/MINGW/MacOS compilers.
it's great to have these new plugins. I will have a look at how it compiles using the MinGW compiler...
there is not yet a plugin source file for the JXR plugin in the CVS. Yould you please load your current version into the CVS?
now, I tried to compile both LibWebP and LibJXR with MinGW 32 Bit and on Linux with GCC. LibWebP seems to compile fine with all these compilers. However, it turns out, that some changes must be applied to the LibJXR sources for MinGW (and optionally for GCC as well).
Although the JXR code is from Microsoft, it is kind of platform independent. However, MinGW, which stands somewhere between MSVC and GCC, needs some special attendance.
Basically, we've always tried to use MinGW as a MSVC replacement. That's what we like to keep with LibJXR, too. However, in order to compile properly, for MinGW, the code needs to include stdint.h explicitly, which defines uintptr_t and intptr_t. MSVC does not need that file (it does not even have this file). File "..\x86\x68.h" then defines UINTPTR_T and INTPTR_T being uintptr_t and intptr_t, respectively (the capitalized defines seem to be used in the JXR code).
So, for MinGW, I recommend adding the following to file "Source/LibJXR/image/sys/strcodec.h", which somehow acts as 'config.h' as well:
In line 32 (after including stddef.h), add the following:
After that, when compiling with MinGW, file "..\x86\x68.h" will be included in line 64 (line number already counts the above three lines), which effectively makes MinGW behave like MSVC (including Windows.h, etc)
The above is not needed for the real GCC (on Linux, for example). With GCC it is better to just include file "ansi.h", which
So, for GCC, there are several options available. Have a look at file "Source/LibJXR/image/sys/strcodec.h", line 76 (still includes the three lines above for MinGW):
File "ansi.h" is included, if __ANSI__ is defined.
Option 1: define __ANSI__ in the Makefile only (MSVC will never use the Makefile)
1. __ANSI__ is likely not the best name for that option (LIB_JXR_NO_MSVC ?)
2. MinGW also uses the Makefile, so we need to exclude MinGW from the above block:
#if defined(__ANSI__) && !defined(__MINGW32__)
However, as a second code modification is required, we could as well auto-select ANSI mode for any non-MSVC compiler (not needing any additional compiler option, actually I recommend this solution):
#if defined(__ANSI__) || (!defined(_MSC_VER) && !defined(__MINGW32__))
For now, these two changes seem to be required for MinGW and GCC. However, I was only able to compile some of the source files manually (the Makefile does not work, since PluginJXR is still missing). Also, I was not yet able to link any of the objects.
additionally, there is something to change in file "Source/LibJXR/image/jxrgluelib/JXRMata.h". The problem here is, that MinGW does define WIN32, but does not support the SAL stuff. So, we need to treat MinGW, as if it has not defined WIN32. That requires the following changes:
In line 31:
before: #ifndef WIN32
after: #if !defined(WIN32) || defined(MINGW32)
In line 110:
before: #ifdef WIN32
after: #if defined(WIN32) && !defined(MINGW32)
Since GCC (on Linux, for example) does not define WIN32, there is nothing special to be done for GCC.
oh no... in my last post, the bold printed MINGW32 option (as in defined(MINGW32)), should be __MINGW32__, of course. Two leading or trailing underscores must be escaped to display properly in this SF forum.
So it should be
before: #ifndef WIN32
after: #if !defined(WIN32) || defined(__MINGW32__)
before: #ifdef WIN32
after: #if defined(WIN32) && !defined(__MINGW32__)
Thanks for your help :)
I've added PluginJXR to the CVS and updated the Exif reader.
Your suggested changes are also commited.
Note that for gcc, I changed the Makefile.gnu like this :
CFLAGS += -DDISABLE_PERF_MEASUREMENT -D__ANSI__
CXXFLAGS += -D__ANSI__
the most recent change applied to file Source/OpenEXR/IlmImf/ImfAutoArray.h (revision 1.5 on Sun Oct 20 18:26:59 2013 UTC), re-introduced an already known problem for MinGW. You've changed
It seems that <string.h> for memset is needed for all compilers expect MSVC. However, since MinGW also defines _WIN32 (that is an internal define), the file is not included with MinGW.
Likely you should change it to
#if !defined(_WIN32) || defined(__MINGW32__)
MinGW is hard to control, since it is MSVC and GCC. __MINGW32__ seems to be the only macro usable to distinguish MinGW and MSVC so, we'll likely have it in several places.
In this moment, more compiling errors are popping up (I was compiling while posting this). These come from the JXR library. However, I'm out of the office from this afternoon till tomorrow, so I can not care for these until Friday.
ok, it was easy to get rid of the above mentioned errors.
In file "Source/LibJXR/jxrgluelib/JXRGlue.h", change line 48 from
#if defined(__ANSI__) || defined(__MINGW32__)
In file "Source/LibJXR/image/sys/strcodec.c", change line 284 from
#if defined(WIN32) && !defined(__MINGW32__)
and line 667 from
#if (defined(WIN32) && !defined(UNDER_CE)) || (defined(UNDER_CE) && defined(_ARM_))
#if (defined(WIN32) && !defined(UNDER_CE) && !defined(__MINGW32__)) || (defined(UNDER_CE) && defined(_ARM_))
That's all. After that, FreeImage happily compiles with MinGW. I'll send you an updated version of Makefile.mingw on Friday.
did you see the two recent posts? You should actually apply the changes mentioned above to the most recent version of the JXR code to make it compile with MinGW.
Your last bug fixes are now in the CVS.
Can you send me your updated MINGW makefile ?
that is good news. I will send you the latest MinGW makefile ASAP. I will also ensure, that the latest VB6 wrapper is up to date and compatible with the 3.16.0 version of FreeImage.
There is still a bug/warning in file PluginWebP.cpp in line 576: you should return FALSE instead of NULL.
WebP and JPEG-XR plugins are now available in FreeImage release 3.16.0
Log in to post a comment.