[FFmpeg-devel] [PATCH 5/5] DCA: use SDIVMOD

Michael Niedermayer michaelni
Mon Apr 12 16:30:09 CEST 2010


On Mon, Apr 12, 2010 at 04:25:58PM +0200, Michael Niedermayer wrote:
> On Sun, Apr 11, 2010 at 11:05:54PM +0100, Mans Rullgard wrote:
> > ---
> >  libavcodec/dca.c |    8 ++++----
> >  1 files changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/libavcodec/dca.c b/libavcodec/dca.c
> > index 7a6841d..6f944f2 100644
> > --- a/libavcodec/dca.c
> > +++ b/libavcodec/dca.c
> > @@ -34,6 +34,7 @@
> >  #include "avcodec.h"
> >  #include "dsputil.h"
> >  #include "fft.h"
> > +#include "mathops.h"
> >  #include "get_bits.h"
> >  #include "put_bits.h"
> >  #include "dcadata.h"
> > @@ -889,17 +890,16 @@ static void dca_downmix(float *samples, int srcfmt,
> >      }
> >  }
> >  
> > -
> >  /* Very compact version of the block code decoder that does not use table
> >   * look-up but is slightly slower */
> >  static int decode_blockcode(int code, int levels, int *values)
> >  {
> > -    int i;
> > +    int i, mod;
> >      int offset = (levels - 1) >> 1;
> >  
> >      for (i = 0; i < 4; i++) {
> > -        values[i] = (code % levels) - offset;
> > -        code /= levels;
> > +        SDIVMOD(code, mod, code, levels);
> > +        values[i] = mod - offset;
> 
> this can be done faster with FASTDIV() id suspect

and even faster by adding a 7 entry table that contain the inverses
of abits_levels[]

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

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.
-------------- 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/20100412/67fac8bf/attachment.pgp>



More information about the ffmpeg-devel mailing list