Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 18th February 2020, 09:20   #5161  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by StainlessS View Post
BlankClip(Width=1024,Height=1024,pixel_type=CS)
BicubicResize(W,H) # Resize: Source image too small for this resize method. Width=1024, Support=2048.

Return Last
[...]
I will definitely kill that error message about "support". Filter property, original and target size, crop size are all involved in the calculation.

Code:
filter_support = support() / min(target_width / crop_width, 1.0)
if (width_original < filter_support) --> error
support() values are
4 - Gaussian, sinc, Spline64, lanczos4
4 (or taps) - Blackman
3 (or taps) - Lanczos
3 - Spline36
2 - Spline16, bicubic
1 - bilinear
pinterf is offline  
Old 18th February 2020, 09:23   #5162  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
This calcs for 2.58, 2.60, and avs+

Code:
Function IsAvs26()           { VersionNumber>=2.6}
Function IsAvsNeo()          { FindStr(VersionString," Neo")!=0}
Function IsAvsPlus()         { FindStr(VersionString,"AviSynth+")!=0||IsAvsNeo}
Function X_YMod(clip c)      { c IsAvsPlus ? (NumComponents==1||IsRGB?1:Height/ExtractU.Height):(IsYV12 ?2:1) } # Y Min crop multiple for Progressive
Function X_XMod(clip c)      { c IsAvsPlus ? (NumComponents==1||IsRGB?1:Width/ExtractU.Width):IsAvs26?(IsYV411?4:IsYUY2||IsYV16||IsYV12?2:1):(IsRGB?1:2)} # X Min crop multiple
Function X_CsXMod(Val CSP)   { (CSP.IsClip)?CSP:(CSP.IsString)?Blankclip(Length=1,Width=16,height=16,Pixel_type=CSP):Assert(False,"X_CsXMod: CSP Clip or Pixel_Type string ONLY") Return X_XMod }
Function X_CsYMod(Val CSP)   { (CSP.IsClip)?CSP:(CSP.IsString)?Blankclip(Length=1,Width=16,height=16,Pixel_type=CSP):Assert(False,"X_CsYMod: CSP Clip or Pixel_Type string ONLY") Return X_YMod }

Function X_MinResize(String Resizer,Val CSP,Bool "Wid",Bool "Src",Int "Taps") { # Minimum required Width or Height, Source or Dest, for Resizer and Colorspace, CSP can be Clip or String eg "RGB32"
    S=Resizer.UCase I=FindStr(S,"RESIZE") S=(I==0) ? S : S.LeftStr(I-1) # Can use eg Resizer either "BiLinearResize or just BiLinear"
    Ix=(S=="POINT")?0:(S=="BILINEAR")?1:(S=="BICUBIC")?2:(S=="SPLINE16")?3:(S=="SPLINE36")?4:(S=="SPLINE64")?5:(S=="GAUSS")?6:(S=="LANCZOS4")?7:(S=="LANCZOS")?8:(S=="BLACKMAN")?9:(S=="SINC")?10:-1
    Assert(0 <= IX <= (IsAvs26?10:9), "X_MinResize: No such Resizer filter (" + S + "Resize)")
    defT=Select(Ix, 0,-1,-2,-2,-3,-4,-4,-4,3,4,4)
    Wid=Default(Wid,True)   # True = Inquire Width, else Height
    Src=Default(Src,True)   # True = Inquire Upscale Src, else DownScale Dest
    Assert(defT>0 || !Taps.Defined,"X_MinResize: "+S+"RESIZE Does not have a Taps arg")
    Taps=(defT>0) ? Default(Taps,defT) : Abs(defT)
    Assert(CSP.IsClip || CSP.IsString,"X_MinResize: CSP clip or Pixel_Type string ONLY")
    Return (Wid) ? (Taps+1) * CSP.X_CsXMod : (IsAvs26) ? (Taps+1) * CSP.X_CsYMod
        \ : (Src) ?  (Taps+1) * 2 : Max((Taps+1)*2,4) # Fix for v2.58 Peculiarities
}
From here:- https://forum.doom9.org/showthread.p...05#post1901605

