-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert array to arguments, and others issues about array #226
Comments
also: "+" mean "one or more" "*" mean "zero or more" right? Scripts arrays only do "*" ? |
Yes, Script arrays can do only '*': zero or more. Function Average(array a) translates to parameter definition ".*" (zero or more of anything, this is needed for handling an arbitrary length of clip, weight, [clip, weight...] sequence) Inside your script parameter 'a' is an explicite 'array' type, which is a single type - single variable. Arrays in old compatible behaviour are somewhat 'hybrid' ones: arrays are always 'flattened' before recognizing them against a function definition. Array as single variable: [clip1, value] - one variable having two elements inside. Array as a 'flattened' one: Script level keeps 'a' as an array and does not 'flatten' the array content into a non-array parameter sequence. If Average would be written that it checks if its first (and only) parameter is an embedded array then it would work with this syntax. |
yes, I also think that the case there is function that convert arguments (Array as a 'flattened') to single variable in avs+ already called "Array()" I wonder if it possible to add function for opposite case and called UnArray() or another better name? also can script arrays get "+" (one or more) as new "_arrays" like int_arrays to distinguish from "_array" which mean "*" (zero or more)? |
Unfortunately one function can have only one result, In this case we'd need array.size number of results which is impossible. |
I think your proposal, the ..._arrays syntax can be easily implemented, one can poll language lovers about another name, though I don't think they find a much better descriptive name. |
I see, so it's impossible...
good to know, will see what the others will say also, I note that non-array parameters in plugins accept arrays (BM3D and fmtconv both are examples of that), while in scripts it will give error message, it will be good if script function do as plugins behavior |
Yep, similar behaviour would be welcomed. |
here https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/blob/8339115ff736005b9c9f8e60e4ac8718e3a508bc/cpu_source/source_avs.cpp#L461 (note they all not array type) but they work with array https://forum.doom9.org/showpost.php?p=1949485&postcount=64
|
Thanks, I'm just looked into its syntax at http://avisynth.nl/index.php/BM3DCUDA |
with float_array it will be endless loop and then crash since it will use the script function over and over since both dll and script functions not match |
Clearly, you cannot pass [] array of floats to a float "sigma". It will always report "Invalid arguments" error message.
|
IIRC I did try that and it's not work too, the problem is in dll it's literally (clip clip, clip "ref", float "sigma", int "block_step", int "bm_range", int "radius", int "ps_num", int "ps_range", bool "chroma") so any thing different in the script wrapper will give endless loop and then crash edit: I was think you mean "two function call" with same name but with different parameters..., well if the script one different than the dll it will work indeed but that not what I want, I want it with same name... edit of edit: it will not have endless loop and then crash but it will not work, since arrays not undefined so it will still need the ugly way below... the only ugly way that seems work (I didn't test enough though) is https://forum.doom9.org/showpost.php?p=1949856&postcount=70 and maybe after adding "_arrays" ('+': one or more) it can be edit to be less ugly also for fmtconv (also has non-array parameters but accept arrays) I think it will be worst since I plan to porting Dither_resize16nr to fmtc_resamplenr which is not simple function as the wrapper above |
I note another weird thing https://github.com/EleonoreMizo/fmtconv/blob/aece6c775c8e9d244c2564b759f60e62418365b2/src/main-avs.cpp#L42 planes parameter is string but it not show error with fmtc_bitdepth(16,planes=array(3,-128,1)) but it not do what it should so I think the plugins will accept anything if it array right? |
Back to BM3D: I checked the _CPU function signature in the DLL and "sigma" is really a single float, not an array. |
yes, but it work with array BM3D_CPU(sigma=[0.5, 0.0, 0.0]) unlike fmtconv |
seems I misunderstanding fmtconv doc, it's not like BM3D, it's use val "." to use array inside string |
Ok. Then I'll investigate why |
This build is giving error message when an explicite array is passed to a non-array argument. |
thanks, so that mean BM3D need to update to + array now? |
Fixed in |
I will close this, continuation of the discussion #203 (comment) |
is this https://forum.doom9.org/showpost.php?p=1953137&postcount=42 plugin problem or avs+ problem? |
Don't know yet the exact use case, but tried to explain it a bit. |
as said here https://forum.doom9.org/showpost.php?p=1949717&postcount=1258
in this read me there areif I save this https://github.com/pinterf/Average wrapper as Average.avsi
seems I missed something or something is already missing in avs side (way to convert array to arguments maybe?)
The text was updated successfully, but these errors were encountered: