diff options
author | Mans Rullgard <mans@mansr.com> | 2011-03-13 16:22:07 +0000 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2011-03-30 00:38:45 +0100 |
commit | 6f718471eaae9d25c4fd2dd8d8defa412e2d041c (patch) | |
tree | 70358ae1f2dede7ac601d7893f182682ac5e3eff | |
parent | e0be794a71be25a350f68287ee291b4942bcb7d8 (diff) | |
download | ffmpeg-6f718471eaae9d25c4fd2dd8d8defa412e2d041c.tar.gz |
ac3enc: move mant*_cnt and qmant*_ptr out of AC3EncodeContext
These fields are only used in quantize_mantissas() and reset
on each call, no need to store them in the main context.
Signed-off-by: Mans Rullgard <mans@mansr.com>
-rw-r--r-- | libavcodec/ac3enc.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c index e62ded62c8..fc591d9716 100644 --- a/libavcodec/ac3enc.c +++ b/libavcodec/ac3enc.c @@ -178,10 +178,6 @@ typedef struct AC3EncodeContext { int frame_bits; ///< all frame bits except exponents and mantissas int exponent_bits; ///< number of bits used for exponents - /* mantissa encoding */ - int mant1_cnt, mant2_cnt, mant4_cnt; ///< mantissa counts for bap=1,2,4 - uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; ///< mantissa pointers for bap=1,2,4 - SampleType **planar_samples; uint8_t *bap_buffer; uint8_t *bap1_buffer; @@ -199,6 +195,10 @@ typedef struct AC3EncodeContext { DECLARE_ALIGNED(16, SampleType, windowed_samples)[AC3_WINDOW_SIZE]; } AC3EncodeContext; +typedef struct AC3Mant { + uint16_t *qmant1_ptr, *qmant2_ptr, *qmant4_ptr; ///< mantissa pointers for bap=1,2,4 + int mant1_cnt, mant2_cnt, mant4_cnt; ///< mantissa counts for bap=1,2,4 +} AC3Mant; #define CMIXLEV_NUM_OPTIONS 3 static const float cmixlev_options[CMIXLEV_NUM_OPTIONS] = { @@ -1248,7 +1248,7 @@ static inline int asym_quant(int c, int e, int qbits) /** * Quantize a set of mantissas for a single channel in a single block. */ -static void quantize_mantissas_blk_ch(AC3EncodeContext *s, int32_t *fixed_coef, +static void quantize_mantissas_blk_ch(AC3Mant *s, int32_t *fixed_coef, uint8_t *exp, uint8_t *bap, uint16_t *qmant, int n) { @@ -1350,12 +1350,11 @@ static void quantize_mantissas(AC3EncodeContext *s) for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { AC3Block *block = &s->blocks[blk]; AC3Block *ref_block; - s->mant1_cnt = s->mant2_cnt = s->mant4_cnt = 0; - s->qmant1_ptr = s->qmant2_ptr = s->qmant4_ptr = NULL; + AC3Mant m = { 0 }; for (ch = 0; ch < s->channels; ch++) { ref_block = block->exp_ref_block[ch]; - quantize_mantissas_blk_ch(s, block->fixed_coef[ch], + quantize_mantissas_blk_ch(&m, block->fixed_coef[ch], ref_block->exp[ch], ref_block->bap[ch], block->qmant[ch], s->nb_coefs[ch]); } |