Commit 5bff8590 authored by Justin Ruggles's avatar Justin Ruggles

Simplify compute_exp_strategy() by passing a pointer to all exponents and

exponent strategies for a single channel to compute_exp_strategy_ch().
This allows for removal of the temporary pointer arrays.

Originally committed as revision 26356 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 4b90c35d
...@@ -441,7 +441,7 @@ static void extract_exponents(AC3EncodeContext *s) ...@@ -441,7 +441,7 @@ static void extract_exponents(AC3EncodeContext *s)
* Calculate exponent strategies for all blocks in a single channel. * Calculate exponent strategies for all blocks in a single channel.
*/ */
static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy, static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy,
uint8_t **exp) uint8_t *exp)
{ {
int blk, blk1; int blk, blk1;
int exp_diff; int exp_diff;
...@@ -449,12 +449,14 @@ static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy, ...@@ -449,12 +449,14 @@ static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy,
/* estimate if the exponent variation & decide if they should be /* estimate if the exponent variation & decide if they should be
reused in the next frame */ reused in the next frame */
exp_strategy[0] = EXP_NEW; exp_strategy[0] = EXP_NEW;
exp += AC3_MAX_COEFS;
for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) { for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) {
exp_diff = s->dsp.sad[0](NULL, exp[blk], exp[blk-1], 16, 16); exp_diff = s->dsp.sad[0](NULL, exp, exp - AC3_MAX_COEFS, 16, 16);
if (exp_diff > EXP_DIFF_THRESHOLD) if (exp_diff > EXP_DIFF_THRESHOLD)
exp_strategy[blk] = EXP_NEW; exp_strategy[blk] = EXP_NEW;
else else
exp_strategy[blk] = EXP_REUSE; exp_strategy[blk] = EXP_REUSE;
exp += AC3_MAX_COEFS;
} }
emms_c(); emms_c();
...@@ -482,20 +484,10 @@ static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy, ...@@ -482,20 +484,10 @@ static void compute_exp_strategy_ch(AC3EncodeContext *s, uint8_t *exp_strategy,
*/ */
static void compute_exp_strategy(AC3EncodeContext *s) static void compute_exp_strategy(AC3EncodeContext *s)
{ {
uint8_t *exp1[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS];
uint8_t exp_str1[AC3_MAX_CHANNELS][AC3_MAX_BLOCKS];
int ch, blk; int ch, blk;
for (ch = 0; ch < s->fbw_channels; ch++) { for (ch = 0; ch < s->fbw_channels; ch++) {
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { compute_exp_strategy_ch(s, s->exp_strategy[ch], s->blocks[0].exp[ch]);
exp1[ch][blk] = s->blocks[blk].exp[ch];
exp_str1[ch][blk] = s->exp_strategy[ch][blk];
}
compute_exp_strategy_ch(s, exp_str1[ch], exp1[ch]);
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++)
s->exp_strategy[ch][blk] = exp_str1[ch][blk];
} }
if (s->lfe_on) { if (s->lfe_on) {
ch = s->lfe_channel; ch = s->lfe_channel;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment