cpu.h 2.04 KB
Newer Older
1 2 3
/*****************************************************************************
 * cpu.h: h264 encoder library
 *****************************************************************************
4
 * Copyright (C) 2004-2008 Loren Merritt <lorenm@u.washington.edu>
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111, USA.
19 20
 *****************************************************************************/

21 22
#ifndef X264_CPU_H
#define X264_CPU_H
23 24

uint32_t x264_cpu_detect( void );
25
int      x264_cpu_num_processors( void );
26
void     x264_emms( void );
27
void     x264_cpu_mask_misalign_sse( void );
28

29 30 31 32 33 34 35
/* kluge:
 * gcc can't give variables any greater alignment than the stack frame has.
 * We need 16 byte alignment for SSE2, so here we make sure that the stack is
 * aligned to 16 bytes.
 * gcc 4.2 introduced __attribute__((force_align_arg_pointer)) to fix this
 * problem, but I don't want to require such a new version.
 * This applies only to x86_32, since other architectures that need alignment
Steven Walters's avatar
Steven Walters committed
36
 * either have ABIs that ensure aligned stack, or don't support it at all. */
37
#if defined(ARCH_X86) && defined(HAVE_MMX)
Steven Walters's avatar
Steven Walters committed
38 39
int x264_stack_align( void (*func)(), ... );
#define x264_stack_align(func,...) x264_stack_align((void (*)())func, __VA_ARGS__)
40
#else
Steven Walters's avatar
Steven Walters committed
41
#define x264_stack_align(func,...) func(__VA_ARGS__)
42 43
#endif

44
typedef struct {
45
    const char name[16];
46
    int flags;
47 48
} x264_cpu_name_t;
extern const x264_cpu_name_t x264_cpu_names[];
49

50
#endif