[FFmpeg-devel,3/5] lavc/qsv: add decode support for HEVC Rext

Submitted by Linjie Fu on June 28, 2019, 2:28 a.m.

Details

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

Commit Message

Linjie Fu June 28, 2019, 2:28 a.m.
Add support for YUV422P/YUV422P10, YUV444P/YUV444P10 in qsv_map_pixfmt.
Allow qsv to choose correct fourc from format.

Add support for YUYV422/Y210/AYUV/Y410 to map frame to surface and
allowed hwdownload.

HEVC Rext decode is supported on ICL+ platform.

Cmdline for 444 8 bit decode:
ffmpeg -hwaccel qsv -hwaccel_device /dev/dri/renderD128 -c:v
hevc_qsv -load_plugin hevc_hw -i HEVCRext_444_8bit.bin -vf
hwdownload,format=ayuv -pix_fmt ayuv -vsync passthrough out.yuv

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavcodec/qsv.c          | 12 ++++++++++++
 libavutil/hwcontext_qsv.c | 25 ++++++++++++++++++++++---
 2 files changed, 34 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 986d4f6..87f4aae 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -225,6 +225,18 @@  int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc)
     case AV_PIX_FMT_NV12:
         *fourcc = MFX_FOURCC_NV12;
         return AV_PIX_FMT_NV12;
+    case AV_PIX_FMT_YUV422P:
+        *fourcc = MFX_FOURCC_YUY2;
+        return AV_PIX_FMT_YUYV422;
+    case AV_PIX_FMT_YUV422P10:
+        *fourcc = MFX_FOURCC_Y210;
+        return AV_PIX_FMT_Y210LE;
+    case AV_PIX_FMT_YUV444P:
+        *fourcc = MFX_FOURCC_AYUV;
+        return AV_PIX_FMT_AYUV;
+    case AV_PIX_FMT_YUV444P10:
+        *fourcc = MFX_FOURCC_Y410;
+        return AV_PIX_FMT_Y410LE;
     case AV_PIX_FMT_YUV420P10:
     case AV_PIX_FMT_P010:
         *fourcc = MFX_FOURCC_P010;
diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index 59e4ed9..f0be4bb 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_Y210LE,
+                       MFX_FOURCC_Y210 },
+    { AV_PIX_FMT_AYUV,
+                       MFX_FOURCC_AYUV },
+    { AV_PIX_FMT_Y410LE,
+                       MFX_FOURCC_Y410 },
 };
 
 static uint32_t qsv_fourcc_from_pix_fmt(enum AVPixelFormat pix_fmt)
@@ -760,20 +768,31 @@  static int map_frame_to_surface(const AVFrame *frame, mfxFrameSurface1 *surface)
         surface->Data.Y  = frame->data[0];
         surface->Data.UV = frame->data[1];
         break;
-
     case AV_PIX_FMT_YUV420P:
         surface->Data.Y = frame->data[0];
         surface->Data.U = frame->data[1];
         surface->Data.V = frame->data[2];
         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_Y210LE:
+        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_Y410LE:
+        surface->Data.U = frame->data[0];
+        break;
     default:
         return MFX_ERR_UNSUPPORTED;
     }