[Ffmpeg-devel] [Patch] Add Yamaha ADPCM encoding/decoding
Michael Niedermayer
michaelni
Fri Jul 15 02:05:34 CEST 2005
Hi
On Thursday 14 July 2005 23:27, Vidar Madsen wrote:
> Hi.
>
> Attached is a patch that adds Yamaha ADPCM support to libavcodec. This
> is a rather simple codec that is used in ring tones in some phones,
> and is typically found in "Yamaha SMAF" files (*.mmf).
>
> There's some hype to be read at: http://smaf-yamaha.com/
>
> I'm working on adding basic SMAF reading/writing to libavformat
> (almost done), and until then it's hard to test the codec. But I added
> a tag to wav.c to test it, and both encoding and decoding worked fine.
>
> Comments?
[...]
> static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c,
unsigned char nibble)
> {
> if(!c->coeff2) {
> c->coeff1 = 0;
> c->coeff2 = 127;
> }
>
> c->coeff1 += (c->coeff2 * yamaha_difflookup[nibble]) / 8;
> c->coeff1 = clip(c->coeff1, -32768, 32767);
> c->coeff2 = (c->coeff2 * yamaha_indexscale[nibble]) >> 8;
> c->coeff2 = clip(c->coeff2, 127, 24567);
> return c->coeff1;
missuse of variables, please change:
c->coeff1 -> c->predictor or c->sample1
c->coeff2 -> c->step or c->idelta
> c->coeff1 = clip(c->coeff1, -32768, 32767);
CLAMP_TO_SHORT()
[...]
--
Michael
More information about the ffmpeg-devel
mailing list