[FFmpeg-devel] [PATCH] audio conversion clipping/overflows

Ronald S. Bultje rsbultje
Tue Mar 2 23:51:30 CET 2010


Hi,

On Tue, Mar 2, 2010 at 6:36 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Mon, Mar 01, 2010 at 09:18:58AM -0500, Ronald S. Bultje wrote:
>> float 1.0 rounds to int INT_MIN (whatever int size). This leads to
>> considerable audio clipping artifacts.
>>
>> Attached patch is a lame attempt of mine to fix this. It probably
>> makes the code slower, so sue me. :-).
>
>> ?libavcodec/audioconvert.c | ? 18 ++++++++++++------
>> ?libavutil/common.h ? ? ? ?| ? 11 +++++++++++
>> ?2 files changed, 23 insertions(+), 6 deletions(-)
>> 3cbfbc44e4362ec7017ebdc358b3021319023bf1 ?aconv.patch
>
> ok but you know this needs optimizations

Well, yeah. I was wondering why the whole thing is constructed as:

for (n=0;n<n_samples;n++) {
  if (from==.. && to=..) CONV...;
  else if .. etc.
}

Instead of the more logical pix_fmt way, i.e. a table of conversion
functions, some of which could optionally be SIMD'ified (e.g.
float<->int16)?

> also if you apply this, make sure you remove the cliping from every decoder
> that matches SAMPLE_FMT_FLT

OK, separate commit OK or same? I know this affects SIPRO and QCELP at
the very least. Vitor had some concerns about this also...

Ronald



More information about the ffmpeg-devel mailing list