View Single Post
Old 31st October 2007, 06:40   #5  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Direct 2D is very hard to MMX well, especially for higher order interpolation. Avery's VDub rotater is really devious. This offers a separable solution

And this triple shear implementation has heaps of room for improvement. i.e. get rid of the 90, 180 & 270 pre-rotates and adjust the core routine to work for all rotates (or do 4 core engines). Jazz the horizontal mmx code to do 2 or 4 pixels per loop. Jazz the the vertical MMX code to process across the image instead of down (I estimate any vertical code I wrote would be faster than the horizontal particularly for planar, in which case change the main code to be shear-V, shear-H, shear-V). Junk the width and height options and always output maximal size, this loses all the edge testing code in the inner loops, if really required just do as an implicit Crop on the output.

To improve accuracy, the multipoint interpolation could be stolen from the resizer core. Also shear-1 could output 16bit intermediate, shear-2 could process 16bit and shear-3 could process 16bit and finally output 8bit.

@Fizick,

To test the rotate do
Code:
A=Last
Rotate(30.0)
Rotate(30.0)
Rotate(30.0)
TurnRight()
Subtract(A)
Code:
A=Last
Rotate(-30.0)
Rotate(-30.0)
Rotate(-30.0)
TurnLeft()
Subtract(A)
And at the boundary extremes
Code:
A=Last
Rotate(45.0)
Rotate(45.0)
TurnRight()
Subtract(A)
Code:
A=Last
Rotate(-45.0)
Rotate(-45.0)
TurnLeft()
Subtract(A)

Last edited by IanB; 31st October 2007 at 06:46.
IanB is offline   Reply With Quote