merged improvements by Edgar

metadata
Wenzel Jakob 2014-02-17 15:16:00 +01:00
commit 915a672da1
6 changed files with 23 additions and 6 deletions

View File

@ -52,6 +52,17 @@
#include <math.h> #include <math.h>
#pragma intrinsic(memset, memcmp, memcpy, strlen, strcmp, strcpy, _strset, strcat, fabs, abs) #pragma intrinsic(memset, memcmp, memcpy, strlen, strcmp, strcpy, _strset, strcat, fabs, abs)
#endif #endif
#if _MSC_VER >= 1600
#ifdef SINGLE_PRECISION
#pragma detect_mismatch( "MTS_FLOAT_PRECISION", "SINGLE")
#elif DOUBLE_PRECISION
#pragma detect_mismatch( "MTS_FLOAT_PRECISION", "DOUBLE")
#endif
#define MTS_STRINGIFY(s) #s
#define MTS_XSTRINGIFY(s) MTS_STRINGIFY(s)
#pragma detect_mismatch("MTS_SPECTRUM_SAMPLES", MTS_XSTRINGIFY(SPECTRUM_SAMPLES))
#endif
#elif defined(__APPLE__) #elif defined(__APPLE__)
#define __OSX__ #define __OSX__
#elif defined(__linux) #elif defined(__linux)

View File

@ -348,7 +348,7 @@ public:
m_storage = new ImageBlock(Bitmap::ESpectrumAlphaWeight, m_cropSize); m_storage = new ImageBlock(Bitmap::ESpectrumAlphaWeight, m_cropSize);
} else { } else {
m_storage = new ImageBlock(Bitmap::EMultiSpectrumAlphaWeight, m_cropSize, m_storage = new ImageBlock(Bitmap::EMultiSpectrumAlphaWeight, m_cropSize,
NULL, SPECTRUM_SAMPLES * m_pixelFormats.size() + 2); NULL, (int) (SPECTRUM_SAMPLES * m_pixelFormats.size() + 2));
} }
} }

View File

@ -142,7 +142,7 @@ public:
proc->setPixelFormat( proc->setPixelFormat(
m_integrators.size() > 1 ? Bitmap::EMultiSpectrumAlphaWeight : Bitmap::ESpectrumAlphaWeight, m_integrators.size() > 1 ? Bitmap::EMultiSpectrumAlphaWeight : Bitmap::ESpectrumAlphaWeight,
m_integrators.size() * SPECTRUM_SAMPLES + 2, false); (int) (m_integrators.size() * SPECTRUM_SAMPLES + 2), false);
int integratorResID = sched->registerResource(this); int integratorResID = sched->registerResource(this);
proc->bindResource("integrator", integratorResID); proc->bindResource("integrator", integratorResID);

View File

@ -1399,7 +1399,10 @@ ref<Bitmap> Bitmap::convert(EPixelFormat pixelFormat,
ref<Bitmap> Bitmap::convertMultiSpectrumAlphaWeight(const std::vector<EPixelFormat> &pixelFormats, ref<Bitmap> Bitmap::convertMultiSpectrumAlphaWeight(const std::vector<EPixelFormat> &pixelFormats,
EComponentFormat componentFormat, const std::vector<std::string> &channelNames) const { EComponentFormat componentFormat, const std::vector<std::string> &channelNames) const {
ref<Bitmap> bitmap = new Bitmap(Bitmap::EMultiChannel, componentFormat, m_size, channelNames.size()); if (channelNames.size() > std::numeric_limits<uint8_t>::max())
Log(EError, "convertMultiSpectrumAlphaWeight(): excessive number of channels!");
ref<Bitmap> bitmap = new Bitmap(Bitmap::EMultiChannel, componentFormat,
m_size, (uint8_t) channelNames.size());
bitmap->setChannelNames(channelNames); bitmap->setChannelNames(channelNames);
convertMultiSpectrumAlphaWeight(this, getUInt8Data(), bitmap, convertMultiSpectrumAlphaWeight(this, getUInt8Data(), bitmap,
bitmap->getUInt8Data(), pixelFormats, componentFormat, bitmap->getUInt8Data(), pixelFormats, componentFormat,

View File

@ -69,7 +69,6 @@ static InterpolatedSpectrum CIE_D65_interp(CIE_wavelengths, CIE_D65_entries, CIE
Spectrum Spectrum::CIE_X; Spectrum Spectrum::CIE_X;
Spectrum Spectrum::CIE_Y; Spectrum Spectrum::CIE_Y;
Spectrum Spectrum::CIE_Z; Spectrum Spectrum::CIE_Z;
Spectrum Spectrum::CIE_D65;
Float Spectrum::CIE_normalization; Float Spectrum::CIE_normalization;
/// @} /// @}

View File

@ -276,7 +276,9 @@ static bp::tuple Matrix4x4_lu(Matrix4x4 *matrix) {
static Vector4 Matrix4x4_cholSolve(Matrix4x4 *matrix, Vector B) { static Vector4 Matrix4x4_cholSolve(Matrix4x4 *matrix, Vector B) {
typedef Matrix<4, 1, Float> Matrix4x1; typedef Matrix<4, 1, Float> Matrix4x1;
Vector4 X; Vector4 X;
matrix->cholSolve<1>((Matrix4x1 &) B, (Matrix4x1 &) X); Matrix4x1 & aliasedB MTS_MAY_ALIAS = reinterpret_cast<Matrix4x1 &>(B);
Matrix4x1 & aliasedX MTS_MAY_ALIAS = reinterpret_cast<Matrix4x1 &>(X);
matrix->cholSolve<1>(aliasedB, aliasedX);
return X; return X;
} }
@ -290,7 +292,9 @@ static Vector4 Matrix4x4_luSolve(Matrix4x4 *matrix, Vector B, bp::list pivList)
for (int i=0; i<4; ++i) for (int i=0; i<4; ++i)
piv[i] = bp::extract<Float>(pivList[i]); piv[i] = bp::extract<Float>(pivList[i]);
matrix->luSolve<1>((Matrix4x1 &) B, (Matrix4x1 &) X, piv); Matrix4x1 & aliasedB MTS_MAY_ALIAS = reinterpret_cast<Matrix4x1 &>(B);
Matrix4x1 & aliasedX MTS_MAY_ALIAS = reinterpret_cast<Matrix4x1 &>(X);
matrix->luSolve<1>(aliasedB, aliasedX, piv);
return X; return X;
} }