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

Ideal --scale-antiring value for ringy polar filters? #12750

Closed
ghost opened this issue Oct 26, 2023 · 11 comments
Closed

Ideal --scale-antiring value for ringy polar filters? #12750

ghost opened this issue Oct 26, 2023 · 11 comments

Comments

@ghost
Copy link

ghost commented Oct 26, 2023

Title. What's a good value that doesn't lead to too much artifacting/detail loss? Just curious if anyone who has done more testing has arrived at a nice value, since the mpv/libplacebo documentation doesn't give any recommendations. Discuss :)

Pseudo-continuation of the discussion from #12384

@ghost ghost added the meta:question label Oct 26, 2023
@kasper93
Copy link
Contributor

I use 0.75 myself. Just because I've seen some artifacts above this value. But I don't generally pixel peep every video so ymmv

@llyyr
Copy link
Contributor

llyyr commented Oct 26, 2023

I don't think there's any magic number. I'd say it depends on how good your eyes are and the scaler, some ring more than others.

If you use a scaler that can cause ringing artifacts, and the ringing bothers you then start with a lower value and increase it gradually until you don't notice it anymore. "Until you don't notice it anymore" does a lot of heavy lifting here, because if you take screenshots and pixel peep at 500%, obviously you're going to notice it. When I make comparisons I only do it with screenshots at 100% zoom. If it passes that then it's highly unlikely I'll ever see anything during actual playback.

If you still notice ringing at extremely high *-antiring values, then consider using a different family of scalers instead.

I know a lot of people have cargoculted 0.8 as a value due to ravu-zoom-ar and ewa_lanczos4sharpest using it, but some scalers cause more ringing than others. I don't use any antiring with ewa_lanczos since the type of content I consume will never noticeably ring, and for any other type of content where it could be a problem (480p anime) nnedi reigns supreme after all these years, though I'd probably use 0.5-0.7 if I used ewa_lanczos. For ewa_lanczos4sharpest I think the default is fine.

chroma plane ringing doesn't exist, you didn't see anything. It's your imagination.

@ghost
Copy link

ghost commented Oct 26, 2023

Too strong antiring can create aliasing and an unnatural looking image: https://slow.pics/c/6RzExQBR. This sample is obviously exaggerated to show what kind of artifacts it can create, on real content it can still be noticeable but to a much lesser degree.

Personally i've noticed that blurrier filters can get away with stronger antiringing without the issues becoming noticeable.
I think 0.5 is a good middleground between removing ringing and adding artifacts but I also use ewa_hanning which rings less to begin with (2nd halo is almost nonexistent) so maybe a higher value like ~0.6 or so would be good for ewa_lanczos/ewa_lanczossharp.

@ghost
Copy link
Author

ghost commented Oct 27, 2023

Just because I've seen some artifacts above this value.

I agree, though I think most people would agree that setting this to something absurd like 1.0 is just too much.

If it passes that then it's highly unlikely I'll ever see anything during actual playback.

I'd say it more so depends on tolerance, and less on actual eyesight. Anybody can train themselves into noticing stuff like this, for better or worse. Ringing is definitely less noticeable on very grainy content, to a point where sweating over the AR value probably doesn't matter. But on content that has very flat colors and gradients, ringing is still pretty noticeable in my opinion. This pretty much only encapsulates animated content anyways, and animated content tends to have a lot of static shot and shot-reverse shot scenes. So the definition of "playback" here is also doing a lot of heavy-lifting, because if we're being honest, we're actually talking about scenes with a lot of motion in them.

nnedi reigns supreme after all these years

Agreed, though I don't find this answer super satisfying just because it's a little hard to convince someone to holistically only use really heavy doublers, rather than utilize built-in functions like AR. And if I'm being honest, as someone who regularly utilizes said heavy doublers, the cost-benefit is still arguable because ewa_lanczossharp with AR looks pretty damn good already. It really depends on the scale factor, as you said.

chroma plane ringing doesn't exist, you didn't see anything. It's your imagination.

Depends on the content, I suppose. But chroma benefits from AR as well from my experience. Or at the very least, when you encounter trivial content that really highlights it, it looks really, really ugly.

@ghost
Copy link
Author

ghost commented Oct 27, 2023

Too strong antiring can create aliasing and an unnatural looking image:

I think it's important here to clarify whether or not AR actually creates the aliasing, or if the source was aliased to begin with, and overshoot was simply masking it. In practice, the difference probably doesn't really matter, but it can help clarify whether or not even tweaking the AR strength helps mitigate the issue. Obviously, as you already clarified, the example here is super exaggerated, and I've noticed these unnatural cut-off artifacts myself with similar test images. But I still think the difference here is pretty important.

Personally i've noticed that blurrier filters can get away with stronger antiringing without the issues becoming noticeable.

Interesting, I actually haven't tested this out myself. Something like haasnsoft can get away with higher AR values then? I know it's just a blurry ewa_hanning, but that's the first filter that comes to mind. Quadratic-windowed Jinc maybe?

It seems like the general consensus here is leaning towards somewhere between 0.50-0.75 AR, which is pretty much where the discussion last thread ended. Right now, I'm most interested in a source where AR strength highlights aliasing, because that might lead us closer to a definitive answer. I think on relatively grainy and/or clean sources, the difference in AR strength is just a matter of pixel-peeping, which we could do until the end of time.

I'm also curious if AR leads to those unnatural cut-off artifacts on realistic but still high scale factors (maybe like 4.5x with 480p -> 2160p?). I'm constrained to my own screen size here, so if anyone would like to chip into the discussion with that, it would be cool.

@Artoriuz
Copy link

Artoriuz commented Oct 27, 2023

I feel like this is one of those things that depend on too many factors:

  • Content type: If your surfaces are naturally noisy/texturised you can get away with more "ringing" without it becoming too noticeable. If you have sharp transitions between homogeneous surfaces ringing is extremely easy to see in comparison.
  • Choice of filter: You can get away with stronger AR for blurrier filters because they generally won't go "over the limit" as often or as much, which means the "ringy" and the "not-ringy" images look similar and therefore mixing them is unlikely to cause issues (or change how the result looks that much).
  • Scaling factor: Most of the issues AR brings are only ever a thing when you start memeing with obscenely high scaling factors. If you limit yourself to "saner" scenarios like 2x or 4x you're unlikely to run into weird issues. Even then though, a value that works well for 2x might not be ideal for 1.333x for example (and vice versa).

You could perhaps try different strengths with different filters on different scaling factors, and assuming your "test dataset" covers most content types you could come up with an unbiased answer as long as you trust your quality metrics. This sounds like a good idea on paper, but in practice you'd just find a meaningless average because you tried to reconcile too many things at the same time...

Edit: With that said though, my opinion is that ewa_lanczossharp is way too soft to need AR at all. MS-SSIM (correlates relatively well with the human perception of quality, better than all the other classic metrics at least) seems to agree so I'm probably not insane:

AR Strength (Violet 2x ewa_lanczossharp) MS-SSIM
0 0.998475
5 0.998472
10 0.998467
15 0.998461
20 0.998455
25 0.998447
30 0.998438
35 0.998428
40 0.998417
45 0.998405
50 0.998392
55 0.998377
60 0.998362
65 0.998345
70 0.998327
75 0.998308
80 0.998287
85 0.998266
90 0.998243
95 0.998218
100 0.998193

This is just a single test image and a single scaling factor, so it obviously doesn't get even close to covering all scenarios, but still... Unless you're pixel peeping at 500% zoom this is unlikely to matter.

@ghost
Copy link

ghost commented Oct 28, 2023

I think it's important here to clarify whether or not AR actually creates the aliasing

The cutoff artifacts you see in the example creates an aliased look on real content.

Interesting, I actually haven't tested this out myself. Something like haasnsoft can get away with higher AR values then? I know it's just a blurry ewa_hanning, but that's the first filter that comes to mind. Quadratic-windowed Jinc maybe?

I don't know about haasnsoft but quadric windowed jinc definitely seems to respond better to stronger AR strengths compared to ewa_hanning/ewa_lanczos.

I'm also curious if AR leads to those unnatural cut-off artifacts on realistic but still high scale factors (maybe like 4.5x with 480p -> 2160p?). I'm constrained to my own screen size here, so if anyone would like to chip into the discussion with that, it would be cool.

