I have load my output file in DM6437 .i have made only some changes in video preview code as follows (for background subtraction) .
FVID_exchange(hGioVpfeCcdc, &frameBuffPtr); /* grab a fresh video input frame */
copyframe( (void*)(frameBuffPtr->frame.frameBufferPtr)); //store background frame
while ( status == 0 ) {
FVID_exchange(hGioVpfeCcdc, &frameBuffPtr); /* grab a fresh video input frame */
subtract( (void*)(frameBuffPtr->frame.frameBufferPtr)); //subtract background frame from current frame
writeframe( (void*)(frameBuffPtr->frame.frameBufferPtr)); //give this subtraction to output fame buffer
FVID_exchange(hGioVpbeVid0, &frameBuffPtr); /* display the video frame */
}
But it sometimes show correct output and sometimes only blue screen or video preview output. Why this is happening.Is it related to stack size?
please guide me.
detail copy ,subtraction,write function as follows:
void copyframe(void *currentFrame)
{ int xx = 0;
for( xx = 0; xx < 829440; xx+=1 )
arr[xx]=*( ( (unsigned char*)currentFrame+xx ));
}
void writeframe(void *currentFrame)
{
int xx = 0;
for( xx = 0; xx < 414719; xx+=1 )
*( ( (unsigned char*)currentFrame+(2*xx)+1 ))=arr1[xx];
*( ( (unsigned char*)currentFrame+(2*xx) ))=0x80;
}
void subtract(void *currentFrame)
{
int xx = 0;
for( xx = 0; xx < 829440; xx+=1 )
arr1[xx]=*( ( (unsigned char*)currentFrame+xx ))-arr[xx];
}