[FFmpeg-cvslog] Remove deprecation of avcodec_get_chroma_sub_sample.
Michael Niedermayer
git at videolan.org
Wed Nov 14 12:11:17 CET 2012
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Nov 14 11:59:25 2012 +0100| [d4e74d5d6d67fbe5999aa48b988b49ffe36ea81c] | committer: Michael Niedermayer
Remove deprecation of avcodec_get_chroma_sub_sample.
Add explanations what the difference between the 2 functions are and
when either should be used.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d4e74d5d6d67fbe5999aa48b988b49ffe36ea81c
---
libavcodec/avcodec.h | 15 +++++++++++++--
libavcodec/imgconvert.c | 2 ++
libavutil/pixdesc.h | 5 +++++
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index f6e0ee7..368f2c4 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -4580,10 +4580,21 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
*/
/**
- * @deprecated Use av_pix_fmt_get_chroma_sub_sample
+ * Utility function to access log2_chroma_w log2_chroma_h from
+ * the pixel format AVPixFmtDescriptor.
+ *
+ * This function asserts that pix_fmt is valid. See av_pix_fmt_get_chroma_sub_sample
+ * for one that returns a failure code and continues in case of invalid
+ * pix_fmts.
+ *
+ * @param[in] pix_fmt the pixel format
+ * @param[out] h_shift store log2_chroma_h
+ * @param[out] v_shift store log2_chroma_w
+ *
+ * @see av_pix_fmt_get_chroma_sub_sample
*/
-void attribute_deprecated avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
+void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
/**
* Return a value representing the fourCC code associated to the
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index 43eeba7..39c49bd 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -33,6 +33,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "internal.h"
+#include "libavutil/avassert.h"
#include "libavutil/colorspace.h"
#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
@@ -427,6 +428,7 @@ static const PixFmtInfo pix_fmt_info[AV_PIX_FMT_NB] = {
void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ av_assert0(desc);
*h_shift = desc->log2_chroma_w;
*v_shift = desc->log2_chroma_h;
}
diff --git a/libavutil/pixdesc.h b/libavutil/pixdesc.h
index d4e8766..dca56a7 100644
--- a/libavutil/pixdesc.h
+++ b/libavutil/pixdesc.h
@@ -210,6 +210,11 @@ 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.
*
+ * See avcodec_get_chroma_sub_sample() for a function that asserts a
+ * valid pixel format instead of returning an error code.
+ * Its recommanded that you use avcodec_get_chroma_sub_sample unless
+ * you do check the return code!
+ *
* @param[in] pix_fmt the pixel format
* @param[out] h_shift store log2_chroma_h
* @param[out] v_shift store log2_chroma_w
More information about the ffmpeg-cvslog
mailing list