aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-14 11:22:40 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-11-14 11:59:20 +0100
commite13d5e9a4b5b4de065b00b1caea850cd47fd4b18 (patch)
tree13bf2f01763823c4e4da6374acadc95b3f8bc121 /libavutil
parent26afdbcfc0ecd646c6d829b781e0a53d6b289186 (diff)
parent5e9c6ef8f3beb9ed7b271654a82349ac90fe43f2 (diff)
downloadffmpeg-e13d5e9a4b5b4de065b00b1caea850cd47fd4b18.tar.gz
Merge commit '5e9c6ef8f3beb9ed7b271654a82349ac90fe43f2'
* commit '5e9c6ef8f3beb9ed7b271654a82349ac90fe43f2': x86: h264_weight_10bit: port to cpuflags libtheoraenc: add missing pixdesc.h header avcodec: remove ff_is_hwaccel_pix_fmt pixdesc: add av_pix_fmt_get_chroma_sub_sample hlsenc: stand alone hls segmenter Conflicts: doc/muxers.texi libavcodec/ffv1enc.c libavcodec/imgconvert.c libavcodec/mpegvideo_enc.c libavcodec/tiffenc.c libavformat/Makefile libavformat/allformats.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/pixdesc.c12
-rw-r--r--libavutil/pixdesc.h14
2 files changed, 26 insertions, 0 deletions
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 6ee7024d24..bbe64bee7a 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1749,3 +1749,15 @@ enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc)
return desc - av_pix_fmt_descriptors;
}
+
+int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
+ int *h_shift, int *v_shift)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ if (!desc)
+ return AVERROR(ENOSYS);
+ *h_shift = desc->log2_chroma_w;
+ *v_shift = desc->log2_chroma_h;
+
+ return 0;
+}
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index ccbee9b2f1..d4e8766132 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -206,4 +206,18 @@ const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev);
*/
enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc);
+/**
+ * Utility function to access log2_chroma_w log2_chroma_h from
+ * the pixel format AVPixFmtDescriptor.
+ *
+ * @param[in] pix_fmt the pixel format
+ * @param[out] h_shift store log2_chroma_h
+ * @param[out] v_shift store log2_chroma_w
+ *
+ * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format
+ */
+int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt,
+ int *h_shift, int *v_shift);
+
+
#endif /* AVUTIL_PIXDESC_H */