summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Freire <klaussfreire@gmail.com>2015-11-26 03:37:29 -0300
committerClaudio Freire <klaussfreire@gmail.com>2015-11-26 03:37:29 -0300
commit3b1cab9351f384f3a8d03dec58262d5b66920e30 (patch)
treee109fd4e9bf750112c5fd639afe42cab5518693b
parentfc36d852ee3413f7cd00ce531ba985925fa7a749 (diff)
AAC encoder: fix wrong gain sacalefactor being set
In some conditions, where the first band was being zeroed mainly, the wrong global gain scalefactor would be written to the stream since it's always taken from the first band regardless of whether it's been marked as zero or not. So, always make sure it contians something useful.
-rw-r--r--libavcodec/aaccoder_twoloop.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/aaccoder_twoloop.h b/libavcodec/aaccoder_twoloop.h
index e53257fbaa..5e64d48024 100644
--- a/libavcodec/aaccoder_twoloop.h
+++ b/libavcodec/aaccoder_twoloop.h
@@ -693,6 +693,9 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
if (prev != -1) {
int sfdiff = sce->sf_idx[w*16+g] - prev + SCALE_DIFF_ZERO;
av_assert1(sfdiff >= 0 && sfdiff <= 2*SCALE_MAX_DIFF);
+ } else if (sce->zeroes[0]) {
+ /** Set global gain to something useful */
+ sce->sf_idx[0] = sce->sf_idx[w*16+g];
}
prev = sce->sf_idx[w*16+g];
}