General > General Technical Chat
How do videoscalars like retrotink and ossc work (technically)
bzuidgeest:
Hello,
The last few years I have seen all kinds of video converters in the retro computer scene. Converting even the signals from ancient consoles to something better.
I under stand the basic idea behind them, first digitizing (often), then processing (scaling and other effects), then output in the new format either analog or digital.
A lot of hassle is made about keeping lag as low as possible. What I cannot seem to figure out and cannot find any documentation on is how the keep everything synced together. Most analog formats don't exactly have a pixel clock or something.
Does anyone here know of a good write up on how the "magic" is done? Not in generics, but with actual examples. Examples need not be harder then for example going from cga to vga with integerscaling in between and or things like moving from interlaced to progressive formats.
dmills:
Not somewhere I have played, SDI generally being my starting point, but I can make some informed guesses.
Sync separator then lock a PLL to the input line rate to produce a pixel clock at whatever frequency is appropriate, some ability to slip the input pixel sampling phase to match whatever the video hardware is generating is probably desirable. This could probably be done with some magic involving an NCO and playing with the phase trimming given that a reasonable FPGA will go at way above the required pixel clock rate for 480p
If the input is composite then a well designed comb filter in the digital domain is likely better then trying to deal in the analogue space, and you will want to sort out the various options for chroma subsampling and assumed gamma, a quick enough ADC for this is reasonably trivial these days.
A good deinterlacer is actually one of the hardest things to write, because doing it really properly involves motion estimation, and that just eats gates (and memory bandwidth). Doing it low latency just adds to the joy. Getting below 1 frame of latency is basically impossible if doing it well, but for stuff like old console games there are options.
Scaling however is fairly easy, especially for the integer ratio cases, being a case of applying a 2d polyphase filter to produce the output samples, this can be done with only a few lines of latency depending obviously on the size of the filter kernel.
Memory bandwidth requirements can be reduced by doing it as a two 1D filters at the cost of some loss of accuracy that often does not matter. The hard thing here is making sure that the memory layout works to put the correct pixels on the bus when you need them, not trivial given the nature of DDR3 and friends really needing at least row length reads or writes (Fine for the horizontal processing, pain in the arse for the vertical bit).
Line doubling is of course easy, buffer 1 line, play it out twice at double speed, while buffering the next line, then just ping pong. Not how you write a GOOD scaler (Which is black magic), but very, very low latency.
dave j:
There's also hoglet's Raspberry Pi Zero based RGB to HDMI converter. As well as the full source being available for it, there is extensive discussion of its development on this stardot.org.uk thread.
tooki:
--- Quote from: bzuidgeest on March 28, 2023, 11:08:37 am ---A lot of hassle is made about keeping lag as low as possible. What I cannot seem to figure out and cannot find any documentation on is how the keep everything synced together. Most analog formats don't exactly have a pixel clock or something.
--- End quote ---
Analog video doesn’t have a pixel clock because it doesn’t have pixels at all. It has lines, which are discrete, but within each line it’s a continuous signal. In interlaced video, like analog TV, a fixed number of lines form a field (even or odd) and two fields form a frame. In progressive video (like VGA or some analog HD formats), a fixed number of lines form a single frame.
The horizontal sync signals the beginning of a line, and vertical sync signals the beginning of a field or frame.
There are a few different synchronization schemes, but the upshot is that there’s always some mechanism for sync. Computer video connections like VGA usually have separate H and V sync lines. Some have one of those embedded in the green channel. Analog TV formats use complex voltage levels to encode the sync; it’s plainly visible in the waveform.
bzuidgeest:
--- Quote from: tooki on March 28, 2023, 05:30:59 pm ---
--- Quote from: bzuidgeest on March 28, 2023, 11:08:37 am ---A lot of hassle is made about keeping lag as low as possible. What I cannot seem to figure out and cannot find any documentation on is how the keep everything synced together. Most analog formats don't exactly have a pixel clock or something.
--- End quote ---
Analog video doesn’t have a pixel clock because it doesn’t have pixels at all.
--- End quote ---
You clearly missed the sarcasm in the highlighted statement. It's one of the few things I actually seem to understand about this topic. :)
Navigation
[0] Message Index
[#] Next page
Go to full version