Commit 9ad39e35 authored by ods15's avatar ods15

Original Commit: r14 | ods15 | 2006-09-22 12:26:17 +0300 (Fri, 22 Sep 2006) | 2 lines

use several codebooks and passes to prevent header from being several MB...

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@6425 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent c30739a2
...@@ -164,13 +164,13 @@ static void ready_codebook(codebook_t * cb) { ...@@ -164,13 +164,13 @@ static void ready_codebook(codebook_t * cb) {
static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) { static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) {
codebook_t * cb; codebook_t * cb;
int i; int i, book;
venc->channels = avccontext->channels; venc->channels = avccontext->channels;
venc->sample_rate = avccontext->sample_rate; venc->sample_rate = avccontext->sample_rate;
venc->blocksize[0] = venc->blocksize[1] = 8; venc->blocksize[0] = venc->blocksize[1] = 8;
venc->ncodebooks = 3; venc->ncodebooks = 10;
venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks); venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks);
// codebook 1 - floor1 book, values 0..255 // codebook 1 - floor1 book, values 0..255
...@@ -199,19 +199,21 @@ static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccon ...@@ -199,19 +199,21 @@ static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccon
cb->quantlist = NULL; cb->quantlist = NULL;
ready_codebook(cb); ready_codebook(cb);
// codebook 3 - vector, for the residue, dimentions 1. values -32768..32767 // codebook 3..10 - vector, for the residue, values -32767..32767, dimentions 1
cb = &venc->codebooks[2]; for (book = 0; book < 8; book++) {
cb->nentries = 32767 - (-32768); cb = &venc->codebooks[2 + book];
cb->entries = av_malloc(sizeof(cb_entry_t) * cb->nentries); cb->nentries = 5;
for (i = 0; i < cb->nentries; i++) cb->entries[i].len = 16; cb->entries = av_malloc(sizeof(cb_entry_t) * cb->nentries);
cb->ndimentions = 1; for (i = 0; i < cb->nentries; i++) cb->entries[i].len = i == 2 ? 1 : 3;
cb->min = -32768.; cb->ndimentions = 1;
cb->delta = 1.; cb->delta = 1 << ((7 - book) * 2);
cb->seq_p = 0; cb->min = -cb->delta*2;
cb->lookup = 2; cb->seq_p = 0;
cb->quantlist = av_malloc(sizeof(int) * cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries)); cb->lookup = 2;
for (i = 0; i < cb->nentries; i++) cb->quantlist[i] = i; cb->quantlist = av_malloc(sizeof(int) * cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries));
ready_codebook(cb); for (i = 0; i < cb->nentries; i++) cb->quantlist[i] = i;
ready_codebook(cb);
}
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment