[FFmpeg-devel] [PATCH] WMA Voice postfilter

Ronald S. Bultje rsbultje
Thu Mar 18 22:02:35 CET 2010


Hi,

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
>> this
>> + ? ? * is a sinus input) by doing a phase shift (in theory,
>> H(sin())=cos()).
>> + ? ? * Because input is symmetric (mirror above), every im[n] is zero. */
>> + ? ?ff_rdft_calc(&s->rdft, &lpcs[1]);
>> + ? ?lpcs[1] = lpcs[2];
>> + ? ?lpcs[2] = lpcs[0] = 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?

>> +static void postfilter(WMAVoiceContext *s, const float *synth,
>> + ? ? ? ? ? ? ? ? ? ? ? float *samples, ? ?int size,
>> + ? ? ? ? ? ? ? ? ? ? ? const float *lpcs, float *zero_exc_pf,
>> + ? ? ? ? ? ? ? ? ? ? ? int fcb_type, ? ? ?int pitch)
>
> size is always 80, so it's better to fix it with a define.

That's only for now... I could change it later, and in fact have
tested with size=40/20, which gives pretty good results also. The idea
here could be to eventually add this in the block-loop, rather than
after synthesis of all blocks, in theory this'd generate better cache
usage (?).

> I'll give a second look at it later when I have the time.

Thanks!

Ronald



More information about the ffmpeg-devel mailing list