aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYinhang Liu <yinhangx.liu@intel.com>2019-03-06 10:53:10 +0800
committerZong Wei <wei.zong@intel.com>2019-03-27 15:01:23 +0800
commitd6d8bbfa73f47e3bc274f7c7671cac4647d26c62 (patch)
treea07413cc448081ec626f2b91325245878d1e6b17
parent71d3c3c5c650e8163c183858001bc86f572d9064 (diff)
downloadlibxcam-d6d8bbfa73f47e3bc274f7c7671cac4647d26c62.tar.gz
xcam-utils: remove unnecessary explicit type conversions
-rw-r--r--xcore/xcam_utils.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/xcore/xcam_utils.cpp b/xcore/xcam_utils.cpp
index 4fb5b36..246be93 100644
--- a/xcore/xcam_utils.cpp
+++ b/xcore/xcam_utils.cpp
@@ -95,10 +95,10 @@ PointFloat3 bowl_view_image_to_world (
float b = config.b;
float c = config.c;
- float wall_image_height = config.wall_height / (float)(config.wall_height + config.ground_length) * (float)img_height;
- float ground_image_height = (float)img_height - wall_image_height;
+ float wall_image_height = config.wall_height / (config.wall_height + config.ground_length) * img_height;
+ float ground_image_height = img_height - wall_image_height;
- float z_step = (float)config.wall_height / wall_image_height;
+ float z_step = config.wall_height / wall_image_height;
float angle_step = fabs(config.angle_end - config.angle_start) / img_width;
if(img_pos.y < wall_image_height) {
@@ -124,7 +124,6 @@ PointFloat3 bowl_view_image_to_world (
b = b * sqrt(1 - config.center_z * config.center_z / (c * c));
float ratio_ab = b / a;
-
float step_b = config.ground_length / ground_image_height;
b = b - (img_pos.y - wall_image_height) * step_b;
@@ -193,13 +192,13 @@ linear_interpolate_p2 (
if (dist_start == 0) {
weight_start = 10000000.0;
} else {
- weight_start = ((double)dist_sum / dist_start);
+ weight_start = (dist_sum / dist_start);
}
if (dist_end == 0) {
weight_end = 10000000.0;
} else {
- weight_end = ((double)dist_sum / dist_end);
+ weight_end = (dist_sum / dist_end);
}
value = (value_start * weight_start + value_end * weight_end) / (weight_start + weight_end);
@@ -227,36 +226,35 @@ linear_interpolate_p4(
double dist_sum = 0;
double value = 0;
- dist_lt = (double)abs(ref_curr_x - ref_lt_x) + (double)abs(ref_curr_y - ref_lt_y);
- dist_rt = (double)abs(ref_curr_x - ref_rt_x) + (double)abs(ref_curr_y - ref_rt_y);
- dist_lb = (double)abs(ref_curr_x - ref_lb_x) + (double)abs(ref_curr_y - ref_lb_y);
- dist_rb = (double)abs(ref_curr_x - ref_rb_x) + (double)abs(ref_curr_y - ref_rb_y);
+ dist_lt = abs(ref_curr_x - ref_lt_x) + abs(ref_curr_y - ref_lt_y);
+ dist_rt = abs(ref_curr_x - ref_rt_x) + abs(ref_curr_y - ref_rt_y);
+ dist_lb = abs(ref_curr_x - ref_lb_x) + abs(ref_curr_y - ref_lb_y);
+ dist_rb = abs(ref_curr_x - ref_rb_x) + abs(ref_curr_y - ref_rb_y);
dist_sum = dist_lt + dist_rt + dist_lb + dist_rb;
if (dist_lt == 0) {
weight_lt = 10000000.0;
} else {
- weight_lt = ((float)dist_sum / dist_lt);
+ weight_lt = (dist_sum / dist_lt);
}
if (dist_rt == 0) {
weight_rt = 10000000.0;
} else {
- weight_rt = ((float)dist_sum / dist_rt);
+ weight_rt = (dist_sum / dist_rt);
}
if (dist_lb == 0) {
weight_lb = 10000000.0;
} else {
- weight_lb = ((float)dist_sum / dist_lb);
+ weight_lb = (dist_sum / dist_lb);
}
if (dist_rb == 0) {
weight_rb = 10000000.0;
} else {
- weight_rb = ((float)dist_sum / dist_rt);
+ weight_rb = (dist_sum / dist_rt);
}
- value = (double)floor ( (value_lt * weight_lt + value_rt * weight_rt +
- value_lb * weight_lb + value_rb * weight_rb) /
- (weight_lt + weight_rt + weight_lb + weight_rb) + 0.5 );
+ value = floor ((value_lt * weight_lt + value_rt * weight_rt + value_lb * weight_lb + value_rb * weight_rb) /
+ (weight_lt + weight_rt + weight_lb + weight_rb) + 0.5);
return value;
}
@@ -272,7 +270,7 @@ get_gauss_table (uint32_t radius, float sigma, std::vector<float> &table, bool n
table[radius] = 1.0f;
for (i = 0; i < radius; i++) {
- dis = ((float)i - radius) * ((float)i - radius);
+ dis = (i - radius) * (i - radius);
table[i] = table[scale - i - 1] = exp(-dis / (2.0f * sigma * sigma));
sum += table[i] * 2.0f;
}