Log in

View Full Version : ChromaReconstructor v3.0: restore 420/422 to (almost) native 444


Pages : 1 2 [3]

SSH4
2nd February 2016, 04:09
then, @SSH4
I seriously don't know what went wrong when you were trying it.. :(

Found main problem in old (NNEDI 0.9.4)
So changed to 0.9.4.20 from "Port of NNEDI under new v2.6 AVS API" http://forum.doom9.org/showthread.php?t=170083

But anyway, result is different from your test/tes1 results.

http://105.imagebam.com/download/_h5bBZbx4nYKFrmaUKWwLw/46286/462856161/Icqh01Q000000%282%29.png

This what i have on

orig=last.converttoyv24()
converttoyv12()
converttoyv24()

Dither_convert_8_to_16()
ChromaReconstructor()
ditherpost(mode=-1)
StackVertical(orig,last)

http://113.imagebam.com/download/FG-V7tezgF99knSWEytQSA/46286/462852511/Icqh01Q000000.png

feisty2
2nd February 2016, 08:32
(sorry third post in a row!)

Is the vpy version any faster, and I cannot find the vpy version in your github link ?

removed it cuz it was kinda unstable, will add it back when it's ready
it's no way faster, actually slower maybe...
but it features some extra quality (full 32bits floating point precision vs 8/16 bits hybrid precision) over the avisynth version

feisty2
4th February 2016, 09:36
@poisondeathray
@SSH4
try the vaporsynth version if you guys couldn't get the avisynth version to work
vaporsynth implement requires input to be 4:4:4 at 32bits precision (floating point)

poisondeathray
4th February 2016, 21:28
@poisondeathray
@SSH4
try the vaporsynth version if you guys couldn't get the avisynth version to work
vaporsynth implement requires input to be 4:4:4 at 32bits precision (floating point)

I got the avisynth version to work properly, I reported it a few posts back the the problem (at least for me) was the NNEDI3 version. My problem initially looked similar to SSH4's screenshots in post 102, but he said he already switched out the NNED3I version

I'll give the vapoursynth version a go later this week, thanks again for your efforts

SSH4
12th February 2016, 09:56
Well, well, well... Who's that boy?

I got it!

U = up16.UToY8()
but why ?
Unew = wild ? KNLMeansCL(U, 0, radius, 0, False, 1, str, Luma, lsb_inout=True) : interpolationZ(Luma, U, 2, str)
the same with V

D**n, this take me some days for understand :D

@feisty2 if U and V is 8bit why you want 16bit input?

Set lsb_inout=False is making all work as in your original and latest example.

1)Source
2)Source->YV12->YV24
3)Reconstructed

http://113.imagebam.com/download/kpdJWUtE3sua-JaHGfzFmQ/46470/464696064/Icqh01Q000000.png


Oh. May be your Ditherpost(mode=-1) inside script and some converttoX8 broke your 16bit idea.

Or. May be you "fine-tune" your own dither.avsi ?

musicvideos4k
15th August 2016, 21:00
I installed everything properly, the KNLMeansCL installed and DLL's too. I use W10 x64, though im using Avisynth 2.60MT and with 32bit plugins.

I load the script ( even copied the first post examples ) and all i get is "invalid arguments for KNLMeansCL" Line blah blah blah"

It doesn't matter if the script is empty with just the video clip source and the ChromaReconstructor basic script, it always says invalid arguments for KNLMeansCL.

I have the avsi installed, dll's working, opencl.dll in system32 and SysWOW64...

The thing just doesn't wanna work.

My Specs are i7 4770k, z97, 2x8gb ddr3 2400, W10.

