SVPflow
Abstract | |
---|---|
Author | SVP Team and MVTools authors |
Version | 4.3.0.168 |
Download | svpflow-4.3.0.168.zip |
Category | Frame Rate Converters |
License |
|
Discussion | Doom9 Forum |
Contents |
Intro
SVPflow provides fast and high quality GPU accelerated frame rate interpolation.
Motion vectors search plugin (svpflow1) is a deeply refactored and modified version of MVTools2 AviSynth plugin and we're grateful to all of MVTools authors: Manao, Fizick, Tsp, TSchniede and SEt for developing such a great library. SVP wouldn't be ever possible without it.
Parts of description were taken from MVTools2 page so this documentation is available under CreativeCommons BY-SA 3.0 license.
See official documentation: https://www.svp-team.com/wiki/Manual:SVPflow
Requirements
- [x86]: AviSynth+ or AviSynth 2.6
- [x64]: AviSynth+
- Supported color formats: YV12
The interface
svpflow1
This is a motion vectors search plugin which is a refactored version of MVTools2 2.5 so this plugin is distributed under terms of the GNU GPL license.
SVSuper(source, params_string)
Get source clip and prepare special "super" clip with multilevel (hierarchical scaled) frames data. The super clip is used by both SVAnalyse and SVSmoothFps functions. For storing and transferring its parameters we use audio properties of super clip (specifically, num_audio_samples) as a trick. So, audio is killed in super clip.
- source - source video clip
- params_string - parameters list in JSON format, names quotation is optional. All parameters are optional too.
{ | |
|
The accuracy of the motion estimation. Value can only be 1, 2 or 4. 1 means a precision to the pixel, 2 means a precision to half a pixel, 4 - to quarter pixel (not recommended to use). |
|
GPU usage mode: 0 - none, 1 - for frame rendering. Note that with "gpu:1" scaling up mode is always set to 0 cause subpixel planes are not actually used for frame rendering. |
|
Turns on reduced super clip size when full=false, valid only with pel=1. It saves some memory and can be useful for processing extra large frames (like UHD (4K)). |
|
Scaling modes: |
|
Subpixel interpolation method for pel=2,4.
|
|
Hierarchical levels smoothing and reducing (halving) filter.
|
|
|
|
Used by the SVP Manager only. You don't need to set this in your own scripts. |
} |
SVAnalyse(super, params_string, [src]: clip)
Get prepared multilevel super clip, estimate motion by block-matching method and produce special output clip with motion vectors data used by SVSmoothFps function. Some hierarchical multi-level search methods are implemented (from coarse image scale to finest).
- super - multilevel super clip prepared by SVSuper function. You can replace this clip with MSuper clip from original MVTools 2.5 in which case you should define "gpu" parameter here.
- params_string - parameters list in JSON format.
- src - source clip, must be defined when using reduced super clip ("super.full"=false).
{ | |
|
GPU usage mode: 0 - none, 1 - for frame rendering. Should be used instead of "super.gpu" if and only if SVSuper is replaced with MSuper! |
|
Direction of motion vectors to search for.
|
|
Defines vectors grid step and block sizes for block matching algorithm. |
|
Size of a block (horizontal). It's either 8, 16 or 32. Larger blocks are less sensitive to noise, are faster, but also less accurate, smaller blocks produce more wavy picture. |
|
Vertical size of a block. Default is equal to horizontal size. Additional options are: 4 for "block.w:8", 8 for "block.w:16", 16 for "block.w:32". |
|
Block overlap value. 0 - none, 1 - 1/8 of block size in each direction, 2 - 1/4 of block size, 3 - 1/2 of block size. The greater overlap, the more blocks number, and the lesser the processing speed.
Resulting overlap value in pixels should be even with CPU rendering. |
|
|
|
Defines main search settings. |
|
Positive value is the number of levels used in the hierarchical analysis made while searching for motion vectors. Negative or zero value is the number of coarse levels NOT used in the hierarchical analysis made while searching for motion vectors. |
|
|
|
The type of search on finest level:
|
|
Search range on finest level:
|
|
Sort vectors from previous level by SAD values to define the order of blocks scanning so the search begins with better predictors. This option is always ON on coarse levels but may be time consuming on finest one. |
|
Use SATD function instead of SAD on finest level. Extremely slow, do not use it! |
|
The same parameters for coarse levels. |
|
Maximum width of a level to be processed with 'coarse' parameters. Can be useful to save CPU power when processing extra large frames (like UHD (4K)). |
|
Same as "main.search.type". |
|
Same as "main.search.type" except zero means "-10". |
|
Use SATD function instead of SAD on every coarse level, improves motion vector estimation at luma flicker and fades. |
|
Try to start searches around many predictors. |
|
Wide second search for bad vectors. |
|
SAD threshold to define "bad" vectors. Value is scaled to block size 8x8. |
|
The range of wide search for bad blocks. Use positive value for UMH search and negative for Exhaustive search. |
|
|
|
|
|
|
|
Main search penalties for motion coherence. |
|
Set the coherence of the field of vectors. The higher, the more coherent. However, if set too high, some best motion vectors can be missed.
This value is different from MVTools, see remark for explanations. |
|
penalty.lambda scaling mode between levels. 1.0 means no scaling, 2.0 - linear, 4.0 - quadratic dependence from hierarchical level number.
This value is different from MVTools, see remark for explanations. |
|
SAD limit for lambda using. Local lambda is smoothly decreased if SAD value of vector predictor is greater than the limit. It prevents bad predictors using but decreases the motion coherence. Value is scaled to block size 8x8. |
|
Relative penalty (scaled to 256) to SAD cost for new candidate vector. New candidate vector must be better will be accepted as new vector only if its SAD with penalty (SAD + SAD*pnew/256) is lower then predictor cost (old SAD). It prevent replacing of quite good predictors by new vector with a little better SAD but different length and direction. |
|
Relative penalty (scaled to 256) to SAD cost for global predictor vector (lambda is not used for global vector). |
|
Relative penalty (scaled to 256) to SAD cost for zero vector. It prevent replacing of quite good predictor by zero vector with a little better SAD (lambda is not used for zero vector). |
|
Relative penalty (scaled to 256) to SAD cost for up to 8 neighbours vectors. |
|
Relative penalty (scaled to 256) to SAD cost for "reverse" vector (already found vector from reverse search direction), works only with "analyse.vectors: 3". |
|
|
|
|
|
Array of structures, each element defines additional level of recalculation, on each level blocks are divided by 4. Replaces MRecalculate function.
Interpolated vectors of old blocks are used as predictors for new vectors, with recalculation of SAD. |
|
Only bad quality new vectors with SAD above this threshold will be re-estimated by search. Good vectors are not changed, but its SAD will be updated (re-calculated). Value is scaled to block size 8x8.
Zero means "do not refine, just divide" |
|
Search parameters. |
|
Same as main.search.type by default. |
|
Same as super.pel value by default. |
|
Same as main.search.satd by default. |
|
|
|
|
|
Same as main.penalty.pnew by default. |
|
|
|
|
|
Some special parameters not used in SVP |
|
Interval between analysed frames. |
|
|
} |
SVConvert(vectors, isb: bool)
Convert SVAnalyse output to the format of MAnalyse compatible with "client" MVTools 2.5 functions.
- vectors - motion vectors data produced by SVAnalyse function,
- isb - which vectors to extracts: forward if isb=false, backward if isb=true.
super = SVSuper(super_params) vectors = SVAnalyse(super, analyse_params) forward_mv = SVConvert(vectors, false) backward_mv = SVConvert(vectors, true) super_mv = MSuper(pel=1, hpad=0, vpad=0) #padding should be zero here! MFlowFps(super_mv, backward_mv, forward_mv, num=60, den=1)
Remark: lambda/plevel values meaning.
Let the finest level number is 0 and we've got N levels total => the smallest level number is N-1.
MVTools approach:
<local lambda value at level K> = lambda * (2^(K*plevel)), where lambda is integer and plevel is integer in [0;2]
SVPflow approach:
<local lambda value at level K> = lambda * 1000 / (plevel^(N-1-K)), where both lambda and plevel are floats.
Benefits - lambda penalty is now invariant to video frame size.
svpflow2
A closed-source frame rendering plugin.
SVSmoothFps(source, super, vectors, params_string, [sar]: float, [mt]: integer)
Will change the framerate (fps) and number of frames of the source clip. The function can be use for framerate conversion, slow-motion effect, etc. It uses motion vectors found with SVAnalyse function to create interpolated pictures at some intermediate time moments between frames. Some internal masks (cover/uncover, vectors quality) can be used to produce the output image with minimal artifacts.
- source - source video clip.
- super - multilevel super clip prepared by SVSuper function.
- vectors - motion vectors data produced by SVAnalyse function.
- params_string - parameters list in JSON format.
- sar - optional, can be used instead of "light.sar" inside ffdshow:
SVSmoothFps(..., sar=float(ffdshow_sar_x)/ffdshow_sar_y, ...)
- mt - optional, workaround for current Avisynth 2.6 MT build ver. 2.6.0.3, should be equal to number of threads defined in SetMTMode():
threads = 10 SetMTMode(3,threads) #.... SVSmoothFps(..., mt=threads, ...)
{ | |
|
Target frame rate. |
|
Numerator of multiplier for frame rate change. |
|
Denominator of multiplier for frame rate change. |
|
If true then num/den define absolute frame rate value instead if multiplier for source frame rate. |
|
|
|
Rendering algorithm or "SVP shader", available values are:
|
|
Use block-based motion compensation instead of pixel-based. Always OFF with GPU rendering enabled. |
|
Only works with GPU rendering enabled:
|
|
Defines which video card should be used for rendering, only works with GPU rendering enabled:
|
|
Only works with GPU rendering enabled. When set to "true" frame rendering is done in linear light. |
|
Masks properties. |
|
Cover/uncover mask strength, more means "more strong mask". Recommended values 50-100. |
|
Bad areas (identified by vector's SAD values) mask, more means "more strong mask". Recommended value is 100, but it can dramatically reduce smoothness effect. |
|
Defines the exponent of relation between SAD and area mask values. |
|
|
|
Extended "scene change" controls. |
|
Frames interpolation mode:
|
|
Blend frames at scene change like ConvertFps if true, or repeat last frame like ChangeFps if false. |
|
Limits for vector field quality / scene change detection.
For example scene change will be detected if number of blocks with "adjusted SAD" > "limits.scene" will be more than "limits.blocks" percents of all blocks, that has "adjusted SAD" value > "limits.zero", where "adjusted SAD" is "block SAD"/"block average luma". |
|
Limit for changing uniform mode to "1m". |
|
Limit for changing "1m" mode to "2m". |
|
Limit for scene change detection. |
|
Vectors with "adjusted SAD" less than this value are excluded from consideration. |
|
Threshold which sets how many blocks in percents have to change. |
|
|
|
Additional correction parameter for "average luma" value. |
|
|
|
"Ambilight"-like black fields lighting. |
|
Screen aspect ratio defines black fields height (or width) and output video frame size. |
|
Source video pixel aspect ratio. |
|
"Glow" (or "zoom out") effect size, in percents of original frame size. |
|
Lights count. |
|
Flare length in percents. |
|
Width of every light. |
|
Height of averaging frame border. |
|
|
} |
SVSmoothFps_NVOF(source, params_string, ...)
TODO!
The same as SVSmoothFps but the motion vectors are acquired in-place via NVidia Optical Flow API so there's no need for SVSuper/SVAnalyse at all.
Samples
Basic Avisynth script
SetMemoryMax(1024) LoadPlugin("svpflow1.dll") LoadPlugin("svpflow2.dll") threads=9 SetMTMode(3,threads) # Some input here SetMTMode(2) ConvertToYV12() # All parameters set to defaults which means high quality frame doubling super=SVSuper("{gpu:1}") vectors=SVAnalyse(super, "{}") SVSmoothFps(super, vectors, "{}", mt=threads)
Basic Vapoursynth script
import vapoursynth as vs core = vs.get_core(threads=9) core.std.LoadPlugin("svpflow1_vs.dll") core.std.LoadPlugin("svpflow2_vs.dll") clip = # need some input here clip = clip.resize.Bicubic(format=vs.YUV420P8) #convert to YV12 super = core.svp1.Super(clip,"{gpu:1}") vectors= core.svp1.Analyse(super["clip"],super["data"],clip,"{}") smooth = core.svp2.SmoothFps(clip,super["clip"],super["data"],vectors["clip"],vectors["data"],"{}") smooth = core.std.AssumeFPS(smooth,fpsnum=smooth.fps_num,fpsden=smooth.fps_den) smooth.set_output()
All other scripts are the same except for different JSON strings. For example:
Maximum smoothness for animation
# Header is exactly same as in previous example super=SVSuper("{gpu:1}") # Small 8x8 blocks with additional refine to 4x4 vectors=SVAnalyse(super, "{ block:{w:8}, refine:[{thsad:1000}] }") # Conversion to 5/2 of source frame rate with 2nd SVP-shader. SVSmoothFps(super, vectors, "{ num:5, den:2, algo:2 }", mt=threads)
More JSON magic
Multi-line JSON string with comments inside it:
analyse_params="""{block:{w:8,overlap:1}, main: {search: {type:2,distance:-2,satd:true, coarse:{trymany:true} } // the following line is commented out in C++-style //,penalty:{plevel:1.0,lambda:1.0} } }""" # ... vectors=SVAnalyse(super, analyse_params) # ...
Downloads
The latest version is: 4.3.0.168 (2019-07-28).
The distribution includes:
- svpflow1.dll, svpflow2.dll, 32-/64-bit plugins for AviSynth and VapourSynth on Windows
- svpflow1.so, svpflow2.so, 64-bit plugins for VapourSynth on Linux
- svpflow1.dylib, svpflow2.dylib 64-bit plugins for VapourSynth on MacOS
- sample scripts
- readme and licenses files
Please note that SVPflow v4.3.0.168 libs require SVP Manager running (Windows and macOS only), otherwise you'll see a red rectangle around the video frame and the interpolated are just duplicates.
You're free to disable SVP completely ("Temporarily disable SVP" + ui.disable_on_launch = true in All settings), however it still must be running in background.
Download link is here: https://www.svp-team.com/files/gpl/svpflow-4.3.0.168.zip
As an alternative you can you use version 4.2.0.142 which does not have the SVP Manager requirement.
Archived Downloads
Version | Download | Mirror |
---|---|---|
v4.3.0.168 | svpflow-4.3.0.168.zip | svpflow-4.3.0.168.zip |
v4.2.0.142 | svpflow-4.2.0.142.zip | |
v4.0.0.128 | svpflow-4.0.0.128.zip | |
v1.1.16 | svpflow-1.1.16.zip | |
v1.1.15a | svpflow-1.1.15a.zip |
- svpflow1 v4.2.0.142 source code: svpflow1-src.zip /// mirror
Changelog
SVPflow – 4.3.0.168 – 2019-07-28 = AviSynth: further improved HDR tone mapping in GPU mode: brighter, less yellowish, 1st SVP shader fixed = VapourSynth: fixed audio desync in VLC SVPflow – 4.3.0.165 – 2019-06-08 = Avisynth: improved HDR tone mapping in GPU mode = improved SAD masking and 13th SVP shader (thanks to Mystery) = Linux: fixed memory leak in some cases + Win, Mac: requires SVP Manager rev.165 or later to work SVPflow – 4.3.0.161 – 2019-04-24 = NVOF: fixed wrong MVs alignment in some cases = NVOF: fixed init error with some video files SVPflow – 4.3.0.160 – 2019-03-29 + support for MVs calculation via NVIDIA Optical Flow API SVPflow – 4.3.0.157 – 2019-02-12 = Vapoursynth: fixed wrong frame timestamps in some cases resulting in audio de-sync SVPflow – 4.3.0.155 – 2018-11-15 = improved performance playing UHD video with GPU acceleration on + Avisynth: added HDR colors recovery mode = fixed crash with empty black borders lighting playing 3D video SVPflow – 4.2.0.147 – 2018-08-11 = Vapoursynth: fixed audio sync issues in some cases, especially with VFR sources SVPflow – 4.2.0.146 – 2018-07-31 + Vapoursynth: correctly process variable frame rate (VFR) sources SVPflow – 4.2.0.145 – 2018-05-04 = fixed incorrect outer lighting when light.length=0 (needed for 3D AR fix) SVPflow – 4.2.0.144 – 2018-03-13 = fixed wrong colors and video blinking in 10-bit mode = Mac: fixed crash on some files with OSD turned on SVPflow – 4.2.0.142 – 2017-10-19 = fixed OSD image blinking = fixed minor (?) error in the motion vectors search algorithm (“cross search”) + updated ASM code from x264 (supports AVX-512) SVPflow – 4.1.0.141 – 2017-04-05 = fixed high CPU load with frame interpolation off SVPflow – 4.1.0.140 – 2017-03-03 + rendering in 10 bit color depth (Vapoursynth only) SVPflow – 4.0.0.137 – 2016-08-25 = fixed random crash in mpv and VLC SVPflow – 4.0.0.136 – 2016-08-18 = fixed video corruption with smooth.cubic=0 SVPflow – 4.0.0.135 – 2016-04-30 = Win: fixed random crash in some cases SVPflow – 4.0.0.132 – 2016-03-18 – Win: dropped legacy Avisynth 2.5 interface support + Win: added SVConvert function in 64-bit version SVPflow – 4.0.0.131 – 2016-03-04 = Mac: initial public release – Linux: removed Qt dependencies SVPflow – 4.0.0.130 – 2016-02-27 = may fix crashes in some cases = fixed wrong colors in SVPlight SVPflow – 4.0.0.129 – 2016-02-23 = fixed crash with SVPlight enabled SVPflow – 4.0.0.128 – 2016-02-22 = bump versions to match SVP 4 multi-OS release + Vaporsynth/Windows 32-bit/64-bit builds + Vaporsynth/Linux 32-bit/64-bit builds + all filters now compatible with MT mode 1 + improved multi-threaded performance and stability Version - 1.1.16 - 2015-07-08 = fixed random crash in svpflow1.dll found by SVP 3.1.7 users Version 1.1.15a (05/15/15) + 64-bit AviSynth build added Version 1.1.15 (05/13/15) = fixed performance issues with the default main.search.coarse.width value (introduced in 1.1.12) Version 1.1.14 (04/24/15) = up to 15% faster = 2nd attempt to fix broken SVConvert function NOT fixed in 1.1.13 Version 1.1.13 (03/09/15) = fixed broken SVConvert function Version 1.1.12 (03/04/15) = up to 20% faster + "64-bit ready" - assembler code (still not all of them) ported/rewritten in intrinsics, target compiler is VC++2013 + new option in SVAnalyse - search.main.coarse.width - to get more than one "finest" levels + SATD for 32-x blocks = reduced memory usage for large number of small blocks = refactoring - removed svpflow_cpu/gpu modules - merged with svpflow2 Version 1.0.11 (05/04/14) = Fixed crash in CPU rendering mode with pel>1 and blend=true = Fixed rounding error in GPU rendering mode Version 1.0.10 (04/01/14) + GPU rendering in linear light by default = SAD functions updated to the latest x264 code Version 1.0.9 (07/17/13) + SVSmoothFps switches to 13th SVP shader if scene quality is below scene.m1 value = GPU rendering was very slow for some "prime" frame sizes (like 1916x1076) on some video cards - removed workaround for a bug in early IvyBridge's drivers Version 1.0.8 (02/03/13) = fixed regression from 1.0.5 (low rendering precision in GPU mode) = improved lighting quality (reduced color banding) Version 1.0.7 (01/23/13) + improved scene change detection = fixed crash after SVConvert, adjusted SAD values in MVTools' vectors field Version 1.0.6 (12/23/12) + super clip size reduced by 4 for pel=1 ('full' param in SVSuper and 'src' param in SVAnalyse) = added workaround for OpenCL rendering on Intel's IvyBridge GPUs + "Ambilight" can now produce "glow" effect from all sides of the frame ('light.zoom' param in SVSmoothFps) = several small bugs fixed: == crash with frame rate ratio < 2 (50->60, 60->50 and so on) == arts near screen edges with CPU rendering and some frame / block sizes combination == green lines with 21th shader and arts masking on CPU Version 1.0.5 (05/03/12) = added compatibility with GTX680 (and may be with all other Kepler GPUs) - thanks to flagger Version 1.0.4 (05/02/12) + added special.delta param Version 1.0.3 (04/16/12) = fixed random crash in MT mode = fixed usage of invalid predictors from reverse vectors (thanks -Vit-) Version 1.0.2 (04/04/12) = support for multiply SVSmoothFps instances needed for proper 3D handling + SVConvert function for integration with MVTools-based scripts + GPU selection for rendering = updated SAD/SATD x264 code
Changelog put together from info found here:
- https://www.svp-team.com/news/
- https://www.svp-team.com/wiki/Changelog
- https://forum.doom9.org/showthread.php?t=164554
Back to External Filters ←