View Full Version : HAvsFunc
Pages :
1
2
3
4
5
6
7
8
9
[
10]
11
12
13
poisondeathray
29th December 2018, 06:07
Would it be possible to add a smoothcurve function or similar ?
(I'm aware of SigmoidInverse and SigmoidDirect , it would be useful to have a function where you remap values directly )
Thanks
lansing
8th April 2019, 18:05
What color format does GrainFactory3 supports? My clip is RGBS and it turns it blueish.
HolyWu
8th April 2019, 22:40
What color format does GrainFactory3 supports? My clip is RGBS and it turns it blueish.
I didn't put format restriction to much of the functions in the script. Some (or many) of them probably don't work with RGB or even floating point.
FortMax
6th May 2019, 20:48
Any chance of you updating the QTGMC port to 3.362? Some older versions (including 3.33) have some weird blending issues that the newest ones fix.
ChaosKing
7th May 2019, 00:11
This is the newest avs version btw https://pastebin.com/JLGwn7mE
HolyWu
7th May 2019, 02:47
Any chance of you updating the QTGMC port to 3.362? Some older versions (including 3.33) have some weird blending issues that the newest ones fix.
I don't have spare time at the moment. Will look into it in 1~2 months. And, what's the exact settings you used for QTGMC? I need to make sure I can reproduce the issue with the same settings.
FortMax
7th May 2019, 21:38
I don't have spare time at the moment. Will look into it in 1~2 months. And, what's the exact settings you used for QTGMC? I need to make sure I can reproduce the issue with the same settings.
I was using Preset="slow", TFF=True, FPSDivisor=2.
It's more noticeable in animation, especially on thicker lines, than it is with live-action stuff. It also can mess with stuff like overlayed text that just appears and disappears as opposed to fading.
pcroland
27th May 2019, 18:30
Dear HolyWu!
I really appreciate your work. Would you be so kind to add/port the following AviSynth script to your collection: FixRowBrightnessMod (and also its Column variant).
Here's the AVS code:
Function FixRBr(clip c, int row, float adj_val, int "prot_val")
{
Assert(adj_val <= 100, "adj_val max value 100")
Assert(adj_val >= -100, "adj_val min value -100")
p = Pow(2, BitsPerComponent(c))-1
b = p-10*(Pow(2, (BitsPerComponent(c)-8)))
prot_val = Default(prot_val, 0)
Assert(prot_val <= Pow(2, BitsPerComponent(c))-1, "prot_val max value = max luma of the current bit depth")
Assert(prot_val >= 0, "prot_val min value 0")
c
ExtractY()
Crop(0,row,0,1)
adj_val >= 0 ? Expr("x 16 scaleb - 0 <= 16 scaleb 235 scaleb " + string(adj_val*2.19) + " scaleb - 16 scaleb - 0 <= 0.01 235 scaleb " + string(adj_val*2.19) + " scaleb - 16 scaleb - ? / 219 scaleb * x 16 scaleb - 235 scaleb " + string(adj_val*2.19) + " scaleb - 16 scaleb - 0 <= 0.01 235 scaleb "\
+ string(adj_val*2.19) + " scaleb - 16 scaleb - ? / 219 scaleb * 16 scaleb + ? x " + string(p-prot_val) + " - -10 scaleb / 0 max 1 min * x x " + string(b-prot_val) + " - 10 scaleb / 0 max 1 min * + 16 scaleb 235 scaleb clip") : \
Expr("x 16 scaleb - 0 <= 16 scaleb 219 scaleb / 235 scaleb " + string(adj_val*2.19) + " scaleb + 16 scaleb - * x 16 scaleb - 219 scaleb / 235 scaleb " + string(adj_val*2.19) + " scaleb + 16 scaleb - * 16 scaleb + ? x " + string(p-prot_val) + " - -10 scaleb / 0 max 1 min * x x " + string(b-prot_val) + \
" - 10 scaleb / 0 max 1 min * + 16 scaleb 235 scaleb clip")
Overlay(c.ExtractY(),last,0,row,mode="luma")
CombinePlanes(last, c, planes="YUV", sample_clip=c)
}
Function FixCBr(clip c, int column, float adj_val, int "prot_val")
{
Assert(adj_val <= 100, "adj_val max value 100")
Assert(adj_val >= -100, "adj_val min value -100")
p = Pow(2, BitsPerComponent(c))-1
b = p-10*(Pow(2, (BitsPerComponent(c)-8)))
prot_val = Default(prot_val, 0)
Assert(prot_val <= Pow(2, BitsPerComponent(c))-1, "prot_val max value = max luma of the current bit depth")
Assert(prot_val >= 0, "prot_val min value 0")
c
ExtractY()
Crop(column,0,1,0)
adj_val >= 0 ? Expr("x 16 scaleb - 0 <= 16 scaleb 235 scaleb " + string(adj_val*2.19) + " scaleb - 16 scaleb - 0 <= 0.01 235 scaleb " + string(adj_val*2.19) + " scaleb - 16 scaleb - ? / 219 scaleb * x 16 scaleb - 235 scaleb " + string(adj_val*2.19) + " scaleb - 16 scaleb - 0 <= 0.01 235 scaleb "\
+ string(adj_val*2.19) + " scaleb - 16 scaleb - ? / 219 scaleb * 16 scaleb + ? x " + string(p-prot_val) + " - -10 scaleb / 0 max 1 min * x x " + string(b-prot_val) + " - 10 scaleb / 0 max 1 min * + 16 scaleb 235 scaleb clip") : \
Expr("x 16 scaleb - 0 <= 16 scaleb 219 scaleb / 235 scaleb " + string(adj_val*2.19) + " scaleb + 16 scaleb - * x 16 scaleb - 219 scaleb / 235 scaleb " + string(adj_val*2.19) + " scaleb + 16 scaleb - * 16 scaleb + ? x " + string(p-prot_val) + " - -10 scaleb / 0 max 1 min * x x " + string(b-prot_val) + \
" - 10 scaleb / 0 max 1 min * + 16 scaleb 235 scaleb clip")
Overlay(c.ExtractY(),last,column,0,mode="luma")
CombinePlanes(last, c, planes="YUV", sample_clip=c)
}
Thank you very much for your effort.
Natty
30th May 2019, 15:17
If you want tr > 3 use the hnwvsfunc.SMDegrain version by Wolfberry https://forum.doom9.org/showthread.php?t=175614
invalid thread
ChaosKing
30th May 2019, 15:35
invalid thread
See here https://forum.doom9.org/showthread.php?p=1862691
Selur
30th May 2019, 16:58
-> https://github.com/Helenerineium/G41Fun/blob/master/G41Fun.py
HolyWu
5th July 2019, 16:03
I was using Preset="slow", TFF=True, FPSDivisor=2.
It's more noticeable in animation, especially on thicker lines, than it is with live-action stuff. It also can mess with stuff like overlayed text that just appears and disappears as opposed to fading.
Hi, I need a short sample for investigation since you said that it's more noticeable in specific content type. 2-3 seconds are sufficient.
HolyWu
7th July 2019, 16:35
Dear HolyWu!
I really appreciate your work. Would you be so kind to add/port the following AviSynth script to your collection: FixRowBrightnessMod (and also its Column variant).
Here's the AVS code:
Thank you very much for your effort.
Hi, may I know where did you get this mod version? Essentially what's the difference or improvement compared to FixRowBrightnessProtect2? I can see the used expression is different though.
pcroland
9th July 2019, 12:31
To be honest, I don't remember where I found the code. For me it is also perfect if you port the Protect2 version. I don't think it would make much difference. Thank you in advance.
Selur
1st August 2019, 15:44
I got a problem on Linux using MCTemporalDenoise
on Windows:
# Imports
import os
import sys
import ctypes
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("I:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'I:/Hybrid/64bit/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DenoiseFilter/TTempSmooth/TTempSmooth.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/DCTFilter.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DeblockFilter/Deblock/Deblock.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2k.dll")
# Import scripts
import havsfunc
# Loading source using FFMS2K
clip = core.ffms2.Source(source="F:/TESTCL~1/files/test.avi",cachefile="E:/Temp/avi_078c37f69bb356e7b5fa040c71584c40_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25/1
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# denoising using MCTemporalDenoise
clip = havsfunc.MCTemporalDenoise(i=clip, settings="low")
# Output
clip.set_output()
works fine.
On Linux (Ubuntu 19.04) calling:
# Imports
import os
import sys
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = '/home/selur/opt/hybrid/vsscripts'
sys.path.append(os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="/home/selur/opt/hybrid/vsfilters/libttempsmooth.so")
core.std.LoadPlugin(path="/home/selur/opt/hybrid/vsfilters/libdfttest.so")
core.std.LoadPlugin(path="/home/selur/opt/hybrid/vsfilters/libfft3dfilter.so")
core.std.LoadPlugin(path="/home/selur/opt/hybrid/vsfilters/libdctfilter.so")
core.std.LoadPlugin(path="/home/selur/opt/hybrid/vsfilters/libdeblock.so")
core.std.LoadPlugin(path="/home/selur/opt/hybrid/vsfilters/libmvtools.so")
core.std.LoadPlugin(path="/home/selur/opt/hybrid/vsfilters/libffms2.so")
# Import scripts
import havsfunc
# Loading source using FFMS2
clip = core.ffms2.Source(source="/home/selur/Schreibtisch/test.avi",cachefile="/home/selur/Schreibtisch/HybridTemp/avi_77c74b7b15937c7267959c738c5ee2fa_936145377.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25/1
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# denoising using MCTemporalDenoise
clip = havsfunc.MCTemporalDenoise(i=clip, settings="low")
# Output
clip.set_output()
I get:
Failed to evaluate the script:
Python exception: DFTTest: invalid entry in sigma string
Traceback (most recent call last):
File "src/cython/vapoursynth.pyx", line 1942, in vapoursynth.vpy_evaluateScript
File "src/cython/vapoursynth.pyx", line 1943, in vapoursynth.vpy_evaluateScript
File "/home/selur/Schreibtisch/HybridTemp/tempPreviewVapoursynthFile16_39_42_491.vpy", line 28, in <module>
clip = havsfunc.MCTemporalDenoise(i=clip, settings="low")
File "/home/selur/opt/hybrid/vsscripts/havsfunc.py", line 2784, in MCTemporalDenoise
p = core.dfttest.DFTTest(i, tbsize=1, sstring='0.0:4.0 0.2:9.0 1.0:15.0', planes=planes)
File "src/cython/vapoursynth.pyx", line 1848, in vapoursynth.Function.__call__
vapoursynth.Error: DFTTest: invalid entry in sigma string
since when using:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="/home/selur/opt/hybrid/vsfilters/libdfttest.so")
core.std.LoadPlugin(path="/home/selur/opt/hybrid/vsfilters/libffms2.so")
# Loading source using FFMS2
clip = core.ffms2.Source(source="/home/selur/Schreibtisch/test.avi",cachefile="/home/selur/Schreibtisch/HybridTemp/avi_77c74b7b15937c7267959c738c5ee2fa_936145377.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25/1
clip = core.std.AssumeFPS(clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# denoising using DFTTest
clip = core.dfttest.DFTTest(clip=clip)
# Output
clip.set_output()
works fine, I don't think it's an issue of my DFTTest build.
The python version on my linux system is "Python 3.7.3 (default, Apr 3 2019, 05:39:12)" in case it matters.
Is there some way I need to modify:
p = core.dfttest.DFTTest(i, tbsize=1, sstring='0.0:4.0 0.2:9.0 1.0:15.0', planes=planes)
to make it working, or does anyone know what could be causing this?
Cu Selur
Myrsloik
1st August 2019, 15:57
Could the decimal separator by any chance be , instead of . on your linux system?
Selur
2nd August 2019, 19:54
Yes,... but that's also true for my Window system.
I assumed, like in C++ it's a thing defined by the language not the current 'local' or similar.
(that's really scary,...)
-> you are right, when I replace the dots with commas it works.
There must be a way to write such code dependent of the 'local' of the system
Myrsloik
2nd August 2019, 21:48
Yes,... but that's also true for my Window system.
I assumed, like in C++ it's a thing defined by the language not the current 'local' or similar.
(that's really scary,...)
-> you are right, when I replace the dots with commas it works.
There must be a way to write such code dependent of the 'local' of the system
It's all locale hell. There are many ways to get around it and use functions where you can specify the locale (sscanf_l instead of sscanf if available) or C++ streams or whatever.
It's also blindingly obvious dfttest got a lazy port. The arguments sstring, ssx, ssy and sst should simply be arrays of float in VS.
Selur
3rd August 2019, 08:17
opened an issue over at https://github.com/HomeOfVapourSynthEvolution/VapourSynth-DFTTest/issues/8
Something like (I don't know how to do the 'if' part properly):
if float('1.0') != float('1')
p = core.dfttest.DFTTest(i, tbsize=1, sstring='0,0:4,0 0,2:9,0 1,0:15,0', planes=planes)
else
p = core.dfttest.DFTTest(i, tbsize=1, sstring='0.0:4.0 0.2:9.0 1.0:15.0', planes=planes)
should work as a workaround, but how to write this in python3 syntax?
Git it using:
if (float("1.0") != float("1")):
p = core.dfttest.DFTTest(i, tbsize=1, sstring='0.0:4.0 0.2:9.0 1.0:15.0', planes=planes)
else:
p = core.dfttest.DFTTest(i, tbsize=1, sstring='0,0:4,0 0,2:9,0 1,0:15,0', planes=planes)
in MCTemporalDenoise
and if (float("1.0") != float("1")):
pref = core.std.MaskedMerge(core.dfttest.DFTTest(inputP, tbsize=1, sstring='0.0:4.0 0.2:9.0 1.0:15.0', planes=planes),
inputP,
core.std.Expr([mvf.GetPlane(inputP, 0)], [expr]),
planes=planes)[
else:
pref = core.std.MaskedMerge(core.dfttest.DFTTest(inputP, tbsize=1, sstring='0,0:4,0 0,2:9,0 1,0:15,0', planes=planes),
inputP,
core.std.Expr([mvf.GetPlane(inputP, 0)], [expr]),
planes=planes)
in SMDegrain, seems to fix the issue
ChaosKing
3rd August 2019, 10:21
Maybe it is easier to use locale https://docs.python.org/2/library/locale.html -> locale.setlocale(locale.LC_ALL, 'en_us')
Python returns this on a german Windows 10:
python -c "import locale; print(locale.localeconv())"
{'int_curr_symbol': '', 'currency_symbol': '', 'mon_decimal_point': '', 'mon_thousands_sep': '', 'mon_grouping': [], 'positive_sign': '', 'negative_sign': '',
'int_frac_digits': 127, 'frac_digits': 127, 'p_cs_precedes': 127, 'p_sep_by_space': 127, 'n_cs_precedes': 127,
'n_sep_by_space': 127, 'p_sign_posn': 127, 'n_sign_posn': 127, 'decimal_point': '.', 'thousands_sep': '', 'grouping': []}
Selur
3rd August 2019, 12:15
I don't like the idea of switching the locale since loading different sub-scripts from different authors inside a script that might also contain some code written by me I hate the idea that the last script that changed the locale changes the local not just for the sub-script but for the all the scripts,..
So if you change the locale it should be changed per function and restored to the previous value.
best solution would be if:
dfttest adjusts the interface to use float arrays and MCTemporalDenoise&SMDegrain would be adjusted accordingly.
-> hoping HolyWu will adjust DFTTest :)
Myrsloik
3rd August 2019, 15:50
Maybe it is easier to use locale https://docs.python.org/2/library/locale.html -> locale.setlocale(locale.LC_ALL, 'en_us')
Python returns this on a german Windows 10:
python -c "import locale; print(locale.localeconv())"
{'int_curr_symbol': '', 'currency_symbol': '', 'mon_decimal_point': '', 'mon_thousands_sep': '', 'mon_grouping': [], 'positive_sign': '', 'negative_sign': '',
'int_frac_digits': 127, 'frac_digits': 127, 'p_cs_precedes': 127, 'p_sep_by_space': 127, 'n_cs_precedes': 127,
'n_sep_by_space': 127, 'p_sign_posn': 127, 'n_sign_posn': 127, 'decimal_point': '.', 'thousands_sep': '', 'grouping': []}
That is a really horrible idea. Now imagine using VS from inside an application that itself sets the locale to something in order to work. You've now broken everything.
LIBRARIES MUST NEVER MODIFY GLOBAL APPLICATION STATE
ChaosKing
3rd August 2019, 15:57
In my head it was only for a script and not global... :D
But you could change it back at the end of the script.
Selur
4th August 2019, 08:50
Holywo adjusted the library by changing the local to us and back,..
HolyWu
6th August 2019, 16:05
Update r32:
MCTemporalDenoise: Add option edgeclean.
Add functions dec_txt60mc, ivtc_txt30mc, FixColumnBrightness, FixRowBrightness, FixColumnBrightnessProtect, FixRowBrightnessProtect, FixColumnBrightnessProtect2, FixRowBrightnessProtect2, and bbmod.
Keep up with the changes in DFTTest.
Boulder
16th August 2019, 18:15
I have a weird issue with QTGMC. If I use it to get a double-rate output out of this clip here, there are some weird vertical artifacts. I tested both presets very slow and very fast, and the same issue is there.
Take a closer look at the bass player in the screenshot.
https://drive.google.com/open?id=1BuRWBaX7BjFp3nBjCSDEDEu7ZuaM9NQV (sample m2ts)
https://drive.google.com/open?id=1AMxv9F6taHSoCGGGxbIEF71cFbl-fcJl (screenshot)
If I just separate the fields, there's nothing strange there.
poisondeathray
16th August 2019, 19:33
I have a weird issue with QTGMC. If I use it to get a double-rate output out of this clip here, there are some weird vertical artifacts. I tested both presets very slow and very fast, and the same issue is there.
Take a closer look at the bass player in the screenshot.
https://drive.google.com/open?id=1BuRWBaX7BjFp3nBjCSDEDEu7ZuaM9NQV (sample m2ts)
https://drive.google.com/open?id=1AMxv9F6taHSoCGGGxbIEF71cFbl-fcJl (screenshot)
If I just separate the fields, there's nothing strange there.
I cannot reproduce with vapoursynth , using lsmash as the source filter . Looks ok in avisynth too.
Perhaps it's a source filter issue ? Check that it's decoding correctly
Your screenshot looks lossy despite being a PNG. Perhaps it's an encoder/encoding settings issue ?
Boulder
16th August 2019, 20:11
The source filter is DGDecNV, and there's no problem if I just separate the fields. I'd assume that a decoding issue would also show up there. I also tried bobbing with TDeintMod and it doesn't cause the artifacts.
poisondeathray
16th August 2019, 20:24
Vapoursynth 47.2 ?
Also check your plugin/dependency versions
ChaosKing
16th August 2019, 21:00
Can not reproduce. Tested with R47.2, DGDecNV + lsmas and latest havsfunc.
haf.QTGMC(dgi, Preset="slower", TFF=True)
Boulder
16th August 2019, 21:44
I'll have to try updating all the plugins and stuff, maybe there is something causing it.
lansing
17th August 2019, 02:25
I'll have to try updating all the plugins and stuff, maybe there is something causing it.
I can reproduce it with earlier vs version, it is okay with newest version.
Boulder
17th August 2019, 10:35
I can reproduce it with earlier vs version, it is okay with newest version.
That's true. I just upgraded from R47 to R47.2 and it's gone :)
Mystery Keeper
17th August 2019, 20:48
Same issue I had with mxNet. Yes, VS 47.2 fixes it.
fAy01
1st September 2019, 21:29
Thanks for filling my previous requests. Would you consider porting InpaintDelogo https://forum.doom9.org/showthread.php?t=176860 ? Furthermore, I'm interested to see how it'd perform against logoNR.
Also, please port SmoothD2 to as well. http://avisynth.nl/index.php/SmoothD2 <-- SmoothD2 performs better than other deblocking plugin and scripts (DeblockPP7, deblock_qed, and AutoDeblock).
poisondeathray
2nd October 2019, 05:02
Overlay bug? havsfunc r32
A foreground clip smaller in dimensions than the background clip, cuts out with black to fill the height
avisynth
https://i.postimg.cc/6pNPV4nf/overlay-avs.png
vapoursynth
https://i.postimg.cc/zX3DmMcc/overlay-vpy.png
avs
fg=blankclip(1,1024,640,"RGB24",color=color_darkred)
bg=blankclip(1,1280,720,"RGB24",color=color_gray)
overlay(bg,fg)
vpy
fg = core.std.BlankClip(width=1024, height=640, format=vs.RGB24, fpsnum=24, fpsden=1, length=1, color=[139, 1, 0])
bg = core.std.BlankClip(width=1280, height=720, format=vs.RGB24, fpsnum=24, fpsden=1, length=1, color=[128, 128, 128])
overl = haf.Overlay(bg, fg)
overl.set_output()
EDIT: also, x=, y= positioning do not seem to work in vpy overlay (e.g. x=20, y=20) - it just returns the bg clip; but works ok in avisynth
HolyWu
2nd October 2019, 08:16
Overlay bug? havsfunc r32
A foreground clip smaller in dimensions than the background clip, cuts out with black to fill the height
It likely is a MaskedMerge bug introduced in VS R47. Try again with VS R46.
poisondeathray
2nd October 2019, 15:32
It likely is a MaskedMerge bug introduced in VS R47. Try again with VS R46.
Works with R46.
_Al_
2nd October 2019, 15:47
for overlay you can use this overlay function (based on our discussion on ramping), I just simplified that, no moduls needed only numpy.
avantages: much faster, YUV does not need to be converted to 444, numpy does it on the fly even chroma resolutions, works with any vs format
cons: numpy modul needed
formats needs to be the same though, also make sure the lengths are same, and there is enough room for pasting pip did not troubleshoot that:
import vapoursynth as vs
from vapoursynth import core
import numpy as np
file1 = r'C:\path\background.mp4'
file2 = r'D:\path\pasted_video.avi'
X1,Y1 = (100,100)
clip = core.ffms2.Source(file1)
pip = core.ffms2.Source(file2)
#make sure clips have the same format and lenght, then continue
def overlay(clip, pip, X1, Y1):
pl = clip.format.num_planes
if clip.format.name == 'CompatBGR32':
Y1 = clip.height - (Y1 + pip.height) #Y is mirrored
X2,Y2 = (X1 + pip.width, Y1 + pip.height)
#shifting 0,1 or 2 to get chroma coordinates, equivalent of dividing Y plane coordinates by 1,2 or 4
X1CH,Y1CH = (X1 >> clip.format.subsampling_w, Y1 >> clip.format.subsampling_h)
X2CH,Y2CH = (X2 >> clip.format.subsampling_w, Y2 >> clip.format.subsampling_h)
def pip_func(n,f):
fout = f[0].copy()
for p in range(pl):
plane = np.asarray(f[0].get_read_array (p))
rectangle = np.asarray(f[1].get_read_array (p))
plane_out = np.asarray(fout.get_write_array(p))
if p: plane[Y1CH:Y2CH, X1CH:X2CH] = rectangle #p=1,2 U,V plane
else: plane[Y1:Y2, X1:X2] = rectangle #p=0 Y plane
np.copyto(plane_out, plane) #writing np.array plane into vapoursynth._memoryviewslice
del plane_out
return fout
return core.std.ModifyFrame(clip, [clip,pip], pip_func)
clip = overlay(clip, pip, X1, Y1)
clip.set_output()
poisondeathray
2nd October 2019, 16:04
Thanks _Al_ ;
I don't "need" it right now in terms of some pressing engagement :) ; but there are some functions and scripts that rely MaskedMerge and/or Overlay that are probably broken in R47.x
If that method is better in terms of pros/cons , maybe it can be implemented in vapoursynth core, maskedmerge, or havsfunc overlay ?
_Al_
2nd October 2019, 16:20
To be fully replaceable, opacity and mask arguments would need to be added. Havsfunc.Overlay offers arguments like that, in a sense if there is no opacity it might not be calledd overlay (as I named that function). It would involve some numpy calculations to achieve that. But MaskedMerge is a vs function, so it is fast, it would be interesting to compare it speed wise.
ChaosKing
20th October 2019, 20:46
Contrasharpen and smdegrain(contrasharp=True) produce a pink border. VS R48 RC1
clip = core.std.BlankClip(format=vs.YUV420P8)
clip=haf.SMDegrain(clip, contrasharp=True)
Myrsloik
20th October 2019, 21:07
Contrasharpen and smdegrain(contrasharp=True) produce a pink border. VS R48 RC1
clip = core.std.BlankClip(format=vs.YUV420P8)
clip=haf.SMDegrain(clip, contrasharp=True)
I can't reproduce it. Using the vsrepo version of everything. Try adding vs.core.std.SetMaxCPU("none") to the start of the script on your end.
ChaosKing
20th October 2019, 22:48
The pink border disappears with SetMaxCPU("none"). My cpu is a ryzen 2600
With SetMaxCPU("avx2") and "sse2" it's still pink.
EDIT
With BlankClip(format=vs.YUV420P16) (and 420P10) it's the same, except that sse2 produces vertical stripes.
EDIT
422, 444 is also affected.
l00t
21st October 2019, 07:42
bbmod also seems to be affected, it was OK with R47.2 and broken in R48-RC1
(tested with YUV420P8, YUV444P16 and YUV420P16)
Contrasharpen and smdegrain(contrasharp=True) produce a pink border. VS R48 RC1
clip = core.std.BlankClip(format=vs.YUV420P8)
clip=haf.SMDegrain(clip, contrasharp=True)
Myrsloik
21st October 2019, 08:11
bbmod also seems to be affected, it was OK with R47.2 and broken in R48-RC1
(tested with YUV420P8, YUV444P16 and YUV420P16)
I still can't reproduce it. What are you using to view the output?
l00t
21st October 2019, 08:39
VapourSynth Edtior r19
ChaosKing
21st October 2019, 08:46
vsedit r19
import vapoursynth as vs
import mvsfunc as mvf
import havsfunc as haf
core = vs.core
clip = core.std.BlankClip(width=200,height=100, format=vs.YUV420P8)
sm=haf.SMDegrain(clip, contrasharp=True) # havsfunc from master
clip=core.std.StackHorizontal([clip.text.Text("blank"), sm.text.Text("smdegrain +\ncontrasharp \ncpu default/not set")])
vs.core.std.SetMaxCPU("none")
clip2 = core.std.BlankClip(width=200,height=100, format=vs.YUV420P8)
sm=haf.SMDegrain(clip2, contrasharp=True) # havsfunc from master
clip2=core.std.StackHorizontal([clip2.text.Text("blank"), sm.text.Text("smdegrain +\ncontrasharp cpu none")])
c=core.std.StackVertical([clip, clip2])
vs.core.std.SetMaxCPU("sse2")
clip3 = core.std.BlankClip(width=200,height=100, format=vs.YUV420P16) #16!
sm=haf.SMDegrain(clip3, contrasharp=True) # havsfunc from master
clip3=core.std.StackHorizontal([clip3.text.Text("blank"), sm.text.Text("smdeg + contrasharp \ncpu sse2 16bit")])
c=core.std.StackVertical([c, mvf.Depth(clip3, 8)])
c.set_output()
https://i.imgur.com/ybD5pyT.png
Myrsloik
21st October 2019, 08:58
Nice, that manages to reproduce the green stripes. Oddly enough the pink border doesn't happen on my system.
ChaosKing
21st October 2019, 09:19
And if it helps. The problem is produced somewhere in contrahsrapening and not smdegrain: https://github.com/HomeOfVapourSynthEvolution/havsfunc/blob/master/havsfunc.py#L5406
It's a short script and the pink border still happens if you remove miniblur.
When I remove the only Expr line, the stripes disappear but the pink border is still there. Border could be Repair or MakeDiff. Will test later more.
EDIT
should this produce a pink image?
clip = core.std.BlankClip(width=200,height=100, format=vs.YUV420P8)
matrix1 = [1, 2, 1, 2, 4, 2, 1, 2, 1]
con = core.std.Convolution(clip, matrix=matrix1)
clip=core.std.MakeDiff(clip, con)
EDIT2
mode=0 -> green image. So I guess the pink border comes from MakeDiff.
https://i.imgur.com/5oXvbKc.png
EDIT3
This is how it looks in R47
https://i.imgur.com/QqzGMJG.png
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.