diff options
author | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 05:56:23 +0000 |
---|---|---|
committer | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 05:56:23 +0000 |
commit | 6b03d096dcd02e19a651b636536bcda5e3ad1d62 (patch) | |
tree | 333da88c962716c5d3e430ccbea7930fdd4ddf34 /libavcodec/vorbis_enc.c | |
parent | 1b34d5737d16c31586c3c301889a58a3a5a7f8ec (diff) | |
download | ffmpeg-6b03d096dcd02e19a651b636536bcda5e3ad1d62.tar.gz |
Original Commit: r38 | ods15 | 2006-09-23 09:02:34 +0300 (Sat, 23 Sep 2006) | 2 lines
buffer related struct variables
Originally committed as revision 6446 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vorbis_enc.c')
-rw-r--r-- | libavcodec/vorbis_enc.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index c92176d876..d38c87f073 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -24,6 +24,11 @@ #include "avcodec.h" +#define BITSTREAM_H // don't include this +typedef int VLC; +typedef int GetBitContext; +#include "vorbis.h" + #undef NDEBUG #include <assert.h> @@ -91,6 +96,12 @@ typedef struct { int channels; int sample_rate; int blocksize[2]; // in (1<<n) format + MDCTContext mdct[2]; + const float * win[2]; + float * saved; + float * samples; + float * floor; // also used for tmp values for mdct + float * coeffs; // also used for residue after floor int ncodebooks; codebook_t * codebooks; @@ -327,6 +338,20 @@ static void create_vorbis_context(venc_context_t * venc, AVCodecContext * avccon // single mode venc->modes[0].blockflag = 0; venc->modes[0].mapping = 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); + + { + const float *vwin[8]={ vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 }; + venc->win[0] = vwin[venc->blocksize[0] - 6]; + venc->win[1] = vwin[venc->blocksize[1] - 6]; + } + + ff_mdct_init(&venc->mdct[0], venc->blocksize[0], 0); + ff_mdct_init(&venc->mdct[1], venc->blocksize[1], 0); } static inline int ilog(unsigned int a) { @@ -669,6 +694,14 @@ static int vorbis_encode_close(AVCodecContext * avccontext) av_freep(&venc->modes); + av_freep(&venc->saved); + av_freep(&venc->samples); + av_freep(&venc->floor); + av_freep(&venc->coeffs); + + ff_mdct_end(&venc->mdct[0]); + ff_mdct_end(&venc->mdct[1]); + av_freep(&avccontext->coded_frame); av_freep(&avccontext->extradata); |