[FFmpeg-devel] [PATCH] lavu/imgutils: create misc functions for dealing with buffers

Michael Niedermayer michaelni at gmx.at
Tue Jun 19 15:14:18 CEST 2012


On Tue, Jun 19, 2012 at 01:48:27PM +0200, Stefano Sabatini wrote:
> Move the lavc/imgconvert functions and rename them as follows:
> avpicture_get_size -> av_image_get_size()
> avpicture_fill     -> av_image_fill()
> avpicture_layout   -> av_image_fill_buffer()
> 
> The new functions have an align parameter, which allows to define the
> alignment buffer in the buffer (which is set or read).
[...]
> --- a/libavutil/imgutils.h
> +++ b/libavutil/imgutils.h
> @@ -117,6 +117,61 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
>                     enum PixelFormat pix_fmt, int width, int height);
>

>  /**
> + * Fill in the image data and linesizes from an image buffer.

Setup the data pointers and linesizes based on the specified picture
paramaters and the provided array.


> + *
> + * The fields of the given image are filled in by using the src
> + * address which points to the image data buffer. Depending on the
> + * specified pixel format, one or multiple image data pointers and
> + * line sizes will be set.  If a planar format is specified, several
> + * pointers will be set pointing to the different picture planes and
> + * the line sizes of the different planes will be stored in the
> + * lines_sizes array. Call with src == NULL to get the required
> + * size for the src buffer.
> + *
> + * To allocate the buffer and fill in the dst_data and dst_linesize in
> + * one call, use av_image_alloc().
> + *
> + * @param [out]dst_data      data pointers to be filled in
> + * @param [out]dst_linesizes linesizes for the image in dst_data to be filled in
> + * @param [in]src            buffer which will contain or contains the actual image data, can be NULL
> + * @param [in]pix_fmt        the pixel format of the image
> + * @param [in]width          the width of the image in pixels
> + * @param [in]height         the height of the image in pixels
> + * @param [in]align          the value used in src_buffer for linesize alignment
> + * @return the size in bytes required for the src_buffer, a negative
> + * error code in case of failure
> + */
> +int av_image_fill(uint8_t *dst_data[4], int dst_linesize[4],
> +                  const uint8_t *src,
> +                  enum PixelFormat pix_fmt, int width, int height, int align);
> +


> +/**
> + * Return the size in bytes of the amount of data required to store a
> + * given image.
> + *

> + * @param[in] align the assumed linesize for the image

this sounds odd


> + */
> +int av_image_get_size(enum PixelFormat pix_fmt, int width, int height, int align);
> +
> +/**
> + * Copy image data from an image into a buffer.

why is the function not called ...copy... ?


> + *
> + * @param[out] dst           a buffer into which picture data will be copied
> + * @param[in]  dst_size      the size in bytes of dst
> + * @param[in]  src_data      pointers containing the source image data


> + * @param[in]  src_linesizes linesizes for the image in src_data
[...]
> + * @param[in] align          the value assumed in src_buffer for linesize alignment

destination i would assume


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

You can kill me, but you cannot change the truth.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120619/cc6c5c5f/attachment.asc>


More information about the ffmpeg-devel mailing list