ota42y / seam-carving-gui

Automatically exported from code.google.com/p/seam-carving-gui
0 stars 0 forks source link

A bug with thread #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. input a image, and get the result.
2. input the same image, and get the result.
3. do it(2) many times, and compare the results.

What is the expected output? What do you see instead?
The results should be same, but they are not.

What version of the product are you using? On what operating system?
Src Seam Carving GUI 1.11, CAIR 2.19, Ubuntu LTS 12.04.

Please provide any additional information below.
    I solved the problem, and I provide the diff file.
    In CAIR, there are 4(you can set a different number) threads. They work together to do the same work. The main thread do 'sem_post' 4 times, and each worker thread do 'sem_wait' to get a semaphore to work. There is posibility that one worker may finish the work extreme fast and do 'sem_wait' again before other worker has a turn to run on cpu. For example, worker 0 calc energy on image block 0, worker 3 calc energy on image block 3, worker 2 calc energy on image block 2, worker 3 calc energy on image block 3. In this example worker 1 didn't work, and worker 3 worked twice.
    I'm sorry for my poor English. I hope you can understand what I said. That's all.

Original issue reported on code.google.com by gfateext...@gmail.com on 16 Jan 2014 at 7:26

Attachments: