Giter Site home page Giter Site logo

vapoursynth-cnr2's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

milliyang unixfx

vapoursynth-cnr2's Issues

Performance issue due to using fmSerial VSFilterMode

Currently, CNR2 becomes a bottleneck, especially when used in conjunction with slow filters.

Example script:

src=r'test.avi'

import vapoursynth as vs
import havsfunc as haf
core = vs.get_core()

clip = core.lsmas.LWLibavSource(src)

## Test 0 (no filters)

## Test 1 (QTGMC)
#clip = haf.QTGMC(clip, Preset='Slower', TFF=True)

## Test 2 (QTGMC + CNR2)
#clip = haf.QTGMC(clip, Preset='Slower', TFF=True)
#clip = core.cnr2.Cnr2(clip,"oxx",8,16,191,100,255,32,255,False) #VHS

## Test 3 (CNR2)
#clip = core.cnr2.Cnr2(clip,"oxx",8,16,191,100,255,32,255,False) #VHS

clip.set_output()

The results are:

Test 0 (no filters):   ~920 fps, ~100% CPU
Test 1 (QTGMC):         ~50 fps, ~100% CPU
Test 2 (QTGMC + CNR2):  ~25 fps,  ~40% CPU
Test 3 (CNR2):         ~540 fps,  ~60% CPU

Due to CNR2 being fmSerial, it prevents QTGMC from using all available CPU.

Changing filter mode to fmUnordered (or even fmParallelRequests) should resolve the problem.

Random crash with YUV444P8 (works with YUV

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/DenoiseFilter/Cnr2/libcnr2.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/Support/DePan.dll")
core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DebandFilter/Flash3kDeband/flash3kyuu_deband.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/d2vSource/d2vsource.dll")
# Import scripts
import lostfunc
import autowhite
import havsfunc
# source: 'C:\Users\Selur\Desktop\VTS_01_1.MPG'
# current color space: YUV420P8, bit depth: 8, resolution: 720x576, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: top field first
# Loading C:\Users\Selur\Desktop\VTS_01_1.MPG using D2VSource
clip = core.d2v.Source(input="E:/Temp/mpg_f02df6982fa4b3a8d498a0ad5b138442_853323747.d2v", rff=False)
# Setting color matrix to 470bg.
clip = core.std.SetFrameProps(clip, _Matrix=5)
clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5)
clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5)
# 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: 50
# make sure content is preceived as frame based
clip = core.std.SetFieldBased(clip, 0)
# Color Adjustment using SmoothLevels
clip = havsfunc.SmoothLevels(input=clip, output_low=16, output_high=235, Ecurve=0)
# adjusting color space from YUV420P8 to RGB24 for vsAutoWhite
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
# Color Adjustment
clip = autowhite.AutoWhite(clip=clip)
# adjusting color space from RGB24 to YUV444P8 for vsFixChromaBleeding
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444P8, matrix_s="470bg", range_s="limited")
# Fixing chroma bleeding using FixChromaBleedingMod
clip = havsfunc.FixChromaBleedingMod(input=clip)
# stabilizing using Stab
clip = lostfunc.Stab(clp=clip,range=4,mirror=0,dxmax=16,dymax=16)
# cropping the video to 624x556
clip = core.std.CropRel(clip=clip, left=48, right=48, top=4, bottom=16)
# chroma denoising using VsCnr2
# clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P8)
clip = core.cnr2.Cnr2(clip=clip, mode="oxx")
# adjusting output color to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
# set output frame rate to 50.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=50, fpsden=1)
# Output
clip.set_output()

I get random crashs (vspipe simply closes with out any error messages) unless I add:
clip = core.resize.Bicubic(clip=clip, format=vs.YUV422P8) or clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8)
before the clip = core.cnr2.Cnr2(clip=clip, mode="oxx") call.

-> seems like something is wrong with the YUV444P8 support.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.