[FFmpeg-devel] [PATCH] DCA: use FASTDIV in decode_blockcode()

Måns Rullgård mans
Mon Apr 12 18:05:44 CEST 2010


Kostya <kostya.shishkov at gmail.com> writes:

> 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

Applied.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list