diff options
author | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 06:08:19 +0000 |
---|---|---|
committer | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 06:08:19 +0000 |
commit | a277ad842e149c4b8afa02b746db554fb6128893 (patch) | |
tree | 2e34920961a112b685ff8e4ba37c999269ec6a78 /libavcodec/vorbis_enc.c | |
parent | 899124aa389bef235872a7fcfe7c94dab57365f2 (diff) | |
download | ffmpeg-streaming-a277ad842e149c4b8afa02b746db554fb6128893.zip ffmpeg-streaming-a277ad842e149c4b8afa02b746db554fb6128893.tar.gz |
Original Commit: r74 | ods15 | 2006-09-29 13:03:31 +0300 (Fri, 29 Sep 2006) | 2 lines
support multiple codebooks for floor
Originally committed as revision 6479 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vorbis_enc.c')
-rw-r--r-- | libavcodec/vorbis_enc.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index fc7aac7..09855da 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -753,11 +753,29 @@ static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb counter = 2; for (i = 0; i < fc->partitions; i++) { floor_class_t * c = &fc->classes[fc->partition_to_class[i]]; - codebook_t * book = &venc->codebooks[c->books[0]]; - int k; - assert(!c->subclass); + int k, cval = 0, csub = 1<<c->subclass; + if (c->subclass) { + codebook_t * book = &venc->codebooks[c->masterbook]; + int cshift = 0; + for (k = 0; k < c->dim; k++) { + int l; + for (l = 0; l < csub; l++) { + int maxval = 1; + if (c->books[l] != -1) maxval = venc->codebooks[c->books[l]].nentries; + // coded could be -1, but this still works, cause thats 0 + if (coded[counter + k] < maxval) break; + } + assert(l != csub); + cval |= l << cshift; + cshift += c->subclass; + } + assert(cval < book->nentries); + 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 entry = coded[counter++]; + cval >>= c->subclass; if (entry == -1) entry = 0; assert(entry < book->nentries); assert(entry >= 0); |