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. |
7th October 2013, 10:11 | #121 | Link |
Oz of the zOo
Join Date: May 2005
Posts: 208
|
The simpler the better. I like Gavino's with even less 'noise': for var = init, limit, step { .... } #step could be negative.
Recursion is not human readable. Making dlls isn't worth the effort in simple cases. Using vapoursynth isn't always an option. And there's nothing wrong to have a small set of simple human readable block statements in avisynth-plus. Also, this topic was discussed like a thousand times. |
7th October 2013, 10:24 | #122 | Link | |
Registered User
Join Date: May 2008
Posts: 40
|
Quote:
Anyway, I'd go with the C style for (and no while, for already covers it). I find the readability of Gavino's one a bit of a problem (if you don't use named parameters), and while his solution is a lot more in line with Avisynth synthax I still prefer having full statements. Last edited by Sapo84; 7th October 2013 at 10:40. |
|
7th October 2013, 10:27 | #123 | Link |
Registered User
Join Date: Dec 2007
Location: Enschede, NL
Posts: 302
|
+1 for C-style
__________________
Roelofs Coaching |
7th October 2013, 10:38 | #124 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,433
|
Quote:
I made limit and step fixed as I felt they are the parameters that define the loop. Anything more complex can be programmed as a while loop. |
|
7th October 2013, 10:53 | #125 | Link |
Registered User
Join Date: Jan 2010
Posts: 270
|
I'm not sure for loop is required either, maybe because I haven't seen a single useful example of it used in gscript, that couldn't be rewritten with recursion with maybe a bit more effort. If anyone could provide such an example (preferably used in a real working commonly-used script), I would be grateful.
That said, if you feel like adding features to the language just to simplify a little more than zero scripts - sure, go ahead. It's not like it will make the language worse. I don't have any particular opinion on which version is better, they are both fine. Efficiency should be pretty much identical because after building the filter graph it's all the same. |
7th October 2013, 11:01 | #126 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,433
|
Quote:
Its purpose is to avoid that 'bit more effort' for the majority of script writers. |
|
7th October 2013, 11:15 | #127 | Link |
Registered User
Join Date: Jan 2010
Posts: 270
|
Gavino, I understand and I would fully agree with you in an ideal situation. I just think it would be better to check if the actual demand is high enough (with examples) rather than simply adding features that "would be cool to have". It's never late to add the feature but it will be really hard to remove it. Just look at C++ right now.
|
7th October 2013, 11:30 | #128 | Link |
AVS+ Dev
Join Date: Aug 2013
Posts: 359
|
I myself find the new block-if the most useful, but the looping constructs are useful too. Please don't turn this discussion into whether to have looping constructs at all or not. The fact that previously loops have been emulated using recursion proves that loops are needed and sought after in Avisynth. Especially in a language that is designed to be simple to write and simple to interpret by humans, "for" or "while" can mean a lot, because they are way easier to program and read than even the simplest form of recursion.
So there will be ifs, fors and whiles (and admittedly I'll also see if I can hack a "break" statement into the language). If you are more comfortable with recursion, you can still keep using it. Now please, let's get back to the question at hand and let's vote which "for" variant you'd prefer. Edit: I understand that none of these new constructs are technically needed, as the same effect can be achieved using other methods. However, those methods make scripts harder to write and to read. These new constructs are improvements, and improving the existing functionality of Avisynth is the goal of Avisynth+ after all. Last edited by ultim; 7th October 2013 at 12:04. |
7th October 2013, 12:03 | #129 | Link | |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,445
|
Quote:
I'm looking at it more from the perspective of growth toward other machine architectures - having an unoptimized version maximizes portability. Sure, there could be wholesale additions for NEON or AltiVec or SHmedia or whatever else, but that'd still have to be a case-by-case basis. |
|
7th October 2013, 14:28 | #131 | Link | ||||||||
Registered User
Join Date: Nov 2001
Posts: 291
|
Quote:
Quote:
easier for script writers the better, to make more human readable avisynth language is something to add to a TODO list, avisynth is far to be intuitive or friendly for normal user. Gavino's work is in that direction, nor more nor less.(My opinion, never interchanged views with him) I see you have already decided to conform everybody including both and something else, luckly you have the energy and skills for everything. Thanks again. Quote:
Quote:
Quote:
that I don't define with precision, so I left opened to a research, study or discussion. Quote:
Quote:
And is also portable, probably to more platforms. Obviously you have to work under and enviroment that can use Nasm. Asm code can be non optimal of course. I was thinking about the task of moving out inline code you already have in built in filters nowadays, optimal or not, while preserving many mmx and Isse code. There are some Isse codes that are well optimized in avisynth and it is very difficult to get a SSE2 or higer version to work better, mainly when you have to work with misaligned ptrs. Quote:
All these are just some quick ideas, I see you are working hard with other issues, more immediate needs and improvements so we can leave all this discussion for future. Thanks for all the work you are doing, and keep on. |
||||||||
7th October 2013, 18:47 | #133 | Link | ||
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Quote:
Quote:
Other redundant functions that should be removed: ShowFiveVersions - exactly equivalent to StackHorizontal with five arguments. Why? MonoToStereo - has been explicitly deprecated since 2.5 and replaced by MergeChannels Pulldown - it's SelectEvery with the cycle forced to 5, use that instead SwapFields - the documentation explicitly says it's just an alias for SeparateFields().ComplementParity().Weave() Last edited by TheFluff; 7th October 2013 at 19:06. |
||
7th October 2013, 20:02 | #134 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,581
|
I have one comment to make about the inline assembler/softwire/mess that is in avisynth. Most of it is of a horribly low quality.
Replacing it with proper C++ code probably wouldn't slow it down that much. You also need a proper C++ code path just to test that the assembler you wrote is correct anyway. But that's something no other posters seem to take into consideration. Anyway, interesting to see some kind of development going on.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
8th October 2013, 08:22 | #135 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,369
|
Being a big user of pulldown, i personnaly prefer to keep it. Some are like macro in C. When something can be used very often, it's nice to have a more compact syntax. I prefer writing PullDown(0,2) than SelectEvery(5,0,2).AssumeFrameBased.
Even if i don't use it, showfiveversion has the same purpose. They are like macro in C, made to simplify syntax of something which may be used very often. Seriously, i prefer SwapField, name is explicit, syntax is simple, than SeparateFields().ComplementParity().Weave() ! Think of someone who simply want to swap fields... Good luck guessing SeparateFields().ComplementParity().Weave() when you don't have the "swapfield" function !! Same for pulldown. Personnaly, i think these shouldn't be removed. Last edited by jpsdr; 8th October 2013 at 08:30. |
8th October 2013, 11:47 | #137 | Link |
AVS+ Dev
Join Date: Aug 2013
Posts: 359
|
I'm not sure putting them into .avsi scripts is how much better then being included in the core native filters. Even if in the core, we can cleanly separate them out into their own filters/shortcuts.cpp file (or whatever the name) to not pollute the main filters. But putting them into a separate script incurs a needless startup cost (the'd be autoloaded anyway, but now they'd need to be separately loaded, parsed and evaluated).
|
8th October 2013, 11:59 | #138 | Link |
Registered User
Join Date: Jan 2010
Posts: 270
|
ultim
I'm not saying they should be definitely separated, just stating that the issue can be solved without any real affect on the user. I think both solutions are fine: the cost of loading a single avsi is not that high, but having them in a separate cpp file would not be bad either, especially since most of them can be implemented in one-two lines. |
9th October 2013, 11:12 | #139 | Link |
Registered User
Join Date: Jan 2010
Posts: 270
|
While we're at the question of removing stuff: is there any reason TemporalSoften's mode 1 still exists?
Documentation says mode 2 "has a new and better way of blending frame and provides better quality. It is also much faster." and it looks to me almost everyone is using it anyway, so why keeping it at all? |
9th October 2013, 14:13 | #140 | Link |
AVS+ Dev
Join Date: Aug 2013
Posts: 359
|
Avisynth Plugin Writing Tips #1: Exceptions
Exceptions thrown from a module should only be caught in the same module. Otherwise you can experience weird and hard-to-debug errors in the plugin. Not adhering to this advice will result in code that can sporadically fail, or work on your computer consistently but fail on other machines. Unfortunately, avisynth.h contains the AvisynthError class, giving plugin authors the false impression that it is safe to throw and catch these exception objects. It is not. The problem is not in the definition of this class, but in the implicit encouragement to throw C++ exceptions across DLL boundaries. Here are some tips to avoid getting caught in the deepest pits of hell: - When throwing exceptions on your own, it is best not to use AvisynthError. Not using it will stop you thinking that AvisynthError has some special meaning, or that it can be used to throw to (or to catch from) avisynth.dll. - Exceptions thrown by you should always be caught inside your plugin. You should not let exceptions propagate outside of your DLL (unless thrown using ThrowError), to Avisynth. - Errors thrown by Avisynth should not be caught by you. In specific, don't wrap calls to Avisynth in try-catch blocks, because you cannot rely on it working correctly in every situation. If you need to detect errors, validate user parameters in your plugin, or use other API facilities provided by Avisynth, like IScriptEnvironment->FunctionExists(). - If you want to throw an exception to the user and/or to Avisynth, then only use IScriptEnvironment->ThrowError(). You should not call C++'s "throw" yourself for this purpose (see 2. point), and you should not catch the error thrown by ThrowError() yourself (see 3. point). - If you want to catch an exception, want to do something based on that and finally raise an exception to Avisynth, don't rethrow. Catch your own exception (unless thrown by ThrowError), then call ThrowError separately. Ignoring the above tips can still result in a fully working binary, but that is only guaranteed under very specific circumstances, more specifically when you've compiled your plugin with the *exact* same compiler version as the avisynth.dll was compiled with, AND when linking to the CRT runtime dynamically. Given that plugin authors can use whatever compiler they want, and that an avisynth binary can be supplied by any community member, it is unwise to rely on such detail. These tips apply to all Avisynth versions (e.g. to 2.5 and to 2.6, to "classic" Avisynth and to Avisynth+, etc). Last edited by ultim; 25th October 2013 at 21:18. |
Thread Tools | Search this Thread |
Display Modes | |
|
|