raffriff42
15th August 2016, 23:30
There has been a change in KNLMeansCL's function signature since ChromaReconstructor_faster was posted (http://forum.doom9.org/showthread.php?p=1751574#post1751574).
I get an "invalid arguments" error with the latest KNLMeansCL (0.7.6), but not with an older version (0.6.2)
Here's ChromaReconstructor_faster, modified to work with the new KNLMeansCL signature:function ChromaReconstructor_faster(clip src, int "radius", float "str")
{
radius = default(radius, 16)
str = default(str, 6.4)
w = src.width
h = src.height / 2
#ref = src.ConvertToY8().KNLMeansCL(0, radius, 0, False, 1, pow(1.464968620512209618455732713658, str), lsb_inout=True)
ref = src.ConvertToY8().KNLMeansCL(0, radius, 0, pow(1.464968620512209618455732713658, str), False, 1, lsb_inout=True)
srcU = src.UToY8()
srcV = src.VToY8()
src8 = YToUV(srcU, srcV, ref)
sup = src8.Dither_resize16nr(w*2, h*2, src_left=0, src_top=0, kernel="spline", taps=6)
Luma = sup.ConvertToY8()
U = sup.UToY8()
V = sup.VtoY8()
#Unew = U.KNLMeansCL(0, radius, 0, False, 1, str, Luma, lsb_inout=True).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
#Vnew = V.KNLMeansCL(0, radius, 0, False, 1, str, Luma, lsb_inout=True).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
Unew = U.KNLMeansCL(0, radius, 0, str, False, 1, rclip=Luma, lsb_inout=True).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
Vnew = V.KNLMeansCL(0, radius, 0, str, False, 1, rclip=Luma, lsb_inout=True).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
UHi = Dither_sub16(Unew, Dither_Removegrain16(Unew, 20).Dither_Removegrain16(20), dif=True)
VHi = Dither_sub16(Vnew, Dither_Removegrain16(Vnew, 20).Dither_Removegrain16(20), dif=True)
UFinal = Dither_add16(srcU, UHi, dif=True)
VFinal = Dither_add16(srcV, VHi, dif=True)
return YToUV(UFinal, VFinal, src.ConvertToY8())
}

musicvideos4k
16th August 2016, 00:07
There has been a change in KNLMeansCL's function signature since ChromaReconstructor_faster was posted (http://forum.doom9.org/showthread.php?p=1751574#post1751574).
I get an "invalid arguments" error with the latest KNLMeansCL (0.7.6), but not with an older version (0.6.2)
Here's ChromaReconstructor_faster, modified to work with the new KNLMeansCL signature:function ChromaReconstructor_faster(clip src, int "radius", float "str")
{
radius = default(radius, 16)
str = default(str, 6.4)
w = src.width
h = src.height / 2
#ref = src.ConvertToY8().KNLMeansCL(0, radius, 0, False, 1, pow(1.464968620512209618455732713658, str), lsb_inout=True)
ref = src.ConvertToY8().KNLMeansCL(0, radius, 0, pow(1.464968620512209618455732713658, str), False, 1, lsb_inout=True)
srcU = src.UToY8()
srcV = src.VToY8()
src8 = YToUV(srcU, srcV, ref)
sup = src8.Dither_resize16nr(w*2, h*2, src_left=0, src_top=0, kernel="spline", taps=6)
Luma = sup.ConvertToY8()
U = sup.UToY8()
V = sup.VtoY8()
#Unew = U.KNLMeansCL(0, radius, 0, False, 1, str, Luma, lsb_inout=True).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
#Vnew = V.KNLMeansCL(0, radius, 0, False, 1, str, Luma, lsb_inout=True).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
Unew = U.KNLMeansCL(0, radius, 0, str, False, 1, rclip=Luma, lsb_inout=True).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
Vnew = V.KNLMeansCL(0, radius, 0, str, False, 1, rclip=Luma, lsb_inout=True).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
UHi = Dither_sub16(Unew, Dither_Removegrain16(Unew, 20).Dither_Removegrain16(20), dif=True)
VHi = Dither_sub16(Vnew, Dither_Removegrain16(Vnew, 20).Dither_Removegrain16(20), dif=True)
UFinal = Dither_add16(srcU, UHi, dif=True)
VFinal = Dither_add16(srcV, VHi, dif=True)
return YToUV(UFinal, VFinal, src.ConvertToY8())
}

I have tried it and i get constant CL_MEM_OBJECT errors, allocation and run out of memory ( error is linked to KNLMeansCL , again )

Looks like the new release needs fix, do you know where to get the old version that works?

raffriff42
16th August 2016, 00:22
all versions are here:
https://github.com/Khanattila/KNLMeansCL/releases

musicvideos4k
16th August 2016, 00:59
all versions are here:
https://github.com/Khanattila/KNLMeansCL/releases

I will try. It looks like having a lot of Avsi could make Avisynth memory maxed out, even if i do not call a specific avsi ? Maybe that's whats going on with my machine.

flacattack
5th December 2016, 03:49
I have cartoon material that I am trying to use with this set to wild=false. It works just fine when using wild=true, but when i set it to false:
mt_lutxy : unsupported colorspace.masktools only support planar YUN colorspaces (YV12, YV16, YV24)
(dither.avsi, line 1178)
(dither.avsi, line 1153)
(chromareconstructor.avsi, line 43)
(chromareconstructor.avsi, line 20)

Anyone else get this error before?

tuanden0
28th March 2017, 10:02
I get an "invalid arguments" error with the latest KNLMeansCL 1.0.2
Can someone help me?

