What is a fast algorithm or method for displaying line images from a linear scanning camera

We have a line scan camera that produces 300 lines of images per second. We want to display the lines in the image as a FIFO so that the last line displays the most recent line image while shifting the previous lines higher to update the line.

If I can access video memory in C like the old days, I would just do

memcpy(videoMem, videoMem+lineWidth*pixelSize, pixelSize*lineWidth*(nLines-1));
memcpy(videoMem+pixelSize*lineWidth*(nLines-1),newLine,lineWidth*pixelSize);

      

But I donโ€™t know how much this is the best I can do even with direct access to video memory.

Now I understand that it is impossible and not desirable to directly access video memory. In this case, which method is better? Any expert opinion would be appreciated.

This is a desktop application for Windows 7.

Update

As I expected, it seems to me that I have to deal with the type of circular buffers. In my case, the tricky part is taking turns writing the buffer while reading across the screen. So as the pointer end

reaches the physical end of the buffer, an additional copy of the memory is required to transfer the screen memory to the video. I assume the Bip buffer will be used for this. Any other idea?

+3


source to share


1 answer


You cannot overwrite the memcpy memory, i.e. the memmove target. However, you can use memcpy as long as the copy happens in the correct order. Try on your platform to see if it works.

The main implementation issue is that having two separate entries causes flickering. If so, you first need to write a new image to the buffer and then write the entire buffer at once to video memory.

Generally speaking, you are not reading video memory. The data to be displayed must be in its own memory area. To summarize, you have 3 memory areas:



  • data to be displayed
  • display buffer
  • video memory (or equivalent)

The standard process is to write 1-> 2, then 2-> 3 in one step. However, if you have no flicker, you can go directly to 1-> 3 without a buffer. Other than this, there is no magic algorithm other than what you wrote

+2


source







All Articles