[FFmpeg-devel] [PATCH] Resize AVFilterBuffer data pointers, linesizes. Adjust pic refs to use only four.
Stefano Sabatini
stefano.sabatini-lala
Fri Jul 23 12:18:56 CEST 2010
On date Thursday 2010-07-22 21:59:50 -0700, S.N. Hemanth Meenakshisundaram encoded:
>
> >> avfilter.h | 4 ++--
> >> defaults.c | 16 +++++++++++-----
> >> 2 files changed, 13 insertions(+), 7 deletions(-)
> >> ea6500130cae103756bee2d2ddd8e23fc879fa3b 0001-Resize-AVFilterBuffer-data-pointers-linesizes.-Adjus.patch
> >> 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..4253bb3 100644
> >> --- a/libavfilter/defaults.c
> >> +++ b/libavfilter/defaults.c
> >> @@ -38,6 +38,8 @@ AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms,
> >> AVFilterPicRef *ref = av_mallocz(sizeof(AVFilterPicRef));
> >> int i, tempsize;
> >> char *buf;
> >> + /* first four plane pointers and last four linesizes are unused for video */
> >> + uint8_t *newpic = (uint8_t *)pic + 4*sizeof(uint8_t *);
> >>
> > this is a ugly hack, the first 4 plane pointers should be used for video
> >
> >
> > [...]
> >
>
> To fix this is it enough to pass the regular pic pointer as AVPicture *
> and then copy the linesizes to the right location? Or should I write
> versions of ff_fill_pointers and ff_fill_linesize that will fill the new
> AVFilterBuffer instead of AVPicture?
I believe we should make those functions more generic.
int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width);
->
int ff_fill_image_linesize(int linesize[4], enum PixelFormat pix_fmt, int width);
ff_fill_pointer() requires the linesizes to be already filled, so we
could have:
int ff_fill_image_data(int data[4], uint8_t *ptr, enum PixelFormat pix_fmt, int height, const int const linesize[4]);
BTW these new functions should be placed in libavcore, I suggest:
libavcore/imgutils.h
(but please feel free to suggest a name which sucks less), and make
libavcodec ff_fill_linesize() and ff_fill_pointer() depend on that.
Regards.
--
FFmpeg = Forgiving & Forgiving Magic Portable Extended Gem
More information about the ffmpeg-devel
mailing list