On Fri, Jul 29, 2011 at 2:58 PM, Nathan Caldwell <[email protected]> wrote: > The spec states: > > * Only the lowest 12 spectral coefficients of any LFE may be non-zero > > We were using the 12 lowest *bands*. > --- > libavcodec/aacenc.c | 10 +++++++++- > 1 files changed, 9 insertions(+), 1 deletions(-)
Typo, oops. -- -Nathan Caldwell
From 44a479c50070e1e5af258f7aa741704ee1046b0f Mon Sep 17 00:00:00 2001 From: Nathan Caldwell <[email protected]> Date: Fri, 29 Jul 2011 14:49:04 -0600 Subject: [PATCH 2/2] aacenc: Fix number of coefficients used in a LFE channel. To: libav development <[email protected]> The spec states: * Only the lowest 12 spectral coefficients of any LFE may be non-zero We were using the 12 lowest *bands*. --- libavcodec/aacenc.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index e74af0b..35d4b71 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -540,6 +540,14 @@ static int aac_encode_frame(AVCodecContext *avctx, wi[ch].window_shape = 0; wi[ch].num_windows = 1; wi[ch].grouping[0] = 1; + + /* Only the lowest 12 coefficients are used in a LFE channel */ + if (s->samplerate_index >= 11) + ics->num_swb = 1; + else if (s->samplerate_index >= 8) + ics->num_swb = 2; /* This actually results in 16 coefficients */ + else + ics->num_swb = 3; } else { wi[ch] = s->psy.model->window(&s->psy, samples2, la, cur_channel, ics->window_sequence[0]); @@ -550,7 +558,7 @@ static int aac_encode_frame(AVCodecContext *avctx, ics->use_kb_window[0] = wi[ch].window_shape; ics->num_windows = wi[ch].num_windows; ics->swb_sizes = s->psy.bands [ics->num_windows == 8]; - ics->num_swb = tag == TYPE_LFE ? 12 : s->psy.num_bands[ics->num_windows == 8]; + ics->num_swb = tag == TYPE_LFE ? ics->num_swb : s->psy.num_bands[ics->num_windows == 8]; for (w = 0; w < ics->num_windows; w++) ics->group_len[w] = wi[ch].grouping[w]; -- 1.7.4.1
_______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
