Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.

Commit c374126

Browse files
committed
fixed the ColorRegression for loop bug, as well as added #defines for the min and max effort levels
1 parent 38dd7fb commit c374126

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

EtcLib/Etc/Etc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#include "EtcColor.h"
2222
#include "EtcErrorMetric.h"
2323

24+
#define ETCCOMP_MIN_EFFORT_LEVEL (0.0f)
25+
#define ETCCOMP_DEFAULT_EFFORT_LEVEL (40.0f)
26+
#define ETCCOMP_MAX_EFFORT_LEVEL (100.0f)
27+
2428
namespace Etc
2529
{
2630
class Block4x4EncodingBits;

EtcLib/Etc/EtcImage.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,15 @@ namespace Etc
220220
return m_encodingStatus;
221221
}
222222

223-
if (m_fEffort < 0.0f)
223+
if (m_fEffort < ETCCOMP_MIN_EFFORT_LEVEL)
224224
{
225225
AddToEncodingStatus(WARNING_EFFORT_OUT_OF_RANGE);
226-
m_fEffort = 0.0f;
226+
m_fEffort = ETCCOMP_MIN_EFFORT_LEVEL;
227227
}
228-
else if (m_fEffort > 100.0f)
228+
else if (m_fEffort > ETCCOMP_MAX_EFFORT_LEVEL)
229229
{
230230
AddToEncodingStatus(WARNING_EFFORT_OUT_OF_RANGE);
231-
m_fEffort = 100.0f;
231+
m_fEffort = ETCCOMP_MAX_EFFORT_LEVEL;
232232
}
233233
if (a_uiJobs < 1)
234234
{
@@ -276,7 +276,7 @@ namespace Etc
276276
}
277277

278278
// perform effort-based encoding
279-
if (m_fEffort > 0.0f)
279+
if (m_fEffort > ETCCOMP_MIN_EFFORT_LEVEL)
280280
{
281281
unsigned int uiFinishedBlocks = 0;
282282
unsigned int uiTotalEffortBlocks = static_cast<unsigned int>(roundf(0.01f * m_fEffort * GetNumberOfBlocks()));

EtcLib/EtcCodec/EtcBlock4x4Encoding_RGB8.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,9 +1715,10 @@ namespace Etc
17151715
{
17161716
afX[uiPixel] = (float)uiPixel;
17171717
afY[uiPixel] = paf4Pixels[uiPixel].f[uiComponent];
1718-
Etc::Regression(afX, afY, a_uiPixels,
1719-
&(pf4Slope->f[uiComponent]), &(pf4Offset->f[uiComponent]));
1718+
17201719
}
1720+
Etc::Regression(afX, afY, a_uiPixels,
1721+
&(pf4Slope->f[uiComponent]), &(pf4Offset->f[uiComponent]));
17211722
}
17221723

17231724
}

EtcTool/EtcTool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Commands
7979
{
8080
apstrCompareFilename[uiComparison] = nullptr;
8181
}
82-
fEffort = 40.0f;
82+
fEffort = ETCCOMP_DEFAULT_EFFORT_LEVEL;
8383
//Rec. 709 or BT.709...the default
8484
e_ErrMetric = ErrorMetric::BT709;
8585
uiJobs = MIN_JOBS;

0 commit comments

Comments
 (0)