Patch for a Windows x64 build of OpenJPEG

365 views
Skip to first unread message

cy...@nuclex.org

unread,
Apr 5, 2008, 10:24:33 AM4/5/08
to OpenJPEG
Hi!

I'm trying to compile OpenJPEG for the Windows x64 platform. The only
thing that has caused trouble until now is the inline assembler code
in opj_includes.h.

Here's a patch that makes OpenJPEG compile on Windows x64 for me:

--- libopenjpeg\opj_includes.original.h Tue Nov 13 19:35:12 2007
+++ libopenjpeg\opj_includes.h Fri Apr 04 12:40:50 2008
@@ -89,6 +89,9 @@
/* MSVC does not have lrintf */
#ifdef _MSC_VER
static INLINE long lrintf(float f){
+#ifdef _M_X64
+ return (long)((f > 0.0f) ? (f + 0.5f) : (f - 0.5f));
+#else
int i;

_asm{
@@ -97,6 +100,7 @@
};

return i;
+#endif
}
#endif

-Markus-

Colby Dillion

unread,
Apr 5, 2008, 9:40:23 PM4/5/08
to OpenJPEG
Hi Markus,

I was having the same problem getting the library compiled under
Win64. I originally wrote something very close to what you have. In
the end I ended up with the code below. It was faster, but not as
fast as 32-bit mode.

#ifdef _M_X64
#include <emmintrin.h>
static INLINE long lrintf(float f) {
return _mm_cvtss_si32(_mm_load_ss(&f));
}
#else

Colby
Reply all
Reply to author
Forward
0 new messages