mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-09 01:55:33 +00:00
Get rid of a bunch of MSVC compiler warnings.
This commit is contained in:
parent
a9d8f4ca6e
commit
89110be602
|
@ -104,7 +104,8 @@ class Pixel : public Vector4<uint16> {
|
||||||
// smaller to larger bit depths.
|
// smaller to larger bit depths.
|
||||||
void ChangeBitDepth(const uint8 (&newDepth)[4]);
|
void ChangeBitDepth(const uint8 (&newDepth)[4]);
|
||||||
|
|
||||||
static float ConvertChannelToFloat(uint8 channel, uint8 bitDepth) {
|
template<typename IntType>
|
||||||
|
static float ConvertChannelToFloat(IntType channel, uint8 bitDepth) {
|
||||||
float denominator = static_cast<float>((1 << bitDepth) - 1);
|
float denominator = static_cast<float>((1 << bitDepth) - 1);
|
||||||
return static_cast<float>(channel) / denominator;
|
return static_cast<float>(channel) / denominator;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace FasTC {
|
||||||
T vec[N];
|
T vec[N];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
typedef T ScalarType;
|
||||||
|
|
||||||
VectorBase() { }
|
VectorBase() { }
|
||||||
VectorBase(const VectorBase<T, N> &other) {
|
VectorBase(const VectorBase<T, N> &other) {
|
||||||
|
@ -194,7 +195,7 @@ namespace FasTC {
|
||||||
static inline VectorType ScalarMultiply(const VectorType &v, const ScalarType &s) {
|
static inline VectorType ScalarMultiply(const VectorType &v, const ScalarType &s) {
|
||||||
VectorType a;
|
VectorType a;
|
||||||
for(int i = 0; i < VectorType::Size; i++)
|
for(int i = 0; i < VectorType::Size; i++)
|
||||||
a(i) = v(i) * s;
|
a(i) = static_cast<VectorType::ScalarType>(v(i) * s);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +212,7 @@ namespace FasTC {
|
||||||
static inline VectorType ScalarDivide(const VectorType &v, const ScalarType &s) {
|
static inline VectorType ScalarDivide(const VectorType &v, const ScalarType &s) {
|
||||||
VectorType a;
|
VectorType a;
|
||||||
for(int i = 0; i < VectorType::Size; i++)
|
for(int i = 0; i < VectorType::Size; i++)
|
||||||
a(i) = v(i) / s;
|
a(i) = static_cast<VectorType::ScalarType>(v(i) / s);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace FasTC {
|
||||||
|
|
||||||
// Tests for equality by comparing the values and the bit depths.
|
// Tests for equality by comparing the values and the bit depths.
|
||||||
bool Color::operator==(const Color &other) const {
|
bool Color::operator==(const Color &other) const {
|
||||||
static const float kEpsilon = 0.001;
|
static const float kEpsilon = 0.001f;
|
||||||
for(uint32 c = 0; c < 4; c++) {
|
for(uint32 c = 0; c < 4; c++) {
|
||||||
if(fabs(Component(c) - other.Component(c)) > kEpsilon) {
|
if(fabs(Component(c) - other.Component(c)) > kEpsilon) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -221,7 +221,7 @@ double Image<PixelType>::ComputePSNR(Image<PixelType> *other) {
|
||||||
static Image<IPixel> FilterValid(const Image<IPixel> &img, uint32 size, double sigma) {
|
static Image<IPixel> FilterValid(const Image<IPixel> &img, uint32 size, double sigma) {
|
||||||
assert(size % 2);
|
assert(size % 2);
|
||||||
Image<IPixel> gaussian(size, size);
|
Image<IPixel> gaussian(size, size);
|
||||||
GenerateGaussianKernel(gaussian, size, sigma);
|
GenerateGaussianKernel(gaussian, size, static_cast<float>(sigma));
|
||||||
|
|
||||||
double sum = 0.0;
|
double sum = 0.0;
|
||||||
for(uint32 j = 0; j < size; j++) {
|
for(uint32 j = 0; j < size; j++) {
|
||||||
|
@ -285,8 +285,8 @@ double Image<PixelType>::ComputeSSIM(Image<PixelType> *other) {
|
||||||
|
|
||||||
for(uint32 j = 0; j < GetHeight(); j++) {
|
for(uint32 j = 0; j < GetHeight(); j++) {
|
||||||
for(uint32 i = 0; i < GetWidth(); i++) {
|
for(uint32 i = 0; i < GetWidth(); i++) {
|
||||||
img1(i, j) = 255.0 * static_cast<float>(img1(i, j));
|
img1(i, j) = 255.0f * static_cast<float>(img1(i, j));
|
||||||
img2(i, j) = 255.0 * static_cast<float>(img2(i, j));
|
img2(i, j) = 255.0f * static_cast<float>(img2(i, j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -498,7 +498,7 @@ void Image<PixelType>::Filter(const Image<IPixel> &kernel) {
|
||||||
|
|
||||||
for(uint32 j = 0; j < k.GetHeight(); j++) {
|
for(uint32 j = 0; j < k.GetHeight(); j++) {
|
||||||
for(uint32 i = 0; i < k.GetWidth(); i++) {
|
for(uint32 i = 0; i < k.GetWidth(); i++) {
|
||||||
k(i, j) = static_cast<float>(k(i, j)) / sum;
|
k(i, j) = static_cast<float>(k(i, j) / sum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,11 @@ bool CompressedImage::DecompressImage(unsigned char *outBuf, unsigned int outBuf
|
||||||
switch(m_Format) {
|
switch(m_Format) {
|
||||||
case eCompressionFormat_PVRTC:
|
case eCompressionFormat_PVRTC:
|
||||||
{
|
{
|
||||||
|
#ifndef NDEBUG
|
||||||
|
PVRTCC::Decompress(dj, false, PVRTCC::eWrapMode_Wrap, true);
|
||||||
|
#else
|
||||||
PVRTCC::Decompress(dj);
|
PVRTCC::Decompress(dj);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ namespace PVRTCC {
|
||||||
|
|
||||||
uint32 idx = static_cast<uint32>(xx) + width * static_cast<uint32>(yy);
|
uint32 idx = static_cast<uint32>(xx) + width * static_cast<uint32>(yy);
|
||||||
uint8 ix = static_cast<uint8>(255.0f * LookupIntensity(labels, pixels, idx) + 0.5f);
|
uint8 ix = static_cast<uint8>(255.0f * LookupIntensity(labels, pixels, idx) + 0.5f);
|
||||||
if(ix >= i0) {
|
if(ix > i0) {
|
||||||
ng++;
|
ng++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ namespace PVRTCC {
|
||||||
for(uint32 j = 0; j < blocksH; j++) {
|
for(uint32 j = 0; j < blocksH; j++) {
|
||||||
for(uint32 i = 0; i < blocksW; i++) {
|
for(uint32 i = 0; i < blocksW; i++) {
|
||||||
|
|
||||||
float minIntensity = 1.1, maxIntensity = -0.1;
|
float minIntensity = 1.1f, maxIntensity = -0.1f;
|
||||||
uint32 minIntensityIdx = 0, maxIntensityIdx = 0;
|
uint32 minIntensityIdx = 0, maxIntensityIdx = 0;
|
||||||
for(uint32 y = j*4; y <= (j+1)*4; y++)
|
for(uint32 y = j*4; y <= (j+1)*4; y++)
|
||||||
for(uint32 x = i*4; x <= (i+1)*4; x++) {
|
for(uint32 x = i*4; x <= (i+1)*4; x++) {
|
||||||
|
|
|
@ -224,7 +224,7 @@ static Pixel AveragePixels(const ::std::vector<Pixel> &pixels) {
|
||||||
|
|
||||||
Pixel result;
|
Pixel result;
|
||||||
for(uint32 c = 0; c < 4; c++) {
|
for(uint32 c = 0; c < 4; c++) {
|
||||||
result.Component(c) = sum[c] / pixels.size();
|
result.Component(c) = static_cast<uint16>(sum[c] / pixels.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -337,7 +337,7 @@ void Image::ContentAwareDownscale(uint32 xtimes, uint32 ytimes,
|
||||||
Iy[idx] = (I[yphidx] - I[ymhidx]) / 2.0f;
|
Iy[idx] = (I[yphidx] - I[ymhidx]) / 2.0f;
|
||||||
|
|
||||||
for(uint32 c = 0; c <= 3; c++) {
|
for(uint32 c = 0; c <= 3; c++) {
|
||||||
#define CPNT(dx) Pixel::ConvertChannelToFloat(GetPixels()[dx].Component(c), bitDepth[c])
|
#define CPNT(dx) Pixel::ConvertChannelToFloat(static_cast<uint8>(GetPixels()[dx].Component(c)), bitDepth[c])
|
||||||
Ix[c][idx] = (CPNT(xphidx) - CPNT(xmhidx)) / 2.0f;
|
Ix[c][idx] = (CPNT(xphidx) - CPNT(xmhidx)) / 2.0f;
|
||||||
Ixx[c][idx] = (CPNT(xphidx) - 2.0f*CPNT(idx) + CPNT(xmhidx)) / 2.0f;
|
Ixx[c][idx] = (CPNT(xphidx) - 2.0f*CPNT(idx) + CPNT(xmhidx)) / 2.0f;
|
||||||
Iyy[c][idx] = (CPNT(yphidx) - 2.0f*CPNT(idx) + CPNT(ymhidx)) / 2.0f;
|
Iyy[c][idx] = (CPNT(yphidx) - 2.0f*CPNT(idx) + CPNT(ymhidx)) / 2.0f;
|
||||||
|
@ -378,7 +378,7 @@ void Image::ContentAwareDownscale(uint32 xtimes, uint32 ytimes,
|
||||||
float denom = Ixsq + Iysq;
|
float denom = Ixsq + Iysq;
|
||||||
|
|
||||||
for(uint32 c = 0; c < 4; c++) {
|
for(uint32 c = 0; c < 4; c++) {
|
||||||
float I0 = Pixel::ConvertChannelToFloat(current.Component(c), bitDepth[c]);
|
float I0 = Pixel::ConvertChannelToFloat(static_cast<uint8>(current.Component(c)), bitDepth[c]);
|
||||||
float It = Ixx[c][idx] + Iyy[c][idx];
|
float It = Ixx[c][idx] + Iyy[c][idx];
|
||||||
if(fabs(denom) > 1e-6) {
|
if(fabs(denom) > 1e-6) {
|
||||||
It -= (Ixsq * Ixx[c][idx] +
|
It -= (Ixsq * Ixx[c][idx] +
|
||||||
|
|
Loading…
Reference in a new issue