Merge commit '74652af821d7e526a6541876a637fbf81261fa8e'

* commit '74652af821d7e526a6541876a637fbf81261fa8e':
  pixdesc: add function to return pixel format with swapped endiannes

Conflicts:
	libavutil/pixdesc.c
	libavutil/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-05-07 10:47:25 +02:00
commit 60fd88059a
3 changed files with 60 additions and 1 deletions

View File

@ -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
}

View File

@ -241,4 +241,15 @@ 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 */

View File

@ -75,7 +75,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 29
#define LIBAVUTIL_VERSION_MINOR 30
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \