This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Why is KNLMeansCL slowing me down so much
I am using Hybrid_2022.03.20.1_SETUP. I have encoded dozens of episodes with multiple filters being used. Suddenly when I try to encode more of the same episodes using the same filters, my fps drops from nearly 4fps to 0.3fps. I eliminate filters one by one to see if it's caused by one in particular and it turns out that when KNLMeansCL is running is when my fps becomes so low. But it didn't cause the problem before so I'm not sure why it's a problem now. Is there a way to update this filter or figure out why it's suddenly causing problems?

I run Windows 10 x64, i5-4430, Radeon HD 6850 1GB, 16GB DDR3
Quote: Is there a way to update this filter or figure out why it's suddenly causing problems?
Not enough details to adjequately comment this.
You neither show the VapourSynth nor AviSynth scripts you use, nor do you provide any details about the source.

Wild guess - from the speed drop - would be that before your source was progressive and you are now using an interlaced source which needs deinterlacing.

-> Read the sticky, provide a debug output and detailed steps what you do and I can look at it after work.

Cu Selur
Here's the attempted script with KNL included. It's not an interlaced source. I go onto the (De-)Interlace tab to set Auto Deinterlace Handling to None. The source is 1920x1080 but I crop the black sides so it is 1440x1080 for the encode.
# Imports
import os
import sys
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'C:/Program Files/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/CTMF/CTMF.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DenoiseFilter/KNLMeansCL/KNLMeansCL.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SharpenFilter/AWarpSharp2/libawarpsharp2.dll")
core.std.LoadPlugin(path="C:/Program Files/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import hnwvsfunc
import psharpen
import havsfunc
import mvsfunc
# source: 'E:\Pumbaa.mkv'
# current color space: YUV420P8, bit depth: 8, resolution: 1920x1080, fps: 23.976, color matrix: 709, yuv luminance scale: limited, scanorder: progressive
# Loading E:\Pumbaa.mkv using LWLibavSource
clip = core.lsmas.LWLibavSource(source="E:\Pumbaa.mkv", format="YUV420P8", 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 23.976
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# cropping the video to 1440x1080
clip = core.std.CropRel(clip=clip, left=236, right=244, top=0, bottom=0)
# line darkening using Toon
clip = havsfunc.Toon(input=clip,str=0.50)
# applying delocking using Deblock
clip = core.deblock.Deblock(clip=clip, quant=33, boffset=14)
# denoising using KNLMeansCL
clip = havsfunc.KNLMeansCL(clip=clip, a=1)
# sharpening using AWarpSharp2
clip = core.warp.AWarpSharp2(clip=clip, blur=2, depth=2)
# sharpening using PSharpen
clip = psharpen.psharpen(clip=clip)
# Anti Aliasing using DAAMod
clip = hnwvsfunc.daamod(c=clip)
clip = havsfunc.FineDehalo(clip)
# adjusting output color from: YUV420P8 to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited")
# set output frame rate to 23.976fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001)
# Output
Quote:It's not an interlaced source. I go onto the (De-)Interlace tab to set Auto Deinterlace Handling to None.
That is not needed. Since the source isn't detected as interlaced Hybrid won't deinterlace.

Quote:my fps drops from nearly 4fps to 0.3fps.
tried the script, KNLMeansCL isn't the bottleneck for me.
(I'm using a Ryzen 9 3850x)
with the script as you posted it, I get 19.5fps
(just) without KNLMeansCL I get 20.5fps
(just) without daamod I get 27fps
(just) without FineDeHalo I get 34.4fps

Assuming you are correct and it is indeed KNLMeansCL that is slowing you down and it didn't do this before, I would suggest to:
a. check the taskmanager whether some anti virual tool or similar is slowing the whole process down
b. reinstall your GPU drivers

Cu Selur
I used the AMD Catalyst Control Center to determine what my newest drives are. Downloaded them and re-installed them. Although since it's such an old video card the drivers haven't been updated on the website for several years.

If I look at my Task Manager activity while Hybrid is running, it shows my CPU usage is above 95% while it's encoding. Every so often a background process of Antimalware Service Executable will blip a few percentages but it also does that while Hybrid is not running. I did notice that when I restarted the script, that program jumped to 20% for less than a second but is now back down to 0%.

It doesn't even start at 0.3fps. It has to slowly build to that. Right now starting the encode again and I'm at 0.07fps. After a few seconds it goes up to 0.08, and so on. It just peaks around 0.3fps or so.

With your tests it appears like KNL should be the least of my concerns. When you disable FineDeHalo only you get the biggest boost yet that one is not what's causing my massive slowdown. If I remove all filters by choosing no XSynth, I can get between 6-8fps from the beginning. If I keep KNL but disable FineDeHalo I stay stuck at abysmal 0.10fps. So how can I fix it?

Thank you for the help
Since I'm not aware of any changes in any of the used filters that would explain such a speed drop and I assume that you before used the same settings, a similar source (same resolution, format, etc.) and didn't change which graphic card is the first one in your system try whether is changes anything if you:
  • set "Filtering->Vapoursynth->Misc->Source->Libav hardware decoding mode" to '2' this way the decoding of the source should be done through the decoder chip of the gpu.
  • Try whether changing "Filtering->Vapoursynth->DeNoise->KNLMeansCL->Device type" and "Filtering->Vapoursynth->DeNoise->KNLMeansCL->Device type->Device" to test whether it changes anything if KNLMeansCL runs on the CPU, CPU-GPU or AMD card.
  • adding the filters one by one to see which one is the bottleneck, like I stated on my system it isn't KNLMeansCL.

Cu Selur
Looking at Libav hardware decoding mode it shows:
1= Use nVidia CUVID acceleration...
2= Use Intel Quick Sync Video acceleration...
3= Try in the order of CUVID -> QSV
does that mean my video card cannot be used here? I should use QuickSync of my CPU?

and just for more background, this happened before. I encoded several episodes of the show at around 4fps then suddenly it wouldn't encode faster than 0.5fps. I ended up re-installing Windows 10 because there were a few other quirks with my machine so I figured I would start fresh. After the re-install, Hybrid started working as normal again at first but eventually it went back to 0.3fps. All of these encodes are using the same show (different episodes, but the same series throughout the experienced issue)
Yes, libavsource ( can't use the decoder chip of your gpu and using the decoder chip of your gpu might be help. (iirc the IntelĀ® HD-Grafik 4600 should be able to decode H..264 @1080p)

Cu Selur
Am I supposed to download something from that link and put it somewhere?

I changed KNL device type to CPU and got no fps gain. GPU and Accelerator both caused a crash.
No, that link it just to the documentation of libavsource.

Quote:GPU and Accelerator both caused a crash.
Okay, that sounds wrong.
Did you try different device settings in combination with GPU?
If neither of the gpu devices work, it would mean that for some reason you got no, or no working opencl drivers.
Reinstalling the gpu drivers for your intel and out amd gpu might help with that.

Cu Selur

Forum Jump:

Users browsing this thread: 1 Guest(s)