X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fplus%2Ftransition_affine.c;h=719705618605edc4c6d9c8cc6bb041d00c8e2d57;hb=4fc3fa1bf4116848c423837437d75f103cdd0154;hp=186ad8b29afc5641e4c3188565f2fadc4f7850e2;hpb=91fb4d73caa09a606c46393c7565462bf926e6a8;p=melted diff --git a/src/modules/plus/transition_affine.c b/src/modules/plus/transition_affine.c index 186ad8b..7197056 100644 --- a/src/modules/plus/transition_affine.c +++ b/src/modules/plus/transition_affine.c @@ -3,22 +3,22 @@ * Copyright (C) 2003-2004 Ushodaya Enterprises Limited * Author: Charles Yates * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "transition_affine.h" +#include #include #include @@ -30,7 +30,7 @@ /** Calculate real geometry. */ -static void geometry_calculate( mlt_transition this, char *store, struct mlt_geometry_item_s *output, float position ) +static void geometry_calculate( mlt_transition this, const char *store, struct mlt_geometry_item_s *output, float position ) { mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); mlt_geometry geometry = mlt_properties_get_data( properties, store, NULL ); @@ -52,7 +52,7 @@ static void geometry_calculate( mlt_transition this, char *store, struct mlt_geo } -static mlt_geometry transition_parse_keys( mlt_transition this, char *name, char *store, int normalised_width, int normalised_height ) +static mlt_geometry transition_parse_keys( mlt_transition this, const char *name, const char *store, int normalised_width, int normalised_height ) { // Get the properties of the transition mlt_properties properties = MLT_TRANSITION_PROPERTIES( this ); @@ -108,7 +108,7 @@ static mlt_geometry composite_calculate( mlt_transition this, struct mlt_geometr return start; } -static inline float composite_calculate_key( mlt_transition this, char *name, char *store, int norm, float position ) +static inline float composite_calculate_key( mlt_transition this, const char *name, const char *store, int norm, float position ) { // Struct for the result struct mlt_geometry_item_s result; @@ -122,7 +122,7 @@ static inline float composite_calculate_key( mlt_transition this, char *name, ch return result.x; } -typedef struct +typedef struct { float matrix[3][3]; } @@ -330,8 +330,8 @@ static inline void get_affine( affine_t *affine, mlt_transition this, float posi affine_rotate_x( affine->matrix, fix_rotate_x + rotate_x * position ); affine_rotate_y( affine->matrix, fix_rotate_y + rotate_y * position ); affine_rotate_z( affine->matrix, fix_rotate_z + rotate_z * position ); - affine_shear( affine->matrix, - fix_shear_x + shear_x * position, + affine_shear( affine->matrix, + fix_shear_x + shear_x * position, fix_shear_y + shear_y * position, fix_shear_z + shear_z * position ); affine_offset( affine->matrix, ox, oy ); @@ -392,6 +392,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f int normalised_width = mlt_properties_get_int( a_props, "normalised_width" ); int normalised_height = mlt_properties_get_int( a_props, "normalised_height" ); + double consumer_ar = mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ; + // Structures for geometry struct mlt_geometry_item_s result; @@ -414,15 +416,18 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f b_width = result.w; b_height = result.h; + if ( mlt_properties_get_double( b_props, "aspect_ratio" ) == 0.0 ) + mlt_properties_set_double( b_props, "aspect_ratio", consumer_ar ); + if ( !strcmp( mlt_properties_get( a_props, "rescale.interp" ), "none" ) ) { mlt_properties_set( b_props, "rescale.interp", "nearest" ); - mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "aspect_ratio" ) ); + mlt_properties_set_double( b_props, "consumer_aspect_ratio", consumer_ar ); } else { mlt_properties_set( b_props, "rescale.interp", mlt_properties_get( a_props, "rescale.interp" ) ); - mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); + mlt_properties_set_double( b_props, "consumer_aspect_ratio", consumer_ar ); } mlt_properties_set_int( b_props, "distort", mlt_properties_get_int( properties, "distort" ) ); @@ -448,7 +453,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f int cx = result.x + ( b_width >> 1 ); int cy = result.y + ( b_height >> 1 ); - + cx -= cx % 2; + int lower_x = 0 - cx; int upper_x = *width - cx; int lower_y = 0 - cy; @@ -468,9 +474,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f get_affine( &affine, this, ( float )position ); - lower_x -= ( lower_x & 1 ); - upper_x -= ( upper_x & 1 ); - q = *image; dz = MapZ( affine.matrix, 0, 0 ); @@ -508,7 +511,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f if ( dx >= 0 && dx < b_width && dy >=0 && dy < b_height ) { - *pmask ++; + pmask ++; dx -= dx & 1; *p ++ = *( b_image + dy * b_stride + ( dx << 1 ) ); *p ++ = *( b_image + dy * b_stride + ( dx << 1 ) + ( ( x & 1 ) << 1 ) + 1 ); @@ -590,7 +593,7 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram /** Constructor for the filter. */ -mlt_transition transition_affine_init( char *arg ) +mlt_transition transition_affine_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ) { mlt_transition transition = mlt_transition_new( ); if ( transition != NULL )