ramapcsx2 / gbs-control

GNU General Public License v3.0
773 stars 110 forks source link

Update web UI #413

Closed nyanpasu64 closed 1 year ago

nyanpasu64 commented 1 year ago

Fixes most of #412.

I'm not sure which changes you want to keep or not; I think you should test the changes yourself.

Initially I committed webui_html.h along with each change to the HTML source. But that made it difficult to remove or fixup individual commits, since the header file would be completely different after adding or removing each change, resulting in merge conflicts (unless you ran npm run build to regenerate the header, for every subsequent commit).

I decided to skip committing that header file at each step, and regenerate it in its own commit at the very end. This avoids merge conflicts and avoids bloating up the repository, but introduces the possibility that I forget to regenerate the file. (Scarily, even if I already rebuilt and committed the header from the current sources, npm run build alters webui_html.h anyway, because gzip includes a 4-byte timestamp in the header at bytes 4..=7.)

Testing:

Unresolved issues:

nyanpasu64 commented 1 year ago

Proposed description (for a later PR):

Auto Gain increases gain so bright areas are displayed as white, then decreases it when clipping is detected. Calibrate for a few seconds on a white screen.

My concern is that if you leave auto gain on, it resets its initial value when the GBS-C is rebooted, requiring the user to again bring up an all-white screen, or else highlights will be clipped (unfortunately auto gain will not reliably identify small white highlights, since it only samples individual points in the image to look for clipping). And if you turn off auto gain after calibration, switching resolutions will reset the current gain to default.

Saving presets triggers bug #401 for 480p inputs (which has a workaround). On the plus side, it saves the current gain (though separately for 15 and 31 KHz inputs), and restores it when you load the preset.

ramapcsx2 commented 1 year ago

Auto gain: It does what you deducted :p So the ADC has gain controls on the 3 color channels. Each gain should be set to match the incoming voltage from the source, after cables and passive component and all that. It's clear that most sources will not be a perfect 0.7Vpp on all 3 colors. So auto gain first increases gain to deliberately cause clipping conditions, then it reduces it whenever clipping occurs. So far so good. There is a problem with this, as the debug bus where the ADC values are reported is a) not documented (nothing of the debug stuff is) b) not updating quickly enough c) possibly not sampled (via I2C) often enough So clipping events get missed, and the adjust phase has to run longer. Also, the source video could simply be displaying a lot of dark content at the time.

The tuning of the algorithm tries to work with the constraints, and worked really well for me. I typically left it enabled.

ramapcsx2 commented 1 year ago

Line filter is a preference. Sometimes it's also required for ie Motion Adaptive or the Scanlines.. iirc.

ramapcsx2 commented 1 year ago

Auto gain kinda has to always run, whenever the source changes or power is cycled. Nothing guarantees that the source has not changed, the cables got worse, or any other real world difference that no one told the GBS about ;p

nyanpasu64 commented 1 year ago

Added the Auto Gain description. Personally I think it reads fine.

After testing for a few days, I like the change that makes help remain expanded across page reloads, and don't plan to revert it before merging.

ramapcsx2 commented 1 year ago

Sounds good! The explanation for auto gain can be either complete, but span 3 paragraphs, or a short version like yours. I prefer yours for the UI ;p