0
\$\begingroup\$

I'm having problems when trying to synchronize output from IR camera and hdmi transmitter. I use cyclone FPGA and ulis IR sensor, for describing how I use Verilog.

Sensor frame rate is 60 fps, same applies for hdmi transmitter. Pixel clock for hdmi is circa 25.03Mhz. Parameters for sensor are fixed and cannot be changed. Output from sensor firstly runs through image pipeline before it is transmitted. I use double buffering - one frame is beeing written to b1 while frame from b2 is beeing transmitted.

The problem is that the frame rate from sensor isn't exactly 60fps, it is little faster. Hdmi transmitter transmits with delay circa 25000ns. Therefore after some time sensor outruns the hdmi transmitter and writes to the same buffer, from which the hdmi transmitter reads the data. This causes that half of new and half of old image is beeing displayed on monitor.

I've tried to use fifo instead buffers, but with this technique after some time I display images with significant delay. I tried to skip some pixels, synchronize writing to buffers, using 2 different clocks for the transmitter (some frames transmitted with faster clock to compensate for the delay), but all those attempts failed.

I'm new in image processing and don't know what to try next. I would greatly appreciate any advice. Thanks in advance.

\$\endgroup\$
14
  • \$\begingroup\$ Why can't you make the HDMI frame rate exactly the same as the sensor frame rate? \$\endgroup\$
    – Dave Tweed
    Commented Aug 10, 2021 at 12:13
  • \$\begingroup\$ If the sensor receives faster than the transmitter transmits, doesn't that mean you can always transmit the current buffer the sensor is writing in, because all the pixels will be ready before you transmit them? Using this idea, sometimes you will write the same buffer twice but the sensor will have received a new image into that buffer in between. \$\endgroup\$ Commented Aug 10, 2021 at 12:14
  • \$\begingroup\$ @DaveTweed Due to the delay of image pipeline, I would need the clock to run on 25.029911Mhz, which is not possible for me. \$\endgroup\$ Commented Aug 10, 2021 at 12:29
  • \$\begingroup\$ @user253751 Not sure if I understand you correctly, but doesn't it run into the same problem? In longer timeframe the sensor will outrun hdmi and the same problem occurs again. \$\endgroup\$ Commented Aug 10, 2021 at 12:29
  • \$\begingroup\$ @mirek.skrabal When the sensor outruns HDMI by a whole frame, you skip a buffer. \$\endgroup\$ Commented Aug 10, 2021 at 12:31

1 Answer 1

1
\$\begingroup\$

Assuming that you can't change the speed of either the sensor or the HDMI output: I suggest that the HDMI transmitter skips a buffer if the sensor has already finished it.

When the HDMI transmitter completes buffer 1, if the sensor has already completed buffer 2 and gone back to buffer 1, the HDMI transmitter can also go back to the start of buffer 1 (skipping buffer 2). Since the sensor is ahead of the HDMI output and runs faster, there's no chance the HDMI transmitter will catch up to the sensor and cause tearing. One frame will be dropped, but that's what you were expecting.

\$\endgroup\$
4
  • \$\begingroup\$ I actually can make the hdmi pixel clock faster. But I would run into the same problem, just the other way around. Or are you suggesting that I could wait between the transmission of frames? I tried that, but got no output on screen, so I thought I violated the standard ...but I don't understand the standard very well tbh. \$\endgroup\$ Commented Aug 10, 2021 at 12:47
  • \$\begingroup\$ @mirek.skrabal Can you make the HDMI pixel clock exactly the same as the sensor pixel clock? I don't know anything about HDMI. \$\endgroup\$ Commented Aug 10, 2021 at 12:48
  • \$\begingroup\$ No, that is unfortunately not possible. \$\endgroup\$ Commented Aug 10, 2021 at 12:50
  • \$\begingroup\$ I was thinkg about trying to use triple buffer, but this effectively does the same job. I will wait if some other idea will occur, if not, I will implement this technique. \$\endgroup\$ Commented Aug 10, 2021 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.