[Ffmpeg-devel] channel ordering and downmixing

Michael Niedermayer michaelni
Sun Apr 8 13:17:27 CEST 2007


Hi

On Sun, Apr 08, 2007 at 01:15:21AM -0400, Justin Ruggles wrote:
> Michael Niedermayer wrote:
> > i even suggest to completely ignore downmix coeffs first and design just the
> > channel layout stuff that way we have a smaller set of things to consider
> > and after the channel layout is done and in svn work on the downmix coeffs
> > (just a random suggestion)
> 
> Here is another concept-patch for channel layout handling.  Downmixing
> is ignored for now.
> 
> Demuxing:
> The demuxer sets AVCodecContext->channel_layout to the appropriate
> layout or leaves it NULL if unknown or codec-dependent.
> 
> Decoding:
> If required, the decoder sets AVCodecContext->channel_layout to the
> channel layout of the input audio stream.  If downmixing is done in the
> decoder (current situation), the final downmixed channel layout is
> considered the input layout.
> 
> Encoding:
> The user must set AVCodecContext->channel_layout to one of the encoder's
> compatible layouts in AVCodec->channel_layouts.  If the encoder's list
> is empty, any layout can be used.
> 
> Muxing:
> The user's chosen layout must also match one of the muxer's compatible
> layouts in AVOutputFormat->channel_layouts.
> 
> Channel mixing and reordering API:
> 
> av_channel_mix_init allocates the AVChannelMixContext and sets the
> values from input parameters.  To help the user with finding compatible
> layouts, this function returns NULL if the ilayout and olayout
> parameters are not compatible.

how can they be incompatible?


> 
> av_channel_mix does the channel reordering (and will do downmixing once
> it is implemented).
> 
> av_channel_mix_close frees the AVChannelMixContext.
> 
> The attached patch is not fully-functional, but gives an idea of how it
> might work.  The example used is encoding PCM wav to raw AC3.  The
> user-level parts (ffmpeg.c and ffplay.c) are not implemented yet, so the
> patch doesn't work at this point.
> 
> Also, I don't really know what appropriate channel positions should be.

just guess and add a note that they are just guessed ...


>  Anyone have any ideas or references I might refer to for this?
> 
> -Justin

[...]
> Index: libavformat/avformat.h
> ===================================================================
> --- libavformat/avformat.h	(revision 8673)
> +++ libavformat/avformat.h	(working copy)
> @@ -193,6 +193,12 @@
>  
>      /* private fields */
>      struct AVOutputFormat *next;
> +
> +    /**
> +     * array of supported channel layouts, or NULL if any
> +     * array is terminanted by NULL
> +     */
> +    const AVChannelLayout **channel_layouts[];
>  } AVOutputFormat;

you can place this before *next i think as *next is private

and ia fine with the general design i think ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070408/43359a2d/attachment.pgp>



More information about the ffmpeg-devel mailing list