This was a logic error in the previous commit. It's better to reduce all higher
bitrate strategies before starting to reduce lower bitrate strategies.
---
libavcodec/ac3enc.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git libavcodec/ac3enc.c libavcodec/ac3enc.c
index bc9a28c..fc50fb5 100644
--- libavcodec/ac3enc.c
+++ libavcodec/ac3enc.c
@@ -1314,13 +1314,21 @@ static int downgrade_exponents(AC3EncodeContext *s,
exp_strategy[blk][ch] = EXP_D25;
return 1;
}
+ }
+ }
+ for (ch = 0; ch < s->channels; ch++) {
+ for (blk = AC3_MAX_BLOCKS-1; blk >= 0; blk--) {
if (exp_strategy[blk][ch] == EXP_D25) {
exp_strategy[blk][ch] = EXP_D45;
return 1;
}
- /* block 0 cannot reuse exponents, so only downgrade D45 to REUSE
- if the block number > 0 */
- if (exp_strategy[blk][ch] == EXP_D45 && blk) {
+ }
+ }
+ for (ch = 0; ch < s->channels; ch++) {
+ /* block 0 cannot reuse exponents, so only downgrade D45 to REUSE if
+ the block number > 0 */
+ for (blk = AC3_MAX_BLOCKS-1; blk > 0; blk--) {
+ if (exp_strategy[blk][ch] == EXP_D45) {
exp_strategy[blk][ch] = EXP_REUSE;
return 1;
}
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc