diff options
Diffstat (limited to 'ffmpeg/libavutil/pixdesc.h')
| -rw-r--r-- | ffmpeg/libavutil/pixdesc.h | 72 |
1 files changed, 60 insertions, 12 deletions
diff --git a/ffmpeg/libavutil/pixdesc.h b/ffmpeg/libavutil/pixdesc.h index 0947fd1..e88bf9b 100644 --- a/ffmpeg/libavutil/pixdesc.h +++ b/ffmpeg/libavutil/pixdesc.h @@ -23,6 +23,8 @@ #define AVUTIL_PIXDESC_H #include <inttypes.h> + +#include "attributes.h" #include "pixfmt.h" typedef struct AVComponentDescriptor{ @@ -86,27 +88,60 @@ typedef struct AVPixFmtDescriptor{ AVComponentDescriptor comp[4]; }AVPixFmtDescriptor; -#define PIX_FMT_BE 1 ///< Pixel format is big-endian. -#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) +/** + * Pixel format is big-endian. + */ +#define AV_PIX_FMT_FLAG_BE (1 << 0) +/** + * Pixel format has a palette in data[1], values are indexes in this palette. + */ +#define AV_PIX_FMT_FLAG_PAL (1 << 1) +/** + * All values of a component are bit-wise packed end to end. + */ +#define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2) +/** + * Pixel format is an HW accelerated format. + */ +#define AV_PIX_FMT_FLAG_HWACCEL (1 << 3) +/** + * At least one pixel component is not in the first data plane. + */ +#define AV_PIX_FMT_FLAG_PLANAR (1 << 4) +/** + * The pixel format contains RGB-like data (as opposed to YUV/grayscale). + */ +#define AV_PIX_FMT_FLAG_RGB (1 << 5) /** * The pixel format is "pseudo-paletted". This means that FFmpeg treats it as * paletted internally, but the palette is generated by the decoder and is not * stored in the file. */ -#define PIX_FMT_PSEUDOPAL 64 - -#define PIX_FMT_ALPHA 128 ///< The pixel format has an alpha channel +#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) +/** + * The pixel format has an alpha channel. + */ +#define AV_PIX_FMT_FLAG_ALPHA (1 << 7) +#if FF_API_PIX_FMT +/** + * @deprecated use the AV_PIX_FMT_FLAG_* flags + */ +#define PIX_FMT_BE AV_PIX_FMT_FLAG_BE +#define PIX_FMT_PAL AV_PIX_FMT_FLAG_PAL +#define PIX_FMT_BITSTREAM AV_PIX_FMT_FLAG_BITSTREAM +#define PIX_FMT_HWACCEL AV_PIX_FMT_FLAG_HWACCEL +#define PIX_FMT_PLANAR AV_PIX_FMT_FLAG_PLANAR +#define PIX_FMT_RGB AV_PIX_FMT_FLAG_RGB +#define PIX_FMT_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL +#define PIX_FMT_ALPHA AV_PIX_FMT_FLAG_ALPHA +#endif #if FF_API_PIX_FMT_DESC /** * The array of all the pixel format descriptors. */ -extern const AVPixFmtDescriptor av_pix_fmt_descriptors[]; +extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[]; #endif /** @@ -168,7 +203,7 @@ const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt); /** * Print in buf the string corresponding to the pixel format with - * number pix_fmt, or an header if pix_fmt is negative. + * number pix_fmt, or a header if pix_fmt is negative. * * @param buf the buffer where to write the string * @param buf_size the size of buf @@ -180,7 +215,8 @@ char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt /** * Return the number of bits per pixel used by the pixel format - * described by pixdesc. + * described by pixdesc. Note that this is not the same as the number + * of bits per sample. * * The returned number of bits refers to the number of bits actually * used for storing the pixel information, that is padding bits are @@ -239,5 +275,17 @@ int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, */ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); +void ff_check_pixfmt_descriptors(void); + +/** + * Utility function to swap the endianness of a pixel format. + * + * @param[in] pix_fmt the pixel format + * + * @return pixel format with swapped endianness if it exists, + * otherwise AV_PIX_FMT_NONE + */ +enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt); + #endif /* AVUTIL_PIXDESC_H */ |
