[Libav-user] Converting audio sample buffer format
Brad O'Hearne
brado at bighillsoftware.com
Mon Feb 25 17:26:00 CET 2013
On Feb 25, 2013, at 2:50 AM, Paul B Mahol <onemda at gmail.com> wrote:
>>
>> Exactly, but you'd need to build the libav libs yourself, with debugging
>> info.
>>
>> 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 than compare speed. You will learn a lot.
There's been several replies by a number of folks on various aspects of my problem, for which I thank you. There appears there may be either some misreads or something getting lost in translation. Rather than answer every post individually, I'm going to try to hit the high points in summary in one post here -- then I'll reply to a few individual ones as necessary. I hope this will communicate the most info while reducing list traffic. To the high points:
- It would appear from the replies of more than one person that the source code I posted was either missed or not received. I attached a text file with source code to my original message. I did that so as to minimize the length of the message dialog by not posting all code inline -- thought that would be considered proper etiquette on this list. I received this attachment from the mailing list fine, but perhaps some have mail servers which stripped this attachment off, here is a link to the file:
https://www.dropbox.com/sh/3exqfeli6446wno/0w6IEyj7Jo/AudioProcessingSnippet.txt
I'm attaching the file as well, in case some have the URL above blocked for some reason.
- Ideally yes, as anyone would be, I am interested in maximum performance. However, at this point, performance tweaking is a very distant secondary issue -- getting it working is by far most important issue on the table right now.
- It seemed from certain replies that there was a perception that either binaries built elsewhere were in play, or that I wasn't dealing with source. To erase those questions, I am developing on Mac OS X 10.8.2, using Xcode 4.5.2. I pulled FFmpeg source directly from git, and built all relevant libraries from source.
- My code has been modeled directly after the resampling_audio.c example bundled with FFmpeg. There were minor changes from the example for a) combining the resampler context allocation and setting of options into one call instead of two using swr_alloc_set_opts, and b) filling the source data array from QTSampleBuffer using the av_samples_fill_arrays. All of these changes execute successfully. The only error I receive results from the swr_convert call.
- Some of the responses seem to suggest that either a certain approach or resampling in general might be error prone, or known not to work in some cases or in some environments. If this is indeed the case, please expound further if you could, because at this point, I need to avoid beating my head endlessly against API that might be broken. I have assumed to this point that the API is solid and error-free, and all errors or omissions are in my code. If this is not the case, it would be good to know, and what the ramifications are.
After wrestling with this for days, at this point, anything helps. If answering any questions helps erase any ambiguity of what I'm doing or anything that might be contributing to the problem, I'm happy to do so. Again, thanks everyone for the conversation, I greatly appreciate the help.
Brad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130225/a16d4aa5/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: AudioProcessingSnippet.txt
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130225/a16d4aa5/attachment.txt>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130225/a16d4aa5/attachment-0001.html>
More information about the Libav-user
mailing list