[FFmpeg-devel] [PATCH] AAC decoder
Robert Swain
robert.swain
Wed May 21 15:45:18 CEST 2008
2008/5/20 Michael Niedermayer <michaelni at gmx.at>:
> On Tue, May 20, 2008 at 02:23:15PM +0100, Robert Swain wrote:
>> 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?
>
> looks better
Applied.
Rob
More information about the ffmpeg-devel
mailing list