[FFmpeg-devel] [PATCH] WMA Voice postfilter

Ronald S. Bultje rsbultje
Thu Apr 1 17:25:25 CEST 2010


Hi Vitor,

On Thu, Apr 1, 2010 at 7:48 AM, Vitor Sessak <vitor1001 at gmail.com> wrote:
> Ronald S. Bultje wrote:
[..]
> It very likely still crashes with YASM enabled. You are still passing
> buffers to {D,RD}FT that has whatever random alignment the compiler decided
> to give them. You should move some buffers to the context and use
> DECLARE_ALIGNED(16, ...).

I'm probably asking silly questions here, but can I allocate aligned
memory on the stack? Or do they have to be in the struct?

(I'll test, but figured I'd ask before doing weird stuff since "it
doesn't crash" doesn't mean it's not wrong.)

>> + ? ?for (n = 0x3F; n > 0; n--) {
>> + ? ? ? ?float sin, cos;
>> +
>> + ? ? ? ?idx = av_clip((n & 1 ? -lpcs[64] : +lpcs[64]) - 2 * lpcs[n - 1],
>> -255, 255);
>> + ? ? ? ?if (idx >= 0) {
>> + ? ? ? ? ? ?sin = ?ff_sine_256[ ? ? ?idx];
>> + ? ? ? ? ? ?cos = ?ff_sine_256[255 - idx];
>> + ? ? ? ?} else {
>> + ? ? ? ? ? ?sin = -ff_sine_256[ ? ? -idx];
>> + ? ? ? ? ? ?cos = ?ff_sine_256[255 + idx];
>> + ? ? ? ?}
>> + ? ? ? ?coeffs[n * 2 + 1] = coeffs[n + 1] * sin;
>> + ? ? ? ?coeffs[n * 2] ? ? = coeffs[n + 1] * cos;
>> + ? ?}
>
> The branches are expensive and can be easily avoided with a bigger table and
> unrolling the loop once.

Improved that piece. The init code is a bit fuzzy because I now have
to set up the table myself (partially), I hope that's OK.

New patch will come after I fix alignment issues.

Ronald



More information about the ffmpeg-devel mailing list