Dogway / Avisynth-Scripts

AviSynth+ 3.7.3+ Filters
GNU General Public License v3.0
85 stars 11 forks source link

Default f_taps for default flat resizer creates ringing around edges #47

Closed Kogarou-san closed 2 years ago

Kogarou-san commented 2 years ago

Given an example clip with very sharp edges:

ColorBarsHD()
deep_resize(1920, 1080, edge="nnedi3") #nnedi3 to make sure non-ringing kernels are used in edges where possible

(cropped area, 400% with PointResize) noticeable luma and chroma ringing appear around the edges. As far as I can test, it seem to be created by the flat resizer (Sinc). When using less taps than the default (8), or a softer resizer like Hermite or Gauss, the luma ringing almost completely disappears to a single white halo in the lower cropped area, however chroma ringing still happens around the cyan-brown edge. In comparison, running nnedi3resize(1920, 1080) has almost similar ringing in the lower cropped area, and absolutely no chroma ringing. While this case is a bit on the extreme, I noticed deep_resize() was introducing luma and chroma ringing around lineart in anime when scaling it by 200%.

Dogway commented 2 years ago

Hehe, I saw that coming. A few commits back I added the comment "to resize natural images in high quality" By default deep_resize is not targeted to 2D animation or graphics because those mostly lack texture, for those you can simply use nnedi3resize(), or tune deep_resize() kernels to others with lower taps.

Indeed the ringing is not caused by the 'edge' kernel, but from 'sinc'. 'sinc' gives utmost sharpness to natural images, you can use other ones like Blackman, Lanczos or Cosine. By the way, the default f_taps is a typo, 'sinc' should never use above 4. What I can do is to expose the chroma kernel which by default also rings a bit (Blackman8), so you can also change that. I will upload that for the next commit.

Dogway commented 2 years ago

Check now here: d05bd0e87d7760d79ef4ac86155bb2b9004182a8 Changed default upscale chroma kernel to Blackman6, but now you can change it with 'chroma' arg. Also changed the 'flat' kernel to Blackman8. Sinc wasn't very good, and SincLin still leaked some ringing. You can try them out for a tiny bit more sharpness, but I think it would be better to add a sharpener afterwards in case you want more sharpness than the defaults.

Kogarou-san commented 2 years ago

Got it; having the chroma kernel configurable and Blackman as defaults seem nice. I did read the comment "to resize natural images in high quality" before while reading the script, but I completely forgot about it, heh I will keep nnedi3resize in mind when resizing non-natural images

Dogway commented 2 years ago

Is this still an issue?

Kogarou-san commented 2 years ago

No, forgot to close the issue Thank you.