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

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th August 2012, 13:22   #1  |  Link
hanfrunz
Registered User
 
hanfrunz's Avatar
 
Join Date: Feb 2002
Location: Germany
Posts: 534
Can we speedup separatefields().selectevery(4,0,3).weave() ?


Last edited by hanfrunz; 9th August 2012 at 13:26.
hanfrunz is offline   Reply With Quote
Old 9th August 2012, 22:46   #2  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,390
It's not the separate/select/weave that is slow. Those are just copying bits from here to there.

The slow part is the bob, and the slow part is the resize. Those are the ones actually doing calculations.

a)
Code:
dgsource("1080i.dgi")

bob(0,0.5)
lanczos4resize(720,576) 

separatefields().selectevery(4,0,3).weave()
34 fps.
Bob() is doing a [y] resize. Lanczos is 4-tap (more taps = more slow) in both dimensions.


b)
Code:
dgsource("1080i.dgi")

bob(0,0.5)
bicubicresize(720,576,0,0.5)

separatefields().selectevery(4,0,3).weave()
76 fps.
Bicubic is 3-tap, hence faster than 4-tap.


c)
Code:
dgsource("1080i.dgi")

bicubicresize(720,height(),0,0.5)
bob(0,0.5,height=576) 

separatefields().selectevery(4,0,3).weave()
The number of resizing steps minimized.
101 fps.


Example a) with a 5-tap resizer (lanczos, blackman) comes out at 28.5 fps.
__________________
- 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!)
Didée is offline   Reply With Quote
Old 10th August 2012, 01:49   #3  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
@hanfrunz,

To answer your original question, yes you can use DoubleWeave() which tries to optimise the frame memory copying if it can. Weave() always creates a new frame and copies the top field then the bottom field. DoubleWeave() in frame mode checks to see if either input frame IsWriteable() and will then only copy the alternate field from the other frame, saving 1 field memory copy. If neither are writeable then it does the same as Weave().

As you can see it does not make much difference to the whole script, which Didée points out is because most processing is taking place in other filters. Here we can save 0.5ms per frame, which as expected, is about the cost of a SD field bit on a modest machine. The semantics of using DoubleWeave() are a little tricky so most people tend to overlook using it.
Code:
ColorBars(1920, 1080, "yv12")

bicubicresize(720,height(),0,0.5)
bob(0,0.5,height=576) 

# separatefields().selectevery(4,0,3).weave() # 104 fps, 9.6ms
ComplementParity().DoubleWeave().selectevery(4,1) # 110 fps, 9.1 ms
IanB is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 23:28.


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