[FFmpeg-devel] [PATCH] AAC decoder

Robert Swain robert.swain
Tue May 20 15:23:15 CEST 2008


2008/4/2 Michael Niedermayer <michaelni at gmx.at>:
> On Tue, Apr 01, 2008 at 04:56:48PM +0200, Andreas ?man wrote:
>> Andreas ?man wrote:
> [...]
>> +/**
>> + * Set up program_config_struct, but based on a default channel configuration
>> + * as specified in Table 1.17
>> + */
>> +static int program_config_element_default(AACContext *ac, int channels)
>> +{
>> +    program_config_struct pcs;
>> +
>> +    memset(&pcs, 0, sizeof(program_config_struct));
>> +
>> +    /* Premixed downmix outputs are not available */
>> +    pcs.mono_mixdown   = -1;
>> +    pcs.stereo_mixdown = -1;
>> +
>> +    switch(channels) {
>> +    case 1: /* Mono */
>> +        pcs.sce_type[0] = AAC_CHANNEL_FRONT;
>> +        break;
>> +
>> +    case 2: /* Stereo */
>> +        pcs.cpe_type[0] = AAC_CHANNEL_FRONT;
>> +        break;
>> +
>> +    case 3: /* Front Center + L + R  */
>> +        pcs.sce_type[0] = AAC_CHANNEL_FRONT;
>> +        pcs.cpe_type[0] = AAC_CHANNEL_FRONT;
>> +        break;
>> +
>> +    case 4: /* Front Center + L + R + Back Center */
>> +        pcs.sce_type[0] = AAC_CHANNEL_FRONT;
>> +        pcs.cpe_type[0] = AAC_CHANNEL_FRONT;
>> +        pcs.sce_type[1] = AAC_CHANNEL_BACK;
>> +        break;
>> +
>> +    case 5: /* Front Center + L + R + Back Stereo */
>> +        pcs.sce_type[0] = AAC_CHANNEL_FRONT;
>> +        pcs.cpe_type[0] = AAC_CHANNEL_FRONT;
>> +        pcs.cpe_type[1] = AAC_CHANNEL_BACK;
>> +        break;
>> +
>> +    case 6: /* Front Center + L + R + Back Stereo + LFE */
>> +        pcs.sce_type[0] = AAC_CHANNEL_FRONT;
>> +        pcs.cpe_type[0] = AAC_CHANNEL_FRONT;
>> +        pcs.cpe_type[1] = AAC_CHANNEL_BACK;
>> +        pcs.lfe_type[0] = AAC_CHANNEL_LFE;
>> +        break;
>> +
>> +    case 7: /* Front Center + L + R + Outer Front Left + Outer Front Right + Back Stereo + LFE */
>> +        pcs.sce_type[0] = AAC_CHANNEL_FRONT;
>> +        pcs.cpe_type[0] = AAC_CHANNEL_FRONT;
>> +        pcs.cpe_type[1] = AAC_CHANNEL_FRONT;
>> +        pcs.cpe_type[2] = AAC_CHANNEL_BACK;
>> +        pcs.lfe_type[0] = AAC_CHANNEL_LFE;
>> +        break;
>> +
>> +    default:
>> +        av_log(ac->avccontext, AV_LOG_ERROR, "Invalid default channel configuration (%d channels)\n",
>> +               channels);
>> +        return -1;
>> +    }
>
> Above is full of code duplication and can be done simpler.
>
> [...]

How about the attached patch?

I'm attacking the remaining issues you mentioned so that this can be
committed. I expect we'll go through a few iterations. I'll soon start
gluing in my SBR code which is mostly complete but not yet working. :)

Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: program_config_element_default_01.diff
Type: text/x-diff
Size: 2831 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080520/fea0a391/attachment.diff>



More information about the ffmpeg-devel mailing list