mirror of https://github.com/FFmpeg/FFmpeg.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.9 KiB
67 lines
1.9 KiB
12 years ago
|
/*
|
||
12 years ago
|
* This file is part of FFmpeg.
|
||
12 years ago
|
*
|
||
12 years ago
|
* FFmpeg is free software; you can redistribute it and/or
|
||
12 years ago
|
* 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.
|
||
|
*
|
||
12 years ago
|
* FFmpeg is distributed in the hope that it will be useful,
|
||
12 years ago
|
* 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
|
||
12 years ago
|
* License along with FFmpeg; if not, write to the Free Software
|
||
12 years ago
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||
|
*/
|
||
|
|
||
1 year ago
|
#ifndef AVUTIL_EMMS_H
|
||
|
#define AVUTIL_EMMS_H
|
||
12 years ago
|
|
||
12 years ago
|
#include "config.h"
|
||
|
#include "libavutil/attributes.h"
|
||
|
|
||
1 year ago
|
#if ARCH_X86
|
||
|
|
||
8 years ago
|
void avpriv_emms_asm(void);
|
||
12 years ago
|
|
||
12 years ago
|
#if HAVE_MMX_INLINE
|
||
3 years ago
|
#ifndef __MMX__
|
||
|
#include "libavutil/cpu.h"
|
||
|
#endif
|
||
|
|
||
12 years ago
|
# define emms_c emms_c
|
||
12 years ago
|
/**
|
||
|
* Empty mmx state.
|
||
|
* this must be called between any dsp function and float/double code.
|
||
|
* for example sin(); dsp->idct_put(); emms_c(); cos()
|
||
8 years ago
|
* Note, *alloc() and *free() also use float code in some libc implementations
|
||
|
* thus this also applies to them or any function using them.
|
||
12 years ago
|
*/
|
||
|
static av_always_inline void emms_c(void)
|
||
|
{
|
||
9 years ago
|
/* Some inlined functions may also use mmx instructions regardless of
|
||
|
* runtime cpuflags. With that in mind, we unconditionally empty the
|
||
|
* mmx state if the target cpu chosen at configure time supports it.
|
||
|
*/
|
||
|
#if !defined(__MMX__)
|
||
12 years ago
|
if(av_get_cpu_flags() & AV_CPU_FLAG_MMX)
|
||
9 years ago
|
#endif
|
||
12 years ago
|
__asm__ volatile ("emms" ::: "memory");
|
||
12 years ago
|
}
|
||
|
#elif HAVE_MMX && HAVE_MM_EMPTY
|
||
|
# include <mmintrin.h>
|
||
|
# define emms_c _mm_empty
|
||
12 years ago
|
#elif HAVE_MMX_EXTERNAL
|
||
8 years ago
|
# define emms_c avpriv_emms_asm
|
||
12 years ago
|
#endif /* HAVE_MMX_INLINE */
|
||
|
|
||
1 year ago
|
#endif /* ARCH_X86 */
|
||
|
|
||
|
#ifndef emms_c
|
||
|
# define emms_c() do {} while(0)
|
||
|
#endif
|
||
|
|
||
|
#endif /* AVUTIL_EMMS_H */
|