[FFmpeg-devel] [PATCH] Introduce av_fill_image_planesizes() (was: swscale-test: add md5 output)

Michael Niedermayer michaelni
Wed Sep 22 23:31:10 CEST 2010


On Wed, Sep 15, 2010 at 07:19:28PM -0300, Ramiro Polla wrote:
> On Tue, Sep 14, 2010 at 12:53 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Tue, Sep 14, 2010 at 12:47:24PM -0300, Ramiro Polla wrote:
> >> On Tue, Sep 14, 2010 at 12:18 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> >> > On Mon, Sep 13, 2010 at 11:25:23PM -0300, Ramiro Polla wrote:
> >> >> On Thu, Sep 9, 2010 at 12:53 PM, Ramiro Polla <ramiro.polla at gmail.com> wrote:
> >> >> > On Wed, Sep 8, 2010 at 11:52 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> >> >> >> On Sat, Sep 04, 2010 at 01:56:42PM -0300, Ramiro Polla wrote:
> >> >> >> [...]
> >> >> >>> @@ -93,6 +93,18 @@ int av_fill_image_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh
> >> >> >>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? uint8_t *ptr, const int linesizes[4]);
> >> >> >>>
> >> >> >>> ?/**
> >> >> >>> + * Fill plane sizes for an image with pixel format pix_fmt and height height.
> >> >> >>> + *
> >> >> >>> + * @param planesizes[4] array to be filled with the size for each image plane
> >> >> >>> + * @param linesizes[4] the array containing the linesize for each
> >> >> >>> + * plane, should be filled by av_fill_image_linesizes()
> >> >> >>> + * @return the size in bytes required for the image buffer, a negative
> >> >> >>> + * error code in case of failure
> >> >> >>> + */
> >> >> >>> +int av_fill_image_planesizes(int planesizes[4], enum PixelFormat pix_fmt, int height,
> >> >> >>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? const int linesizes[4]);
> >> >> >>> +
> >> >> >>
> >> >> >> this needs to be updated to the hierachical naming
> >> >> >
> >> >> > Updated.
> >> >>
> >> >> use_* patch updated. add_* patch remains the same.
> >> >
> >> >> ?swscale-test.c | ? 58 +++++++++++++++++++++++++++++++--------------------------
> >> >> ?1 file changed, 32 insertions(+), 26 deletions(-)
> >> >> dc7bd92cc3ed41386e90ff1037173e271468dbed ?use_av_image_fill_planesizes_2.diff
> >> >
> >> > am i confused or is a patch that is supposed to simplify code making it
> >> > bigger?
> >>
> >> It's more correct:
> >> - ? ? ? ?if (dstStride[i])
> >> - ? ? ? ? ? ?dst[i]= av_mallocz(dstStride[i]*dstH+16);
> >> - ? ? ? ?if (dstStride[i] && !dst[i]) {
> >> + ? ? ? ?if (dst_planesizes[i])
> >> + ? ? ? ? ? ?dst[i]= av_mallocz(dst_planesizes[i]+16);
> >> + ? ? ? ?if (dst_planesizes[i] && !dst[i]) {
> >>
> >> The current code makes no distinction of height for chroma planes.
> >> Sure we could >>1 here and there but with av_image_fill_planesizes()
> >
> > that would be +1>>1
> 
> > anyway, do as you prefer if this is just about pedantic correctness
> 
> does that also go for adding the function? (updated here with minor
> bump and doc/APIchanges entry)

>  doc/APIchanges       |    3 +++
>  libavcore/avcore.h   |    2 +-
>  libavcore/imgutils.c |   23 +++++++++++++++++++----
>  libavcore/imgutils.h |   12 ++++++++++++
>  4 files changed, 35 insertions(+), 5 deletions(-)
> f781b802c36a7541868bc05f89fcc82aeeadc12c  add_av_image_fill_planesizes_2.diff
> Index: doc/APIchanges
> ===================================================================
> --- doc/APIchanges	(revision 25126)
> +++ doc/APIchanges	(working copy)
> @@ -13,6 +13,9 @@ libavutil:   2009-03-08
>  
>  API changes, most recent first:
>  
> +2010-09-xx - rxxxxx - lavcore 0.10.0 - imgutils.h
> +  Add function av_fill_image_planesizes(), declared in libavcore/imgutils.h.
> +
>  2010-09-08 - r25076 - lavu 50.26.0 - av_get_cpu_flags()
>    Add av_get_cpu_flags().
>  
> Index: libavcore/imgutils.h
> ===================================================================
> --- libavcore/imgutils.h	(revision 25126)
> +++ libavcore/imgutils.h	(working copy)
> @@ -101,6 +101,18 @@ void av_image_copy(uint8_t *dst_data[4], int dst_l
>                     enum PixelFormat pix_fmt, int width, int height);
>  
>  /**
> + * Fill plane sizes for an image with pixel format pix_fmt and height height.
> + *
> + * @param planesizes[4] array to be filled with the size for each image plane
> + * @param linesizes[4] the array containing the linesize for each
> + * plane, should be filled by av_image_fill_linesizes()
> + * @return the size in bytes required for the image buffer, a negative
> + * error code in case of failure

in/out should be marked with proper syntax
something shoudl be said about with what goal it chooses linesizes
alignemnt ans such

That said iam not too happy about this api bloat with odd wrapers

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100922/80d08067/attachment.pgp>



More information about the ffmpeg-devel mailing list