CombinePlanes
Raffriff42 (Talk | contribs) (Avisynthplus - new filter) |
(→Add/Remove Alpha Plane: add link to avs+ documentation) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | <div style="max-width:82em; min-width:42em;" > | |
− | + | {{AvsPlusFilter}} | |
+ | </div> | ||
__TOC__ | __TOC__ | ||
− | + | <div style="max-width:62em; min-width:42em;" > | |
− | <div style="max-width:62em" > | + | <!-- ==== Syntax and Parameters ==== --> |
+ | ==== CombinePlanes ==== | ||
+ | Merges planes of source clip(s) into a target clip. <br> | ||
+ | It is similar to ''ShufflePlanes'' in Vapoursynth. Performs the functionality of [[SwapUV]], [[YToUV]], [[MergeChroma]], [[MergeRGB]] and more. | ||
+ | |||
{{FuncDef|CombinePlanes(clip, <br> | {{FuncDef|CombinePlanes(clip, <br> | ||
[string ''planes'', string ''source_planes'', string ''pixel_type'', clip ''sample_clip'' ] )}} | [string ''planes'', string ''source_planes'', string ''pixel_type'', clip ''sample_clip'' ] )}} | ||
Line 36: | Line 41: | ||
::If supplied, output {{FuncArg|pixel_type}} will match that of {{FuncArg|sample_clip}}. | ::If supplied, output {{FuncArg|pixel_type}} will match that of {{FuncArg|sample_clip}}. | ||
+ | ==== Add/Remove Alpha Plane ==== | ||
+ | |||
+ | <div {{BlueBox2|40|0|3px solid purple}} > | ||
+ | {{AvsPlusFullname}}<br> | ||
+ | Up-to-date documentation: [https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/mask.html#addalphaplane https://avisynthplus.readthedocs.io] | ||
</div> | </div> | ||
+ | |||
+ | |||
+ | Adds or removes the RGB or YUV alpha plane.<br> | ||
+ | If an alpha plane was present, calling '''AddAlphaPlane''' replaces it.<br> | ||
+ | If an alpha plane was not present, calling '''RemoveAlphaPlane''' does nothing.<br> | ||
+ | Although RGB24, RGB32, RGB48 and RGB64 are not planar colorspaces, the alpha is handled for them as well. | ||
+ | |||
+ | {{FuncDef|AddAlphaPlane(clip, clip ''mask'' )}} <br> | ||
+ | {{FuncDef|AddAlphaPlane(clip, float ''mask'')}} <br> | ||
+ | {{FuncDef|AddAlphaPlane(clip, int ''mask'')}} <br> | ||
+ | {{FuncDef|RemoveAlphaPlane(clip)}} | ||
+ | |||
+ | :{{Par2||clip|}} | ||
+ | ::Source clip. | ||
+ | |||
+ | :{{Par2|mask|clip|}} | ||
+ | ::alpha source clip | ||
+ | |||
+ | ::If supplied, and the clip is greyscale - IsY() is true - it is copied to the resulting clip. | ||
+ | ::If supplied, and the clip has alpha plane (such as RGBAP8 or RGB64) the alpha plane from {{FuncArg|mask}} is copied to the resulting clip. | ||
+ | |||
+ | or | ||
+ | |||
+ | :{{Par2|mask|float|}} | ||
+ | ::pixel value. | ||
+ | or | ||
+ | :{{Par2|mask|integer|}} | ||
+ | ::pixel value | ||
+ | ::If the numeric-type {{FuncArg|mask}} parameter is supplied, it will be used as filler value of the resulting alpha plane. No bit depth scaling happens, parameter value is used as-is. | ||
+ | </div> | ||
+ | |||
==== Examples ==== | ==== Examples ==== | ||
− | <div style="max-width:62em" > | + | <div style="max-width:62em; min-width:42em;" > |
− | <div {{BoxWidthIndent| | + | <div {{BoxWidthIndent|54|2}} > |
#combine greyscale clips into YUVA clip | #combine greyscale clips into YUVA clip | ||
U8 = source.UToY8() | U8 = source.UToY8() | ||
Line 49: | Line 90: | ||
</div> | </div> | ||
− | <div {{BoxWidthIndent| | + | <div {{BoxWidthIndent|54|2}} > |
# Copy planes between planar RGB(A) and YUV(A) without any conversion | # Copy planes between planar RGB(A) and YUV(A) without any conversion | ||
# yuv 4:4:4 <-> planar rgb | # yuv 4:4:4 <-> planar rgb | ||
Line 60: | Line 101: | ||
</div> | </div> | ||
− | <div {{BoxWidthIndent| | + | <div {{BoxWidthIndent|54|2}} > |
#create a black and white planar RGB clip using Y channel | #create a black and white planar RGB clip using Y channel | ||
#source is a YUV clip | #source is a YUV clip | ||
Line 67: | Line 108: | ||
</div> | </div> | ||
− | <div {{BoxWidthIndent| | + | <div {{BoxWidthIndent|54|2}} > |
#copy luma from one clip, U and V from another | #copy luma from one clip, U and V from another | ||
#source is the template | #source is the template |
Latest revision as of 19:42, 17 September 2022
AVS+ |
---|
This feature is specific to AviSynthPlus. It is not supported in other AviSynth versions. |
Contents |
[edit] CombinePlanes
Merges planes of source clip(s) into a target clip.
It is similar to ShufflePlanes in Vapoursynth. Performs the functionality of SwapUV, YToUV, MergeChroma, MergeRGB and more.
CombinePlanes(clip,
[string planes, string source_planes, string pixel_type, clip sample_clip ] )
CombinePlanes(clip, clip,
[string planes, string source_planes, string pixel_type, clip sample_clip ] )
CombinePlanes(clip, clip, clip,
[string planes, string source_planes, string pixel_type, clip sample_clip ] )
CombinePlanes(clip, clip, clip, clip,
[string planes, string source_planes, string pixel_type, clip sample_clip ] )
- clip =
- Source clip(s). At least one is required. Up to four clips are accepted.
- Each clip defines a color plane in the output, as defined by the planes and source_planes arguments.
- If the clip count is less than the given planes defined, then the last available clip is used as a source for all later planes.
- string planes = ""
- The target plane order (e.g. "YVU", "YYY", "RGB"); missing target planes will be undefined in the target.
- string source_planes = "YUVA" or "RGBA"
- The source plane order, defaulting to "YUVA" or "RGBA" depending on the video format.
- Source clips can even be mixed from greyscale, YUV, YUVA or planar RGB(A) — the only rule being that the relevant source plane character should match with the clip format, respectively.
- string pixel_type =
- Set color format of the returned clip. Supports all AVS+ color formats.
- clip sample_clip =
- If supplied, output pixel_type will match that of sample_clip.
[edit] Add/Remove Alpha Plane
AviSynth+
Up-to-date documentation: https://avisynthplus.readthedocs.io
Adds or removes the RGB or YUV alpha plane.
If an alpha plane was present, calling AddAlphaPlane replaces it.
If an alpha plane was not present, calling RemoveAlphaPlane does nothing.
Although RGB24, RGB32, RGB48 and RGB64 are not planar colorspaces, the alpha is handled for them as well.
AddAlphaPlane(clip, clip mask )
AddAlphaPlane(clip, float mask)
AddAlphaPlane(clip, int mask)
RemoveAlphaPlane(clip)
- clip =
- Source clip.
- clip mask =
- alpha source clip
- If supplied, and the clip is greyscale - IsY() is true - it is copied to the resulting clip.
- If supplied, and the clip has alpha plane (such as RGBAP8 or RGB64) the alpha plane from mask is copied to the resulting clip.
or
- float mask =
- pixel value.
or
- integer mask =
- pixel value
- If the numeric-type mask parameter is supplied, it will be used as filler value of the resulting alpha plane. No bit depth scaling happens, parameter value is used as-is.
[edit] Examples
#combine greyscale clips into YUVA clip U8 = source.UToY8() V8 = source.VToY8() Y8 = source.ConvertToY() A8 = source.AddAlphaPlane(128).AToY8() CombinePlanes(Y8, U8, V8, A8, planes="YUVA", source_planes="YYYY", \ sample_clip=source) #pixel_type="YUV444P8"
# Copy planes between planar RGB(A) and YUV(A) without any conversion # yuv 4:4:4 <-> planar rgb source = last.ConvertBits(32) # 4:4:4 cast_to_planarrgb = CombinePlanes(source, planes="RGB", source_planes="YUV", \ pixel_type="RGBPS") # get back a clip identical with "source" cast_to_yuv = CombinePlanes(cast_to_planarrgb, planes="YUV", source_planes="RGB", \ pixel_type="YUV444PS")
#create a black and white planar RGB clip using Y channel #source is a YUV clip grey = CombinePlanes(source, planes="RGB", source_planes="YYY", \ pixel_type="RGBP8")
#copy luma from one clip, U and V from another #source is the template #sourceY is a Y or YUV clip #sourceUV is a YUV clip grey = CombinePlanes(sourceY, sourceUV, planes="YUV", \ source_planes="YUV", sample_clip = source)
[edit] Changes
20161110 | first added |