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 9th November 2017, 01:00   #3721  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
But important, when following StainlessS' form: Do not use "return" before "Prefetch". In case you do, the "return" statement is "the end of the script", not the last character.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline  
Old 9th November 2017, 01:05   #3722  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by LigH View Post
But important, when following StainlessS' form: Do not use "return" before "Prefetch". In case you do, the "return" statement is "the end of the script", not the last character.
Are you saying that
Code:
return Last.Prefetch(4)
is equivalent to [EDIT: of course it dont work]
Code:
return 
Last.Prefetch(4)
???

EDIT: OK, I think I get what you mean, simlar to John's earlier not working script.

Use eg

Code:
return output.Prefetch(4)
OR
Code:
output.Prefetch(4)
at the end of script (where no further parsing will occur on subsequent lines).
__________________
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; 9th November 2017 at 01:20.
StainlessS is offline  
Old 9th November 2017, 01:19   #3723  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
No, it would be equivalent to:

Code:
last = last.Prefetch(4)
return last
With "before", I mean "at least one line above, one linebreak in between"; "return" in the same line, just in front of the Prefetch result, would work.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; 9th November 2017 at 01:21.
LigH is offline  
Old 9th November 2017, 01:22   #3724  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
OK, but both of my last two above code blocks would work, yes ?

EDIT: or that below will NOT work as planned.
Code:
return output.Prefetch(4)
EDIT: OK, thank you sir.
__________________
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; 9th November 2017 at 01:31.
StainlessS is offline  
Old 9th November 2017, 08:49   #3725  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
Using a variable "output" only works if you actually assigned the currently filtered clip to this clip variable; it is not an existing global symbol (but "last" is).
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline  
Old 9th November 2017, 09:22   #3726  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
A short question.
Lately moved to Visual Studio 2017.
Now Avisynth+ is built with v141_xp toolset instead of v140_xp (VS 2015).

