Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Glass & Dark Mode] Improve rendering performances methods #105

Closed
gileli121 opened this issue May 30, 2021 · 1 comment
Closed

[Glass & Dark Mode] Improve rendering performances methods #105

gileli121 opened this issue May 30, 2021 · 1 comment
Labels
enhancement New feature or request Feature-Dark-Mode

Comments

@gileli121
Copy link
Member

gileli121 commented May 30, 2021

Currently, the dark mode feature needs to process the frame of the window, and using an algorithm it assumes where exactly are the images in the frame. Then it knows to not invert the colors in these areas.

Same for the Glass mode - The glass mode needs also another algorithm that detects any text in the frame.

After more investigation of the available APIs in the system, seems that these algorithms are unnecessary.
The system has API to get directly the DOM of any window

This API allows you to get directly all of the information that is needed.
Now it is possible to know where exactly the window showing an image, where it shows text and without any need to recognize it using an algorithm that try to figure it out using just pixels.

Tasks:

  • Replace the image & text detection algorithms with this API. We will now get directly this information without any need to detect it

This should fix the issues:

@gileli121
Copy link
Member Author

gileli121 commented Sep 30, 2022

I found a new way how to improve the rendering performances!
Until a few days ago, I was unaware of how to invert the colors of 8,294,400 pixels (the amount in 4K resolution) in GPU without using NVIDIA CUDA API (which requires NVIDIA GPU).

And recently, I found a way to do it!
In Dricent2D API, there is a GPU-accelerated method to do that, and because it is Dricent2D, it is not exclusive to NVIDIA GPUs! It will work on even regular Intel GPUs. This finding means that every computer will use the GPU for this effect. Great stuff!

I made a POC that proves that it is possible to get 60+ frames per second on 4K using just intel GPU, and this is instead of 20-30 FPS.

Not only that, but this finding also comes with a new optimization advantage: because the OS API also does not send the captured frame to the CPU and because Dricent2D will do its magic in GPU, now, unlike before, we will never need to move any frame data to CPU (unless the "filter images" option is enabled) so this fact also will help.
This will also reduce a lot of battery usage because everything will be done natively by the GPU!

The idea in the message above (To use DOM API) may still be worth checking after this finding. It is still relevant because it tries to optimize the performances when the "filter images" option is enabled.

Opened task #264 for this optimization method

@gileli121 gileli121 pinned this issue Sep 30, 2022
@gileli121 gileli121 changed the title Dark/Glass Modes - Improve rendering performance by removing the need of image & text recognition algorithms Dark Modes - Improve rendering performance by using Direct2D and maybe by using DOM information Sep 30, 2022
@gileli121 gileli121 changed the title Dark Modes - Improve rendering performance by using Direct2D and maybe by using DOM information [Dark Mode] Improve rendering performance by using Direct2D and maybe by using DOM information Sep 30, 2022
@gileli121 gileli121 changed the title [Dark Mode] Improve rendering performance by using Direct2D and maybe by using DOM information [Glass & Dark Mode] Improve rendering performances methods Sep 30, 2022
@gileli121 gileli121 unpinned this issue Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Feature-Dark-Mode
Projects
None yet
Development

No branches or pull requests

1 participant