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
Register FAQ Calendar Today's Posts Search

Closed Thread
 
Thread Tools Search this Thread Display Modes
Old 14th April 2020, 08:45   #5441  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
So is the code same for getting values from arrays?
_args[idx].IsArray() -> _args[idx].ArraySize() -> _args[idx][i].AsInt()
__________________
Projects
x265 - Yuuki-Asuna-mod Download / GitHub
TS - ADTS AAC Splitter | LATM AAC Splitter | BS4K-ASS
Neo AviSynth+ filters - F3KDB | FFT3D | DFTTest | MiniDeen | Temporal Median
MeteorRain is offline  
Old 14th April 2020, 09:14   #5442  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Yes. But even if parameter definition allows arrays, for length=1 the parameter will appear as a single non-array of a specific value
(covering such cases when parameter list of variable number of elements is only a single integer for example and it is not put into an array, it remains as a single integer AVSValue)

Plus: even is such single values are not IsArray, ArraySize will report 1, and you can access it as [0].

For example here, in ConditionalSelect, args[2] can be an array of clips or a single clip.
https://github.com/pinterf/AviSynthP...ional.cpp#L228

NEW_AVSVALUE considerations:
Arrays in the above form cannot be named parameters, nor can they be provided as the new [] syntax.
Unnamed or named (and even zero sized) array can appear as specific parameter.

With new AVSValue concept arrays can have arbitrary deepness, with mixed type of elements, and are always "deep copy"-ed (except on the plain C interface)

Handling and parameter list
https://github.com/pinterf/AviSynthP...ource.cpp#L419
https://github.com/pinterf/AviSynthP...urce.cpp#L2020

Definition (using specific 'a' as parameter type):
As NEW_AVSVALUE is no in the mainstream Windows build, this option is not really documented other than in my readme_xxx.txt.

Original BlankClip definitions
Code:
"[]c*[length]i[width]i[height]i[pixel_type]s[fps]f[fps_denominator]i[audio_rate]i[stereo]b[sixteen_bit]b[color]i[color_yuv]i[clip]c
 []c*[length]i[width]i[height]i[pixel_type]s[fps]f[fps_denominator]i[audio_rate]i[channels]i[sample_type]s[color]i[color_yuv]i[clip]c
Extra BlankClip definitions, allow calling with e.g. BlankClip(colors = [4095, 12, 2311])
Code:
[]c*[length]i[width]i[height]i[pixel_type]s[fps]f[fps_denominator]i[audio_rate]i[stereo]b[sixteen_bit]b[color]i[color_yuv]i[clip]c[colors]a
[]c*[length]i[width]i[height]i[pixel_type]s[fps]f[fps_denominator]i[audio_rate]i[channels]i[sample_type]s[color]i[color_yuv]i[clip]c[colors]a
pinterf is offline  
Old 14th April 2020, 09:34   #5443  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
I understand that NEW_AVSVALUE is not yet on mainstream Windows, but it is expected to be on Windows at a later time, right?

Regarding to prefix 'a', it doesn't have a type that means it's weak typed, right? So basically I can pass anything in and the filter is responsible for checking the type.

And what happens if I put 'a' in function declaration and filter is loaded by a version not supporting arrays? Do I have to keep 2 DLLs for different AVS version?

And --
Quote:
(covering such cases when parameter list of variable number of elements is only a single integer for example and it is not put into an array, it remains as a single integer AVSValue)
I assume this does not apply to 'a' parameters, right? If I mark a parameter as 'a' and user pass a 1 element array, I should always get IsArray() true, right?
__________________
Projects
x265 - Yuuki-Asuna-mod Download / GitHub
TS - ADTS AAC Splitter | LATM AAC Splitter | BS4K-ASS
Neo AviSynth+ filters - F3KDB | FFT3D | DFTTest | MiniDeen | Temporal Median
MeteorRain is offline  
Old 14th April 2020, 09:46   #5444  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Quote:
Originally Posted by MeteorRain View Post
I understand that NEW_AVSVALUE is not yet on mainstream Windows, but it is expected to be on Windows at a later time, right?

Regarding to prefix 'a', it doesn't have a type that means it's weak typed, right? So basically I can pass anything in and the filter is responsible for checking the type.
Yes, only requirement that it should be an array.

For an 'a' typed parameter parser will allow explicitely defined constant (using [ and ]) or an array typed variable or function return value.

Quote:
Originally Posted by MeteorRain View Post
And what happens if I put 'a' in function declaration and filter is loaded by a version not supporting arrays? Do I have to keep 2 DLLs for different AVS version?
I don't know other that trying it.

