GaryOderNichts / evwii

Wii U plugin to enhance the vWii mode
GNU General Public License v2.0
71 stars 2 forks source link

[feature request] fixing vwii video issues #1

Open Reual4412 opened 1 year ago

Reual4412 commented 1 year ago

What we know is that there seems to be a color space issue. https://gbatemp.net/threads/fixing-vwii-mode.573265/post-9391136 (he says it's his display. But, I suspect that's the output from the cable, as it's even repeatable on my monitor. )

What the issue is specifically is the cable is giving a rec 709 over hdmi, on vwii mode, which is HD color space. Not the correct 609 color space, which is for SD. Which given that the wiiu (in wiiu mode) doesn't properly send RGB range in the first place. (yet somehow does in vwii) It's unlikely Nintendo properly implemented that in the first place.

The second issue, seems to be what's causing the color bleed. https://gbatemp.net/threads/fixing-vwii-mode.573265/post-9512768

The OG wii does a RGB color space (internally) and then does a conversion to YcBCr, which according to the user, is 4:2:2. Basically, Nintendo's DMCU? (I'm not sure if that's the exact cause, but considering that it's responsible for VI in vwii.) instead of doing the correct 4:2:2 format. It's doing YCrCb 4:4:4. this creates the color bleed and other issues. (Or rather, making them far worse. as the original Wii already had light color bleed.)

Regardless if this is possible to fix or not. Thanks, honestly. It's already amazing to be finally done with the overcropping issue.

GaryOderNichts commented 1 year ago

Thanks for mentioning this, I completely missed those posts while skimming over the "Fixing vWii Mode" thread.

Regarding the first issue: Color Matrix Transformation is disabled in vWii mode, which might confirm the suspicion in the original thread:

On vWii I believe the issue is that the game is rendering SD 601 colours, but vWii is neglecting to convert them to HD 709 colours before outputting them as 709 colours over HDMI.

Not too sure about the second issue though, the pixel encoding format is set to YCbCr 4:2:2 while in vWii mode.

Reual4412 commented 1 year ago

Not too sure about the second issue though, the pixel encoding format is set to YCbCr 4:2:2 while in vWii mode.

Interesting, unless the view port fix fixed the colorbleed issue. (that or it's just purely caused by that color space issue, or something else entirely. One step at a time I suppose) Also awesome to hear I was able to help somewhat.

aaron-clovsky commented 1 year ago

The chroma bleed issue is unfortunately not fixed by evwii for now (it would be amazing if it could be fixed). I have tested both Wind Waker (via Nintendont) and Skyward Sword at 1080p and 480p via HDMI as well as 480p via component while using evwii 0.2. The issue is most clearly visible in skyward sword when looking at the white outline/glow around the goddess statue in the intro - the glow on the right side of the statue is clearly non-white due to the bleeding. For Wind Waker I set evwii to 640x480 to try and reduce scaling artifacts, but bleed could still be seen on Link's right side during the playable intro segments. It honestly looks like a 1-2 pixel horizontal chroma/luma offset (though how that sort of bug is even possible I can't imagine). I can post uncompressed screen captures if that would be helpful.

aaron-clovsky commented 1 year ago

For future reference here are comparison captures, both were taken with the following fixes applied to try and get as raw a framebuffer capture as possible:

All captures are fully uncompressed (rgb24) taken with a Magewell capture card and saved to a PNG with ffmpeg.

First capture is from the Wii and was captured unscaled with an OSSC connected with component cables using optimal timings.

image

Second capture is from the Wii U in vWii mode outputting 480p with evwii set to 720x480 and was captured directly via HDMI.

image

For dramatic effect here's the zoom in (scaled nearest neighbor):

Wii:

image

Wii U (evwii):

image

Hopefully this helps!

Mii-U commented 1 year ago

According to NoobletCheese, the chroma bug seems to be coming from the a misalingment of the CbCr channels, and that it could be solved by outputting RGB instead of YCbCr.

Could a toggle for RGB/YCbCr be added to evWii?

Original post: https://gbatemp.net/threads/fixing-vwii-mode.573265/post-9758960

Ingunar commented 1 year ago

I used Nintendont to force different video modes, and I can confirm this behavior: Just a reminder, the chroma is usually slightly shifted to the left and it is yellowish.

The red shift would stay in the HBC and SM, so there would be no more yellowish bleed. (Shift to yellowish does reset after the reboot)

When booting the game, staying at 50Hz is the goal:

Rulumi commented 1 year ago

I think I already said about this a bit on the linked threads when testing the evwii first version output, but the chroma shift seems to vary between a very ugly one and a fine-ish one according to how the software sets the video output and the VI (and if it reinitializes it or not too?). I imagine this is a bug in Nintendo's implementation on the Wii U as of course doesn't happen on GameCube and Wii.

If you output on 1:1 without crop and look carefully, when there's more chroma shift, the most horizontal pixels of the vWii output are green on each side. It also always crops one pixel on the game image right side when there's more chroma shift. There are some images that show that below (all with evwii for the Wii U).

Wii U (most chroma shift): amarec(20230825-1724) avi_snapshot_00 15_ 2023 08 25_18 05 20

Wii U (less chroma shift): amarec(20230825-1731) avi_snapshot_00 14_ 2023 08 25_18 05 14

Wii (2006 unit): amarec(20230825-1747) avi_snapshot_00 25_ 2023 08 25_18 05 49

### 300% zoom

Wii U (most chroma shift): image

Wii U (less chroma shift): image

Wii (2006 unit): image

MDHEXT commented 11 months ago

I think this would require a rewrite of the DMCU firmware to fix. And I don't believe anyone knows in enough real great detail how the DMCU firmware works exactly to be able to rewrite it to fix all of this.

GaryOderNichts commented 11 months ago

I think this would require a rewrite of the DMCU firmware to fix. And I don't believe anyone knows in enough real great detail how the DMCU firmware works exactly to be able to rewrite it to fix all of this.

I have the DMCU firmware mostly reverse engineered and partially reimplemented. Unfortunately that doesn't automatically help with fixing the chroma shift issues. There's a lot more testing required to figure out what exactly causes it.

Cynirex commented 8 months ago

Hopefully this is something that can be solved in the near future, seeing as DMCU is mostly reverse engineered. Nintendo really dropped the ball with the Wii U.

mariomadproductions commented 7 months ago

Is latency also something that people have reproduced/tested? I've noticed it, although I haven't tested it, and its been reported as about 20ms, which is pretty high. I'm using a European Wii U, if that makes a difference.

wizardkitty commented 1 month ago

If the chroma shift is fixed it would make the wii u almost perfect for most wii games. I would LOVE to see a fix for the issue in the future.