[FFmpeg-devel] [PATCH] AAC decoder
Michael Niedermayer
michaelni
Tue May 20 23:31:12 CEST 2008
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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080520/6f1e1ad3/attachment.pgp>
More information about the ffmpeg-devel
mailing list