Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37578451
en ru br
ALT Linux repositórios
S:7.16.0-alt1

Group :: Vídeo
RPM: mlt7

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: alt-libav.patch
Download


--- a/src/modules/avformat/filter_avcolour_space.c
+++ b/src/modules/avformat/filter_avcolour_space.c
@@ -124,26 +124,18 @@ static int set_luma_transfer( struct Sws
 static int av_convert_image( uint8_t *out, uint8_t *in, int out_fmt, int in_fmt,
 	int width, int height, int src_colorspace, int dst_colorspace, int use_full_range )
 {
-	uint8_t *in_data[4];
-	int in_stride[4];
-	uint8_t *out_data[4];
-	int out_stride[4];
+	AVPicture input;
+	AVPicture output;
 	int flags = SWS_BICUBIC | SWS_ACCURATE_RND;
 	int error = -1;
 
-	if ( out_fmt == AV_PIX_FMT_YUYV422 || out_fmt == AV_PIX_FMT_YUV422P16LE )
+	if ( out_fmt == AV_PIX_FMT_YUYV422 )
 		flags |= SWS_FULL_CHR_H_INP;
 	else
 		flags |= SWS_FULL_CHR_H_INT;
 
-	if ( in_fmt == AV_PIX_FMT_YUV422P16LE )
-		mlt_image_format_planes(mlt_image_yuv422p16, width, height, in, in_data, in_stride);
-	else
-		av_image_fill_arrays(in_data, in_stride, in, in_fmt, width, height, IMAGE_ALIGN);
-	if ( out_fmt == AV_PIX_FMT_YUV422P16LE )
-		mlt_image_format_planes(mlt_image_yuv422p16, width, height, out, out_data, out_stride);
-	else
-		av_image_fill_arrays(out_data, out_stride, out, out_fmt, width, height, IMAGE_ALIGN);
+	avpicture_fill( &input, in, in_fmt, width, height );
+	avpicture_fill( &output, out, out_fmt, width, height );
 	struct SwsContext *context = sws_getContext( width, height, in_fmt,
 		width, height, out_fmt, flags, NULL, NULL, NULL);
 	if ( context )
@@ -152,8 +144,8 @@ static int av_convert_image( uint8_t *ou
 		if ( out_fmt == AV_PIX_FMT_RGB24 || out_fmt == AV_PIX_FMT_RGBA )
 			dst_colorspace = 601;
 		error = set_luma_transfer( context, src_colorspace, dst_colorspace, use_full_range );
-		sws_scale(context, (const uint8_t* const*) in_data, in_stride, 0, height,
-			out_data, out_stride);
+		sws_scale( context, (const uint8_t* const*) input.data, input.linesize, 0, height,
+			output.data, output.linesize);
 		sws_freeContext( context );
 	}
 	return error;
@@ -183,7 +175,7 @@ static int convert_image( mlt_frame fram
 
 		int in_fmt = convert_mlt_to_av_cs( *format );
 		int out_fmt = convert_mlt_to_av_cs( output_format );
-		int size = FFMAX( av_image_get_buffer_size(out_fmt, width, height, IMAGE_ALIGN),
+		int size = FFMAX( avpicture_get_size(out_fmt, width, height),
 			mlt_image_format_size( output_format, width, height, NULL ) );
 		uint8_t *output = mlt_pool_alloc( size );
 
--- a/src/modules/avformat/filter_avdeinterlace.c
+++ b/src/modules/avformat/filter_avdeinterlace.c
@@ -231,8 +231,8 @@ static inline void deinterlace_bottom_fi
 
 
 /* deinterlace - if not supported return -1 */
-static int mlt_avpicture_deinterlace(uint8_t *dst_data[4], int dst_stride[4],
-	uint8_t *src_data[4], int src_stride[4], int pix_fmt, int width, int height)
+static int mlt_avpicture_deinterlace(AVPicture *dst, const AVPicture *src,
+                          int pix_fmt, int width, int height)
 {
     int i;
 
@@ -240,12 +240,12 @@ static int mlt_avpicture_deinterlace(uin
         pix_fmt != AV_PIX_FMT_YUV422P &&
         pix_fmt != AV_PIX_FMT_YUYV422 &&
         pix_fmt != AV_PIX_FMT_YUV444P &&
-        pix_fmt != AV_PIX_FMT_YUV411P)
+	pix_fmt != AV_PIX_FMT_YUV411P)
         return -1;
     if ((width & 3) != 0 || (height & 3) != 0)
         return -1;
 
-    if ( pix_fmt != AV_PIX_FMT_YUYV422 )
+	if ( pix_fmt != AV_PIX_FMT_YUYV422 )
 	{
       for(i=0;i<3;i++) {
           if (i == 1) {
@@ -264,23 +264,23 @@ static int mlt_avpicture_deinterlace(uin
                   break;
               }
           }
-          if (src_data[0] == dst_data[0]) {
-              deinterlace_bottom_field_inplace(dst_data[i], dst_stride[i],
+          if (src == dst) {
+              deinterlace_bottom_field_inplace(dst->data[i], dst->linesize[i],
                                    width, height);
           } else {
-              deinterlace_bottom_field(dst_data[i], dst_stride[i],
-                                          src_data[i], src_stride[i],
+              deinterlace_bottom_field(dst->data[i],dst->linesize[i],
+                                          src->data[i], src->linesize[i],
                                           width, height);
           }
 	  }
     }
 	else {
-      if (src_data[0] == dst_data[0]) {
-          deinterlace_bottom_field_inplace(dst_data[0], dst_stride[0],
+      if (src == dst) {
+          deinterlace_bottom_field_inplace(dst->data[0], dst->linesize[0],
                                width<<1, height);
       } else {
-          deinterlace_bottom_field(dst_data[0], dst_stride[0],
-                                      src_data[0], src_stride[0],
+          deinterlace_bottom_field(dst->data[0],dst->linesize[0],
+                                      src->data[0], src->linesize[0],
                                       width<<1, height);
       }
 	}
@@ -311,14 +311,14 @@ static int filter_get_image( mlt_frame f
 	if ( deinterlace && *format == mlt_image_yuv422 && *image != NULL && !mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), "progressive" ) )
 	{
 		// Create a picture
-		uint8_t *image_data[4];
-		int strides[4];
+		AVPicture *output = mlt_pool_alloc( sizeof( AVPicture ) );
 
 		// Fill the picture
-		av_image_fill_arrays(image_data, strides, *image, AV_PIX_FMT_YUYV422, *width, *height, 1);
-		mlt_log_timings_begin();
-		mlt_avpicture_deinterlace( image_data, strides, image_data, strides, AV_PIX_FMT_YUYV422, *width, *height );
-		mlt_log_timings_end( NULL, "mlt_avpicture_deinterlace" );
+		avpicture_fill( output, *image, AV_PIX_FMT_YUYV422, *width, *height );
+		mlt_avpicture_deinterlace( output, output, AV_PIX_FMT_YUYV422, *width, *height );
+
+		// Free the picture
+		mlt_pool_release( output );
 
 		// Make sure that others know the frame is deinterlaced
 		mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "progressive", 1 );
--- a/src/modules/avformat/producer_avformat.c
+++ b/src/modules/avformat/producer_avformat.c
@@ -1442,26 +1442,24 @@ static int convert_image( producer_avfor
 	{
 		struct SwsContext *context = sws_getContext( width, height, src_pix_fmt,
 			width, height, AV_PIX_FMT_RGB24, flags | SWS_FULL_CHR_H_INT, NULL, NULL, NULL);
-		uint8_t *out_data[4];
-		int out_stride[4];
-		av_image_fill_arrays(out_data, out_stride, buffer, AV_PIX_FMT_RGB24, width, height, IMAGE_ALIGN);
+		AVPicture output;
+		avpicture_fill( &output, buffer, AV_PIX_FMT_RGB24, width, height );
 		// libswscale wants the RGB colorspace to be SWS_CS_DEFAULT, which is = SWS_CS_ITU601.
 		set_luma_transfer( context, self->yuv_colorspace, 601, self->full_luma, 0 );
 		sws_scale( context, (const uint8_t* const*) frame->data, frame->linesize, 0, height,
-			out_data, out_stride);
+			output.data, output.linesize);
 		sws_freeContext( context );
 	}
 	else if ( *format == mlt_image_rgb24a || *format == mlt_image_opengl )
 	{
 		struct SwsContext *context = sws_getContext( width, height, src_pix_fmt,
 			width, height, AV_PIX_FMT_RGBA, flags | SWS_FULL_CHR_H_INT, NULL, NULL, NULL);
-		uint8_t *out_data[4];
-		int out_stride[4];
-		av_image_fill_arrays(out_data, out_stride, buffer, AV_PIX_FMT_RGBA, width, height, IMAGE_ALIGN);
+		AVPicture output;
+		avpicture_fill( &output, buffer, AV_PIX_FMT_RGBA, width, height );
 		// libswscale wants the RGB colorspace to be SWS_CS_DEFAULT, which is = SWS_CS_ITU601.
 		set_luma_transfer( context, self->yuv_colorspace, 601, self->full_luma, 0 );
 		sws_scale( context, (const uint8_t* const*) frame->data, frame->linesize, 0, height,
-			out_data, out_stride);
+			output.data, output.linesize);
 		sws_freeContext( context );
 	}
 	else
@@ -1480,7 +1478,7 @@ static int convert_image( producer_avfor
 			.src_full_range = self->full_luma,
 			.dst_full_range = 0,
 		};
-#if defined(FFUDIV) && (LIBAVFORMAT_VERSION_INT >= ((55<<16)+(48<<8)+100))
+#if 0
 		ctx.src_format = src_pix_fmt;
 #else
 		ctx.src_format = pix_fmt;
--- a/src/modules/avformat/filter_swscale.c
+++ b/src/modules/avformat/filter_swscale.c
@@ -90,8 +90,9 @@ static int filter_scale( mlt_frame frame
 		interp = SWS_SPLINE;
 	interp |= SWS_ACCURATE_RND;
 
-	// Determine the output image size.
-	int out_size = mlt_image_format_size( *format, owidth, oheight, NULL );
+	// Determine the bytes per pixel
+	int bpp;
+	mlt_image_format_size( *format, 0, 0, &bpp );
 
 	// Set swscale flags to get good quality
 	switch ( *format )
@@ -115,28 +116,25 @@ static int filter_scale( mlt_frame frame
 	int avformat = convert_mlt_to_av_cs( *format );
 
 	// Fill out the AVPictures
-	uint8_t *in_data[4];
-	int in_stride[4];
-	uint8_t *out_data[4];
-	int out_stride[4];
-	uint8_t *outbuf = mlt_pool_alloc( out_size );
-
-	av_image_fill_arrays(in_data, in_stride, *image, avformat, iwidth, iheight, IMAGE_ALIGN);
-	av_image_fill_arrays(out_data, out_stride, outbuf, avformat, owidth, oheight, IMAGE_ALIGN);
+	AVPicture input;
+	AVPicture output;
+	uint8_t *outbuf = mlt_pool_alloc( owidth * ( oheight + 1 ) * bpp );
+	avpicture_fill( &input, *image, avformat, iwidth, iheight );
+	avpicture_fill( &output, outbuf, avformat, owidth, oheight );
 
 	// Create the context and output image
 	struct SwsContext *context = sws_getContext( iwidth, iheight, avformat, owidth, oheight, avformat, interp, NULL, NULL, NULL);
 	if ( context )
 	{
 		// Perform the scaling
-		sws_scale( context, (const uint8_t **) in_data, in_stride, 0, iheight, out_data, out_stride);
+		sws_scale( context, (const uint8_t* const*) input.data, input.linesize, 0, iheight, output.data, output.linesize);
 		sws_freeContext( context );
 	
 		// Now update the frame
-		mlt_frame_set_image( frame, outbuf, out_size, mlt_pool_release );
+		mlt_frame_set_image( frame, output.data[0], owidth * ( oheight + 1 ) * bpp, mlt_pool_release );
 	
 		// Return the output
-		*image = outbuf;
+		*image = output.data[0];
 	
 		// Scale the alpha channel only if exists and not correct size
 		int alpha_size = 0;
@@ -149,16 +147,16 @@ static int filter_scale( mlt_frame frame
 			{
 				avformat = AV_PIX_FMT_GRAY8;
 				struct SwsContext *context = sws_getContext( iwidth, iheight, avformat, owidth, oheight, avformat, interp, NULL, NULL, NULL);
+				avpicture_fill( &input, alpha, avformat, iwidth, iheight );
 				outbuf = mlt_pool_alloc( owidth * oheight );
-				av_image_fill_arrays(in_data, in_stride, alpha, avformat, iwidth, iheight, IMAGE_ALIGN);
-				av_image_fill_arrays(out_data, out_stride, outbuf, avformat, owidth, oheight, IMAGE_ALIGN);
+				avpicture_fill( &output, outbuf, avformat, owidth, oheight );
 	
 				// Perform the scaling
-				sws_scale( context, (const uint8_t **) in_data, in_stride, 0, iheight, out_data, out_stride);
+				sws_scale( context, (const uint8_t* const*) input.data, input.linesize, 0, iheight, output.data, output.linesize);
 				sws_freeContext( context );
 	
 				// Set it back on the frame
-				mlt_frame_set_alpha( frame, outbuf, owidth * oheight, mlt_pool_release );
+				mlt_frame_set_alpha( frame, output.data[0], owidth * oheight, mlt_pool_release );
 			}
 		}
 	
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009