[FFmpeg-devel] [PATCH] One more shared func for SIPR and AMR

Michael Niedermayer michaelni
Thu Nov 12 23:42:11 CET 2009


On Wed, Nov 11, 2009 at 06:03:40PM +0100, Vitor Sessak wrote:
> $subj.
>
> -Vitor

>  acelp_pitch_delay.c |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  acelp_pitch_delay.h |   18 ++++++++++++++++++
>  2 files changed, 66 insertions(+)
> e0460b2f9e7167632ea6c730a18eb19f8b71e2f9  pitch_lag.diff
> Index: libavcodec/acelp_pitch_delay.c
> ===================================================================
> --- libavcodec/acelp_pitch_delay.c	(revision 20431)
> +++ libavcodec/acelp_pitch_delay.c	(working copy)
> @@ -140,3 +140,51 @@
>  
>      return val;
>  }
> +
> +void ff_decode_pitch_lag(int *lag_int, int *lag_frac, int pitch_index,
> +                         const int prev_lag_int, const int subframe,
> +                         int third_as_first, int resolution)
> +{
> +    /* Note n * 10923 >> 15 is floor(x/3) for 0 <= n <= 32767 */
> +    if (subframe == 0 ||
> +        (subframe == 2 && third_as_first)) {
> +        if (pitch_index < 197) {
> +            *lag_int  = (pitch_index + 59) * 10923 >> 15;
> +            *lag_frac = pitch_index - *lag_int * 3 + 58;
> +        } else {
> +            *lag_int  = pitch_index - 112;
> +            *lag_frac = 0;
> +        }

maybe this function could be clearer if the int/frac split was factored out
and done at the end?
above could be something like:

if(pitch_index < 197) pitch_index += 59
else                  pitch_index = 3*pitch_index - 335

*lag_int  = pitch_index * 10923 >> 15;
*lag_frac = pitch_index - *lag_int * 3 - 1;

but this of course makes only sense if its not meassureable slower in
reality and actually clearer

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

Thouse who are best at talking, realize last or never when they are wrong.
-------------- 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/20091112/e7f14348/attachment.pgp>



More information about the ffmpeg-devel mailing list