chromium/third_party/ffmpeg/libavutil/cpu.h

/*
 * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * FFmpeg is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef AVUTIL_CPU_H
#define AVUTIL_CPU_H

#include <stddef.h>

#define AV_CPU_FLAG_FORCE

    /* lower 16 bits - CPU features */
#define AV_CPU_FLAG_MMX
#define AV_CPU_FLAG_MMXEXT
#define AV_CPU_FLAG_MMX2
#define AV_CPU_FLAG_3DNOW
#define AV_CPU_FLAG_SSE
#define AV_CPU_FLAG_SSE2
#define AV_CPU_FLAG_SSE2SLOW
                                        ///< than regular MMX/SSE (e.g. Core1)
#define AV_CPU_FLAG_3DNOWEXT
#define AV_CPU_FLAG_SSE3
#define AV_CPU_FLAG_SSE3SLOW
                                        ///< than regular MMX/SSE (e.g. Core1)
#define AV_CPU_FLAG_SSSE3
#define AV_CPU_FLAG_SSSE3SLOW
#define AV_CPU_FLAG_ATOM
#define AV_CPU_FLAG_SSE4
#define AV_CPU_FLAG_SSE42
#define AV_CPU_FLAG_AESNI
#define AV_CPU_FLAG_AVX
#define AV_CPU_FLAG_AVXSLOW
#define AV_CPU_FLAG_XOP
#define AV_CPU_FLAG_FMA4
#define AV_CPU_FLAG_CMOV
#define AV_CPU_FLAG_AVX2
#define AV_CPU_FLAG_FMA3
#define AV_CPU_FLAG_BMI1
#define AV_CPU_FLAG_BMI2
#define AV_CPU_FLAG_AVX512
#define AV_CPU_FLAG_AVX512ICL
#define AV_CPU_FLAG_SLOW_GATHER

#define AV_CPU_FLAG_ALTIVEC
#define AV_CPU_FLAG_VSX
#define AV_CPU_FLAG_POWER8

#define AV_CPU_FLAG_ARMV5TE
#define AV_CPU_FLAG_ARMV6
#define AV_CPU_FLAG_ARMV6T2
#define AV_CPU_FLAG_VFP
#define AV_CPU_FLAG_VFPV3
#define AV_CPU_FLAG_NEON
#define AV_CPU_FLAG_ARMV8
#define AV_CPU_FLAG_VFP_VM
#define AV_CPU_FLAG_DOTPROD
#define AV_CPU_FLAG_I8MM
#define AV_CPU_FLAG_SETEND

#define AV_CPU_FLAG_MMI
#define AV_CPU_FLAG_MSA

//Loongarch SIMD extension.
#define AV_CPU_FLAG_LSX
#define AV_CPU_FLAG_LASX

// RISC-V extensions
#define AV_CPU_FLAG_RVI
#define AV_CPU_FLAG_RVF
#define AV_CPU_FLAG_RVD
#define AV_CPU_FLAG_RVV_I32
#define AV_CPU_FLAG_RVV_F32
#define AV_CPU_FLAG_RVV_I64
#define AV_CPU_FLAG_RVV_F64
#define AV_CPU_FLAG_RVB_BASIC
#define AV_CPU_FLAG_RVB_ADDR
#define AV_CPU_FLAG_RV_ZVBB
#define AV_CPU_FLAG_RV_MISALIGNED

/**
 * Return the flags which specify extensions supported by the CPU.
 * The returned value is affected by av_force_cpu_flags() if that was used
 * before. So av_get_cpu_flags() can easily be used in an application to
 * detect the enabled cpu flags.
 */
int av_get_cpu_flags(void);

/**
 * Disables cpu detection and forces the specified flags.
 * -1 is a special case that disables forcing of specific flags.
 */
void av_force_cpu_flags(int flags);

/**
 * Parse CPU caps from a string and update the given AV_CPU_* flags based on that.
 *
 * @return negative on error.
 */
int av_parse_cpu_caps(unsigned *flags, const char *s);

/**
 * @return the number of logical CPU cores present.
 */
int av_cpu_count(void);

/**
 * Overrides cpu count detection and forces the specified count.
 * Count < 1 disables forcing of specific count.
 */
void av_cpu_force_count(int count);

/**
 * Get the maximum data alignment that may be required by FFmpeg.
 *
 * Note that this is affected by the build configuration and the CPU flags mask,
 * so e.g. if the CPU supports AVX, but libavutil has been built with
 * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through
 *  av_set_cpu_flags_mask(), then this function will behave as if AVX is not
 *  present.
 */
size_t av_cpu_max_align(void);

#endif /* AVUTIL_CPU_H */