On 2013-05-06 14:42:39 +0300, Martin Storsjö wrote:
> On Mon, 6 May 2013, Janne Grunau wrote:
>
> > On 2013-04-27 09:38:31 +0200, Anton Khirnov wrote:
> >>
> >> Wouldn't it be more useful to have a function that swaps endianness?
> >> It could probably have a shorter name too.
> >
> > good idea, it's less special and works equally well for its intended use.
> >
> > Janne
> >
> > ---8<---
> > ---
> > libavutil/pixdesc.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
> > libavutil/pixdesc.h | 7 +++++++
> > libavutil/version.h | 2 +-
> > 3 files changed, 56 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> > index 67f9c43..6b49678 100644
> > --- a/libavutil/pixdesc.c
> > +++ b/libavutil/pixdesc.c
> > @@ -1512,3 +1512,51 @@ int av_pix_fmt_count_planes(enum AVPixelFormat
> > pix_fmt)
> > ret += planes[i];
> > return ret;
> > }
> > +
> > +
> > +enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
> > +{
> > +#define PIX_FMT_SWAP_ENDIANNESS(be, le)
> > \
> > + case AV_PIX_FMT_##be: return AV_PIX_FMT_##le;
> > \
> > + case AV_PIX_FMT_##le: return AV_PIX_FMT_##be
...
>
> Any specific reason not to factorize the BE/LE suffixes into it (just like
> in the macro in swscale)?
copied from native endianness macro in pixfmt.h, which needs both
parameters for RGBA and ABGR. I decided to ignore those here since they
swap component order instead of byte swapping component values.
I'll update the patch.
Janne
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel