From 54320512d1a0077e4427040e1fc6bc28e9f45c09 Mon Sep 17 00:00:00 2001
From: Aaron Levinson <[email protected]>
Date: Sun, 16 Apr 2017 17:56:10 -0700
Subject: [PATCH 2/2] libavcodec/qsvenc.c:  Added additional Query() call to
 get updated parameter values

Purpose: libavcodec/qsvenc.c: Added additional Query() call to get an
updated parameter values.  Note that this code had been in ffmpeg at
one point and demonstrates good practice for Intel Media SDK coding.

Notes: Tested with progressive (720p59.94) and interlaced (1080i59.94)
video (with ffmpeg).

Comments:

-- libavcodec/qsvenc.c: Added code to call MFXVideoENCODE_Query()
   after calling init_video_param().  This represents a generally good
   practice to make sure that it is working with the right parameter
   values.  After returning from MFXVideoENCODE_Query(), q->param will
   be populated with potentially updated parameter values.
---
 libavcodec/qsvenc.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index ccb1216..7c6ad09 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -774,10 +774,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.10.1.windows.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to