~siretart/x264/trunk

« back to all changes in this revision

Viewing changes to common/cpu.h

  • Committer: Fiona Glaser
  • Author(s): Steven Walters
  • Date: 2009-09-02 04:06:20 UTC
  • Revision ID: git-v1:6940dcaef140d8a0c43c9a62db158e9d71a8fdeb
Threaded lookahead
Move lookahead into a separate thread, set to higher priority than the other threads, for optimal performance.
Reduces the amount that lookahead bottlenecks encoding, greatly increasing performance with lookahead-intensive settings (e.g. b-adapt 2) on many-core CPUs.
Buffer size can be controlled with --sync-lookahead, which defaults to auto (threads+bframes buffer size).
Note that this buffer is separate from the rc-lookahead value.
Note also that this does not split lookahead itself into multiple threads yet; this may be added in the future.
Additionally, split frames into "fdec" and "fenc" frame types and keep the two separate.
This split greatly reduces memory usage, which helps compensate for the larger lookahead size.
Extremely special thanks to Michael Kazmier and Alex Giladi of Avail Media, the original authors of this patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 * gcc 4.2 introduced __attribute__((force_align_arg_pointer)) to fix this
34
34
 * problem, but I don't want to require such a new version.
35
35
 * This applies only to x86_32, since other architectures that need alignment
36
 
 * also have ABIs that ensure aligned stack. */
 
36
 * either have ABIs that ensure aligned stack, or don't support it at all. */
37
37
#if defined(ARCH_X86) && defined(HAVE_MMX)
38
 
int x264_stack_align( void (*func)(x264_t*), x264_t *arg );
39
 
#define x264_stack_align(func,arg) x264_stack_align((void (*)(x264_t*))func,arg)
 
38
int x264_stack_align( void (*func)(), ... );
 
39
#define x264_stack_align(func,...) x264_stack_align((void (*)())func, __VA_ARGS__)
40
40
#else
41
 
#define x264_stack_align(func,arg) func(arg)
 
41
#define x264_stack_align(func,...) func(__VA_ARGS__)
42
42
#endif
43
43
 
44
44
typedef struct {