[FFmpeg-devel] [PATCH v2 1/6] lavc/qsv: add function ff_qsv_map_picstruct()

Zhong Li zhong.li at intel.com
Wed Feb 20 04:58:16 EET 2019


Signed-off-by: Zhong Li <zhong.li at intel.com>
---
 libavcodec/qsv.c          | 18 ++++++++++++++++++
 libavcodec/qsv_internal.h |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index bb0d79588c..224bc00ce4 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -196,6 +196,24 @@ int ff_qsv_find_surface_idx(QSVFramesContext *ctx, QSVFrame *frame)
     return AVERROR_BUG;
 }
 
+enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct)
+{
+    enum AVFieldOrder field = AV_FIELD_UNKNOWN;
+    switch (mfx_pic_struct & 0xF) {
+    case MFX_PICSTRUCT_PROGRESSIVE:
+        field = AV_FIELD_PROGRESSIVE;
+        break;
+    case MFX_PICSTRUCT_FIELD_TFF:
+        field = AV_FIELD_TT;
+        break;
+    case MFX_PICSTRUCT_FIELD_BFF:
+        field = AV_FIELD_BB;
+        break;
+    }
+
+    return field;
+}
+
 enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type)
 {
     enum AVPictureType type;
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 394c558883..51c23d5c7b 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -94,6 +94,8 @@ int ff_qsv_profile_to_mfx(enum AVCodecID codec_id, int profile);
 int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc);
 enum AVPictureType ff_qsv_map_pictype(int mfx_pic_type);
 
+enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct);
+
 int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession *session,
                                  const char *load_plugins);
 
-- 
2.17.1



More information about the ffmpeg-devel mailing list