Log in

View Full Version : AddAlphaPlane


hello_hello
10th August 2020, 16:36
Maybe I'm missing something, but AddAlphaPlane() doesn't always seem to be accepting "last" as the first clip. It seems I can work around it by specifying the mask clip as a named argument, but is this apparent inconsistency expected? I'm running Avisynth+ 3.5 on XP.

No error

ConvertToYUV420()
AddAlphaPlane()
Alfa = ExtractA()
ConvertToYUV420().AddAlphaPlane(Alfa)

Results in a "greyscale source is not allowed" error

ConvertToYUV420()
AddAlphaPlane()
Alfa = ExtractA()
ConvertToYUV420()
AddAlphaPlane(Alfa)

Results in a "greyscale source is not allowed" error

ConvertToYUV420()
AddAlphaPlane()
Alfa = ExtractA()
Add = "AddAlphaPlane(Alfa)"
ConvertToYUV420().Eval(Add)

Results in a "greyscale source is not allowed" error

ConvertToYUV420()
AddAlphaPlane()
Alfa = ExtractA()
Add = "AddAlphaPlane(Alfa)"
ConvertToYUV420()
Eval(Add)

When using Mask=MaskClip, it never produces an error, but I'd be interested to know why only one of the examples above works as I expected it to.

This sort if thing never results in an error

ConvertToYUV420()
AddAlphaPlane()
Alfa = ExtractA()
Add = "AddAlphaPlane(Mask=Alfa)"
ConvertToYUV420()
Eval(Add)

Edit: While I'm here, could somebody please explain this one. I'm using the example from the wiki (http://avisynth.nl/index.php/AddAlphaPlane#Examples). Are these functions newer than version 3.5, or were they removed?

No such function as UToY8

Source = last.AddAlphaPlane()
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)

No such function as AToY8 (or ATtoY)

Source = last.AddAlphaPlane()
U8 = source.UToY.ConvertToY8()
V8 = source.VToY.ConvertToY8()
Y8 = source.ConvertToY()
A8 = source.AddAlphaPlane(128).AToY8()
CombinePlanes(Y8, U8, V8, A8, planes="YUVA", source_planes="YYYY",
\ sample_clip=source)

No error

Source = last.AddAlphaPlane()
U8 = source.UToY.ConvertToY8()
V8 = source.VToY.ConvertToY8()
Y8 = source.ConvertToY()
A8 = source.AddAlphaPlane(128).ExtractA().ConvertToY8()
CombinePlanes(Y8, U8, V8, A8, planes="YUVA", source_planes="YYYY",
\ sample_clip=source)

Cheers.

real.finder
11th August 2020, 00:55
there are bug in how last avs+ read the parameters https://forum.doom9.org/showpost.php?p=1918913&postcount=5 and https://forum.doom9.org/showpost.php?p=1920166&postcount=622

hello_hello
11th August 2020, 04:08
It's an odd one.

Thanks.

wonkey_monkey
11th August 2020, 10:35
Also https://forum.doom9.org/showthread.php?p=1920018#post1920018

real.finder
16th August 2020, 07:49
ok, the OP seems not related with avs+ 3.6 problem, simply it not work because Mask is var so it not use the feeded clip unless it forced to do so

UToY8 was there from classic avs 2.6, but I think AToY8/AToY was in some avs+ test and removed later after ExtractA was added

pinterf
18th August 2020, 13:54
Maybe I'm missing something, but AddAlphaPlane() doesn't always seem to be accepting "last" as the first clip. It seems I can work around it by specifying the mask clip as a named argument, but is this apparent inconsistency expected? I'm running Avisynth+ 3.5 on XP.

ConvertToYUV420()
AddAlphaPlane()
Alfa = ExtractA()
ConvertToYUV420()
AddAlphaPlane(Alfa)

Results in a "greyscale source is not allowed" error


The "mask" parameter is a named parameter and is optional.
http://avisynth.nl/index.php/CombinePlanes#AddAlphaPlane

When you call AddAlphaPlane with a simple clip, it is a perfectly valid form of AddAlphaPlane with a single source clip parameter.

In this syntax the single nameless parameter you were given is the interpreted as a source clip. And this clip (Alfa at the moment) is not allowed to be greyscale.

AddAlphaPlane(mask=Alfa) will work, since the source will be "last".