[FFmpeg-devel] [PATCH] IFF demuxer and 8SVX decoder
Vitor Sessak
vitor1001
Fri Mar 28 18:50:16 CET 2008
Jai Menon wrote:
> On Thursday 27 March 2008 20:00:48 Michael Niedermayer wrote:
>> On Thu, Mar 27, 2008 at 11:48:10PM +0000, Jai Menon wrote:
>>> On Thursday 27 March 2008 15:23:54 Michael Niedermayer wrote:
>>>> On Thu, Mar 27, 2008 at 08:44:54PM +0000, Jai Menon wrote:
>>>>> On Wednesday 26 March 2008 21:12:26 Michael Niedermayer wrote:
>>>>>> uint8_t d = *buf++;
>>>>>>
>>>>>>> + esc->fib_acc += esc->table[d & 0x0f];
>>>>>>> + *out_data++ = esc->fib_acc << 8;
>>>>>>> + esc->fib_acc += esc->table[d >> 4];
>>>>>>> + *out_data++ = esc->fib_acc << 8;
>>>>>>> + }
>>>>>> you can do this with one subtraction and 2 shifts less
>>>>> I still don't know how i can eliminate the two shifts?
>>>> change the table ...
>>> I could change it to int16_t, and remove the 2 shifts.....but then i
>>> would need to clip twice before adding the table value to the
>>> accumulator......in which case imho we should stick to 2 shifts.
>> Why would you need to clip?
> Thats because the encoding scheme requires adding an 8 bit signed value (from
> the table) to fib_acc. So if we change the table size to int16_t , we could
> do away with the shifts but the value can't be directly added to fib_acc
> without clipping. the av_clip macro iirc uses comparisons. you could actually
> try making the change and running it on the compressed sample Dennis posted
> earlier on the list. Instead of the sound sample, you will get a highly
> distorted waveform which sounds nothing like the original sample.
>
>> + for(;buf_size>0;buf_size--) {
>> + uint8_t d = *buf++;
>> + esc->fib_acc += esc->table[d & 0x0f];
>> + *out_data++ = esc->fib_acc << 8;
>> + esc->fib_acc += esc->table[d >> 4];
>> + *out_data++ = esc->fib_acc << 8;
>> + }
>
>> this still does a unneeded subtraction besides the shifts
> where? is it buf_size-- ?
>
>
> other stuff should be fixed by the patch
Well, I've already asked once, but I'll ask again:
> +/**
> + * @file 8svx.c
> + * 8svx audio decoder
> + * @author Jaikrishnan Menon
> + * supports: fibonacci delta encoding
> + * : exponential encoding
> + */
> +
> +#include <stdio.h>
> +#include <stdlib.h>
Why are the two includes needed?
-Vitor
More information about the ffmpeg-devel
mailing list