[FFmpeg-devel] AMR-NB decoder

Colin McQuillan m.niloc
Sat Aug 8 17:09:39 CEST 2009


2009/8/8 Michael Niedermayer <michaelni at gmx.at>:
> On Fri, Aug 07, 2009 at 08:23:53PM +0100, Colin McQuillan wrote:
>> 2009/8/6 Michael Niedermayer <michaelni at gmx.at>:
>> > On Wed, Aug 05, 2009 at 05:51:36PM +0100, Colin McQuillan wrote:
>> >> Attached is a patch for an AMR-NB decoder.

[...]

>> > that should e a seperate patch
>>
>> I'll leave this one until I investigate a version for sparse vectors. Attached:
>>
>> 1. Helper functions for gain control in floating-point codecs
>> I couldn't find a similar fixed point function to copy the function name.
>>
>> 2. Floating-point version of ff_acelp_high_pass_filter
>
>> ?acelp_vectors.c | ? 22 ++++++++++++++++++++++
>> ?acelp_vectors.h | ? 27 +++++++++++++++++++++++++++
>> ?2 files changed, 49 insertions(+)
>> f1abbee9b62c1779fd5fb1c634d4ab4294d8611d ?get-set-energyf.patch
>> Index: libavcodec/acelp_vectors.c
>> ===================================================================
>> --- libavcodec/acelp_vectors.c ? ? ? ?(revision 19606)
>> +++ libavcodec/acelp_vectors.c ? ? ? ?(working copy)
>> @@ -155,3 +155,25 @@
>> ? ? ? ? ?out[i] = weight_coeff_a * in_a[i]
>> ? ? ? ? ? ? ? ? + weight_coeff_b * in_b[i];
>> ?}
>> +
>> +float ff_energyf(const float *v, int length)
>> +{
>> + ? ?float sum = 0;
>> + ? ?int i;
>> +
>> + ? ?for (i = 0; i < length; i++)
>> + ? ? ? ?sum += v[i] * v[i];
>> +
>> + ? ?return sum;
>> +}
>
> ff_dot_productf)(

Do you mean that ff_energyf is redundant? I've taken it out.

>
>
>> +
>> +void ff_set_energyf(float *v_out, const float *v_in, float energy,
>> + ? ? ? ? ? ? ? ? ? ?const int length)
>> +{
>> + ? ?int i;
>> + ? ?float scalefactor = ff_energyf(v_in, length);
>> + ? ?if (scalefactor)
>> + ? ? ? ?scalefactor = sqrt(energy / scalefactor);
>> + ? ?for (i = 0; i < length; i++)
>> + ? ? ? ?v_out[i] = v_in[i] * scalefactor;
>> +}
>
> somehow this looks similar to apply_gain_ctrl() in qcelp

It is meant to be useful to any gain control procedure. Attached patch
is ff_set_energyf + qcelpdec changes. I tested on "tube.3g2" and
16-bit output only changes by +/- 1.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: agc.patch
Type: text/x-diff
Size: 3365 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090808/d3683f1b/attachment.patch>



More information about the ffmpeg-devel mailing list