[FFmpeg-devel,1/5] lavc/qsvdec: add function ff_qsv_map_picstruct()

Submitted by Zhong Li on Jan. 21, 2019, 12:41 p.m.

Details

Message ID 1548074517-6578-2-git-send-email-zhong.li@intel.com
State New
Headers show

Commit Message

Zhong Li Jan. 21, 2019, 12:41 p.m.
Signed-off-by: Zhong Li <zhong.li@intel.com>
---
 libavcodec/qsv.c          | 18 ++++++++++++++++++
 libavcodec/qsv_internal.h |  2 ++
 2 files changed, 20 insertions(+)

Comments

Rogozhkin, Dmitry V Jan. 24, 2019, 8:35 p.m.
On Mon, 2019-01-21 at 20:41 +0800, Zhong Li wrote:
> Signed-off-by: Zhong Li <zhong.li@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 bb0d795..224bc00 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 394c558..51c23d5 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);

>  


Not sure why this is a separate patch.
Zhong Li Jan. 25, 2019, 10:46 a.m.
> From: Rogozhkin, Dmitry V

> Sent: Friday, January 25, 2019 4:36 AM

> To: ffmpeg-devel@ffmpeg.org

> Cc: Li, Zhong <zhong.li@intel.com>

> Subject: Re: [FFmpeg-devel] [PATCH 1/5] lavc/qsvdec: add function

> ff_qsv_map_picstruct()

> > +enum AVFieldOrder ff_qsv_map_picstruct(int mfx_pic_struct);

> > +

> >  int ff_qsv_init_internal_session(AVCodecContext *avctx, mfxSession

> > *session,

> >                                   const char

> *load_plugins);

> >

> 

> Not sure why this is a separate patch.


This is not a decode-only-used function, so it is separated. 
Probably I should change the patch title form "lavc/qsvdec" to "lavc/qsv".

Patch hide | download patch | download mbox

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index bb0d795..224bc00 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 394c558..51c23d5 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);