[FFmpeg-devel] [PATCH] cpu: add a function for querying maximum required data alignment

Hendrik Leppkes h.leppkes at gmail.com
Sat Sep 2 21:48:08 EEST 2017


On Sat, Sep 2, 2017 at 8:29 PM, Clément Bœsch <u at pkh.me> wrote:
> On Sat, Sep 02, 2017 at 02:07:01PM -0300, James Almer wrote:
> [...]
>> +size_t av_cpu_max_align(void)
>> +{
>> +    int av_unused flags = av_get_cpu_flags();
>> +
>> +#if ARCH_ARM || ARCH_AARCH64
>> +    if (flags & AV_CPU_FLAG_NEON)
>> +        return 16;
>> +#elif ARCH_PPC
>> +    if (flags & AV_CPU_FLAG_ALTIVEC)
>> +        return 16;
>
>> +#elif ARCH_X86
>> +    if (flags & AV_CPU_FLAG_AVX)
>> +        return 32;
>> +    if (flags & AV_CPU_FLAG_SSE)
>> +        return 16;
>> +#endif
>
> mmh, will this really work in FFmpeg? I think we have a difference related
> to the flags dependency. Typically, if having SSE2 doesn't imply you have
> SSE. I think you may want to extend the mask.
>
>

If we do, we should really get rid of supporting that. Its really not
very meaningful to select say SSSE3 but not SSE2. SSSE3 flagged
functions are still going to use the majority of SSE2 instructions,
and so on.
If you unselect MMX, I would wager a bunch of checks all over fall
over and fail on you. :p

- Hendrik


More information about the ffmpeg-devel mailing list