pinterf / AviSynthPlus

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

Feature Implementation: mod2 crop function #50

Closed nobananasforyou closed 4 years ago

nobananasforyou commented 4 years ago

G'day! Currently in avs+ cropping is limited to mod4 whereas in vs mod2 cropping is permitted. Is it possible to get this feature implemented in avs+?

Kind Regards!

pinterf commented 4 years ago

It should work. Post your use case.

nobananasforyou commented 4 years ago

Crop(left=7, top=0, right=5, bottom=0) That's how I do it in vs.

Avs+ doesn't allow odd crop values. Crop(7, 0, -7, -0)

pinterf commented 4 years ago

http://avisynth.nl/index.php/Crop Use width and height. With this syntax you are cropping an 1x1 rectangle, which probably works for yuv444 but does not work for any other subsampled format.

nobananasforyou commented 4 years ago

Yeah, but in vs it's not limited to specific formats.

pinterf commented 4 years ago

No. You cannot make an 1x1 sized clip in yuv420 format. Maybe vs rounds up.

nobananasforyou commented 4 years ago

You're right. My testing material is gray10/16. However, that also doesn't work with avs+.

pinterf commented 4 years ago

For a workaround, you can use resizers for cropping, src_left,top,width,height follow the crop syntax. Spline64Resize(width-2*7,height,src_left=7, src_top=0, src_width=-7, src_height=0)

For grey (Y8..Y32), Crop should work, note that GreyScale() and ConvertToY() is different, former leaves the clip in whatever source format (e.g. YV12), just neutralizing chroma.

pinterf commented 4 years ago

http://avisynth.nl/index.php/Crop Use width and height. With this syntax you are cropping an 1x1 rectangle, which probably works for yuv444 but does not work for any other subsampled format. And my reasoning was wrong, of course, -7 and 0 does not yield 1x1 pixels they result in right side and bottom-relative calculation.

nobananasforyou commented 4 years ago

Alright, thanks.