Click here to Skip to main content
15,902,276 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery1-Jul-08 7:18
Mark Salsbery1-Jul-08 7:18 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish1-Jul-08 12:38
Kiran Satish1-Jul-08 12:38 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery1-Jul-08 13:34
Mark Salsbery1-Jul-08 13:34 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish1-Jul-08 14:48
Kiran Satish1-Jul-08 14:48 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery2-Jul-08 5:19
Mark Salsbery2-Jul-08 5:19 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish5-Aug-08 12:22
Kiran Satish5-Aug-08 12:22 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery6-Aug-08 6:49
Mark Salsbery6-Aug-08 6:49 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish6-Aug-08 10:00
Kiran Satish6-Aug-08 10:00 
My images are only 8bpp(0-255) and I use unsigned char pointer for image data. I am not sure which thread is slowing down and as fas as I know I dont have any critical sections. Here is the order-

BipBuffer ImageBuffer;
ImageBuffer.AllocateBuffer(128*m_FrameBufferSize) //m_FrameBufferSize = 512x512

-Main Thread (camera thread)- // this controls the processing thread
while (camthread)
take image (~20.5msec)
copy image data into shared buffer
set event to processing thread

-Processing thread-
while (processing thread)
wait for event from camera
copy image data from shared buffer to processing buffer

if(saveimage)
copy image data from shared buffer to buffer for saving image
Set event to save image thread

do the processing on image data in processing buffer
Update displays for results

-Save Image thread-
BYTE* pData
wait for save image event
pData = ImageBuffer.Reserve(m_FrameBufferSize, iResult)
memcpy(pData, m_pImageBuffer, iResult)
ImageBuffer.Commit(iResult) //iResult will be equal to m_FrameBufferSize

-Store Image thread- //this thread runs continuously until BipBuffer == NULL
while ((pData = ImageBuffer.GetContiguousBlock(iResult)) != NULL){
create filename
write image data to a file (I tried writing in two ways to see if there will be any difference in speed, one as a tiff format and also as a binary file)
ImageBuffer.DecommitBlock(iResult)}

I think I might just use a standard circular buffer of my own rather than BipBuffer as I see there is something going on when using it. When I run the program loop for 15sec, the number of images being stored are increasing from one run to another. Hope I am clear Smile | :) . If I comment out writing image data to a file in store image thread, everything runs fine at desired speed.

-thanks

PKNT

GeneralRe: Help on Multi-Threaded applicaiton Pin
Mark Salsbery7-Aug-08 5:41
Mark Salsbery7-Aug-08 5:41 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish7-Aug-08 6:45
Kiran Satish7-Aug-08 6:45 
AnswerRe: Help on Multi-Threaded applicaiton Pin
Simon Cooke15-Oct-08 21:52
Simon Cooke15-Oct-08 21:52 
GeneralRe: Help on Multi-Threaded applicaiton Pin
Kiran Satish6-Aug-08 13:33
Kiran Satish6-Aug-08 13:33 
QuestionGet Running Application's Main Window Pin
vikrant kpr27-Jun-08 12:22
vikrant kpr27-Jun-08 12:22 
Questionwinsock2 recv() returns empty buffer, but correct number of bytes received Pin
Member 427345427-Jun-08 11:14
Member 427345427-Jun-08 11:14 
AnswerRe: winsock2 recv() returns empty buffer, but correct number of bytes received Pin
Mark Salsbery28-Jun-08 11:15
Mark Salsbery28-Jun-08 11:15 
QuestionOLE Automation server's knowledge of client(s) Pin
garyflet27-Jun-08 6:11
garyflet27-Jun-08 6:11 
AnswerRe: OLE Automation server's knowledge of client(s) Pin
Roger Stoltz27-Jun-08 7:42
Roger Stoltz27-Jun-08 7:42 
QuestionRe: OLE Automation server's knowledge of client(s) Pin
garyflet27-Jun-08 8:27
garyflet27-Jun-08 8:27 
AnswerRe: OLE Automation server's knowledge of client(s) Pin
Roger Stoltz30-Jun-08 1:31
Roger Stoltz30-Jun-08 1:31 
Questionerror appear Pin
sofia_11127-Jun-08 5:32
sofia_11127-Jun-08 5:32 
AnswerRe: error appear Pin
led mike27-Jun-08 5:37
led mike27-Jun-08 5:37 
GeneralRe: error appear [modified] Pin
sofia_11127-Jun-08 7:03
sofia_11127-Jun-08 7:03 
QuestionRe: error appear Pin
CPallini27-Jun-08 9:40
mveCPallini27-Jun-08 9:40 
AnswerRe: error appear Pin
sofia_11127-Jun-08 12:54
sofia_11127-Jun-08 12:54 
AnswerRe: error appear Pin
Hamid_RT30-Jun-08 18:30
Hamid_RT30-Jun-08 18:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.