Added #ifdef _OPENMP, to compile without OpenMP (singlethread)
Patched creation of Directory RawTherapeeAlpha
This commit is contained in:
parent
2e910a1a48
commit
de22e77a4b
@ -26,7 +26,9 @@
|
|||||||
#include <mytime.h>
|
#include <mytime.h>
|
||||||
#include <gauss.h>
|
#include <gauss.h>
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
|
#ifdef _OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// This seems ugly, but way faster than any other solutions I tried
|
// This seems ugly, but way faster than any other solutions I tried
|
||||||
|
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <alignedbuffer.h>
|
#include <alignedbuffer.h>
|
||||||
|
#ifdef _OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
// classical filtering if the support window is small:
|
// classical filtering if the support window is small:
|
||||||
|
|
||||||
@ -31,7 +33,11 @@ template<class T> void gaussHorizontal3 (T** src, T** dst, T* buffer, int W, int
|
|||||||
|
|
||||||
#pragma omp parallel for if (multiThread)
|
#pragma omp parallel for if (multiThread)
|
||||||
for (int i=0; i<H; i++) {
|
for (int i=0; i<H; i++) {
|
||||||
|
#ifdef _OPENMP
|
||||||
T* temp = buffer + omp_get_thread_num() * W;
|
T* temp = buffer + omp_get_thread_num() * W;
|
||||||
|
#else
|
||||||
|
T* temp = buffer;
|
||||||
|
#endif
|
||||||
for (int j=1; j<W-1; j++)
|
for (int j=1; j<W-1; j++)
|
||||||
temp[j] = (T)(c1 * (src[i][j-1] + src[i][j+1]) + c0 * src[i][j]);
|
temp[j] = (T)(c1 * (src[i][j-1] + src[i][j+1]) + c0 * src[i][j]);
|
||||||
dst[i][0] = src[i][0];
|
dst[i][0] = src[i][0];
|
||||||
@ -44,7 +50,11 @@ template<class T> void gaussVertical3 (T** src, T** dst, T* buffer, int W, int H
|
|||||||
|
|
||||||
#pragma omp parallel for if (multiThread)
|
#pragma omp parallel for if (multiThread)
|
||||||
for (int i=0; i<W; i++) {
|
for (int i=0; i<W; i++) {
|
||||||
|
#ifdef _OPENMP
|
||||||
T* temp = buffer + omp_get_thread_num() * H;
|
T* temp = buffer + omp_get_thread_num() * H;
|
||||||
|
#else
|
||||||
|
T* temp = buffer;
|
||||||
|
#endif
|
||||||
for (int j = 1; j<H-1; j++)
|
for (int j = 1; j<H-1; j++)
|
||||||
temp[j] = (T)(c1 * (src[j-1][i] + src[j+1][i]) + c0 * src[j][i]);
|
temp[j] = (T)(c1 * (src[j-1][i] + src[j+1][i]) + c0 * src[j][i]);
|
||||||
dst[0][i] = src[0][i];
|
dst[0][i] = src[0][i];
|
||||||
@ -107,9 +117,11 @@ template<class T> void gaussHorizontal (T** src, T** dst, AlignedBuffer<double>*
|
|||||||
|
|
||||||
#pragma omp parallel for if (multiThread)
|
#pragma omp parallel for if (multiThread)
|
||||||
for (int i=0; i<H; i++) {
|
for (int i=0; i<H; i++) {
|
||||||
|
#ifdef _OPENMP
|
||||||
double* temp2 = buffer->data + omp_get_thread_num() * W;
|
double* temp2 = buffer->data + omp_get_thread_num() * W;
|
||||||
|
#else
|
||||||
|
double* temp2 = buffer->data;
|
||||||
|
#endif
|
||||||
temp2[0] = B * src[i][0] + b1*src[i][0] + b2*src[i][0] + b3*src[i][0];
|
temp2[0] = B * src[i][0] + b1*src[i][0] + b2*src[i][0] + b3*src[i][0];
|
||||||
temp2[1] = B * src[i][1] + b1*temp2[0] + b2*src[i][0] + b3*src[i][0];
|
temp2[1] = B * src[i][1] + b1*temp2[0] + b2*src[i][0] + b3*src[i][0];
|
||||||
temp2[2] = B * src[i][2] + b1*temp2[1] + b2*temp2[0] + b3*src[i][0];
|
temp2[2] = B * src[i][2] + b1*temp2[1] + b2*temp2[0] + b3*src[i][0];
|
||||||
@ -183,9 +195,11 @@ template<class T> void gaussVertical (T** src, T** dst, AlignedBuffer<double>* b
|
|||||||
|
|
||||||
#pragma omp parallel for if (multiThread)
|
#pragma omp parallel for if (multiThread)
|
||||||
for (int i=0; i<W; i++) {
|
for (int i=0; i<W; i++) {
|
||||||
|
#ifdef _OPENMP
|
||||||
double* temp2 = buffer->data + omp_get_thread_num() * H;
|
double* temp2 = buffer->data + omp_get_thread_num() * H;
|
||||||
|
#else
|
||||||
|
double* temp2 = buffer->data;
|
||||||
|
#endif
|
||||||
temp2[0] = B * src[0][i] + b1*src[0][i] + b2*src[0][i] + b3*src[0][i];
|
temp2[0] = B * src[0][i] + b1*src[0][i] + b2*src[0][i] + b3*src[0][i];
|
||||||
temp2[1] = B * src[1][i] + b1*temp2[0] + b2*src[0][i] + b3*src[0][i];
|
temp2[1] = B * src[1][i] + b1*temp2[0] + b2*src[0][i] + b3*src[0][i];
|
||||||
temp2[2] = B * src[2][i] + b1*temp2[1] + b2*temp2[0] + b3*src[0][i];
|
temp2[2] = B * src[2][i] + b1*temp2[1] + b2*temp2[0] + b3*src[0][i];
|
||||||
|
@ -27,7 +27,9 @@
|
|||||||
#include <mytime.h>
|
#include <mytime.h>
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
#include <iccstore.h>
|
#include <iccstore.h>
|
||||||
|
#ifdef _OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace rtengine {
|
namespace rtengine {
|
||||||
|
|
||||||
@ -192,7 +194,13 @@ void ImProcFunctions::firstAnalysis (Image16* original, const ProcParams* params
|
|||||||
}
|
}
|
||||||
|
|
||||||
// calculate chroma radius and histogram of the y channel needed for exposure curve calculation
|
// calculate chroma radius and histogram of the y channel needed for exposure curve calculation
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
int T = omp_get_max_threads();
|
int T = omp_get_max_threads();
|
||||||
|
#else
|
||||||
|
int T = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
int* cr = new int [T];
|
int* cr = new int [T];
|
||||||
unsigned int** hist = new unsigned int* [T];
|
unsigned int** hist = new unsigned int* [T];
|
||||||
for (int i=0; i<T; i++) {
|
for (int i=0; i<T; i++) {
|
||||||
@ -202,6 +210,7 @@ void ImProcFunctions::firstAnalysis (Image16* original, const ProcParams* params
|
|||||||
}
|
}
|
||||||
|
|
||||||
int H = original->height;
|
int H = original->height;
|
||||||
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel if (multiThread)
|
#pragma omp parallel if (multiThread)
|
||||||
{
|
{
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
@ -213,7 +222,9 @@ void ImProcFunctions::firstAnalysis (Image16* original, const ProcParams* params
|
|||||||
else
|
else
|
||||||
firstAnalysis_ (original, wprofile, hist[tid], &cr[tid], tid*blk, H);
|
firstAnalysis_ (original, wprofile, hist[tid], &cr[tid], tid*blk, H);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
firstAnalysis_ (original, wprofile, hist[0], &cr[0], 0, original->height);
|
||||||
|
#endif
|
||||||
chroma_radius = cr[0];
|
chroma_radius = cr[0];
|
||||||
for (int i=0; i<T; i++)
|
for (int i=0; i<T; i++)
|
||||||
if (cr[i]>chroma_radius)
|
if (cr[i]>chroma_radius)
|
||||||
@ -421,9 +432,11 @@ void ImProcFunctions::lumadenoise (LabImage* lab, int** b2) {
|
|||||||
void ImProcFunctions::colordenoise (LabImage* lab, int** b2) {
|
void ImProcFunctions::colordenoise (LabImage* lab, int** b2) {
|
||||||
|
|
||||||
if (params->colorDenoise.enabled && lab->W>=8 && lab->H>=8) {
|
if (params->colorDenoise.enabled && lab->W>=8 && lab->H>=8) {
|
||||||
|
#ifdef _OPENMP
|
||||||
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(lab->W,lab->H)*omp_get_max_threads());
|
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(lab->W,lab->H)*omp_get_max_threads());
|
||||||
|
#else
|
||||||
|
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(lab->W,lab->H));
|
||||||
|
#endif
|
||||||
gaussHorizontal<short> (lab->a, lab->a, buffer, lab->W, lab->H, params->colorDenoise.amount / 10.0 / scale, multiThread);
|
gaussHorizontal<short> (lab->a, lab->a, buffer, lab->W, lab->H, params->colorDenoise.amount / 10.0 / scale, multiThread);
|
||||||
gaussHorizontal<short> (lab->b, lab->b, buffer, lab->W, lab->H, params->colorDenoise.amount / 10.0 / scale, multiThread);
|
gaussHorizontal<short> (lab->b, lab->b, buffer, lab->W, lab->H, params->colorDenoise.amount / 10.0 / scale, multiThread);
|
||||||
gaussVertical<short> (lab->a, lab->a, buffer, lab->W, lab->H, params->colorDenoise.amount / 10.0 / scale, multiThread);
|
gaussVertical<short> (lab->a, lab->a, buffer, lab->W, lab->H, params->colorDenoise.amount / 10.0 / scale, multiThread);
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
#include <improcfun.h>
|
#include <improcfun.h>
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
#include <iccstore.h>
|
#include <iccstore.h>
|
||||||
|
#ifdef _OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace rtengine {
|
namespace rtengine {
|
||||||
|
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
#include <rtengine.h>
|
#include <rtengine.h>
|
||||||
#include <improcfun.h>
|
#include <improcfun.h>
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
|
#ifdef _OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace rtengine {
|
namespace rtengine {
|
||||||
|
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
#include <rtengine.h>
|
#include <rtengine.h>
|
||||||
#include <improcfun.h>
|
#include <improcfun.h>
|
||||||
|
#ifdef _OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
#include <minmax.h>
|
#include <minmax.h>
|
||||||
#include <gauss.h>
|
#include <gauss.h>
|
||||||
#include <bilateral2.h>
|
#include <bilateral2.h>
|
||||||
@ -66,9 +68,11 @@ void ImProcFunctions::deconvsharpening (LabImage* lab, unsigned short** b2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float** tmp = (float**)b2;
|
float** tmp = (float**)b2;
|
||||||
|
#ifdef _OPENMP
|
||||||
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H)*omp_get_max_threads());
|
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H)*omp_get_max_threads());
|
||||||
|
#else
|
||||||
|
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H));
|
||||||
|
#endif
|
||||||
float damping = params->sharpening.deconvdamping / 5.0;
|
float damping = params->sharpening.deconvdamping / 5.0;
|
||||||
bool needdamp = params->sharpening.deconvdamping > 0;
|
bool needdamp = params->sharpening.deconvdamping > 0;
|
||||||
for (int k=0; k<params->sharpening.deconviter; k++) {
|
for (int k=0; k<params->sharpening.deconviter; k++) {
|
||||||
@ -118,9 +122,11 @@ void ImProcFunctions::sharpening (LabImage* lab, unsigned short** b2) {
|
|||||||
|
|
||||||
int W = lab->W, H = lab->H;
|
int W = lab->W, H = lab->H;
|
||||||
unsigned short** b3;
|
unsigned short** b3;
|
||||||
|
#ifdef _OPENMP
|
||||||
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H)*omp_get_max_threads());
|
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H)*omp_get_max_threads());
|
||||||
|
#else
|
||||||
|
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H));
|
||||||
|
#endif
|
||||||
if (params->sharpening.edgesonly==false) {
|
if (params->sharpening.edgesonly==false) {
|
||||||
|
|
||||||
gaussHorizontal<unsigned short> (lab->L, b2, buffer, W, H, params->sharpening.radius / scale, multiThread);
|
gaussHorizontal<unsigned short> (lab->L, b2, buffer, W, H, params->sharpening.radius / scale, multiThread);
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
#include <rtengine.h>
|
#include <rtengine.h>
|
||||||
#include <improcfun.h>
|
#include <improcfun.h>
|
||||||
|
#ifdef _OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
#include <mytime.h>
|
#include <mytime.h>
|
||||||
|
|
||||||
namespace rtengine {
|
namespace rtengine {
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
#include <iccstore.h>
|
#include <iccstore.h>
|
||||||
#include <image8.h>
|
#include <image8.h>
|
||||||
#include <curves.h>
|
#include <curves.h>
|
||||||
|
#ifdef _OPENMP
|
||||||
#include <omp.h>
|
#include <omp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace rtengine {
|
namespace rtengine {
|
||||||
|
|
||||||
@ -962,6 +964,7 @@ void RawImageSource::correction_YIQ_LQ (Image16* im, int times) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (int t=0; t<times; t++) {
|
for (int t=0; t<times; t++) {
|
||||||
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
{
|
{
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
@ -973,6 +976,9 @@ void RawImageSource::correction_YIQ_LQ (Image16* im, int times) {
|
|||||||
else
|
else
|
||||||
correction_YIQ_LQ_ (im, 1 + tid*blk, im->height - 1);
|
correction_YIQ_LQ_ (im, 1 + tid*blk, im->height - 1);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
correction_YIQ_LQ_ (im, 1 , im->height - 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1807,6 +1813,7 @@ void RawImageSource::hphd_demosaic () {
|
|||||||
memset(hpmap[i], 0, W*sizeof(float));
|
memset(hpmap[i], 0, W*sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
{
|
{
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
@ -1818,7 +1825,9 @@ void RawImageSource::hphd_demosaic () {
|
|||||||
else
|
else
|
||||||
hphd_vertical (hpmap, tid*blk, W);
|
hphd_vertical (hpmap, tid*blk, W);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
hphd_vertical (hpmap, 0, W);
|
||||||
|
#endif
|
||||||
if (plistener)
|
if (plistener)
|
||||||
plistener->setProgress (0.33);
|
plistener->setProgress (0.33);
|
||||||
|
|
||||||
@ -1826,6 +1835,7 @@ void RawImageSource::hphd_demosaic () {
|
|||||||
for (int i=0; i<H; i++)
|
for (int i=0; i<H; i++)
|
||||||
memset(this->hpmap[i], 0, W*sizeof(char));
|
memset(this->hpmap[i], 0, W*sizeof(char));
|
||||||
|
|
||||||
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel
|
#pragma omp parallel
|
||||||
{
|
{
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
@ -1837,7 +1847,9 @@ void RawImageSource::hphd_demosaic () {
|
|||||||
else
|
else
|
||||||
hphd_horizontal (hpmap, tid*blk, H);
|
hphd_horizontal (hpmap, tid*blk, H);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
hphd_horizontal (hpmap, 0, H);
|
||||||
|
#endif
|
||||||
freeArray<float>(hpmap, H);
|
freeArray<float>(hpmap, H);
|
||||||
|
|
||||||
if (plistener)
|
if (plistener)
|
||||||
|
@ -794,6 +794,7 @@ bool Thumbnail::writeData (const Glib::ustring& fname) {
|
|||||||
SafeKeyFile keyFile;
|
SafeKeyFile keyFile;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if( Glib::file_test(fname,Glib::FILE_TEST_EXISTS) )
|
||||||
keyFile.load_from_file (fname);
|
keyFile.load_from_file (fname);
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
|
|
||||||
|
@ -53,14 +53,18 @@ void SHMap::update (Image16* img, unsigned short** buffer, double radius, double
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!hq) {
|
if (!hq) {
|
||||||
|
#ifdef _OPENMP
|
||||||
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H)*omp_get_max_threads());
|
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H)*omp_get_max_threads());
|
||||||
|
#else
|
||||||
|
AlignedBuffer<double>* buffer = new AlignedBuffer<double> (MAX(W,H));
|
||||||
|
#endif
|
||||||
gaussHorizontal<unsigned short> (map, map, buffer, W, H, radius, multiThread);
|
gaussHorizontal<unsigned short> (map, map, buffer, W, H, radius, multiThread);
|
||||||
gaussVertical<unsigned short> (map, map, buffer, W, H, radius, multiThread);
|
gaussVertical<unsigned short> (map, map, buffer, W, H, radius, multiThread);
|
||||||
|
|
||||||
delete buffer;
|
delete buffer;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel if (multiThread)
|
#pragma omp parallel if (multiThread)
|
||||||
{
|
{
|
||||||
int tid = omp_get_thread_num();
|
int tid = omp_get_thread_num();
|
||||||
@ -72,6 +76,9 @@ void SHMap::update (Image16* img, unsigned short** buffer, double radius, double
|
|||||||
else
|
else
|
||||||
bilateral<unsigned short> (map, buffer, W, H, 8000, radius, tid*blk, H);
|
bilateral<unsigned short> (map, buffer, W, H, 8000, radius, tid*blk, H);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
bilateral<unsigned short> (map, buffer, W, H, 8000, radius, 0, H);
|
||||||
|
#endif
|
||||||
// anti-alias filtering the result
|
// anti-alias filtering the result
|
||||||
for (int i=0; i<H; i++)
|
for (int i=0; i<H; i++)
|
||||||
for (int j=0; j<W; j++)
|
for (int j=0; j<W; j++)
|
||||||
|
@ -140,6 +140,8 @@ int Options::readFromFile (Glib::ustring fname) {
|
|||||||
rtengine::SafeKeyFile keyFile;
|
rtengine::SafeKeyFile keyFile;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if( !Glib::file_test(fname,Glib::FILE_TEST_EXISTS))
|
||||||
|
return 1;
|
||||||
if (!keyFile.load_from_file (fname))
|
if (!keyFile.load_from_file (fname))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user