rsd2015
8th September 2017, 06:22
I know this is an old thread, but can some kind and wise person correct the KNLMeansCL syntax in line 8 of the ChromaReconstructor_faster script so that the script works with the latest version of KNLMeansCL, 1.10?

OvejaNegra
11th November 2017, 06:04
id did some changes and it's working for me with last version:

function ChromaReconstructor(clip src, int "radius", float "str", int "hipass", int "mode", bool "wild")
{
radius = default(radius, 32)
str = default(str, 6.4)
hipass = default(hipass, 6)
mode = default(mode, 0)
wild = default(wild, True)
w = src.width
h = src.height / 2
ref = wild ? src.ConvertToY8() : src.ConvertToY8().KNLMeansCL(0, radius, 0, channels="Y", wmode=1, pow(1.464968620512209618455732713658, str), stacked=True,device_type="gpu",device_id=1,info=false)
srcU = src.UToY8()
srcV = src.VToY8()
src8 = YToUV(srcU, srcV, ref).Ditherpost(mode=-1)
up2x = src8.nnedi3(field=1, dh=True, nns=4, qual=2, etype=1, nsize=0).TurnRight().nnedi3(field=1, dh=True, nns=4, qual=2, etype=1, nsize=0).TurnLeft()
up4x = up2x.nnedi3(field=1, dh=True, nns=4, qual=2, etype=1, nsize=0).TurnRight().nnedi3(field=1, dh=True, nns=4, qual=2, etype=1, nsize=0).TurnLeft()
up16 = up4x.Dither_convert_8_to_16()
Luma = up16.ConvertToY8()
U = up16.UToY8()
V = up16.VtoY8()
Unew = wild ? KNLMeansCL(U, 0, radius, 0, channels="Y", wmode=1, str, rclip=luma, stacked=True,device_type="gpu",device_id=1,info=false) : interpolation(Luma, U, 2, str)
Unew = wild ? Unew : interpolation(Luma, Unew, 4, str)
Unew = wild ? Unew : interpolation(Luma, Unew, 8, str)
Unew = wild ? Unew : interpolation(Luma, Unew, 16, str)
Unew = wild ? Unew : interpolation(Luma, Unew, 32, str)
Unew = Unew.Dither_resize16nr(w, h, src_left=-1.5, src_top=-1.5, kernel="spline", taps=6)
Vnew = wild ? KNLMeansCL(V, 0, radius, 0, channels="Y", wmode=1, str, rclip=luma, stacked=True,device_type="gpu",device_id=1,info=false) : interpolation(Luma, V, 2, str)
Vnew = wild ? Vnew : interpolation(Luma, Vnew, 4, str)
Vnew = wild ? Vnew : interpolation(Luma, Vnew, 8, str)
Vnew = wild ? Vnew : interpolation(Luma, Vnew, 16, str)
Vnew = wild ? Vnew : interpolation(Luma, Vnew, 32, str)
Vnew = Vnew.Dither_resize16nr(w, h, src_left=-1.5, src_top=-1.5, kernel="spline", taps=6)
UHi = (mode == 1) ? Dither_sub16(Unew, gauss_h(Unew, hipass), dif=True) : Dither_sub16(Unew, gauss(Unew, hipass), dif=True)
VHi = (mode == 1) ? Dither_sub16(Vnew, gauss_h(Vnew, hipass), dif=True) : Dither_sub16(Vnew, gauss(Vnew, hipass), dif=True)
UFinal = Dither_add16(srcU, UHi, dif=True)
VFinal = Dither_add16(srcV, VHi, dif=True)
return YToUV(UFinal, VFinal, src.ConvertToY8())
}


function ChromaReconstructor_faster(clip src, int "radius", float "str")
{
radius = default(radius, 16)
str = default(str, 6.4)
w = src.width
h = src.height / 2
#ref = src.ConvertToY8().KNLMeansCL(0, radius, 0, channels="Y", 1, pow(1.464968620512209618455732713658, str), stacked=True,device_type="gpu",device_id=1,info=false)
ref = src.ConvertToY8().KNLMeansCL(0, radius, 0, pow(1.464968620512209618455732713658, str), channels="Y", wmode=1, stacked=True,device_type="gpu",device_id=1,info=false)
srcU = src.UToY8()
srcV = src.VToY8()
src8 = YToUV(srcU, srcV, ref)
sup = src8.Dither_resize16nr(w*2, h*2, src_left=0, src_top=0, kernel="spline", taps=6)
Luma = sup.ConvertToY8()
U = sup.UToY8()
V = sup.VtoY8()
#Unew = U.KNLMeansCL(0, radius, 0, channels="Y", wmode=1, str, Luma, stacked=True,device_type="gpu",device_id=1,info=false).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
#Vnew = V.KNLMeansCL(0, radius, 0, channels="Y", wmode=1, str, Luma, stacked=True,device_type="gpu",device_id=1,info=false).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
Unew = U.KNLMeansCL(0, radius, 0, str, channels="Y", wmode=1, rclip=Luma, stacked=True,device_type="gpu",device_id=1,info=false).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
Vnew = V.KNLMeansCL(0, radius, 0, str, channels="Y", wmode=1, rclip=Luma, stacked=True,device_type="gpu",device_id=1,info=false).Dither_resize16nr(w, h, src_left=0, src_top=0, kernel="spline", taps=6)
UHi = Dither_sub16(Unew, Dither_Removegrain16(Unew, 20).Dither_Removegrain16(20), dif=True)
VHi = Dither_sub16(Vnew, Dither_Removegrain16(Vnew, 20).Dither_Removegrain16(20), dif=True)
UFinal = Dither_add16(srcU, UHi, dif=True)
VFinal = Dither_add16(srcV, VHi, dif=True)
return YToUV(UFinal, VFinal, src.ConvertToY8())
}


