[FFmpeg-cvslog] aacenc: Fix number of coefficients used in a LFE channel.

Nathan Caldwell git at videolan.org
Sun Aug 14 20:02:38 CEST 2011


ffmpeg | branch: master | Nathan Caldwell <saintdev at gmail.com> | Fri Jul 29 14:49:04 2011 -0600| [24efdea7fd024431f8ddd2b08c9390eba08c91f1] | committer: Alex Converse

aacenc: Fix number of coefficients used in a LFE channel.

The spec states:

 *  Only the lowest 12 spectral coefficients of any LFE may be non-zero

We were using the 12 lowest *bands*.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=24efdea7fd024431f8ddd2b08c9390eba08c91f1
---

 libavcodec/aacenc.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index 5a1fc94..449b200 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -540,6 +540,12 @@ 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.
+                 * The expression below results in only the bottom 8 coefficients
+                 * being used for 11.025kHz to 16kHz sample rates.
+                 */
+                ics->num_swb = s->samplerate_index >= 8 ? 1 : 3;
             } else {
                 wi[ch] = s->psy.model->window(&s->psy, samples2, la, cur_channel,
                                               ics->window_sequence[0]);
@@ -550,7 +556,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];
 



More information about the ffmpeg-cvslog mailing list