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

Commit

Permalink
Merge pull request #4 from kablammyman/master
Browse files Browse the repository at this point in the history
fixed the ColorRegression for loop bug, as well as added #defines for…
  • Loading branch information
mainroach authored Sep 21, 2016
2 parents 38dd7fb + c374126 commit aecc84f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions EtcLib/Etc/Etc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "EtcColor.h"
#include "EtcErrorMetric.h"

#define ETCCOMP_MIN_EFFORT_LEVEL (0.0f)
#define ETCCOMP_DEFAULT_EFFORT_LEVEL (40.0f)
#define ETCCOMP_MAX_EFFORT_LEVEL (100.0f)

namespace Etc
{
class Block4x4EncodingBits;
Expand Down
10 changes: 5 additions & 5 deletions EtcLib/Etc/EtcImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ namespace Etc
return m_encodingStatus;
}

if (m_fEffort < 0.0f)
if (m_fEffort < ETCCOMP_MIN_EFFORT_LEVEL)
{
AddToEncodingStatus(WARNING_EFFORT_OUT_OF_RANGE);
m_fEffort = 0.0f;
m_fEffort = ETCCOMP_MIN_EFFORT_LEVEL;
}
else if (m_fEffort > 100.0f)
else if (m_fEffort > ETCCOMP_MAX_EFFORT_LEVEL)
{
AddToEncodingStatus(WARNING_EFFORT_OUT_OF_RANGE);
m_fEffort = 100.0f;
m_fEffort = ETCCOMP_MAX_EFFORT_LEVEL;
}
if (a_uiJobs < 1)
{
Expand Down Expand Up @@ -276,7 +276,7 @@ namespace Etc
}

// perform effort-based encoding
if (m_fEffort > 0.0f)
if (m_fEffort > ETCCOMP_MIN_EFFORT_LEVEL)
{
unsigned int uiFinishedBlocks = 0;
unsigned int uiTotalEffortBlocks = static_cast<unsigned int>(roundf(0.01f * m_fEffort * GetNumberOfBlocks()));
Expand Down
5 changes: 3 additions & 2 deletions EtcLib/EtcCodec/EtcBlock4x4Encoding_RGB8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1715,9 +1715,10 @@ namespace Etc
{
afX[uiPixel] = (float)uiPixel;
afY[uiPixel] = paf4Pixels[uiPixel].f[uiComponent];
Etc::Regression(afX, afY, a_uiPixels,
&(pf4Slope->f[uiComponent]), &(pf4Offset->f[uiComponent]));

}
Etc::Regression(afX, afY, a_uiPixels,
&(pf4Slope->f[uiComponent]), &(pf4Offset->f[uiComponent]));
}

}
Expand Down
2 changes: 1 addition & 1 deletion EtcTool/EtcTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Commands
{
apstrCompareFilename[uiComparison] = nullptr;
}
fEffort = 40.0f;
fEffort = ETCCOMP_DEFAULT_EFFORT_LEVEL;
//Rec. 709 or BT.709...the default
e_ErrMetric = ErrorMetric::BT709;
uiJobs = MIN_JOBS;
Expand Down

0 comments on commit aecc84f

Please sign in to comment.