[FFmpeg-devel] [PATCH] AAC Decoder round 4
Robert Swain
robert.swain
Tue Aug 5 16:48:13 CEST 2008
2008/7/30 Robert Swain <robert.swain at gmail.com>:
> 2008/7/27 Michael Niedermayer <michaelni at gmx.at>:
>> On Fri, Jul 18, 2008 at 03:13:38PM +0100, Robert Swain wrote:
>>> Index: libavcodec/aac.c
>>> ===================================================================
>>> --- libavcodec/aac.c (revision 0)
>>> +++ libavcodec/aac.c (revision 0)
[...]
>>> +/**
>>> + * Set up ProgramConfig, but based on a default channel configuration
>>> + * as specified in table 1.17.
>>> + */
>>> +static int program_config_element_default(AACContext *ac, int channels)
>>> +{
>>> + ProgramConfig pcs;
>>> +
>>> + memset(&pcs, 0, sizeof(ProgramConfig));
>>> +
>>> + /* Pre-mixed down-mix outputs are not available. */
>>> + pcs.mono_mixdown_tag = -1;
>>> + pcs.stereo_mixdown_tag = -1;
>>> +
>>> + if(channels < 1 || channels > 7) {
>>> + av_log(ac->avccontext, AV_LOG_ERROR, "invalid default channel configuration (%d channels)\n",
>>> + channels);
>>> + return -1;
>>> + }
>>> +
>>
>>> + /* default channel configurations:
>>> + *
>>> + * 1ch : front center (mono)
>>> + * 2ch : L + R (stereo)
>>> + * 3ch : front center + L + R
>>> + * 4ch : front center + L + R + back center
>>> + * 5ch : front center + L + R + back stereo
>>> + * 6ch : front center + L + R + back stereo + LFE
>>> + * 7ch : front center + L + R + outer front left + outer front right + back stereo + LFE
>>> + */
>>> +
>>> + if(channels != 2)
>>> + pcs.che_type[ID_SCE][0] = AAC_CHANNEL_FRONT; // front center (or mono)
>>> + if(channels > 1)
>>> + pcs.che_type[ID_CPE][0] = AAC_CHANNEL_FRONT; // L + R (or stereo)
>>> + if(channels == 4)
>>> + pcs.che_type[ID_SCE][1] = AAC_CHANNEL_BACK; // back center
>>> + if(channels > 4)
>>> + pcs.che_type[ID_CPE][(channels == 7) + 1]
>>> + = AAC_CHANNEL_BACK; // back stereo
>>> + if(channels > 5)
>>> + pcs.che_type[ID_LFE][0] = AAC_CHANNEL_LFE; // LFE
>>> + if(channels == 7)
>>> + pcs.che_type[ID_CPE][1] = AAC_CHANNEL_FRONT; // outer front left + outer front right
>>
>> i tried to simplify this:
>>
>> switch(channels){
>> case 7: pcs.che_type[ID_CPE][ 1] = AAC_CHANNEL_FRONT; // outer front left + outer front right
>> case 6: pcs.che_type[ID_LFE][ 0] = AAC_CHANNEL_LFE; // LFE
>> case 5: pcs.che_type[ID_CPE][(channels == 7) + 1] = AAC_CHANNEL_BACK; // back stereo
>>
>> but then i realized your 7 ch case really uses 8 channels...
>
> Mmm, I never noticed that before. Strange. I'll have to have a look to
> see what the spec says about program configurations.
Strange as it is, I checked this and table 1.17 does indeed state that
channels == 7 defines the configuration for 7+1 channels.
Rob
More information about the ffmpeg-devel
mailing list