Post subject: PlayStation (One) interlaced mode in Bizhawk
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11268
Location: RU
Wow this was a crazy trip, but we've made it! When you play PSX games that have interlaced footage, or just the BIOS sequence, you see that it runs at approximately 60fps (50fps for PAL), that can also be seen if you dump video of that mode. But it is also 480 pixel high (576 pixels for PAL), which is confusing. PSX doesn't support 480i 60fps mode. Only 480i 30fps. Moreover, on TV those interlaced video fields don't magically increase resolution, instead they become alternating 240p frames running at 60fps! Actual 240p modes also run at 60fps and in steady scenes using that mode, on a tv you see perfectly steady images. But when you closely look at how tv shows steady footage in interlaced modes, object edges visibly flicker as the 480i fields alternate. Footage might be posted later. Now guess what bizhawk (actually mednafen) is doing? It sets the resolution to 480p. It shows the first field at odd scanlines of that framebuffer, even scanlines remaining black. Then it shows the even scanlines of the next frame, while the odd scanlines simply persist through the next frame. Then the odd scanlines update and the even scanlines persist. This means it takes every field and keeps it on the screen for two 60fps frames, while updating fields at 60fps, simulating 480i 60fps interlaced mode. This is done for UI convenience and doesn't correspond to how the real console works. This means that when we want to deinterlace whatever octoshock is doing for this kinda footage, we need to take only first field from every first frame, and only second field from every second frame. And make them 240p as the TV shows it.
tl;dr: PSX in 480i doesn't magically increase resolution, 480i fields show up on tv as 240p frames one by one at 60fps. It arguably just makes the object borders slightly smoother. Probably that's why the interlaced mode wasn't that popular?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Post subject: Re: PlayStation (One) interlaced mode in Bizhawk
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
feos wrote:
Actual 240p modes also run at 60fps and in steady scenes using that mode, on a TV you see perfectly steady images.
Easily recognizable because of the scanlines. A full NTSC frame (including overscan/blanking) is 525 lines, 262.5 lines per field. The first (upper) field shows 262 full lines, and the last one ends up in the middle of the lower border of the CRT. When the electron beam jumps back to the top, it continues in the middle, drawing the new lines between the lines of the previous field. The odd number is what causes the interlacing. Consoles with progressive mode just omit the last line, which is why those modes are also a little bit faster (1/525 = ~0.19%).
feos wrote:
Probably that's why the interlaced mode wasn't that popular?
Yes. There are for example very few SNES games that use interlacing, mostly just for static screens. RPM Racing is the only one that uses it in actual gameplay, afaik.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11268
Location: RU
fsvgm777 captured TV output and it almost perfectly matches this function if I run it on 576i footage from tuner:
Language: avisynth

AssumeBFF() # or AssumeTFF() SeparateFields() PointResize(last.width, last.height*2) clip1=SelectOdd.Crop(0,0,0,last.height).AddBorders(0,0,0,0) clip2=SelectEven.Crop(0,0,0,last.height-1).AddBorders(0,1,0,0) Interleave(clip1,clip2)
But there is one problem. The previous feld doesn't instantly fade out because of how luminophores work. Because of that, after dumb separation of fields, you don't see these frames: But these instead: Notice how it only partially shows letters L and E, but the previous frame (or field if you will) bleeds in, compensating for partial display! How do I make the above script bleed the previous frame?
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Joined: 10/14/2013
Posts: 335
Location: Australia
Could you please post a sample of the footage to play around with?
I'm not as active as I once was, but I can be reached here if I should be needed.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11268
Location: RU
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
Site Admin, Skilled player (1236)
Joined: 4/17/2010
Posts: 11268
Location: RU
After a few hours of brainstorming, Corey and I got stuck. There's no way to make interlaced PSX scenes look accurate to hardware and pleasant to watch at the same time. Since TV doesn't output blade sharp pixels, blurring the footage a little bit looks like the closest replication of TV to me, but it doesn't feel like good experience I should say. The best result is provided by using the entire 480p framebuffer that PSX actually renders but never displays on TV. Examples by Corey: https://www.mediafire.com/file/kcppp0redeafs4v/test_psx.zip/file
Warning: When making decisions, I try to collect as much data as possible before actually deciding. I try to abstract away and see the principles behind real world events and people's opinions. I try to generalize them and turn into something clear and reusable. I hate depending on unpredictable and having to make lottery guesses. Any problem can be solved by systems thinking and acting.
creaothceann
He/Him
Editor
Joined: 4/7/2005
Posts: 1874
Location: Germany
feos wrote:
accurate to hardware
DoubleWeave, or
Language: Avisynth

AVISource("tuner.avi").AssumeTFF SeparateFields Interleave(last, BlankClip(last)).Weave Crop(34, 41, -36, -55) BilinearResize(Height * 4 / 3, Height)
...but that's really ugly.
feos wrote:
pleasant to watch
QTGMC
Spikestuff
They/Them
Editor, Publisher, Expert player (2292)
Joined: 10/12/2011
Posts: 6337
Location: The land down under.
Short answer to any interlaced problems is definitely use QTGMC. Due to the long time of waiting (and the amount of files QTGMC requires) I screwed with Yadifmod and had this:
Language: avisynth

AVISource("blah.avi") LoadPlugin("yadifmod2.dll") ConvertToYV24() yadifmod2(order=1, field=-1, mode=1, opt=2) last.FrameRate > 59 ? SelectEvery(4, 0, 3) : SelectEvery(4, 1, 2)
Not best for actual publications, but for temporary maybe with some tinkering... haha also 32bit. >.>
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
Zinfidel
He/Him
Player (200)
Joined: 11/21/2019
Posts: 247
Location: Washington
Did you guys run into a "vertical banding" issue when you were working on deinterlacing PSX video? I'm processing some videos of the PSX game Ehrgeiz, which runs in the same mode as Tekken 3, namely 360x480 interlaced (or 400x480 including the overscan). This issue is much easier to describe with screenshots so here's an album of them. I think the problem is due to dithering. Ehrgeiz has dithering applied to nearly the entire game, which is what I think is causing the light-dark bands that are appearing. Deinterlacing is some how picking this dithering up and causing this visual artifact. Just scaling the still-interlaced video does not produce these vertical bands (mostly), it's ony after deinterlacing that they show up. Here's unmodified, but stretched (point) footage: And here's after a bob filter and stretching (lanczos): The banding is fairly obvious, and you can see that there is roughly a light-dark-light pattern that makes it stand out. I've used much more advanced filters like QTGMC and yadifmod and gotten the same result. I've included close-up shots of the banding in the album, including some shots of the Tekken 3 clip that was shared in this thread exhibiting the same problem. I watched the HQ downloads for the Tekken 3 encodes and neither seem to have this problem, so I'm wondering if someone who did the encoding for those videos recalls how they solved this problem, or if they even had this problem at all. I'm using AviSynth and VirtualDub for most of my work. I have tried quite a few options for the QTGMC deinterlacer dealing with noise and grain retention, but haven't made much progress there.Here's a link to the clip I used for these examples.