Revert "Further cleanup and astyled lcp.*"
This reverts commit 1348ea06e4
.
This commit is contained in:
@@ -80,7 +80,7 @@ void LCPModelCommon::merge (const LCPModelCommon& a, const LCPModelCommon& b, fl
|
||||
param[i] = facA * a.param[i] + facB * b.param[i];
|
||||
}
|
||||
|
||||
const double param0Sqr = param[0] * param[0];
|
||||
const float param0Sqr = param[0] * param[0];
|
||||
|
||||
vign_param[0] = -param[0];
|
||||
vign_param[1] = param0Sqr - param[1];
|
||||
@@ -115,9 +115,8 @@ void LCPModelCommon::prepareParams (int fullWidth, int fullHeight, float focalLe
|
||||
fx = foc_len_x * Dmax;
|
||||
fy = foc_len_y * Dmax;
|
||||
}
|
||||
|
||||
rfx = 1.0 / fx; // calculatiom with double precision doesn't cost anything at this step
|
||||
rfy = 1.0 / fy; // "
|
||||
rfx = 1.0f / fx;
|
||||
rfy = 1.0f / fy;
|
||||
|
||||
//printf("FW %i /X0 %g FH %i /Y0 %g %g\n",fullWidth,x0,fullHeight,y0, imgYCenter);
|
||||
}
|
||||
@@ -266,6 +265,17 @@ void LCPMapper::correctCA (double& x, double& y, int channel) const
|
||||
}
|
||||
}
|
||||
|
||||
float LCPMapper::calcVignetteFac(int x, int y) const
|
||||
{
|
||||
// No need for swapXY, since vignette is in RAW and always before rotation
|
||||
float xd = ((float)x - mc.x0) * mc.rfx, yd = ((float)y - mc.y0) * mc.rfy;
|
||||
|
||||
const LCPModelCommon::VignParam vignParam = mc.vign_param;
|
||||
float rsqr = xd * xd + yd * yd;
|
||||
|
||||
return rsqr * (vignParam[0] + rsqr * ((vignParam[1]) - (vignParam[2]) * rsqr + (vignParam[3]) * rsqr * rsqr));
|
||||
}
|
||||
|
||||
SSEFUNCTION void LCPMapper::processVignetteLine(int width, int y, float *line) const
|
||||
{
|
||||
// No need for swapXY, since vignette is in RAW and always before rotation
|
||||
@@ -284,7 +294,6 @@ SSEFUNCTION void LCPMapper::processVignetteLine (int width, int y, float *line)
|
||||
const vfloat rfxv = F2V(mc.rfx);
|
||||
|
||||
vfloat xv = _mm_setr_ps(0.f, 1.f, 2.f, 3.f);
|
||||
|
||||
for (; x < width-3; x+=4) {
|
||||
vfloat xdv = (xv - x0v) * rfxv;
|
||||
vfloat rsqr = xdv * xdv + ydv;
|
||||
@@ -294,11 +303,9 @@ SSEFUNCTION void LCPMapper::processVignetteLine (int width, int y, float *line)
|
||||
STVFU(line[x], valv);
|
||||
xv += fourv;
|
||||
}
|
||||
|
||||
#endif // __SSE2__
|
||||
|
||||
for (; x < width; x++) {
|
||||
if (line[x] > 0.f) {
|
||||
if (line[x] > 0) {
|
||||
float xd = ((float)x - mc.x0) * mc.rfx;
|
||||
const LCPModelCommon::VignParam vignParam = mc.vign_param;
|
||||
float rsqr = xd * xd + yd;
|
||||
@@ -307,18 +314,16 @@ SSEFUNCTION void LCPMapper::processVignetteLine (int width, int y, float *line)
|
||||
}
|
||||
}
|
||||
|
||||
void LCPMapper::processVignetteLine3Channels (int width, int y, float *line) const
|
||||
SSEFUNCTION void LCPMapper::processVignetteLine3Channels(int width, int y, float *line) const
|
||||
{
|
||||
// No need for swapXY, since vignette is in RAW and always before rotation
|
||||
float yd = ((float)y - mc.y0) * mc.rfy;
|
||||
yd *= yd;
|
||||
const LCPModelCommon::VignParam vignParam = mc.vign_param;
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
float xd = ((float)x - mc.x0) * mc.rfx;
|
||||
float rsqr = xd * xd + yd;
|
||||
float vignetteFactor = rsqr * (vignParam[0] + rsqr * ((vignParam[1]) - (vignParam[2]) * rsqr + (vignParam[3]) * rsqr * rsqr));
|
||||
|
||||
for(int c = 0;c < 3; ++c) {
|
||||
if (line[3*x+c] > 0) {
|
||||
line[3*x+c] += line[3*x+c] * vignetteFactor;
|
||||
@@ -327,6 +332,7 @@ void LCPMapper::processVignetteLine3Channels (int width, int y, float *line) con
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LCPProfile::LCPProfile(const Glib::ustring &fname)
|
||||
{
|
||||
const int BufferSize = 8192;
|
||||
@@ -444,6 +450,7 @@ int LCPProfile::filterBadFrames (double maxAvgDevFac, int minFramesLeft)
|
||||
return filtered;
|
||||
}
|
||||
|
||||
|
||||
// mode: 0=vignette, 1=distortion, 2=CA
|
||||
void LCPProfile::calcParams(int mode, float focalLength, float focusDist, float aperture, LCPModelCommon *pCorr1, LCPModelCommon *pCorr2, LCPModelCommon *pCorr3) const
|
||||
{
|
||||
|
@@ -148,6 +148,7 @@ public:
|
||||
|
||||
void correctDistortion(double& x, double& y) const; // MUST be the first stage
|
||||
void correctCA(double& x, double& y, int channel) const;
|
||||
float calcVignetteFac (int x, int y) const; // MUST be in RAW
|
||||
void processVignetteLine(int width, int y, float *line) const;
|
||||
void processVignetteLine3Channels(int width, int y, float *line) const;
|
||||
};
|
||||
|
Reference in New Issue
Block a user