[FFmpeg-devel] [PATCH] Resize AVFilterBuffer and use ff_fill_image* functions to fill in video buffer linesizes & data
Stefano Sabatini
stefano.sabatini-lala
Mon Jul 26 00:42:04 CEST 2010
On date Sunday 2010-07-25 15:28:36 -0700, S.N. Hemanth Meenakshisundaram encoded:
> Resize AVFilterBuffer to hold 8 planes/linesizes worth of data and
> modify avfilter_get_video_buffer to use only first four data pointers
> and linesizes in AVFilterBuffer. Call the new ff_fill_image* functions
>
> ---
> libavfilter/avfilter.h | 4 ++--
> libavfilter/defaults.c | 6 +++---
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
>
>
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 066bdc3..a9bec02 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -66,8 +66,8 @@ typedef struct AVFilterPad AVFilterPad;
> */
> typedef struct AVFilterBuffer
> {
> - uint8_t *data[4]; ///< buffer data for each plane
> - int linesize[4]; ///< number of bytes per line
> + uint8_t *data[8]; ///< buffer data for each plane
> + int linesize[8]; ///< number of bytes per line
> int format; ///< media format
>
> unsigned refcount; ///< number of references to this buffer
> diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
> index 27c8a3b..4104034 100644
> --- a/libavfilter/defaults.c
> +++ b/libavfilter/defaults.c
> @@ -49,15 +49,15 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms,
> pic->refcount = 1;
> pic->format = link->format;
> pic->free = avfilter_default_free_buffer;
> - ff_fill_linesize((AVPicture *)pic, pic->format, ref->w);
> + ff_fill_image_linesize(pic->linesize, pic->format, ref->w);
>
> for (i=0; i<4;i++)
> pic->linesize[i] = FFALIGN(pic->linesize[i], 16);
>
> - tempsize = ff_fill_pointer((AVPicture *)pic, NULL, pic->format, ref->h);
> + tempsize = ff_fill_image_data_ptr(pic->data, NULL, pic->format, ref->h, pic->linesize);
> buf = av_malloc(tempsize + 16); // +2 is needed for swscaler, +16 to be
> // SIMD-friendly
> - ff_fill_pointer((AVPicture *)pic, buf, pic->format, ref->h);
> + ff_fill_image_data_ptr(pic->data, buf, pic->format, ref->h, pic->linesize);
>
> memcpy(ref->data, pic->data, sizeof(pic->data));
> memcpy(ref->linesize, pic->linesize, sizeof(pic->linesize));
Looks fine to me.
--
FFmpeg = Foolish and Furious Marvellous Pure Exploitable Glue
More information about the ffmpeg-devel
mailing list