minor FP tweaks
This commit is contained in:
parent
b6b25b677a
commit
f966ef70fc
@ -65,11 +65,11 @@ unsigned FLAC__fixed_compute_best_predictor(const int32 data[], unsigned data_le
|
||||
else
|
||||
order = 4;
|
||||
|
||||
residual_bits_per_sample[0] = (real)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (real)total_error_0 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (real)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (real)total_error_1 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (real)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (real)total_error_2 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (real)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (real)total_error_3 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (real)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (real)total_error_4 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[0] = (real)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (real)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (real)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (real)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (real)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double) data_len) / M_LN2 : 0.0);
|
||||
|
||||
return order;
|
||||
}
|
||||
@ -112,17 +112,17 @@ unsigned FLAC__fixed_compute_best_predictor_slow(const int32 data[], unsigned da
|
||||
/* signal, so we use it directly to compute E(|x|) */
|
||||
#ifdef _MSC_VER
|
||||
/* with VC++ you have to spoon feed it the casting */
|
||||
residual_bits_per_sample[0] = (real)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (real)(int64)total_error_0 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (real)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (real)(int64)total_error_1 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (real)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (real)(int64)total_error_2 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (real)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (real)(int64)total_error_3 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (real)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (real)(int64)total_error_4 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[0] = (real)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (double)(int64)total_error_0 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (real)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (double)(int64)total_error_1 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (real)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (double)(int64)total_error_2 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (real)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (double)(int64)total_error_3 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (real)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (double)(int64)total_error_4 / (double) data_len) / M_LN2 : 0.0);
|
||||
#else
|
||||
residual_bits_per_sample[0] = (real)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (real)total_error_0 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (real)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (real)total_error_1 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (real)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (real)total_error_2 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (real)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (real)total_error_3 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (real)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (real)total_error_4 / (real) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[0] = (real)((data_len > 0 && total_error_0 > 0) ? log(M_LN2 * (double)total_error_0 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[1] = (real)((data_len > 0 && total_error_1 > 0) ? log(M_LN2 * (double)total_error_1 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[2] = (real)((data_len > 0 && total_error_2 > 0) ? log(M_LN2 * (double)total_error_2 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[3] = (real)((data_len > 0 && total_error_3 > 0) ? log(M_LN2 * (double)total_error_3 / (double) data_len) / M_LN2 : 0.0);
|
||||
residual_bits_per_sample[4] = (real)((data_len > 0 && total_error_4 > 0) ? log(M_LN2 * (double)total_error_4 / (double) data_len) / M_LN2 : 0.0);
|
||||
#endif
|
||||
|
||||
return order;
|
||||
|
@ -112,7 +112,7 @@ void FLAC__lpc_compute_lp_coefficients(const real autoc[], unsigned max_order, r
|
||||
int FLAC__lpc_quantize_coefficients(const real lp_coeff[], unsigned order, unsigned precision, unsigned bits_per_sample, int32 qlp_coeff[], int *shift)
|
||||
{
|
||||
unsigned i;
|
||||
real d, cmax = -1e10;
|
||||
real d, cmax = -1e32;
|
||||
|
||||
FLAC__ASSERT(bits_per_sample > 0);
|
||||
FLAC__ASSERT(bits_per_sample <= sizeof(int32)*8);
|
||||
@ -262,7 +262,7 @@ real FLAC__lpc_compute_expected_bits_per_residual_sample(real lpc_error, unsigne
|
||||
return 0.0;
|
||||
}
|
||||
else if(lpc_error < 0.0) { /* error should not be negative but can happen due to inadequate float resolution */
|
||||
return 1e10;
|
||||
return 1e32;
|
||||
}
|
||||
else {
|
||||
return 0.0;
|
||||
@ -279,7 +279,7 @@ real FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(real l
|
||||
return 0.0;
|
||||
}
|
||||
else if(lpc_error < 0.0) { /* error should not be negative but can happen due to inadequate float resolution */
|
||||
return 1e10;
|
||||
return 1e32;
|
||||
}
|
||||
else {
|
||||
return 0.0;
|
||||
|
Loading…
Reference in New Issue
Block a user