pinterf / AviSynthPlus

AviSynth with improvements
http://avs-plus.net
208 stars 24 forks source link

Crash when ternary operator is used with HBD #40

Closed TbtBI closed 4 years ago

TbtBI commented 4 years ago

Hi, using this script with 8-bit video everything is fine. When the video is > 8-bit there is crash without any error message. Replacing NumComponents(input) > 1 ? input == ExtractY(input) : NOP() with if (NumComponents(input) > 1) { input = ExtractY(input) } works fine with every bit depth. Used avs+ r2915 / 3.4.

pinterf commented 4 years ago

Try input = ExtractY(input) instead of input == ExtractY(input)

TbtBI commented 4 years ago

NumComponents(input) > 1 ? input = ExtractY(input) : NOP() - returns "Script error: expected ':' " in AvsPmod. if (NumComponents(input) > 1) { input == ExtractY(input) } - still no error with every bit depth.

pinterf commented 4 years ago

I'm from mobile, just a quick help. Don't mix assignment = with comparison ==. Don't put assignment operator on ternary operator's true/false branch. Find and check proper language syntax on avisynth.nl or ask it on forums

TbtBI commented 4 years ago

But you suggested: "Try input = ExtractY(input) instead of input == ExtractY(input)".

pinterf commented 4 years ago

I was wrong. input = NumComponents(input) > 1 ? ExtractY(input) : input

TbtBI commented 4 years ago

That works. Thanks.

But shouldn't NumComponents(input) > 1 ? input == ExtractY(input) : NOP() have the same behavior for both 8-bit video and >8-bit video?