I have put it to an xp virtual machine, which did not have Microsoft Visual C++ Redistributable for Visual Studio 2017.
I expected that it would crash with a nice exception but it was running instead. What function call should I use that would crash this vs2017-built dll with no new redistributables?
pinterf is offline  
Old 9th November 2017, 09:46   #3727  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by pinterf View Post
What function call should I use that would crash this vs2017-built dll with no new redistributables?
No idea. Have you read through this (paragraph "Standard Library improvements")? You might also want to look at this.
__________________
Groucho's Avisynth Stuff
Groucho2004 is offline  
Old 9th November 2017, 10:44   #3728  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
Quote:
Originally Posted by Groucho2004 View Post
No idea. Have you read through this (paragraph "Standard Library improvements")? You might also want to look at this.
Thanks. I reached here:
C++ Binary Compatibility between Visual Studio 2015 and Visual Studio 2017
It says that in our case they are compatible, because the major number is to the toolsets (v140, v141) is 14.
(Does it mean that for a freshly installed system, it's enough to have the VS2017 redistributables for our old dlls that would need VS2015 redist in the past?)
pinterf is offline  
Old 9th November 2017, 10:50   #3729  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by pinterf View Post
Thanks. I reached here:
C++ Binary Compatibility between Visual Studio 2015 and Visual Studio 2017
It says that in our case they are compatible, because the major number is to the toolsets (v140, v141) is 14.
(Does it mean that for a freshly installed system, it's enough to have the VS2017 redistributables for our old dlls that would need VS2015 redist in the past?)
Yes, if you look at installed programs the 2017 runtime actually replaces the 2015 one
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline  
Old 13th November 2017, 12:33   #3730  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
since there are many plugins dll's that didn't port to x64 including the closed source plugins, is there some ways to make the 32 bit one work in 64 processes? I note this http://www.dllwrapper.com/ but couldn't build wrapped dll successfully, and even if I did, it will work one day only (need to buy it)
__________________
See My Avisynth Stuff
real.finder is offline  
Old 13th November 2017, 12:53   #3731  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
I guess it might be possible in a separate 32-bit sub process (with a "bridge" EXE in between), but that would probably be quite inefficient, possibly requiring frame data to be piped (like the avs2yuv or avs4x26x bridges do).

Could you name any "priceless" plugins you know some users can't live without?
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline  
Old 13th November 2017, 13:06   #3732  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by LigH View Post
I guess it might be possible in a separate 32-bit sub process (with a "bridge" EXE in between), but that would probably be quite inefficient, possibly requiring frame data to be piped (like the avs2yuv or avs4x26x bridges do).

Could you name any "priceless" plugins you know some users can't live without?
I think that dllwrapper use bridge EXE for that

about the "priceless" plugins, it depend on the source you work with it, but there are many, mostly used in avsi script functions
__________________
See My Avisynth Stuff
real.finder is offline  
Old 13th November 2017, 13:50   #3733  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,100
People keep saying that but they never cite any actual examples. If you actually say what you want maybe someone will actually modernize it!
TheFluff is offline  
Old 13th November 2017, 15:15   #3734  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,753
Somehow I think about "glorified anime miracle scripts" right now...
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline  
Old 13th November 2017, 15:31   #3735  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
ok then, like removedirt, deen, TBilateral, removegrainT, LGhost

edit: and AVSInpaint (for FillBorders() in Stabilization Tools Pack by Dogway)
__________________
See My Avisynth Stuff

Last edited by real.finder; 13th November 2017 at 18:10.
real.finder is offline  
Old 13th November 2017, 20:07   #3736  |  Link
Yanak
Registered User
 
Join Date: Oct 2011
Posts: 275
Quote:
Originally Posted by real.finder View Post
ok then, like removedirt, deen, TBilateral, removegrainT, LGhost

edit: and AVSInpaint (for FillBorders() in Stabilization Tools Pack by Dogway)
AvsInpaint.dll used also with InpaintFunc.avs which is the logo remover i get best results with, many Vdub Plugins not natively supported in x64 too, hopefully MP_Pipeline exists and can run some parts of a .avs in win32 mode + some good souls managed to port some other very nice plugins on x64 recently.

This said i gave up on many x86 plug-ins that looked interesting on the paper for some specific tasks i had to do and needed a solution for but did not bothered with long processing and headache of not being able to pass some variables from one process mode to the other and in the end found other ways to do what i needed using other tools outside avisytnh or simply gave up on those projects.

Being able to run natively and more smoothly some x86 stuff like MP_Pipeline allows it will be a dream, but i keep this as a dream

Last edited by Yanak; 1st December 2017 at 13:16.
Yanak is offline  
Old 13th November 2017, 20:36   #3737  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by Yanak View Post
AvsInpaint.dll used also with InpaintFunc.avs which is the logo remover i get best results with, many Vdub Plugins not natively supported in x64 too, hopefully MP_Pipeline exists and can run some parts of a in win32 mode + some good souls managed to port some other very nice plugins on x64 recently.

This said i gave up on many x86 plug-ins that looked interesting on the paper for some specific tasks i had to do and needed a solution for but did not bothered with long processing and headache of not being able to pass some variables from one process mode to the other and in the end found other ways to do what i needed using other tools outside avisytnh or simply gave up on those projects.

Being able to run natively and more smoothly some x86 stuff like MP_Pipeline allows it will be a dream, but i keep this as a dream
mpp is good but it's complicated for some people, has some limit like you can't use """ """ and you can't use some avs+ Features in it, no audio support, and has some overhead ofc

and aside from mpp downside, if there are one plugin that lacking x64 port in some function then you have to use the x86 just for it!
__________________
See My Avisynth Stuff
real.finder is offline  
Old 14th November 2017, 16:19   #3738  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
All good things must come to an end: now I stopped optimizing Expr so have fun with this release.

This version - along with fixing some annoying bugs - features the Expr filter, which was ported from the Vapoursynth project. Although it was ported in one day, tweaking it further took a _lot_ more time and of course, a good entertainment.

Download Avisynth+ r2542 (20171114)

Questions, testing are welcome.

Please read the "readme.txt" for details about Expr, until the documentation appears in the avisynth webpage.

Code:
# Avisynth+ r2542 (20171114)

## Fixes
  - Fix: RGB (full scale) conversion: 10-16 bits to 8 bits rounding issue; pic got darker in repeated 16<->8 bit conversion chain
  - Fix: ConvertToY: remove unnecessary clamp for Planar RGB 32 bit float
  - Fix: RGB ConvertToY when rec601, rec709 (limited range) matrix. Regression since r2266

## modification, additions  
  - Add: Expr filter
  - Add: Levels: 32 bit float format support
  - Optimized: Faster RGB (full scale) 10-16 bits to 8 bits conversion when dithering
  - Other: Default frame alignment is 64 bytes (was: 32 bytes). (independently of AVX512 support)
  - Built with Visual Studio 2017, v141_xp toolset
  - some fixes in avisynth_c.h (C interface header file)
  - experimental x64 build with size_t frame offsets for testing more properly written C interfaces
edit: quick info about Expr (from readme):
Code:
  Expr filter

  Syntax ("c+s+[format]s[optAvx2]b[optSingleMode]b[optSSE2]b")
  clip Expr(clip c[,clip c2, ...], string expr [, string expr2[, string expr3[, string expr4]]] [, string format]
      [, bool optSSE2][, bool optAVX2][, bool optSingleMode])

  Clip and Expr parameters are unnamed
  'format' overrides the output video format
  'optSSE2' to disable simd optimizations (use C code)
  'optAVX2' to disable AVX2 optimizations (use SSE2 code)
  'optSingleMode' default false, to generate simd instructions for one XMM/YMM wide data instead of two. Experimental.
     One simd cycle processes 8 pixels (SSE2) or 16 pixels (AVX2) at a time by using two XMM/YMM registers as working set.
     Very-very complex expressions would use too many XMM/YMM registers which are then "swapped" to memory slots, that can be slow.
     Using optSingleMode = true may result in using less registers with no need for swapping them to memory slots.

  Expr accepts 1 to 26 clips as inputs and up to four expression strings, an optional video format overrider, and some debug parameters.
  Output video format is inherited from the first clip, when no format override.
  All clips have to match their dimensions and plane subsamplings.

  Expressions are evaluated on each plane, Y, U, V (and A) or R, G, B (,A).
  When an expression string is not specified, the previous expression is used for that plane. Except for plane A (alpha) which is copied by default.
  When an expression is an empty string ("") then the relevant plane will be copied (if the output clip bit depth is similar).
  When an expression is a single clip reference letter ("x") and the source/target bit depth is similar, then the relevant plane will be copied.
  When an expression is constant, then the relevant plane will be filled with an optimized memory fill method.
  Expressions are written in Reverse Polish Notation (RPN).

  Expressions use 32 bit float precision internally
 
  For 8..16 bit formats output is rounded and clamped from the internal 32 bit float representation to valid 8, 10, ... 16 bits range.
  32 bit float output is not clamped at all.
  
  - Clips: letters x, y, z, a, ... w. x is the first clip parameter, y is the second one, etc.
  - Math: * / + -
  - Math constant: pi
  - Functions: min, max, sqrt, abs, neg, exp, log, pow ^ (synonyms: "pow" and "^")
  - Logical: > < = >= <= and or xor not == & | != (synonyms: "==" and "=", "&" and "and", "|" and "or")
  - Ternary operator: ?
  - Duplicate stack: dup, dupN (dup1, dup2, ...)
  - Swap stack elements: swap, swapN (swap1, swap2, ...)
  - Scale by bit shift: scaleb (operand is treated as being a number in 8 bit range unless i8..i16 or f32 is specified)
  - Scale by full scale stretch: scalef (operand is treated as being a number in 8 bit range unless i8..i16 or f32 is specified)
  - Bit-depth aware constants
    ymin, ymax (ymin_a .. ymin_z for individual clips) - the usual luma limits (16..235 or scaled equivalents)
    cmin, cmax (cmin_a .. cmin_z) - chroma limits (16..240 or scaled equivalents)
    range_half (range_half_a .. range_half_z) - half of the range, (128 or scaled equivalents)
    range_size, range_half, range_max (range_size_a .. range_size_z , etc..)
  - Keywords for modifying base bit depth for scaleb and scalef: i8, i10, i12, i14, i16, f32
  - Spatial input variables in expr syntax:
    sx, sy (absolute x and y coordinates, 0 to width-1 and 0 to height-1)
    sxr, syr (relative x and y coordinates, from 0 to 1.0)

  Additions and differences to VS r39 version:
  ------------------------------
  (similar features to the masktools mt_lut family syntax)

  Aliases:
    introduced "^", "==", "&", "|" 
  New operator: != (not equal)
  Built-in constants
    ymin, ymax (ymin_a .. ymin_z for individual clips) - the usual luma limits (16..235 or scaled equivalents)
    cmin, cmax (cmin_a .. cmin_z) - chroma limits (16..240 or scaled equivalents)
    range_half (range_half_a .. range_half_z) - half of the range, (128 or scaled equivalents)
    range_size, range_half, range_max (range_size_a .. range_size_z , etc..)
  Autoscale helper functions (operand is treated as being a number in 8 bit range unless i8..i16 or f32 is specified)
    scaleb (scale by bit shift - mul or div by 2, 4, 6, 8...)
    scalef (scale by stretch full scale - mul or div by source_max/target_max
  Keywords for modifying base bit depth for scaleb and scalef
: i8, i10, i12, i14, i16, f32
  Built-in math constant
    pi
  Alpha plane handling. When no separate expression is supplied for alpha, plane is copied instead of reusing last expression parameter.
  Proper clamping when storing 10, 12 or 14 bit outputs
  (Faster storing of results for 8 and 10-16 bit outputs, fixed in VS r40)
  16 pixels/cycle instead of 8 when avx2, with fallback to 8-pixel case on the right edge. Thus no need for 64 byte alignment for 32 bit float.
  (Load zeros for nonvisible pixels, when simd block size goes beyond image width, to prevent garbage input for simd calculation)

  Optimizations for pow: x^0.5 is sqrt, ^2, ^3, ^4 is done by faster and more precise multiplication
  Spatial input variables in expr syntax:
    sx, sy (absolute x and y coordinates, 0 to width-1 and 0 to height-1)
    sxr, syr (relative x and y coordinates, from 0 to 1.0)
  Optimize: recognize constant plane expression: use fast memset instead of generic simd process. Approx. 3-4x (32 bits) to 10-12x (8 bits) speedup
  Optimize: Recognize single clip letter in expression: use fast plane copy (BitBlt) 
    (e.g. for 8-16 bits: instead of load-convert_to_float-clamp-convert_to_int-store). Approx. 1.4x (32 bits), 3x (16 bits), 8-9x (8 bits) speedup
  Optimize: do not call GetFrame for input clips that are not referenced or plane-copied
  Recognize constant expression: use fast memset instead of generic simd process. Approx. 3-4x (32 bits) to 10-12x (8 bits) speedup
    Example: Expr(clip,"128","128,"128")
 
Differences from masktools 2.2.10
--------------------------------
  Up to 26 clips are allowed (x,y,z,a,b,...w). Masktools handles only up to 4 clips with its mt_lut, my_lutxy, mt_lutxyz, mt_lutxyza

  - Clips with different bit depths are allowed
  - Works with 32 bit floats instead of 64 bit double internally
  - Less functions (e.g. no bit shifts)
  - No float clamping and float-to-8bit-and-back load/store autoscale magic (yet)
  - Logical 'false' is 0 instead of -1
  - The ymin, ymax, etc built-in constants can have a _X suffix, where X is the corresponding clip designator letter. E.g. cmax_z, range_half_x
  - mt_lutspa-like functionality is available through "sx", "sy", "sxr", "syr"
  - No y= u= v= parameters with negative values for filling plane with constant value, constant expressions are changed into optimized "fill" mode

Sample: 

  Average three clips:
  c = Expr(clip1, clip2, clip3, "x y + z + 3 /") 

  using spatial feature:
  c = Expr(clip1, clip2, clip3, "sxr syr 1 sxr - 1 syr - * * * 4096 scaleb *", "", "")

Last edited by pinterf; 14th November 2017 at 16:30.
pinterf is offline  
Old 14th November 2017, 16:59   #3739  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
About how much faster is avx2 vs sse2 on a modern cpu in your expr version?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline  
Old 14th November 2017, 17:05   #3740  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
thanks pinterf

Quote:
- Clips with different bit depths are allowed
some friend that use vs said that float <- -> int is broken in vs expr, did you note that and fix it?
__________________
See My Avisynth Stuff
real.finder 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 22:19.


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