Speedup for bilinear dual demosaicers, #5748
This commit is contained in:
@@ -23,12 +23,13 @@
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "rawimagesource.h"
|
||||
#include "rt_math.h"
|
||||
#define BENCHMARK
|
||||
#include "StopWatch.h"
|
||||
|
||||
using namespace rtengine;
|
||||
|
||||
void RawImageSource::bayer_bilinear_demosaic(const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue)
|
||||
void RawImageSource::bayer_bilinear_demosaic(const float* const * blend, const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue)
|
||||
{
|
||||
BENCHFUN
|
||||
#ifdef _OPENMP
|
||||
@@ -46,13 +47,12 @@ BENCHFUN
|
||||
#pragma GCC ivdep
|
||||
#endif
|
||||
for (int j = 2 - (FC(i, 1) & 1); j < W - 2; j += 2) { // always begin with a green pixel
|
||||
green[i][j] = rawData[i][j];
|
||||
nonGreen1[i][j] = (rawData[i][j - 1] + rawData[i][j + 1]) * 0.5f;
|
||||
nonGreen2[i][j] = (rawData[i - 1][j] + rawData[i + 1][j]) * 0.5f;
|
||||
green[i][j + 1] = ((rawData[i - 1][j + 1] + rawData[i][j]) + (rawData[i][j + 2] + rawData[i + 1][j + 1])) * 0.25f;
|
||||
nonGreen1[i][j + 1] = rawData[i][j + 1];
|
||||
nonGreen2[i][j + 1] = ((rawData[i - 1][j] + rawData[i - 1][j + 2]) + (rawData[i + 1][j] + rawData[i + 1][j + 2])) * 0.25f;
|
||||
green[i][j] = intp(blend[i][j], green[i][j], rawData[i][j]);
|
||||
nonGreen1[i][j] = intp(blend[i][j], nonGreen1[i][j], (rawData[i][j - 1] + rawData[i][j + 1]) * 0.5f);
|
||||
nonGreen2[i][j] = intp(blend[i][j], nonGreen2[i][j], (rawData[i - 1][j] + rawData[i + 1][j]) * 0.5f);
|
||||
green[i][j + 1] = intp(blend[i][j + 1], green[i][j + 1], ((rawData[i - 1][j + 1] + rawData[i][j]) + (rawData[i][j + 2] + rawData[i + 1][j + 1])) * 0.25f);
|
||||
nonGreen1[i][j + 1] = intp(blend[i][j + 1], nonGreen1[i][j + 1], rawData[i][j + 1]);
|
||||
nonGreen2[i][j + 1] = intp(blend[i][j + 1], nonGreen2[i][j + 1], ((rawData[i - 1][j] + rawData[i - 1][j + 2]) + (rawData[i + 1][j] + rawData[i + 1][j + 2])) * 0.25f);
|
||||
}
|
||||
}
|
||||
border_interpolate(W, H, 2, rawData, red, green, blue);
|
||||
}
|
||||
|
@@ -112,18 +112,23 @@ void RawImageSource::dual_demosaic_RT(bool isBayer, const procparams::RAWParams
|
||||
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);
|
||||
array2D<float> greenTmp;
|
||||
array2D<float> blueTmp;
|
||||
|
||||
if (isBayer) {
|
||||
if (raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::AMAZEBILINEAR) ||
|
||||
raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::RCDBILINEAR) ||
|
||||
raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::DCBBILINEAR)) {
|
||||
bayer_bilinear_demosaic(rawData, redTmp, greenTmp, blueTmp);
|
||||
bayer_bilinear_demosaic(blend, rawData, red, green, blue);
|
||||
return;
|
||||
} else {
|
||||
greenTmp(winw, winh);
|
||||
blueTmp(winw, winh);
|
||||
vng4_demosaic(rawData, redTmp, greenTmp, blueTmp);
|
||||
}
|
||||
} else {
|
||||
greenTmp(winw, winh);
|
||||
blueTmp(winw, winh);
|
||||
fast_xtrans_interpolate(rawData, redTmp, greenTmp, blueTmp);
|
||||
}
|
||||
|
||||
|
@@ -300,7 +300,7 @@ protected:
|
||||
void xtrans_interpolate (const int passes, const bool useCieLab, size_t chunkSize = 1, bool measure = false);
|
||||
void fast_xtrans_interpolate (const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue);
|
||||
void pixelshift(int winx, int winy, int winw, int winh, const procparams::RAWParams &rawParams, unsigned int frame, const std::string &make, const std::string &model, float rawWpCorrection);
|
||||
void bayer_bilinear_demosaic(const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue);
|
||||
void bayer_bilinear_demosaic(const float *const * blend, const array2D<float> &rawData, array2D<float> &red, array2D<float> &green, array2D<float> &blue);
|
||||
void hflip (Imagefloat* im);
|
||||
void vflip (Imagefloat* im);
|
||||
void getRawValues(int x, int y, int rotate, int &R, int &G, int &B) override;
|
||||
|
Reference in New Issue
Block a user