[FFmpeg-devel] [PATCH] Replace CLAMP_TO_SHORT with av_clip in adpcm.c
Aurelien Jacobs
aurel
Sat Aug 11 16:16:37 CEST 2007
On Sat, 11 Aug 2007 12:02:38 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:
> Hi
>
> On Sat, Aug 11, 2007 at 02:13:51AM -0300, Ramiro Ribeiro Polla wrote:
> > Aurelien Jacobs wrote:
> > > Hi,
> > >
> > > $subj
> > > This fixes issue84.
> > >
> > >
> >
> > What about making av_clip_int16 in libavutil/common.h?
> > There are many more places throughout FFmpeg where this is used.
Attached is an implementation of av_clip_int16().
> what is the speed/filesize effect of such a change?
I benchmarked the 3 versions (original CLAMP_TO_SHORT, initial patch
using av_clip, new patch using av_clip_int16).
> speed being:
> volatile int v=0;
> START_TIMER
> for(i=-40000; i<40000; i++)
> v+= av_clip_int16(i)
> STOP_TIMER("foober")
> printf("%d", v);
Here are the result of this speed benchmark:
6184290 dezicycles in CLAMP_TO_SHORT, 1 runs, 0 skips
6184370 dezicycles in av_clip, 1 runs, 0 skips
5235530 dezicycles in av_clip_int16, 1 runs, 0 skips
av_clip_int16 is a clear winner here.
> filesize being object size with --enable-small
Object size of adpcm.o and ffmpeg with --enable-small:
text data bss dec hex filename
14382 2164 0 16546 40a2 libavcodec/adpcm.o.orig
2493191 45804 1017840 3556835 3645e3 ffmpeg.orig
14377 2164 0 16541 409d libavcodec/adpcm.o.av_clip
2493175 45804 1017840 3556819 3645d3 ffmpeg.av_clip
14209 2164 0 16373 3ff5 libavcodec/adpcm.o.av_clip_int16
2492967 45804 1017840 3556611 364503 ffmpeg.av_clip_int16
Once again, av_clip_int16 is a clear winner.
So I will commit soon this av_clip_int16 implementation.
Aurel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: av_clip_int16.diff
Type: text/x-diff
Size: 547 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070811/25f3f3b1/attachment.diff>
More information about the ffmpeg-devel
mailing list