function interpolation(clip luma, clip "chroma", int "radius", float "str")
{
exp_c0 = 1.060417282747435920994529352433
exp_c1 = pow(1.070339301855046091743224243341, 32)
weight = pow(exp_c0, radius) / exp_c1
ref0 = Dither_lut16(chroma, "x "+string(weight)+" *")
ref1 = Dither_lut16(luma, "x 1.0 "+string(weight)+" - *")
ref = Dither_add16(ref0, ref1, dif=False)
return KNLMeansCL(chroma, 0, radius, 0, channels="Y", wmode=1, str, rclip=ref, stacked=True,device_type="gpu",device_id=1,info=false)
}

function gauss(clip src, int "p")
{
p = default(p, 30)
w = src.width
h = src.height / 2
upsmp = Dither_resize16(src, w * 2, h * 2, kernel="gauss", a1=100)
return Dither_resize16(upsmp, w, h, kernel="gauss", a1=p)
}

function gauss_h(clip src, int "p")
{
p = default(p, 30)
w = src.width
h = src.height / 2
upsmp = Dither_resize16(src, w * 2, h, kernel="gauss", a1=100)
return Dither_resize16(upsmp, w, h, kernel="gauss", a1=p)
}


change device_type="gpu",device_id=1 and enable disable info to see if your main GPU is doing the work ( and not the Intel OpenCL, that will be slow)

real.finder
5th April 2020, 21:56
here VS port to avs with more things https://forum.doom9.org/showpost.php?p=1906550&postcount=120

work with 8-16 bits and float

Sparktank
6th April 2020, 00:16
here VS port to avs with more things https://pastebin.com/40QXjAE4

work with 8-16 bits and float

Thanks! Will check it out!

FranceBB
6th April 2020, 02:50
here VS port to avs with more things https://pastebin.com/40QXjAE4

work with 8-16 bits and float

When you declared sisphbd you actually used the AvsPlusVersionNumber > 2294, however in AviSynth+ 3.5 (r3106, 3.5, i386) (3.5.0.0) when I try to compile it says "I don't know what AVSPlusVersionNumber means". When was that command implemented in the AVS core?
Anyway, I set it to some bogus value in order for it to always return true


sisphbd = 3500 > 2294


and it got me pass that, but now it's saying that there's no function called sh_padding which you used to pad


pad = fast > -1 ? src.sh_padding (4, 4, 4, 4) : src


but I can't find any filter which actually has sh_padding. Am I missing something?

real.finder
6th April 2020, 03:01
When you declared sisphbd you actually used the AvsPlusVersionNumber > 2294, however in AviSynth+ 3.5 (r3106, 3.5, i386) (3.5.0.0) when I try to compile it says "I don't know what AVSPlusVersionNumber means". When was that command implemented in the AVS core?
Anyway, I set it to some bogus value in order for it to always return true


sisphbd = 3500 > 2294


and it got me pass that, but now it's saying that there's no function called sh_padding which you used to pad


pad = fast > -1 ? src.sh_padding (4, 4, 4, 4) : src


but I can't find any filter which actually has sh_padding. Am I missing something?

in My Avisynth Stuff there are this :)

note:- Zs_RF_Shared.avsi (https://github.com/realfinder/AVS-Stuff/raw/master/avs%202.5%20and%20up/Zs_RF_Shared.avsi) (Shared Functions and utility V1.05 or up) is needed

real.finder
6th April 2020, 12:02
update for clean up things https://github.com/realfinder/AVS-Stuff/raw/master/avs%202.6%20and%20up/scaled444tonative.avsi

also now work with YUVA