X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fplus%2Ftransition_affine.c;h=f95b1483955438455715b42a58ba5a58623d5df2;hb=909d149697331a560edb1924f58fc58c5a25aaea;hp=bd399e733f8fd428e470bfe2e2db3a2340c6c597;hpb=6feaaeac76d4f062d27c4c783e24f8052949a7b5;p=melted diff --git a/src/modules/plus/transition_affine.c b/src/modules/plus/transition_affine.c index bd399e7..f95b148 100644 --- a/src/modules/plus/transition_affine.c +++ b/src/modules/plus/transition_affine.c @@ -407,18 +407,18 @@ static void affine_offset( float this[3][3], int x, int y ) } // Obtain the mapped x coordinate of the input -static inline int MapX( float this[3][3], int x, int y ) +static inline double MapX( float this[3][3], int x, int y ) { return this[0][0] * x + this[0][1] * y + this[0][2]; } // Obtain the mapped y coordinate of the input -static inline int MapY( float this[3][3], int x, int y ) +static inline double MapY( float this[3][3], int x, int y ) { return this[1][0] * x + this[1][1] * y + this[1][2]; } -static inline float MapZ( float this[3][3], int x, int y ) +static inline double MapZ( float this[3][3], int x, int y ) { return this[2][0] * x + this[2][1] * y + this[2][2]; } @@ -517,7 +517,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f mlt_frame_get_image( a_frame, image, format, width, height, 1 ); // Calculate the region now - composite_calculate( &result, this, a_frame, ( float )position / ( out - in + 1 ) ); + composite_calculate( &result, this, a_frame, ( float )( position - in ) / ( out - in + 1 ) ); // Fetch the b frame image result.w = ( int )( result.w * *width / result.nw ); @@ -550,10 +550,14 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f { register int x, y; register int dx, dy; + double dz; float sw, sh; // Get values from the transition - float rotate_x = mlt_properties_get_double( properties, "rotate" ); + float fix_rotate_x = mlt_properties_get_double( properties, "fix_rotate_x" ); + float fix_rotate_y = mlt_properties_get_double( properties, "fix_rotate_y" ); + float fix_rotate_z = mlt_properties_get_double( properties, "fix_rotate_z" ); + float rotate_x = mlt_properties_get_double( properties, "rotate_x" ); float rotate_y = mlt_properties_get_double( properties, "rotate_y" ); float rotate_z = mlt_properties_get_double( properties, "rotate_z" ); float fix_shear_x = mlt_properties_get_double( properties, "fix_shear_x" ); @@ -587,9 +591,9 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f affine_t affine; affine_init( affine.matrix ); - affine_rotate( affine.matrix, rotate_x * ( position - in ) ); - affine_rotate_y( affine.matrix, rotate_y * ( position - in ) ); - affine_rotate_z( affine.matrix, rotate_z * ( position - in ) ); + affine_rotate( affine.matrix, fix_rotate_x + rotate_x * ( position - in ) ); + affine_rotate_y( affine.matrix, fix_rotate_y + rotate_y * ( position - in ) ); + affine_rotate_z( affine.matrix, fix_rotate_z + rotate_z * ( position - in ) ); affine_shear( affine.matrix, fix_shear_x + shear_x * ( position - in ), fix_shear_y + shear_y * ( position - in ), @@ -607,14 +611,16 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f q = *image; + dz = MapZ( affine.matrix, 0, 0 ); + for ( y = lower_y; y < upper_y; y ++ ) { p = q; for ( x = lower_x; x < upper_x; x ++ ) { - dx = MapX( affine.matrix, x, y ) + x_offset; - dy = MapY( affine.matrix, x, y ) + y_offset; + dx = MapX( affine.matrix, x, y ) / dz + x_offset; + dy = MapY( affine.matrix, x, y ) / dz + y_offset; if ( dx >= 0 && dx < b_width && dy >=0 && dy < b_height ) {