[Libav-user] imgutils.h decode dst buffer going from avpicture_fill to av_image_fill_arrays

ssshukla26 ssshukla26 at gmail.com
Fri Aug 19 12:54:37 EEST 2016


For example let suppose "decoder->dst_data[0]" has YUV buffer and its
alignment is 1.

-----------------------------------------------------------------------------------------------------------------------

//Allocate AVFrame data and linesize

av_image_alloc(avframe->data, avframe->linesize, 
    decoder->video_resolution.frame_width,
decoder->video_resolution.frame_height,
    AV_PIX_FMT_YUV420P, 1);


Below are the 3 methods to fill data array of avframe.

-----------------------------------------------------------------------------------------------------------------------

//1) if your Y, U, V buffers are contiguous and have the correct size, This
is deprecated
avpicture_fill((AVPicture*) avframe, decoder->dst_data[0], avframe->format,
avframe->width, avframe->height);

-----------------------------------------------------------------------------------------------------------------------

//2) if your Y, U, V buffers are non-contiguous, This is deprecated
// Initialize avframe->linesize
avpicture_fill((AVPicture*) avframe, NULL, avframe->format, avframe->width,
avframe->height);

//Set avframe->data pointers manually
avframe->data[0] = decoder->dst_data[0];//Y-Buffer
avframe->data[1] = decoder->dst_data[1];//U-Buffer
avframe->data[2] = decoder->dst_data[2];//V-Buffer

-----------------------------------------------------------------------------------------------------------------------

//3) Fill data array of avframe, as decoder->dst_data[0] alignment is 1 use
the same alignment.
av_image_fill_arrays(avframe->data, avframe->linesize, decoder->dst_data[0],
avframe->format, avframe->width, avframe->height, *1*);



--
View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-imgutils-h-decode-dst-buffer-going-from-avpicture-fill-to-av-image-fill-arrays-tp4662419p4662425.html
Sent from the libav-users mailing list archive at Nabble.com.


More information about the Libav-user mailing list