mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2024-11-27 05:20:48 +00:00
pixdesc: add function to return pixel format with swapped endiannes
This commit is contained in:
parent
6e293d111f
commit
74652af821
@ -1512,3 +1512,51 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
|
|||||||
ret += planes[i];
|
ret += planes[i];
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt)
|
||||||
|
{
|
||||||
|
#define PIX_FMT_SWAP_ENDIANNESS(fmt) \
|
||||||
|
case AV_PIX_FMT_ ## fmt ## BE: return AV_PIX_FMT_ ## fmt ## LE; \
|
||||||
|
case AV_PIX_FMT_ ## fmt ## LE: return AV_PIX_FMT_ ## fmt ## BE
|
||||||
|
|
||||||
|
switch (pix_fmt) {
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(GRAY16);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(RGB48);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(RGB565);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(RGB555);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(RGB444);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(BGR48);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(BGR565);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(BGR555);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(BGR444);
|
||||||
|
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUV420P9);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUV422P9);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUV444P9);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUV420P10);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUV422P10);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUV444P10);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUV420P16);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUV422P16);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUV444P16);
|
||||||
|
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(GBRP9);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(GBRP10);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(GBRP16);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUVA420P9);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUVA422P9);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUVA444P9);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUVA420P10);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUVA422P10);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUVA444P10);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUVA420P16);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUVA422P16);
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(YUVA444P16);
|
||||||
|
|
||||||
|
PIX_FMT_SWAP_ENDIANNESS(XYZ12);
|
||||||
|
default:
|
||||||
|
return AV_PIX_FMT_NONE;
|
||||||
|
}
|
||||||
|
#undef PIX_FMT_SWAP_ENDIANNESS
|
||||||
|
}
|
||||||
|
@ -226,4 +226,15 @@ int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
|
|||||||
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
|
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 */
|
#endif /* AVUTIL_PIXDESC_H */
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
#define LIBAVUTIL_VERSION_MAJOR 52
|
#define LIBAVUTIL_VERSION_MAJOR 52
|
||||||
#define LIBAVUTIL_VERSION_MINOR 10
|
#define LIBAVUTIL_VERSION_MINOR 10
|
||||||
#define LIBAVUTIL_VERSION_MICRO 0
|
#define LIBAVUTIL_VERSION_MICRO 1
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||||
LIBAVUTIL_VERSION_MINOR, \
|
LIBAVUTIL_VERSION_MINOR, \
|
||||||
|
Loading…
Reference in New Issue
Block a user