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

ods15 subversion
Mon Oct 2 08:09:53 CEST 2006


Author: ods15
Date: Mon Oct  2 08:09:52 2006
New Revision: 6518

Modified:
   trunk/libavcodec/vorbis_enc.c

Log:
Original Commit: r114 | ods15 | 2006-10-01 21:38:37 +0200 (Sun, 01 Oct 2006) | 2 lines

blocksize -> log2_blocksize

Modified: trunk/libavcodec/vorbis_enc.c
==============================================================================
--- trunk/libavcodec/vorbis_enc.c	(original)
+++ trunk/libavcodec/vorbis_enc.c	Mon Oct  2 08:09:52 2006
@@ -91,7 +91,7 @@
 typedef struct {
     int channels;
     int sample_rate;
-    int blocksize[2]; // in (1<<n) format
+    int log2_blocksize[2];
     MDCTContext mdct[2];
     const float * win[2];
     int have_saved;
@@ -722,7 +722,7 @@
 
     venc->channels = avccontext->channels;
     venc->sample_rate = avccontext->sample_rate;
-    venc->blocksize[0] = venc->blocksize[1] = 11;
+    venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11;
 
     venc->ncodebooks = sizeof(cvectors)/sizeof(cvectors[0]);
     venc->codebooks = av_malloc(sizeof(codebook_t) * venc->ncodebooks);
@@ -781,7 +781,7 @@
         for (j = 0; j < books; j++) c->books[j] = floor_classes[i].nbooks[j];
     }
     fc->multiplier = 2;
-    fc->rangebits = venc->blocksize[0] - 1;
+    fc->rangebits = venc->log2_blocksize[0] - 1;
 
     fc->values = 2;
     for (i = 0; i < fc->partitions; i++)
@@ -859,16 +859,16 @@
     venc->modes[0].mapping = 0;
 
     venc->have_saved = 0;
-    venc->saved = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
-    venc->samples = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]));
-    venc->floor = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
-    venc->coeffs = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2);
+    venc->saved = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]) / 2);
+    venc->samples = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]));
+    venc->floor = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]) / 2);
+    venc->coeffs = av_malloc(sizeof(float) * venc->channels * (1 << venc->log2_blocksize[1]) / 2);
 
-    venc->win[0] = ff_vorbis_vwin[venc->blocksize[0] - 6];
-    venc->win[1] = ff_vorbis_vwin[venc->blocksize[1] - 6];
+    venc->win[0] = ff_vorbis_vwin[venc->log2_blocksize[0] - 6];
+    venc->win[1] = ff_vorbis_vwin[venc->log2_blocksize[1] - 6];
 
-    ff_mdct_init(&venc->mdct[0], venc->blocksize[0], 0);
-    ff_mdct_init(&venc->mdct[1], venc->blocksize[1], 0);
+    ff_mdct_init(&venc->mdct[0], venc->log2_blocksize[0], 0);
+    ff_mdct_init(&venc->mdct[1], venc->log2_blocksize[1], 0);
 }
 
 static void put_float(PutBitContext * pb, float f) {
@@ -1007,8 +1007,8 @@
     put_bits(&pb, 32, 0); // bitrate
     put_bits(&pb, 32, 0); // bitrate
     put_bits(&pb, 32, 0); // bitrate
-    put_bits(&pb, 4, venc->blocksize[0]);
-    put_bits(&pb, 4, venc->blocksize[1]);
+    put_bits(&pb, 4, venc->log2_blocksize[0]);
+    put_bits(&pb, 4, venc->log2_blocksize[1]);
     put_bits(&pb, 1, 1); // framing
 
     flush_put_bits(&pb);
@@ -1311,8 +1311,8 @@
 static int apply_window_and_mdct(venc_context_t * venc, signed short * audio, int samples) {
     int i, j, channel;
     const float * win = venc->win[0];
-    int window_len = 1 << (venc->blocksize[0] - 1);
-    float n = (float)(1 << venc->blocksize[0]) / 4.;
+    int window_len = 1 << (venc->log2_blocksize[0] - 1);
+    float n = (float)(1 << venc->log2_blocksize[0]) / 4.;
     // FIXME use dsp
 
     if (!venc->have_saved && !samples) return 0;
@@ -1375,7 +1375,7 @@
 
     avccontext->extradata_size = put_main_header(venc, (uint8_t**)&avccontext->extradata);
 
-    avccontext->frame_size = 1 << (venc->blocksize[0] - 1);
+    avccontext->frame_size = 1 << (venc->log2_blocksize[0] - 1);
 
     avccontext->coded_frame = avcodec_alloc_frame();
     avccontext->coded_frame->key_frame = 1;
@@ -1394,7 +1394,7 @@
     int i;
 
     if (!apply_window_and_mdct(venc, audio, samples)) return 0;
-    samples = 1 << (venc->blocksize[0] - 1);
+    samples = 1 << (venc->log2_blocksize[0] - 1);
 
     init_put_bits(&pb, packets, buf_size);
 




More information about the ffmpeg-cvslog mailing list