+ 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
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 :-).
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 ) );
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;
{
got_picture = 0;
}
- mlt_properties_set_int( properties, "top_field_first", av_frame->top_field_first );
}
}
// 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 );