[FFmpeg-devel] [PATCH] aacenc: Fix bug in LAME windowing where only one channel got initalized.

Martin Storsjö martin
Mon Oct 25 08:16:10 CEST 2010


On Sat, 23 Oct 2010, Alex Converse wrote:

> On Sat, Oct 23, 2010 at 5:43 AM, Ronald S. Bultje <rsbultje at gmail.com> wrote:
> >
> > On Sat, Oct 23, 2010 at 3:20 AM, Nathan Caldwell <saintdev at gmail.com> wrote:
> > > I used the same loop counter for the inner and outer initalization loops.
> > > This caused initalization to only run for the first channel. This in turn lead
> > > to any channel other than the first using only short blocks.
> > > ---
> > > ?libavcodec/aacpsy.c | ? ?6 +++---
> > > ?1 files changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c
> > > index b1bfc7b..d5b51f8 100644
> > > --- a/libavcodec/aacpsy.c
> > > +++ b/libavcodec/aacpsy.c
> > > @@ -195,7 +195,7 @@ static float lame_calc_attack_threshold(int bitrate)
> > > ?* LAME psy model specific initialization
> > > ?*/
> > > ?static void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx) {
> > > - ? ?int i;
> > > + ? ?int i, j;
> > >
> > > ? ? for (i = 0; i < avctx->channels; i++) {
> > > ? ? ? ? AacPsyChannel *pch = &ctx->ch[i];
> > > @@ -205,8 +205,8 @@ static void lame_window_init(AacPsyContext *ctx,
> > > AVCodecContext *avctx) {
> > > ? ? ? ? else
> > > ? ? ? ? ? ? pch->attack_threshold =
> > > lame_calc_attack_threshold(avctx->bit_rate / avctx->channels / 1000);
> > >
> > > - ? ? ? ?for (i = 0; i < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; i++)
> > > - ? ? ? ? ? ?pch->prev_energy_subshort[i] = 10.0f;
> > > + ? ? ? ?for (j = 0; j < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; j++)
> > > + ? ? ? ? ? ?pch->prev_energy_subshort[j] = 10.0f;
> > > ? ? }
> > > ?}
> >
> 
> LGTM

Applied

// Martin



More information about the ffmpeg-devel mailing list