Author Topic: How do videoscalars like retrotink and ossc work (technically)  (Read 1086 times)

0 Members and 1 Guest are viewing this topic.

Offline bzuidgeestTopic starter

  • Newbie
  • Posts: 4
  • Country: nl

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.
 

Offline dmills

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #1 on: March 28, 2023, 12:30:43 pm »
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.

 
The following users thanked this post: Wolfram

Offline dave j

  • Regular Contributor
  • *
  • Posts: 127
  • Country: gb
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #2 on: March 28, 2023, 02:33:00 pm »
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.
I'm not David L Jones. Apparently I actually do have to point this out.
 
The following users thanked this post: bzuidgeest

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11471
  • Country: ch
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #3 on: March 28, 2023, 05:30:59 pm »
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.
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.
« Last Edit: March 28, 2023, 05:33:28 pm by tooki »
 

Offline bzuidgeestTopic starter

  • Newbie
  • Posts: 4
  • Country: nl
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #4 on: March 30, 2023, 08:17:01 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.
Analog video doesn’t have a pixel clock because it doesn’t have pixels at all.

You clearly missed the sarcasm in the highlighted statement. It's one of the few things I actually seem to understand about this topic. :)
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8167
  • Country: fi
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #5 on: March 30, 2023, 08:26:34 am »
While analog does not have pixels (and thus no sync for pixels), it has sync for lines, and sync for frames.

All that needs to be done is to decide number of pixels that go into a line, synchronize to the start of the line, and then digitize that many pixels. The more, the better.

If the analog material is originally "pixel perfect" digital art, and the number of output pixels is limited for technical reasons, then more sophisticated algorithms are needed for good results: something that tries to find the pixel boundaries of the original and map them to output pixels. LCD screens with VGA inputs try to do tricks like this.
« Last Edit: March 30, 2023, 08:29:16 am by Siwastaja »
 

Offline bzuidgeestTopic starter

  • Newbie
  • Posts: 4
  • Country: nl
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #6 on: March 30, 2023, 08:28:19 am »
@dmills, Thanks for replying, but pretend for a minute that I don't know how implementations of those steps work. Should not be to hard :). Your reply (appreciated) is actually why I was asking the question. High level explanations there are a lot of, not so much in depth. Let me put it this way, making a good amplifier can get "complex", but I can pick up any textbook on electronics and find basic explanations, examples and experiments. Same for so many other topics. But not this one (as far as I could find.

@dave_J that is a usefull link, not exactly a textbook, but there is some useful information in there. I knew about the project, but not this thread. I even already looked at the code. The thing is, that there is a lot in there, so as a basic example, you would have to strip a lot away. So as a teaching aid it becomes usefull after one has some idea what he is looking at.
 
 

Offline bzuidgeestTopic starter

  • Newbie
  • Posts: 4
  • Country: nl
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #7 on: March 30, 2023, 08:40:46 am »
While analog does not have pixels (and thus no sync for pixels), it has sync for lines, and sync for frames.

All that needs to be done is to decide number of pixels that go into a line, synchronize to the start of the line, and then digitize that many pixels. The more, the better.

If the analog material is originally "pixel perfect" digital art, and the number of output pixels is limited for technical reasons, then more sophisticated algorithms are needed for good results: something that tries to find the pixel boundaries of the original and map them to output pixels. LCD screens with VGA inputs try to do tricks like this.

That sounds simple, just sync to the line. But surely lines, go faster in the digital signals then the old analogue ones. So you would have to look into the future to know what the slower signal is going to do. How do they keep up to each other? I might sound dumb here, but I was asking for basic explanation/tutorial stuff for a reason....
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11471
  • Country: ch
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #8 on: March 30, 2023, 08:54:39 am »
That sounds simple, just sync to the line. But surely lines, go faster in the digital signals then the old analogue ones. So you would have to look into the future to know what the slower signal is going to do. How do they keep up to each other? I might sound dumb here, but I was asking for basic explanation/tutorial stuff for a reason....

Huh? Just how exactly do you think a digitizer works?

I’m sure there are different methods, but I’d expect that the digitizer either digitizes the entire video signal continuously and then extracts the lines from it (either extracting the sync to a trigger from a composite signal, or from separate sync signals), or that it syncs first and then digitizes each line. Either way, the sampling rate is something the designer can choose. After that it’s all digital signal processing.
 

Offline dmills

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #9 on: March 30, 2023, 12:28:52 pm »
To line double you start at the beginning of the line sampling the data into a memory, at a multiple of the line rate, then when the line buffer becomes half full (so half a line of latency) you start reading out the buffer twice as fast as you wrote it. You will thus catch up with the writer just as you hit the end of the line buffer, and can start playing the line buffer a second time (for the doubled line). At the time the second line is played out, your input side will be half way along the line buffer so you can immediately go again.

The trick here is to configure the dual port ram such that if a simultaneous read and write occur, the read port gets the old data (Otherwise the first pixel on the doubled line gets stomped). 
 
Obviously higher multiples need slightly different timing to work, but the idea is the same.

