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

Michael Niedermayer michaelni
Mon Apr 12 16:25:58 CEST 2010


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

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- 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/322753a4/attachment.pgp>



More information about the ffmpeg-devel mailing list