aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-07 10:47:25 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-07 10:49:40 +0200
commit60fd88059a62c9237893ff6d159c28cd929aadf0 (patch)
treeb7f52ad5930cfb9257dc761ab1161e5df25ddfaa /libavutil
parent399f6ef971eb992f612ddb9aa50ecc3aa378d0c8 (diff)
parent74652af821d7e526a6541876a637fbf81261fa8e (diff)
downloadffmpeg-60fd88059a62c9237893ff6d159c28cd929aadf0.tar.gz
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>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/pixdesc.c48
-rw-r--r--libavutil/pixdesc.h11
-rw-r--r--libavutil/version.h2
3 files changed, 60 insertions, 1 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
+}
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index 538e6a55d2..f411558b44 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -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 */
diff --git a/libavutil/version.h b/libavutil/version.h
index d59eac5071..4d876313b3 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -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, \