Artoriuz / artoriuz.github.io

MIT License
23 stars 2 forks source link

[Suggestion] Use an 8x4 diameter for NNEDI3 instead of 8x6 #15

Closed ghost closed 1 year ago

ghost commented 1 year ago

I know that you don't have an automated process for the mpv article, so redoing metrics is probably a pain in the ass, but I suggest using 8x4 for NNEDI3 instead of 8x6. 8x6 typically results in very ugly artifacts even though it's sharper. I don't think most people who use NNEDI3 for linework reconstruction go beyond 8x4.

This will probably hurt NNEDI3 in the metrics, but I think 8x4 is more of a "real world" use case for the shader. You could always include both, I guess. But generally I don't see a point in using 8x6 for image upsampling.

nnedi3-nns64-win8x4.hook + no-scaler-resizes-only 5x zoom 8x4 zoom

nnedi3-nns64-win8x6.hook + no-scaler-resizes-only 5x zoom 8x6 zoom

Artoriuz commented 1 year ago

I was basically following the instructions I found here: https://github.com/dubhater/vapoursynth-nnedi3

Admittedly I never really used NNEDI for more than 5 minutes so I don't know which variations are more/less popular, but I also didn't want to include all of them.

I'll replace them soon™, thanks =)

ghost commented 1 year ago

Right. I'm not going to pretend like it's a settled science or anything. That vapoursynth guide recommends either 8x6 or 8x4. I could probably find some random blogpost that recommends a 8x6 window for encoding (hell, I already found the mpv.conf of a popular encoder who uses nns32+8x6 in real time...), but it doesn't seem like switching to 8x4 has hurt NNEDI3 too much in the metrics, so I think it's safer to benchmark the version with less artifacts. A 8x4 window is also quite a bit faster to run in real-time.

Personally speaking, it also doesn't make too much sense to use such a slow luma doubler if you're still going to end up getting artifacting in the end anyways. The speed penalty is only worth it if you're going to get a clean picture for subsequent fractional upscales and/or downscales.

I know you're not a huge fan of NNEDI3, but I think it's cool as an upscaler, and it still has a lot of advantages over other meme shaders that will probably never be replicated 1:1 anytime soon. Just giving my two cents :^)

Artoriuz commented 1 year ago

Oh please, I have nothing against NNEDI3, I just genuinely never used it as a daily driver. I also don't think it would be that difficult to train a CNN that looks more or less the same, it's just a matter of matching the loss function described here assuming it hasn't changed that much since then.

ghost commented 1 year ago

I also don't think it would be that difficult to train a CNN that looks more or less the same

Well, its not like it hasn't been attempted already. But I can't think of any recent CNNs that attempt to anti-alias in the same way NNEDI3 does. It seems like a lot of models are focused on thin lines and compression artifact reduction, which might be good for bit-starved web content, but misses the mark for me when it comes to stuff like upscaling lowres DVDs. Even though its not a CNN, the new RAVU-Zoom-AR shaders get pretty close to scratching the same itch, so I've been pretty satisfied with them so far.