Author: abrander
Date: 2011-12-30 21:12:44 +0100 (Fri, 30 Dec 2011)
New Revision: 4085
Modified:
trunk/plugins/colorspace-transform/colorspace_transform.c
trunk/plugins/colorspace-transform/colorspace_transform.h
Log:
Use main thread for very small image transforms (Patch by Klaus Post).
Modified: trunk/plugins/colorspace-transform/colorspace_transform.c
===================================================================
--- trunk/plugins/colorspace-transform/colorspace_transform.c 2011-12-30
20:12:09 UTC (rev 4084)
+++ trunk/plugins/colorspace-transform/colorspace_transform.c 2011-12-30
20:12:44 UTC (rev 4085)
@@ -490,7 +490,10 @@
gint i;
guint y_offset, y_per_thread, threaded_h;
- const guint threads = rs_get_number_of_processor_cores();
+ guint threads = rs_get_number_of_processor_cores();
+ if (roi->height * roi->width < 200*200)
+ threads = 1;
+
ThreadInfo *t = g_new(ThreadInfo, threads);
threaded_h = roi->height;
@@ -512,12 +515,15 @@
t[i].end_y = y_offset;
t[i].matrix = &mat;
t[i].table8 = NULL;
-
- t[i].threadid =
g_thread_create(start_single_cs8_transform_thread, &t[i], TRUE, NULL);
+ t[i].single_thread = (threads == 1);
+ if (threads == 1)
+ start_single_cs8_transform_thread(&t[0]);
+ else
+ t[i].threadid =
g_thread_create(start_single_cs8_transform_thread, &t[i], TRUE, NULL);
}
/* Wait for threads to finish */
- for(i = 0; i < threads; i++)
+ for(i = 0; threads > 1 && i < threads; i++)
g_thread_join(t[i].threadid);
g_free(t);
Modified: trunk/plugins/colorspace-transform/colorspace_transform.h
===================================================================
--- trunk/plugins/colorspace-transform/colorspace_transform.h 2011-12-30
20:12:09 UTC (rev 4084)
+++ trunk/plugins/colorspace-transform/colorspace_transform.h 2011-12-30
20:12:44 UTC (rev 4085)
@@ -51,6 +51,7 @@
GCond* transform_finished;
GMutex* transform_finished_mutex;
gboolean do_run_transform;
+ gboolean single_thread;
} ThreadInfo;
/* SSE2 optimized functions */
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit