Mercurial > mplayer.hg
diff libswscale/swscale_internal.h @ 19872:8e50cba9fe03
Remove the dependency of libswscale on img_format.h
author | lucabe |
---|---|
date | Sun, 17 Sep 2006 15:15:13 +0000 |
parents | 4678e9f81334 |
children | aca9e9783f67 |
line wrap: on
line diff
--- a/libswscale/swscale_internal.h Sun Sep 17 15:06:28 2006 +0000 +++ b/libswscale/swscale_internal.h Sun Sep 17 15:15:13 2006 +0000 @@ -173,4 +173,52 @@ char *sws_format_name(int format); +//FIXME replace this with something faster +#define isPlanarYUV(x) ((x)==PIX_FMT_YUV410P || (x)==PIX_FMT_YUV420P \ + || (x)==PIX_FMT_YUV411P || (x)==PIX_FMT_YUV422P \ + || (x)==PIX_FMT_YUV444P || (x)==PIX_FMT_NV12 \ + || (x)==PIX_FMT_NV21) +#define isYUV(x) ((x)==PIX_FMT_UYVY422 || (x)==PIX_FMT_YUYV422 || isPlanarYUV(x)) +#define isGray(x) ((x)==PIX_FMT_GRAY8) +#define isRGB(x) ((x)==PIX_FMT_BGR32 || (x)==PIX_FMT_RGB24 \ + || (x)==PIX_FMT_RGB565 || (x)==PIX_FMT_RGB555 \ + || (x)==PIX_FMT_RGB8 || (x)==PIX_FMT_RGB4 \ + || (x)==PIX_FMT_MONOBLACK) +#define isBGR(x) ((x)==PIX_FMT_RGB32 || (x)==PIX_FMT_BGR24 \ + || (x)==PIX_FMT_BGR565 || (x)==PIX_FMT_BGR555 \ + || (x)==PIX_FMT_BGR8 || (x)==PIX_FMT_BGR4 \ + || (x)==PIX_FMT_MONOBLACK) + +static inline 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; + } +} + #endif