diff options
Diffstat (limited to 'libavutil/pixdesc.c')
-rw-r--r-- | libavutil/pixdesc.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 203ec7b1d4..10a6f1ad58 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -1907,3 +1907,51 @@ void ff_check_pixfmt_descriptors(void){ } } } + + +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 +} |