Weave
(add link to avs+ documentation) |
|||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | <div style="max-width:62em" > | |
− | + | <div {{BlueBox2|40|0|3px solid purple}} > | |
+ | {{AvsPlusFullname}}<br> | ||
+ | Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/weave.html https://avisynthplus.readthedocs.io] | ||
+ | </div> | ||
− | |||
− | + | {{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. | |
− | + | 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. | |
− | + | {{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. | |
− | ''' | + | '''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. |
− | # makes a black and white checkerboard (without changing the spatial position of the rows and columns) | + | '''WeaveRows(2)''' is the same as Weave(). |
+ | |||
+ | '''Example:''' | ||
+ | <div {{BoxWidthIndent|48|0}} > | ||
+ | # makes a black and white checkerboard | ||
+ | # (without changing the spatial position of the rows and columns) | ||
− | BlankClip | + | [[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 28: | Line 38: | ||
# 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 34: | Line 44: | ||
# 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 40: | Line 50: | ||
# 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 53: | Line 63: | ||
# 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 77: | Line 87: | ||
# 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:''' | ||
+ | {| border="1" | ||
+ | |- | ||
+ | | v2.60 | ||
+ | | Added WeaveColumns and WeaveRows. | ||
+ | |} | ||
+ | </div> | ||
[[Category:Internal filters]] | [[Category:Internal filters]] | ||
+ | [[Category:Interlace_Filters]] |
Latest revision as of 09:46, 17 September 2022
AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io
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. |