[FFmpeg-devel] [PATCH] DCA: use FASTDIV in decode_blockcode()
Kostya
kostya.shishkov
Mon Apr 12 17:56:07 CEST 2010
On Mon, Apr 12, 2010 at 04:40:40PM +0100, Mans Rullgard wrote:
> ---
> libavcodec/dca.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/dca.c b/libavcodec/dca.c
> index 79ea373..8db25fd 100644
> --- a/libavcodec/dca.c
> +++ b/libavcodec/dca.c
> @@ -30,6 +30,7 @@
> #include <stddef.h>
> #include <stdio.h>
>
> +#include "libavutil/intmath.h"
> #include "libavutil/intreadwrite.h"
> #include "avcodec.h"
> #include "dsputil.h"
> @@ -907,8 +908,9 @@ static int decode_blockcode(int code, int levels, int *values)
> int offset = (levels - 1) >> 1;
>
> for (i = 0; i < 4; i++) {
> - values[i] = (code % levels) - offset;
> - code /= levels;
> + int div = FASTDIV(code, levels);
> + values[i] = code - offset - div*levels;
> + code = div;
> }
>
> if (code == 0)
looks ok
More information about the ffmpeg-devel
mailing list