[FFmpeg-devel] [PATCH] Define endian variant for PIX_FMT_RGB/BGR_5X5

Stefano Sabatini stefano.sabatini-lala
Wed Mar 18 23:44:58 CET 2009


On date Wednesday 2009-03-18 22:30:26 +0100, Michael Niedermayer encoded:
> On Tue, Mar 17, 2009 at 09:14:32PM +0100, Stefano Sabatini wrote:
[...]
> > Index: ffmpeg/libavcodec/avcodec.h
> > ===================================================================
> > --- ffmpeg.orig/libavcodec/avcodec.h	2009-03-17 21:06:43.000000000 +0100
> > +++ ffmpeg/libavcodec/avcodec.h	2009-03-17 21:09:56.000000000 +0100
> > @@ -2702,6 +2702,19 @@
> >  const char *avcodec_get_pix_fmt_name(int pix_fmt);
> >  void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
> >  enum PixelFormat avcodec_get_pix_fmt(const char* name);
> > +
> > +/**
> > + * Returns the pixel format corresponding to the name \p name.
> > + *
> > + * If \p search_ne_variant is zero works like avcodec_get_pix_fmt().
> > + * If \p search_ne_variant is non-zero and if there is no pixel format
> > + * with name \p name, then a pixel format with the name corresponding
> > + * to the native endian format of \p name is searched.  For example in
> > + * a little-endian system, first is looked "gray16", then "gray16le".
> > + *
> > + * Finally if both forms are not found, returns \c PIX_FMT_NONE.
> > + */
> > +enum PixelFormat avcodec_get_pix_fmt2(const char* name, int search_ne_variant);
> >  unsigned int avcodec_pix_fmt_to_codec_tag(enum PixelFormat p);
> >  
> >  #define FF_LOSS_RESOLUTION  0x0001 /**< loss due to resolution change */
> 
> i dont see why a API change would be needed if no be/le postfix is used then
> the machine endianness canbe filled in

Since we're changing the behaviour of avcodec_get_pix_fmt() then I think
it should be a new function, for example
avcodec_get_pix_fmt("gray16")

currently fails with PIX_FMT_NONE, extending it it would return
PIX_FMT_GRAY16XE

or we could break compatibility, although the likeliness that this
may create problems are very low.

Also I'd like to keep the simpler functionality of the old function
(it has no cost in term of code duplication, since the new function
calls the old one anyway).

[...]

Regards.
-- 
FFmpeg = Funny and Friendly Mortal Ponderous Excellent Gymnast




More information about the ffmpeg-devel mailing list