diff mbox series

[FFmpeg-devel] lavc/vaapi_encode_h265: add encoding support for 4:2:2 10 bit

Message ID 1583394132-20067-1-git-send-email-linjie.fu@intel.com
State New
Headers show
Series [FFmpeg-devel] lavc/vaapi_encode_h265: add encoding support for 4:2:2 10 bit
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Fu, Linjie March 5, 2020, 7:42 a.m. UTC
Enables VMEPAK encoding on ICL.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
Needs support [1] in media driver to get it work correctly.

With [2] supported in libva, setting VA_SURFACE_ATTRIB_USAGE_HINT_RECON to
the recon surface and resize them in driver would be more robust in ffmpeg
level.

[1] https://github.com/intel/media-driver/pull/855
[2] https://github.com/intel/libva/pull/344

 libavcodec/vaapi_encode.c      | 12 ++++++++++--
 libavcodec/vaapi_encode_h265.c |  3 +++
 2 files changed, 13 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
index 8ff720e..ad0414f 100644
--- a/libavcodec/vaapi_encode.c
+++ b/libavcodec/vaapi_encode.c
@@ -1191,6 +1191,9 @@  static const VAAPIEncodeRTFormat vaapi_encode_rt_formats[] = {
 #if VA_CHECK_VERSION(0, 38, 1)
     { "YUV420_10", VA_RT_FORMAT_YUV420_10BPP, 10, 3, 1, 1 },
 #endif
+#if VA_CHECK_VERSION(1, 2, 0)
+    { "YUV422_10", VA_RT_FORMAT_YUV422_10,    10, 3, 1, 0 },
+#endif
 };
 
 static const VAEntrypoint vaapi_encode_entrypoints_normal[] = {
@@ -2185,8 +2188,13 @@  static av_cold int vaapi_encode_create_recon_frames(AVCodecContext *avctx)
 
     ctx->recon_frames->format    = AV_PIX_FMT_VAAPI;
     ctx->recon_frames->sw_format = recon_format;
-    ctx->recon_frames->width     = ctx->surface_width;
-    ctx->recon_frames->height    = ctx->surface_height;
+    if (recon_format == AV_PIX_FMT_Y210) {
+        ctx->recon_frames->width     = ctx->surface_width / 2;
+        ctx->recon_frames->height    = ctx->surface_height * 2;
+    } else {
+        ctx->recon_frames->width     = ctx->surface_width;
+        ctx->recon_frames->height    = ctx->surface_height;
+    }
 
     err = av_hwframe_ctx_init(ctx->recon_frames_ref);
     if (err < 0) {
diff --git a/libavcodec/vaapi_encode_h265.c b/libavcodec/vaapi_encode_h265.c
index db1bf24..4ba9fef 100644
--- a/libavcodec/vaapi_encode_h265.c
+++ b/libavcodec/vaapi_encode_h265.c
@@ -1138,6 +1138,9 @@  static const VAAPIEncodeProfile vaapi_encode_h265_profiles[] = {
     { FF_PROFILE_HEVC_MAIN_10, 10, 3, 1, 1, VAProfileHEVCMain10     },
     { FF_PROFILE_HEVC_REXT,    10, 3, 1, 1, VAProfileHEVCMain10     },
 #endif
+#if VA_CHECK_VERSION(1, 2, 0)
+    { FF_PROFILE_HEVC_REXT,    10, 3, 1, 0, VAProfileHEVCMain422_10 },
+#endif
     { FF_PROFILE_UNKNOWN }
 };