summaryrefslogtreecommitdiffstats
path: root/libhb/work.c
diff options
context:
space:
mode:
authoreddyg <[email protected]>2007-10-13 23:01:57 +0000
committereddyg <[email protected]>2007-10-13 23:01:57 +0000
commit46fb7d4c533333b92f2c3ed2ddf6f3d1a830ab6c (patch)
tree154fc3f99b67ddcd13b8a9cba63979596e6da5a0 /libhb/work.c
parentd388cdcaeed4ce4f4defd3487d3958d85554897e (diff)
Change the fifo size from being statically tuned for a Mac Pro with 4 CPUs to dynamically adjust according to how many processors are available. 8 extra buffers in the fifo per CPU available. Hopefully this will make the single CPU systems run at pretty much the same speed as before (although they may still be slower if they are low on memory and start thrashing the pager).
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1023 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/work.c')
-rw-r--r--libhb/work.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libhb/work.c b/libhb/work.c
index 535deb0fe..72d12d75a 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -22,7 +22,7 @@ static void work_func();
static void do_job( hb_job_t *, int cpu_count );
static void work_loop( void * );
-#define FIFO_SIZE 32
+#define FIFO_CPU_MULT 8
/**
* Allocates work object and launches work thread with work_func.
@@ -176,10 +176,10 @@ static void do_job( hb_job_t * job, int cpu_count )
}
hb_log (" + PixelRatio: %d, width:%d, height: %d",job->pixel_ratio,job->width, job->height);
job->fifo_mpeg2 = hb_fifo_init( 2048 );
- job->fifo_raw = hb_fifo_init( FIFO_SIZE );
- job->fifo_sync = hb_fifo_init( FIFO_SIZE );
- job->fifo_render = hb_fifo_init( FIFO_SIZE );
- job->fifo_mpeg4 = hb_fifo_init( FIFO_SIZE );
+ job->fifo_raw = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+ job->fifo_sync = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+ job->fifo_render = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+ job->fifo_mpeg4 = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
/* Synchronization */
hb_list_add( job->list_work, ( w = getWork( WORK_SYNC ) ) );
@@ -239,8 +239,8 @@ static void do_job( hb_job_t * job, int cpu_count )
{
hb_log( " + subtitle %x, %s", subtitle->id, subtitle->lang );
- subtitle->fifo_in = hb_fifo_init( FIFO_SIZE );
- subtitle->fifo_raw = hb_fifo_init( FIFO_SIZE );
+ subtitle->fifo_in = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+ subtitle->fifo_raw = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
/*
* Disable forced subtitles if we didn't find any in the scan
@@ -439,9 +439,9 @@ static void do_job( hb_job_t * job, int cpu_count )
/* set up the audio work structures */
audio->fifo_in = hb_fifo_init( 2048 );
- audio->fifo_raw = hb_fifo_init( FIFO_SIZE );
- audio->fifo_sync = hb_fifo_init( FIFO_SIZE );
- audio->fifo_out = hb_fifo_init( FIFO_SIZE );
+ audio->fifo_raw = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+ audio->fifo_sync = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
+ audio->fifo_out = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
switch( audio->codec )
{