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. |
![]() |
#1181 | Link | |
Registered User
Join Date: Jan 2014
Posts: 2,275
|
Quote:
|
|
![]() |
![]() |
![]() |
#1185 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,337
|
Thanks for the update!
Is a sort operator possible? I found myself the last days fighting with implementing some median algos (removegrain modes 2-4). I know I can't compete in speed but for completion in ExTools this is probably the last function I'm adding. Tired to do permutations to no avail I searched some maths and found Sorting Networks, this is also proving hard to achieve with current Expr in-string tools. Pseudo-code for 8 inputs (swap here means variable swap, 0 as nop sub) Code:
A C < A C swap 0 ? B D < B D swap 0 ? E G < E G swap 0 ? F H < F H swap 0 ? A E < A E swap 0 ? B F < B F swap 0 ? C G < C G swap 0 ? D H < D H swap 0 ? A B < A B swap 0 ? C D < C D swap 0 ? E F < E F swap 0 ? G H < G H swap 0 ? C E < C E swap 0 ? D F < D F swap 0 ? B E < B E swap 0 ? D G < D G swap 0 ? B C < B C swap 0 ? D E < D E swap 0 ? F G < F G swap 0 ? I also found myself occasionally wanting to do the next: Code:
"x y * sqrt A^ A[-1,0] B^ A[0,0] C^ ...."
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread |
![]() |
![]() |
![]() |
#1186 | Link | |
Registered User
Join Date: Jan 2014
Posts: 2,275
|
Quote:
For example here: Median of 3 https://github.com/pinterf/MedianBlu...r_sse2.cpp#L81 Median of 5 https://github.com/pinterf/MedianBlu..._sse2.cpp#L155 For these magnitudes (3, 5) they are not even complex ones and can be written specifically. For larger radius we probably need a generic implementation with sorting but then Expr would starting to become an enormously complex filter (embedded MedianBlur ![]() Generic sorting algorithms are available for avx2 and avx512, (search for "avx2 avx512 simd sorting"); I can say that there are really nice solutions, but they are beyond my mental limits ![]() |
|
![]() |
![]() |
![]() |
#1188 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,531
|
Why are you not using real compilers at this point? WHY?
I mean even modern javascript engines will probably run better with that number of variables and have cleaner syntax. Obviously the solution is to implement a secondary stack where you can push and pop overflow values. As a solution to the number of addressable input clips use stackvertical to get around it. WE DON'T NEED NO STINKING COMPILERS!
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
![]() |
![]() |
![]() |
#1189 | Link | |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,478
|
Quote:
Code:
(A C <) - 0 or 1 C A 0 Code:
A C < A C ? A C < C A ? This isn't great because of the two comparisons. You could always store the first result into a variable: Code:
A C < R@ A C ? R C A ? Code:
A C < A C ? dup A C + - Code:
A C min A C max Thank you for listening to my TED Talk. |
|
![]() |
![]() |
![]() |
#1190 | Link |
Registered User
Join Date: Nov 2009
Posts: 2,337
|
wonkey_monkey: nice TED hehe. I was going with the new var assignment starting from Z, and then thought what a sudoku I would end playing so asked for AA kind of vars. I will go with the most efficient method, ternaries are costly so min max probably. I'm not sure it might work but will test. Hopefully I can build a nice median and repair library as I did with ex_edge().
Myrsloik: It's just too much for me... and my 2013 SSD. I'm art oriented so my knowledge and disk space goes to DCC (3D, compo, video) and audio software mostly (no games). I fear that getting into nitty gritty programming can derail me too much, or simply make either my brain or SSD explode. I only do basic scripting in AVS, AHK and Python, some regex in there too and very basic GLSL. Will look forward how Expr evolves.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread |
![]() |
![]() |
![]() |
#1191 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,275
|
New version
Avisynth+ 3.7.1 test build 9 (20210706) Code:
- Expr: allow arbitrary variable names (instead of A..Z), up to 256 variables can be used. Do not use existing keywords. Variable names must start with '_' or alpha, continued with '_' or alphanumeric characters. |
![]() |
![]() |
![]() |
#1194 | Link | |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
Quote:
to describe a 3x3 gauss blur filter, you have in Expr: "x[-1, -1] x[-1, 0] 2 * + x[-1, 1] + x[0, -1] 2 * + x 4 * + x[0, 1] 2 * + x[1, -1] + x[1, 0] 2 * + x[1, 1] + 16 /" meanwhile to describe the same thing in C++: https://github.com/IFeelBloated/vapo...ssBlur.hxx#L22 you tell me which one is easier to write and to understand. a temporal median filter that works for any temporal radius is also no more than a few lines in C++. but in this case, you can't even describe it (by ab)using Expr. it's year 2021 and things have changed, drastically. writing a C++ plugin is scripting (given that it's a simple filter like 3x3 conv or temporal median), and C++ is a scripting language, if you will it to. |
|
![]() |
![]() |
![]() |
#1195 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,880
|
As Feisty says, some things are actually easier in C/CPP, and Doggy would make for a good coder. [So would Real.Finder].
The only real difficult bit about learning C is figuring out where to put all them damn semi-colons, after that its no more difficult than AVS script.
__________________
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 ??? |
![]() |
![]() |
![]() |
#1196 | Link |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
davidh*****, I wasn't replying to you. I was replying to Dogway continuing on Myrsloik's point. I suggest that you do not cut in on a conversion not centered around you, and stop acting like you own the place or something. It's a public forum, you do not have the right to stop me from talking just because you don't agree with my opinions.
Last edited by feisty2; 6th July 2021 at 18:37. |
![]() |
![]() |
![]() |
#1197 | Link | |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
now back to your points
Quote:
what I am concerned about is that, if this feature creep Expr gets widely adopted, people would start abusing Expr for things that should be written in a proper programming language (Dogway is already asking for the sort functionality). the consequence of this is that it creates a shit mountain of unreadable and unmaintainable code, because: a) RPN itself is a rather "exotic" language, hard to decipher by human. b) Expr, even with all that feature creep, is still nowhere as expressive as a real programming language, so it is very likely that sometimes there's no direct way to describe what you want using Expr. and people would then "invent" weird tricks to do what they want indirectly, and those "tricks" can be extremely confusing to the reader of the code. |
|
![]() |
![]() |
![]() |
#1198 | Link | ||
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#1199 | Link | |
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
Quote:
Code:
x[-1, -1] x[-1, 0] 2 * + x[-1, 1] + x[0, -1] 2 * + x 4 * + x[0, 1] 2 * + x[1, -1] + x[1, 0] 2 * + x[1, 1] + 16 / Code:
auto GaussKernel = [](auto Center) { auto WeightedSum = Center[-1][-1] + Center[-1][0] * 2 + Center[-1][1] + Center[0][-1] * 2 + Center[0][0] * 4 + Center[0][1] * 2 + Center[1][-1] + Center[1][0] * 2 + Center[1][1]; return WeightedSum / 16; }; Last edited by feisty2; 6th July 2021 at 19:49. |
|
![]() |
![]() |
![]() |
#1200 | Link | ||
I'm Siri
Join Date: Oct 2012
Location: void
Posts: 2,633
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|