Thread: Avisynth+
View Single Post
Old 19th December 2017, 18:45   #3794  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
New version.
Avisynth Plus r2574

- Finally with an installer (x86/x64 in one package), thanks to Groucho2004. This is the first time I'm providing installer, there can be glitches. One of the installer comes with the current Visual Studio C++ x86 and x64 Redistributables. In theory the VS2017 redistributables superseed and are compatible with the VS2015 one. Please note that original Avisynth documentation and filter SDK is not provided, they are not up to date.

- A fix for MaskHS, reported by sneaker_ger, thanks for the report.

- The other things are mainly Expr related.

There was a bugfix in jit that took some time to understand and caused many grey hairs.
And new "why not" features to have my entertainment as well

The idea for introducing variables came for an earlier test Expr script, in which abs(x-y) was used and computed at least four times. Variables are temporary registers inside an Expr that can be saved, saved and popped from stack and reused many times. A variable is an uppercase letter from A to Z.

The other feature is the pixel-relative addressing. Clip variables can be shifted by (constant) x and y offset.

Both of this two features were found later in davidhorman's great rgba_rpn/y8_rpn filter: https://forum.doom9.org/showthread.php?t=172601

Two other Expr feature idea then was adopted from his filter: 'frameno' and 'time' ('n' and 't' in his version - in Expr lowercase letters are clip references)

Example: Mandelbrot zoomer, syntax rewritten from the above topic
Code:
a="X dup * Y dup * - A + T^ X Y 2 * * B + 2 min Y^ T 2 min X^ "
b=a+a
c=b+b

blankclip(width=960,height=640,length=1600,pixel_type="YUV420P8")

Expr("sxr 3 * 2 - -1.2947627 - 1.01 frameno ^ / -1.2947627 + A@ X^ syr 2 * 1 - 0.4399695 "+\
"- 1.01 frameno ^ / 0.4399695  + B@ Y^ "+c+c+c+c+c+b+a+"X dup * Y dup * + 4 < 0 255 ?","128","128")
Changes since r2544
Code:
# Fix
Fix: MaskHS created inverse mask. Regression after r2173
Fix: jitasm code generation at specific circumstances in Expr filter

# Build
Build: changed avisynth.h, strict C++ conformity with Visual Studio 2017 /permissive- flag

# Other
Installer in two flavours: simple or full (with Microsoft Visual C++ Redistributables)

# New
Expr tweaks:
  - Indexable source clip pixels by relative x,y positions. 
  Syntax: x[a,b] where 
  'x': source clip letter a..z
  'a': horizontal shift. -width < a < width
  'b': vertical shift. -height < b < height
  'a' and 'b' should be constant. e.g.: "x[-1,-1] x[-1,0] x[-1,1] y[0,-10] + + + 4 /"
  When requested pixels come from off-screen the off-screen values are cloned from the appropriate top-bottom-left-right edge.
  Optimized version requires SSSE3 (and no AVX2 version is available). On non-SSSE3 CPUs falls back to C.
  
  - sin cos tan asin acos atan (no SSE2/AVX2 optimization, when they appear in Expr a slower C code runs the expression)
  
  - % (modulo). result = x - trunc(x/d)*d. 
  Note: internally everything is calculated as a 32 bit float. 
  A float can only hold a 24 bit integer number, don't expect 32 bit accuracy here.
  
  - Variables: uppercase letters A..Z for storing and reuse temporary results, frequently used computations.
  Store, result can still be used from stack: A@ .. Z@ 
  Store and remove from stack: A^ .. Z^
  Use: A..Z
  Example: "x y - A^ x y 0.5 + + B^ A B / C@ x +"
  
  - 'frameno' : use current frame number in expression. 0 <= frameno < clip_frame_count
  
  - 'time' : calculation: time = frameno/clip_frame_count. Use relative time position in expression. 0 <= time < frameno/clip_frame_count
  
  - 'width', 'height': currently processed plane width and height
pinterf is offline