Weave
m (1 revision) |
Revision as of 17:02, 9 May 2013
Weave(clip clip)
Weave is the opposite of SeparateFields: it takes pairs of fields from the input video clip and combines them together to produce interlaced frames. The new clip has half the frame rate and frame count. Weave uses the frame-parity information in the source clip to decide which field to put on top. If it gets it wrong, use ComplementParity beforehand or SwapFields afterwards.
All AviSynth filters keep track of field parity, so Weave will always join the fields together in the proper order. If you want the other order, you'll have to use ComplementParity beforehand or SwapFields afterwards.
From verions v2.56 this filter raises an exception if the clip is already frame-based. You may want to use AssumeFieldBased to force weave a second time. Prior versions did a no-op for materials that was already frame-based.
WeaveColumns(clip clip, int period)
WeaveRows(clip clip, int period)
WeaveColumns and WeaveRows are the opposite of SeparateColumns and SeparateRows.
WeaveColumns weaves period frames into a new frame as columns. The number of frames of the new clip is the number of frames of the old clip divided by period (rounded down). The width of new the frame is period times the width of the old frame.
WeaveRows weaves period frames into a new frame as rows. The number of frames of the new clip is the number of frames of the old clip divided by period (rounded down). The height of new the frame is period times the height of the old frame.
WeaveRows(2) is the same as Weave().
Example:
# makes a black and white checkerboard (without changing the spatial position of the rows and columns) BlankClip() # black # frame 0 consists of the rows 0,2,4,... of the original frame 0 # frame 1 consists of the rows 1,3,5,... of the original frame 0 # frame 2 consists of the rows 0,2,4,... of the original frame 1 # frame 3 consists of the rows 1,3,5,... of the original frame 1 # etc ... SeparateRows(2) # E1 consists of even frames thus # rows 0,2,4,... of the original frame 0 # rows 0,2,4,... of the original frame 1 # etc ... E1 = SelectEven() # O1 consists of the odd frames thus # rows 1,3,5,... of the original frame 0 # rows 1,3,5,... of the original frame 1 # etc ... O1 = SelectOdd() # likewise for a white clip BlankClip(color=$FFFFFF) SeparateRows(2) E2 = SelectEven() O2 = SelectOdd() # rows 0,2,4,... of the original black frame 0 # rows 0,2,4,... of the original white frame 0 # rows 0,2,4,... of the original black frame 1 # rows 0,2,4,... of the original white frame 1 # etc ... EI = Interleave(E1, E2) # rows 1,3,5,... of the original white frame 0 # rows 1,3,5,... of the original black frame 0 # rows 1,3,5,... of the original white frame 1 # rows 1,3,5,... of the original black frame 1 # etc ... OI = Interleave(O2, O1) # alternating black and white columns frame 0 # alternating black and white columns frame 1 # etc ... E = EI.WeaveColumns(2) # alternating white and black columns frame 0 # alternating white and black columns frame 1 # etc ... O = OI.WeaveColumns(2) # alternating black and white columns frame 0 # alternating white and black columns frame 0 # alternating black and white columns frame 1 # alternating white and black columns frame 1 # etc ... Interleave(E, O) # weaves the even and odd rows of the original clips with alternating black and white columns WeaveRows(2)