From 2754cfb2eb43867e2f9bae2bc9d4e220d6047a18 Mon Sep 17 00:00:00 2001
From: Claudio Freire <klaussfreire@gmail.com>
Date: Sun, 12 May 2013 01:26:57 -0300
Subject: [PATCH] Fix bug #1784: erasure of surround channels
This was due to a miscomputation of s->cur_channel, which led to
psy-based encoders using the psy coefficients for the wrong channel.
Test sample attached on the bug tracker had the peculiar case of all
other channels being silent, so the error was far more noticeable.
---
libavcodec/aacenc.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index aa93c90..8812a17 100644
|
a
|
b
|
static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
| 593 | 593 | coeffs[ch] = cpe->ch[ch].coeffs; |
| 594 | 594 | s->psy.model->analyze(&s->psy, start_ch, coeffs, wi); |
| 595 | 595 | for (ch = 0; ch < chans; ch++) { |
| 596 | | s->cur_channel = start_ch * 2 + ch; |
| | 596 | s->cur_channel = start_ch + ch; |
| 597 | 597 | s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda); |
| 598 | 598 | } |
| 599 | 599 | cpe->common_window = 0; |
| … |
… |
static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
| 609 | 609 | } |
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | | s->cur_channel = start_ch * 2; |
| | 612 | s->cur_channel = start_ch; |
| 613 | 613 | if (s->options.stereo_mode && cpe->common_window) { |
| 614 | 614 | if (s->options.stereo_mode > 0) { |
| 615 | 615 | IndividualChannelStream *ics = &cpe->ch[0].ics; |
| … |
… |
static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
| 626 | 626 | MS-transformed channels */ |
| 627 | 627 | s->psy.model->analyze(&s->psy, start_ch, coeffs, wi); |
| 628 | 628 | for (ch = 0; ch < chans; ch++) { |
| 629 | | s->cur_channel = start_ch * 2 + ch; |
| | 629 | s->cur_channel = start_ch + ch; |
| 630 | 630 | s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda); |
| 631 | 631 | } |
| 632 | 632 | } |