Dual demosaic: reduce memory usage by width * height * 4 byte
This commit is contained in:
parent
0444334564
commit
9bd53a5cc9
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
#include "../rtgui/options.h"
|
#include "../rtgui/options.h"
|
||||||
|
|
||||||
//#define BENCHMARK
|
#define BENCHMARK
|
||||||
#include "StopWatch.h"
|
#include "StopWatch.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@ -66,14 +66,9 @@ void RawImageSource::dual_demosaic_RT(bool isBayer, const procparams::RAWParams
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
array2D<float> redTmp(winw, winh);
|
|
||||||
array2D<float> greenTmp(winw, winh);
|
|
||||||
array2D<float> blueTmp(winw, winh);
|
|
||||||
array2D<float> L(winw, winh);
|
array2D<float> L(winw, winh);
|
||||||
|
|
||||||
if (isBayer) {
|
if (isBayer) {
|
||||||
vng4_demosaic(rawData, redTmp, greenTmp, blueTmp);
|
|
||||||
|
|
||||||
if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::AMAZEVNG4) || raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::PIXELSHIFT)) {
|
if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::AMAZEVNG4) || raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::PIXELSHIFT)) {
|
||||||
amaze_demosaic_RT(0, 0, winw, winh, rawData, red, green, blue, options.chunkSizeAMAZE, options.measure);
|
amaze_demosaic_RT(0, 0, winw, winh, rawData, red, green, blue, options.chunkSizeAMAZE, options.measure);
|
||||||
} else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::DCBVNG4) ) {
|
} else if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::DCBVNG4) ) {
|
||||||
@ -87,7 +82,6 @@ void RawImageSource::dual_demosaic_RT(bool isBayer, const procparams::RAWParams
|
|||||||
} else {
|
} else {
|
||||||
xtrans_interpolate (1, false, options.chunkSizeXT, options.measure);
|
xtrans_interpolate (1, false, options.chunkSizeXT, options.measure);
|
||||||
}
|
}
|
||||||
fast_xtrans_interpolate(rawData, redTmp, greenTmp, blueTmp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const float xyz_rgb[3][3] = { // XYZ from RGB
|
const float xyz_rgb[3][3] = { // XYZ from RGB
|
||||||
@ -114,6 +108,17 @@ void RawImageSource::dual_demosaic_RT(bool isBayer, const procparams::RAWParams
|
|||||||
buildBlendMask(L, blend, winw, winh, contrastf, 1.f, autoContrast);
|
buildBlendMask(L, blend, winw, winh, contrastf, 1.f, autoContrast);
|
||||||
contrast = contrastf * 100.f;
|
contrast = contrastf * 100.f;
|
||||||
|
|
||||||
|
array2D<float>& redTmp = L; // L is not needed anymore => reuse it
|
||||||
|
array2D<float> greenTmp(winw, winh);
|
||||||
|
array2D<float> blueTmp(winw, winh);
|
||||||
|
|
||||||
|
if (isBayer) {
|
||||||
|
vng4_demosaic(rawData, redTmp, greenTmp, blueTmp);
|
||||||
|
} else {
|
||||||
|
fast_xtrans_interpolate(rawData, redTmp, greenTmp, blueTmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// the following is split into 3 loops intentionally to avoid cache conflicts on CPUs with only 4-way cache
|
// the following is split into 3 loops intentionally to avoid cache conflicts on CPUs with only 4-way cache
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
#pragma omp parallel for
|
#pragma omp parallel for
|
||||||
|
Loading…
x
Reference in New Issue
Block a user