aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/aaccoder.c
diff options
context:
space:
mode:
authorClaudio Freire <klaussfreire@gmail.com>2015-11-26 03:27:06 -0300
committerClaudio Freire <klaussfreire@gmail.com>2015-11-26 03:27:06 -0300
commitfc36d852ee3413f7cd00ce531ba985925fa7a749 (patch)
tree17327c4356bb4a9c57c97f99374d18c08f712c8e /libavcodec/aaccoder.c
parent04deaef29330e672b6d6600fedf4066c4f30d0e6 (diff)
downloadffmpeg-fc36d852ee3413f7cd00ce531ba985925fa7a749.tar.gz
AAC encoder: Fix application of M/S with PNS
When both M/S coding and PNS are enabled, scalefactors and coding books would be mistakenly clobbered when setting the M/S flag on PNS'd bands. The flag needs to be set to signal the generation of correlated noise, but the scalefactors, coefficients and the coding books need to be kept intact.
Diffstat (limited to 'libavcodec/aaccoder.c')
-rw-r--r--libavcodec/aaccoder.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index fd9785e26a..2337784011 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -887,8 +887,8 @@ static void search_for_ms(AACEncContext *s, ChannelElement *cpe)
}
cpe->ms_mask[w*16+g] = dist2 <= dist1 && B1 < B0;
if (cpe->ms_mask[w*16+g]) {
- /* Setting the M/S mask is useful with I/S, but only the flag */
- if (!cpe->is_mask[w*16+g]) {
+ /* Setting the M/S mask is useful with I/S or PNS, but only the flag */
+ if (!cpe->is_mask[w*16+g] && sce0->band_type[w*16+g] != NOISE_BT && sce1->band_type[w*16+g] != NOISE_BT) {
sce0->sf_idx[w*16+g] = mididx;
sce1->sf_idx[w*16+g] = sididx;
sce0->band_type[w*16+g] = midcb;