Tuesday, November 25, 2014

FreeImage & 64 bit compilation on Windows

We are changing from lib DevIL to FreeImage because DevIL is not thread-safe.

But the FreeImage website lacks of x64 binaries

We had to recompile it for VC11 (Visual 2012) in x64 bit. We enabled SSE2 processor optimization flags.

Here's the archive : Download


Follow the project on Facebook : https://www.facebook.com/immersionengine
Follow me on twitter : twitter.com/lefebv_l

Thursday, June 19, 2014

SSE horizontal minimum and maximum

 static inline float sseHorizontalMin(const __m128 &p)  
 {   
     __m128 data = p;             /* [0, 1, 2, 3] */   
     __m128 low = _mm_movehl_ps(data, data); /* [2, 3, 2, 3] */   
     __m128 low_accum = _mm_min_ps(low, data); /* [0|2, 1|3, 2|2, 3|3] */   
     __m128 elem1 = _mm_shuffle_ps(low_accum,   
                       low_accum,   
                       _MM_SHUFFLE(1,1,1,1)); /* [1|3, 1|3, 1|3, 1|3] */   
     __m128 accum = _mm_min_ss(low_accum, elem1);   
     return _mm_cvtss_f32(accum);   
 }  
 static inline float sseHorizontalMax(const __m128 &p)  
 {   
     __m128 data = p;             /* [0, 1, 2, 3] */   
     __m128 high = _mm_movehl_ps(data, data); /* [2, 3, 2, 3] */   
     __m128 high_accum = _mm_max_ps(high, data); /* [0|2, 1|3, 2|2, 3|3] */   
     __m128 elem1 = _mm_shuffle_ps(high_accum,   
                       high_accum,   
                       _MM_SHUFFLE(1,1,1,1)); /* [1|3, 1|3, 1|3, 1|3] */   
     __m128 accum = _mm_max_ss(high_accum, elem1);   
     return _mm_cvtss_f32(accum);   
 }  


Follow the project on Facebook : https://www.facebook.com/immersionengine
Follow me on twitter : twitter.com/lefebv_l

Sunday, May 11, 2014

LibXML2 & 64 bit compilation on Windows

We recently tried to change our platform from 32bit to 64bit.

Here are some feedbacks:
- We were based on libxml2, which relies on libiconv and zlib. Unfortunately, the official libxml website (ftp://xmlsoft.org/libxml2/) doesn't provide 64bit precompiled binaries for Windows.

- We found some files on the web https://github.com/dlonie/OpenBabel-BFGS/tree/master/windows-vc2008/libs/x64 that didn't work.

- We didn't have the patience to recompile everything from scratch - it will add too much complexity to our dev env.

The solution we choose:
TinyXML2 ! 
- Because it is just 2 files : one .h / one .cpp
- Because you can compile it in 32/64 bit
- Because it is fast and easy to use

Source : http://www.grinninglizard.com/tinyxml2/

What's new in TinyXML2 compared to TinyXML ?
  1. Many fewer memory allocation (1/10th to 1/100th), uses less memory (about 40% of TinyXML-1), and faster (~5x on read)
  2. No STL requirement
  3. More modern C++, including a proper namespace
  4. Proper and useful handling of whitespace

Hello, world.

Just a simple announcement : From now, all posts will be written in English.