[Ffmpeg-devel] [PATCH] convert libswscale to PIX_FMT_*
Luca Abeni
lucabe72
Wed Sep 13 23:06:00 CEST 2006
Hi Michael,
On Wed, 2006-09-13 at 14:56 +0200, Michael Niedermayer wrote:
[...]
> > +int fmt_depth(int fmt)
> > +{
>
> shouldnt that either be static or have a prefix?
Opss... Sorry; I converted it in a static inline, and moved it in
swscale_internal.h.
> > #if defined(ARCH_X86) || defined(ARCH_X86_64)
> > @@ -1509,15 +1543,73 @@
> > return srcSliceH;
> > }
> >
> > +/* 1:0, 4:1, 8:2, 15:3, 16:4, 24:6, 32:8 */
> > +static int fmt_id(int fmt)
> > +{
> > + switch (fmt) {
> > + case PIX_FMT_RGB32:
> > + case PIX_FMT_RGB32_1:
> > + case PIX_FMT_BGR32:
> > + case PIX_FMT_BGR32_1:
> > + return 8;
> > + case PIX_FMT_RGB24:
> > + case PIX_FMT_BGR24:
> > + return 6;
> > + case PIX_FMT_RGB565:
> > + case PIX_FMT_BGR565:
> > + return 4;
> > + case PIX_FMT_RGB555:
> > + case PIX_FMT_BGR555:
> > + return 3;
> > + case PIX_FMT_RGB8:
> > + case PIX_FMT_BGR8:
> > + return 2;
> > + case PIX_FMT_RGB4:
> > + case PIX_FMT_BGR4:
> > + return 1;
> > + case PIX_FMT_MONOBLACK:
> > + return 0;
>
> isnt that the same as fmt_depth()>>2 ?
You are right... I changed the calls to fmt_id() to fmt_depth >> 2. I
also changed fmt_bpp() in (fmt_depth() + 7) >> 3.
> except these patch ok, (commit it after fixing these if it works and there
> are no objectons from anyone else) (= no need to repost it with these 2
> minor things fixed)
Good, thanks. I will wait few days to see if anyone else has comments,
and if noone objects I will commit the patch in the weekend.
[...]
> > + case PIX_FMT_NV12:
> > + return "nv12";
> > + case PIX_FMT_NV21:
> > + return "nv21";
> > + default:
> > + return "Unknown format";
> > + }
> > }
>
> we really should add a small table to libavutil which contains these at
> some point in the future maybe something like
>
> typedef struct PixFmtInfo {
> const char *name;
> uint8_t flags;
> #define PIX_FMT_FLAG_YUV 1
> #define PIX_FMT_FLAG_PLANAR 2
> #define PIX_FMT_FLAG_16BIT 4
> #define PIX_FMT_FLAG_32BIT 8
> #define PIX_FMT_FLAG_ELEM_IS_SAMPLE 16 ///< each 8/16/32 bit element matches a sample
> #define PIX_FMT_FLAG_CHROMA_2NDX 32 ///< for packed 422 and NV12/NV21
> uint8_t log2_h_chroma_sub_sample;
> uint8_t log2_v_chroma_sub_sample;
> uint8_t sample_stride;
> uint8_t sample_pos[4];
> uint8_t mask[4]
> }
I had a similar idea; I'll look at it after the first patch will be in
(I am currently thinking about "splitting" the PixFmtInfo structure that
is currently in libavcodec into 2 structures - a small one in libavutil
and a second one in libavcodec. But I still have to better think at this
to see if it is a good idea).
Thanks,
Luca
More information about the ffmpeg-devel
mailing list