changeset 3877:00623377043e libavcodec

Original Commit: r77 | ods15 | 2006-09-29 15:12:56 +0300 (Fri, 29 Sep 2006) | 2 lines fix for book==-1 in floor
author ods15
date Mon, 02 Oct 2006 06:08:25 +0000
parents cd4236d3d477
children 30de59a39f6e
files vorbis_enc.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/vorbis_enc.c	Mon Oct 02 06:08:23 2006 +0000
+++ b/vorbis_enc.c	Mon Oct 02 06:08:25 2006 +0000
@@ -773,13 +773,14 @@
             put_bits(pb, book->entries[cval].len, book->entries[cval].codeword);
         }
         for (k = 0; k < c->dim; k++) {
-            codebook_t * book = &venc->codebooks[c->books[cval & (csub-1)]];
+            int book = c->books[cval & (csub-1)];
             int entry = coded[counter++];
             cval >>= c->subclass;
+            if (book == -1) continue;
             if (entry == -1) entry = 0;
-            assert(entry < book->nentries);
+            assert(entry < venc->codebooks[book].nentries);
             assert(entry >= 0);
-            put_bits(pb, book->entries[entry].len, book->entries[entry].codeword);
+            put_bits(pb, venc->codebooks[book].entries[entry].len, venc->codebooks[book].entries[entry].codeword);
         }
     }