It is probably worth using an actual PLL to produce the sampling clock to minimise jitter relative to the line sync pulse as this will translate directly into jitter in the output image, a bit of a pain as there are multiple different input formats.

 

Offline jonpaul

  • Super Contributor
  • ***
  • Posts: 3365
  • Country: fr
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #10 on: March 30, 2023, 12:29:32 pm »
see history of video codecs and compression.

Yeves FAROUDJA did the pioneering work in 1980s.

https://en.wikipedia.org/wiki/Faroudja

BRAVO to our old friend !


Jon
Jean-Paul  the Internet Dinosaur
 
The following users thanked this post: pardo-bsso

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26878
  • Country: nl
    • NCT Developments
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #11 on: April 01, 2023, 12:42:18 am »
That sounds simple, just sync to the line. But surely lines, go faster in the digital signals then the old analogue ones. So you would have to look into the future to know what the slower signal is going to do. How do they keep up to each other? I might sound dumb here, but I was asking for basic explanation/tutorial stuff for a reason....

Huh? Just how exactly do you think a digitizer works?

I’m sure there are different methods, but I’d expect that the digitizer either digitizes the entire video signal continuously and then extracts the lines from it (either extracting the sync to a trigger from a composite signal, or from separate sync signals), or that it syncs first and then digitizes each line. Either way, the sampling rate is something the designer can choose.
No, as Siwastaja already wrote: if the source of the analog signal is digital (which is the case for video consoles), then there will be a finite number of pixels in each horizontal line of the image. If you want the best results, then you'll need to find those pixel boundaries and lock the sampling to these boundaries so you are sampling the pixel values and not the crossover between pixels. You should try and hook up an LCD monitor to an analog VGA output and let the screen 'self adjust'. You'll see this locking process in action (and typically get horrible results when the sampling isn't locked to the pixel boundaries).
« Last Edit: April 01, 2023, 12:45:04 am by nctnico »
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11471
  • Country: ch
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #12 on: April 01, 2023, 09:19:13 am »
That sounds simple, just sync to the line. But surely lines, go faster in the digital signals then the old analogue ones. So you would have to look into the future to know what the slower signal is going to do. How do they keep up to each other? I might sound dumb here, but I was asking for basic explanation/tutorial stuff for a reason....

Huh? Just how exactly do you think a digitizer works?

I’m sure there are different methods, but I’d expect that the digitizer either digitizes the entire video signal continuously and then extracts the lines from it (either extracting the sync to a trigger from a composite signal, or from separate sync signals), or that it syncs first and then digitizes each line. Either way, the sampling rate is something the designer can choose.
No, as Siwastaja already wrote: if the source of the analog signal is digital (which is the case for video consoles), then there will be a finite number of pixels in each horizontal line of the image. If you want the best results, then you'll need to find those pixel boundaries and lock the sampling to these boundaries so you are sampling the pixel values and not the crossover between pixels. You should try and hook up an LCD monitor to an analog VGA output and let the screen 'self adjust'. You'll see this locking process in action (and typically get horrible results when the sampling isn't locked to the pixel boundaries).
I’m well familiar with that. But I didn’t overlook it, that falls under the “sync first and then digitize each line” approach I mentioned.
 

Offline m k

  • Super Contributor
  • ***
  • Posts: 1995
  • Country: fi
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #13 on: April 01, 2023, 11:10:26 am »
Vertical is as equally important as is horizontal.
If it's up scaling it finally has caps to fill.

First there is a film camera.
There film is exposed to light, the whole picture at once.
Keyword here is time.

--A--B--C--D--

Picture taking time start from A and end to B.
Then is shutter time from B to C.
And next picture from C to D.
Object is moving all the time.

Computer picture has no time, if it is not added.
On the other hand, shutter time is lost for ever.

Frame rate adds a 3rd dimension.

So interpolating 2x 2x 2x and there is a single real pixel in the center of the cube.
And copying frames create a temporal disruption.
Advance-Aneng-Appa-AVO-Data Tech-Fluke-General Radio-H. W. Sullivan-Heathkit-HP-Kaise-Kyoritsu-Leeds & Northrup-Mastech-REO-Simpson-Sinclair-Tektronix-Triplett-YFE
(plus lesser brands from the work shop of the world)
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11471
  • Country: ch
Re: How do videoscalars like retrotink and ossc work (technically)
« Reply #14 on: April 01, 2023, 11:23:38 am »
First there is a film camera.
There film is exposed to light, the whole picture at once.
FYI, that’s not necessarily true. SLRs and most other removable-lens 35mm film cameras use shutters with two shutter curtains that move independently of each other, from one edge to the other (mostly vertically, but earlier ones horizontally). This means that exposure begins at one edge of the film and then progressively moves to the other. One curtain is opening, the other closing shortly afterwards. For longer exposure times, the frame will be completely unblocked for some period of time, but for short shutter speeds, the opening curtain is quickly followed by the closing one, resulting in a moving slit, exposing the frame progressively. This can cause effects like a car or horse appearing slanted in the image. While it is continuous (no discrete lines like digital), it is not the whole picture exactly at once.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf