]> git.sesse.net Git - mlt/commitdiff
filter_avcolour_space.c
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 23 Sep 2005 06:13:58 +0000 (06:13 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 23 Sep 2005 06:13:58 +0000 (06:13 +0000)
+ Correction for uneven width

filter_avdeinterlace.c
+ Correction for cases were the interlace state of frame is only known after rendering

producer_avformat.c
+ Corrections for uneven width
+ Corrections for state propogation of top field first and interlaced state

git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@827 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/avformat/filter_avcolour_space.c
src/modules/avformat/filter_avdeinterlace.c
src/modules/avformat/producer_avformat.c

index 4a53e940557831cbbea31393922275199cbc706e..50eb2ce46b613f17565db01dd866f4e89cd30288 100644 (file)
@@ -57,57 +57,11 @@ static inline int convert_mlt_to_av_cs( mlt_image_format format )
 
 static inline void convert_image( uint8_t *out, uint8_t *in, int out_fmt, int in_fmt, int width, int height )
 {
-       if ( in_fmt == PIX_FMT_YUV420P && out_fmt == PIX_FMT_YUV422 )
-       {
-               register int i, j;
-               register int half = width >> 1;
-               register uint8_t *Y = in;
-               register uint8_t *U = Y + width * height;
-               register uint8_t *V = U + width * height / 2;
-               register uint8_t *d = out;
-               register uint8_t *y, *u, *v;
-
-               i = height >> 1;
-               while ( i -- )
-               {
-                       y = Y;
-                       u = U;
-                       v = V;
-                       j = half;
-                       while ( j -- )
-                       {
-                               *d ++ = *y ++;
-                               *d ++ = *u ++;
-                               *d ++ = *y ++;
-                               *d ++ = *v ++;
-                       }
-
-                       Y += width;
-                       y = Y;
-                       u = U;
-                       v = V;
-                       j = half;
-                       while ( j -- )
-                       {
-                               *d ++ = *y ++;
-                               *d ++ = *u ++;
-                               *d ++ = *y ++;
-                               *d ++ = *v ++;
-                       }
-
-                       Y += width;
-                       U += width / 2;
-                       V += width / 2;
-               }
-       }
-       else 
-       {
-               AVPicture input;
-               AVPicture output;
-               avpicture_fill( &output, out, out_fmt, width, height );
-               avpicture_fill( &input, in, in_fmt, width, height );
-               img_convert( &output, out_fmt, &input, in_fmt, width, height );
-       }
+       AVPicture input;
+       AVPicture output;
+       avpicture_fill( &output, out, out_fmt, width, height );
+       avpicture_fill( &input, in, in_fmt, width, height );
+       img_convert( &output, out_fmt, &input, in_fmt, width, height );
 }
 
 /** Do it :-).
index 84f9cb929beaaa9702c8ede1f84264831ddb4cba..b071f6efa072f3f965485310216f70593c006ba2 100644 (file)
@@ -304,7 +304,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, writable );
 
        // Check that we want progressive and we aren't already progressive
-       if ( deinterlace && *format == mlt_image_yuv422 && *image != NULL )
+       if ( deinterlace && *format == mlt_image_yuv422 && *image != NULL && !mlt_properties_get_int( MLT_FRAME_PROPERTIES( this ), "progressive" ) )
        {
                // Create a picture
                AVPicture *output = mlt_pool_alloc( sizeof( AVPicture ) );
index b589468b0239c8b6d5415cacd54d5ba23b68aefb..8cbdad442c20077ba6d62422e78cf2354e18b1f8 100644 (file)
@@ -344,51 +344,7 @@ static double producer_time_of_frame( mlt_producer this, mlt_position position )
 
 static inline void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, mlt_image_format format, int width, int height )
 {
-       // EXPERIMENTAL IMAGE NORMALISATIONS
-       if ( pix_fmt == PIX_FMT_YUV420P && format == mlt_image_yuv422 )
-       {
-               register int i, j;
-               register int half = width >> 1;
-               register uint8_t *Y = ( ( AVPicture * )frame )->data[ 0 ];
-               register uint8_t *U = ( ( AVPicture * )frame )->data[ 1 ];
-               register uint8_t *V = ( ( AVPicture * )frame )->data[ 2 ];
-               register uint8_t *d = buffer;
-               register uint8_t *y, *u, *v;
-
-               i = height >> 1;
-               while ( i -- )
-               {
-                       y = Y;
-                       u = U;
-                       v = V;
-                       j = half;
-                       while ( j -- )
-                       {
-                               *d ++ = *y ++;
-                               *d ++ = *u ++;
-                               *d ++ = *y ++;
-                               *d ++ = *v ++;
-                       }
-
-                       Y += ( ( AVPicture * )frame )->linesize[ 0 ];
-                       y = Y;
-                       u = U;
-                       v = V;
-                       j = half;
-                       while ( j -- )
-                       {
-                               *d ++ = *y ++;
-                               *d ++ = *u ++;
-                               *d ++ = *y ++;
-                               *d ++ = *v ++;
-                       }
-
-                       Y += ( ( AVPicture * )frame )->linesize[ 0 ];
-                       U += ( ( AVPicture * )frame )->linesize[ 1 ];
-                       V += ( ( AVPicture * )frame )->linesize[ 2 ];
-               }
-       }
-       else if ( format == mlt_image_yuv420p )
+       if ( format == mlt_image_yuv420p )
        {
                AVPicture pict;
                pict.data[0] = buffer;
@@ -589,7 +545,6 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                                        {
                                                got_picture = 0;
                                        }
-                                       mlt_properties_set_int( properties, "top_field_first", av_frame->top_field_first );
                                }
                        }
 
@@ -600,6 +555,9 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                // Now handle the picture if we have one
                if ( got_picture )
                {
+                       mlt_properties_set_int( frame_properties, "progressive", !av_frame->interlaced_frame );
+                       mlt_properties_set_int( frame_properties, "top_field_first", av_frame->top_field_first );
+
                        convert_image( av_frame, *buffer, codec_context->pix_fmt, *format, *width, *height );
 
                        mlt_properties_set_data( frame_properties, "image", *buffer, size, (mlt_destructor)mlt_pool_release, NULL );