[Libav-user] Converting audio sample buffer format

"René J.V. Bertin" rjvbertin at gmail.com
Mon Feb 25 11:47:46 CET 2013


On Feb 25, 2013, at 10:50, Paul B Mahol wrote:

>> There's another thing that's nagging me. IIUC, the goal here is to convert a
>> buffer of (C) floats into signed shorts. I have some difficulty believing
>> that doing this through a generic workhouse function can be more efficient
>> than writing a simple loop and let a good optimising compiler create the
>> best assembly out of it ...
> 
> Why not do it? And then compare speed. You will learn a lot.
                       ^ there Carl, I fixed a quote as you requested O:-)

I would if the particular problem was relevant to me, right now I have a bit too much of a hunch that I'd find very little gain of the one over the other. Which would mean that if, for a one-time requirement, you need to spend significant time figuring out how to present your data the right way (and then try to understand where you're going wrong), you'd just as well jot something down yourself.

That said, as reported earlier, I did compare performance of a hand-coded SIMD version of a yuv conversion routine (from the Perian project) to the generic scalar version. The SIMD version ran twice as fast as the scalar version until I used gcc 4.7, which has auto-vectorisation capable enough to reverse the picture and make the "scalar" version more than twice as fast as the SIMD version. I should add that working on OS X I have nothing extra to do to ensure that memory is allocated with the proper alignment.

> One could argue that on this mailing list, only self-compiled 
> FFmpeg is supported

One could, but that argument would not be supported by the mailing list's own title:
"This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user at ffmpeg.org>"

The concept "using libav*" doesn't imply anything about how you obtained the libraries, and indeed, who built the libraries you're using (as opposed to which and how) should be irrelevant. It does however constitute a clear invitation to post questions like "how do I convert an audio format".

R.


More information about the Libav-user mailing list