From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B2B8140519 for ; Tue, 25 Jan 2022 03:22:26 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 690AA68AF88; Tue, 25 Jan 2022 05:22:23 +0200 (EET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1AF168A5DC for ; Tue, 25 Jan 2022 05:22:15 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643080941; x=1674616941; h=from:to:subject:date:message-id:references:in-reply-to: content-id:content-transfer-encoding:mime-version; bh=jMqur5/JiSyGVCDIi6kRFYDZZUcmDpeWaaXP0+FneXI=; b=mNH3nFLONl+iuCIXoz9+HWgC1nPB1BHwAiDqJ9ghp20WiozUD3skPgGG YfFcmcazVhJAy2Qs5PzEu/ElgPosgOa7DzBPwJ+hR/Wx9Zg647sy6kY7Q tVzy5BnrwhhipORwFULmz4mvz5Qt0K+NXBoY1rYIY4Y70XhPCDcYv/ICT zIHw1eEw3lBWrK2uTm9LoBPKc/v1ZKI/F2WnAYBa+ATBbAfRKOYD+0UGs gPvKNfz9iTw1zsjTjYFoFQfQ1UFGy0lAOFcwSm4UAc06cpboJ0aGbKQ/4 45FdNkg9hAuPXjsI2vkcTBojd91AGVht5ddAyV/sl+wc7zkfn0Mns2OXx A==; X-IronPort-AV: E=McAfee;i="6200,9189,10237"; a="246425052" X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="246425052" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 19:22:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,314,1635231600"; d="scan'208";a="627748842" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga004.jf.intel.com with ESMTP; 24 Jan 2022 19:22:12 -0800 Received: from orsmsx606.amr.corp.intel.com (10.22.229.19) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 24 Jan 2022 19:22:12 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Mon, 24 Jan 2022 19:22:12 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.168) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Mon, 24 Jan 2022 19:22:10 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GLaQuyAYxIJTYxNmdbYihor7NR+JwZh/GleurWYdp6XWJGGhLr3ndlSz7MSwzFHi5OkhsMo8WOueeZQXdc26bqjyVXRKq1yNObRhQSlEyk87/mvmvuvsZ4mKGfJO9DpjWTqEEAwvu6LPhT9IuEsBu7SPOJsVfg+3lSi2F0WCwBcDGjymCp+0/8aupj8i++G8/7kqzkXPQK5+YdszOLL14vBj6+3sUEPqQOn1bpX7xwO702SA5Mzv+Vw574tSyvZFcBYYnTiwzkXaiRFnYkUea2Reitlpth6PG41dUZiXrkxfAPiOdW3/py30ddP2AwVrL8nU9D7M0fm2Ix2yFGAy0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jMqur5/JiSyGVCDIi6kRFYDZZUcmDpeWaaXP0+FneXI=; b=jEvX1fXMx1TzjTmpVwiGc6DLgMvUz2qKqmgfGb4wr+sniL1CPdAbuc7wbCN7r4eJOO1uwZ38+yMmqyECIDFP7lO1sxQyuW0E6j+w1raXKGmTnzd6b/xISiLG/0Shh4CyEFhl4sgMe9tR8C9KSLb2/T90L3W5bxlk8RVFZX2PjBKclKmLzFhko3mkVQUO0+NKnmURhOAuS4t9TOPC8Zl2W9FDNOtxJTBzghrOpepy+zgCGpa6A67AQXEZLiLIDhwsf2Hj4Z3P+OKJhh1tIWqGB2x7qNJL/HbfFPCxvCLRv9B3voC0s/35yNw9/eB3t8RJCBiS4h2fciiei2LL+447uQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from BN9PR11MB5515.namprd11.prod.outlook.com (2603:10b6:408:104::8) by SN6PR11MB3038.namprd11.prod.outlook.com (2603:10b6:805:cd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.12; Tue, 25 Jan 2022 03:22:03 +0000 Received: from BN9PR11MB5515.namprd11.prod.outlook.com ([fe80::d436:c6ab:6e71:8843]) by BN9PR11MB5515.namprd11.prod.outlook.com ([fe80::d436:c6ab:6e71:8843%5]) with mapi id 15.20.4888.020; Tue, 25 Jan 2022 03:22:03 +0000 From: "Xiang, Haihao" To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [FFmpeg-devel] [PATCH 3/3] libavcodec/qsvenc: Add intra refresh to hevc_qsv and add new intra refresh parameter Thread-Index: AQHYEM7ack/nQNjdoESH9yWForQYCaxzE8OA Date: Tue, 25 Jan 2022 03:22:03 +0000 Message-ID: References: <20220124025955.204168-1-wenbin.chen@intel.com> <20220124025955.204168-3-wenbin.chen@intel.com> In-Reply-To: <20220124025955.204168-3-wenbin.chen@intel.com> Accept-Language: en-AS, zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Evolution 3.28.5-0ubuntu0.18.04.2 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 053c8d7e-912f-48e0-8b7d-08d9dfb1dbcb x-ms-traffictypediagnostic: SN6PR11MB3038:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1443; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Dmlpp5tBTBtxpOdpjZioCbY4vnMRN5/dMN+ksh3mHp6d3CyyLpRx0wiB6NI4iGzEyDrioYrPfBAv1B9LOzPi9n3ph8d/RmLew5wR7k1cnMuVWZzp5ccXOVylTfkyxYVQzAOsMZZ80uzGMrq5p2Zii1DaA7AgsfA7F5SxEl45usrQFE/Ne4yFUXC5a+4J4jLVpHIZIQRN/SMdTflOOwkNS7tWPHjPq6gQOXJK90KmEyfQlEQU7jXFE/7YWjcG53Rl40PixmYtCb9KHqEln/pSvHU5CkCXqUUU7//NYRuYSUpAqP8Ly1Np5naTCOeq8FlFUiOox+xkKBCTDdP063pKibDpkaIH/92RuHJ74xeGxAiumK+NRrTLtisUfRG3zo5d880R6P4gaKNP2M34PY07ActdmTPq5SDxGgPrLuBC+19yv6Bnplcf2yk5NC5q4II8uW/JDoybQoNqUQb9gGHiFU9aTPlfkIgOV67mmUHTyZFzIHBO9XbUn6aOPZfp9KSKeGkz21bE8fenAdO8jheTs381njQGWiJKpcKRiatwMR8RqtoxtzNeywGdPdNK2aa6vWGev50zZJ07hWVudHA7fi8uBcTvPBpmdLR+vD3yYCvG3Pgi2Z3EMyLKyEY9S4P7C3ssXm5x8vhG268NkUFWXbvwJfVD52QmL04b4TE3EuAN2vd+8fNkwhZE7IgWDk0gU25JcgBQwS22xKzDSAjqyTwG84ZuIUFNM3WQZWsaQpA= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN9PR11MB5515.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(316002)(2616005)(6506007)(38100700002)(6486002)(508600001)(26005)(8936002)(82960400001)(86362001)(6512007)(5660300002)(38070700005)(2906002)(66476007)(6916009)(83380400001)(36756003)(71200400001)(76116006)(66946007)(91956017)(122000001)(186003)(8676002)(64756008)(66556008)(66446008)(99106002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?ZGxtV2ZBN24rcnZqTnZNN1MxQkltZk03WDdaUHFSL0xBTFRTdFplSDZjWXUr?= =?utf-8?B?RDN3MXd4UmcvZm5zZkJLNzdqSkZxcmV0aFhWNSs3WGY2S3g2Vlg0bXUwZjBL?= =?utf-8?B?ZjZqYkhIZ1p5OGdtcUp3WWtUZk5Pc3ZONHdFSmdSYkFwQnJ5aUdHeG0yajZY?= =?utf-8?B?T0hOV0YzNG5ZNEJEdCtwZUhQTVF4UndEZTFJdkc4QmlMVkhPU0hHQmNIeS9i?= =?utf-8?B?elloL1c2dFVjbFpNZjhJZ0dTZjJqakdUcTRPVnJZRlA5cWIvb0o1V0lRZkF3?= =?utf-8?B?NW5IaytlL0ZYRkZUZjJRZndMaGI5dUFSUUhhNHI3RXplRk1Va0dmSGwvWFh6?= =?utf-8?B?MFF0VE0rcGltd3JLdVg3enV1NXZydTh4RUxSd3puOFBubXFFOHBGN2pHbHYx?= =?utf-8?B?eVowSW54Rk1lMHorVTlpekdkYnN5eGhKbjBKR3V2NzZydEJWVm1wUmE3NFh3?= =?utf-8?B?VzBROTFJTldYY3BiRE5mNHFuR3MyL3o1d1N3TkRvZ1p6Wm5WU0xVNzhLdnpo?= =?utf-8?B?bzhKVkpIS3Y3NVUxS3J5SDhwWVBzTW1BaDBpY2E1bFdZcXNpWWp3NUxGWkd6?= =?utf-8?B?dzlaSkVic1U4NHU1dEpOUkh4M3RMU1pwTU1VOGhkZjY1OWpLQTFWLzNKKzVm?= =?utf-8?B?Uzg4dVJlWlpJTlRjWFM1dVJyakFoTFZuWTR1SXVJRFBMV3QydVVlQnVUaDUy?= =?utf-8?B?N0hiS2RlM3VnaTVCRHRFYXdhRlAvWjA0S0F4VmRUVWVMNzcveFFiRkduMHYv?= =?utf-8?B?eFg2RUtscTkwdzBoMXBTQVpPdWhueDNDWVBtTDZjNnpmZHpLeHlVRitONzJT?= =?utf-8?B?M2QvcmNNVkc0U1czSUd6MDBUajRSSTZoMXp6OGdkTllaVVh3a1RidW1JY0Nh?= =?utf-8?B?YlBhL0tNMzN4YlJSYjFhWDh5M3lBSDBwWVhxRmNsQmVnelc3M3JQZ1JMVzV1?= =?utf-8?B?T0o2Yzl6T1NCR2VvYXIwcWxtM2ptYXhlZ3F0Unk5UWRhc29PK2FEL0xKU2ho?= =?utf-8?B?RjR1RXZybmhoUCt4VnFkalFNNnovb1FBVk4zNVlqeW5DYW5uWEF1b3FSdFhI?= =?utf-8?B?RmEyMFhTeXUyYys5VTdnakRyZ2d6MWlSNG9qNlpabUJ1UEg0enE4OFRhdk1z?= =?utf-8?B?cC91QkVPVFVyQ0VocTFFa0p2QlJVbHhpWlBSMjR0ZDdJL0JCWjR1V0hDYWFa?= =?utf-8?B?SEIrOVVLZDltMHk3M0RCbGhTcjFJbjRPUWNUNkNpNmFFaFo3SXdPOE9SdnE1?= =?utf-8?B?VFN5RzYvTEM2cUgrNXN6NFVBRHJrU1ExVHdmTEdDMURGRGF5TVJvaklGaHE1?= =?utf-8?B?bFpiUWZyVGFXSVNYbnltWXYwbi91RUdkWmdQcXJPREFHdlRoa1lNazkzU0hR?= =?utf-8?B?QlhIdlRFSE1GVERLV2poSE92YlcxTm1PS203TGNXald2dGdWTE51UXdoeWFm?= =?utf-8?B?M1p5cExNWm1rcFJEQVUvRWl4aUZXVXZ5OExacldRbGU3QVBCK0RaQ2xRVE95?= =?utf-8?B?Qy9xNEQ1YzNhcXZJV3dpU1lLVmVrZ2MzSjgzN3psMEh3MGNOaUtuN05xM1lo?= =?utf-8?B?Q0pMK2RyRGZYRVZWSzhIbGVKNGpLeXF2Szg0TVpDT3UyZnUrNzV0OFBNaWV5?= =?utf-8?B?eGpxY25nTENQMytKWm5Ua2RYQWRtVWF1Wjh3OTNFYkZPdzdrRmIyTWcxcUZD?= =?utf-8?B?REdha0dTWlVLWk5aenIwTXlUNEFKYVBzbWJzVzA3a2phZU0rMk1pL1JXdXhL?= =?utf-8?B?bmlGWm01RDFuRk9ZWUx3NDFDVWc2ejJ4VVNjNHpld0FMVzM2UnYvcnY4bUV5?= =?utf-8?B?SzZtNEticjhyNG5Wb1BlaUhCdG1tVzJsbTJpdXVHZS9HUnUyZUpTS2RJWmR3?= =?utf-8?B?cmlTMXRlUmY1eklicnJqditRRmllVWYraFFYY3RGeHRhd1FtV1g4VDRRcmJJ?= =?utf-8?B?RUZtRjRYUU4wZWIyYkYwM1J3Wlh4bFFVcVFhUjg5VDNheFI5djY2ZkVLdlNi?= =?utf-8?B?ZTJHQ1NxZkV1eGRDRGFTTkdDR3BudHVRMDlyRVJFc3BxUDhENTNNMGRrWmY4?= =?utf-8?B?TUZEQllJZzVYMitXS1FPcndBTjZYeHJMVFg3cDRFVVE1elBxTXlPVVpuNkhx?= =?utf-8?B?UXMzeENYeGxJZElBVmdQOUg0Qk5WSEk4SGJjVnc0cU9RUC9DVUxHRC9BMVhF?= =?utf-8?Q?jD2C0PB0mXJJJwqwZF72eYY=3D?= Content-ID: <4B373F2C4481F64AA30F215EFD0AA03D@namprd11.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5515.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 053c8d7e-912f-48e0-8b7d-08d9dfb1dbcb X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jan 2022 03:22:03.8141 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Iev79aDQK47AVUZOFXD8bDCsKXY3lhBQgfimwuJIKPFHUMvja1NjMI6vLxM9NUh1GHuBHYQc7mew7IjEZM30pA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3038 X-OriginatorOrg: intel.com Subject: Re: [FFmpeg-devel] [PATCH 3/3] libavcodec/qsvenc: Add intra refresh to hevc_qsv and add new intra refresh parameter 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Mon, 2022-01-24 at 10:59 +0800, Wenbin Chen wrote: > Add intra refresh support to hevc_qsv as well. > Add an new intra refresh type: "horizontal", and an new param > ref_cycle_dist. This param specify the distance between the > beginnings of the intra-refresh cycles in frames. > > Signed-off-by: Wenbin Chen > --- > doc/encoders.texi | 26 +++++++++++++++++++++++++- > libavcodec/qsvenc.c | 23 ++++++++++++++--------- > libavcodec/qsvenc.h | 1 + > libavcodec/qsvenc_h264.c | 7 +++++-- > libavcodec/qsvenc_hevc.c | 9 +++++++++ > 5 files changed, 54 insertions(+), 12 deletions(-) > > diff --git a/doc/encoders.texi b/doc/encoders.texi > index 6c1c4df57a..4e35e50e4d 100644 > --- a/doc/encoders.texi > +++ b/doc/encoders.texi > @@ -3344,7 +3344,8 @@ 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. > +vertical refresh, by column of MBs. 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 > @@ -3355,6 +3356,9 @@ Specifies QP difference for inserted intra MBs. This is > signed value in > [-51, 51] range if target encoding bit-depth for luma samples is 8 and this > range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth > respectively. > > +@item @var{int_ref_cycle_dist} > +Distance between the beginnings of the intra-refresh cycles in frames. > + > @item @var{profile} > @table @samp > @item unknown > @@ -3463,6 +3467,26 @@ Insert picture timing SEI with pic_struct_syntax > element. > @item @var{transform_skip} > Turn this option ON to enable transformskip. It is supported on platform > equal > or newer than ICL. > + > +@item @var{int_ref_type} > +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. > + > +@item @var{int_ref_cycle_size} > +Specifies number of pictures within refresh cycle starting from 2. 0 and 1 > are > +invalid values. > + > +@item @var{int_ref_qp_delta} > +Specifies QP difference for inserted intra MBs. This is signed value in > +[-51, 51] range if target encoding bit-depth for luma samples is 8 and this > +range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth > respectively. > + > +@item @var{int_ref_cycle_dist} > +Distance between the beginnings of the intra-refresh cycles in frames. > @end table > > @subsection MPEG2 Options > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c > index a8d876d6d9..af1529936e 100644 > --- a/libavcodec/qsvenc.c > +++ b/libavcodec/qsvenc.c > @@ -267,8 +267,10 @@ static void dump_video_param(AVCodecContext *avctx, > QSVEncContext *q, > > #if QSV_HAVE_CO2 > av_log(avctx, AV_LOG_VERBOSE, > - "RecoveryPointSEI: %s IntRefType: %"PRIu16"; IntRefCycleSize: > %"PRIu16"; IntRefQPDelta: %"PRId16"\n", > - print_threestate(co->RecoveryPointSEI), co2->IntRefType, co2- > >IntRefCycleSize, co2->IntRefQPDelta); > + "RecoveryPointSEI: %s IntRefType: %"PRIu16"; IntRefCycleSize: > %"PRIu16 > + "; IntRefQPDelta: %"PRId16"; IntRefCycleDist: %"PRId16"\n", > + print_threestate(co->RecoveryPointSEI), co2->IntRefType, co2- > >IntRefCycleSize, > + co2->IntRefQPDelta, co3->IntRefCycleDist); IntRefCycleDist is a member of mfxExtCodingOption3, and was introduced in mfx version 1.16, so it should be used under QSV_HAVE_CO3 && QSV_VERSION_ATLEAST(1, 16), not QSV_HAVE_CO2. Thanks Haihao > > av_log(avctx, AV_LOG_VERBOSE, "MaxFrameSize: %d; ", co2->MaxFrameSize); > #if QSV_HAVE_MAX_SLICE_SIZE > @@ -865,13 +867,6 @@ static int init_video_param(AVCodecContext *avctx, > QSVEncContext *q) > > #if QSV_HAVE_CO2 > if (avctx->codec_id == AV_CODEC_ID_H264) { > - if (q->int_ref_type >= 0) > - q->extco2.IntRefType = q->int_ref_type; > - if (q->int_ref_cycle_size >= 0) > - q->extco2.IntRefCycleSize = q->int_ref_cycle_size; > - if (q->int_ref_qp_delta != INT16_MIN) > - q->extco2.IntRefQPDelta = q->int_ref_qp_delta; > - > if (q->bitrate_limit >= 0) > q->extco2.BitrateLimit = q->bitrate_limit ? > MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF; > if (q->mbbrc >= 0) > @@ -900,6 +895,12 @@ static int init_video_param(AVCodecContext *avctx, > QSVEncContext *q) > q->extco2.ExtBRC = q->extbrc ? MFX_CODINGOPTION_ON : > MFX_CODINGOPTION_OFF; > if (q->max_frame_size >= 0) > q->extco2.MaxFrameSize = q->max_frame_size; > + if (q->int_ref_type >= 0) > + q->extco2.IntRefType = q->int_ref_type; > + if (q->int_ref_cycle_size >= 0) > + q->extco2.IntRefCycleSize = q->int_ref_cycle_size; > + if (q->int_ref_qp_delta != INT16_MIN) > + q->extco2.IntRefQPDelta = q->int_ref_qp_delta; > #if QSV_HAVE_MAX_SLICE_SIZE > if (q->max_slice_size >= 0) > q->extco2.MaxSliceSize = q->max_slice_size; > @@ -973,6 +974,10 @@ static int init_video_param(AVCodecContext *avctx, > QSVEncContext *q) > av_log(avctx, AV_LOG_WARNING, > "Please set max_b_frames(-bf) to 0 to enable P- > pyramid\n"); > } > +#endif > +#if QSV_VERSION_ATLEAST(1, 16) > + if (q->int_ref_cycle_dist >= 0) > + q->extco3.IntRefCycleDist = q->int_ref_cycle_dist; > #endif > } > > diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h > index 65f035045c..5fa0b6f5ba 100644 > --- a/libavcodec/qsvenc.h > +++ b/libavcodec/qsvenc.h > @@ -195,6 +195,7 @@ typedef struct QSVEncContext { > int int_ref_type; > int int_ref_cycle_size; > int int_ref_qp_delta; > + int int_ref_cycle_dist; > int recovery_point_sei; > > int repeat_pps; > diff --git a/libavcodec/qsvenc_h264.c b/libavcodec/qsvenc_h264.c > index 9f127607b7..bec3633268 100644 > --- a/libavcodec/qsvenc_h264.c > +++ b/libavcodec/qsvenc_h264.c > @@ -126,13 +126,16 @@ static const AVOption options[] = { > { "4x" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > MFX_LOOKAHEAD_DS_4x }, INT_MIN, INT_MAX, VE, > "look_ahead_downsampling" }, > #endif > > - { "int_ref_type", "Intra refresh > type", OFFSET(qsv.int_ref_type), > AV_OPT_TYPE_INT, { .i64 = -1 }, -1, UINT16_MAX, VE, "int_ref_type" }, > + { "int_ref_type", "Intra refresh type. B frames should be set to > 0.", OFFSET(qsv.int_ref_type), AV_OPT_TYPE_INT, { .i64 = -1 > }, -1, UINT16_MAX, VE, "int_ref_type" }, > { "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" }, > { "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 }, > - > +#if QSV_VERSION_ATLEAST(1, 16) > + { "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 }, > +#endif > { "profile", NULL, OFFSET(qsv.profile), AV_OPT_TYPE_INT, { .i64 = > MFX_PROFILE_UNKNOWN }, 0, INT_MAX, VE, "profile" }, > { "unknown" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > MFX_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, VE, "profile" }, > { "baseline", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > MFX_PROFILE_AVC_BASELINE }, INT_MIN, INT_MAX, VE, "profile" }, > diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c > index 91a316f9c8..5cac141c4d 100644 > --- a/libavcodec/qsvenc_hevc.c > +++ b/libavcodec/qsvenc_hevc.c > @@ -258,6 +258,15 @@ static const AVOption options[] = { > #if QSV_VERSION_ATLEAST(1, 26) > { "transform_skip", "Turn this option ON to enable > transformskip", OFFSET(qsv.transform_skip), AV_OPT_TYPE_INT, { > .i64 = -1}, -1, 1, VE}, > #endif > + { "int_ref_type", "Intra refresh type. B frames should be set to > 0", OFFSET(qsv.int_ref_type), AV_OPT_TYPE_INT, { .i64 = -1 > }, -1, UINT16_MAX, VE, "int_ref_type" }, > + { "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" }, > + { "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 }, > +#if QSV_VERSION_ATLEAST(1, 16) > + { "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 }, > +#endif > > { NULL }, > }; _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".