code cleanup: double promotions

This commit is contained in:
Campbell Barton 2012-11-04 10:20:16 +00:00
parent fae6c35ca7
commit 7579a9ec37
9 changed files with 17 additions and 17 deletions

@ -53,11 +53,11 @@ void AUD_ButterworthFactory::recalculateCoefficients(AUD_SampleRate rate,
float omega = 2 * tan(m_frequency * M_PI / rate);
float o2 = omega * omega;
float o4 = o2 * o2;
float x1 = o2 + 2 * BWPB41 * omega + 4;
float x2 = o2 + 2 * BWPB42 * omega + 4;
float y1 = o2 - 2 * BWPB41 * omega + 4;
float y2 = o2 - 2 * BWPB42 * omega + 4;
float o228 = 2 * o2 - 8;
float x1 = o2 + 2.0f * (float)BWPB41 * omega + 4.0f;
float x2 = o2 + 2.0f * (float)BWPB42 * omega + 4.0f;
float y1 = o2 - 2.0f * (float)BWPB41 * omega + 4.0f;
float y2 = o2 - 2.0f * (float)BWPB42 * omega + 4.0f;
float o228 = 2.0f * o2 - 8.0f;
float norm = x1 * x2;
a.push_back(1);
a.push_back((x1 + x2) * o228 / norm);

@ -33,8 +33,8 @@
AUD_DelayReader::AUD_DelayReader(AUD_Reference<AUD_IReader> reader, float delay) :
AUD_EffectReader(reader),
m_delay(int(delay * reader->getSpecs().rate)),
m_remdelay(int(delay * reader->getSpecs().rate))
m_delay(int((AUD_SampleRate)delay * reader->getSpecs().rate)),
m_remdelay(int((AUD_SampleRate)delay * reader->getSpecs().rate))
{
}

@ -48,8 +48,8 @@ void AUD_HighpassFactory::recalculateCoefficients(AUD_SampleRate rate,
std::vector<float> &b,
std::vector<float> &a)
{
float w0 = 2 * M_PI * m_frequency / rate;
float alpha = sin(w0) / (2 * m_Q);
float w0 = 2.0 * M_PI * (AUD_SampleRate)m_frequency / rate;
float alpha = (float)(sin(w0) / (2.0 * (double)m_Q));
float norm = 1 + alpha;
float c = cos(w0);
a.push_back(1);

@ -60,7 +60,7 @@ static bool isQuadPlanar(carve::geom3d::Vector &v1, carve::geom3d::Vector &v2,
float production = carve::geom::dot(cross, vec3);
float magnitude = 1e-5 * cross.length();
return fabs(production) < magnitude;
return fabsf(production) < magnitude;
}
static bool isFacePlanar(CSG_IFace &face, std::vector<carve::geom3d::Vector> &vertices)

@ -86,8 +86,8 @@ static void FHT(fREAL *data, unsigned int M, unsigned int inverse)
fREAL *data_nbd = &data_n[bd];
fREAL *data_bd = &data[bd];
for (k = bl; k < len; k += istep) {
t1 = fc * data_n[k] + fs * data_nbd[k];
t2 = fs * data_n[k] - fc * data_nbd[k];
t1 = fc * (double)data_n[k] + fs * (double)data_nbd[k];
t2 = fs * (double)data_n[k] - fc * (double)data_nbd[k];
data_n[k] = data[k] - t1;
data_nbd[k] = data_bd[k] - t2;
data[k] += t1;
@ -395,7 +395,7 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile,
// linear window good enough here, visual result counts, not scientific analysis
//w = (1.f-fabs(u))*(1.f-fabs(v));
// actually, Hanning window is ok, cos^2 for some reason is slower
w = (0.5f + 0.5f * cos((double)u * M_PI)) * (0.5f + 0.5f * cos((double)v * M_PI));
w = (0.5f + 0.5f * cosf(u * (float)M_PI)) * (0.5f + 0.5f * cosf(v * (float)M_PI));
mul_v3_fl(fcol, w);
ckrn->writePixel(x, y, fcol);
}

@ -785,7 +785,7 @@ static int file_extension_type(const char *relname)
}
else if (BLI_testextensie(relname, ".txt") ||
BLI_testextensie(relname, ".glsl") ||
BLI_testextensie(relname, ".osl") ||
BLI_testextensie(relname, ".osl") ||
BLI_testextensie(relname, ".data"))
{
return TEXTFILE;

@ -947,7 +947,7 @@ static void getLogToLinLut(float *lut, LogImageFile *logImage, LogImageElement l
softClip = 0;
breakPoint = logImage->referenceWhite - softClip;
gain = logElement.maxValue / (1.0 - powf(10, (logImage->referenceBlack - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f));
gain = logElement.maxValue / (1.0f - powf(10, (logImage->referenceBlack - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f));
offset = gain - logElement.maxValue;
kneeOffset = powf(10, (breakPoint - logImage->referenceWhite) * step / negativeFilmGamma * logImage->gamma / 1.7f) * gain - offset;
kneeGain = (logElement.maxValue - kneeOffset) / powf(5 * softClip, softClip / 100);

@ -154,7 +154,7 @@ static void FLOAT2RGBE(fCOLOR fcol, RGBE rgbe)
if (d <= 1e-32f)
rgbe[RED] = rgbe[GRN] = rgbe[BLU] = rgbe[EXP] = 0;
else {
d = frexp(d, &e) * 256.f / d;
d = (float)frexp(d, &e) * 256.0f / d;
rgbe[RED] = (unsigned char)(fcol[RED] * d);
rgbe[GRN] = (unsigned char)(fcol[GRN] * d);
rgbe[BLU] = (unsigned char)(fcol[BLU] * d);

@ -93,7 +93,7 @@ static int svbvh_bb_intersect_test(const Isect *isec, const float *_bb)
RE_RC_COUNT(isec->raycounter->bb.test);
if (t1x > t2y || t2x < t1y || t1x > t2z || t2x < t1z || t1y > t2z || t2y < t1z) return 0;
if (t2x < 0.0 || t2y < 0.0 || t2z < 0.0) return 0;
if (t2x < 0.0f || t2y < 0.0f || t2z < 0.0f) return 0;
if (t1x > isec->dist || t1y > isec->dist || t1z > isec->dist) return 0;
RE_RC_COUNT(isec->raycounter->bb.hit);