realfinder / AVS-Stuff

avs/avs+ Stuff
GNU General Public License v2.0
61 stars 15 forks source link

QTGMC doesn't work on GNU/Linux #168

Open ctrlcctrlv opened 1 year ago

ctrlcctrlv commented 1 year ago

You can still use it though with this patch:

diff --git a/avs 2.6 and up/QTGMC.avsi b/avs 2.6 and up/QTGMC.avsi
index 2e0f48e..197ffe0 100644
--- a/avs 2.6 and up/QTGMC.avsi 
+++ b/avs 2.6 and up/QTGMC.avsi 
@@ -211,6 +211,7 @@ function QTGMC( clip Input, string "Preset", int "TR0", int "TR1", int "TR2", in
    # EdiMode="RepcYadif"/"cYadif" require the Yadif plugin, which doesn't autoload. Typically the calling script would load it.

    # Temporary Warnings
+   AvsPlusVersionNumber = 9000
    Assert( !defined(BT),            "QTGMC: Setting BT has been replaced by setting NoiseTR" )
    Assert( !defined(DetailRestore), "QTGMC: Setting DetailRestore has been renamed to GrainRestore" )
    Assert( !defined(MotionBlur),    "QTGMC: Setting MotionBlur has been renamed to ShutterBlur" )
@@ -359,7 +360,8 @@ function QTGMC( clip Input, string "Preset", int "TR0", int "TR1", int "TR2", in
    EdiMaxD  = (SourceMatch == 0) ? EdiMaxD  : Select( mpNum1,  12,      10,       8,        7,        7,        6,        6,        5,        4,        4     )
    EdiQual  = (SourceMatch == 0) ? EdiQual  : Select( mpNum1,  1,       1,        1,        1,        1,        1,        1,        1,        1,        1     )
    TempEdi  = EdiMode # Main interpolation is actually done by basic-source match step when enabled, so a little swap and wriggle is needed
-   EdiMode  = (SourceMatch == 0) ? EdiMode  : default( MatchEdi, ((mpNum1 < 9) ?  EdiMode : "Yadif") ) # Force Yadif for "Ultra Fast" basic source match
+   #EdiMode  = (SourceMatch == 0) ? EdiMode  : default( MatchEdi, ((mpNum1 < 9) ?  EdiMode : "Yadif") ) # Force Yadif for "Ultra Fast" basic source match
+   EdiMode  = "Yadif"
    MatchEdi = TempEdi

    #                                                          Very                                                        Very      Super     Ultra
@@ -377,7 +379,7 @@ function QTGMC( clip Input, string "Preset", int "TR0", int "TR1", int "TR2", in
    # Core and Interpolation defaults
    TR2        = (SourceMatch > 0) ? default(TR2, ((TR2X == 0) ? 1 : TR2X)) : TR2X  # ***TR2 defaults always at least 1 when using source-match***
    RepChroma  = default( RepChroma,  true )
-   EdiThreads = default( EdiThreads, sh_GetUserGlobalIMTint(true)    )
+   EdiThreads = default( EdiThreads, 20    )
    ChromaEdi  = default( ChromaEdi,  ""   )
    NNeurons   = (EdiMode == "NNEDI2" && NNeurons > 2) ? 2 : NNeurons # Smaller range for NNeurons in NNEDI2 (which calls it nsize)
    EdiQual    = (EdiMode == "EEDI3+NNEDI3" || EdiMode == "NNEDI3" || EdiMode == "BWDIF+NNEDI3" || EdiMode == "BWDIF+EEDI3") && EdiQual > 2 ? 2 : EdiQual  # Smaller range for EdiQual in NNEDI3
@@ -420,7 +422,7 @@ function QTGMC( clip Input, string "Preset", int "TR0", int "TR1", int "TR2", in
                   (defined(EZDenoise)   && EZDenoise   > 0.0) ? EZDenoise : \
                   (defined(EZKeepGrain) && EZKeepGrain > 0.0) ? 4.0 * EZKeepGrain : 2.0
    FftThreads   = default( FftThreads, EdiThreads )
-   bomt         = sh_GetUserGlobalIMTbool()
+   bomt         = true
    ChromaNoise  = default( ChromaNoise, false )
    ShowNoise    = default( ShowNoise, 0.0 )
    ShowNoise    = IsBool( ShowNoise ) ? (ShowNoise ? 10.0 : 0.0) : ShowNoise
@@ -509,7 +511,7 @@ function QTGMC( clip Input, string "Preset", int "TR0", int "TR1", int "TR2", in
    planarClip = yuy2 ? clip.nonyuy2clipin(true) : clip

    # Bob the input as a starting point for motion search clip
-   bobbed = (InputType == 0) ? UseEdiExt > 0 ? isyuy2(EdiExt) ? EdiExt.nonyuy2clipin(true) : EdiExt : planarClip.sh_Bob( 0,0.5 ) : \
+   bobbed = (InputType == 0) ? UseEdiExt > 0 ? isyuy2(EdiExt) ? EdiExt.nonyuy2clipin(true) : EdiExt : planarClip.Bob( 0,0.5 ) : \
             (InputType == 1) ? planarClip : \
                                planarClip.Blur( 0,1 )
    bobbed = (InputType == 0) && UseEdiExt > 1 ? bobbed.Vinverse() : bobbed
@@ -778,7 +780,7 @@ function QTGMC( clip Input, string "Preset", int "TR0", int "TR1", int "TR2", in
    # Expand fields to full frame size before extracting noise (allows use of motion vectors which are frame-sized)
    fullClip  = (NoiseProcess == 0) ? NOP() : \
                (InputType > 0)     ? clip : \
-                                     clip.sh_Bob( 0,1.0 )
+                                     clip.Bob( 0,1.0 )
    fullClip  = (yuy2 && NoiseTR > 0) ? fullClip.nonyuy2clipin(true) : fullClip
    fullSuper = (NoiseTR > 0)         ? defined(bomt) ? fullClip.MSuper( pel=SubPel, levels=1, hpad=hpad, vpad=vpad, chroma=ChromaNoise, mt=bomt ) : fullClip.MSuper( pel=SubPel, levels=1, hpad=hpad, vpad=vpad, chroma=ChromaNoise ) : NOP() #TEST chroma OK?

@@ -822,7 +824,7 @@ function QTGMC( clip Input, string "Preset", int "TR0", int "TR1", int "TR2", in
    noise = (totalRestore > 0.0)  ? mt_makediff( planarClip, planarDenoised, U=CNmt1,V=CNmt1 ) : NOP()
    deintNoise = (NoiseProcess == 0 || totalRestore == 0.0) ? NOP() : \
                 (InputType != 0)                           ? noise : \
-                (NoiseDeint == "Bob")                      ? noise.sh_Bob( 0,0.5 ) : \
+                (NoiseDeint == "Bob")                      ? noise.Bob( 0,0.5 ) : \
                 (NoiseDeint == "Generate")                 ? noise.QTGMC_Generate2ndFieldNoise( denoised, ChromaNoise ) : \
                                                              noise.DoubleWeave()
    # Motion-compensated stabilization of generated noise
@@ -1064,19 +1066,19 @@ function QTGMC_Interpolate( clip Input, int InputType, string EdiMode, int NNSiz
             (EdiMode == "Yadif")        ? isyuy2(Input) ? Input.nonyuy2clipin(true).Yadifmod2( mode=3 ).nonyuy2clipout(true) : Input.Yadifmod2( mode=3 ) : \
             (EdiMode == "cYadif")       ? Input.Yadif( mode=3 ) : \
             (EdiMode == "TDeint")       ? Input.TDeInt( mode=1 ) : \
-            (EdiMode == "RepYadif")     ? isyuy2(Input) ? Repair( Input.nonyuy2clipin(true).Yadifmod2( mode=3 ), default( Fallback, Input.sh_Bob( 0,0.5 ) ).nonyuy2clipin(true), 2, 0 ).nonyuy2clipout(true) : \
-                                                           Repair( Input.Yadifmod2( mode=3 ), default( Fallback, Input.sh_Bob( 0,0.5 ) ), 2, 0 ) : \   
-            (EdiMode == "RepcYadif")    ? isyuy2(Input) ? Repair( Input.Yadif( mode=3 ).nonyuy2clipin(true), default( Fallback, Input.sh_Bob( 0,0.5 ) ).nonyuy2clipin(true), 2, 0 ).nonyuy2clipout(true) : \
-                                                          Repair( Input.Yadif( mode=3 ), default( Fallback, Input.sh_Bob( 0,0.5 ) ), 2, 0 ) : \
+            (EdiMode == "RepYadif")     ? isyuy2(Input) ? Repair( Input.nonyuy2clipin(true).Yadifmod2( mode=3 ), default( Fallback, Input.Bob( 0,0.5 ) ).nonyuy2clipin(true), 2, 0 ).nonyuy2clipout(true) : \
+                                                           Repair( Input.Yadifmod2( mode=3 ), default( Fallback, Input.Bob( 0,0.5 ) ), 2, 0 ) : \  
+            (EdiMode == "RepcYadif")    ? isyuy2(Input) ? Repair( Input.Yadif( mode=3 ).nonyuy2clipin(true), default( Fallback, Input.Bob( 0,0.5 ) ).nonyuy2clipin(true), 2, 0 ).nonyuy2clipout(true) : \
+                                                          Repair( Input.Yadif( mode=3 ), default( Fallback, Input.Bob( 0,0.5 ) ), 2, 0 ) : \
             (EdiMode == "BWDIF+NNEDI3") ? isyuy2(Input) ? Input.nonyuy2clipin(true).BWDIF(-2,edeint=NNEDI3clp.nonyuy2clipin(true)).Vinverse(clip2=NNEDI3clp.nonyuy2clipin(true)).nonyuy2clipout(true) : Input.BWDIF(-2,edeint=NNEDI3clp).Vinverse(clip2=NNEDI3clp) : \
             (EdiMode == "BWDIF+EEDI3")  ? isyuy2(Input) ? Input.nonyuy2clipin(true).BWDIF(-2,edeint=EEDI3clp.nonyuy2clipin(true)).Vinverse(clip2=NNEDI3clp.nonyuy2clipin(true)).nonyuy2clipout(true) : Input.BWDIF(-2,edeint=EEDI3clp).Vinverse(clip2=NNEDI3clp) : \
-                                          default( Fallback, Input.sh_Bob( 0,0.5 ) )
+                                          default( Fallback, Input.Bob( 0,0.5 ) )

    interpuv = (InputType == 1)        ? NOP() : \
               (ChromaEdi == "NNEDI3") ? Input.NNEDI3( field=-2, nsize=4, nns=0, qual=1, threads=EdiThreads, Y=false ) : \
               (ChromaEdi == "Yadif")  ? isyuy2(Input) ? Input.nonyuy2clipin(true).Yadifmod2( mode=3 ).nonyuy2clipout(true) : Input.Yadifmod2( mode=3 ) : \
               (ChromaEdi == "cYadif") ? Input.Yadif( mode=3 ) : \
-              (ChromaEdi == "Bob")    ? Input.sh_Bob( 0,0.5 ) : \
+              (ChromaEdi == "Bob")    ? Input.Bob( 0,0.5 ) : \
                                         NOP()

    return (!IsClip(interpuv)) ? interp : interp.MergeChroma( interpuv )
@@ -1324,4 +1326,4 @@ function QTGMC_GetUserGlobal( string Prefix, string Name, bool "Reuse" )
    try       { ret = Reuse ? Eval( globalName ) : NOP() }
    catch (e) { ret = NOP() }
    return ret
-}
\ No newline at end of file
+}
realfinder commented 1 year ago

what error you got without the patch? most changes seems to do with Zs_RF_Shared.avsi functions

ctrlcctrlv commented 1 year ago

Lots of missing functions. NNEDI plugin won't compile for GNU/Linux as it #include's windows.h; see https://github.com/jpsdr/NNEDI3/issues/10