Commit 781571dd authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

patch against original libpgf 6.11.24 to :

- Handle properly OpenMP depending of compiler/OS (inspired from libraw.org).
- Include only one omp.h instance in PGFplatform.h
- Support no OpenMP availability (else libpgf do not compile without OpenMP).
This patch must be included in next stable libpgf.

Raphael, i recommend too to change EOL as Unix like and to replace tab by 4 spaces.

CCBUGS: 273765
CCMAIL: rschweizer@schweizer-informatik.ch
parent 8be95a09
......@@ -27,7 +27,7 @@
/// @author C. Stamm, R. Spuler
#include "Decoder.h"
#include <omp.h>
#ifdef TRACE
#include <stdio.h>
#endif
......@@ -85,7 +85,9 @@ CDecoder::CDecoder(CPGFStream* stream, PGFPreHeader& preHeader, PGFHeader& heade
#endif
if (useOMP && m_macroBlockLen > 1) {
#ifdef _OPENMP
omp_set_num_threads(m_macroBlockLen);
#endif
// create macro block array
m_macroBlocks = new CMacroBlock*[m_macroBlockLen];
......
......@@ -27,7 +27,7 @@
/// @author C. Stamm, R. Spuler
#include "Encoder.h"
#include <omp.h>
#ifdef TRACE
#include <stdio.h>
#endif
......@@ -87,7 +87,9 @@ CEncoder::CEncoder(CPGFStream* stream, PGFPreHeader preHeader, PGFHeader header,
#endif
if (useOMP && m_macroBlockLen > 1) {
#ifdef _OPENMP
omp_set_num_threads(m_macroBlockLen);
#endif
// create macro block array
m_macroBlocks = new CMacroBlock*[m_macroBlockLen];
......
......@@ -608,5 +608,30 @@ __inline UINT64 ByteSwap(UINT64 ui64) {
#endif //PGF_USE_BIG_ENDIAN
// OpenMP rules (inspired from libraw project)
#if defined (_OPENMP)
#if defined(WIN32)
# if defined (_MSC_VER) && (_MSC_VER >= 1600)
/* VS2010+ : OpenMP works OK */
# define LIBPGF_USE_OPENMP
#elif defined (__INTEL_COMPILER) && (__INTEL_COMPILER >=910)
/* Have not tested on 9.x and 10.x, but Intel documentation claims OpenMP 2.5 support in 9.1 */
# define LIBPGF_USE_OPENMP
#else
# undef LIBPGF_USE_OPENMP
#endif
/* Not Win32 */
# elif (defined(__APPLE__) || defined(__MACOSX__)) && defined(_REENTRANT)
# undef LIBPGF_USE_OPENMP
# else
# define LIBPGF_USE_OPENMP
# endif
#endif
#ifdef LIBPGF_USE_OPENMP
#include <omp.h>
#endif
#endif //PGF_PGFPLATFORM_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment