Ticket #1784: 0001-Fix-bug-1784-erasure-of-surround-channels.patch

File 0001-Fix-bug-1784-erasure-of-surround-channels.patch, 2.1 KB (added by klaussfreire, 3 years ago)

Patch that fixes this issue

  • libavcodec/aacenc.c

    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, 
    593593                coeffs[ch] = cpe->ch[ch].coeffs; 
    594594            s->psy.model->analyze(&s->psy, start_ch, coeffs, wi); 
    595595            for (ch = 0; ch < chans; ch++) { 
    596                 s->cur_channel = start_ch * 2 + ch; 
     596                s->cur_channel = start_ch + ch; 
    597597                s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda); 
    598598            } 
    599599            cpe->common_window = 0; 
    static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, 
    609609                    } 
    610610                } 
    611611            } 
    612             s->cur_channel = start_ch * 2; 
     612            s->cur_channel = start_ch; 
    613613            if (s->options.stereo_mode && cpe->common_window) { 
    614614                if (s->options.stereo_mode > 0) { 
    615615                    IndividualChannelStream *ics = &cpe->ch[0].ics; 
    static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, 
    626626                   MS-transformed channels */ 
    627627                s->psy.model->analyze(&s->psy, start_ch, coeffs, wi); 
    628628                for (ch = 0; ch < chans; ch++) { 
    629                     s->cur_channel = start_ch * 2 + ch; 
     629                    s->cur_channel = start_ch + ch; 
    630630                    s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda); 
    631631                } 
    632632            }