From patchwork Tue Sep 6 09:22:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chen, Wenbin" X-Patchwork-Id: 37691 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp3135726pzh; Tue, 6 Sep 2022 02:25:41 -0700 (PDT) X-Google-Smtp-Source: AA6agR6c8ewTn0NF9o7fGQHI6lQEQKeoHsXE1thoCXua63GH3qdKHKxLw8Edmhw5bQsMDnD1kJ8H X-Received: by 2002:a05:6402:24a4:b0:440:8c0c:8d2b with SMTP id q36-20020a05640224a400b004408c0c8d2bmr45448352eda.311.1662456341044; Tue, 06 Sep 2022 02:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662456341; cv=none; d=google.com; s=arc-20160816; b=mY+zjRqu3y7Ljx5asaPVlo8X0KJq9EDGahwvMt6wPq1GlgBVqWN3EM4dKSk5Q7m+nC mm7Mi4pLt2RNziqZPyxaA/G2Ccx/wj7e180qTE9Rch9I93Q/2kWeSsTjIUmA28DZwl22 4rJxp82+efk2skVn1ajkMF9Q/WTnGo9O1TpegVL2kP8mcfFu/YF/ZGSDHDhsxn01kpn6 g4LaLTLEBUZWDVBDxE/KNODgw/50rzJBRm79Sok2e6KnkLfFb+34la+ty1Ws0c4sv4V6 V7dNQMAVHsHlhz8IHcSU2dpnJKBUu7EzgQg52S3egR6KXTkPqhw5SjQ56zZyjB8BWxIL Tdqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=umL9AQq2n5uDkRyuPLAP5OOpIxSkjqAkqZtAiMpwrV4=; b=0P61bsbLd8qlCiwNqmowiG3aMcWaV0VaUrLqOW0VpRAmkHFM+jEzAxF/DX757mw8lX ObB1OKTckzVcoDGREmTpLx0LKpPXpYSsfmeoqHcFYHedlVQa8o60XyNn/tnR/njlil2q M9fRqLF2oiJdblBmyq6WcU6YpvJ6N0GbSuqXOI7CXPE9jDF+jn8Nvv+YHdJoBSCG++P/ BN+HfRiq26zul4zEiFA/TiEKzytiX4FHPQZr5HOslvIHL4F4SkzjNFflhp+81rvFgDRn Mf4SScDFRgwwATaZesmKkpCqSQDxh+6kmyfS85bXz1LTpq9MWQ4B24ymQkzn7E07gCo8 AoFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=igEDGTIj; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sc27-20020a1709078a1b00b0073d71b3e93dsi9815412ejc.285.2022.09.06.02.25.40; Tue, 06 Sep 2022 02:25:41 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=igEDGTIj; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3F10A68BABA; Tue, 6 Sep 2022 12:25:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8556A68BAB1 for ; Tue, 6 Sep 2022 12:25:04 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662456309; x=1693992309; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=UmqcWIEaRKCiRF37H+et1pwHkcg4UehKI8L0LKGvRho=; b=igEDGTIjVWOPKUwQuJ/xaTdR6tycnbLQ/3f3v6dxADfh5ehSI8EMijS2 jJz2Ibzp8cBKont3mDuFdnFdy0ygVDosLLPlopXpAU+Xep6nBm1fqysxw B2fcpQiVMBc++xy+d1bpV54EgJWPuVSgHV3Qwi/XfAMRMu5NyNRAnwfFd sIkfDi+QZDDWsYX3PgOXIaFLZv3mq074MzUubD0zFYho3PvN1BeRYYcG9 sGXYmFyocnDKZkGMhK4LCiT2nvAsY7t6JVIF1N58n7tODgHN4CYruUnyw YD/m6IOiRfHF1F7FklX2nWIuNb9mu+9SkBOC+DuMth3maCPmHIHeaV3jZ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10461"; a="322720553" X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="322720553" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2022 02:24:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="565028243" Received: from wenbin-z390-aorus-ultra.sh.intel.com ([10.239.35.4]) by orsmga003.jf.intel.com with ESMTP; 06 Sep 2022 02:24:58 -0700 From: Wenbin Chen To: ffmpeg-devel@ffmpeg.org Date: Tue, 6 Sep 2022 17:22:55 +0800 Message-Id: <20220906092258.994742-4-wenbin.chen@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220906092258.994742-1-wenbin.chen@intel.com> References: <20220906092258.994742-1-wenbin.chen@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/7] libavcodec/qsvenc: Add "slice" intra refresh type to qsvenc X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Fje7S8IOImNM Add "slice" intra refresh type to h264_qsv and hevc_qsv. This type means horizontal refresh by slices without overlapping. Also update the doc. Signed-off-by: Wenbin Chen --- doc/encoders.texi | 12 ++++++++---- libavcodec/qsvenc_h264.c | 1 + libavcodec/qsvenc_hevc.c | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index bc1a4dae38..d5d695d39c 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -3454,8 +3454,10 @@ Specifies intra refresh type. The major goal of intra refresh is improvement of error resilience without significant impact on encoded bitstream size caused by I frames. The SDK encoder achieves this by encoding part of each frame in refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means -vertical refresh, by column of MBs. To enable intra refresh, B frame should be -set to 0. +vertical refresh, by column of MBs. @var{horizontal} means horizontal refresh, +by rows of MBs. @var{slice} means horizontal refresh by slices without +overlapping. In case of @var{slice}, in_ref_cycle_size is ignored. To enable +intra refresh, B frame should be set to 0. @item @var{int_ref_cycle_size} Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are @@ -3641,8 +3643,10 @@ Specifies intra refresh type. The major goal of intra refresh is improvement of error resilience without significant impact on encoded bitstream size caused by I frames. The SDK encoder achieves this by encoding part of each frame in refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means -vertical refresh, by column of MBs. To enable intra refresh, B frame should be -set to 0. +vertical refresh, by column of MBs. @var{horizontal} means horizontal refresh, +by rows of MBs. @var{slice} means horizontal refresh by slices without +overlapping. In case of @var{slice}, in_ref_cycle_size is ignored. To enable +intra refresh, B frame should be set to 0. @item @var{int_ref_cycle_size} Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c index 1bbdc45203..8bc4ef95d2 100644 --- a/libavcodec/qsvenc_h264.c +++ b/libavcodec/qsvenc_h264.c @@ -139,6 +139,7 @@ static const AVOption options[] = { { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, .flags = VE, "int_ref_type" }, { "vertical", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .flags = VE, "int_ref_type" }, { "horizontal", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, .flags = VE, "int_ref_type" }, + { "slice" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, .flags = VE, "int_ref_type" }, { "int_ref_cycle_size", "Number of frames in the intra refresh cycle", OFFSET(qsv.int_ref_cycle_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, UINT16_MAX, VE }, { "int_ref_qp_delta", "QP difference for the refresh MBs", OFFSET(qsv.int_ref_qp_delta), AV_OPT_TYPE_INT, { .i64 = INT16_MIN }, INT16_MIN, INT16_MAX, VE }, { "recovery_point_sei", "Insert recovery point SEI messages", OFFSET(qsv.recovery_point_sei), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE }, diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c index 5986c3f1a6..ba7cb6fba6 100644 --- a/libavcodec/qsvenc_hevc.c +++ b/libavcodec/qsvenc_hevc.c @@ -270,6 +270,7 @@ static const AVOption options[] = { { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, .flags = VE, "int_ref_type" }, { "vertical", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, .flags = VE, "int_ref_type" }, { "horizontal", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, .flags = VE, "int_ref_type" }, + { "slice" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, .flags = VE, "int_ref_type" }, { "int_ref_cycle_size", "Number of frames in the intra refresh cycle", OFFSET(qsv.int_ref_cycle_size), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, UINT16_MAX, VE }, { "int_ref_qp_delta", "QP difference for the refresh MBs", OFFSET(qsv.int_ref_qp_delta), AV_OPT_TYPE_INT, { .i64 = INT16_MIN }, INT16_MIN, INT16_MAX, VE }, { "int_ref_cycle_dist", "Distance between the beginnings of the intra-refresh cycles in frames", OFFSET(qsv.int_ref_cycle_dist), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT16_MAX, VE },