WolframRhodium / VapourSynth-dpid

Rapid, Detail-Preserving Image Downscaler for VapourSynth
BSD 3-Clause "New" or "Revised" License
33 stars 4 forks source link

lambda -> invalid syntax #16

Open Selur opened 2 years ago

Selur commented 2 years ago

Using:

# Imports
import vapoursynth as vs
import os
import ctypes
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("i:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
import sys
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'i:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/DPID/vapoursynth-dpid.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/temporalsoften.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import havsfunc
# source: 'G:\TestClips&Co\files\mxf\C0100.MXF'
# current color space: YUV422P8, bit depth: 8, resolution: 1920x1080, fps: 25, color matrix: 709, yuv luminance scale: limited, scanorder: top field first
# Loading G:\TestClips&Co\files\mxf\C0100.MXF using LWLibavSource
clip = core.lsmas.LWLibavSource(source="G:/TestClips&Co/files/mxf/C0100.MXF", format="YUV422P8", cache=0, prefer_hw=0)
# Setting color matrix to 709.
clip = core.std.SetFrameProps(clip, _Matrix=1)
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=1)
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# setting field order to what QTGMC should assume (top field first)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=2)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=True) # new fps: 25
# make sure content is preceived as frame based
clip = core.std.SetFieldBased(clip, 0)
clip = clip[::2]
# Resizing: 1920x1080 -> 720x406
clip = core.dpid.Dpid(clip=clip, width=720, height=406, lambda=0.9)
# adjusting output color from: YUV422P8 to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
# set output frame rate to 25.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()

I get

Failed to evaluate the script:
Python exception: invalid syntax (tempPreviewVapoursynthFile19_00_52_017.vpy, line 49)

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2818, in vapoursynth._vpy_evaluate
File "E:\Temp\tempPreviewVapoursynthFile19_00_52_017.vpy", line 49
clip = core.dpid.Dpid(clip=clip, width=720, height=406, lambda=0.9)
^
SyntaxError: invalid syntax

when using VSPipe instead of a viewer, I get:

Script evaluation failed:
Python exception: invalid syntax (tempPreviewVapoursynthFile19_00_52_017.vpy, line 49)

Traceback (most recent call last):
  File "src\cython\vapoursynth.pyx", line 2818, in vapoursynth._vpy_evaluate
  File "e:\Temp\tempPreviewVapoursynthFile19_00_52_017.vpy", line 49
    clip = core.dpid.Dpid(clip=clip, width=720, height=406, lambda=0.9)
                                                                  ^
SyntaxError: invalid syntax

When not using 'lambda' everything works. My wild guess would be that it collides with Pythons lamba-operator.

Cu Selur

AkarinVS commented 2 years ago

please use lambda_=0.9 to avoid conflicting with the lambda keyword.

Selur commented 2 years ago

Thanks! Using 'lamba_' works, using '_lambda' or 'lambda' (which is now stated by the README.md) does not. -> README.md should be adjusted. :)