From 1125277bc64ebef1a7a6bee7349c7a8fab7fdcc7 Mon Sep 17 00:00:00 2001 From: Zhong Li Date: Fri, 11 Jan 2019 15:09:07 +0800 Subject: lavc/qsvenc: enable hevc gpb option GPB is the default type, just contains forward references but the slice_type is B slice with higher encoding efficiency than regular P slice, but lower performance. Add an option to allow user to set regular P slice. Fix ticket#6870 Test data on Intel Kabylake (i7-7567U CPU @ 3.50GHz): 1. ffmpeg -hwaccel qsv -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal.mp4 -vsync passthrough -vframes 1000 -c:v hevc_qsv -gpb 0 -bf 0 -q 25 test_gpb_off_bf0_kbl.mp4 transcoding fps: 85 encoded file size of test_gpb_off_bf0_kbl.mp4: 21960100 (bytes) 2. ffmpeg -hwaccel qsv -c:v h264_qsv -i bbb_sunflower_1080p_30fps_normal.mp4 -vsync passthrough -vframes 1000 -c:v hevc_qsv -gpb 1 -bf 0 -q 25 test_gpb_on_bf0_kbl.mp4 transcoding fps: 79 encoded file size oftest_gpb_on_bf0_kbl.mp4: 21211449 (bytes) In this case, enable gpb can bring about 7% performance drop but 3.4% encoding efficiency improvment. Signed-off-by: Zhong Li --- libavcodec/qsvenc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'libavcodec/qsvenc.c') diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 55f1223f02..a03ab69590 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -267,6 +267,11 @@ static void dump_video_param(AVCodecContext *avctx, QSVEncContext *q, #endif #endif +#if QSV_HAVE_GPB + if (avctx->codec_id == AV_CODEC_ID_HEVC) + av_log(avctx, AV_LOG_VERBOSE,"GPB: %s\n", print_threestate(co3->GPB)); +#endif + if (avctx->codec_id == AV_CODEC_ID_H264) { av_log(avctx, AV_LOG_VERBOSE, "Entropy coding: %s; MaxDecFrameBuffering: %"PRIu16"\n", co->CAVLC == MFX_CODINGOPTION_ON ? "CAVLC" : "CABAC", co->MaxDecFrameBuffering); @@ -748,6 +753,10 @@ FF_ENABLE_DEPRECATION_WARNINGS #if QSV_HAVE_CO3 q->extco3.Header.BufferId = MFX_EXTBUFF_CODING_OPTION3; q->extco3.Header.BufferSz = sizeof(q->extco3); +#if QSV_HAVE_GPB + if (avctx->codec_id == AV_CODEC_ID_HEVC) + q->extco3.GPB = q->gpb ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; +#endif q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco3; #endif } -- cgit v1.2.3