Code Monkey home page Code Monkey logo

fizeau's Introduction

Fizeau

Adjust the color of the screen of your Nintendo Switch.

Features

  • Modify the color temperature of the display.
  • Filter colors to one single component.
  • Apply color corrections: gamma, luminance, and color range.
  • Schedule settings to be applied to dusk/dawn time, with smooth transitions.
  • Configurable screen dimming.

Images

Installation

Download the latest zip from the release page, unzip it to the root of your sd card (be careful to merge and not overwrite folders), and reboot.

Only the latest version of the Atmosphère CFW is supported.

If you want to use the overlay, you will need to set up Tesla (install Tesla-Menu and ovlloader). This isn't supported on firmware versions prior to 9.0.0.

Supported firmwares

Firmware versions 9.0.0 and later are supported. If you encounter an issue running this software on a particular version, please create an issue.

Usage

You can refer to the built-in help. Navigate with either the touchscreen or the D-pad buttons.

Settings

Settings are saved at /switch/Fizeau/config.ini and /config/Fizeau/config.ini (in order of priority), which you can also edit.

Building

  • Compiling requires a working devkitA64 installation, with package switch-glm installed. You also need rsync to be available (it should be by default on all major operating systems).
  • Clone this repository recursively (git clone --recursive https://github.com/averne/Fizeau)
  • Navigate to its directory (cd Fizeau).
  • Run make dist.
  • You will find the output file in out/.

How it works

This software uses the CMU (Color Management Unit) built into the Tegra GPU of the Nintendo Switch. The purpose of this unit is to enable gamma correction/color gamut changes.

The CMU works in 3 passes:

  • the first pass converts 8-bit sRGB data into a 12-bit linear colorspace, using a LUT (look-up table). Therefore, it also increases the precision of the color data.
  • the second pass is a dot product between the CSC (Color Space Correction) matrix and the RGB data, as illustrated below.

  • the third pass maps the 12-bit linear, now corrected color data back into 8-bit sRGB, using another LUT. Hence the precision after this pass is decreased. Moreover, this LUT is split into two parts: the first 512 entries map [0, 32), while the 448 other represent [32, 256). This allows greater precision for darker color components, which the human eye is more sensitive to.

Overview of the CMU pipeline:

More detail can be found in the TRM (Tegra Reference Manual), section 24.3.14 (Display Color Management Unit).

Official software use the CMU for multiple purposes (the following images were generated using a script found here, with data dumped from running official software):

  • Represented below is the default CMU configuration. No correction is applied:

  • Color inversion is applied using the LUT2, which is simply inverted:

  • Grayscale is implemented with the CSC, using the luminance function Y = 0.2126 * R + 0.7152 * G + 0.0722 * B on each component (the actual coefficients being 0.2109375, 0.7109375 and 0.0703125 due to the limited precision of CSC components which are 10-bit signed Q1.8 numbers):

  • Lastly, luminance correction, here with a luma=1.0 (color range correction is very similar):

In addition, the color range of the external display is restricted using the HDMI AVI (Auxiliary Video Information) infoframe.

Official software uses precalculated default gamma ramps, and apply modifications to those (the relevant function can be found at .text + 0x05c70 in 6.0.0 nvnflinger). However here gamma ramps are generated at runtime, which is both more elegant and easily enables non-default gamma. The generated LUT1 is byte-for-byte identical to the official one.

Credits

fizeau's People

Contributors

aurorawright avatar averne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fizeau's Issues

Can't make the temperature colder

Unless I'm missing something, I'm unable to make the color temperature colder on my switch, only warmer.

My switch is on the older side, and suffers from a slightly yellower display. I saw this Youtube video which showed an RGB slider in the Fizeau app which I thought would do the trick, but those options seem to have been removed in the latest version.

I've set the color temperature in the app to as cold as it can go (all the way to the right), however this temperature appears to be the default native temperature and make no difference in terms of cooling off the screen.

Is there a reason the RGB sliders have been removed from the latest version of the app? Is there another way to accomplish what I'm after in this new version?

Thanks!

Compatibility with Neutos

I get error 0x1 (2001-0000) when starting Fizeau with Neutos CFW. It's a fork of Atmosphere so how hard would it be to make FIzeau compatible with it?
Edit: updating Fizeau fixes it

Potential Tinfoil Crash

Hi, I am running atmos 16 with hetake 5.5 on 11.0 firmware. I installed fizeau to the root of my sd + got my prod keys with lockpick. These were the only two actions I took. After these, tinfoil was reading corrupted data from my sd card and would not launch. I am unsure if fizeau is related in any way but I wanted to let you know as I still have not found a fix.

Ams 1.2.4

Doesn't work on newest ams, crashes atmosphere on trying to enter the homebrew menu. Update again please🙏

Atmosphere 1.2.1 panic error

Hi, I give you report that Fizeau broke on new versions:

Fizeau 2.2.2
Atmosphere 1.2.1 with fusee
Firmware 13.1.0

Panic error on boot.

Thx

error on start

Error 0xf601 (2001-0123)
System version: 10.1.0
Atmos version: 0.14.1

If there's any more info you need just let me know!

config.ini at ./config/Fizeau instead of ./switch/Fizeau

Hiya. How would you feel about storing the config at sdmc:/config/Fizeau instead of storing it in the /switch folder? Be cleaner that way if we could get more devs to put their config files there instead of everyone storing them alongside the .nro

It would be a little more convenient that way for users when updating too, because they could just copy/overwrite the /atmosphere and /switch folders to update, leaving /config untouched. Otherwise they have to go through the archive to extract and replace only the nro, and that's a bit of a hassle.

14.0.0 update fizeau crash on launch

Fizeau is making atmosphere crash on boot, I have downloaded latest build but when i open the overlay it just goes back to tesla menu the overlay doesnt appear, any way to fix

14.0.0 support

Dear @averne!

Please do the support for FW 14.0.0, AMS 1.3.0.

Thank you VM in Advance!!!

Color correction not working in docked mode when in-game

I'm on version 10.1.0 with Atmosphere 0.14.0
I'm not using the Tesla Overlay, just the homebrew app.
I have the service enabled in Kosmos Toolbox.
The color correction works at the home menu, works during the nintendo loading screen when launching a game, but disappears and goes back to normal when the actual game menu is loaded.
It works fine in handheld mode.
Tested with Legend of Zelda: BOTW and Splatoon 2.

Fizeau

Hi fizeau no working en atmosphear 0.14.3

SX OS compatibility issue?

hi beloved dev, i tried running the brew on sx but it shows black screen and stuck, any input from other people or is it not compatible with sx os?

thanks

You need a toolbox.json

Create a file named toolbox.json next to the exefs.nsp with this content

{
    "name"  : "Fizeau",
    "tid"   : "0100000000000F12",
    "requires_reboot": false
}

Firmware 11.0.0

Hello I get an error message on the firmware 11.0.0 : a fatal error occurred when running atmosphere

Feature Request: Add a toggle to follow HOS brightness level and dimming timeout settings

I've encountered some issues in which that the backlight is not dimmed when auto-sleep is enabled, it seems that the backlight and color correction is readjusted (when auto-sleep dimming is triggered) to the set brightness profile settings when Fizeau is active.

My setup:

Fizeau version: 2.1.2-9449f24
HOS: 11.0.1
Atmosphere: 0.17.0

EDIT:

I just found out that Fizeau has an independent option for dimming timeout. Would you consider adding a toggle for Fizeau to follow HOS' settings for brightness level and dimming timeout?

Controls messed up

I'm on Atmosphere 0.14.1, and while everything seems to work, the non-touchscreen controls don't match up to the instructions.

L does nothing. R does the same thing as X, and while the 'D-Pad' on the left will control every other slider, it does not affect the Brightness slider.

Fails to start on latest firmware

Running latest OFW and also latest version of Atmosphere CFW.
Greeted with error "0x10601 (2001-0131)"
Have tried turning off SysDVR and Sys-clk

Error: 0x1 (2001-0000)

On AMS 0.18.0 and using version 2.1.3-0a00d21. I've tried removing and reinstalling but that isn't working

Disable at startup?

Is there anyway to disable the filter at startup?
In my case it is auto start even when it reaches nintendo boot logo at startup.
I tried to turn it off (switch to inactive), but then when I reboot the switch it goes back to active.
Any suggestion will be appreciated. Thank you in advance.
Cheers.
Screenshot_20210514-190134_Gallery

Atmosphere 0.19.4 An error occurred

Hi, I report again Fizeau broke on new versions:

Fizeau 2.1.7
Atmosphere 0.19.4 with fusee-primary
Firmware 12.0.3

An error occurred: 0xf601 (2001-0123)

Thx

Saturation Control

I think it would be neat to have a slider/option to adjust the colour saturation. I might look into implementing this, at some point.

I believe this is possible by adjusting the CSC matrix.

As a quick PoC, I made this python script for adjusting the saturation of an image, based on a CSC matrix:

from PIL import Image

def norm(n):
	return max(0, min(int(n), 255))

def gamma(x):
	return x ** 2.2

def ungamma(x):
	return max(x, 0) ** (1.0/2.2)

im = Image.open("flowers.png")
width, height = im.size
pixels = im.load()

lr, lg, lb = (.2126, 0.7152, 0.0722)
f = 1.0

for y in range(height):
	for x in range(width):
		r, g, b = map(gamma, pixels[x, y])
		r1 = r * ((1+f*(1-lr)))  + g * (-f*lg)         + b * (-f*lb)
		g1 = r * (-f*lr)         + g * ((1+f*(1-lg)))  + b * (-f*lb)
		b1 = r * (-f*lr)         + g * (-f*lg)         + b * ((1+f*(1-lb)))
		pixels[x, y] = tuple(map(lambda x: norm(ungamma(x)), (r1, g1, b1)))

im.save("saturated.png")

The variable f controls the saturation level. -1 is fully desaturated, 0 is normal, and above zero is increasingly saturated.

Example input:
image

Example output (f=1.0):
image

Disabled after screen off

Hi,

Eveytime I turn off the screen and on again, Fizeau is disabled.
Also, I installed last version of the chainloader but Fizeau is not applied automatically.

My Switch is first gen, with last version of Atmosphere (1.2.6) and firmware 13.2.0

Thanks for this great app.

OFW 12.1.0 with AMS 0.19.5 support

Hello dear averne!..

Please do a support for OFW 12.1.0 with AMS 0.19.5 support, 'cause right now it's 010000000000CF12 yellow screen of death. :(

Thank you in advance!

toolbox.json in chl package + minor bug

Some feedback:

  • The toolbox.json should probably be removed from 0100000000000F12 in the chl release package and a new json created in 010000000000CF12 to manage the boot2.flag there. The sysmodules overlay does mark fizeau chl as 'off' but that's secondary to actually managing the boot2.flag I'd say.

  • Attempting to launch the ovl if the fizeau sysmodule is not running silently crashes tesla until reboot, ideally an error message or something to inform the user that the sysmodule is not running would pop up instead as the nro homebrew does.

"Correction active" toggle results in freeze and crash on latest version

I'm experiencing the following freeze and crash with the latest commit of Fizeau:

Console and environment: Switch Lite (Mariko), atmosphere 1.3.2, firmware 14.1.1
Sysmodules: Tesla + Fizeau

The console freezes then reboots when selecting the "Correction active" toggle in either the overlay or the homebrew. I also use Tesla on an Erista console and this does not happen there, so it seems to be a hardware specific issue? Also to note that Fizeau works normally otherwise, just that the toggle triggers the crash.

These crash and fatal reports are generated:
https://gist.github.com/pixeltester/03f9ec8dfdce71756b5075b510e3d9b4

Some minor issues/bugs with Fizeau

I would like to report a few issues/bugs with the latest version of Fizeau. I am not sure if these are expected or even resolvable but thought they were worth mentioning in case something was missed. I am sorry if some of the details are a bit vague.

I am using the actions build https://github.com/averne/Fizeau/actions/runs/2036835490 to be able to use Fizeau on current firmware and I have been using the latest atmosphere and latest official firmware.

The first issue is that any type of reboot or shutdown takes around 10 seconds if Fizeau is running instead of being more or less instant as it is normally.

The second issue is a little more vague but I found that if Fizeau is running the Tesla sysmodule and even some homebrew experience data aborts more frequently which cause atmosphere to crash. The main one I come across is when frequently opening and closing a Tesla overlay to use its functions, I usually experience this with the emuiibo overlay for example.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.