summaryrefslogtreecommitdiffstats
path: root/ipecamera
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-12 16:34:33 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-12 16:34:33 +0100
commit04cf1d6de47e21b330f377b5e4f0d11cc638d4d9 (patch)
treea2a44b8bb81c93d93da3f5e32e9c06e194012936 /ipecamera
parent5b536ceea053c8480862f68fd46a478abb64fd63 (diff)
downloadipecamera-04cf1d6de47e21b330f377b5e4f0d11cc638d4d9.tar.gz
ipecamera-04cf1d6de47e21b330f377b5e4f0d11cc638d4d9.tar.bz2
ipecamera-04cf1d6de47e21b330f377b5e4f0d11cc638d4d9.tar.xz
ipecamera-04cf1d6de47e21b330f377b5e4f0d11cc638d4d9.zip
Allow to configure the number of preprocessing threads
Diffstat (limited to 'ipecamera')
-rw-r--r--ipecamera/ipecamera.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ipecamera/ipecamera.c b/ipecamera/ipecamera.c
index c170174..d963494 100644
--- a/ipecamera/ipecamera.c
+++ b/ipecamera/ipecamera.c
@@ -407,12 +407,17 @@ int ipecamera_start(pcilib_context_t *vctx, pcilib_event_t event_mask, pcilib_ev
if (flags&PCILIB_EVENT_FLAG_PREPROCESS) {
ctx->n_preproc = pcilib_get_cpu_count();
+
+ // it would be greate to detect hyperthreading cores and ban them
switch (ctx->n_preproc) {
case 1: break;
case 2-3: ctx->n_preproc -= 1; break;
default: ctx->n_preproc -= 2; break;
}
-
+
+ if ((vctx->params.parallel.max_threads)&&(vctx->params.parallel.max_threads < ctx->n_preproc))
+ ctx->n_preproc = vctx->params.parallel.max_threads;
+
ctx->preproc = (ipecamera_preprocessor_t*)malloc(ctx->n_preproc * sizeof(ipecamera_preprocessor_t));
if (!ctx->preproc) {
ipecamera_stop(vctx, PCILIB_EVENT_FLAGS_DEFAULT);