06-24-2019 06:27 AM
I use a FPGA to display 3G SDI video stream on a 5" LCD screen.
FPGA output is RGB 24bits with horizontal and vertical synchro signals.
I need to add a line on the display. This line is not fixed (start point and end point can change).
So i tought to use the line equation and check pixel per pixel if pixel coordinate match with the line equation.
But, of course there is a but...
I can't make floating computation! Or i don't know how.
I have a process, executed each video clock period.
I have 2 counters, one for horizontal and one for vertical, so I know where i am in the image.
Now, how make the computation?
06-24-2019 07:25 AM
Normally you'd just do it in fixed-point. Much faster than floating-point, and much less resource-hungry. Should be easy to check whether each pixel matches the line.
06-24-2019 08:33 AM
Besides being a waste of resources, it won't work... pixel coordinates are integers and your line equation may be fractional. also, if you run through the X axis and your line has a slope greater than 45 deg, you will get disconnected points that don't look good.
I wrote such a routine ages ago for an 8-bit MCU.. let me find it in those things called floppy disks... they might be there
06-24-2019 11:34 PM
06-25-2019 12:07 AM - edited 06-25-2019 12:08 AM
Of course, line equation result will not be an integer for each pixel, but i will authorize a range (10 pixels for example).
I think it's a bad idea...you may end up drawing lines with pixels 9 positions up and down their true locations. Somebody suggested an algorithm, I would stick to it, when something is used by many people it can't be bad (or chances are that your own invention is not going to be better)