Author: post
Date: 2010-06-26 08:20:08 +0200 (Sat, 26 Jun 2010)
New Revision: 244
Modified:
RawSpeed/Common.h
RawSpeed/DngDecoderSlices.cpp
RawSpeed/DngDecoderSlices.h
RawSpeed/RawDecoder.cpp
RawSpeed/RawImage.h
RawSpeed/StdAfx.h
Log:
Use a shared function for CPU count detection, and move pthread.h into
precompiled header. Also fix CPU count detection in DNG decoder (thanks Edouard
Gomez!)
Modified: RawSpeed/Common.h
===================================================================
--- RawSpeed/Common.h 2010-06-20 10:33:55 UTC (rev 243)
+++ RawSpeed/Common.h 2010-06-26 06:20:08 UTC (rev 244)
@@ -88,6 +88,14 @@
return p0 - ((p0 - p1) & ((p0 - p1) >> 31));
}
+inline uint32 getThreadCount()
+{
+#ifdef WIN32
+ return pthread_num_processors_np();
+#else
+ return rawspeed_get_number_of_processor_cores();
+#endif
+}
inline uint32 clampbits(int x, uint32 n) { uint32 _y_temp; if( (_y_temp=x>>n)
) x = ~_y_temp >> (32-n); return x;}
Modified: RawSpeed/DngDecoderSlices.cpp
===================================================================
--- RawSpeed/DngDecoderSlices.cpp 2010-06-20 10:33:55 UTC (rev 243)
+++ RawSpeed/DngDecoderSlices.cpp 2010-06-26 06:20:08 UTC (rev 244)
@@ -40,11 +40,6 @@
DngDecoderSlices::DngDecoderSlices(FileMap* file, RawImage img) :
mFile(file), mRaw(img) {
mFixLjpeg = false;
-#ifdef WIN32
- nThreads = pthread_num_processors_np();
-#else
- nThreads = 2; // FIXME: Port this to unix
-#endif
}
DngDecoderSlices::~DngDecoderSlices(void) {
Modified: RawSpeed/DngDecoderSlices.h
===================================================================
--- RawSpeed/DngDecoderSlices.h 2010-06-20 10:33:55 UTC (rev 243)
+++ RawSpeed/DngDecoderSlices.h 2010-06-26 06:20:08 UTC (rev 244)
@@ -1,7 +1,6 @@
#pragma once
#include "RawDecoder.h"
#include <queue>
-#include "pthread.h"
#include "LJpegPlain.h"
/*
RawSpeed - RAW file decoder.
Modified: RawSpeed/RawDecoder.cpp
===================================================================
--- RawSpeed/RawDecoder.cpp 2010-06-20 10:33:55 UTC (rev 243)
+++ RawSpeed/RawDecoder.cpp 2010-06-26 06:20:08 UTC (rev 244)
@@ -198,11 +198,7 @@
void RawDecoder::startThreads() {
uint32 threads;
-#ifdef WIN32
- threads = pthread_num_processors_np();
-#else
- threads = rawspeed_get_number_of_processor_cores();
-#endif
+ threads = getThreadCount();
int y_offset = 0;
int y_per_thread = (mRaw->dim.y + threads - 1) / threads;
RawDecoderThread *t = new RawDecoderThread[threads];
Modified: RawSpeed/RawImage.h
===================================================================
--- RawSpeed/RawImage.h 2010-06-20 10:33:55 UTC (rev 243)
+++ RawSpeed/RawImage.h 2010-06-26 06:20:08 UTC (rev 244)
@@ -1,5 +1,4 @@
#pragma once
-#include "pthread.h"
#include "ColorFilterArray.h"
#include "BlackArea.h"
Modified: RawSpeed/StdAfx.h
===================================================================
--- RawSpeed/StdAfx.h 2010-06-20 10:33:55 UTC (rev 243)
+++ RawSpeed/StdAfx.h 2010-06-26 06:20:08 UTC (rev 244)
@@ -48,6 +48,7 @@
#endif // __unix__
#include <malloc.h>
#include <math.h>
+#include "pthread.h"
// STL
#include <iostream>
#include <string>
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit