Noise Reduction - auto chroma issue2495

This commit is contained in:
jdc
2014-11-05 15:04:18 +01:00
parent 3f5199396c
commit 47ed53084d
26 changed files with 3302 additions and 341 deletions

View File

@@ -307,26 +307,26 @@ void CurveFactory::curveLightBrightColor (
if (tcurve) delete tcurve;
}
// add curve Denoise : L=f(L)
void CurveFactory::denoiseLL ( bool & lldenoiseutili,const std::vector<double>& llcurvePoints, LUTf & Noisecurve,int skip){
// add curve Denoise : C=f(C)
void CurveFactory::denoiseCC ( bool & ccdenoiseutili,const std::vector<double>& cccurvePoints, LUTf & NoiseCCcurve,int skip){
bool needed;
DiagonalCurve* dCurve = NULL;
LUTf dCcurve(65536,0);
float val;
for (int i=0; i<32768; i++) {
dCcurve[i] = (float)i / 32767.0;
for (int i=0; i<48000; i++) {
dCcurve[i] = (float)i / 47999.0;
}
needed = false;
if (!llcurvePoints.empty() && llcurvePoints[0]!=0) {
dCurve = new DiagonalCurve (llcurvePoints, CURVES_MIN_POLY_POINTS/skip);
if (!cccurvePoints.empty() && cccurvePoints[0]!=0) {
dCurve = new DiagonalCurve (cccurvePoints, CURVES_MIN_POLY_POINTS/skip);
if (dCurve && !dCurve->isIdentity())
{needed = true;lldenoiseutili=true;}
{needed = true;ccdenoiseutili=true;}
}
fillCurveArray(dCurve, Noisecurve, skip, needed);
//Noisecurve.dump("Noise");
fillCurveArray(dCurve, NoiseCCcurve, skip, needed);
//NoiseCCcurve.dump("Noise");
if (dCurve) {
delete dCurve;
@@ -1191,6 +1191,38 @@ void OpacityCurve::Set(const std::vector<double> &curvePoints, bool &opautili) {
}
}
void NoisCCcurve::Reset() {
lutNoisCCcurve.reset();
}
void NoisCCcurve::Set(const Curve *pCurve) {
if (pCurve->isIdentity()) {
lutNoisCCcurve.reset(); // raise this value if the quality suffers from this number of samples
return;
}
lutNoisCCcurve(501); // raise this value if the quality suffers from this number of samples
nonzeroc=0.f;
for (int i=0; i<501; i++) {
lutNoisCCcurve[i] = pCurve->getVal(double(i)/500.);
if(lutNoisCCcurve[i] < 0.1f) lutNoisCCcurve[i]=0.1f;//avoid 0.f for wavelet : under 0.01f quasi no action for each value
nonzeroc+=lutNoisCCcurve[i];}//minima for Wavelet about 6.f or 7.f quasi no action
//lutNoisCCcurve.dump("NoisCC");
}
void NoisCCcurve::Set(const std::vector<double> &curvePoints, bool &ccdenoiseutili) {
FlatCurve* tcurve = NULL;
if (!curvePoints.empty() && curvePoints[0]>FCT_Linear && curvePoints[0]<FCT_Unchanged) {
tcurve = new FlatCurve (curvePoints, false, CURVES_MIN_POLY_POINTS/2);
tcurve->setIdentityValue(0.);
}
if (tcurve) {
Set(tcurve);ccdenoiseutili=true;
delete tcurve;
tcurve = NULL;
}
}
void NoisCurve::Reset() {
lutNoisCurve.reset();
}