PAL picture emulation tools

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

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

PAL picture emulation tools

Post by rainwarrior » Mon May 30, 2016 11:30 am

In another thread someone mentioned diagonal artifacts caused by PAL.

Many emulators have an NTSC picture emulation, and we have other tools that do a good job how an NTSC NES picture actually looks, but I can't seem to find anything equivalent for PAL.

FCEUX had a prospective PAL filter in r3112, but it was redacted in r3195 with the comment that it's not "done" yet, so I've got no basis to speculate on how accurate it might have been.

Edit: A build of the last revision before it was disabled is available here: r3194 at EmuCR


Does anyone know of other emulators or tools that can give an accurate idea of what the PAL picture should look like?


Edit: renamed thread from "PAL picture emulation" to avoid confusion between this and feos' similarly titled thread.
Last edited by rainwarrior on Tue May 31, 2016 10:18 am, edited 2 times in total.

User avatar
feos
Posts: 107
Joined: Tue Apr 19, 2011 11:26 am
Location: RU
Contact:

Re: PAL picture emulation

Post by feos » Mon May 30, 2016 1:55 pm

That's basically what we've been doing for 4 pages:
viewtopic.php?f=3&t=12788

The idea is kinda clear, I just need to find time to properly implement it. The hardest parts are the notch filter and chroma merge. Emulating the moire was done in various ways and is easy in itself. But very hard to get perfectly.

Can these threads be merged?

tepples
Posts: 21713
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: PAL picture emulation

Post by tepples » Mon May 30, 2016 3:25 pm

For the time being, I am declining the request to lock or merge the two topics for reasons that I have set forth in this post.

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

Re: PAL picture emulation tools

Post by rainwarrior » Mon May 30, 2016 3:57 pm

feos I renamed this to "PAL picture emulation tools" so my tool question thread won't be confused with your reverse engineering thread.

User avatar
feos
Posts: 107
Joined: Tue Apr 19, 2011 11:26 am
Location: RU
Contact:

Re: PAL picture emulation tools

Post by feos » Tue May 31, 2016 12:49 am

rainwarrior wrote:feos I renamed this to "PAL picture emulation tools" so my tool question thread won't be confused with your reverse engineering thread.
That's the same thing, we're only reverse engineering it to be able to come up with tools that emulate it. My filter was close to it right before I disabled it (don't use its first revision), there's also efforts by r57shell that should be available at his github gist.

If you could figure out how Blargg's filter works and tweak it to meet PAL needs, that's be fantastic too. I even bought a CRT TV last winter just to be able to tell exactly what's going on. And soon I'll be getting an Avermedia tuner.

So far, I think the greatest problem with our implementaitons was that it didn't match the outcomes from tuner and TV because of arbitrary samplerate we were choosing. And because we weren't doing proper aspect ratio correction. I have some shots from my USB tuner that show what happens to the same color due to luma peaks not matching the pixels.

Image

See some kind of a wave that appears because moire phase doesn't match the pixel phase. You'd think that moire here is a sine wave? No. It's a square one! But the fact that it can't match the pixelrate results in different measures of resulting luma getting into each pixel.

Code: Select all

|00 01 02 03 04 05         |         03 04 05 06 07 08|                  06 07 08|
|                  06 07 08|00 01 02                  |00 01 02 03 04 05         |
It's the same square wave all the time, but the exact color you see in a pixel is a sum of these 2 values that end up in it.

Why am I describing all that?

Because it's what you see after you apply a notch filter - at color borders. See how
https://dl.dropboxusercontent.com/u/136 ... svideo.PNG
becomes
https://dl.dropboxusercontent.com/u/136 ... posite.PNG

I was choosing wrong samplerate, so I couldn't get the same result as on the second picture. Also, there's no need to use float conversions, that's not what decoders were doing. HardWareMan has the formulas that let us just substract and add, so probably it'd be fast enough to do all this stuff on the fly, instead of my lookup tables. Then chroma merge emulation will be more or less possible.

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

Re: PAL picture emulation tools

Post by rainwarrior » Tue May 31, 2016 9:20 am

feos wrote:
rainwarrior wrote:feos I renamed this to "PAL picture emulation tools" so my tool question thread won't be confused with your reverse engineering thread.
That's the same thing, we're only reverse engineering it to be able to come up with tools that emulate it.
No, it's not the same thing. I want to know if anybody has seen tools for simulating PAL picture; I am not really asking about the details of how PAL works; I would ask about that in your thread.

I understand that you might be the first/only person to attempt this in an NES emulator, but that doesn't mean there aren't other PAL simulation tools out there that might help.

feos wrote:there's also efforts by r57shell that should be available at his github gist.
All I could find in the other thread was this: https://gist.github.com/realmonster/23a ... d50e859f09
I can't tell quite what it's doing, though. Does it really have anything to do with PAL? It looks more like it's just trying to produce scanlines and phosphor colour stripes?

feos wrote:... lengthy technical reply ...
This is a response to a question I asked in the other thread, so I'm going to respond there. I appreciate that you're willing to answer questions about it, but please keep it together with the question. I have to keep two tabs open and jump back and forth just to understand what's going on here in your reply.

User avatar
feos
Posts: 107
Joined: Tue Apr 19, 2011 11:26 am
Location: RU
Contact:

:/

Post by feos » Tue May 31, 2016 9:35 am

There's no point in having them separated. See
viewtopic.php?t=8209
It discusses internals, implementation and the resulting tools. If we don't combine the threads, despite of the first one having info/examples regarding implementation, the having 2 tabs each time will be required for anyone who wants to participate, since tools are the goal of my thread, and you can't create/fix tools without info about internals.

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

Re: PAL picture emulation tools

Post by rainwarrior » Tue May 31, 2016 9:46 am

No, it really is a very different question that I am asking. PLEASE STOP INSISTING ON A MERGE. This is like if I asked about what sprite editing tools exist, and you insisted that I can only ask in some long thread about internal details about how YY-CHR was developed.

If your answer is "I don't know of such a tool, but I'm working on one, here's some details", that is a great answer, and I'm glad you gave it, but please don't start dumping those technical details here.

Your question was how to build it, and that is the topic of your thread. My question is what is ready to use. We do not have the same question. They are related, and any tools that appear in your thread would be relevant to mention here, but the rest is not.

User avatar
feos
Posts: 107
Joined: Tue Apr 19, 2011 11:26 am
Location: RU
Contact:

Re: PAL picture emulation tools

Post by feos » Tue May 31, 2016 10:09 am

Alright, let's just wait for someone to come up with a tool that hasn't yet been found, without ability to discuss its internals.

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

Re: PAL picture emulation tools

Post by rainwarrior » Tue May 31, 2016 10:13 am

feos wrote:My filter was close to it right before I disabled it (don't use its first revision)
Ah, I didn't see that it had been revised. I thought what freem showed me in the thread that put this question in my head was representative.

This is the last interim build made before it was disabled: r3194
battletoads_pal_r3194.png
This looks a lot closer to what I would expect, though yes I can see how downsampling is still a problem.

feos wrote:Alright, let's just wait for someone to come up with a tool that hasn't yet been found, without ability to discuss its internals.
Thank you, that is what I am looking for, sort of.

I'm not actually saying that no internal details are relevant to this thread, but half of this post is a non-sequitur in this thread because you're responding to something I said elsewhere.

I get that you don't see the point of my thread, but it's quite exasperating trying to justify my existence to you. Maybe you don't agree with me, but I did try to respect your request for a merge by both changing the title and asking my technical question in your thread and not here. I really am trying NOT to be redundant to your thread.

Post Reply