[FFmpeg-devel] [PATCH 1/2] qsvenc: Use MFXVideoENCODE_Query() to update the parameters

Aaron Levinson alevinsn at aracnet.com
Sun May 7 20:39:29 EEST 2017


>From 2882d77d76805e74fe139f6763f91c39746bebaf Mon Sep 17 00:00:00 2001
From: Aaron Levinson <alevinsn at aracnet.com>
Date: Fri, 5 May 2017 18:49:57 -0700
Subject: [PATCH 1/2] qsvenc: Use MFXVideoENCODE_Query() to update the
 parameters

Purpose: Fill out the default/unset parameters with ones actually in use.

Note: Matches the current MediaSDK example code.  This code used to be
present in ffmpeg and was eliminated in revision 1f26a23 on Oct. 31,
2016 (qsv: Merge libav implementation, at
https://github.com/FFmpeg/FFmpeg/commit/1f26a231bb065276cd80ce02957c759f3197edfa#diff-7d84a34d58597bb7aa4b8239dca1f9f8).
Already applied to libav.

Reviewed-by: Luca Barbato <lu_zero at gentoo.org>
(cherry picked from commit b22094d74901fb3ac203c8322f8d84aded470bfb)
Signed-off-by: Mark Thompson <sw at jkqxz.net>
Signed-off-by: Aaron Levinson <alevinsn at aracnet.com>
---
 libavcodec/qsvenc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 9c385a79d8..68d4f5edd0 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -740,10 +740,18 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
     if (ret < 0)
         return ret;
 
+    ret = MFXVideoENCODE_Query(q->session, &q->param, &q->param);
+    if (ret == MFX_WRN_PARTIAL_ACCELERATION) {
+        av_log(avctx, AV_LOG_WARNING, "Encoder will work with partial HW acceleration\n");
+    } else if (ret < 0) {
+        return ff_qsv_print_error(avctx, ret,
+                                  "Error querying encoder params");
+    }
+
     ret = MFXVideoENCODE_QueryIOSurf(q->session, &q->param, &q->req);
     if (ret < 0)
         return ff_qsv_print_error(avctx, ret,
-                                  "Error querying the encoding parameters");
+                                  "Error querying (IOSurf) the encoding parameters");
 
     if (opaque_alloc) {
         ret = qsv_init_opaque_alloc(avctx, q);
-- 
2.12.2.windows.2



More information about the ffmpeg-devel mailing list