float pos2 = src[i + 1].pos;
assert(pos2 > pos1);
- fp16_int_t pos, total_weight;
+ DestFloat pos, total_weight;
float sum_sq_error;
combine_two_samples(w1, w2, pos1, pos2, num_subtexels, inv_num_subtexels, &pos, &total_weight, &sum_sq_error);
for (unsigned i = 0; i < num; ++i) {
sum += to_fp64(vals[i].weight);
}
+ double inv_sum = 1.0 / sum;
for (unsigned i = 0; i < num; ++i) {
- vals[i].weight = from_fp64<T>(to_fp64(vals[i].weight) / sum);
+ vals[i].weight = from_fp64<T>(to_fp64(vals[i].weight) * inv_sum);
}
}
}