aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2022-12-08 16:49:45 +0200
committerRoy <Roy.mail.net@gmail.com>2022-12-08 16:49:45 +0200
commitf9ac8ae24290aefd0be19d68de19669817422a88 (patch)
tree8defad710ecd5d0ed68e0d6da0b36080ddbfc6cd /Software/Visual_Studio
parent144f4d40b74b552277c12edc6d41b8676440070a (diff)
parentac51428de0cf381beae9f94db62efb09372bfdee (diff)
downloadTango-f9ac8ae24290aefd0be19d68de19669817422a88.tar.gz
Tango-f9ac8ae24290aefd0be19d68de19669817422a88.zip
Merged GBD.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.cpp80
-rw-r--r--Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.h2
2 files changed, 50 insertions, 32 deletions
diff --git a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.cpp b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.cpp
index 7e9b1b256..30870a983 100644
--- a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.cpp
+++ b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.cpp
@@ -844,21 +844,17 @@ void Tango::ColorLib::ColorConverter::SetCalibFactorization()
double denom;
for (int i = 0; i < m_nInks; ++i)
{
- denom = (m_GamutRegionMaxLim[m_nProcessRanges - 1] - m_CTmaxNlPerCM(i));
- if(m_CalibMode ==1)
+ if (m_GamutRegionMaxLim[m_nProcessRanges - 1] == ((m_CTmaxNlPerCM(i) / 100)*m_maxCalX[i]))
{
- m_CalibGain[i] = ( (m_maxNlPerCM(i)/100.0) * m_maxCalX[i] - m_maxNlPerCM(i)) /denom ;
-
- m_CalibOffset[i] = (m_GamutRegionMaxLim[m_nProcessRanges - 1] * m_maxNlPerCM(i) -
- (m_maxCalX[i] * (m_maxNlPerCM(i) / 100.0) * m_CTmaxNlPerCM(i))) / denom;
+ m_CalibGain[i] = 1.0;
+ m_CalibOffset[i] = 0.0;
}
else
{
- //This is a compromise to keep the inks volumes within limits.
- m_CalibGain[i] = (m_ProcessRangesMaxP[m_nProcessRanges - 1] - m_maxNlPerCM(i)) / denom;
-
+ denom = (m_GamutRegionMaxLim[m_nProcessRanges - 1] - m_CTmaxNlPerCM(i));
+ m_CalibGain[i] = ((m_maxNlPerCM(i) / 100.0) * m_maxCalX[i] - m_maxNlPerCM(i)) / denom;
m_CalibOffset[i] = (m_GamutRegionMaxLim[m_nProcessRanges - 1] * m_maxNlPerCM(i) -
- (m_ProcessRangesMaxP[m_nProcessRanges - 1] * m_CTmaxNlPerCM(i))) / denom;
+ (m_maxCalX[i] * (m_maxNlPerCM(i) / 100.0) * m_CTmaxNlPerCM(i))) / denom;
}
}
}
@@ -1158,11 +1154,16 @@ void Tango::ColorLib::ColorConverter::Thread2ColorTableunits(VectorXd InkIn, Vec
{
if (InkIn(i) > 100.0)
{
- Iconst = m_maxNlPerCM(i) / 100.0;
- lconstCT = m_CTmaxNlPerCM(i) / 100;
- InkOut(i) = ((InkIn(i)*Iconst) - m_CalibOffset[i]) / m_CalibGain[i];
- //back to %
- InkOut(i) /= lconstCT;
+ if((m_CalibGain[i] ==1.0 )& ( m_CalibOffset[i] ==0))
+ InkOut(i) = InkIn(i);
+ else
+ {
+ Iconst = m_maxNlPerCM(i) / 100.0;
+ lconstCT = m_CTmaxNlPerCM(i) / 100;
+ InkOut(i) = ((InkIn(i)*Iconst) - m_CalibOffset[i]) / m_CalibGain[i];
+ //back to %
+ InkOut(i) /= lconstCT;
+ }
}
else
InkOut(i) = InkIn(i);
@@ -1177,11 +1178,16 @@ void Tango::ColorLib::ColorConverter::ColorTable2Threadunits(VectorXd InkIn, Vec
{
if (InkIn(i) > 100.0)
{
- Iconst = m_CTmaxNlPerCM(i) / 100.0;
- lconstCT = m_maxNlPerCM(i) / 100;
- InkOut(i) = m_CalibGain[i] * (InkIn(i)*Iconst) + m_CalibOffset[i];
- //back to %
- InkOut(i) /= lconstCT;
+ if ((m_CalibGain[i] == 1.0)& (m_CalibOffset[i] == 0))
+ InkOut(i) = InkIn(i);
+ else
+ {
+ Iconst = m_CTmaxNlPerCM(i) / 100.0;
+ lconstCT = m_maxNlPerCM(i) / 100;
+ InkOut(i) = m_CalibGain[i] * (InkIn(i)*Iconst) + m_CalibOffset[i];
+ //back to %
+ InkOut(i) /= lconstCT;
+ }
}
else
InkOut(i) = InkIn(i);
@@ -1631,6 +1637,12 @@ void Tango::ColorLib::ColorConverter::ConvertVolumeToRGBDisplay(InputCoordinates
ConvertToLinearInks(NLInkP, InkLinV); //Use Calib tables //full range Thread Units %
Thread2ColorTableunits(InkLinV, InkLinV); //full range Color Table Units %
//Linear Inks are in their natural coordinates %
+ for (int iP = 0; iP < m_nProcessRanges; ++iP)
+ {
+ m_CurrentProcessRangesMax[iP] = m_GamutRegionMaxLim[iP]; //of Color Table
+ m_CurrentProcessRangesMin[iP] = m_GamutRegionMinLim[iP];
+ }
+ LimitInksPercentage(InkLinV, InkLinV, isBounded, 1); //Limited in Color Table Space
VectorToDouble(InkLinV, InkOutP);
ApplyCTInvLinearCurves(InkOutP, InkOutP); //full range % in Color Table Space // //Inks are now nonlinear in Color Table space
}
@@ -1871,8 +1883,9 @@ size_t Tango::ColorLib::ColorConverter::Convert(uint8_t * input_buffer, size_t i
// Set Calibration mode 0 up tp 100%, 1 with High Volume Calib
//SetCalibMode();
//Calculate normalization per ink
- SetCalibFactorization();
SetMaxCalValues();
+ SetCalibFactorization();
+
m_nVolumes = m_nInks;
int GamutRegion = 0;
//Convert input data to linear inks
@@ -3715,8 +3728,9 @@ void Tango::ColorLib::ColorConverter::PrepareGradient(GradientConversionInput* c
// Set Calibration mode 0 up tp 100%, 1 with High Volume Calib
//SetCalibMode();
//Calculate normalization per ink
- SetCalibFactorization();
SetMaxCalValues();
+ SetCalibFactorization();
+
//m_nVolumes = m_nB2AnSepOut;
int GamutRegion = 0;
/* for (int i = 0; i < m_nGradStops; ++i)
@@ -4887,6 +4901,7 @@ void Tango::ColorLib::ColorConverter::GetBackLightInks(VectorXd &VolumeLI, int &
{
sortPairs(LgtInksIndex, LightVol, numLgtInks); //Light inks are sorted in ascending order
//revert and check
+ TotalVolume = 0.0;
for (int j = 0; j < m_TotalNumberofInks; ++j)
TotalVolume += VolumeLI(j);
int i = numLgtInks - 1;
@@ -4894,12 +4909,13 @@ void Tango::ColorLib::ColorConverter::GetBackLightInks(VectorXd &VolumeLI, int &
{
VolumeLI(LgtInksIndex[i] - m_nInks) = LightVol[i] / DilutionFactor;
VolumeLI(LgtInksIndex[i]) =0.0;
+ TotalVolume = 0.0;
for (int j = 0; j < m_TotalNumberofInks; ++j)
- TotalVolume += VolumeLI(i);
+ TotalVolume += VolumeLI(j);
i--;
}
findGamutRegion(GamutRegion, TotalVolume);
- resplit = false;
+ resplit = false;
}
else
{
@@ -4947,8 +4963,8 @@ void Tango::ColorLib::ColorConverter::DefineSplitLimits(double &low, double &hi
//Set Limits
//1st Region
double lim1 = 0;
- double lim2 = m_CurrentProcessRangesMax[0];
- double lim3 = m_CurrentProcessRangesMin[0];
+ double lim2 = m_CurrentProcessRangesMin[0];
+ double lim3 = m_CurrentProcessRangesMax[0];
int ProcessRangeInd = 0;
//Regions 1 to n-1
for (int iReg = 0; iReg < m_nProcessRanges - 1; ++iReg)
@@ -5193,8 +5209,8 @@ size_t Tango::ColorLib::ColorConverter::GetRecommendedProcessParameters(uint8_t
// Set Calibration mode 0 up tp 100%, 1 with High Volume Calib
// SetCalibMode();
//Calculate normalization per ink
- SetCalibFactorization();
SetMaxCalValues();
+ SetCalibFactorization();
m_nVolumes = m_nInks;
int nstops = Input->n_stops;
@@ -5708,7 +5724,7 @@ void Tango::ColorLib::ColorConverter::DirectInversionCalc(double *LabIn, VectorX
C_RGB_XYZ_Lab LabTmp;
double *dECMC = new double[nk];
C_RGB_XYZ_Lab LabInVec;
-
+ VectorXd LabOutTmp(3);
LabInVec.Set(LabIn[0], LabIn[1], LabIn[2]);
C_RGB_XYZ_Lab LabOutVec;
m_currentMaxNLPerCM = m_maxNlPerCM; // thread units
@@ -5749,15 +5765,15 @@ void Tango::ColorLib::ColorConverter::DirectInversionCalc(double *LabIn, VectorX
{
ValK[0] = (double)k * dK;
m_Minimize->MinimizationAlgorithm(InitCMY, &ValK[0], nIterations); //result is returned in InitCMY
- LabOut = DoubleToVector(LabOnGamut, 3);
- LabOut += DoubleToVector(m_Minimize->GetLabOut(), 3);
+ LabOutTmp = DoubleToVector(LabOnGamut, 3);
+ LabOutTmp += DoubleToVector(m_Minimize->GetLabOut(), 3);
for (int i = 0; i < nfree; ++i)
SolVector[k][i] = std::min(std::max(100 * InitCMY[i], 0.0), 100.0);
SolVector[k][nfree] = std::min(std::max(100 * ValK[0], 0.0), 100.0); //Solution Vector is in linear units in the interval [0,100]
isBounded[k] = false;
for (int i = 0; i < 3; ++i)
- finalLab[k][i] = LabOut[i];
- LabOutVec.Set(LabOut[0], LabOut[1], LabOut[2]);
+ finalLab[k][i] = LabOutTmp[i];
+ LabOutVec.Set(LabOutTmp[0], LabOutTmp[1], LabOutTmp[2]);
ColConv.dEcmc(LabTmp, LabOutVec, dECMC[k]);
//Result is in Linear Inks
diff --git a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.h b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.h
index ba32fa44e..ee247eac4 100644
--- a/Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.h
+++ b/Software/Visual_Studio/ColorLib/Tango.ColorLib_v6/ColorConverter.h
@@ -138,6 +138,8 @@ namespace Tango
// bool m_AdaptWP;
CalibData *m_CalibCurves;
//ForwardModel *m_forwardmodel;
+ bool m_has_forfinetuning;
+ bool m_forfinetuning;
int m_nInks;
int m_nVolumes;
//double *m_ProcessRangesMaxInkUptake;