From patchwork Thu Oct 11 09:26:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1/2] lavc/qsvenc_jpeg: add async_depth support X-Patchwork-Submitter: "Li, Zhong" X-Patchwork-Id: 64382 Message-Id: <1539249973-29957-1-git-send-email-zhong.li@intel.com> To: libav-devel@libav.org Date: Thu, 11 Oct 2018 17:26:12 +0800 From: Zhong Li List-Id: libav development Currently qsv (m)jpeg encoding is broken. Regression introducing by the commit(id: c1bcd3): fix async support, which requires the minimum async_depth to be 1, instead previous zero. But the default async_depth of qsv (m)jpeg encoding is still initialized (mostly) as zero. This patch also abviously improves qsv (m)jpeg encoding performance due to the default async_depth is changed to 4. Signed-off-by: Zhong Li --- libavcodec/qsvenc_jpeg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/qsvenc_jpeg.c b/libavcodec/qsvenc_jpeg.c index e11b74d..7465bb9 100644 --- a/libavcodec/qsvenc_jpeg.c +++ b/libavcodec/qsvenc_jpeg.c @@ -64,6 +64,7 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx) #define OFFSET(x) offsetof(QSVMJPEGEncContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { + { "async_depth", "Maximum processing parallelism", OFFSET(qsv.async_depth), AV_OPT_TYPE_INT, { .i64 = ASYNC_DEPTH_DEFAULT }, 1, INT_MAX, VE }, { NULL }, }; From patchwork Thu Oct 11 09:26:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/2] lavc/qsvenc_jpeg: set a default quality X-Patchwork-Submitter: "Li, Zhong" X-Patchwork-Id: 64383 Message-Id: <1539249973-29957-2-git-send-email-zhong.li@intel.com> To: libav-devel@libav.org Date: Thu, 11 Oct 2018 17:26:13 +0800 From: Zhong Li List-Id: libav development Keep alignment with vaapi mjpeg encoder. Signed-off-by: Zhong Li --- libavcodec/qsvenc_jpeg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/qsvenc_jpeg.c b/libavcodec/qsvenc_jpeg.c index 7465bb9..bbfd009 100644 --- a/libavcodec/qsvenc_jpeg.c +++ b/libavcodec/qsvenc_jpeg.c @@ -75,6 +75,11 @@ static const AVClass class = { .version = LIBAVUTIL_VERSION_INT, }; +static const AVCodecDefault qsv_enc_defaults[] = { + { "global_quality", "80" }, + { NULL }, +}; + AVCodec ff_mjpeg_qsv_encoder = { .name = "mjpeg_qsv", .long_name = NULL_IF_CONFIG_SMALL("MJPEG (Intel Quick Sync Video acceleration)"), @@ -89,5 +94,6 @@ AVCodec ff_mjpeg_qsv_encoder = { AV_PIX_FMT_QSV, AV_PIX_FMT_NONE }, .priv_class = &class, + .defaults = qsv_enc_defaults, .wrapper_name = "qsv", };