[FFmpeg-cvslog] Revert "Fix multi-channel AAC encoding."

Michael Niedermayer git at videolan.org
Tue Jan 24 03:04:46 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jan 24 02:31:56 2012 +0100| [b955d4072e3e563b230c9ab4d6575577a3dc7314] | committer: Michael Niedermayer

Revert "Fix multi-channel AAC encoding."

This reverts commit b3452771c4550b46ea54d15be6cfe8cc10585199.

A better solution was implemented by Nathan Caldwell.

Conflicts:

	libavcodec/aacenc.c

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

 libavcodec/aacenc.c  |   24 +++---------------------
 libavcodec/libfaac.c |   10 ----------
 2 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c
index a7b3e4b..5ab0f1f 100644
--- a/libavcodec/aacenc.c
+++ b/libavcodec/aacenc.c
@@ -135,15 +135,6 @@ static const uint8_t aac_chan_configs[6][5] = {
  {4, TYPE_SCE, TYPE_CPE, TYPE_CPE, TYPE_LFE}, // 6 channels - front center + stereo + back stereo + LFE
 };
 
-static const uint8_t channel_maps[][AAC_MAX_CHANNELS] = {
-    { 0 },
-    { 0, 1 },
-    { 2, 0, 1 },
-    { 2, 0, 1, 3 },
-    { 2, 0, 1, 3, 4 },
-    { 2, 0, 1, 4, 5, 3 },
-};
-
 /**
  * Make AAC audio config object.
  * @see 1.6.2.1 "Syntax - AudioSpecificConfig"
@@ -511,24 +502,15 @@ static int aac_encode_frame(AVCodecContext *avctx,
         return 0;
     if (data) {
         if (!s->psypp) {
-            if (avctx->channels <= 2) {
-                memcpy(s->samples + 1024 * avctx->channels, data,
-                       1024 * avctx->channels * sizeof(s->samples[0]));
-            } else {
-                for (i = 0; i < 1024; i++)
-                    for (ch = 0; ch < avctx->channels; ch++)
-                        s->samples[(i + 1024) * avctx->channels + ch] =
-                            ((int16_t*)data)[i * avctx->channels +
-                                             channel_maps[avctx->channels-1][ch]];
-            }
+            memcpy(s->samples + 1024 * avctx->channels, data,
+                   1024 * avctx->channels * sizeof(s->samples[0]));
         } else {
             start_ch = 0;
             samples2 = s->samples + 1024 * avctx->channels;
             for (i = 0; i < s->chan_map[0]; i++) {
                 tag = s->chan_map[i+1];
                 chans = tag == TYPE_CPE ? 2 : 1;
-                ff_psy_preprocess(s->psypp,
-                                  (uint16_t*)data + channel_maps[avctx->channels-1][start_ch],
+                ff_psy_preprocess(s->psypp, (uint16_t*)data + start_ch,
                                   samples2 + start_ch, start_ch, chans);
                 start_ch += chans;
             }
diff --git a/libavcodec/libfaac.c b/libavcodec/libfaac.c
index 31dc1a4..4758cf7 100644
--- a/libavcodec/libfaac.c
+++ b/libavcodec/libfaac.c
@@ -31,13 +31,6 @@ typedef struct FaacAudioContext {
     faacEncHandle faac_handle;
 } FaacAudioContext;
 
-static const int channel_maps[][6] = {
-    { 2, 0, 1 },          //< C L R
-    { 2, 0, 1, 3 },       //< C L R Cs
-    { 2, 0, 1, 3, 4 },    //< C L R Ls Rs
-    { 2, 0, 1, 4, 5, 3 }, //< C L R Ls Rs LFE
-};
-
 static av_cold int Faac_encode_init(AVCodecContext *avctx)
 {
     FaacAudioContext *s = avctx->priv_data;
@@ -93,9 +86,6 @@ static av_cold int Faac_encode_init(AVCodecContext *avctx)
     }
     faac_cfg->outputFormat = 1;
     faac_cfg->inputFormat = FAAC_INPUT_16BIT;
-    if (avctx->channels > 2)
-        memcpy(faac_cfg->channel_map, channel_maps[avctx->channels-3],
-               avctx->channels * sizeof(int));
 
     avctx->frame_size = samples_input / avctx->channels;
 



More information about the ffmpeg-cvslog mailing list