Log in

View Full Version : Degraining old SD Anime, how is it even possible?


BrainFartz
6th January 2025, 15:50
I have been having major troubles degraining old SD anime footage. The footage in question is from the 2003 japanese Dragon Box DVD (Dragon Ball GT). Now, I personally would not care at all about the grain, but I need to do this in order to upscale the footage (using an AI Model which I will train myself). If I don't remove the grain, it is going to lead to major issues, namely flickering, loss of detail and dancing lines. I am pretty new to VapourSynth myself and I was trying for a solid month to get it to work the way I want to. Sadly, I did not have any success, with SMDegrain, KNLMeansCL, BM3D, DFTTest, etc...
All of them lead to major loss of detail (or other significant problems).

I could not even get a detail mask to work precisely, without either missing detail or including grain. Prefiltering before trying to mask is barely possible, it will reduce the noise slightly, but not sufficiently. Or it will destroy detail, defeating the whole purpose.

What makes it even harder, is that the source I am working with has some problems itself. The most troublesome is probably the ghosting.
Here is an example of stars during a panning motion. On the left during movement, on the right without movement:
https://iili.io/2g2N9ql.png
How can you keep what's left of them while degraining? Is that even possible?

There are some big, noisy areas, that will have lot's of grain. It's always rather big, monotone, bright (or let's say "not dark") areas. But, sometimes there is like fine, slightly blurry detail without much contrast hidden underneath it. If you try to degrain, these details will start dancing around. Now, that works better with some filters than with others, but generally they all share that problem in some way. Here is an example using "DFTTest(prefiltered, sbsize=5, smode=0, alpha=2, swin=10, twin=9, ftype=0, f0beta=1.5, tbsize=5, zmean=1, nlocation=nlocationKNL)"
https://i.ibb.co/Gc441Z4/dancing.gif

You'll probably also want to see an example of the unaltered grain:
https://i.ibb.co/R266cv6/Grain.gif

Or, if you want to take a look at the video yourself:
https://easyupload.io/v0dif6

How would you veterans do this?

Selur
6th January 2025, 18:41
The main problem I see is that what some call grain/noise, compression artifacts to others is fine details.
Especially if you apply Retinex to show some more:
https://i.ibb.co/nRVTgLZ/grafik.png (https://ibb.co/t3NSmJk)
and your source isn't pristine to begin with.
Also, folks rarely watch their content on a calibrated monitor with optimal lighting and will never see some of the 'details'. (most folks have their displays too bright)

Something like BasicVSR++:
https://i.ibb.co/gt4CS3X/grafik.png (https://ibb.co/mhN79GY)
is overkill for some, but preferred by others.

Personally, I would try:
a. BasicVSR++ with an edge mask to improve lines
Depending on the source, maybe even use multiple masks.
b. MCDegrainSharp and/or FFT3DFilter and/or KNLMeans
https://imgsli.com/MzM1NTEx https://imgsli.com/MzM1NTEz
but at the end of the road, it's always up to oneself to decide where noise ends and fine details start.

Playing around with xClean (https://github.com/mysteryx93/xClean) might be something for you.

Cu Selur

Z2697
7th January 2025, 19:22
Personally I'd be happy with something like this
ref=zvs.bm3d(last,sigma=[10]*3,sigma2=[5]*3,preset='lc',vt=1,radius=1)
last=zvs.zmdg(last,thsad=350,cs=True,limit=-1,pref=ref,blksize=4,tr=3)

comparison: https://slow.pics/c/wlidu0Nk
zvs: https://github.com/Mr-Z-2697/z-vsPyScripts

The result is not strictly noise free, but has decent detail retention.
These parameters are already aggressive in my opinion.

You can try some denoise function in rksfunc as well.
I know the author has done some old anime remaster bd recently, maybe they'll work well for "non-remaster" too.
I think defilmgrain look pretty good.
https://github.com/RyougiKukoc/rksfunc/blob/main/rksfunc/_denoise.py