[Ffmpeg-devel] Removing img_format dependency from swscale

Luca Abeni lucabe72
Thu Aug 31 22:50:18 CEST 2006


Hi Michael,

thanks for the feedback

On Wed, 2006-08-30 at 16:49 +0200, Michael Niedermayer wrote:
[...] 
> > +#define isBGR(x)       ((x)==PIX_FMT_BGR32 || (x)==PIX_FMT_BGR24\
> > +			|| (x)==PIX_FMT_BGR565 || (x)==PIX_FMT_BGR555	\
> > +			|| (x)==PIX_FMT_BGR8 || (x)==PIX_FMT_BGR4	\
> > +			|| (x)==PIX_FMT_MONOBLACK)
> > +
> > +int fmt_depth(int fmt)
> > +{
> > +    switch(fmt) {
> > +        case PIX_FMT_BGRA:
> > +        case PIX_FMT_ABGR:
> > +        case PIX_FMT_RGBA:
> > +        case PIX_FMT_ARGB:
> > +            return 32;
> > +        case PIX_FMT_BGR24:
> > +        case PIX_FMT_RGB24:
> > +            return 24;
> > +        case PIX_FMT_BGR565:
> > +        case PIX_FMT_RGB565:
> > +            return 16;
> > +        case PIX_FMT_BGR555:
> > +        case PIX_FMT_RGB555:
> > +            return 15;
> > +        case PIX_FMT_BGR8:
> > +        case PIX_FMT_RGB8:
> > +            return 8;
> > +        case PIX_FMT_BGR4:
> > +        case PIX_FMT_RGB4:
> > +        case PIX_FMT_BGR4_BYTE:
> > +        case PIX_FMT_RGB4_BYTE:
> > +            return 4;
> > +        case PIX_FMT_MONOBLACK:
> > +            return 1;
> > +        default:
> > +            return 0;
> > +    }
> > +}
> 
> maybe libavcodec/imgconvert.c pix_fmt_info could be extended with this
> stuff
> currently theres a bits per channel in it but no
> bytes per pixel and no "used" bits per pixel
Yes, I had the same idea... But pix_fmt_info is in libavcodec, and to
avoid creating a dependency on libavcodec I would need to move it in
libavutil. I still do not know if this is a good idea, so before
proposing to move something else from libavcodec to libavutil I tried to
implement fmt_depth(), isBGR() & friends without using pix_fmt_info.

I'll look into using pix_fmt_info after I will have figured out all the
other issues with libswscale


[...]
> > +        case PIX_FMT_RGB565:
> > +            return "rgb565";
> > +	case PIX_FMT_RGB555:
> 
> tabs vs. spaces ...
Opss... Sorry about that; since mplayer mixes tabs and spaces I forgot
to check my modifications before sending the patch.
I am fixing the problem


			Thanks,
				Luca





More information about the ffmpeg-devel mailing list