diff options
author | jstebbins <[email protected]> | 2011-06-08 18:28:55 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-06-08 18:28:55 +0000 |
commit | 2a262093e255a22c3c38c9c676b37c44a1abb085 (patch) | |
tree | 2ca8b4d096c0ca3412d46f9d3c2f3286ae4eefb5 /contrib/ffmpeg/A04-aacenc-chan-order.patch | |
parent | 1e92c150aac42a8cd6e8c12b10494d9a1f42796e (diff) |
Add ffaac encode support
Adds "AAC (ffmpeg)" option to lingui and macui, "ffaac" option to cli.
Does not yet remove faac.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4031 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'contrib/ffmpeg/A04-aacenc-chan-order.patch')
-rw-r--r-- | contrib/ffmpeg/A04-aacenc-chan-order.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A04-aacenc-chan-order.patch b/contrib/ffmpeg/A04-aacenc-chan-order.patch new file mode 100644 index 000000000..6a8a6c988 --- /dev/null +++ b/contrib/ffmpeg/A04-aacenc-chan-order.patch @@ -0,0 +1,46 @@ +diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c +index 66af2b1..16c5906 100644 +--- a/libavcodec/aacenc.c ++++ b/libavcodec/aacenc.c +@@ -135,6 +135,15 @@ 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" +@@ -499,15 +508,24 @@ 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]]; ++ } + } else { + start_ch = 0; + samples2 = s->samples + 1024 * avctx->channels; + for (i = 0; i < chan_map[0]; i++) { + tag = chan_map[i+1]; + chans = tag == TYPE_CPE ? 2 : 1; +- ff_psy_preprocess(s->psypp, (uint16_t*)data + start_ch, ++ ff_psy_preprocess(s->psypp, ++ (uint16_t*)data + channel_maps[avctx->channels-1][start_ch], + samples2 + start_ch, start_ch, chans); + start_ch += chans; + } |