Correct a number of uninitialized value problems when end!=nbEBands. Now 8khz/20ms...
authorGregory Maxwell <greg@xiph.org>
Mon, 14 Feb 2011 20:27:52 +0000 (15:27 -0500)
committerJean-Marc Valin <jean-marc.valin@octasic.com>
Mon, 14 Feb 2011 20:44:31 +0000 (15:44 -0500)
libcelt/bands.c
libcelt/quant_bands.c

index 1c8fe25..1948bae 100644 (file)
@@ -202,7 +202,7 @@ void denormalise_bands(const CELTMode *m, const celt_norm * restrict X, celt_sig
             x++;
          } while (++j<band_end);
       }
             x++;
          } while (++j<band_end);
       }
-      for (i=M*eBands[m->nbEBands];i<N;i++)
+      for (i=M*eBands[end];i<N;i++)
          *f++ = 0;
    } while (++c<C);
 }
          *f++ = 0;
    } while (++c<C);
 }
index 1de7d67..9aa05fe 100644 (file)
@@ -272,7 +272,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
    int badness1=0;
    SAVE_STACK;
 
    int badness1=0;
    SAVE_STACK;
 
-   intra = force_intra || (*delayedIntra && nbAvailableBytes > end*C);
+   intra = force_intra || (*delayedIntra && nbAvailableBytes > (end-start)*C);
    if (/*shortBlocks || */intra_decision(eBands, oldEBands, start, effEnd, m->nbEBands, C))
       *delayedIntra = 1;
    else
    if (/*shortBlocks || */intra_decision(eBands, oldEBands, start, effEnd, m->nbEBands, C))
       *delayedIntra = 1;
    else
@@ -295,7 +295,7 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
 
    ALLOC(oldEBands_intra, C*m->nbEBands, celt_word16);
    ALLOC(error_intra, C*m->nbEBands, celt_word16);
 
    ALLOC(oldEBands_intra, C*m->nbEBands, celt_word16);
    ALLOC(error_intra, C*m->nbEBands, celt_word16);
-   CELT_COPY(oldEBands_intra, oldEBands, C*end);
+   CELT_COPY(oldEBands_intra, oldEBands, C*m->nbEBands);
 
    if (two_pass || intra)
    {
 
    if (two_pass || intra)
    {
@@ -335,12 +335,12 @@ void quant_coarse_energy(const CELTMode *m, int start, int end, int effEnd,
          /* Copy intra bits to bit-stream */
          CELT_COPY(ec_get_buffer(&enc_intra_state) + nstart_bytes,
                intra_bits, nintra_bytes - nstart_bytes);
          /* Copy intra bits to bit-stream */
          CELT_COPY(ec_get_buffer(&enc_intra_state) + nstart_bytes,
                intra_bits, nintra_bytes - nstart_bytes);
-         CELT_COPY(oldEBands, oldEBands_intra, C*end);
-         CELT_COPY(error, error_intra, C*end);
+         CELT_COPY(oldEBands, oldEBands_intra, C*m->nbEBands);
+         CELT_COPY(error, error_intra, C*m->nbEBands);
       }
    } else {
       }
    } else {
-      CELT_COPY(oldEBands, oldEBands_intra, C*end);
-      CELT_COPY(error, error_intra, C*end);
+      CELT_COPY(oldEBands, oldEBands_intra, C*m->nbEBands);
+      CELT_COPY(error, error_intra, C*m->nbEBands);
    }
    RESTORE_STACK;
 }
    }
    RESTORE_STACK;
 }