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. |
|
|
Thread Tools | Search this Thread | Display Modes |
28th September 2005, 13:10 | #1 | Link |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
Average plug-in : weighted average of any number of clips; fast (500 FPS on 2 clips)
Average, 21 October 2005
Usage is Average(clip, weight, clip, weight, clip, weight, ... ) #YV12 clips For example, a simple average of clips alpha and beta is given by Average(alpha, 0.5, beta, 0.5) And for three clips Average(alpha, 1.0/3, beta, 1.0/3, gamma, 1.0/3) In action: It uses (unoptimised) iSSE if present and otherwise falls back to C. On 720x576 source, the iSSE implementation runs at 500 FPS (2 clips), 270 FPS (4 clips) and 190 FPS (6 clips) on my Pentium 4/2400. (Measured, of course, by AVSTimer.) It is probably best to make sure the weights sum to one; the plug-in will work fine if they don't but the average may not make sense. Audio is always taken from the first clip. This can be used as a temporal average by using arguments like: Alpha.trim(1, 0) #next Alpha Alpha.trim(0, -1) + Alpha #previous With a little script work, this can be combined with the scene detection built into Cel Background to avoid averaging over scene boundaries; I'll explain how if one of the scripters out there is interested. This release was brought to you by the Association for the Prevention of Cruelty to TemporalSoften. Edit: iSSE added -- read next posts. Last edited by mg262; 21st October 2005 at 17:09. |
28th September 2005, 13:57 | #2 | Link | |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Hah!
Idea and realisation: No speed rush for non-64bit Athlons: Quote:
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) Last edited by Didée; 28th September 2005 at 14:06. |
|
28th September 2005, 14:43 | #3 | Link |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
Why, Didée, you know I can't bear to see you unhappy
Since it was unoptimised assembly it was pretty straightforward to change to iSSE -- and for reasons I don't follow it is also four times faster. (Not that I'm complaining! I will analyse it when I have more time.) I assume Athlons can cope with this? In any case, please let me know if it doesn't seem to be working. Also, change for MMX would be pretty straightforward if needed. Now a request for you, Didée: please consider making a filter wish list, for anything you want but especially for simple operations like this one... Edit: the reason it was four times faster was as follows: DVDepisode("1")#.crop(8, 2, -12, -2)average(last,1.0/6,Trim(1,0),1.0/6,Trim(2,0),1.0/6,Trim(3,0),1.0/6,Trim(4,0),1.0/6,Trim(5,0),1.0/6) reduceby2() o= last a=o.Trim(3650, 3650+100) b= o.Trim(4392, 4527) #Bridge c=o.Trim(700, 800) # s4(a.Subtitle("A"),b.Subtitle("B"),c.Subtitle("C"),Average(a, 0.2,b,0.4,c,0.4).Subtitle("Average(A,0.2, B,0.4, C,0.4)")) #reduceby2() #Average(a, 0.2,b,0.4,c,0.4) # o AvsTimer(frames=1000, name="mpeg2dec", quiet=true) #average(last,1.0/6,Trim(1,0),1.0/6,Trim(2,0),1.0/6,Trim(3,0),1.0/6,Trim(4,0),1.0/6,Trim(5,0),1.0/6) #average(last,0.5,Trim(1,0), 0.5) average(last,1.0/4,Trim(1,0),1.0/4,Trim(2,0),1.0/4,Trim(3,0),1.0/4) AvsTimer(frames=1000, name="average", difference=1) Last edited by mg262; 28th September 2005 at 14:46. |
28th September 2005, 16:26 | #4 | Link |
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,391
|
Thank you. Oh, and a nice method to squeeze 400% speed increase, indeed. Could work for other filters, too.
Okay, I consider. Problem is, when you shall think of something, then usually nothings comes into mind ... BTW, above link starts with "http://http://..." - that's probably not correct.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
28th September 2005, 17:08 | #5 | Link |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
Oops -- link fixed. Thank you.
Don't worry about compiling something right away! Just as/if things occur to you while you are playing with scripts. Edit: the " test for relevant instruction set" may still reporting an error as "sse2 not present"... but it's just that I forgot to change the other message; it really is testing for integer sse. Will fix in next version. Last edited by mg262; 28th September 2005 at 17:10. |
29th September 2005, 05:54 | #6 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
hey, cool. just 2 days ago i was trying to average 3 clips together to get one uber-clip... i was using ye olde interleave(1,2,3).temporalsoften(1,255,255).selectevery(3,1) to do it.
i like your method better
__________________
sucking the life out of your videos since 2004 |
29th September 2005, 09:59 | #7 | Link | |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
Quote:
@Mug Funky + @Didée (plus anyone else who feels like chipping in), Do you have preferred methods of scene detection? |
|
29th September 2005, 10:25 | #8 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
not really... i set that to 255 as well. so long as you're selectevery-ing the correct frame, there's no bleeding between frames.
as far as preferred scene detection methods go... haven't really needed it, as filters that require it (MVtools stuff) tend to be too slow to use practically anyway.
__________________
sucking the life out of your videos since 2004 |
29th September 2005, 13:13 | #9 | Link |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
Right. Suppose you're taking a temporal average, radius two, like this:
A|B C D E with a scene break between A and B. Is it all right to take the five-point average B B C D E Or do you think it's necessary to take the four-point average B C D E ? (The former is straightforward with the scene detection I have, I guess it's straightforward with ConditionalFilter as well, whereas the latter is possible but more fiddly and harder to generalised higher numbers.) |
21st October 2005, 16:24 | #10 | Link |
Registered User
Join Date: May 2005
Location: Germany
Posts: 495
|
I used your Average filter that way:
Code:
Average(source.duplicateframe(0), -0.5, source, 1.0, source.trim(1,0), 1.0, source.trim(2,0), -0.5) I made some more test and I have still stability problems with the new avisynth version. I have a athlon XP 2000+ and a simple 256mp DDR. I get this message when I use it in the function (have also problems with stand alone): Evaluate: System exception - Access Violation Last edited by MOmonster; 21st October 2005 at 16:45. |
21st October 2005, 17:08 | #11 | Link | |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
Quote:
|
|
22nd October 2005, 03:23 | #13 | Link |
Angel of Night
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
|
Hey, I was wondering where all those Access Violations/crashes were coming from, I thought they were something I was doing wrong. I'll pick up this new version right away and start testing!
|
23rd October 2005, 23:16 | #15 | Link |
Registered User
Join Date: Nov 2004
Location: Spain
Posts: 408
|
humbly request
Hi,
I've used this filter (flawessly, by the way) and i love the possibilty of merge any number of clips i need. Moreover, i think it could be extended, to another colourspaces, and another modes of merge (calculation of median, instead of avegerage). Maybe will be necessary to use another name for the hipotetic new filters, but the central idea will be the same. |
24th October 2005, 06:32 | #16 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
median is a great idea! that'd sort out stuff like overlaying multiple captures. would also be good for mocomped interleaving and stuff.
__________________
sucking the life out of your videos since 2004 |
24th October 2005, 07:41 | #19 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
hmm. good point about the assembly and median stuff. i guess for median filtering weights would behave counter-intuitively, and it would be better handled with interleave(1,2,3).clense().selectevery(3,1)
[edit] btw, thanks for the quick update
__________________
sucking the life out of your videos since 2004 |
24th October 2005, 10:12 | #20 | Link |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
If it's for a small, fixed, number, I think I might have a way of doing it reasonably fast in assembly. But I don't understand how you would even put weights in for median filtering? Unless you wanted to take the weighted average of minimum, median, and maximum (for 3 clips).
|
Thread Tools | Search this Thread |
Display Modes | |
|
|