mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-15 19:40:07 +01:00
cpu: add a function for querying maximum required data alignment
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdatomic.h>
|
||||
|
||||
@@ -180,3 +181,15 @@ int av_cpu_count(void)
|
||||
|
||||
return nb_cpus;
|
||||
}
|
||||
|
||||
size_t av_cpu_max_align(void)
|
||||
{
|
||||
int flags = av_get_cpu_flags();
|
||||
|
||||
if (flags & AV_CPU_FLAG_AVX)
|
||||
return 32;
|
||||
if (flags & (AV_CPU_FLAG_ALTIVEC | AV_CPU_FLAG_SSE | AV_CPU_FLAG_NEON))
|
||||
return 16;
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user