[Flac-dev] Re: 0.9 problems
Matt Zimmerman
mdz at debian.org
Sat May 19 16:32:34 PDT 2001
On Sat, May 19, 2001 at 06:42:22PM -0400, Matt Zimmerman wrote:
> I think this could be fixed by changing the (data_len > 0) test to be
> (data_len > 0 && total_error_X > 0).
Yes, this appears to have worked. I can now correctly encode and decode both
my 8kHz/8-bit/mono sample, and a 44.1kHz/16-bit/stereo sample on Debian/alpha.
Attached is a patch which combines this fix with my earlier patch.
--
- mdz
-------------- next part --------------
--- fixed.c.orig Sat May 19 18:28:08 2001
+++ fixed.c Sat May 19 18:26:50 2001
@@ -81,11 +81,11 @@
residual_bits_per_sample[3] = (real)((data_len > 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) ? log(M_LN2 * (real)(int64)total_error_4 / (real) data_len) / M_LN2 : 0.0);
#else
- residual_bits_per_sample[0] = (real)((data_len > 0) ? log(M_LN2 * (real)total_error_0 / (real) data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[1] = (real)((data_len > 0) ? log(M_LN2 * (real)total_error_1 / (real) data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[2] = (real)((data_len > 0) ? log(M_LN2 * (real)total_error_2 / (real) data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[3] = (real)((data_len > 0) ? log(M_LN2 * (real)total_error_3 / (real) data_len) / M_LN2 : 0.0);
- residual_bits_per_sample[4] = (real)((data_len > 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 * (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);
#endif
return order;
@@ -152,7 +152,7 @@
void FLAC__fixed_compute_residual(const int32 data[], unsigned data_len, unsigned order, int32 residual[])
{
- unsigned i;
+ int i;
switch(order) {
case 0:
@@ -190,7 +190,7 @@
void FLAC__fixed_restore_signal(const int32 residual[], unsigned data_len, unsigned order, int32 data[])
{
- unsigned i;
+ int i;
switch(order) {
case 0:
More information about the Flac-dev
mailing list