Repository navigation
LinGui: Reworked dimensions tab - #3546
Conversation
a614df3 to
531b752
Compare
|
A couple of issues:
|
When not upscaling, Use Maximum Size keeps the scale dimensions == source - crop. Otherwise, as you change crop, scale doesn't change and you have to manually adjust scale if you want the maximum possible scaling without upscaling. |
|
I don't follow your reasoning for the placement of "Allow Upscaling" and "Use Maximum Size". "Resolution limit" and "Maximum size" are intimately connected, so I don't see why you would put those options between them. It seems to me they are best either at the top or just above "Scale size" since they are unrelated to anamorphic. |
|
GTK doesn't appear to have a standard lock/unlock icon. So if we are going to do the lock toggle button thing, I'll need a couple icons to work with. |
|
An idea. Instead of repeating "Borders". Have the heading say Borders, and the popup label say "Fill" with options "None", "Surround", "Height (Letterbox)", "Width (Pillarbox)", "Custom". A couple advantages to this. Deletes the repetition, and makes the option text short enough that it better aligns the right side of the popup box with the right side of the Top pad entry. It's still a smidgen wider, but looks better. |
Good stuff. Fill as a label is fine; I must have been thinking there could be other types, but that seems unlikely. In hindsight, we should probably change Fill (Surround) to Fill Height & Width, because you just know someone is going to think it has something to do with surround sound. Maybe also place it last in the list. I need to think/sleep on the resolution section, only half-formed thoughts right now. I can create suitable lock/unlock icon resources. I feel like we want to reset the display aspect when locking the fields, but that seems like a layer of magic atop more traditional lock behavior. Thoughts? |
That's the current behavior. The button is essentially !PictureKeepAspect which is passed as a flag to hb_set_anamorphic_size2 which tells it to "keep the source display aspect". So when "locked" it will revert to the source display aspect. Maybe a lock isn't the right emblem, but I think that's the right behavior. |
|
Nesting Allow Upscaling and Use Maximum Size under Scaled Size seems like a good choice. Keeps them away from things they don't affect directly (or as directly) and avoids leading with checkboxes, putting Resolution Limit first in the list. I gotta have Resolution Limit first in the list. I believe I understand the Use Maximum Size behavior you've described. It wasn't my original intention but it does make some sense. To continue with that behavior, though, something should be renamed to disassociate Maximum Size and Use Maximum Size. If we go all the way back to one of the earliest incarnations of the Dimensions tab redesign (Aug/Sept 2016!), we had a Scaling control with Fill as one of the options. Ultimately, we decided to create Allow Upscaling to gate the whole thing, with Fill being renamed to Use Maximum Size and becoming a checkbox. This was before PAR controls were added, so it inherently was not intended to keep PAR at the time. So that's the origin story, at least. Maybe in conjunction with moving those controls under Scaled Size, we could rename Use Maximum Size to something with OG Fill in it, or a synonym in this context. Scaled Size, Allow Upscaling, Upscale Fill? Upscale To Fill? Upscale Dr. Phil? Upscale Punxsutawney Phil? Upscale The LA Philharmonic aka LA Phil? You could add a third checkbox, "Keep PAR" that when unchecked, sets Scaled Size == Maximum Size and adjusts PAR, basically splitting Use Maximum Size into Upscale |
Is there a corresponding edit (sans clearing) icon? That seems like it would work. |
Nope |
|
Also, is there an online reference for your icon set? I downloaded a tarball of the GNOME 3 default icon set a few days ago, but it might not be correct as the edit-clear icon is a broom. |
LinGui has always had a checkbox to enable this behavior which was previously linked to the deprecated preset key UsesPictureSettings != 1. Checkbox says "Optimal for source" which doesn't quite fit either, but perhaps the word "Optimal" could be worked in somehow to distinguish from "Maximum". |
|
Optimal For Dr Phil? |
If you have a linux vm running, there's a python script that will let you browse the icons: And here's a list of the "standard" icon names |
|
Oh the script is cool, will use that to get a better look on Fedora. I found a list of standard names and was using a tarball from https://packages.debian.org/buster/gnome-icon-theme, specifically http://deb.debian.org/debian/pool/main/g/gnome-icon-theme/gnome-icon-theme_3.12.0.orig.tar.xz |
|
My last commit has the readonly and edit-clear icons if you want to see that combination in action. |
|
Cool, just started a build on bare metal Fedora 33. 😸 |
Loose attempts to stay as close as possible to original source PAR. We had a discussion on IRC about that and you convinced me there's no benefit to doing that. If you are not scaling (i.e. only crop is occuring), auto happens to result in the same PAR as the source. If you are scaling, you really want to keep as many source pixels as possible, PAR be damned. If a specific PAR is important for some use case, you probably need to set a specific PAR with custom anamorphic anyway. |
|
One case where keeping the original PAR might be desirable is when upscaling. There's not a lot of point in taking a cropped 1920 x 800 HD video and upscaling to 1920 x 1080 if it's only going to get downscaled back to 1920 x 800 again at playback. But we can do that automatically without the use of a special mode. Auto + upscale could trigger that behavior in hb_set_anamorphic_mode2 if desired. |
|
Thinking more about the auto + upscale use case... I can't think of any scenario where I would personally use upscaling with auto anamorphic, which is why I'm wondering if it's behavior should be something different. The arguments for permitting upscaling are usually either the player has a crummy scaler or the output needs to exactly match some standard. If you are upscaling a 1920x800 video to 1920x1080, you will have to rescale it on playback and it does not conform to any standard format (because PAR is nonstandard). So none of the usual arguments apply. Maybe there is some other use case for this type of upscale that I'm not thinking of? Maybe we want to allow it even though we can't think of a use case for it (file size be damned)? I'm really just looking for ideas on what the use cases for this might be. If there are none, maybe some tweak in behavior would satisfy some use case and make this feature better. |
|
To be clear, I'm talking only about anamorphic auto + allow upscale + use max size. |
|
Right, given full-screen playback, 1920x800->1920x1080 on a 1920x1080 display would basically be upscaling the height and scaling it back down on playback. That said, the additional (interpolated) resolution could be useful on a higher resolution display, on which playback could also be windowed at 2592x1080. |
|
I suppose we could get clever with Optimal Size and not upscale the height where the width already equals the max width? There are probably tallscreen considerations as well; perhaps it should not upscale where the longest dimension is equal to the max (resolution limit) for that dimension? Since we renamed Use Maximum Size to Optimal Size, that probably gives us some wiggle room to be clever in these cases. That said, it's upscaling which is advanced and not part of any preset, so we could just say "there be dragons" and leave it as-is. |
|
Example: Resolution Limit: 1920x1080 Resolution Limit: 3840x2160 |
|
Another way of thinking about this which might be an easier condition to code, is when Optimal Size is used in conjunction with Allow Upscaling, only upscale when both dimensions will increase. |
I.e. if you increase width = W * X, also increase height = H * X (subject to maxWidth and maxHeight)? That seems reasonable. If you do the math, that results in keeping the source PAR, which would be trivial to implement as we already have a code path for setting a specific PAR in hb_set_anamorphic_size2. Another option that has some appeal (and some complications) is to use a fixed PAR of 1:1 and only upscale if both dimensions increase. 1:1 PAR matches the PAR of most screens and most modern video standards, the appeal is more aesthetic than anything else 🤷♂️ . The complication is that you do have to test if it resulted in reduction of one dimension. I prefer the previous solution for it's simplicity 😉 |
More like: |
|
Umm, doesn't that result in the exact behavior we currently have. Output would be 1920x1080 for 1920x800 input. |
|
It's not exactly the same I suppose, but it's close enough that it's a difference without a distinction. An input of 1918 x 800 would result again in 1920 x 1080 output. |
|
It results in 1920x800 output, because max width is not greater than width (we would be scaling only height to no advantage). |
That's true. |
|
I pretty much never want to keep PAR when scaling up or down. Perhaps we simply need a Keep PAR checkbox for people who do. Or a new anamorphic mode called Keep PAR. 😅 |
|
It's not about keeping PAR. That just happens to be a side effect of not scaling one dimension more than another. |
|
Perhaps a checkbox nested under Pixel Aspect, ☑️ Keep Original.
In that case, could the issue be better defined as, upscaling between zero and a very small percentage in any one dimension is not optimal? |
0.88 is just a rough idea. |
There's no point in adding such a feature to the UI. I'm not asking for that.
Upscaling is never optimal. It is done for some specific purpose that is antithetical to optimality. My issue is that our current behavior when upscale and optimal size are checked doesn't appear to serve any purpose. I'm searching for an outcome that serves some purpose. Downscaling with optimal size checked serves a distinct purpose, it maximizes quality by keeping the most original pixels possible. Upscaling behavior with optimal checked has no equivalent purpose. I'm sounding very emo right now 👅 |
|
If someone wants to always upscale to fill the resolution limit, they would have to disable Optimal Size and manually match the Storage Size fields to the Maximum Size fields... |
The question is, why would someone want to do that? I'm just trying to come up with a behavior that might be more generally useful. |
Indeed, it explicitly conveys the user's intention to avoid downscaling, beyond the enforcing the Resolution Limit. This allows us to automatically adjust storage size as the user changes crop values, as you mentioned previously.
Likewise, it explicitly conveys the user's intention when upscaling: "just friggin' upscale it!" 😆 This again allows us to adjust storage size automatically, preventing the user from having to manually enter storage size values; i.e., they've already told us once via Resolution Limit / Maximum Size. The main difference is, in the downscaling case, knowing the explicit intention both prevents inconvenience (user must adjust storage size values after adjusting cropping values) and potential harm (failure to do so will negatively affect picture quality). In the upscaling case, it only prevents inconvenience (user must adjust storage size values to match what they've already given us elsewhere), as there is no potential for harm. So I'd say it's consistent and helpful in the UI, even though it's not solving an equivalent potential technical problem.
Right. Traditionally, the answer has been Just Don't Do It™, largely because of storage considerations and the fact devices and softwares do this for you in real-time. Up until recently, the assumption has always been we can't do much better, if any, than a TV's scaler. Why would someone want to upscale using a dumb windowing algorithm? Except in edge cases where additional restoration is warranted, it's a lot of downside for little if any benefit. It absolutely does make sense to upscale using as much storage resolution as possible using state-of-the-art upscaling technology. AI-based upscaling can be quite impressive (I've been doing some of this manually), and I suspect it will be some time before most people's TVs have comparable capabilities (and even then, real-time constraints apply). I really doubt NLMeans+AI scaling on difficult sources will be outmatched by consumer hardware anytime soon. Until then, it is still useful for me as a user to have a preset for tough sources that dictates, "denoise the source, upscale it to this limit, and apply a sharpening filter". Because even NLMeans+dumbscaler+dumbsharp, as it now stands, can be pretty effective if you're willing to pay with file size. So there are good reasons to specify and record the explicit intention of using all available storage size, in any case, now and in the future. |
|
OK. I relent. I actually can see someone wanting to use as much software filtering as possible up to the resolution limits of some specific decoder hardware. That's a use case that hadn't occurred to me.
I've not seen any denoiser, much less a good one on consumer hardware. The NVidia Shield Pro has an AI scaler, but TBH, I've not done any comparisons to see how good it is. |
|
Food for though, adding complexity to the UI for the 0.1% use case. Is it worth it? |
Nope. But nothing we were talking about affected UI. It's all about the under the covers behavior and what behavior would be most useful for the UI as it now stands in this PR. |
I realize my last was a bit "thorough". 🤣 Hopefully I didn't come off as attempting to apply pressure or argue. Mostly just thinking through things "out loud".
Yeah. And probably rare that one would be exposed to the user directly. I do have an older 1080p plasma display with a denoise filter roughly equivalent to hqdn3d on the light and medium settings, and pretty ugly on the strong setting. Definitely some sort of low pass implementation. There's an automatic mode that seems to apply the medium setting to pretty much everything, even to high quality material. So it's actually harmful to higher quality video, and naturally, I leave it disabled.
Always a good question to be asking. In this case, the control already exists and is necessary when downscaling, just trying to define/clarify how it should behave when upscaling. |
|
So, I think this PR is ready short of any additional support @sr55 might need for WinGUI. Do you need a json interface to hb_rotate_geometry()? Any other json interfaces that would be helpful? |
Also includes libhb changes to support new dimensions tab. New libhb function hb_rotate_geometry() helper for rotating dimensions tab settings when rotation filter settings change. Simplified hb_set_anamorphic_size2 and added support for updating display size. Added new pad filter parameters top, bottom, left, right to make interface to pad filter fit more easily with our UI. Added preset keys for pad filter PicturePadMode, PicturePadColor, PicturePadTop, PicturePadBottom, PicturePadLeft, PicturePadRight. Added preset keys PictureAllowUpscaling, PictureUseMaximumSize which are used in the new dimensions tab.
b7050f0 to
16f2d03
Compare








Also includes libhb changes to support new dimensions tab.
New libhb function hb_rotate_geometry() helper for rotating dimensions
tab settings when rotation filter settings change.
Simplified hb_set_anamorphic_size2 and added support for updating
display size and factoring pad into resolution limits.
Added new pad filter parameters top, bottom, left, right to make
interface to pad filter fit more easily with our UI.
Added preset keys for pad filter PicturePadMode, PicturePadColor,
PicturePadTop, PicturePadBottom, PicturePadLeft, PicturePadRight.
Added preset keys PictureAllowUpscaling, PictureUseMaximumSize which are
used in the new dimensions tab.
Special note for @sr55 hb_geometry_settings_t struct has changed, so if you map that in WinGui, you'll need to update it.
Test on:
Screenshots (If relevant):
