View Full Version : Debilinear filter
jpsdr
11th January 2017, 12:51
I've learned it exists a debilinear filter.
I've only found an old dll, without x64 version and without source code.
Does someone know where i can find the sources (if any avaible) of it ?
Or, does it exist another recent filter doing the same thing ?
Thanks.
Izuchi
11th January 2017, 13:18
Debilinear is closed source, although a similar result can be achieved:
Dither_resize16(w,h,kernel="bilinear",invks=true)
Activates the kernel inversion mode ... This mode is somewhat equivalent to the debilinear plug-in but works with a different principle.
jpsdr
11th January 2017, 14:32
.....nnnnggg.... Is there any link of paper/publication which explain the algorithm/formula of debilinear ?
Izuchi
11th January 2017, 15:25
I'm not sure if there are any scientific papers on the topic, but I suggest asking the author (prunedtree) on IRC if you are interested in the source code. He can usually be found in #darkhold.
jpsdr
11th January 2017, 15:31
Thanks, don't use it often, but i'll try to contact it. On what server will i found the #darkhold channel ?
real.finder
11th January 2017, 15:35
Thanks, don't use it often, but i'll try to contact it. On what server will i found the #darkhold channel ?
rizon
feisty2
11th January 2017, 19:10
A resampling algorithm (other than nearest neighbor) could be interpreted as nearest neighbor + a certain convolution (tho that's not actually how the image got interpolated)
And since the PSF of that certain convolution is mathematically well defined (could be precisely estimated from each individual resampling algorithm), the convolution part could be reversed with a deconvolution theoretically (ignoring errors caused by limited precision).
After deconvolution, scale the image back to its original size with nearest neighbor and DONE!
jpsdr
11th January 2017, 20:50
Thanks for all your comments.
PSF...?
I've talked with prunedtree, it says it's not writen in C++ but in... clay (don't know what it is).
He explained i think a little differently than feisty2. Result image "y" comes from linear "B" filtering of image "x" => y=Bx.
So, we retreive "x" with least square method, solving B'Bx=B'y (B' : Transpose of B).
I'll work on this on a later time.
jpsdr
11th January 2017, 21:29
Little question about picture resampling.
I've a little trouble to see exactly the "positions".
First, very easy thing, just for exemple i stay with one dimension, a simple line.
I consider my line of N pixels being a sample of a [0..1] f(x) function.
First way of thinking, sampling is like this :
With 4 pixels, i have : P0=f(0), P1=f(1/3), P2=f(2/3), P3=f(1).
With 7 pixels, i have : R0=f(0), R1=f(1/6), ..., R5=f(5/6), R6=f(1).
What bothers me thinking this way, it's that whatever interpolation/resampling method is used, and whater you do (upscale/downscale), the 1rst and the last will allways have the same value.
Second way of thinking, each pixel has a size, and the value is the one at the center of the pixel.
So, a line with N pixels : Pixel size is 1/N, result : Pi=f((0.5+i)*(1/N)) n=0..N-1.
What is the correct way of thinking ? One of them, another one ?
feisty2
11th January 2017, 22:09
PSF...?
Point Spread Function (https://en.wikipedia.org/wiki/Point_spread_function)
Generally a convolved (blurred, sharpened, resampled, etc) image = image to be restored * PSF + e, * is the convolution operator, e is the error (noise, precision loss, etc).
e could be solved like kind of, with wiener deconvolution, which leaves PSF the biggest problem reversing the convolution.
Result image "y" comes from linear "B" filtering of image "x" => y=Bx.
So, we retreive "x" with least square method, solving B'Bx=B'y (B' : Transpose of B).
That's a specialized algorithm for bilinear and deconvolution is a universal solution for all resampling algorithms (bilinear, bicubic, sinc family, ...), deconvolution might be the approach used in dither package and fmtconv, since invks is available for all available resampling algorithms.
FranceBB
12th January 2017, 06:30
@jpsdr... I actually use debilinear a lot to reverse upscale in my encodes, mostly because many anime in 1080 are just a 720 upscale. Debilinear is generally a "strong" kernel and may end up in producing an over sharp picture if BicubicResize was used on the source instead. Debicubic, on the other hand, it's a more "gentle" kernel which actually generally produces good results. Besides, issues you will be facing are:
1) what's the native resolution of the original video?
(You can't set it wrong, otherwise you'll end up with pure garbage after the reverse upscale filter is applied)
2) Credits, typesetting in general.
(Yes, signs, hardsubbed subs... whatever has been hardsubbed to the original video by the TV channels or during postproduction is generally "bad" and will be spoiled, 'cause in a 720i anime upscaled to 1080i for broadcast, credits during the opening, Kanji during the opening and any hardsubbed signs have probably been hardsubbed in 1080i).
End of the story: I have been able to reverse upscale many Blu-ray discs, but I have always had troubles with .ts ripped from broadcast TV Channels.
This is an example of a 1080p WEBRip video ripped from Crunchyroll to which has been applied Debicubic reverse upscale, with luma and chroma divided, processed and then merged back together, handling credits carefully.
LWLibavVideoSource("test.mkv")
mask = MaskDetail(last,1280,720,expandN=2,inflateN=1,RGmode=3,cutoff=70,gain=0.8,blur_more=false)
Dither_convert_8_to_16()
input = last
noalias = input.Dither_resize16(1280,720,kernel="blackmanminlobe", taps=4, y=3, u=1, v=1)
debicubicy_precise(1280,720,b=0,c=0.5)
Masked = Dither_merge16_8(noalias,last, mask.invert(), u=1,v=1)
strange(5313,5384,masked)
strange(5450,5558,masked)
strange(5621,5700,masked)
strange(5789,5872,masked)
strange(5948,6044,masked)
strange(6203,6290,masked)
strange(6388,6479,masked)
strange(6532,6623,masked)
strange(6880,7001,masked)
strange(123508,123613,masked)
strange(123651,123756,masked)
strange(123793,123899,masked)
strange(123948,124056,masked)
strange(124400,124493,masked)
strange(124495,124566,masked)
strange(124568,124659,masked)
strange(124706,124783,masked)
strange(124790,124855,masked)
ly = last
lu = input.utoy().dither_resize16(1280,720,kernel="spline16",invks=true,invkstaps=4,src_left=0.25,u=1,v=1)
lv = input.vtoy().dither_resize16(1280,720,kernel="spline16",invks=true,invkstaps=4,src_left=0.25,u=1,v=1)
ytouv(lu,lv,ly)
f3kdb(range=15, Y=60, Cb=50, Cr=50, grainY=0, grainC=0, keep_tv_range=True, input_depth=16, output_depth=10)
Dither_quantize(10,reducerange=true,mode=6)
Dither_Out()
vcmohan
12th January 2017, 13:30
Point Spread Function (https://en.wikipedia.org/wiki/Point_spread_function)
Generally a convolved (blurred, sharpened, resampled, etc) image = image to be restored * PSF + e, * is the convolution operator, e is the error (noise, precision loss, etc).
e could be solved like kind of, with wiener deconvolution, which leaves PSF the biggest problem reversing the convolution..
If PSF is known exactly, then can my FQPlus plugin function F2QSharp be used in this situation?
feisty2
12th January 2017, 15:01
If PSF is known exactly, then can my FQPlus plugin function F2QSharp be used in this situation?
yeah, suppose so.
jpsdr
13th January 2017, 10:35
Point Spread Function (https://en.wikipedia.org/wiki/Point_spread_function)
Ah ! Ok, didn't know this way of calling it.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.