[FFmpeg-devel] AMR-NB decoder

Michael Niedermayer michaelni
Thu Aug 13 18:22:39 CEST 2009


On Thu, Aug 13, 2009 at 09:35:49AM +0100, Colin McQuillan wrote:
> 2009/8/13 Michael Niedermayer <michaelni at gmx.at>:
> > On Wed, Aug 12, 2009 at 09:54:14PM +0100, Colin McQuillan wrote:
> >> 2009/8/12 Robert Swain <robert.swain at gmail.com>:
> >> > Hey,
> >> >
> >> > 2009/8/10 Colin McQuillan <m.niloc at googlemail.com>:
> >> >
> >> > [...]
> >> >
> >> >> I have tried to address every other comment made in the thread. The
> >> >> main changes are cosmetics, using fixed point tables to save space,
> >> >> and keeping the algebraic codebook vector sparse until
> >> >> anti_sparseness.
> >> >>
> >> >> amrnb-decoder-r2.patch uses high-pass-filterf.patch, agc-3.patch, and
> >> >> circ-addf.patch.
> >> >
> >> > circ-addf committed after editing the comments a little and discussing
> >> > them with Colin on IRC. I think maybe the high-pass filter should be
> >> > made at least somewhat generic as the missing QCELP postfilter uses a
> >> > filter that is the same order but with different coefficients. I think
> >> > using the stuff from iirfilter.{c,h} would be overkill for this
> >> > purpose. I'm discussing this with Colin too.
> >> >
> >> > Regards,
> >> > Rob
> >>
> >> Here's a more general ff_acelp_high_pass_filterf.
> >
> >> ?acelp_filters.c | ? 18 ++++++++++++++++++
> >> ?acelp_filters.h | ? 16 ++++++++++++++++
> >> ?2 files changed, 34 insertions(+)
> >> f3c59c35439591944d3e0db69adc7158ecfd1abf ?high-pass-filterf-2.patch
> >> Index: libavcodec/acelp_filters.c
> >> ===================================================================
> >> --- libavcodec/acelp_filters.c ? ? ? ?(revision 19634)
> >> +++ libavcodec/acelp_filters.c ? ? ? ?(working copy)
> >> @@ -93,3 +93,21 @@
> >> ? ? ? ? ?hpf_f[0] = tmp;
> >> ? ? ?}
> >> ?}
> >> +
> >> +void ff_acelp_high_pass_filterf(float *buf,
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const float zero_coeffs[2],
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?const float pole_coeffs[2],
> >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?float gain, float mem[2], int n)
> >> +{
> >> + ? ?int i;
> >> + ? ?float tmp;
> >> +
> >> + ? ?for (i = 0; i < n; i++) {
> >
> >> + ? ? ? ? tmp = buf[i] - pole_coeffs[0] * mem[0] - pole_coeffs[1] * mem[1];
> >> + ? ? ? ? buf[i] = tmp + zero_coeffs[0] * mem[0] + zero_coeffs[1] * mem[1];
> >> + ? ? ? ? buf[i] *= gain;
> >
> > float tmp= gain*buf[i] - pole_coeffs[0] * mem[0] - pole_coeffs[1] * mem[1];
> > buf[i] ? = ? ? ? ? tmp + zero_coeffs[0] * mem[0] + zero_coeffs[1] * mem[1];
> 
> Ok.
> 
> >
> > and yes iam in favor of such a generic function
> >
> > [...]
> >
> >> Index: libavcodec/acelp_filters.h
> >> ===================================================================
> >> --- libavcodec/acelp_filters.h ? ? ? ?(revision 19634)
> >> +++ libavcodec/acelp_filters.h ? ? ? ?(working copy)
> >> @@ -81,4 +81,20 @@
> >> ?void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2],
> >> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? const int16_t* in, int length);
> >>
> >> +/**
> >> + * Apply an order 2 rational transfer function in-place.
> >> + *
> >> + * @param samples [in/out]
> >> + * @param zero_coeffs z^-1 and z^-2 coefficients of the numerator
> >> + * @param pole_coeffs z^-1 and z^-2 coefficients of the denominator
> >> + * @param gain scale factor for final output
> >> + * @param mem intermediate values used by filter (should be 0 initially)
> >> + * @param n number of samples
> >> + */
> >> +void ff_acelp_high_pass_filterf(float *samples,
> >
> > i think the name is very poor because it describes the current use of
> > the function and not what the function does
> > (i mean its like find_length_of_square_from_area() vs. sqrt())
> 
> Changed to ff_acelp_apply_order_2_transfer_function.

>  acelp_filters.c |   17 +++++++++++++++++
>  acelp_filters.h |   16 ++++++++++++++++
>  2 files changed, 33 insertions(+)
> 7ceea8515e5f33bbd1ee4d8cde9c99ba47477ac9  order-2-transfer-function.patch

ok

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

> ... defining _GNU_SOURCE...
For the love of all that is holy, and some that is not, don't do that.
-- Luca & Mans
-------------- 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/20090813/6ecddc6d/attachment.pgp>



More information about the ffmpeg-devel mailing list