[FFmpeg-devel,6/6] lavu/hwcontext_qsv: add frame map support for HEVC rext support

Submitted by Linjie Fu on Sept. 10, 2019, 4:08 p.m.

Details

Message ID 1568131720-20022-1-git-send-email-linjie.fu@intel.com
State New
Headers show

Commit Message

Linjie Fu Sept. 10, 2019, 4:08 p.m.
Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavutil/hwcontext_qsv.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 0329a81..7f8f2de 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -103,6 +103,14 @@  static const struct {
     { AV_PIX_FMT_BGRA, MFX_FOURCC_RGB4 },
     { AV_PIX_FMT_P010, MFX_FOURCC_P010 },
     { AV_PIX_FMT_PAL8, MFX_FOURCC_P8   },
+    { AV_PIX_FMT_YUYV422,
+                       MFX_FOURCC_YUY2 },
+    { AV_PIX_FMT_Y210,
+                       MFX_FOURCC_Y210 },
+    { AV_PIX_FMT_AYUV,
+                       MFX_FOURCC_AYUV },
+    { AV_PIX_FMT_Y410,
+                       MFX_FOURCC_Y410 },
 };
 
 static uint32_t qsv_fourcc_from_pix_fmt(enum AVPixelFormat pix_fmt)
@@ -768,12 +776,29 @@  static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface)
         break;
 
     case AV_PIX_FMT_BGRA:
+    case AV_PIX_FMT_AYUV:
         surface->Data.B = frame->data[0];
         surface->Data.G = frame->data[0] + 1;
         surface->Data.R = frame->data[0] + 2;
         surface->Data.A = frame->data[0] + 3;
         break;
 
+    case AV_PIX_FMT_YUYV422:
+        surface->Data.Y = frame->data[0];
+        surface->Data.U = frame->data[0] + 1;
+        surface->Data.V = frame->data[0] + 3;
+        break;
+
+    case AV_PIX_FMT_Y210:
+        surface->Data.Y16 = frame->data[0];
+        surface->Data.U16 = frame->data[0] + 2;
+        surface->Data.V16 = frame->data[0] + 6;
+        break;
+
+    case AV_PIX_FMT_Y410:
+        surface->Data.U = frame->data[0];
+        break;
+
     default:
         return MFX_ERR_UNSUPPORTED;
     }