Skip to content

Commit

Permalink
Merge pull request google#17 from kablammyman/master
Browse files Browse the repository at this point in the history
fix for last rgbx merge
  • Loading branch information
mainroach authored Mar 13, 2017
2 parents bf22b48 + 38b59d0 commit e2e733c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
12 changes: 6 additions & 6 deletions EtcLib/Etc/EtcFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace Etc
{

static const double M_PI = 3.14159265358979323846;
static const double PiConst = 3.14159265358979323846;

inline double sinc(double x)
{
Expand All @@ -15,7 +15,7 @@ inline double sinc(double x)
return 1.0;
}

return sin(M_PI * x) / (M_PI * x);
return sin(PiConst * x) / (PiConst * x);
}

//inline float sincf( float x )
Expand Down Expand Up @@ -296,10 +296,10 @@ int FilterTwoPass( RGBCOLOR *pSrcImage, int srcWidth, int srcHeight,
}

pPixel = pDestImage + (iRow * destWidth) + iCol;
pPixel->rgba[0] = (unsigned char)(__max( 0, __min( 255.0, dRed)));
pPixel->rgba[1] = (unsigned char)(__max( 0, __min( 255.0, dGreen)));
pPixel->rgba[2] = (unsigned char)(__max( 0, __min( 255.0, dBlue)));
pPixel->rgba[3] = (unsigned char)(__max( 0, __min( 255.0, dAlpha)));
pPixel->rgba[0] = (unsigned char)(std::max( 0.0, std::min( 255.0, dRed)));
pPixel->rgba[1] = (unsigned char)(std::max( 0.0, std::min( 255.0, dGreen)));
pPixel->rgba[2] = (unsigned char)(std::max( 0.0, std::min( 255.0, dBlue)));
pPixel->rgba[3] = (unsigned char)(std::max( 0.0, std::min( 255.0, dAlpha)));
}
}

Expand Down
6 changes: 3 additions & 3 deletions EtcTool/EtcSourceImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ namespace Etc
{
unsigned char* paucPixels = nullptr;

int iWidth;
int iHeight;
int iBitsPerPixel;
int iWidth = 0;
int iHeight = 0;
bool bool16BitImage = false;

#if USE_STB_IMAGE_LOAD
int iBitsPerPixel;
//if stb_iamge is available, only use it to load files other than png
char *fileExt = strrchr(m_pstrFilename, '.');

Expand Down
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,16 @@ Options:
-effort <amount> number between 0 and 100 to specify the encoding quality
(100 is the highest quality)
-errormetric <error_metric> specify the error metric, the options are
rgba, rec709, numeric and normalxyz
rgba, rgbx, rec709, numeric and normalxyz
-format <etc_format> ETC1, RGB8, SRGB8, RGBA8, SRGB8, RGB8A1,
SRGB8A1 or R11
-help prints this message
-jobs or -j <thread_count> specifies the number of threads (default=1)
-normalizexyz normalize RGB to have a length of 1
-verbose or -v shows status information during the encoding
process
-mipmaps or -m <mip_count> sets the maximum number of mipaps to generate (default=1)
-mipwrap or -w <x|y|xy> sets the mipmap filter wrap mode (default=clamp)

* -analyze will run an analysis of the encoding and place it in folder
"analysis_folder" (e.g. ../analysis/kodim05). within the analysis_folder, a folder
Expand All @@ -140,10 +142,12 @@ will dictate what error analysis is used in the comparison.
to apply during the encoding.

* -errormetric selects the fitting algorithm used by the encoder. "rgba" calculates
RMS error using RGB components that are weighted by A. "rec709" is similar to "rgba",
except the RGB components are also weighted according to Rec709. "numeric"
calculates RMS error using unweighted RGBA components. "normalize" calculates error
based on dot product and vector length for RGB and RMS error for A.
RMS error using RGB components that are weighted by A. "rgbx" calculates RMS error
using RGBA components, where A is treated as an additional data channel, instead of
as alpha. "rec709" is similar to "rgba", except the RGB components are also weighted
according to Rec709. "numeric" calculates RMS error using unweighted RGBA components.
"normalize" calculates error based on dot product and vector length for RGB and RMS
error for A.

* -help prints out the usage message

Expand All @@ -154,6 +158,14 @@ based on dot product and vector length for RGB and RMS error for A.
* -verbose shows information on the current encoding process. It will then display the
PSNR and time time it took to encode the image.

* -mipmaps takes an argument that specifies how many mipmaps to generate from the
source image. The mipmaps are generated with a lanczos3 filter using edge clamping.
If the mipmaps option is not specified no mipmaps are created.

* -mipwrap takes an argument that specifies the mipmap filter wrap mode. The options
are "x", "y" and "xy" which specify wrapping in x only, y only or x and y respectively.
The default options are clamping in both x and y.

Note: Path names can use slashes or backslashes. The tool will convert the
slashes to the appropriate polarity for the current platform.

Expand Down

0 comments on commit e2e733c

Please sign in to comment.