pinterf / AviSynthPlus

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

Expr AVX2 alignment bug #38

Closed magiblot closed 4 years ago

magiblot commented 5 years ago

When video width is less than modulo 16, the expressions for the second and third planes (alpha not tested) may produce wrong results.

optAVX2=false prevents the issue, so it seems to be related to AVX2.

Sample code:

expr_r = "x 127 < 0.98 x * -0.02 1.02 x * + ?"
expr_g = "x 127 < 1.02 x * 0.02 0.98 x * + ?"
expr_b = "x 127 < 0.9864 x * -0.0136 1.0136 x * + ?"

ColorBarsHD(1024 + 8, pixel_type="YV24") # Module 8, bug triggers
Y = ConvertToY()
# One Expr per channel
R = Expr(Y, expr_r)
G = Expr(Y, expr_g)
B = Expr(Y, expr_b)
# All at once
e = Expr(Y, expr_r, expr_g, expr_b, format="RGBP8")

Compare(R, e.ExtractR(), "Y") # Equal
Compare(G, e.ExtractG(), "Y") # Not equal!
Compare(B, e.ExtractB(), "Y") # Not equal!
pinterf commented 5 years ago

Thanks, fixed on git, though I now recognized that the description is not correct (non-mod-8 instead of non-mod-16)

magiblot commented 5 years ago

Thank you!