Quote:
Originally Posted by MeteorRain View Post
I assume this does not apply to 'a' parameters, right? If I mark a parameter as 'a' and user pass a 1 element array, I should always get IsArray() true, right?
Yes, such parameters can even have zero length (like a = [], I think there are examples on that in the readme)
pinterf is offline  
Old 14th April 2020, 12:00   #5445  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,580
Quote:
Originally Posted by StainlessS View Post
UsedMB=SetMemoryMax() or UsedMB=SetMemoryMax(0) returns the currently used amount, so SetMemoryMax() without assigning to anything is a NOP, well does nothing useful.
It can't be a NOP as it has results on encoding speed usually better than put any value.
__________________
@turment on Telegram
tormento is offline  
Old 14th April 2020, 12:16   #5446  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by MeteorRain View Post
So is the code same for getting values from arrays?
_args[idx].IsArray() -> _args[idx].ArraySize() -> _args[idx][i].AsInt()
this is horrifying, it should be simplified to
Code:
for (auto x : _args[key])
   // do ur thang
feisty2 is offline  
Old 14th April 2020, 12:23   #5447  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
Feisty2, all the API here that we've been talking about would have to maintain enough compatibility all the way back to the date when C++03 was not even a thing.

My wrapper would take and return a std::vector which then should support all the fancy stuff ( for (auto &&item : array_param) ) but then the underlying code -- those doing heavy-lifting, would have to use an interface where technology is much outdated.
__________________
Projects
x265 - Yuuki-Asuna-mod Download / GitHub
TS - ADTS AAC Splitter | LATM AAC Splitter | BS4K-ASS
Neo AviSynth+ filters - F3KDB | FFT3D | DFTTest | MiniDeen | Temporal Median
MeteorRain is offline  
Old 14th April 2020, 12:32   #5448  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
Quote:
Originally Posted by StainlessS View Post
[EDIT: Below how it was, apparently is changed as per later posts]
Arrays cannot be implemented for script so long as Avs+ supports v2.58 dll loading. [ AvisynthPluginInit2() ]
I wonder if avs+ could use some wrapper for AvisynthPluginInit2 to not interfere with avs+ features like HBD and Arrays
__________________
See My Avisynth Stuff
real.finder is offline  
Old 14th April 2020, 12:32   #5449  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
adding begin() and end() doesn't harm compatibility, these are the "magic" functions that automatically enable range-for syntax in c++11 and onwards, in older standards, they are simply regular member functions and do not correspond to any magic syntax.
feisty2 is offline  
Old 14th April 2020, 14:01   #5450  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by tormento View Post
It can't be a NOP as it has results on encoding speed usually better than put any value.
Well it aint supposed to do anything other than return the used value.

Quote:
Originally Posted by real.finder View Post
I wonder if avs+ could use some wrapper for AvisynthPluginInit2 to not interfere with avs+ features like HBD and Arrays
Well I think that the problem was that could not previously support arrays [EDIT: for script] whilst still supporting v2.58 plugins, judging by above posts that problem seems to have been overcome.

https://www.youtube.com/watch?v=PPvRsLWlDXw

Says it all
__________________
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; 14th April 2020 at 14:05.
StainlessS is offline  
Old 14th April 2020, 14:09   #5451  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
This whole story with the arrays was more than 3 years ago. It's time to re-test, next package will come with and without arrays.
pinterf is offline  
Old 14th April 2020, 17:17   #5452  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by tormento View Post
It can't be a NOP as it has results on encoding speed usually better than put any value.
But does it give different results than not using it at all?

Perhaps your results just show that the default value is actually optimal.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline  
Old 15th April 2020, 00:04   #5453  |  Link
real.finder
Registered User
 
Join Date: Jan 2012
Location: Mesopotamia
Posts: 2,587
can someone make fmtconv port for avs+? https://forum.doom9.org/showthread.p...52#post1907352
__________________
See My Avisynth Stuff
real.finder is offline  
Old 15th April 2020, 03:45   #5454  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
Quote:
Originally Posted by pinterf View Post
I don't know other that trying it.
So I tried it. Having 'a' as type, the filter would not be possible to be used on non-AVS-newvalue build.

Checking the avs core I noticed that it's possible to manipulate (i.e. abuse) param name to support array hinting.

For example, dft has this:
c[sstring]s[ssx]s[ssy]s[sst]s.

If we can somehow do:
c[sstring]s[ssx]s[ssy]s[sst]s[sstring()]f[ssx()]f[ssy()]f[sst()]f
then we can make the filter working under both versions.

In legacy version, because param names has () in it, we know it's not a valid name and you can't assign data to it by name. To support assigning values by order, obviously we can keep array declaration at the end of param list.

In modern version, the core now knows that these 4 parameters are array of floats and will accept them as both single string or array of floats. Weak type arrays can be flagged as "[name()]."

So if user writes
v.dfttest("a", "b")
you get [v, "a", "b", -, -] in both versions.

And if user writes
v.dfttest([1.0], [2.0])
you get [v, [1.0], [2.0], -, -] in newer versions.

Within filter, simply check if args[1].isArray() to know if user passed in an array or a string.

What do you think about this proposal?

==========

EDIT: I'm generating parameter hinting like this:

Code:
for (auto &&p : params)
{
  ...
  if (p.IsOptional) {
    ss << '[' << p.Name << ']';
    if (p.IsArray) {
      ss_arrays << '[' << p.Name << "()]" << type_name;
      type_name = 's';
    }
  }
  ss << type_name;
}
return ss.str() + ss_arrays.str();
c[ftype]i[sigma]f[sigma2]f[pmin]f[pmax]f[sbsize]i[smode]i[sosize]i[tbsize]i[tmode]i[tosize]i[swin]i[twin]i
[sbeta]f[tbeta]f[zmean]b[f0beta]f[nlocation]s[alpha]f[slocation]s[ssx]s[ssy]s[sst]s[ssystem]i[sfile]s[sfile2]s
[dither]i[y]i[u]i[v]i[opt]i[nlocation()]i[slocation()]f[ssx()]f[ssy()]f[sst()]f
__________________
Projects
x265 - Yuuki-Asuna-mod Download / GitHub
TS - ADTS AAC Splitter | LATM AAC Splitter | BS4K-ASS
Neo AviSynth+ filters - F3KDB | FFT3D | DFTTest | MiniDeen | Temporal Median

Last edited by MeteorRain; 15th April 2020 at 04:06.
MeteorRain is offline  
Old 15th April 2020, 05:04   #5455  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
Within dfttest, I noticed that, when nstring="0,0,20,40" I get the following error:

Filter error: GetPlaneHeightSubsampling called with supported plane.

Coming from

const int height = proc_height >> vi.GetPlaneHeightSubsampling(b);
const int width = vi_src.width >> vi.GetPlaneWidthSubsampling(b);

where b == 0.
__________________
Projects
x265 - Yuuki-Asuna-mod Download / GitHub
TS - ADTS AAC Splitter | LATM AAC Splitter | BS4K-ASS
Neo AviSynth+ filters - F3KDB | FFT3D | DFTTest | MiniDeen | Temporal Median
MeteorRain is offline  
Old 15th April 2020, 05:32   #5456  |  Link
MeteorRain
結城有紀
 
Join Date: Dec 2003
Location: NJ; OR; Shanghai
Posts: 894
Also within dfttest, threads=0 and threads=1 returns different results, i.e. bit non-identical.
__________________
Projects
x265 - Yuuki-Asuna-mod Download / GitHub
TS - ADTS AAC Splitter | LATM AAC Splitter | BS4K-ASS
Neo AviSynth+ filters - F3KDB | FFT3D | DFTTest | MiniDeen | Temporal Median
MeteorRain is offline  
Old 15th April 2020, 07:41   #5457  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
Quote:
Originally Posted by MeteorRain View Post
Within dfttest, I noticed that, when nstring="0,0,20,40" I get the following error:

Filter error: GetPlaneHeightSubsampling called with supported plane.

Coming from

const int height = proc_height >> vi.GetPlaneHeightSubsampling(b);
const int width = vi_src.width >> vi.GetPlaneWidthSubsampling(b);

where b == 0.
Then it probably never worked. 0,1,2 should be translated to actual PLANAR_Y, PLANAR_U, PLANAR_V constants.
pinterf is offline  
Old 15th April 2020, 08:08   #5458  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,782
Quote:
Originally Posted by tormento View Post
It can't be a NOP as it has results on encoding speed usually better than put any value.
Did you also test not using SetMemoryMax at all (opposing to calling it once, but without a value)?
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline  
Old 15th April 2020, 08:45   #5459  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,314
When your SetMemoryMax parameter is significantly larger than the actual maximum value reported by avsmeter then all results should be identical within an error margin.
Multiple Avsmeter sessions can report fps values within a range. Just have measured a simple script, five runs, no mt, results varied from 6.53 to 6.69. (2,5%)
pinterf is offline  
Old 15th April 2020, 13:53   #5460  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,580
Quote:
Originally Posted by LigH View Post
Did you also test not using SetMemoryMax at all (opposing to calling it once, but without a value)?
Well, now I tried on another, heavier, script and:

SetMemoryMax() 5.83 fps
no SetMemoryMax 5.69 fps

I mean... has with AVS+ and x64 any matter anymore at this point to put SetMemoryMax(xxx)?
__________________
@turment on Telegram
tormento is offline  
Closed Thread


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 09:10.


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