Weave

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (added category)
m (formatting)
Line 1: Line 1:
{{Template:FuncDef|Weave(clip ''clip'')}}
+
<div style="max-width:62em" >
 +
{{FuncDef|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.  
 
'''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.  
Line 5: Line 6:
 
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.  
 
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.
+
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.
  
{{Template:Func2Def|WeaveColumns(clip ''clip'', int ''period'')|WeaveRows(clip ''clip'', int ''period'')}}
+
{{Func2Def
 +
|WeaveColumns(clip ''clip'', int ''period'')
 +
|WeaveRows(clip ''clip'', int ''period'')
 +
}}
  
 
'''WeaveColumns''' is the opposite of [[SeparateColumns]]: it weaves the columns of period frames into a single output frame. The number of frames of the new clip is the ceiling of 'the number of frames of the input clip divided by period'. WeaveColumns is a relatively slow filter due to the sparse pixel placing required by the algorithm. In some applications it may be faster to use [[TurnLeft]]/[[TurnRight]] with WeaveRows.
 
'''WeaveColumns''' is the opposite of [[SeparateColumns]]: it weaves the columns of period frames into a single output frame. The number of frames of the new clip is the ceiling of 'the number of frames of the input clip divided by period'. WeaveColumns is a relatively slow filter due to the sparse pixel placing required by the algorithm. In some applications it may be faster to use [[TurnLeft]]/[[TurnRight]] with WeaveRows.
Line 16: Line 20:
  
 
'''Example:'''
 
'''Example:'''
 
+
<div {{BoxWidthIndent|48|0}} >
  # makes a black and white checkerboard (without changing the spatial position of the rows and columns)
+
  # makes a black and white checkerboard  
 +
# (without changing the spatial position of the rows and columns)
 
   
 
   
  BlankClip() # black
+
  [[BlankClip]] # black
 
   
 
   
 
  # frame 0 consists of the rows 0,2,4,... of the original frame 0
 
  # frame 0 consists of the rows 0,2,4,... of the original frame 0
Line 26: Line 31:
 
  # frame 3 consists of the rows 1,3,5,... of the original frame 1
 
  # frame 3 consists of the rows 1,3,5,... of the original frame 1
 
  # etc ...
 
  # etc ...
  SeparateRows(2)
+
  [[SeparateRows]](2)
 
   
 
   
 
  # E1 consists of even frames thus
 
  # E1 consists of even frames thus
Line 32: Line 37:
 
  # rows 0,2,4,... of the original frame 1
 
  # rows 0,2,4,... of the original frame 1
 
  # etc ...
 
  # etc ...
  E1 = SelectEven()
+
  E1 = [[SelectEven]]
 
   
 
   
 
  # O1 consists of the odd frames thus
 
  # O1 consists of the odd frames thus
Line 38: Line 43:
 
  # rows 1,3,5,... of the original frame 1
 
  # rows 1,3,5,... of the original frame 1
 
  # etc ...
 
  # etc ...
  O1 = SelectOdd()
+
  O1 = [[SelectOdd]]
 
   
 
   
 
  # likewise for a white clip
 
  # likewise for a white clip
  BlankClip(color=$FFFFFF)
+
  [[BlankClip]](color=$FFFFFF)
  SeparateRows(2)
+
  [[SeparateRows]](2)
  E2 = SelectEven()
+
  E2 = [[SelectEven]]
  O2 = SelectOdd()
+
  O2 = [[SelectOdd]]
 
    
 
    
 
  # rows 0,2,4,... of the original black frame 0
 
  # rows 0,2,4,... of the original black frame 0
Line 51: Line 56:
 
  # rows 0,2,4,... of the original white frame 1
 
  # rows 0,2,4,... of the original white frame 1
 
  # etc ...
 
  # etc ...
  EI = Interleave(E1, E2)
+
  EI = [[Interleave]](E1, E2)
 
   
 
   
 
  # rows 1,3,5,... of the original white frame 0
 
  # rows 1,3,5,... of the original white frame 0
Line 75: Line 80:
 
  # alternating white and black columns frame 1
 
  # alternating white and black columns frame 1
 
  # etc ...
 
  # etc ...
  Interleave(E, O)
+
  [[Interleave]](E, O)
 
   
 
   
  # weaves the even and odd rows of the original clips with alternating black and white columns
+
  # weaves the even and odd rows of the original clips  
 +
# with alternating black and white columns
 
  WeaveRows(2)
 
  WeaveRows(2)
 +
</div>
  
 
'''Changes:'''
 
'''Changes:'''
Line 86: Line 93:
 
| Added WeaveColumns and WeaveRows.
 
| Added WeaveColumns and WeaveRows.
 
|}
 
|}
 +
</div>
  
 
[[Category:Internal filters]]
 
[[Category:Internal filters]]
 
[[Category:Interlace_Filters]]
 
[[Category:Interlace_Filters]]

Revision as of 12:48, 28 February 2016

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.

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 is the opposite of SeparateColumns: it weaves the columns of period frames into a single output frame. The number of frames of the new clip is the ceiling of 'the number of frames of the input clip divided by period'. WeaveColumns is a relatively slow filter due to the sparse pixel placing required by the algorithm. In some applications it may be faster to use TurnLeft/TurnRight with WeaveRows.

WeaveRows is the opposite of SeparateRows: it weaves the rows of period frames into a single output frame. The number of frames of the new clip is the ceiling of 'the number of frames of the input clip divided by period'. WeaveRows is a relatively quick filter, typically costing 1 output frame blit.

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)

Changes:

v2.60 Added WeaveColumns and WeaveRows.
Personal tools