*/
#define LIBAVUTIL_VERSION_MAJOR 51
-#define LIBAVUTIL_VERSION_MINOR 18
+#define LIBAVUTIL_VERSION_MINOR 19
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUYV422] = {
.name = "yuyv422",
{0,2,2,0,7}, /* G */
{0,2,3,0,7}, /* B */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_BGR24] = {
.name = "bgr24",
{0,2,2,0,7}, /* G */
{0,2,3,0,7}, /* R */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_YUV422P] = {
.name = "yuv422p",
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV444P] = {
.name = "yuv444p",
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV410P] = {
.name = "yuv410p",
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV411P] = {
.name = "yuv411p",
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_GRAY8] = {
.name = "gray",
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUVJ422P] = {
.name = "yuvj422p",
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUVJ444P] = {
.name = "yuvj444p",
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_XVMC_MPEG2_MC] = {
.name = "xvmcmc",
{0,0,1,3,2}, /* G */
{0,0,1,0,2}, /* R */
},
- .flags = PIX_FMT_PAL,
+ .flags = PIX_FMT_PAL | PIX_FMT_RGB,
},
[PIX_FMT_BGR4] = {
.name = "bgr4",
{0,3,2,0,1}, /* G */
{0,3,4,0,0}, /* R */
},
- .flags = PIX_FMT_BITSTREAM,
+ .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
},
[PIX_FMT_BGR4_BYTE] = {
.name = "bgr4_byte",
{0,0,1,1,1}, /* G */
{0,0,1,0,0}, /* R */
},
- .flags = PIX_FMT_PAL,
+ .flags = PIX_FMT_PAL | PIX_FMT_RGB,
},
[PIX_FMT_RGB8] = {
.name = "rgb8",
{0,0,1,3,2}, /* G */
{0,0,1,0,2}, /* B */
},
- .flags = PIX_FMT_PAL,
+ .flags = PIX_FMT_PAL | PIX_FMT_RGB,
},
[PIX_FMT_RGB4] = {
.name = "rgb4",
{0,3,2,0,1}, /* G */
{0,3,4,0,0}, /* B */
},
- .flags = PIX_FMT_BITSTREAM,
+ .flags = PIX_FMT_BITSTREAM | PIX_FMT_RGB,
},
[PIX_FMT_RGB4_BYTE] = {
.name = "rgb4_byte",
{0,0,1,1,1}, /* G */
{0,0,1,0,0}, /* B */
},
- .flags = PIX_FMT_PAL,
+ .flags = PIX_FMT_PAL | PIX_FMT_RGB,
},
[PIX_FMT_NV12] = {
.name = "nv12",
{1,1,1,0,7}, /* U */
{1,1,2,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_NV21] = {
.name = "nv21",
{1,1,1,0,7}, /* V */
{1,1,2,0,7}, /* U */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_ARGB] = {
.name = "argb",
{0,3,3,0,7}, /* G */
{0,3,4,0,7}, /* B */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_RGBA] = {
.name = "rgba",
{0,3,3,0,7}, /* B */
{0,3,4,0,7}, /* A */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_ABGR] = {
.name = "abgr",
{0,3,3,0,7}, /* G */
{0,3,4,0,7}, /* R */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_BGRA] = {
.name = "bgra",
{0,3,3,0,7}, /* R */
{0,3,4,0,7}, /* A */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_GRAY16BE] = {
.name = "gray16be",
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUVJ440P] = {
.name = "yuvj440p",
{1,0,1,0,7}, /* U */
{2,0,1,0,7}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUVA420P] = {
.name = "yuva420p",
{2,0,1,0,7}, /* V */
{3,0,1,0,7}, /* A */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_VDPAU_H264] = {
.name = "vdpau_h264",
{0,5,3,0,15}, /* G */
{0,5,5,0,15}, /* B */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_RGB565BE] = {
.name = "rgb565be",
{0,1,1,5,5}, /* G */
{0,1,1,0,4}, /* B */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_RGB,
},
[PIX_FMT_RGB565LE] = {
.name = "rgb565le",
{0,1,1,5,5}, /* G */
{0,1,1,0,4}, /* B */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_RGB555BE] = {
.name = "rgb555be",
{0,1,1,5,4}, /* G */
{0,1,1,0,4}, /* B */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_RGB,
},
[PIX_FMT_RGB555LE] = {
.name = "rgb555le",
{0,1,1,5,4}, /* G */
{0,1,1,0,4}, /* B */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_RGB444BE] = {
.name = "rgb444be",
{0,1,1,4,3}, /* G */
{0,1,1,0,3}, /* B */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_RGB,
},
[PIX_FMT_RGB444LE] = {
.name = "rgb444le",
{0,1,1,4,3}, /* G */
{0,1,1,0,3}, /* B */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_BGR48BE] = {
.name = "bgr48be",
{0,5,3,0,15}, /* G */
{0,5,5,0,15}, /* R */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_RGB,
},
[PIX_FMT_BGR48LE] = {
.name = "bgr48le",
{0,5,3,0,15}, /* G */
{0,5,5,0,15}, /* R */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_BGR565BE] = {
.name = "bgr565be",
{0,1,1,5,5}, /* G */
{0,1,1,0,4}, /* R */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_RGB,
},
[PIX_FMT_BGR565LE] = {
.name = "bgr565le",
{0,1,1,5,5}, /* G */
{0,1,1,0,4}, /* R */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_BGR555BE] = {
.name = "bgr555be",
{0,1,1,5,4}, /* G */
{0,1,1,0,4}, /* R */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_RGB,
},
[PIX_FMT_BGR555LE] = {
.name = "bgr555le",
{0,1,1,5,4}, /* G */
{0,1,1,0,4}, /* R */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_BGR444BE] = {
.name = "bgr444be",
{0,1,1,4,3}, /* G */
{0,1,1,0,3}, /* R */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_RGB,
},
[PIX_FMT_BGR444LE] = {
.name = "bgr444le",
{0,1,1,4,3}, /* G */
{0,1,1,0,3}, /* R */
},
+ .flags = PIX_FMT_RGB,
},
[PIX_FMT_VAAPI_MOCO] = {
.name = "vaapi_moco",
{1,1,1,0,8}, /* U */
{2,1,1,0,8}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV420P9BE] = {
.name = "yuv420p9be",
{1,1,1,0,8}, /* U */
{2,1,1,0,8}, /* V */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
[PIX_FMT_YUV420P10LE] = {
.name = "yuv420p10le",
{1,1,1,0,9}, /* U */
{2,1,1,0,9}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV420P10BE] = {
.name = "yuv420p10be",
{1,1,1,0,9}, /* U */
{2,1,1,0,9}, /* V */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
[PIX_FMT_YUV420P16LE] = {
.name = "yuv420p16le",
{1,1,1,0,15}, /* U */
{2,1,1,0,15}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV420P16BE] = {
.name = "yuv420p16be",
{1,1,1,0,15}, /* U */
{2,1,1,0,15}, /* V */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
[PIX_FMT_YUV422P9LE] = {
.name = "yuv422p9le",
{1,1,1,0,8}, /* U */
{2,1,1,0,8}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV422P9BE] = {
.name = "yuv422p9be",
{1,1,1,0,8}, /* U */
{2,1,1,0,8}, /* V */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
[PIX_FMT_YUV422P10LE] = {
.name = "yuv422p10le",
{1,1,1,0,9}, /* U */
{2,1,1,0,9}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV422P10BE] = {
.name = "yuv422p10be",
{1,1,1,0,9}, /* U */
{2,1,1,0,9}, /* V */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
[PIX_FMT_YUV422P16LE] = {
.name = "yuv422p16le",
{1,1,1,0,15}, /* U */
{2,1,1,0,15}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV422P16BE] = {
.name = "yuv422p16be",
{1,1,1,0,15}, /* U */
{2,1,1,0,15}, /* V */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
[PIX_FMT_YUV444P16LE] = {
.name = "yuv444p16le",
{1,1,1,0,15}, /* U */
{2,1,1,0,15}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV444P16BE] = {
.name = "yuv444p16be",
{1,1,1,0,15}, /* U */
{2,1,1,0,15}, /* V */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
[PIX_FMT_YUV444P10LE] = {
.name = "yuv444p10le",
{1,1,1,0,9}, /* U */
{2,1,1,0,9}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV444P10BE] = {
.name = "yuv444p10be",
{1,1,1,0,9}, /* U */
{2,1,1,0,9}, /* V */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
[PIX_FMT_YUV444P9LE] = {
.name = "yuv444p9le",
{1,1,1,0,8}, /* U */
{2,1,1,0,8}, /* V */
},
+ .flags = PIX_FMT_PLANAR,
},
[PIX_FMT_YUV444P9BE] = {
.name = "yuv444p9be",
{1,1,1,0,8}, /* U */
{2,1,1,0,8}, /* V */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR,
},
[PIX_FMT_DXVA2_VLD] = {
.name = "dxva2_vld",
{1,0,1,0,7}, /* B */
{2,0,1,0,7}, /* R */
},
+ .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
},
[PIX_FMT_GBRP9LE] = {
.name = "gbrp9le",
{1,1,1,0,8}, /* B */
{2,1,1,0,8}, /* R */
},
+ .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
},
[PIX_FMT_GBRP9BE] = {
.name = "gbrp9be",
{1,1,1,0,8}, /* B */
{2,1,1,0,8}, /* R */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
},
[PIX_FMT_GBRP10LE] = {
.name = "gbrp10le",
{1,1,1,0,9}, /* B */
{2,1,1,0,9}, /* R */
},
+ .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
},
[PIX_FMT_GBRP10BE] = {
.name = "gbrp10be",
{1,1,1,0,9}, /* B */
{2,1,1,0,9}, /* R */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
},
[PIX_FMT_GBRP16LE] = {
.name = "gbrp16le",
{1,1,1,0,15}, /* B */
{2,1,1,0,15}, /* R */
},
+ .flags = PIX_FMT_PLANAR | PIX_FMT_RGB,
},
[PIX_FMT_GBRP16BE] = {
.name = "gbrp16be",
{1,1,1,0,15}, /* B */
{2,1,1,0,15}, /* R */
},
- .flags = PIX_FMT_BE,
+ .flags = PIX_FMT_BE | PIX_FMT_PLANAR | PIX_FMT_RGB,
},
};
#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_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.
#include "libavutil/avutil.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
+#include "libavutil/pixdesc.h"
#define STR(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
const char *sws_format_name(enum PixelFormat format);
-//FIXME replace this with something faster
-#define is16BPS(x) ( \
- (x)==PIX_FMT_GRAY16BE \
- || (x)==PIX_FMT_GRAY16LE \
- || (x)==PIX_FMT_BGR48BE \
- || (x)==PIX_FMT_BGR48LE \
- || (x)==PIX_FMT_RGB48BE \
- || (x)==PIX_FMT_RGB48LE \
- || (x)==PIX_FMT_YUV420P16LE \
- || (x)==PIX_FMT_YUV422P16LE \
- || (x)==PIX_FMT_YUV444P16LE \
- || (x)==PIX_FMT_YUV420P16BE \
- || (x)==PIX_FMT_YUV422P16BE \
- || (x)==PIX_FMT_YUV444P16BE \
- )
-#define is9_OR_10BPS(x) ( \
- (x)==PIX_FMT_YUV420P9LE \
- || (x)==PIX_FMT_YUV420P9BE \
- || (x)==PIX_FMT_YUV422P9LE \
- || (x)==PIX_FMT_YUV422P9BE \
- || (x)==PIX_FMT_YUV444P9BE \
- || (x)==PIX_FMT_YUV444P9LE \
- || (x)==PIX_FMT_YUV422P10BE \
- || (x)==PIX_FMT_YUV422P10LE \
- || (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 is16BPS(x) \
+ (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 15)
+
+#define is9_OR_10BPS(x) \
+ (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 8 || \
+ av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 9)
+
+#define isBE(x) \
+ (av_pix_fmt_descriptors[x].flags & PIX_FMT_BE)
+
+#define isYUV(x) \
+ (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB) && \
+ av_pix_fmt_descriptors[x].nb_components >= 2)
+
+#define isPlanarYUV(x) \
+ ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR) && \
+ isYUV(x))
+
+#define isRGB(x) \
+ (av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB)
+
+#define isGray(x) \
+ (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) && \
+ av_pix_fmt_descriptors[x].nb_components <= 2)
+
#define isRGBinInt(x) ( \
(x)==PIX_FMT_RGB48BE \
|| (x)==PIX_FMT_RGB48LE \
|| (x)==PIX_FMT_MONOBLACK \
|| (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) ( \
isRGBinInt(x) \
|| isBGRinInt(x) \
)
-#define isALPHA(x) ( \
- (x)==PIX_FMT_BGR32 \
- || (x)==PIX_FMT_BGR32_1 \
- || (x)==PIX_FMT_RGB32 \
- || (x)==PIX_FMT_RGB32_1 \
- || (x)==PIX_FMT_Y400A \
- || (x)==PIX_FMT_YUVA420P \
- )
-#define isPacked(x) ( \
- (x)==PIX_FMT_PAL8 \
- || (x)==PIX_FMT_YUYV422 \
- || (x)==PIX_FMT_UYVY422 \
- || (x)==PIX_FMT_Y400A \
- || isAnyRGB(x) \
- )
+#define isALPHA(x) \
+ (av_pix_fmt_descriptors[x].nb_components == 2 || \
+ av_pix_fmt_descriptors[x].nb_components == 4)
+
+#define isPacked(x) \
+ (av_pix_fmt_descriptors[x].nb_components >= 2 && \
+ !(av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR))
+
#define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_Y400A)
extern const uint64_t ff_dither4[2];