Porting Violet to Java

A forum for exporter development discussion.
User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Wed Feb 13, 2008 10:42 am

REVISION 49
Working on concurrency, and benchmarking. Currently all filters are disabled.

I've discovered that the post-processing routine to copy the rendered_image to display is not multithread capable. It slows down about 10x with just 2 threads! No idea why.

I've therefore fixed that routine to be single threaded only, and done some benchmarking for the main ImageThread times.

I've discovered that then using more than 1 thread the tonemapped image is not in fact correct. I think this is to do with the getAverageLuminance calculation and the ugly way of making a single thread do the work and the others waiting for it. There's also an ugly sleep() in there which should be replaced with a java concurrency .await() somehow.


For my tests, I timed an initial run with default settings on room.igi (our standard test IGI), adn then I did 2 more runs just by hitting Apply.

So, some results are as follows. The encouraging thing is that multithreading does show some speedup, even if it's not working 100% correct at the minute. This was run on my quad core machine, where 4 threads ought to be optimum.

-- White-balancing / reinhard tonemapping / gamma correction,
sleep in getAvLum() = 100ms
single display thread --

8 Threads:
327ms processing / 110ms display
218ms processing / 63ms display
234ms processing / 125ms display

4 Threads:
374ms processing / 109ms display
219ms processing / 47ms display
234ms processing / 47ms display

2 Threads:
421ms processing / 125ms display
312ms processing / 47ms display
312ms processing / 47ms display

1 Thread:
530ms processing / 125ms display
530ms processing / 47ms display
422ms processing / 46

-- White-balancing / reinhard tonemapping / gamma correction,
sleep in getAvLum() = 1ms
single display thread --

8 Threads:
307ms processing / 109ms display
138ms processing / 47ms display
152ms processing / 141ms display

4 Threads:
301ms processing / 125ms display
164ms processing / 47ms display
174ms processing / 47ms display

2 Threads:
344ms processing / 140ms display
228ms processing / 47ms display
298ms processing / 31ms display

1 Thread:
391ms processing / 109ms display
220ms processing / 47ms display
251ms processing / 47ms display

User avatar
eman7613
Posts: 597
Joined: Sat Sep 16, 2006 2:52 pm

Post by eman7613 » Wed Feb 13, 2008 3:53 pm

if changes are made to a duplicate image, then there are evil ways to get the two threads to work on a single image. IE: you can let two threads have access to the same image object, and read the values independently then add them together to get the result. Most java develepers (& i presume others aswell) will wag their finger at you, but so long as your looking you wont get any funky results.
Yes i know, my spelling sucks

Post Reply
137 posts

Who is online

Users browsing this forum: No registered users and 5 guests