Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Freire <klaussfreire@gmail.com>2015-11-26 09:27:06 +0300
committerClaudio Freire <klaussfreire@gmail.com>2015-11-26 09:27:06 +0300
commitfc36d852ee3413f7cd00ce531ba985925fa7a749 (patch)
tree17327c4356bb4a9c57c97f99374d18c08f712c8e /libavcodec/aacenc.c
parent04deaef29330e672b6d6600fedf4066c4f30d0e6 (diff)
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/aacenc.c')
-rw-r--r--libavcodec/aacenc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 796038c0da..ca6c9dde07 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -292,7 +292,13 @@ static void apply_mid_side_stereo(ChannelElement *cpe)
for (w2 = 0; w2 < ics->group_len[w]; w2++) {
int start = (w+w2) * 128;
for (g = 0; g < ics->num_swb; g++) {
- if (!cpe->ms_mask[w*16 + g] && !cpe->is_mask[w*16 + g]) {
+ /* ms_mask can be used for other purposes in PNS and I/S,
+ * so must not apply M/S if any band uses either, even if
+ * ms_mask is set.
+ */
+ if (!cpe->ms_mask[w*16 + g] || cpe->is_mask[w*16 + g]
+ || cpe->ch[0].band_type[w*16 + g] == NOISE_BT
+ || cpe->ch[1].band_type[w*16 + g] == NOISE_BT) {
start += ics->swb_sizes[g];
continue;
}