[FFmpeg-devel] [PATCH] Common ACELP routines (2/3) - filters
Vladimir Voroshilov
voroshil
Sun Apr 27 07:02:01 CEST 2008
On Sun, Apr 27, 2008 at 5:08 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>
> On Sun, Apr 27, 2008 at 03:12:39AM +0700, Vladimir Voroshilov wrote:
[...]
> > +void ff_acelp_convolve_circ(
> > + int16_t* fc_out,
> > + const int16_t* fc_in,
> > + const int16_t* filter,
>
> > + int subframe_size)
> > +{
> > + int i, k;
> > +
> > + memset(fc_out, 0, subframe_size * sizeof(int16_t));
> > +
> > + for(i=0; i<subframe_size; i++)
> > + {
> > + if(fc_in[i])
> > + {
> > + for(k=0; k<i; k++)
> > + fc_out[k] += (fc_in[i] * filter[subframe_size + k - i]) >> 15;
> > +
> > + for(k=i; k<subframe_size; k++)
> > + fc_out[k] += (fc_in[i] * filter[k - i]) >> 15;
> > + }
> > + }
> > +}
>
> where is this used? I cant find it in g729dec_18.diff
You already asked me few mails ago.
This routines is used for AMR and G.729D
You agreed to keep it here.
> > +int ff_acelp_lp_synthesis_filter(
> > + int16_t *out,
>
> > + const int16_t* filter_coeffs,
> > + const int16_t* in,
> > + int buffer_length,
> > + int filter_length,
> > + int stop_on_overflow)
>
> > +{
> > + int i,n;
> > + int sum;
> > +
> > + for(n=0; n<buffer_length; n++)
> > + {
>
> > + sum = in[n] << 12;
> > + for(i=1; i<filter_length; i++)
> > + sum -= filter_coeffs[i] * out[n-i];
> > +
> > + sum = (sum + 0x800) >> 12;
>
> sum= 0x800;
> for(i=1; i<filter_length; i++)
> sum -= filter_coeffs[i] * out[n-i];
> sum = (sum >> 12) + in[n];
Fixed.
> [...]
> > +void ff_acelp_weighted_filter(
> > + int16_t *out,
> > + const int16_t* in,
> > + int16_t weight,
> > + int filter_length)
> > +{
> > + int weight_pow = 1 << 15;
> > + int n;
> > +
> > + for(n=0; n<filter_length; n++)
> > + {
>
> > + // (0.15) * (3.12) -> (3.12) with rounding
>
> please write the comment in the same order as the calculation:
> (3.12) = (0.15) * (3.12) or whatever
Here and in another places (like recently committed lsp.c) such comment
describes right side of expression only and "->" in it means change of the
fixed-point base (right shift in this particular case)
Comment should be read as "multiply (0.15) by (3.12) and then scale
result to (3.12)"
Thus comment and calculation order corresponds each other, imho.
I've changed comment to "(0.15)*(3.12) and (3.27) -> (3.12) with rounding"
Is this better or i still need to change comments everywhere (and in
lsp.c too) ?
--
Regards,
Vladimir Voroshilov mailto:voroshil at gmail.com
JID: voroshil at gmail.com, voroshil at jabber.ru
ICQ: 95587719
-------------- next part --------------
A non-text attachment was scrubbed...
Name: acelp_filt_35.diff
Type: text/x-diff
Size: 12312 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080427/d4494f92/attachment.diff>
More information about the ffmpeg-devel
mailing list