For me I start to notice issues with 480p -> 1440p (I tend to watch a lot of DVD only content). I don't know about 720p since I don't watch anything thats 720p. Seems unnoticeable at 1080p for the most part (but ringing is also less noticeable aswell, so I'm unsure if theres any legitimate justification to raise AR on smaller scale factors?).

@ghost
Copy link
Author

ghost commented Oct 28, 2023

With that said though, my opinion is that ewa_lanczossharp is way too soft to need AR at all.

The point of any resizing for me would be to arrive at a clean and natural-looking output. I'm sure there are other users who share the same sentiment, even if some of the stuff being discussed here is extremely pedantic in practice, and wouldn't be visible from a sofa-to-TV viewing distance. But if the difference is trivial from such viewing distances anyways, why not just optimize for all viewing distances? What if I wanted to manipulate a screenshot I took in mpv with an image editor? There's still plenty of value in discussing this because you can't really achieve a clean picture with ringy scalers without some form of AR.

Now, I could understand not wanting to use AR for performance reasons, as the performance cost is not trivial. But should you really be using polar filters if you care about performance? Maybe, maybe not.

The cutoff artifacts you see in the example creates an aliased look on real content.

https://slow.pics/c/X2duvRS9

I'll just use some comparisons here so that there's something tangible to anchor statements onto. The source is a bit grainy, but not enough to hide the ringing. The upscale here is fractional and I just used the default --dscale for the NNEDI3 screenshot. Technically, I have a 4K display that I could use to exaggerate this comparison a bit more... but I don't use mpv with it so I'll just go with what is more convenient right now. As always, if anyone wants to chip in comparisons with larger scale factors, they are free to do so. To recreate:

--no-config --vo=gpu-next --profile=high-quality --deband=no --dither-depth=no --scale-antiring=<value> --screenshot-format=png

An arbitrary collage for people who don't have enough time in their day to sear their eyeballs:

ar collage

I decided to exclude 0.6 0.7 & ravu-zoom-ar-r3 from the collage just to reduce the clutter from the image.

There are some subtle differences between the crops, but the main highlight here would be the unnatural gap in the linework around the bottom right of the crop. This gap is also visible at 100% zoom, but most people probably wouldn't notice this without having it explicitly pointed out beforehand.

This does seem to be affected by AR strength. 0.5 also has this "gap" but the color gradient in this gap is much darker and doesn't stick out as much. Though, 0.5 also gets rid of less of the ringing, which isn't as visible from this crop, but can be seen in other areas of the image comparison.

And as expected, NNEDI3 has no competition in this comparison outside of ravu-zoom-ar-r3, but I just wanted to include them into the comparison since both user shaders were mentioned earlier in the thread.

Seems unnoticeable at 1080p for the most part (but ringing is also less noticeable aswell, so I'm unsure if theres any legitimate justification to raise AR on smaller scale factors?).

For me, I feel like it starts being noticeable around 1.50x, but obviously everyone has different levels of tolerance for this kind of stuff.

Feel free to share your thoughts or any other comparisons that really highlight the artifacting. I also tested ewa_hanning, but the the intensity of the cut-off artifacts are identical since they're mainly tied to AR strength, and not really to the kernel type it seems.

@ghost
Copy link

ghost commented Oct 30, 2023

I also tested ewa_hanning, but the the intensity of the cut-off artifacts are identical since they're mainly tied to AR strength, and not really to the kernel type it seems.

Yes, the cutoff artifacts are the same, but blending is better with kernels that ring less to begin with.

@ghost
Copy link
Author

ghost commented Oct 30, 2023

Yes, the cutoff artifacts are the same, but blending is better with kernels that ring less to begin with.

I will have to consider switching to ewa_hanning then. I have grown quite fond of it and it doesn't seem to noticeably alias, which is all I care about. Though, even though I tried to dismiss it earlier in the thread, I generally use NNEDI3 anyways so the difference between ewa_lanczossharp and ewa_hanning at such tiny fractional scale factors is probably irrelevant.

Closing. I think I'm fairly comfortable with the discussion around AR now.

@ghost ghost closed this as completed Oct 30, 2023
@JohnChristianD
Copy link

JohnChristianD commented Aug 22, 2024

It seems like the general consensus here is leaning towards somewhere between 0.50-0.75 AR

Is this true for both upscaling and downscaling and is this also true for orthogonal filters like less ringy lanczos ginseng? Downscaling seems to be ringier. I've fully enabled anti-ringing downscale in the meantime because of that and since clamp seems to make downscaling softer. I get away with clamping upscale because I'm also using the shader Superres although there seems to be less ringing still that way. I reckon this is a sigmoid vs linear diff. Also, no disrespect but, are you talking to yourself?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants