MiSTer-devel / MegaDrive_MiSTer

Sega Megadrive for MiSTer
44 stars 14 forks source link

Analog Video Skew issue: Reintroduce VSync cleaning to video_cond? #45

Open henryrizzi opened 3 weeks ago

henryrizzi commented 3 weeks ago

All releases after MegaDrive_20230915.rbf the video is skewed on top for professional monitors which are pickier with their sync signal like the Ikegami HTM and JVC DT-V line. This change seems to be related to tweaks to the video_cond file regarding cleanups and changes to vsync handling. I swapped the following line to use vs_c instead of vs_in and it fixed the sync issue on my end.

I tested this change with the scaler for HDMI output, and it still synced with my monitor even if the flicker was more apparent.

Analog out testing via 240p test suite alternating resolution switching did produce more stable output using the cleaned output, and this output matched the output from a real Sega Genesis (any flicker matched output from console).

Current core version (20240408) IMG_5972

Genesis output IMG_5974

vs_in > vs_c change video_cond IMG_5973

henryrizzi commented 3 weeks ago

Test rbf attached here: MegaDrive_vs_c_test.zip

MP2E commented 3 weeks ago

Thanks for the detailed report! It looks like we do need to pass the cleaned VSync to the output, but the reason I was avoiding that is because the cleaned VSync breaks interlaced mode.

Very few games actually use interlaced mode so I’m fine with reverting the change, but I do wonder about the proper way to fix this issue while keeping interlaced mode working.

perhaps the fix is to clean the VSync, then reintroduce the half line delay if we’re in interlaced mode?

henryrizzi commented 3 weeks ago

Interlaced mode was still looking as expected via analog io after this reversion, but the behavior seemed to be a bit more strange going through the scaler. Is interlace mode broken after this reversion when going through the scan doubler? The alternating line widths might help, but I don't think I tested that build before. Is the interlace output mode in 240p test suite a valid test? And if not, what are some other titles to use to test interlace mode besides sonic 2 vs?

MP2E commented 3 weeks ago

I've just been testing Sonic 2 VS Mode on a Sony PVM 1953MD, via direct video. When the core goes into interlace mode with clean vsync, it does still display but the offset of the lines is not correct. It creates a much stronger flickering effect and is really noticeable in text. I also have a real Sega Genesis and can connect to the PVM with RGB and there the interlace video is much better looking

henryrizzi commented 2 weeks ago

Just checked myself today, it's definitely rougher for interlacing than it should be with cleaned vsync. And the frame interleave does seem to flicker more. I'll look over the cleaner code, since the line offset seems like it would help with 480i.. or maybe raw vsync when in 480i. I'll compare more with current stable version output at 480i and my md2.

MP2E commented 1 hour ago

MegaDrive_TestSync.zip Could you try this build and let me know if it resolves the skew issues in both progressive and interlace modes? Easy way to check would be the 240p Test Suite grid.

I'll post the change as a pull request if so