]> git.sesse.net Git - mlt/commitdiff
Sanity checks for normalising filters
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 4 Jun 2005 07:58:14 +0000 (07:58 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 4 Jun 2005 07:58:14 +0000 (07:58 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@733 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/avformat/filter_avcolour_space.c
src/modules/avformat/filter_avdeinterlace.c
src/modules/core/filter_resize.c
src/modules/xine/filter_deinterlace.c

index 3853a18d3b332a496e3d7e673c7d851122d3b791..247f6e5970ebb18f7872a8a3dc482229725b11a4 100644 (file)
@@ -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 );
index 35e6541526247a373b656691987c2d285937b5de..919d1e4f2bb22208b1ec7ef58e09905e387a4ddd 100644 (file)
@@ -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;
 }
index ba27859b2947d3843594906ff4b4a18039e52980..d245ed0d409b4f915f315f7446c5a82f1e74c27a 100644 (file)
@@ -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" );
index 9d122a974eeabbd4bd2f07da947ea754035f3212..70210567d2e86519947ac393bf938c63bd47d3a3 100644 (file)
@@ -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" ) )
        {