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

Add hidpi support #19

Merged
merged 1 commit into from
Sep 23, 2022
Merged

Add hidpi support #19

merged 1 commit into from
Sep 23, 2022

Conversation

christoph-heinrich
Copy link
Contributor

@christoph-heinrich christoph-heinrich commented Sep 22, 2022

In a mixed dpi setup, setting the resolution in the config is not sufficient for good results.

@hooke007
Copy link
Contributor

hooke007 commented Sep 23, 2022

It would break the output in my device.
Snipaste_2022-09-23_01-30-27

@christoph-heinrich
Copy link
Contributor Author

How come things keep breaking for you when it comes to hidpi stuff x.x works without a problem for me with any scaling value, be it integer or fractional.

@hooke007
Copy link
Contributor

hooke007 commented Sep 23, 2022

I quickly check the possible values. If scale =1.1xxxx , it will be broken. Too weird.

edit: 2.1xxxx 3.1xxxx meet with the same issue

@christoph-heinrich
Copy link
Contributor Author

christoph-heinrich commented Sep 23, 2022

Huh, 1.09 - 1.16 also breaks for me... that is so weird.

Edit: Now I don't know what kind of sorcery is going on here, but but that makes absolutely no sense at all...
If i set scale to 1.0 and have a max width of 220 in my config, resulting in a thumbnail size of 220x121, it works.
HOWEVER if I set scale to 1.1, and have a max width of 200 in my config, resulting in a thumbnail size of 220x121, it doesn't work.
I've tried it multiple times already, it's repeatable... no idea how that's even possible.

@hooke007
Copy link
Contributor

hooke007 commented Sep 23, 2022

Perhaps the filter dislike fractional numbers.

effective_w = math.floor(options.max_width * scale)

effective_h = math.floor(options.max_height * scale)

@christoph-heinrich
Copy link
Contributor Author

christoph-heinrich commented Sep 23, 2022

With the rounding it works. No idea why my previous example didn't work, as 200*1.1 should still be a clean 220, and the output also didn't show any comma digits, but oh well. Thanks for finding that.

Edit: I've been trying out a few things, inserting rounding in different places, and it makes less and less sense. Things that should be identical just don't work, sometimes the player even crashes. Maybe I'm missing something because I'm awfully tired. But what's important is that the commit above works.

@po5
Copy link
Owner

po5 commented Sep 23, 2022

If your main mpv instance is crashing, or more accurately freezing, it's caused by an overlay-add stride parameter that doesn't match the thumbnail's size.
This had taken me forever to figure out and get reliable.

@christoph-heinrich
Copy link
Contributor Author

christoph-heinrich commented Sep 23, 2022

I already suspected that it must be something like that, but I had rounding in draw() to make sure it's exact integers and I printed the scale parameter that's passed to the new mpv instance, which also contained the numbers as integers. So any place where it actually matters the numbers were the exact same integers and yet it only worked when it gets rounded directly in the calculation. Thus my confusion.

But the commit above works reliably afaict, and that's what matters.

@po5 po5 merged commit 6ca934b into po5:master Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants