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

Michael Niedermayer michaelni
Tue Mar 16 17:02:22 CET 2010


On Tue, Mar 16, 2010 at 11:35:27AM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Mon, Mar 15, 2010 at 7:07 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Mon, Mar 15, 2010 at 06:31:21PM -0400, Ronald S. Bultje wrote:
> >> Index: ffmpeg-svn/libavcodec/amrnbdec.c
> >> ===================================================================
> >> --- ffmpeg-svn.orig/libavcodec/amrnbdec.c ? ? 2010-03-15 14:30:19.000000000 -0400
> >> +++ ffmpeg-svn/libavcodec/amrnbdec.c ?2010-03-15 18:10:23.000000000 -0400
> > [...]
> >> @@ -1049,8 +1047,7 @@
> >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? p->high_pass_mem, AMR_BLOCK_SIZE);
> >>
> >> ? ? ?for (i = 0; i < AMR_BLOCK_SIZE; i++)
> >> - ? ? ? ?buf_out[i] = av_clipf(buf_out[i] * AMR_SAMPLE_SCALE,
> >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?-1.0, 32767.0 / 32768.0);
> >> + ? ? ? ?buf_out[i] *= AMR_SAMPLE_SCALE;
> >
> > cant this be merged into something ?
> 
> Fixed in attached. Output is same. I'm still not sure if the
> interleaving-loops or history-related memcpy()s can be prevented, but
> am open to suggestions on how to achieve the same result without
> memcpy()s/loops.

AVFrame get_buffer/release_buffer like we do for video can surely prevent
the copies in severak ways.
return pointer to internal buffer or require get_buffer to allocate suffiient
space prior to [0]

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

Avoid a single point of failure, be that a person or equipment.
-------------- 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/20100316/14b5562d/attachment.pgp>



More information about the ffmpeg-devel mailing list