[Ffmpeg-cvslog] r6425 - trunk/libavcodec/vorbis_enc.c

ods15 subversion
Mon Oct 2 07:55:38 CEST 2006


Author: ods15
Date: Mon Oct  2 07:55:37 2006
New Revision: 6425

Modified:
   trunk/libavcodec/vorbis_enc.c

Log:
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...

Modified: trunk/libavcodec/vorbis_enc.c
==============================================================================
--- trunk/libavcodec/vorbis_enc.c	(original)
+++ trunk/libavcodec/vorbis_enc.c	Mon Oct  2 07:55:37 2006
@@ -164,13 +164,13 @@
 
 static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccontext) {
     codebook_t * cb;
-    int i;
+    int i, book;
 
     venc->channels = avccontext->channels;
     venc->sample_rate = avccontext->sample_rate;
     venc->blocksize[0] = venc->blocksize[1] = 8;
 
-    venc->ncodebooks = 3;
+    venc->ncodebooks = 10;
     venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks);
 
     // codebook 1 - floor1 book, values 0..255
@@ -199,19 +199,21 @@
     cb->quantlist = NULL;
     ready_codebook(cb);
 
-    // codebook 3 - vector, for the residue, dimentions 1. values -32768..32767
-    cb = &venc->codebooks[2];
-    cb->nentries = 32767 - (-32768);
-    cb->entries = av_malloc(sizeof(cb_entry_t) * cb->nentries);
-    for (i = 0; i < cb->nentries; i++) cb->entries[i].len = 16;
-    cb->ndimentions = 1;
-    cb->min = -32768.;
-    cb->delta = 1.;
-    cb->seq_p = 0;
-    cb->lookup = 2;
-    cb->quantlist = av_malloc(sizeof(int) * cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries));
-    for (i = 0; i < cb->nentries; i++) cb->quantlist[i] = i;
-    ready_codebook(cb);
+    // codebook 3..10 - vector, for the residue, values -32767..32767, dimentions 1
+    for (book = 0; book < 8; book++) {
+        cb = &venc->codebooks[2 + book];
+        cb->nentries = 5;
+        cb->entries = av_malloc(sizeof(cb_entry_t) * cb->nentries);
+        for (i = 0; i < cb->nentries; i++) cb->entries[i].len = i == 2 ? 1 : 3;
+        cb->ndimentions = 1;
+        cb->delta = 1 << ((7 - book) * 2);
+        cb->min = -cb->delta*2;
+        cb->seq_p = 0;
+        cb->lookup = 2;
+        cb->quantlist = av_malloc(sizeof(int) * cb_lookup_vals(cb->lookup, cb->ndimentions, cb->nentries));
+        for (i = 0; i < cb->nentries; i++) cb->quantlist[i] = i;
+        ready_codebook(cb);
+    }
 
 }
 




More information about the ffmpeg-cvslog mailing list