[FFmpeg-devel] [PATCH 2/3] lavc: add a framework to fix alignment problems.

Hendrik Leppkes h.leppkes at gmail.com
Sun May 7 18:15:51 EEST 2017


On Sat, May 6, 2017 at 8:34 PM, Nicolas George <george at nsup.org> wrote:
>
> Encouraging the applications to be aware of the issue for performances
> reasons is a good thing.
>
> Forcing them to do so when it is not convenient, on pain of crash, when
> it can be done for them just as easily, not so much.
>
>> There is no particular reason we can't make the framework check the
>> alignment and re-align if required to the maximum CPU value (with a
>> loud warning, perhaps), but I don't think a per-codec or per-filter
>> alignment value is very practical.
>
> If the framework does the realigning, doing it per-codec or per-filter
> is almost free. And someone really smart said that "since re-aligning
> can be extremely expensive" it "should be avoided at all cost if
> possible", doing the realigning only if the codecs needs it is really
> the right thing to do.
>

One of my main concerns is that FATE will not actually be testing any
of this (otherwise it would be crashing right now), and as such it can
(and we all know, will) lead to subtle bugs that only occur with
certain callers on certain platforms.
This is usually not a very good situation to be in.

Ronald suggested on IRC that the only parts suffering from this are
the ASM DSP components, and we should just make checkasm tests for all
of them and let checkasm test the alignment they claim to support, but
alas this won't be done for months, if not years.
There is potentially nothing wrong with supporting per-codec values in
the framework, but setting them to something lower then the global
alignment (ie. 32-byte) should only be done if we have sufficient
automated testing to ensure this value is and remains correct.

- Hendrik


More information about the ffmpeg-devel mailing list