EDIT:
I do not take into account Dest size when inquiring min Src size, or Src size when inquiring min Dest size, it dont seem to matter, maybe I need more checks.
Also do not take into account src_left, Src_top etc, we assume full src.

EDIT:
Quote:
filter_support = support() / min(target_width / crop_width, 1.0)
if (width_original < filter_support) --> error

# ...

1 - bilinear
If say Bilinear [support=1], and upsizing, so "min(target_width / crop_width, 1.0)" = 1.0, and filter_support = 1.0/1.0 = 1, so error if width_original < 1.0, however,
bilinear always fails unless width_original = 2, ie support + 1. Same with all of the others, and the reason for the "(Taps+1) * CSP.X_CsXMod" type stuff above,
you can substitute support where says Taps above.
Maybe there is some kind of float precision thing going on, where something like width_original < 1.00000000000001 provides error where it is intended not to.
Same happens when downsize, taps + 1 minimum.

Code:
S=1
BlankClip(Length=1,Width=S,Height=S,Pixel_type="RGB32")
Z=2
BiLinearResize(Z,Z)  # Width=1 support = 1 error
EDIT: This looks like it
Code:
ResamplingProgram* ResamplingFunction::GetResamplingProgram(int source_size, double crop_start, double crop_size, int target_size, int bits_per_pixel, IScriptEnvironment2* env)
{
  double filter_scale = double(target_size) / crop_size;
  double filter_step = min(filter_scale, 1.0);
  double filter_support = support() / filter_step;
  int fir_filter_size = int(ceil(filter_support*2));

  ResamplingProgram* program = new ResamplingProgram(fir_filter_size, source_size, target_size, crop_start, crop_size, bits_per_pixel, env);

  // this variable translates such that the image center remains fixed
  double pos;
  double pos_step = crop_size / target_size;

  if (source_size <= filter_support) {
    env->ThrowError("Resize: Source image too small for this resize method. Width=%d, Support=%d", source_size, int(ceil(filter_support)));
  }
Actually <= not <, so support actually means not supported ???
[Actually, I think qyot27 might have said something about < versus <= last time subject came up]
EDIT: Yep, RaffRiff42 and qyot27 both made mention:- https://forum.doom9.org/showthread.p...52#post1836752
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 19th February 2020 at 12:55.
StainlessS is offline  
Old 22nd February 2020, 17:18   #5163  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Made some simple wrapper library for AviSynth and VapourSynth, it was necessary because AviSynth has no C or COM interface...

https://github.com/staxrip/staxrip/t...er/FrameServer

https://github.com/staxrip/staxrip/b...FrameServer.vb

https://github.com/staxrip/staxrip/b...deoRenderer.vb
stax76 is offline  
Old 23rd February 2020, 21:08   #5164  |  Link
gpower2
gMKVExtractGUI author
 
gpower2's Avatar
 
Join Date: Aug 2003
Location: Greece / Thessaloniki
Posts: 251
Quote:
Originally Posted by stax76 View Post
Made some simple wrapper library for AviSynth and VapourSynth, it was necessary because AviSynth has no C or COM interface...

https://github.com/staxrip/staxrip/t...er/FrameServer

https://github.com/staxrip/staxrip/b...FrameServer.vb

https://github.com/staxrip/staxrip/b...deoRenderer.vb
Good job m8!
I was experimenting myself recently on something similar for my C# projects!
gpower2 is offline  
Old 24th February 2020, 01:05   #5165  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
@gpower2

No problem, I've committed a vs text encoding fix today. To convert from VB.NET to C# there is http://converter.telerik.com or if that don't work the jetbrains dotpeek decompiler can be used.

MysteryX has written code to access VapourSynth directly in C#, that would have been an alternative route I could have taken.

https://github.com/mysteryx93?tab=repositories
stax76 is offline  
Old 3rd March 2020, 03:34   #5166  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
AviSynth+ 3.5.0 has been released.

The big, shiny new feature this time around: native support for Linux, macOS, and BSD. Full list of changes:
  • New:
    • New: Native Linux, macOS, and BSD support.
    • New function:
      bool IsVersionOrGreater(int majorVersion, int minorVersion [,int bugfixVersion]) function
      Returns true if the current version is equal or greater than the required one in the parameters.
      The function is checking the current version against the given parameters (similar to a Windows API function)
      e.g. IsVersionOrGreater(3, 4) or IsVersionOrGreater(3, 5, 8)
    • New: "Expr" helpers:
      • Constants "yrange_min", "yrange_half", "yrange_max"
        Unlike the luma/chroma plane adaptive "range_min", "range_half", "range_max" these constants always report the luma (Y) values
      • new parameter: bool clamp_float_UV (default false)
        this parameter affects clamping of chroma planes: chroma is clamped between 0..1.0 instead of -0.5..0.5s
      • "clamp_float" is not ignored (and set to true) when parameter "scale_inputs" auto-scales 32 bit float type pixels
      • New "yscalef" and "yscaleb" keywords similar to "scalef" and "scaleb" but scaling is forced to use rules for Y (non-UV) planes
      • new allowed value "floatUV" for scale_inputs.
        In short: chroma pre-shift by 0.5 for 32 bit float pixels
        Affects the chroma plane expressions of 32 bit float formats.
        Shifts the input up by 0.5 before processing it in the expression, thus values from -0.5..0.5 (zero centered) range are converted to the 0..1 (0.5 centered) one.
        Since the expression result internally has 0..1.0 range, this then is shifted back to the original -0.5..0.5 range. (since 2.2.20)
        Note: predefined constants such as cmin, cmax, range_min, range_max and range_half will be shifted as well, e.g. the expression will see range_half = 0.5
    • These modifications are similar to Masktools2 2.2.20+
    • New: AddBorders, LetterBox: new color_yuv parameter like in BlankClip
  • Fixes:
    • Fix: ConvertBits 32->8 for extremely out of range float pixel values.
      When pixel value in a 32 bit float format video was way out of range and greater than 128 (e.g. instead of 0 to 1.0 for Y plane) then the ConvertBits(8) had artifacts.
    • Fix potential crash on exit or cache shrink (linux/gcc only?)
    • Layer: support RGB24 and RGB48 (internally processed as Planar RGB - lossless pre and post conversion)
    • Fix: RGBP to 444 8-14bit right side artifacts at specific widths
    • Fix: "scalef" and "scaleb" for 32 bit input, when scale_inputs="floatf" produced wrong result
    • Fix: missing rounder in V channel calculation of PlanarRGB->YUV 8-14bits SSE2 code
    • Overlay: show error when Overlay is fed with clips with different bit depths
    • Fix: TemporalSoften possible access violation after SeparateFields (in general: after filters that only change frame pitch)
    • Fix: Shibatch.DLL Access Violation crash when exit when target rate is the same as vi.audio_samples_per_second or audio_samples_per_second is 0
    • Build system: Cmake: use platform toolset "ClangCL" for using built-in Clang support of Visual Studio.
      Since VS2019 v16.4 there is LLVM 9.0 support.
      Use: Tools|Get Tools and Features|Add Individual Components|Compilers, build tools, and runtimes
      [X] C++ Clang compiler for Windows
      [X] C++ Clang-cl for v142 build tools (x64/x86)
      (for LLVM Clang installed separately, please use llvm or LLVM - no change in its usage)
qyot27 is offline  
Old 3rd March 2020, 09:17   #5167  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Lovely and shiny, thanx muchly
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline  
Old 3rd March 2020, 10:34   #5168  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Linux + mac support, nice! So it does not rely on vfw anymore? Are there already tools what supports "native" avs files on linux?

Happy avs filter recompiling
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline  
Old 3rd March 2020, 10:44   #5169  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
It seems like ffmpeg is the only available software that supports avs+ on linux. Probably it's possible to compile avs2yuv/avs2pipemod, but I'm not interested to do so right now.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline  
Old 3rd March 2020, 12:11   #5170  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,883
Introducing Linux and Mac OSX Support is a very important achievement!
Some people (including me) never thought this day was going to happen, but here it is...!
Kudos to all of you, guys!
And as always, it also works like a charm on Windows XP as well! (I just tested it)
FranceBB is offline  
Old 3rd March 2020, 12:47   #5171  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by qyot27 View Post
Nice work.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline  
Old 3rd March 2020, 13:37   #5172  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,493
So is this, not pinterf's, now the Avisynth+?
__________________
My AviSynth filters / I'm the Doctor

Last edited by wonkey_monkey; 3rd March 2020 at 16:14.
wonkey_monkey is online now  
Old 3rd March 2020, 13:43   #5173  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
So was 3.4; development moved back to the original AviSynth/AviSynthPlus git repo last summer.
qyot27 is offline  
Old 3rd March 2020, 14:02   #5174  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,419
Quote:
Originally Posted by ChaosKing View Post
Linux + mac support, nice! So it does not rely on vfw anymore? Are there already tools what supports "native" avs files on linux?

Happy avs filter recompiling
x264 and FFmpeg on Windows have used the C interface for talking to AviSynth.dll directly for ages (x264 = 2009, FFmpeg = 2013). VfW was just a provided interface; on Windows it still is. This does mean that the AviSource/WAVSource/SegmentedFileSource filters don't exist on non-Windows OSes, though.

But yes, a patch exists to be able to use AviSynth+ in FFmpeg on Linux, et al. (https://github.com/qyot27/FFmpeg/commits/avsplus_linux). It getting into FFmpeg upstream is dependent on whether they want a deprecation message to tell people to upgrade from AvxSynth or not (and then delay the actual switch until after the next release of FFmpeg).
qyot27 is offline  
Old 3rd March 2020, 14:41   #5175  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,752
Quote:
Originally Posted by wonkey_monkey View Post
This is this now the Avisynth+, and not pinterf's?
It is our AviSynth+ now
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline  
Old 3rd March 2020, 15:30   #5176  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
qyot27 never gives up , thank you for pushing this through and answering my very basic questions. Supporting multiple platforms is a bit more difficult though. At least for someone (me) who is using linux in every five years for only a day or two. All I can say that Midnight Commander rulez

And a missing thing from the change log (I'll put it on Wiki)

Since on Linux we do not have Windows font rendering engine, as a quick solution a filter named "Text" was created with the same parameters as SubTitle.
"Text" is available on Windows as well.
It is using a simple 10x20 matrix fixed font (planned to have some more), similar to what debug text in some Avisynth external filters are using, but with color and halocolor for outline.
Size and orientations related parameters are simply ignored. SubTitle on linux is simply redirected to this new filter.

Last edited by pinterf; 3rd March 2020 at 17:07. Reason: No "SimpleText" just "Text"
pinterf is offline  
Old 3rd March 2020, 16:32   #5177  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by qyot27 View Post
but why there are no "filesonly" aka portable?
__________________
See My Avisynth Stuff
real.finder is offline  
Old 3rd March 2020, 16:49   #5178  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Quote:
Originally Posted by real.finder View Post
but why there are no "filesonly" aka portable?
You can extract them from Groucho2004's installer using 7zip
https://forum.doom9.org/showthread.php?t=172124
poisondeathray is offline  
Old 3rd March 2020, 16:54   #5179  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
filter named "SimpleText"
Nearly, close but no cigar

Code:
Blankclip(width=120,height=120,Color=$808080)
/*
Text "cs[x]f[y]f[first_frame]i[last_frame]i[font]s[size]f[text_color]i[halo_color]i[align]i[spc]i[lsp]i[font_width]f[font_angle]f[interlaced]b[font_filename]s[utf8]b"
*/

Text("Hello\nWorld",lsp=0,align=5)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 3rd March 2020 at 16:58.
StainlessS is offline  
Old 3rd March 2020, 16:54   #5180  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
pinterf's test version had fixed the errors in this post with the internal avs conversion
https://forum.doom9.org/showthread.php?p=1897686

pinterf test version
https://forum.doom9.org/showthread.php?p=1898860

But using the recent 3.5, r3043 , some differences are back. 12bits again "fixes" it

avsresize/zimg/zlib works using 10bits with either version
poisondeathray is offline  
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:26.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.