[FFmpeg-devel] [PATCH] adpcm swf encoder step index fix

Benjamin Larsson banan
Wed Jul 18 20:55:26 CEST 2007


Baptiste Coudurier wrote:
> Hi
> 
> It seems step index should be clipped instead of truncated. You can hear
> it easily.
> 
> I dunno why first step_index is 6 bits only while during encoding step
> index can go up to 88 (checked on genuine flv with adpcm).
> 
> 
> 
> ------------------------------------------------------------------------
> 
> Index: libavcodec/adpcm.c
> ===================================================================
> --- libavcodec/adpcm.c	(revision 9440)
> +++ libavcodec/adpcm.c	(working copy)
> @@ -525,8 +531,9 @@
>  
>          //Init the encoder state
>          for(i=0; i<avctx->channels; i++){
> +            c->status[i].step_index = av_clip(c->status[i].step_index, 0, 63); // clip step so it fits 6 bits
>              put_bits(&pb, 16, samples[i] & 0xFFFF);
> -            put_bits(&pb, 6, c->status[i].step_index & 0x3F);
> +            put_bits(&pb, 6, c->status[i].step_index);
>              c->status[i].prev_sample = (signed short)samples[i];
>          }
>  

Applied both flash swf patches.

/Benajmin




More information about the ffmpeg-devel mailing list