[FFmpeg-devel] [PATCH] Long-term prediction for ALS

Stefano Sabatini stefano.sabatini-lala
Thu Nov 12 16:45:59 CET 2009


On date Thursday 2009-11-12 16:37:04 +0100, Thilo Borgmann encoded:
> Hi,
> 
> this patch adds long-term prediction to the ALS decoder.
[...]
> Index: libavcodec/alsdec.c
> ===================================================================
> --- libavcodec/alsdec.c	(revision 20525)
> +++ libavcodec/alsdec.c	(working copy)
[...]
> @@ -949,6 +991,14 @@
>          avctx->bits_per_raw_sample = (sconf->resolution + 1) * 8;
>      }
>  
> +    // set lag value for long-term prediction
> +    if      (avctx->sample_rate >= 192000)
> +        ctx->ltp_lag_length = 10;
> +    else if (avctx->sample_rate >=  96000)
> +        ctx->ltp_lag_length = 9;
> +    else
> +        ctx->ltp_lag_length = 8;
> +

Slightly simpler:

ctx->ltp_lag_length = avctx->sample_rate >= 192000 ? 10 :
                      avctx->sample_rate >=  96000 ?  9 : 8;

[...]

Regards.
-- 
FFmpeg = Foolish Faithful Mysterious Proud Elected Gymnast



More information about the ffmpeg-devel mailing list