[FFmpeg-devel] Some ideas for a tiny set of audio conversion functions..

Michael Niedermayer michaelni
Sun Nov 18 02:08:17 CET 2007


On Thu, Nov 15, 2007 at 07:44:57PM +0100, Andreas ?man wrote:
> ... or a replacement of DSPContext->float_to_int16()
>
> I've been given this some thought and I've come up with
> some thoughts that I realized into code.
>
> The idea is to support
>
> * any number of channels
> * both planar and interleaved data
> * mixing of multiple sources into one output channel
>
> If this is the right way to go i'll continue to write some
> convenience functions, SSE-implementations and make some test
> with the current codecs that output floats internally.
>
> The file is currently just standalone.
>
> Comments?

> #include <math.h>
> #include <stdlib.h>
> #include <string.h>
> #include <inttypes.h>
> #include <stdio.h>
> 
> /* really in avcodec.h */
> enum SampleFormat {
>     SAMPLE_FMT_NONE = -1,
>     SAMPLE_FMT_U8,              ///< unsigned 8 bits
>     SAMPLE_FMT_S16,             ///< signed 16 bits
>     SAMPLE_FMT_S24,             ///< signed 24 bits

i think S24 should be droped ...


[...]
> typedef struct AVAconv_src {
>     struct AVAconv_src *next;   ///< next source in list
>     void *data;                 ///< source data
>     float gain;                 ///< gain, 1.0 is normal
>     int stride;                 ///< offset between samples, in bytes
> } AVAconv_src;
> 
> typedef struct {
>     void *data;                    ///< pointer to destination data
>     int stride;                    ///< offset between samples, in bytes
>     struct AVAconv_src *sources;   ///< linked list of sources
> } AVAconv_dst;

the data/stride for the src is strangely duplicated for each dst
also the convertion stuff (which channel to which and what gain) is in the
same struct as the instance specific stuff (data/stride)
these should be seperated!

also src/dst data/stride could be stored in 2 arrays
like videos data[][]/linesize[] in AVFrame

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

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- 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/20071118/ad21948a/attachment.pgp>



More information about the ffmpeg-devel mailing list