What is a “Resizer”?
“In computer graphics and digital imaging, image scaling refers to the resizing of a digital image. In video technology, the magnification of digital material is known as upscaling or resolution enhancement.”
What is a “Native resolution”?
Anime are often scaled with Bicubic or Bilinear to 1080p.
Sometimes even oversharped Bicubic or Cross Conversion.
If you are especially unlucky, it is Nearest Neighbour or some unknown stuff (mixed upscalers). Last case means any hope is lost.
Important, just because it’s 1920×1080 on Blu-rays/TV/Web-sources, doesn’t mean the show’s native resolution is that as well!
Nowadays the production resolution for most show’s still 1280×720, which is the reason why some encoders encode these to 720p Hi444PP and not 1080p.
Credits or other text overlays in anime are, however, mostly in 1920×1080. You have to mask them and resize them with a blurrier upscaler.
How do I know what the native resolution is?
There are three common ways to do that.
The first one is by looking on a website called Anibin.
The second one by running an automated script called getnative.
The third one is checking it manually on your own.
I personally recommend doing all of these. Anibin is in most cases accurate, but anime are usually not only one resolution. Some stuff is maybe 720p, other 810p and even some are 900p. Anibin is just telling the resolution with the most percentage of the show. Let’s say a show’s 40% 1080p and 60% 900p (like some J.C. Staff show’s), it’s still listened as 900p, even when it’s woth a 1080p release. Getnative can help you with that, because it’s downscaling to every resolution and comparing them with the source frame. Just run “Find_ProductionResolution.bat”, a guide how to use it is written in the batch file itself. The third option is more technical, so the explanation is later here in the guide.
But an example (with checking if it’s 720p bicubic) would be:
Compare this one with the source frame.
It’s important that you search for a clean frame, one without any credits.
And what is “Hi444PP / 4:4:4” now?
Hi444PP is a h264 profile. Here we talk about YUV444.
Blu-ray/TV/WEB-Sources are in most cases 1920×1080. But that actually is only half true. An modern source (YV12) has luma and chroma information. The luma information (brightness) are actually 1920×1080, but the chroma information (colours) just halve of it, 960×540. The Original work on the other hand has 1920×1080 for both, but Blu-rays for example doesn’t support 1920×1080 chroma. The chroma is even splitted in two. Cr and Cb. One containing blue-yellow and the other green-red, just as a site note. If the show’s native resolution is 1280×720 and we natively downscale it, it results in 1280×720 luma and 640×360 chroma. Since the native resolution of the chroma is 1280×720 (but the Blu-ray only has 960×540), we lose information. Even when already some information on the Blu-ray is lost, we make it worse with that. We can easily avoid that by upscaling the chroma to 1280×720 (YV24). We can’t get the information between 960×540 and 1280×720 back, but at least we haven’t made it worse.
Only use YUV444 if it’s necessary. Having a 1080p source and upscaling the chroma to 1080p there is totally dumb. Never ever do that. It’s just bloating the file size for no reason.
How do I downscale to the native resolution (with and without Hi444PP)?
out = fvf.Debilinear(src, 1280, 720) #720p without mask and YUV444
out = fvf.DebilinearM(src, 1280, 720) #720p with mask, but without YUV444
out = fvf.Downscale444(src, 1280, 720, kernely='bilinear', invks=True, kerneluv='blackmanminlobe') #720p without mask, but with YUV444
out = fvf.DebilinearM(src, 1280, 720, kerneluv="blackmanminlobe", yuv444=True) #720p with mask & YUV444
out = fvf.Debicubic(src, 1280, 720) #720p without mask and YUV444
out = fvf.DebicubicM(src, 1280, 720) #720p with mask, but without YUV444
out = fvf.Downscale444(src, 1280, 720, kernely='bicubic', invks=True, kerneluv='blackmanminlobe') #720p without mask, but with YUV444
out = fvf.DebicubicM(src, 1280, 720, kerneluv="blackmanminlobe", yuv444=True) #720p with mask & YUV444
Oversharped Bicubic upscale:
You just have to tweak the a1y / b and a2y / c parameter: “a1y / b = 0” & “a2y / c = 1”
out = fvf.Debicubic(src, 1280, 720, b=0, c=1)
out = fvf.Downscale444(src, 1280, 720, kernely='bicubic', invks=True, kerneluv='blackmanminlobe', a1y=0 , a2y=1)
Blurred Bicubic upscale:
You just have to tweak the a1y / b and a2y / c parameter: “a1y / b = 1” & “a2y / c = 0”
out = fvf.Debicubic(src, 1280, 720, b=1, c=0)
out = fvf.Downscale444(src, 1280, 720, kernely='bicubic', invks=True, kerneluv='blackmanminlobe', a1y=1 , a2y=0)
Nearest Neighbour upscale:
out = src.resize.Point(1280,720)
Cross Conversion upscale:
even = src.std.SeparateFields().std.SelectEvery(clip=clip, cycle=2, offsets=0).descale.Debilinear(1280, 360,src_top=+0.19,src_height=540+0.19) odd = src.std.SeparateFields().std.SelectEvery(clip=clip, cycle=2, offsets=1).descale.Debilinear(1280, 360,src_top=-0.19,src_height=540-0.19) mixed = core.std.Interleave(even,odd) out = mixed.std.DoubleWeave()[::2] (Change the “0.19” value in the second one as long as all aliasing is gone)
Two differnet upscalers in one source:
bilinear = src.descale.Debilinear(1280, 720) os_bicubic = src.descale.Debicubic(1280, 720, b=1, c=0) out = kgf.conditional_resize(bilinear, os_bicubic, kernel='bicubic')
Another safe and also recommended method is just to scenefilter here.
Should I always downscale to the native resolution?
No. Only if your source is good enough (Blu-ray or a really good Web-Source).
For sources like Crunchyroll or TV-Channels there are other resizers.
But even on Blu-rays it’s sometimes not possible to downscale to the native resolution.
Look here for an example:
So what resizer can I use for TV/WEB-Sources?
out = src.resize.Spline36(1280, 720)
It works for pretty much every source, but is kinda blurry.
Something sharper would be invks Bicubic:
out = src.fmtc.resample(1280, 720, kernel='Bicubic', invks=True, invkstaps=2 ,a1=0.60 ,a2=0.20)
out = fvf.Downscale444(src, 1280, 720, kernely='Bicubic', invks=True, invkstaps=2 ,a1y=0.60 ,a2y=0.20, kerneluv='blackmanminlobe')
You just have to tweak the invkstaps and a1/a2 : a1y/a2y values here.
However, it can also make it too sharp and probably worse.
The decision is up to you.
How can I upscale back to 1920×1080?
It sounds silly, but this is kinda useful. You first downscale to the native resolution and than back to 1080p with a decent resizer for much sharper results. The reason is that not everyone can afford a good GPU to use nnedi3 while playback.
resized_clip = nresize.nnedi3_resample(src, 1920, 1080, kernel="Spline16") out = muvf.MergeChroma(resized_clip,src)
The is no point in doing 1080p Hi444PP. So you downscale without Hi444PP and merge the chroma back from the source clip.