mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
Clean up av_get_cpu_flag()
Instead of defining functions in per-arch header files included by the main cpu.c, define them normally and call them from the generic one. Originally committed as revision 25084 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
d222e9f9da
commit
9275438a19
@ -57,6 +57,10 @@ OBJS = adler32.o \
|
|||||||
tree.o \
|
tree.o \
|
||||||
utils.o \
|
utils.o \
|
||||||
|
|
||||||
|
OBJS-$(ARCH_ARM) += arm/cpu.o
|
||||||
|
OBJS-$(ARCH_PPC) += ppc/cpu.o
|
||||||
|
OBJS-$(ARCH_X86) += x86/cpu.o
|
||||||
|
|
||||||
TESTPROGS = adler32 aes base64 cpu crc des lls md5 pca sha softfloat tree
|
TESTPROGS = adler32 aes base64 cpu crc des lls md5 pca sha softfloat tree
|
||||||
TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
|
TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
|
||||||
|
|
||||||
|
@ -16,14 +16,10 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_ARM_CPU_H
|
#include "libavutil/cpu.h"
|
||||||
#define AVUTIL_ARM_CPU_H
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
int av_get_cpu_flags(void)
|
int ff_get_cpu_flags_arm(void)
|
||||||
{
|
{
|
||||||
return HAVE_IWMMXT * AV_CPU_FLAG_IWMMXT;
|
return HAVE_IWMMXT * AV_CPU_FLAG_IWMMXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* AVUTIL_ARM_CPU_H */
|
|
@ -19,18 +19,13 @@
|
|||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#if ARCH_ARM
|
|
||||||
# include "arm/cpu.h"
|
|
||||||
#elif ARCH_PPC
|
|
||||||
# include "ppc/cpu.h"
|
|
||||||
#elif ARCH_X86
|
|
||||||
# include "x86/cpu.h"
|
|
||||||
#else
|
|
||||||
int av_get_cpu_flags(void)
|
int av_get_cpu_flags(void)
|
||||||
{
|
{
|
||||||
|
if (ARCH_ARM) return ff_get_cpu_flags_arm();
|
||||||
|
if (ARCH_PPC) return ff_get_cpu_flags_ppc();
|
||||||
|
if (ARCH_X86) return ff_get_cpu_flags_x86();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TEST
|
#ifdef TEST
|
||||||
|
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#ifndef AVUTIL_CPU_H
|
#ifndef AVUTIL_CPU_H
|
||||||
#define AVUTIL_CPU_H
|
#define AVUTIL_CPU_H
|
||||||
|
|
||||||
#include "avutil.h"
|
|
||||||
|
|
||||||
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
|
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
|
||||||
|
|
||||||
/* lower 16 bits - CPU features */
|
/* lower 16 bits - CPU features */
|
||||||
@ -46,4 +44,9 @@
|
|||||||
*/
|
*/
|
||||||
int av_get_cpu_flags(void);
|
int av_get_cpu_flags(void);
|
||||||
|
|
||||||
|
/* The following CPU-specific functions shall not be called directly. */
|
||||||
|
int ff_get_cpu_flags_arm(void);
|
||||||
|
int ff_get_cpu_flags_ppc(void);
|
||||||
|
int ff_get_cpu_flags_x86(void);
|
||||||
|
|
||||||
#endif /* AVUTIL_CPU_H */
|
#endif /* AVUTIL_CPU_H */
|
||||||
|
@ -16,9 +16,6 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_PPC_CPU_H
|
|
||||||
#define AVUTIL_PPC_CPU_H
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#undef _POSIX_C_SOURCE
|
#undef _POSIX_C_SOURCE
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
@ -32,13 +29,14 @@
|
|||||||
#include <proto/exec.h>
|
#include <proto/exec.h>
|
||||||
#endif /* __APPLE__ */
|
#endif /* __APPLE__ */
|
||||||
|
|
||||||
|
#include "libavutil/cpu.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function MAY rely on signal() or fork() in order to make sure AltiVec
|
* This function MAY rely on signal() or fork() in order to make sure AltiVec
|
||||||
* is present.
|
* is present.
|
||||||
*/
|
*/
|
||||||
int av_get_cpu_flags(void)
|
int ff_get_cpu_flags_ppc(void)
|
||||||
{
|
{
|
||||||
#if HAVE_ALTIVEC
|
#if HAVE_ALTIVEC
|
||||||
#ifdef __AMIGAOS4__
|
#ifdef __AMIGAOS4__
|
||||||
@ -84,5 +82,3 @@ int av_get_cpu_flags(void)
|
|||||||
#endif /* HAVE_ALTIVEC */
|
#endif /* HAVE_ALTIVEC */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* AVUTIL_PPC_CPU_H */
|
|
@ -20,9 +20,6 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef AVUTIL_X86_CPU_H2
|
|
||||||
#define AVUTIL_X86_CPU_H2
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "libavutil/x86_cpu.h"
|
#include "libavutil/x86_cpu.h"
|
||||||
#include "libavutil/cpu.h"
|
#include "libavutil/cpu.h"
|
||||||
@ -38,7 +35,7 @@
|
|||||||
: "0" (index));
|
: "0" (index));
|
||||||
|
|
||||||
/* Function to test if multimedia instructions are supported... */
|
/* Function to test if multimedia instructions are supported... */
|
||||||
int av_get_cpu_flags(void)
|
int ff_get_cpu_flags_x86(void)
|
||||||
{
|
{
|
||||||
int rval = 0;
|
int rval = 0;
|
||||||
int eax, ebx, ecx, edx;
|
int eax, ebx, ecx, edx;
|
||||||
@ -124,5 +121,3 @@ int av_get_cpu_flags(void)
|
|||||||
|
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* AVUTIL_X86_CPU_H2 */
|
|
Loading…
x
Reference in New Issue
Block a user