[FFmpeg-devel] [PATCH] Add functions shared by AMR and SIPR

Michael Niedermayer michaelni
Sun Oct 25 19:44:56 CET 2009


On Sun, Oct 25, 2009 at 01:09:10AM +0200, Vitor Sessak wrote:
> Ronald S. Bultje wrote:
>> Hi,
>> On Sun, Oct 18, 2009 at 7:41 PM, Vitor Sessak <vitor1001 at gmail.com> wrote:
>>> The SIPR decoder shares quite a few code with AMR. Most of those 
>>> functions
>>> are copied from the last AMR patch in -devel. An exception is
>>> ff_acelp_interpolatef(), that was copied from a fixed-point version and 
>>> is
>>> used in AMR in the function interp_pitch_vector().
>> [..]
>>> +void ff_set_max_dist_lsf(float *lsf, float min_spacing, int size)
>>> +{
>>> +    int i;
>>> +    float prev = 0.0;
>>> +    for (i = 0; i < size; i++)
>>> +        prev = lsf[i] = FFMAX(lsf[i], prev + min_spacing);
>>> +}
>> ff_set_min_dist_lsf().
>
> Changed that and Diego's cosmetics in the new version. Michael, ping?
[...]
> @@ -155,3 +156,22 @@
>          out[i] = weight_coeff_a * in_a[i]
>                 + weight_coeff_b * in_b[i];
>  }
> +
> +void ff_adaptative_gain_control(float *buf_out, float speech_energ,
> +                                int size, float alpha, float *gain_mem)
> +{
> +    int i;
> +    float postfilter_energ = ff_dot_productf(buf_out, buf_out, 48);
> +    float gain_scale_factor = 1.0;
> +    float mem = *gain_mem;
> +
> +    if (postfilter_energ)
> +        gain_scale_factor = sqrt(speech_energ / postfilter_energ);
> +

> +    for (i = 0; i < size; i++) {
> +        mem = alpha * mem + (1.0 - alpha) * gain_scale_factor;

(1.0 - alpha) * gain_scale_factor
can be factored out, not sure if gcc does that on its own

except that, i leave further review of this to the maintainers of the
respective audio codecs involved in this, they are in a better position
to review this.

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

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- 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/20091025/0eed9438/attachment.pgp>



More information about the ffmpeg-devel mailing list