NES emulator with 480i 30fps support?

A place for your artistic side. Discuss techniques and tools for pixel art on the NES, GBC, or similar platforms.

Moderator: Moderators

User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

NES emulator with 480i 30fps support?

Post by rainwarrior »

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?)
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: NES emulator with 480i 30fps support?

Post by tokumaru »

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.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: NES emulator with 480i 30fps support?

Post by lidnariq »

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.
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NES emulator with 480i 30fps support?

Post by rainwarrior »

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.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: NES emulator with 480i 30fps support?

Post by lidnariq »

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?
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NES emulator with 480i 30fps support?

Post by rainwarrior »

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"?
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: NES emulator with 480i 30fps support?

Post by lidnariq »

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?
NewRisingSun
Posts: 1510
Joined: Thu May 19, 2005 11:30 am

Re: NES emulator with 480i 30fps support?

Post by NewRisingSun »

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
User avatar
Bregalad
Posts: 8055
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: NES emulator with 480i 30fps support?

Post by Bregalad »

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.
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NES emulator with 480i 30fps support?

Post by rainwarrior »

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.
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NES emulator with 480i 30fps support?

Post by rainwarrior »

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.
lidnariq
Posts: 11429
Joined: Sun Apr 13, 2008 11:12 am

Re: NES emulator with 480i 30fps support?

Post by lidnariq »

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.
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: NES emulator with 480i 30fps support?

Post by rainwarrior »

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.)
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: NES emulator with 480i 30fps support?

Post by tokumaru »

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.
tepples
Posts: 22705
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: NES emulator with 480i 30fps support?

Post by tepples »

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.
Post Reply