@@ -86,7 +86,7 @@ static void Convolution(size_t xsize, size_t ysize,
86
86
for (int j = minx; j <= maxx; ++j) {
87
87
sum += inp[y * xsize + j] * multipliers[j - x + offset];
88
88
}
89
- result[ox * ysize + y] = sum * scale;
89
+ result[ox * ysize + y] = static_cast < float >( sum * scale) ;
90
90
}
91
91
}
92
92
}
@@ -101,7 +101,7 @@ void Blur(size_t xsize, size_t ysize, float* channel, double sigma,
101
101
const int expn_size = 2 * diff + 1 ;
102
102
std::vector<float > expn (expn_size);
103
103
for (int i = -diff; i <= diff; ++i) {
104
- expn[i + diff] = exp (scaler * i * i);
104
+ expn[i + diff] = static_cast < float >( exp (scaler * i * i) );
105
105
}
106
106
const int xstep = std::max (1 , int (sigma / 3 ));
107
107
const int ystep = xstep;
@@ -818,8 +818,8 @@ void MaskHighIntensityChange(
818
818
// Interpolate lineraly between the average color and the actual
819
819
// color -- to reduce the importance of this pixel.
820
820
for (int i = 0 ; i < 3 ; ++i) {
821
- xyb0[i][ix] = mix[i] * c0[i][ix] + (1 - mix[i]) * ave[i];
822
- xyb1[i][ix] = mix[i] * c1[i][ix] + (1 - mix[i]) * ave[i];
821
+ xyb0[i][ix] = static_cast < float >( mix[i] * c0[i][ix] + (1 - mix[i]) * ave[i]) ;
822
+ xyb1[i][ix] = static_cast < float >( mix[i] * c1[i][ix] + (1 - mix[i]) * ave[i]) ;
823
823
}
824
824
}
825
825
}
@@ -915,12 +915,12 @@ static inline float GammaPolynomial(float value) {
915
915
12.262350348616792 , 20.557285797683576 , 12.161463238367844 ,
916
916
4.711532733641639 , 0.899112889751053 , 0.035662329617191 ,
917
917
}};
918
- return r (value);
918
+ return static_cast < float >( r (value) );
919
919
}
920
920
921
921
static inline double Gamma (double v) {
922
922
// return SimpleGamma(v);
923
- return GammaPolynomial (v );
923
+ return GammaPolynomial (static_cast < float >(v) );
924
924
}
925
925
926
926
void OpsinDynamicsImage (size_t xsize, size_t ysize,
@@ -950,16 +950,16 @@ void OpsinDynamicsImage(size_t xsize, size_t ysize,
950
950
cur_mixed[2 ] *= sensitivity[2 ];
951
951
double x, y, z;
952
952
RgbToXyb (cur_mixed[0 ], cur_mixed[1 ], cur_mixed[2 ], &x, &y, &z);
953
- rgb[0 ][i] = x ;
954
- rgb[1 ][i] = y ;
955
- rgb[2 ][i] = z ;
953
+ rgb[0 ][i] = static_cast < float >(x) ;
954
+ rgb[1 ][i] = static_cast < float >(y) ;
955
+ rgb[2 ][i] = static_cast < float >(z) ;
956
956
}
957
957
}
958
958
959
959
static void ScaleImage (double scale, std::vector<float > *result) {
960
960
PROFILER_FUNC;
961
961
for (size_t i = 0 ; i < result->size (); ++i) {
962
- (*result)[i] *= scale;
962
+ (*result)[i] *= static_cast < float >( scale) ;
963
963
}
964
964
}
965
965
@@ -1015,7 +1015,7 @@ void CalculateDiffmap(const size_t xsize, const size_t ysize,
1015
1015
for (size_t y = 0 ; y < ysize - s; ++y) {
1016
1016
for (size_t x = 0 ; x < xsize - s; ++x) {
1017
1017
(*diffmap)[(y + s2) * xsize + x + s2]
1018
- += mul1 * blurred[y * (xsize - s) + x];
1018
+ += static_cast < float >( mul1) * blurred[y * (xsize - s) + x];
1019
1019
}
1020
1020
}
1021
1021
ScaleImage (scale, diffmap);
@@ -1084,8 +1084,8 @@ void ButteraugliComparator::BlockDiffMap(
1084
1084
ButteraugliBlockDiff (block0, block1,
1085
1085
diff_xyb_dc, diff_xyb_ac, diff_xyb_edge_dc);
1086
1086
for (int i = 0 ; i < 3 ; ++i) {
1087
- (*block_diff_dc)[3 * res_ix + i] = diff_xyb_dc[i];
1088
- (*block_diff_ac)[3 * res_ix + i] = diff_xyb_ac[i];
1087
+ (*block_diff_dc)[3 * res_ix + i] = static_cast < float >( diff_xyb_dc[i]) ;
1088
+ (*block_diff_ac)[3 * res_ix + i] = static_cast < float >( diff_xyb_ac[i]) ;
1089
1089
}
1090
1090
}
1091
1091
}
@@ -1117,7 +1117,7 @@ void ButteraugliComparator::EdgeDetectorMap(
1117
1117
blurred0, blurred1,
1118
1118
diff_xyb);
1119
1119
for (int i = 0 ; i < 3 ; ++i) {
1120
- (*edge_detector_map)[3 * res_ix + i] = diff_xyb[i];
1120
+ (*edge_detector_map)[3 * res_ix + i] = static_cast < float >( diff_xyb[i]) ;
1121
1121
}
1122
1122
}
1123
1123
}
@@ -1173,7 +1173,7 @@ void ButteraugliComparator::EdgeDetectorLowFreq(
1173
1173
}
1174
1174
}
1175
1175
for (int i = 0 ; i < 3 ; ++i) {
1176
- (*block_diff_ac)[3 * res_ix + i] += kMul * max_diff_xyb[i];
1176
+ (*block_diff_ac)[3 * res_ix + i] += static_cast < float >( kMul * max_diff_xyb[i]) ;
1177
1177
}
1178
1178
}
1179
1179
}
@@ -1197,8 +1197,8 @@ void ButteraugliComparator::CombineChannels(
1197
1197
mask[i] = mask_xyb[i][(res_y + 3 ) * xsize_ + (res_x + 3 )];
1198
1198
dc_mask[i] = mask_xyb_dc[i][(res_y + 3 ) * xsize_ + (res_x + 3 )];
1199
1199
}
1200
- (*result)[res_ix] =
1201
- ( DotProduct (&block_diff_dc[3 * res_ix], dc_mask) +
1200
+ (*result)[res_ix] = static_cast < float >(
1201
+ DotProduct (&block_diff_dc[3 * res_ix], dc_mask) +
1202
1202
DotProduct (&block_diff_ac[3 * res_ix], mask) +
1203
1203
DotProduct (&edge_detector_map[3 * res_ix], mask));
1204
1204
}
@@ -1319,7 +1319,7 @@ void MinSquareVal(size_t square_size, size_t offset,
1319
1319
for (size_t j = minh + 1 ; j < maxh; ++j) {
1320
1320
min = fmin (min, values[x + j * xsize]);
1321
1321
}
1322
- tmp[x + y * xsize] = min;
1322
+ tmp[x + y * xsize] = static_cast < float >( min) ;
1323
1323
}
1324
1324
}
1325
1325
for (size_t x = 0 ; x < xsize; ++x) {
@@ -1330,7 +1330,7 @@ void MinSquareVal(size_t square_size, size_t offset,
1330
1330
for (size_t j = minw + 1 ; j < maxw; ++j) {
1331
1331
min = fmin (min, tmp[j + y * xsize]);
1332
1332
}
1333
- values[x + y * xsize] = min;
1333
+ values[x + y * xsize] = static_cast < float >( min) ;
1334
1334
}
1335
1335
}
1336
1336
}
@@ -1438,7 +1438,7 @@ void DiffPrecompute(
1438
1438
double sup0 = fabs (valsh0[i]) + fabs (valsv0[i]);
1439
1439
double sup1 = fabs (valsh1[i]) + fabs (valsv1[i]);
1440
1440
double m = std::min (sup0, sup1);
1441
- (*mask)[i][ix] = m ;
1441
+ (*mask)[i][ix] = static_cast < float >(m) ;
1442
1442
}
1443
1443
}
1444
1444
}
@@ -1483,12 +1483,12 @@ void Mask(const std::vector<std::vector<float> > &xyb0,
1483
1483
const double p1 = w11 * s1;
1484
1484
const double p2 = w22 * s2;
1485
1485
1486
- (*mask)[0 ][idx] = MaskX (p0);
1487
- (*mask)[1 ][idx] = MaskY (p1);
1488
- (*mask)[2 ][idx] = MaskB (p2);
1489
- (*mask_dc)[0 ][idx] = MaskDcX (p0);
1490
- (*mask_dc)[1 ][idx] = MaskDcY (p1);
1491
- (*mask_dc)[2 ][idx] = MaskDcB (p2);
1486
+ (*mask)[0 ][idx] = static_cast < float >( MaskX (p0) );
1487
+ (*mask)[1 ][idx] = static_cast < float >( MaskY (p1) );
1488
+ (*mask)[2 ][idx] = static_cast < float >( MaskB (p2) );
1489
+ (*mask_dc)[0 ][idx] = static_cast < float >( MaskDcX (p0) );
1490
+ (*mask_dc)[1 ][idx] = static_cast < float >( MaskDcY (p1) );
1491
+ (*mask_dc)[2 ][idx] = static_cast < float >( MaskDcB (p2) );
1492
1492
}
1493
1493
}
1494
1494
for (int i = 0 ; i < 3 ; ++i) {
0 commit comments