[FFmpeg-devel] [PATCH] WMA Voice postfilter
Thu Mar 18 23:52:27 CET 2010
Ronald S. Bultje wrote:
> On Thu, Mar 18, 2010 at 4:33 PM, Vitor Sessak <vitor1001 at gmail.com> wrote:
>> Small problem:
>>> Hunk #8 FAILED at 1517.
> Yes, that's the patch that removes clipping which is before this patch
> in my tree. Sorry about that. Should be easy to manually get to work
> for those wanting to play around.
>> I would add a
>> /* postfilter specific */
>> comment to separate it from the other global values.
> OK, done locally.
>>> + speech_energy += fabs(speech_synth[i]);
>>> + postfilter_energy += fabs(buf_out[i]);
>> fabsf() is probably faster on x64.
> Done, again locally.
>>> + /* calculate the Hilbert transform of the gains, which we do (since
>>> + * is a sinus input) by doing a phase shift (in theory,
>>> + * Because input is symmetric (mirror above), every im[n] is zero. */
>>> + ff_rdft_calc(&s->rdft, &lpcs);
>>> + lpcs = lpcs;
>>> + lpcs = lpcs = 0;
>>> + ff_rdft_calc(&s->irdft, lpcs);
>> I think this deserve to be in a separate function (and that would include
>> the mirroring), it could be reused in case we need a Hilbert transform in
>> another codec. Also I think it should be possible to do it with a half as
>> big FFT...
> Hm. That's a good idea. Now, I can't assume input to be aligned or
> padded, so that'd add an extra memcpy, is that OK?
I didn't mean to make it a shared function, but just move the code in
its own function, so when any other codec need it will be trivial to
make it public. So IMHO you can just assume whatever alignment/padding
is needed (but document it).
Also, you do both
> + ff_rdft_calc(&s->rdft, &lpcs);
> + ff_rdft_calc(&s->irdft, lpcs);
Since either &lpcs or lpcs will be unaligned this code will segfault
when compiled with YASM assembly enabled. But there is no point in
fixing this before looking in a way to do the Hilbert transform with a
buffer half the size. I'll give a look this weekend if I have time.
More information about the ffmpeg-devel