From: lilo_booter Date: Sat, 4 Jun 2005 07:58:14 +0000 (+0000) Subject: Sanity checks for normalising filters X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=e48990e98a385144481adfb64405e2a9d07de3a2;p=melted Sanity checks for normalising filters git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@733 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/modules/avformat/filter_avcolour_space.c b/src/modules/avformat/filter_avcolour_space.c index 3853a18..247f6e5 100644 --- a/src/modules/avformat/filter_avcolour_space.c +++ b/src/modules/avformat/filter_avcolour_space.c @@ -125,7 +125,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * error = mlt_frame_get_image( this, image, format, width, height, 0 ); - if ( error == 0 && *format != output_format && *width > 0 && *height > 0 ) + if ( error == 0 && *format != output_format && *image != NULL ) { int in_fmt = convert_mlt_to_av_cs( *format ); int out_fmt = convert_mlt_to_av_cs( output_format ); diff --git a/src/modules/avformat/filter_avdeinterlace.c b/src/modules/avformat/filter_avdeinterlace.c index 35e6541..919d1e4 100644 --- a/src/modules/avformat/filter_avdeinterlace.c +++ b/src/modules/avformat/filter_avdeinterlace.c @@ -80,7 +80,7 @@ #endif /* filter parameters: [-1 4 2 4 -1] // 8 */ -static void deinterlace_line(uint8_t *dst, +static inline void deinterlace_line(uint8_t *dst, const uint8_t *lum_m4, const uint8_t *lum_m3, const uint8_t *lum_m2, const uint8_t *lum_m1, const uint8_t *lum, @@ -126,7 +126,7 @@ static void deinterlace_line(uint8_t *dst, } #endif } -static void deinterlace_line_inplace(uint8_t *lum_m4, uint8_t *lum_m3, uint8_t *lum_m2, uint8_t *lum_m1, uint8_t *lum, +static inline void deinterlace_line_inplace(uint8_t *lum_m4, uint8_t *lum_m3, uint8_t *lum_m2, uint8_t *lum_m1, uint8_t *lum, int size) { #ifndef USE_MMX @@ -172,7 +172,7 @@ static void deinterlace_line_inplace(uint8_t *lum_m4, uint8_t *lum_m3, uint8_t * /* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The top field is copied as is, but the bottom field is deinterlaced against the top field. */ -static void deinterlace_bottom_field(uint8_t *dst, int dst_wrap, +static inline void deinterlace_bottom_field(uint8_t *dst, int dst_wrap, const uint8_t *src1, int src_wrap, int width, int height) { @@ -201,7 +201,7 @@ static void deinterlace_bottom_field(uint8_t *dst, int dst_wrap, deinterlace_line(dst,src_m2,src_m1,src_0,src_0,src_0,width); } -static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, +static inline void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, int width, int height) { uint8_t *src_m1, *src_0, *src_p1, *src_p2; @@ -295,17 +295,17 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * { int error = 0; + // Get the input image + error = mlt_frame_get_image( this, image, format, width, height, 1 ); + // Check that we want progressive and we aren't already progressive - if ( *format == mlt_image_yuv422 && + if ( *format == mlt_image_yuv422 && *image != NULL && !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "progressive" ) && mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "consumer_deinterlace" ) ) { // Create a picture AVPicture *output = mlt_pool_alloc( sizeof( AVPicture ) ); - // Get the input image - error = mlt_frame_get_image( this, image, format, width, height, 1 ); - // Fill the picture if ( *format == mlt_image_yuv422 ) { @@ -319,11 +319,6 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * // Make sure that others know the frame is deinterlaced mlt_properties_set_int( MLT_FRAME_PROPERTIES( this ), "progressive", 1 ); } - else - { - // Get the input image - error = mlt_frame_get_image( this, image, format, width, height, writable ); - } return error; } diff --git a/src/modules/core/filter_resize.c b/src/modules/core/filter_resize.c index ba27859..d245ed0 100644 --- a/src/modules/core/filter_resize.c +++ b/src/modules/core/filter_resize.c @@ -91,7 +91,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * error = mlt_frame_get_image( this, image, format, &owidth, &oheight, writable ); // We only know how to process yuv422 at the moment - if ( error == 0 && *format == mlt_image_yuv422 ) + if ( error == 0 && *format == mlt_image_yuv422 && *image != NULL ) { // Get the requested scale operation char *op = mlt_properties_get( MLT_FILTER_PROPERTIES( filter ), "scale" ); diff --git a/src/modules/xine/filter_deinterlace.c b/src/modules/xine/filter_deinterlace.c index 9d122a9..7021056 100644 --- a/src/modules/xine/filter_deinterlace.c +++ b/src/modules/xine/filter_deinterlace.c @@ -84,7 +84,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_filter filter = mlt_frame_pop_service( this ); // Check that we want progressive and we aren't already progressive - if ( *format == mlt_image_yuv422 && + if ( *format == mlt_image_yuv422 && *image != NULL && !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "progressive" ) && mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "consumer_deinterlace" ) ) {