[Flac-dev] 0.9 problems

Matt Zimmerman mdz at debian.org
Sat May 19 01:11:02 PDT 2001


On Sat, May 19, 2001 at 01:37:13AM -0400, Matt Zimmerman wrote:

> It's not obvious at first glance where the fault is being triggered; residual
> and data both appear valid.

Aha.  In FLAC__fixed_restore_signal, the index variable 'i' is declared
unsigned, then used like so:

                        for(i = 0; i < data_len; i++) {
                                /* == residual[i] + 2*data[i-1] - data[i-2] */
                                data[i] = residual[i] + (data[i-1]<<1) - data[i-
2];
                        }

For some reason, gdb doesn't notice this when I ask it to evaluate data[i-1]
and data[i-2].  The encoding problem is the same thing, in
FLAC__fixed_compute_residual.  With the following trivial patch applied,
everything works on Alpha, at least with my test sample.  I don't know how this
managed to work before on i386.

--- fixed.c.orig        Sat May 19 03:08:36 2001
+++ fixed.c     Sat May 19 03:08:54 2001
@@ -152,7 +152,7 @@
 
 void FLAC__fixed_compute_residual(const int32 data[], unsigned data_len, unsign
ed 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, unsi
gned order, int32 data[])
 {
-       unsigned i;
+       int i;
 
        switch(order) {
                case 0:

-- 
 - mdz





More information about the Flac-dev mailing list