---
libavcodec/ac3enc_float.c | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c
index d79d028..936b107 100644
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@ -108,11 +108,11 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
nb_coefs = FFMIN(s->nb_coefs[0], s->nb_coefs[1]);
- /* calculate sum of squared coeffs for each block and band */
+ s->blocks[0].new_rematrixing_strategy = 1;
for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) {
block = &s->blocks[blk];
for (bnd = 0; bnd < 4; bnd++) {
- /* calculate sums for one band in one block */
+ /* calculate calculate sum of squared coeffs for one band in one block */
int start = ff_ac3_rematrix_band_tab[bnd];
int end = FFMIN(nb_coefs, ff_ac3_rematrix_band_tab[bnd+1]);
float sum[4] = {0,};
@@ -132,21 +132,15 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
block->rematrixing_flags[bnd] = 1;
else
block->rematrixing_flags[bnd] = 0;
- }
- }
- /* for each block, determine if new rematrixing flags will be sent */
- s->blocks[0].new_rematrixing_strategy = 1;
- for (blk = 1; blk < AC3_MAX_BLOCKS; blk++) {
- block = &s->blocks[blk];
- block0 = &s->blocks[blk-1];
- block->new_rematrixing_strategy = 0;
- for (bnd = 0; bnd < 4; bnd++) {
- if (block->rematrixing_flags[bnd] != block0->rematrixing_flags[bnd]) {
+ /* determine if new rematrixing flags will be sent */
+ if (blk &&
+ !block->new_rematrixing_strategy &&
+ block->rematrixing_flags[bnd] != block0->rematrixing_flags[bnd]) {
block->new_rematrixing_strategy = 1;
- break;
}
}
+ block0 = block;
}
}
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc