Commit 6b0768e2 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Clean up swscale pixfmt macros using av_pix_fmt_descriptors[].

parent bd97b2e1
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
*/ */
#define LIBAVUTIL_VERSION_MAJOR 51 #define LIBAVUTIL_VERSION_MAJOR 51
#define LIBAVUTIL_VERSION_MINOR 18 #define LIBAVUTIL_VERSION_MINOR 19
#define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
......
This diff is collapsed.
...@@ -87,6 +87,8 @@ typedef struct AVPixFmtDescriptor{ ...@@ -87,6 +87,8 @@ typedef struct AVPixFmtDescriptor{
#define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette. #define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette.
#define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end. #define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end.
#define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format. #define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format.
#define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane
#define PIX_FMT_RGB 32 ///< The pixel format contains RGB-like data (as opposed to YUV/grayscale)
/** /**
* The array of all the pixel format descriptors. * The array of all the pixel format descriptors.
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#include "libavutil/log.h" #include "libavutil/log.h"
#include "libavutil/pixfmt.h" #include "libavutil/pixfmt.h"
#include "libavutil/pixdesc.h"
#define STR(s) AV_TOSTRING(s) //AV_STRINGIFY is too long #define STR(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
...@@ -520,83 +521,31 @@ void ff_bfin_get_unscaled_swscale(SwsContext *c); ...@@ -520,83 +521,31 @@ void ff_bfin_get_unscaled_swscale(SwsContext *c);
const char *sws_format_name(enum PixelFormat format); const char *sws_format_name(enum PixelFormat format);
//FIXME replace this with something faster #define is16BPS(x) \
#define is16BPS(x) ( \ (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 15)
(x)==PIX_FMT_GRAY16BE \
|| (x)==PIX_FMT_GRAY16LE \ #define is9_OR_10BPS(x) \
|| (x)==PIX_FMT_BGR48BE \ (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 8 || \
|| (x)==PIX_FMT_BGR48LE \ av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 9)
|| (x)==PIX_FMT_RGB48BE \
|| (x)==PIX_FMT_RGB48LE \ #define isBE(x) \
|| (x)==PIX_FMT_YUV420P16LE \ (av_pix_fmt_descriptors[x].flags & PIX_FMT_BE)
|| (x)==PIX_FMT_YUV422P16LE \
|| (x)==PIX_FMT_YUV444P16LE \ #define isYUV(x) \
|| (x)==PIX_FMT_YUV420P16BE \ (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB) && \
|| (x)==PIX_FMT_YUV422P16BE \ av_pix_fmt_descriptors[x].nb_components >= 2)
|| (x)==PIX_FMT_YUV444P16BE \
) #define isPlanarYUV(x) \
#define is9_OR_10BPS(x) ( \ ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR) && \
(x)==PIX_FMT_YUV420P9LE \ isYUV(x))
|| (x)==PIX_FMT_YUV420P9BE \
|| (x)==PIX_FMT_YUV422P9LE \ #define isRGB(x) \
|| (x)==PIX_FMT_YUV422P9BE \ (av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB)
|| (x)==PIX_FMT_YUV444P9BE \
|| (x)==PIX_FMT_YUV444P9LE \ #define isGray(x) \
|| (x)==PIX_FMT_YUV422P10BE \ (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) && \
|| (x)==PIX_FMT_YUV422P10LE \ av_pix_fmt_descriptors[x].nb_components <= 2)
|| (x)==PIX_FMT_YUV444P10BE \
|| (x)==PIX_FMT_YUV444P10LE \
|| (x)==PIX_FMT_YUV420P10LE \
|| (x)==PIX_FMT_YUV420P10BE \
)
#define isBE(x) ((x)&1)
#define isPlanar8YUV(x) ( \
(x)==PIX_FMT_YUV410P \
|| (x)==PIX_FMT_YUV420P \
|| (x)==PIX_FMT_YUVA420P \
|| (x)==PIX_FMT_YUV411P \
|| (x)==PIX_FMT_YUV422P \
|| (x)==PIX_FMT_YUV444P \
|| (x)==PIX_FMT_YUV440P \
|| (x)==PIX_FMT_NV12 \
|| (x)==PIX_FMT_NV21 \
)
#define isPlanarYUV(x) ( \
isPlanar8YUV(x) \
|| (x)==PIX_FMT_YUV420P9LE \
|| (x)==PIX_FMT_YUV422P9LE \
|| (x)==PIX_FMT_YUV444P9LE \
|| (x)==PIX_FMT_YUV420P10LE \
|| (x)==PIX_FMT_YUV422P10LE \
|| (x)==PIX_FMT_YUV444P10LE \
|| (x)==PIX_FMT_YUV420P16LE \
|| (x)==PIX_FMT_YUV422P16LE \
|| (x)==PIX_FMT_YUV444P16LE \
|| (x)==PIX_FMT_YUV420P9BE \
|| (x)==PIX_FMT_YUV422P9BE \
|| (x)==PIX_FMT_YUV444P9BE \
|| (x)==PIX_FMT_YUV420P10BE \
|| (x)==PIX_FMT_YUV422P10BE \
|| (x)==PIX_FMT_YUV444P10BE \
|| (x)==PIX_FMT_YUV420P16BE \
|| (x)==PIX_FMT_YUV422P16BE \
|| (x)==PIX_FMT_YUV444P16BE \
)
#define isYUV(x) ( \
(x)==PIX_FMT_UYVY422 \
|| (x)==PIX_FMT_YUYV422 \
|| isPlanarYUV(x) \
)
#define isGray(x) ( \
(x)==PIX_FMT_GRAY8 \
|| (x)==PIX_FMT_Y400A \
|| (x)==PIX_FMT_GRAY16BE \
|| (x)==PIX_FMT_GRAY16LE \
)
#define isGray16(x) ( \
(x)==PIX_FMT_GRAY16BE \
|| (x)==PIX_FMT_GRAY16LE \
)
#define isRGBinInt(x) ( \ #define isRGBinInt(x) ( \
(x)==PIX_FMT_RGB48BE \ (x)==PIX_FMT_RGB48BE \
|| (x)==PIX_FMT_RGB48LE \ || (x)==PIX_FMT_RGB48LE \
...@@ -633,39 +582,18 @@ const char *sws_format_name(enum PixelFormat format); ...@@ -633,39 +582,18 @@ const char *sws_format_name(enum PixelFormat format);
|| (x)==PIX_FMT_MONOBLACK \ || (x)==PIX_FMT_MONOBLACK \
|| (x)==PIX_FMT_MONOWHITE \ || (x)==PIX_FMT_MONOWHITE \
) )
#define isRGBinBytes(x) ( \
(x)==PIX_FMT_RGB48BE \
|| (x)==PIX_FMT_RGB48LE \
|| (x)==PIX_FMT_RGBA \
|| (x)==PIX_FMT_ARGB \
|| (x)==PIX_FMT_RGB24 \
)
#define isBGRinBytes(x) ( \
(x)==PIX_FMT_BGR48BE \
|| (x)==PIX_FMT_BGR48LE \
|| (x)==PIX_FMT_BGRA \
|| (x)==PIX_FMT_ABGR \
|| (x)==PIX_FMT_BGR24 \
)
#define isAnyRGB(x) ( \ #define isAnyRGB(x) ( \
isRGBinInt(x) \ isRGBinInt(x) \
|| isBGRinInt(x) \ || isBGRinInt(x) \
) )
#define isALPHA(x) ( \ #define isALPHA(x) \
(x)==PIX_FMT_BGR32 \ (av_pix_fmt_descriptors[x].nb_components == 2 || \
|| (x)==PIX_FMT_BGR32_1 \ av_pix_fmt_descriptors[x].nb_components == 4)
|| (x)==PIX_FMT_RGB32 \
|| (x)==PIX_FMT_RGB32_1 \ #define isPacked(x) \
|| (x)==PIX_FMT_Y400A \ (av_pix_fmt_descriptors[x].nb_components >= 2 && \
|| (x)==PIX_FMT_YUVA420P \ !(av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR))
)
#define isPacked(x) ( \
(x)==PIX_FMT_PAL8 \
|| (x)==PIX_FMT_YUYV422 \
|| (x)==PIX_FMT_UYVY422 \
|| (x)==PIX_FMT_Y400A \
|| isAnyRGB(x) \
)
#define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_Y400A) #define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_Y400A)
extern const uint64_t ff_dither4[2]; extern const uint64_t ff_dither4[2];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment