[FFmpeg-devel] [PATCH] Resize data and linesize in AVFilterBufferRef to 8 and supporting changes

Stefano Sabatini stefano.sabatini-lala
Wed Aug 11 16:24:15 CEST 2010


On date Wednesday 2010-08-11 06:32:05 -0700, S.N. Hemanth Meenakshisundaram encoded:
> Resize patch calling new av_picture_data_copy
> 
> ---
>  ffplay.c                  |    5 +++--
>  libavfilter/avfilter.h    |    4 ++--
>  libavfilter/defaults.c    |    4 ++--
>  libavfilter/vsrc_buffer.c |    5 +++--
>  4 files changed, 10 insertions(+), 8 deletions(-)
> 
> 
> 

> diff --git a/ffplay.c b/ffplay.c
> index 58e54ce..b64ce86 100644
> --- a/ffplay.c
> +++ b/ffplay.c
> @@ -1672,8 +1672,9 @@ static int input_request_frame(AVFilterLink *link)
>          picref = avfilter_ref_buffer(priv->frame->opaque, ~0);
>      } else {
>          picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
> -        av_picture_copy((AVPicture *)&picref->data, (AVPicture *)priv->frame,
> -                        picref->format, link->w, link->h);
> +        av_picture_data_copy(picref->data, picref->linesize,
> +                             priv->frame->data, priv->frame->linesize,
> +                             picref->format, link->w, link->h);
>      }
>      av_free_packet(&pkt);
>  
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index e70bbc7..56455c5 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -114,8 +114,8 @@ typedef struct AVFilterBufferRefVideoProps
>  typedef struct AVFilterBufferRef
>  {
>      AVFilterBuffer *buf;                ///< the buffer that this is a reference to
> -    uint8_t *data[4];                   ///< picture data for each plane
> -    int linesize[4];                    ///< number of bytes per line
> +    uint8_t *data[8];                   ///< picture data for each plane
> +    int linesize[8];                    ///< number of bytes per line
>      int format;                         ///< media format
>  
>      int64_t pts;                        ///< presentation timestamp in units of 1/AV_TIME_BASE
> diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
> index 2140436..e275982 100644
> --- a/libavfilter/defaults.c
> +++ b/libavfilter/defaults.c
> @@ -60,8 +60,8 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per
>                                      // SIMD-friendly
>      av_fill_image_pointers(pic->data, ref->format, ref->video->h, buf, pic->linesize);
>  
> -    memcpy(ref->data,     pic->data,     4*sizeof(pic->data[0]));
> -    memcpy(ref->linesize, pic->linesize, 4*sizeof(pic->linesize[0]));
> +    memcpy(ref->data,     pic->data,     sizeof(ref->data));
> +    memcpy(ref->linesize, pic->linesize, sizeof(ref->linesize));
>  
>      return ref;
>  }
> diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
> index f4761f9..03cf5ec 100644
> --- a/libavfilter/vsrc_buffer.c
> +++ b/libavfilter/vsrc_buffer.c
> @@ -119,8 +119,9 @@ static int request_frame(AVFilterLink *link)
>                                         AV_PERM_REUSE2,
>                                         link->w, link->h);
>  
> -    av_picture_copy((AVPicture *)&picref->data, (AVPicture *)&c->frame,
> -                    picref->format, link->w, link->h);
> +    av_picture_data_copy(picref->data, picref->linesize,
> +                         c->frame.data, c->frame.linesize,
> +                         picref->format, link->w, link->h);
>  
>      picref->pts                    = c->pts;
>      picref->video->pixel_aspect    = c->pixel_aspect; 

Looks OK.
-- 
FFmpeg = Fantastic and Free Moronic Purposeless Exxagerate Goblin



More information about the ffmpeg-devel mailing list