[FFmpeg-devel] [PATCH] trellis quantization support for adpcm_swf

Michael Niedermayer michaelni
Sun Aug 19 22:16:59 CEST 2007


Hi

On Sun, Aug 19, 2007 at 06:04:47PM +0200, Benjamin Larsson wrote:
> This patch adds trellis quantization for the flv/swf adpcm variant. And
> it closes issue 79 in the issue tracker.
> 
> With a random test file I get these benchmarks:
> 
> without trellis:
> stddev: 87.04 PSNR:57.52
> 
> trellis level 1:
> stddev: 81.96 PSNR:58.05
> 
> trellis level 5:
> stddev: 70.96 PSNR:59.30

very nice


[...]
> @@ -537,10 +539,22 @@
>              c->status[i].prev_sample = (signed short)samples[i];
>          }
>  
> -        for (i=1; i<avctx->frame_size; i++) {
> -            put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels*i]) & 0xF);
> +        if(avctx->trellis > 0) {
> +            uint8_t buf[2][n];
> +            adpcm_compress_trellis(avctx, samples+2, buf[0], &c->status[0], n);
>              if (avctx->channels == 2)
> -                put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[1], samples[2*i+1]) & 0xF);
> +                adpcm_compress_trellis(avctx, samples+3, buf[1], &c->status[1], n);
> +            for(i=0; i<n; i++) {
> +                put_bits(&pb, 4, buf[0][i]);
> +                if (avctx->channels == 2)
> +                    put_bits(&pb, 4, buf[1][i]);
> +            }
> +        } else {
> +            for (i=1; i<avctx->frame_size; i++) {
> +                put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0], samples[avctx->channels*i]) & 0xF);
> +                if (avctx->channels == 2)
> +                    put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[1], samples[2*i+1]) & 0xF);
> +            }
>          }

please seperate the reindention of the no trellis code from the
functional changes

besides this iam ok with the patch

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070819/0b909173/attachment.pgp>



More information about the ffmpeg-devel mailing list