NES emulator with 480i 30fps support?

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
NES emulator with 480i 30fps support?
by on (#201194)
Maybe this will seem like a weird thing to want, because it's such a terrible way to represent the signal that should be 240p 60fps, but since it's such a common mode for modern TVs with an NES hooked up, it might actually be really useful for testing purposes, just to see what it's going to look like on a lot of TVs! (Should have NTSC filter in addition to the interlacing and framerate decimation... maybe even with a stupid 16:9 stretch option ha ha.)

So... my question is: does this exist in any current emulators? Would anyone else want to have it emulated for testing? (Or for other reasons?)
Re: NES emulator with 480i 30fps support?
by on (#201195)
I'd be interested in such a feature too, since, like you said, a lot of people will be playing NES games this way. That being said, I can't help feeling sad because of how bad of a job most of today's TVs do when displaying 240p content.
Re: NES emulator with 480i 30fps support?
by on (#201196)
Just to be briefly pedantic ... A deinterlacer will still generate 60fps output.

Obviously, it's no good for trying it out in real time, but one should be able to take a rendered video and use one of mplayer's deinterlacers to try it out. I don't know if there's a plain "weave" deinterlacer trivially available, though.
Re: NES emulator with 480i 30fps support?
by on (#201201)
lidnariq wrote:
Just to be briefly pedantic ... A deinterlacer will still generate 60fps output.

Obviously, it's no good for trying it out in real time, but one should be able to take a rendered video and use one of mplayer's deinterlacers to try it out. I don't know if there's a plain "weave" deinterlacer trivially available, though.

I'm confused by this... aren't we trying to interlace here, not de-interlace?

I'm not familiar with mplayer, but the idea to capture video and interlace it is one that's pretty do-able with existing tools, at least, so I think that's a good suggestion.
Re: NES emulator with 480i 30fps support?
by on (#201203)
You're trying to take the 240p signal from the emulated NES, pretend it's 480i, and display that as though it went through the deinterlacer in the television... right?
Re: NES emulator with 480i 30fps support?
by on (#201204)
What do you mean by de-interlacer in the television?

The result I get/want is an 30fps image of 480 lines, which is a line-alternating combination of the last two frames from the NES. Is this not called "interlacing"?
Re: NES emulator with 480i 30fps support?
by on (#201205)
Uh...

Ok, NES produces video: call scanlines 0,1,2,3,4,5 &c.

Pretend they're interlaced:
On one vsync, renumber those scanlines 0,2,4,6,8,10 &c. This is now the "even" field.
On the other vsync, renumber those scanlines 1,3,5,7,9,11 &c. This is now the "odd" field.
Alternate between the two thereafter.

The video is now interlaced (by just playing funny games with naming, not even any math yet), but not displayable. A modern LCD TV has to convert interlaced video into a progressive format to show it.

TV includes a deinterlacer to produce a progressive image out of these two fields. This can be the "stereotypical interlaced view" which is the result of a "weave" deinterlacer. (A "weave" deinterlacer produces 60fps progressive video from 60fps interlaced video by taking the scanlines from every adjacent pair of fields, and splicing the two fields together. 0a 1b 2a 3b ... then 0c 1b 2c 3b ... then 0c 1d 2c 4d &c)

... does that help?
Re: NES emulator with 480i 30fps support?
by on (#201206)
The only accurate way of displaying 60i on 60p that does not require guessing picture data out of thin air is the 'Bob' method. It means displaying each field's line twice, but shifted by one target-resolution line:

Displaying the first field's lines on target display:
Output line 0: Source line 0
Output line 1: Source line 0
Output line 2: Source line 1
Output line 3: Source line 1
Output line 4: Source line 2
Output line 5: Source line 2

Displaying the second field's lines on target display:
Output line 0: Empty line
Output line 1: Source line 0
Output line 2: Source line 0
Output line 3: Source line 1
Output line 4: Source line 1
Output line 5: Source line 2
Output line 6: Source line 2

This displays a 60i image as a CRT TV would: Stable large areas and flickering single-line detail and smooth motion. (Forget BS descriptions about Bob "losing you half the picture detail", because the loss of half the picture detail occurred when the interlaced image was created, not by the deinterlacing algorithm.)

Pretending that a 240p source like the NES is a 480i source would basically mean displaying each of the 240 lines twice (yielding 480 lines), but shifting each second field by one target line.

Consider these example videos:
Original 240p video
Pretending that the 240p video is a 480i video
Deinterleaving that 480i video using the Bob algorithm

For illustration, consider the following three videos of a true 480i source:
Original 480i video
Prentending that the 480i video is a 240p video
Deinterleaving that 480i video using the Bob algorithm
Re: NES emulator with 480i 30fps support?
by on (#201213)
My $2
rainwarrior wrote:
maybe even with a stupid 16:9 stretch option ha ha.

Unfortunately, many emus already have this in option and sometimes it not even an option if you hook up a 16:9 monitor to your PC. I'm fairly sure SNES9x stretches the image full screen no matter the aspect ratio when told to use "full-screen mode", and for ePSXe, I had to try up hundreds of options to FINALLY have it not stretching the picture to 16:9, and the fact you should change the setting, save the setting, close the emu, re-open the emu and load a game every time doesn't help to make it user-friendly.
Re: NES emulator with 480i 30fps support?
by on (#201231)
lidnariq wrote:
... does that help?

My question was why "a deinterlacer will still generate 60fps output" was a pedantic clarification you had to make, because I thought I had described interlacing and not de-interlacing.

So... most of that description wasn't necessary, but what I will gather is that in the TV processing domain my concept of "interlace" and "deinterlace" are inverted or conflated, and that's fine I guess but it made me very confused about why you brought up deinterlacing.


Take two 240-line images (60fps), and weave them together into one 480-line image (30fps). This is the target image that I created this thread for. I hope that much was clear.


In virtualdub this image process is accomplished by an "interlace" filter. The reverse is accomplished by a "deinterlace" filter. In VLC player there is similarly a set of "deinterlace" filters, but no "interlace" filter that can weave two frames into one (which nobody would want, normally, same with what I'm asking for in an emulator). That's the terminology I'm used to, an image combination operation and its inverse.

Importantly VLC does not have a "weave" option in its deinterlace menu, because that's just the automatic first step in building the image. Its deinterlace menu is options for undoing the weave in a more visually appropriate/appealing way, and this how I'm used to these words.


I understand that the video signal going to the TV is two progressive frames, and that the TV's 480i input reinterprets this but doesn't change the source signal (obviously it can't change the source). So okay, I can accept that how the TV weaves those two fields is called "deinterlacing" in that domain, but what it ends up displaying is a 30fps picture that is visually an interlacingweaving of pairs of frames.

So, sure I get it, with TV signals it's all "deinterlacing"? The application of "interlaced" to the input signal is only a description of how to interpret it, and "deinterlacing" is the process of decoding it into an image, and they're not two opposite directions of a reversible process. (And "deinterlace" here could additionally use any of those fancier methods like what VLC has in its deinterlace menu.) Have I got this right?


Anyhow, that's how I was using those terms, and how I think you're using them, if that clarifies why I was confused.
Re: NES emulator with 480i 30fps support?
by on (#201234)
NewRisingSun wrote:
Pretending that a 240p source like the NES is a 480i source would basically mean displaying each of the 240 lines twice (yielding 480 lines), but shifting each second field by one target line.

Yes that's exactly what I'd want to be able to simulate in an emulator.

I suppose we could even do it with an option to select a deinterlace filter... but I'm used to commonly seeing just a simple "weave" on LCD TVs I've connected 240p composite to. Ha ha I feel like this concept is almost approaching "CRT curavture filter" levels of weird textural simulation.
Re: NES emulator with 480i 30fps support?
by on (#201237)
Overexplaining things I think you already know:
* The process of interlacing video is taking a source image and drawing only even or odd scanlines each vsync and alternating which each vsync. Hence PAL 576i, NTSC 480i, CRT 1024x768-85i, all of these only transmit half the data each vblank.
* When a capture card is used on an SDTV source, there's two different ways of storing it. They could just store the literal fields, effectively 240p/288p, and add a separate bit to specify whether each field is even or odd. (MPEG1 does mention this). Or, they can halve the frame rate, use a cheap "weave" deinterlacer to combine each subsequent pair of fields into a frame and halve the framerate.

But that's not what the TV does when it's fed an interlaced source.

The TV has to redraw at 60fps regardless. The process of deinterlacing does not intrinsically halve the resulting frame rate.

One could take the 480i60 source; deinterlace it (which produces 480p60); throw away (really, fail to calculate) half the resulting frames producing a 480p30 source; and then use a 1:2 pulldown to create 480p60 from that...

I'm really pretty certain that the TV recalculates the "weave" for every 60hz redraw, not just every other.
Re: NES emulator with 480i 30fps support?
by on (#201238)
lidnariq wrote:
I'm really pretty certain that the TV recalculates the "weave" for every 60hz redraw, not just every other.

Well, it very well could be, but the result is still a 30fps display, and whether the TV is doing redundant work doesn't really affect that? What about 120hz TVs?

Or... are you talking about a TV that does output a picture that changes at 60fps by alternatingly updating the even and odd lines? (I don't believe I've ever encountered that in an LCD TV.)
Re: NES emulator with 480i 30fps support?
by on (#201239)
I get the impression that what my TV shows with 240p sources is just 30fps. I see one source frame occupying even scanlines, and another source frame occupying odd scanlines. If a sprite flickers, I get alternating scanlines with and without the sprite, with no visible changes from one target frame to the next.
Re: NES emulator with 480i 30fps support?
by on (#201240)
What Brad wants is to take the 240p60 output of the emulated PPU, pretend it's field-based 480i60, and apply any of various deinterlacing filter chains to that. Yadif, for example, may approximate the processing that an HDTV applies to interpolate the contents of a field from the previous, current, and next fields, while a plain old bob simulates running the video through a DVD recorder to a CRT SDTV.
Re: NES emulator with 480i 30fps support?
by on (#201243)
rainwarrior wrote:
Or... are you talking about a TV that does output a picture that changes at 60fps by alternatingly updating the even and odd lines? (I don't believe I've ever encountered that in an LCD TV.)
Yes, that's what I'm saying.

tokumaru wrote:
If a sprite flickers, I get alternating scanlines with and without the sprite, with no visible changes from one target frame to the next.
You won't be able to tell the difference with a 30fps flicker:

Fields: A b C d E f (lowercase meaning the not-drawn flicker state)
30fps deinterlace: Ab Cd Ef
60fps deinterlace: Ab Cb Cd Ed Ef
In both cases you'll see an almost-identical comb-y result.

With a 1/3rd duty flicker (20Hz) the difference will be obvious:

Fields: A b c D e f G
30fps deinterlace: Ab cD ef - it will now appear to flicker at 10Hz
60fps deinterlace: Ab cb cD eD ef Gf - this will still flicker at 20Hz

rainwarrior wrote:
What about 120hz TVs?
I don't know how starting with a 60i source changes the motion prediction in a 120Hz TV. Certainly I can see that they'd interrelated, such as with mplayer's "mcdeint" deinterlacer which uses motion compensation to produce plausible lies for the missing scanlines, and the same motion compensation data would also be used to generate the entire missing frame for 120Hz rendering.
Re: NES emulator with 480i 30fps support?
by on (#201246)
tepples wrote:
What Brad wants is to take the 240p60 output of the emulated PPU, pretend it's field-based 480i60, and apply any of various deinterlacing filter chains to that.

I only really want a 30fps weave because that's the only one I've noticed HDTVs doing with 240p composite.

I only mentioned the possibility of configurable deinterlacing because it came up in discussion. I personally don't have any desire to simulate that kind of thing, only the one common mode that I have seen on many TVs.

Does anyone have an HDTV that does differently than this? I don't think Yadif is used in televisions. I have seen motion interpolation (yecch!) in some TVs, but not applied to the composite 480i input.

lidnariq wrote:
Fields: A b C d E f (lowercase meaning the not-drawn flicker state)
30fps deinterlace: Ab Cd Ef
60fps deinterlace: Ab Cb Cd Ed Ef
In both cases you'll see an almost-identical comb-y result.

Ah, yes that would be very difficult to see the difference between.

In my most often used LCD TV, I'm certain it's 30fps due to various tests I've done with it, but I don't think I would have been able to tell the difference in other cases I've seen.


Though, TBH either way is almost as good as the other for the kind of visual test I'd like to be able to do easily. Basically just want to be able to preview the negative impact of the weave on the image.
Re: NES emulator with 480i 30fps support?
by on (#201253)
rainwarrior wrote:
I only really want a 30fps weave because that's the only one I've noticed HDTVs doing with 240p composite.

My TV changes methods depending on the video. With no background scrolling, the TV's heuristic decides that the video was converted from 30p and matches pairs of fields to produce 30 frames per second. Once the background is scrolling, the TV's heuristic decides that the video is truly interlaced (with each field at a separate point in time) and switches to something more complicated that produces 60 frames per second.
Re: NES emulator with 480i 30fps support?
by on (#201544)
Many TVs will take a 15KHz signal and assume it is 480i. As a result, they will render the incoming lines into alternating fields. The changes may still be viewed at 60fps in total, but only every other line gets updated on every refresh. This is the worst-case scenario, in my opinion. Comb-like artifacts are seen on moving objects:

Image

Some TVs will weave these two into a full frame, updating the actual display only one two fields have been captured. This gives a 30fps effective refresh rate, where the resulting image is either a comb-artifacted blend of two frames (awful) or a 50% blend between two frames (semi-awful, old YouTube style). This mode is appropriate for interlaced video for which the source material was shot / composed at 30fps (e.g. Many television shows)

Some TVs will bob-deinterlace by only displaying the relevant field. This gets you a 60fps display with no comb lines, but it will wobble a bit (not the worst). This is the appropriate mode for interlaced video that is updating the source material at 60fps (e.g. Super Smash Bros Melee).

Finally, some TVs will treat 240p as only an even/odd field, and not try to deinterlace anything. This is ideal.