[FFmpeg-devel] [RFC] libavfilter audio - af_resample

Jai Menon jmenon86
Sat Jul 10 13:24:29 CEST 2010

2010/7/10 M?ns Rullg?rd <mans at mansr.com>:
> "S.N. Hemanth Meenakshisundaram" <smeenaks at ucsd.edu> writes:
>> Michael Niedermayer wrote:
>>> On Wed, Jul 07, 2010 at 04:31:04AM -0700, S.N. Hemanth Meenakshisundaram wrote:
>>>> On 07/04/2010 07:57 AM, Stefano Sabatini wrote:
>>>>> On date Thursday 2010-07-01 01:42:51 -0700, S.N. Hemanth
>>>>> Meenakshisundaram encoded:
>>>>>> On 06/25/2010 05:10 PM, Stefano Sabatini wrote:
>>>>>>> On date Friday 2010-06-25 03:52:45 -0700, S.N. Hemanth
>>>>>>> Meenakshisundaram encoded:
>>>>>> Hi All,
>>>>>> Here is the working af_resample.c [...]
>> Hi All,
>> I am attaching a reworked af_resample.c
>> The following are the major changes:
>> 1. Samples are now copied only when a conversion (of channels or
>> sample format) is needed, else the same buffer is passed along.
> That's not what I call copying. ?I hope you're not copying the samples
> and then converting them.
>> 2. Earlier, the channel conversion functions only worked for short
>> (SAMPLE_FMT_S16) pointers but writing a different version for each
>> will increase the number of functions required by 5x. To get around
>> this, I have chosen to always convert incoming audio data to
>> SAMPLE_FMT_S16. Most of the times, this conversion is not necessary
>> since most codecs output S16 data. Once we ensure data is in S16
>> format, channel downmix/upmix is done and finally this data is
>> converted to required output sample format (in case it is not
> Entirely unacceptable.

Also have a look at the "Audio conversion and floating-point codecs"
thread if you haven't done so already.

>> Although this seems wasteful, most of the times there should be only
>> one or zero sample format conversions since at least one of codec
>> output or required SDL output is likely to be S16. Please let me know
>> what you think of this.
> Who cares what SDL does or doesn't do?

+1 again
ffplay is just another user application and the design should _not_
focus on SDL or ffplay.

>> The a52dec library for instance has the sample format fixed at compile
>> time and hence has only one version of all channel downmix/upmix
>> conversion routines.
> liba52 is dead. ?Forget what it used to do. ?There's a reason it died.

Again, hardcoding stuff at compile time isnt desirable so i agree with mans.

>> 3. For the channel conversion, I have changed all routines to work
>> only for packed format for the time being. Again this is because,
>> there seems to be no way sending planar data to SDL audio and ffplay
>> also currently assumes data from codecs is in packed format. However,
>> support for planar data only requires additional channel xonversion
>> routines and no change to the af_resample framework.
> The first thing we must do is add support for planar audio.

The thread I reference above should be a starting point where you can
help with this.


Jai Menon

More information about the ffmpeg-devel mailing list