Mercurial > libavcodec.hg
comparison vorbis_enc.c @ 3841:6591b55f6482 libavcodec
Original Commit: r38 | ods15 | 2006-09-23 09:02:34 +0300 (Sat, 23 Sep 2006) | 2 lines
buffer related struct variables
author | ods15 |
---|---|
date | Mon, 02 Oct 2006 05:56:23 +0000 |
parents | bb414feb6a0d |
children | 5f8cfa1a6fdb |
comparison
equal
deleted
inserted
replaced
3840:bb414feb6a0d | 3841:6591b55f6482 |
---|---|
22 * @author Oded Shimon <ods15@ods15.dyndns.org> | 22 * @author Oded Shimon <ods15@ods15.dyndns.org> |
23 */ | 23 */ |
24 | 24 |
25 #include "avcodec.h" | 25 #include "avcodec.h" |
26 | 26 |
27 #define BITSTREAM_H // don't include this | |
28 typedef int VLC; | |
29 typedef int GetBitContext; | |
30 #include "vorbis.h" | |
31 | |
27 #undef NDEBUG | 32 #undef NDEBUG |
28 #include <assert.h> | 33 #include <assert.h> |
29 | 34 |
30 //#define ALT_BITSTREAM_WRITER | 35 //#define ALT_BITSTREAM_WRITER |
31 //#include "bitstream.h" | 36 //#include "bitstream.h" |
89 | 94 |
90 typedef struct { | 95 typedef struct { |
91 int channels; | 96 int channels; |
92 int sample_rate; | 97 int sample_rate; |
93 int blocksize[2]; // in (1<<n) format | 98 int blocksize[2]; // in (1<<n) format |
99 MDCTContext mdct[2]; | |
100 const float * win[2]; | |
101 float * saved; | |
102 float * samples; | |
103 float * floor; // also used for tmp values for mdct | |
104 float * coeffs; // also used for residue after floor | |
94 | 105 |
95 int ncodebooks; | 106 int ncodebooks; |
96 codebook_t * codebooks; | 107 codebook_t * codebooks; |
97 | 108 |
98 int nfloors; | 109 int nfloors; |
325 venc->modes = av_malloc(sizeof(vorbis_mode_t) * venc->nmodes); | 336 venc->modes = av_malloc(sizeof(vorbis_mode_t) * venc->nmodes); |
326 | 337 |
327 // single mode | 338 // single mode |
328 venc->modes[0].blockflag = 0; | 339 venc->modes[0].blockflag = 0; |
329 venc->modes[0].mapping = 0; | 340 venc->modes[0].mapping = 0; |
341 | |
342 venc->saved = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2); | |
343 venc->samples = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1])); | |
344 venc->floor = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2); | |
345 venc->coeffs = av_malloc(sizeof(float) * venc->channels * (1 << venc->blocksize[1]) / 2); | |
346 | |
347 { | |
348 const float *vwin[8]={ vwin64, vwin128, vwin256, vwin512, vwin1024, vwin2048, vwin4096, vwin8192 }; | |
349 venc->win[0] = vwin[venc->blocksize[0] - 6]; | |
350 venc->win[1] = vwin[venc->blocksize[1] - 6]; | |
351 } | |
352 | |
353 ff_mdct_init(&venc->mdct[0], venc->blocksize[0], 0); | |
354 ff_mdct_init(&venc->mdct[1], venc->blocksize[1], 0); | |
330 } | 355 } |
331 | 356 |
332 static inline int ilog(unsigned int a) { | 357 static inline int ilog(unsigned int a) { |
333 int i; | 358 int i; |
334 for (i = 0; a >> i; i++); | 359 for (i = 0; a >> i; i++); |
667 } | 692 } |
668 av_freep(&venc->mappings); | 693 av_freep(&venc->mappings); |
669 | 694 |
670 av_freep(&venc->modes); | 695 av_freep(&venc->modes); |
671 | 696 |
697 av_freep(&venc->saved); | |
698 av_freep(&venc->samples); | |
699 av_freep(&venc->floor); | |
700 av_freep(&venc->coeffs); | |
701 | |
702 ff_mdct_end(&venc->mdct[0]); | |
703 ff_mdct_end(&venc->mdct[1]); | |
704 | |
672 av_freep(&avccontext->coded_frame); | 705 av_freep(&avccontext->coded_frame); |
673 av_freep(&avccontext->extradata); | 706 av_freep(&avccontext->extradata); |
674 | 707 |
675 return 0 ; | 708 return 0 ; |
676 } | 709 } |