[FFmpeg-devel] [PATCH] use bytestream functions more in adpcm.c
Måns Rullgård
mans
Sat Jul 12 15:45:57 CEST 2008
Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:
> Hello,
> seems there is some ancient and horribly obfuscated code in there.
> Attached patch replaces most (all?) of them.
> Regression tests succeed, but I only manually tested on MS ADPCM sample.
> Btw. is that file indeed unmaintained?
>
> Greetings,
> Reimar D?ffinger
>
> Index: libavcodec/adpcm.c
> ===================================================================
> --- libavcodec/adpcm.c (revision 14175)
> +++ libavcodec/adpcm.c (working copy)
> @@ -972,8 +972,7 @@
>
> for(i=0; i<avctx->channels; i++){
> cs = &(c->status[i]);
> - cs->predictor = *samples++ = (int16_t)(src[0] + (src[1]<<8));
> - src+=2;
> + cs->predictor = *samples++ = (int16_t)bytestream_get_le16(&src);
Useless cast.
> cs->step_index = *src++;
> if (cs->step_index > 88){
> @@ -996,13 +995,13 @@
> break;
> case CODEC_ID_ADPCM_4XM:
> cs = &(c->status[0]);
> - c->status[0].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2;
> + c->status[0].predictor= (int16_t)bytestream_get_le16(&src);
Useless cast.
> if(st){
> - c->status[1].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2;
> + c->status[1].predictor= (int16_t)bytestream_get_le16(&src);
Again...
Just get rid of them all.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list