Rotate

Abstract

author: Alexander Balakhnin 'Fizick'
version: 1.5
download: http://avisynth.org.ru/
category: Geometric plugins
requirements: RGB32, planar color formats
license: GPL

Information

Rotate plugin makes frames rotation or shear on any given angle.

It may be used for perspective correction of amateur films or for special effect. Avisynth internal functions TurnLeft and TurnRight can rotate image on 90 degrees only. The Rotate plugin is faster than Zoom plugin (by WarpEnterprises) and EffectRotation(from EffectsMany plugin by vcmohan) and produces good quality images (IMO). Implemented Alan Paeth's method of bitmap rotation by means of 3 shears. Pixel (linear) interpolation is used at every shear. Size (scale) and aspect ratio of source picture are preserved.

Syntax and parameters

Rotate (clip, float "angle", int "color", int "start", int "end", float "endangle", int "width", int "height", float "aspect")

HShear (clip, float "angle", int "color", int "start", int "end", float "endangle", int "width", int "height", float "aspect")

VShear (clip, float "angle", int "color", int "start", int "end", float "endangle", int "width", int "height", float "aspect")

Rotate is rotation, HShear is horizontal shear, VShear is vertical shear.

first parameter is the source clip.

angle is rotation angle in degrees clock wise. Default 0.

color is background color of part of clip. Integer or hex or global color constant like color_gray (see colors_rgb.avsi). Default 0 (color_black).

start is first frame number to rotate. Default 0.

end is last frame number to rotate. Default is -1 (as final frame).

endangle is rotation angle of end frame. Default is same as angle. If not the same, then rotation angle of intermediate frames is linear function.

width and height are sizes of destination output frame. Default 0 is to be equal to input clip size.

aspect is pixel aspect ratio. Default 1.0 (square pixel).

Example

loadplugin("rotate.dll")
avisource("g:\test.avi")
converttoRGB32()
Rotate(1.0) # 1 degree rotation

Discussion

doom9 forum at http://forum.doom9.org/showthread.php?t=131307

License

This plugin is free software released under the GNU GPL license. See file gpl.txt.
Documentation is distributed under CreativeCommons BY-SA 3.0 license.
Please donate for support.

Source code is based on ImageRotate class (with MMX optimization) from
http://treskunov.net/anton/Software/doc/fast_and_high_quality_true_color_bitmap_rotation_function.html
Copyright (c) 2003 by Anton Treskunov
Permission to use, copy, modify, distribute and sell this software for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

Revisions

Version 1.0 (29.10.2007) - initial

Version 1.1 (30.10.2007) - added YV12 color format (slow, no MMX optimization), fixed bug with fill

Version 1.2 (18.11.2007) - Precise (interpolated) position of center of rotation (was rounded in original)

Version 1.3 (16.12.2007) - Removed mid rotation for angle -45...0; fixed bugs with RGB32; Added HShear and VShear functions; frames range

Version 1.3.1 (02.07.2008) - Fixed bug with angle=225 (thanks to mikeytown2 for report)

Version 1.3.2 (25.07.2008) - Fixed bug with YV12 (thanks to mikeytown2 for report)

Version 1.3.3 (09.09.2009) - Fixed bug with gradual rotation (thanks to Terrachild for report)

Version 1.3.4 (22.09.2013) - Fixed bug with gradual rotation for large frame sizes RGB32 (thanks to Efremov for report)

Version 1.4 (28.02.2016) - Updated to vc2005. Upgrade to avisynth 2.6 (all planar formats).

Version 1.5 (11.03.2016) - Added support for differently subsampled planar formats. Added parameter "aspect". Changed processing of big angles (about 90) to be compaible with aspect, but it is more blured now.

Download Rotate plugin version 1.5