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 E1FFD40983 for ; Fri, 4 Mar 2022 08:37:28 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 92D9F68AF89; Fri, 4 Mar 2022 10:37:25 +0200 (EET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D6CC968A507 for ; Fri, 4 Mar 2022 10:37:18 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646383044; x=1677919044; h=from:to:subject:date:message-id:references:in-reply-to: content-id:content-transfer-encoding:mime-version; bh=RzoiyA6y93Ak4e6vitQ7w/lwJvy23vvFlUZh+rAPwzQ=; b=U4NuV6nMDygnxfJICckPDpFQbNNCmyY6UeCf3DMyJ6vO5Yc3SmTrp/Kv KJlwx4wO3V5bsj8icLCjRD2Jb+KXkb6XXBLXlXgGivkx6JLASgSFhQjes 6ogoT/SBERJseQ9hvLqvkW8NlSK+hs/hsHqH1ALydch4vRDPgWtG/iC0C iRD0+/FDemeKUc/06aZLNOzH0ar16GthJdQkPJGs41k07iET1jTIBHs6U lR86dPcLXQj8VqPkmtpnFovWGwmLH/6H1ftc99V0lzLPfbMsiB4RpglvZ USpiV1lxqd7XV7X1puWimUGQkYS2dkWvyxzeLnXTLPEjqjqwijvTk7Gy4 w==; X-IronPort-AV: E=McAfee;i="6200,9189,10275"; a="251504382" X-IronPort-AV: E=Sophos;i="5.90,154,1643702400"; d="scan'208";a="251504382" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2022 00:37:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,154,1643702400"; d="scan'208";a="609883205" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga004.fm.intel.com with ESMTP; 04 Mar 2022 00:37:17 -0800 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Fri, 4 Mar 2022 00:37:16 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21 via Frontend Transport; Fri, 4 Mar 2022 00:37:16 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.170) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.21; Fri, 4 Mar 2022 00:37:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k5uHMQYGh2wlgktpApcK9owVwlWpqHR5w/zKour7Q8TEF0VxvyGrPdGIjZHj60YvfqTa2y7cxRr+pl/q4IquAaajQvITzzaKokbXEb2xlo21IZVA25lIpMvrjIBuBsFqUjqpquNfQ3IA3QpiqVxoJ0czurzaV6U29daNAUAw21fs4Y0V+cUgxs/FzhGJOdvP8oAsG+4EYJL/Ob1/lFq8p7m/qQSs+jnmfNGUMuWDQJO66341NjBt8q0jUDnoI2zuj2r3UC/hG9E7YJcdI9JKWGsEV5iW0ojMAzBIulWw8PJrLlodbOm23M59+ioQzMOrD9tAyH5YmE+rLGZQlzs0XA== 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=RzoiyA6y93Ak4e6vitQ7w/lwJvy23vvFlUZh+rAPwzQ=; b=JMG6g6CaykTYXSHooPTsPk/7L8FgxFK+ECwnaPuDfCYP0l/RUanQBGNiyjrIFkkXcAOKoamdUFgnvEJT3TEhQd6WbjtxqON/tuFV+KdUjpuKTHO1v76+YBNLgtk2PFzEDx5Z0PXt5Sbepj8WZ6XfMovSse3p5ppC6eWpOzFSAsBODHUcldlgmgT2nZCOjve0KtECbWTXvmIR46oxs4AFGXAuGVqz2L6D55rADt0KuDD69JUXphcIAV+5cIqVEJM08NUCURJcCZq4mfZTIjD8tF353Jv5E08G77v5EAExEsPsf1oahmIWy+ySXoD8RCdv6zpaqMuYf3K2bbNYKM4iCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH0PR11MB5030.namprd11.prod.outlook.com (2603:10b6:510:41::5) by MN2PR11MB4109.namprd11.prod.outlook.com (2603:10b6:208:155::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Fri, 4 Mar 2022 08:37:13 +0000 Received: from PH0PR11MB5030.namprd11.prod.outlook.com ([fe80::1409:8899:7215:ba5f]) by PH0PR11MB5030.namprd11.prod.outlook.com ([fe80::1409:8899:7215:ba5f%5]) with mapi id 15.20.5017.027; Fri, 4 Mar 2022 08:37:12 +0000 From: "Wang, Fei W" To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [FFmpeg-devel] [PATCH v2 1/4] lavc/vaapi_encode_h265: Add P frame to GPB frame support for hevc_vaapi Thread-Index: AQHYJsli8kR3hmzsMUyqPODCQofIfqyd6V8AgAEoL4CAADGWgIABz7LAgA3kNAA= Date: Fri, 4 Mar 2022 08:37:12 +0000 Message-ID: <64a8e5847c3c92be0ce7f18303c4bbbe84357199.camel@intel.com> References: <20220221021337.2190359-1-fei.w.wang@intel.com> <03ec8c31-088a-95b6-a514-6fbf14518537@jkqxz.net> <3b94feeb89d9a990cc11d8b2b35a0949736e6fb6.camel@intel.com> <757b53c74767bedb2f98a1373213feca3efd98b3.camel@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Evolution 3.36.5-0ubuntu1 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: 86fc7ba5-0dc0-4100-36d7-08d9fdba2df1 x-ms-traffictypediagnostic: MN2PR11MB4109:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GonEFAafiOSiwmRmRt5Dgzb9sDhvdG7aL9Izof1O3+71OiUz4JRXeEGCAJcgtwysvSKcDFQyUXYHZQS/Lp702j1Emx369eur27Ob1UL0ABrKKVQkUgoGCMyRn2VkaGU3sJKC/beEJPHJ7dlk+4Fyx9pS/Rw+WRUQlyPSFb8suLarPE79y+jVkKdAtTI1gxg1hHbpnead76vC+MGxAlUt4BVkHdgISyfDoDHaaQIpVKWpxcj8Y4G1Ye+plosIBR3eQF5Oo8YoXq2ftnzbO1iMGtWGUrQw5WmlhQyv1U9UlkE2rAicFjmst0zI2FkXf+Eg/Usz0CmvS5EaV6vUI7+gqQP/KjYjAP0hAa7b7Z6UQBl8VRO5j4CPxMDr7Qr3KAB6AxugPgggreOKwgae9F5axDawbWbTjWUH8mpbjtnt94fyOGFICleaJQZSF0QGIwXkNMxiPnXc2T8VVnXDyHMuiTfv3esZTW+orM/eVHfD+uN54IZfSxkh2TcV4z6EbFze2ojh5YRi/n1Mwaf3+qtgblpclolIr7h9q7ijKts5lPpDyzX71tI1a5kNspXE0IYqwXijlA2LSFzKGD4NmFvWq5lvvj7EjEJWWXy30rkJ/WlnGts5MFuAgzJVCdQXHlnSc5bqBjN40m0oTLpLC3iMy17hTkoEmYIef2ZTYoefCayRWz6JHi5/gLrCjzzXm91zwnOuEMrOtT3+6fzsEociidseLNAnag3KELFSCytznoFjAaWBiITkkdl80l0Fs2+n2U7oAcYgo/jrH2MAZBtce7YggFagbhArZIXvLr6WoSUOqDSdSnUbOjirl+FQExdLZdg4N4ST0T0htZ92wFzEwg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5030.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(5660300002)(26005)(36756003)(86362001)(8676002)(186003)(82960400001)(2616005)(38100700002)(83380400001)(122000001)(966005)(38070700005)(6486002)(8936002)(30864003)(2906002)(71200400001)(508600001)(316002)(6916009)(6512007)(53546011)(84970400001)(64756008)(66556008)(66476007)(76116006)(66446008)(91956017)(6506007)(66946007); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?VWxJcGhKQ3BIL0V3dExPZ0U2MFhheGJGbzdBREpZOC9WbVFZenFRNE9Dd0Nv?= =?utf-8?B?QmJYOGZudDhRdDg5Zml6eW5LRXhKUVpwalJ3Myswamo0R1QzeElmdms2bDdO?= =?utf-8?B?dmF5UkhmRGpubXlsUVZDbnBldDI3OHpDdW1XOSsrODB2SDc5UzJCb0EzUFVH?= =?utf-8?B?MlltajYraTVFOG15WG0yRkRZQVBDdjJnS2d0QkRKNG1yWjZ3ck1sM2lGbWkr?= =?utf-8?B?VzRQNUJUTGxoczhaRUNTd1BxVGtQMEtkbzlqc01SbGhNR1o1Um42WEVTV3NQ?= =?utf-8?B?SW0zMXFONXg5OU9HbkJOKy8zUGxMNkhsVWo0Q0dibUd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-8?B?cE80eENmOEViNEZ0STF2WEp2YmorSFl6cVBDbU5Qa2h6L0N2bGNPVHF5VjNy?= =?utf-8?Q?HSgnnttaspOb5h6dlViULv4=3D?= Content-ID: <1A0E1754252B5F4196692F456404C990@namprd11.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5030.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86fc7ba5-0dc0-4100-36d7-08d9fdba2df1 X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Mar 2022 08:37:12.5850 (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: t26n0r8jaZCChS8KM/xIOB/O97CCQ223dos4i4Z/O5ihPKqmoKIVB32UteyLhIcfLxSlKxL1wqYKWuSmjoWEqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB4109 X-OriginatorOrg: intel.com Subject: Re: [FFmpeg-devel] [PATCH v2 1/4] lavc/vaapi_encode_h265: Add P frame to GPB frame support for hevc_vaapi 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 Wed, 2022-02-23 at 13:33 +0000, Wang, Fei W wrote: > > -----Original Message----- > > From: ffmpeg-devel On Behalf Of > > Wang, > > Fei W > > Sent: Tuesday, February 22, 2022 4:49 PM > > To: ffmpeg-devel@ffmpeg.org > > Subject: Re: [FFmpeg-devel] [PATCH v2 1/4] lavc/vaapi_encode_h265: > > Add P > > frame to GPB frame support for hevc_vaapi > > > > On Tue, 2022-02-22 at 05:46 +0000, Xiang, Haihao wrote: > > > On Mon, 2022-02-21 at 12:06 +0000, Mark Thompson wrote: > > > > On 21/02/2022 02:13, Fei Wang wrote: > > > > > From: Linjie Fu > > > > > > > > > > Use GPB frames to replace regular P frames if backend driver > > > > > does > > > > > not support it. > > > > > > > > > > - GPB: > > > > > Generalized P and B picture. P frames replaced by B > > > > > frames > > > > > with > > > > > forward-predict only, L0 == L1. Normal B frames still > > > > > have 2 > > > > > different ref_lists and allow bi-prediction > > > > > > > > > > Signed-off-by: Linjie Fu > > > > > Signed-off-by: Fei Wang > > > > > --- > > > > > libavcodec/vaapi_encode.c | 33 > > > > > +++++++++++++++++++++++++++++++-- > > > > > libavcodec/vaapi_encode.h | 1 + > > > > > libavcodec/vaapi_encode_h265.c | 15 +++++++++++++++ > > > > > 3 files changed, 47 insertions(+), 2 deletions(-) > > > > > > > > This always fails immediately on current iHD > > > > (7e357b4bea76b2fe2522e6af41ae02ea69cec49e): > > > > > > > > $ ./ffmpeg_g -v 44 -y -hwaccel vaapi -hwaccel_output_format > > > > vaapi -i > > > > in.mp4 -an -c:v hevc_vaapi -low_power 1 out.mp4 ... > > > > [hevc_vaapi @ 0x560e81d45e80] Using input frames context > > > > (format > > > > vaapi) with > > > > hevc_vaapi encoder. > > > > [hevc_vaapi @ 0x560e81d45e80] Input surface format is nv12. > > > > [hevc_vaapi @ 0x560e81d45e80] Using VAAPI profile > > > > VAProfileHEVCMain > > > > (17). > > > > [hevc_vaapi @ 0x560e81d45e80] Using VAAPI entrypoint > > > > VAEntrypointEncSliceLP (8). > > > > [hevc_vaapi @ 0x560e81d45e80] Using VAAPI render target format > > > > YUV420 (0x1). > > > > [hevc_vaapi @ 0x560e81d45e80] Using CTU size 64x64, min CB size > > > > 8x8. > > > > [hevc_vaapi @ 0x560e81d45e80] No quality level set; using > > > > default > > > > (25). > > > > [hevc_vaapi @ 0x560e81d45e80] RC mode: CQP. > > > > [hevc_vaapi @ 0x560e81d45e80] RC quality: 25. > > > > [hevc_vaapi @ 0x560e81d45e80] RC framerate: 30000/1001 (29.97 > > > > fps). > > > > [hevc_vaapi @ 0x560e81d45e80] Use GPB B frames to replace > > > > regular P > > > > frames. > > > > [hevc_vaapi @ 0x560e81d45e80] Using intra, GPB-B-frames and B- > > > > frames (supported references: 3 / 3). > > > > [hevc_vaapi @ 0x560e81d45e80] All wanted packed headers > > > > available > > > > (wanted 0xd, found 0x1f). > > > > [hevc_vaapi @ 0x560e81d45e80] Using level 4. > > > > ... > > > > [hevc_vaapi @ 0x560e81d45e80] Failed to end picture encode > > > > issue: > > > > 24 (internal > > > > encoding error). > > > > [hevc_vaapi @ 0x560e81d45e80] Encode failed: -5. > > > > Video encoding failed > > > > ... > > > > $ cat /proc/cpuinfo | grep 'model name' | head -1 > > > > model name : Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz > > > > $ uname -v > > > > #1 SMP PREEMPT Debian 5.16.7-2 (2022-02-09) > > > > > > > > Do you get this too, or is your setup different somehow? > > > > > > Hi Mark, > > > > > > I tested this patchset with iHD > > > (7e357b4bea76b2fe2522e6af41ae02ea69cec49e) on CFL (low_power=0), > > > RKL > > > and DG1, i965 on SKL, and didn't see this issue before. > > > This day I reproduced this issue on ICL. It seems iHD driver > > > doesn't > > > return right values for ICL. > > > > Thanks Mark to report this issue on ICL. > > > > I tested on TGL and CFL before submitted this patch set, all looks > > good. I will > > check why this fail on ICL. > > > > And will fix your other comments together in next version. > > > > Fei > > Thanks > > > > > > > > > diff --git a/libavcodec/vaapi_encode.c > > > > > b/libavcodec/vaapi_encode.c > > > > > index 3bf379b1a0..95eca7c288 100644 > > > > > --- a/libavcodec/vaapi_encode.c > > > > > +++ b/libavcodec/vaapi_encode.c > > > > > @@ -1845,6 +1845,30 @@ static av_cold int > > > > > vaapi_encode_init_gop_structure(AVCodecContext *avctx) > > > > > ref_l1 = attr.value >> 16 & 0xffff; > > > > > } > > > > > > > > > > + ctx->p_to_gpb = 0; > > > > > + > > > > > +#if VA_CHECK_VERSION(1, 9, 0) > > > > > + attr = (VAConfigAttrib) { > > > > > VAConfigAttribPredictionDirection > > > > > }; > > > > > + vas = vaGetConfigAttributes(ctx->hwctx->display, > > > > > + ctx->va_profile, > > > > > + ctx->va_entrypoint, > > > > > + &attr, 1); > > > > > > > > This probably shouldn't be done at all if the user has selected > > > > a > > > > codec without B-frames or a configuration which is intra-only, > > > > because the log message is confusing: > > > > > > > > [mjpeg_vaapi @ 0x55b90d72ee00] Driver does not report whether > > > > support GPB, use regular P frames. > > > > [mjpeg_vaapi @ 0x55b90d72ee00] Using intra frames only. > > > > > > > > > + if (vas != VA_STATUS_SUCCESS) { > > > > > + av_log(avctx, AV_LOG_WARNING, "Failed to query > > > > > prediction direction > > > > > " > > > > > + "attribute: %d (%s).\n", vas, > > > > > vaErrorStr(vas)); > > > > > > > > And fail? > > > > > > 4/4 also ignores the error. It would be better to handle the > > > error in > > > the same way and update 4/4 too. > > > > > > > > + } else if (attr.value == VA_ATTRIB_NOT_SUPPORTED) { > > > > > + av_log(avctx, AV_LOG_VERBOSE, "Driver does not > > > > > report > > > > > whether " > > > > > + "support GPB, use regular P frames.\n"); > > > > > > > > "support GPB" is a strange thing to say. It's a constraint - > > > > any > > > > driver which supports B-frames will let you have the same thing > > > > in > > > > both RefPicLists, but some require it because they don't > > > > support > > > > P-frames. > > > > > > > > So maybe something like "Driver does not report any additional > > > > prediction constraints, using P-frames."? > > > > > > > > > + } else { > > > > > + if (attr.value & > > > > > VA_PREDICTION_DIRECTION_BI_NOT_EMPTY) { > > > > > + ctx->p_to_gpb = 1; > > > > > + av_log(avctx, AV_LOG_VERBOSE, "Use GPB B frames > > > > > to > > > > > replace " > > > > > + "regular P frames.\n"); > > > > > > > > Maybe "Driver does not support P-frames, replacing them with B- > > > > frames."? > > > > > > > > > + } else > > > > > + av_log(avctx, AV_LOG_VERBOSE, "Use regular P > > > > > frames.\n"); > > > > > + } > > > > > +#endif > > > > > + > > > > > if (ctx->codec->flags & FLAG_INTRA_ONLY || > > > > > avctx->gop_size <= 1) { > > > > > av_log(avctx, AV_LOG_VERBOSE, "Using intra frames > > > > > only.\n"); @@ -1861,8 +1885,13 @@ static av_cold int > > > > > vaapi_encode_init_gop_structure(AVCodecContext *avctx) > > > > > ctx->p_per_i = INT_MAX; > > > > > ctx->b_per_p = 0; > > > > > } else { > > > > > - av_log(avctx, AV_LOG_VERBOSE, "Using intra, P- and > > > > > B- > > > > > frames " > > > > > - "(supported references: %d / %d).\n", ref_l0, > > > > > ref_l1); > > > > > + if (ctx->p_to_gpb) > > > > > + av_log(avctx, AV_LOG_VERBOSE, "Using intra, GPB- > > > > > B- > > > > > frames and " > > > > > + "B-frames (supported references: %d / > > > > > %d).\n", > > > > > + ref_l0, ref_l1); > > > > > > > > Seems easier to just say intra and B-frames (though this isn't > > > > really adding anything to the message above - it's still > > > > effectively > > > > a P-frame referring to one previous frame, just using B-slices > > > > to do > > > > it in a strange way). > > > > > > > > > + else > > > > > + av_log(avctx, AV_LOG_VERBOSE, "Using intra, P- > > > > > and B- > > > > > frames " > > > > > + "(supported references: %d / %d).\n", > > > > > ref_l0, > > > > > ref_l1); > > > > > ctx->gop_size = avctx->gop_size; > > > > > ctx->p_per_i = INT_MAX; > > > > > ctx->b_per_p = avctx->max_b_frames; diff --git > > > > > a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index > > > > > b41604a883..61c5615eb8 100644 > > > > > --- a/libavcodec/vaapi_encode.h > > > > > +++ b/libavcodec/vaapi_encode.h > > > > > @@ -328,6 +328,7 @@ typedef struct VAAPIEncodeContext { > > > > > int idr_counter; > > > > > int gop_counter; > > > > > int end_of_stream; > > > > > + int p_to_gpb; > > > > > > > > > > // Whether the driver supports ROI at all. > > > > > int roi_allowed; > > > > > diff --git a/libavcodec/vaapi_encode_h265.c > > > > > b/libavcodec/vaapi_encode_h265.c index e1dc53dfa9..ea45893508 > > > > > 100644 > > > > > --- a/libavcodec/vaapi_encode_h265.c > > > > > +++ b/libavcodec/vaapi_encode_h265.c > > > > > @@ -886,6 +886,7 @@ static int > > > > > vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, > > > > > VAAPIEncodeP > > > > > ictu > > > > > re *pic, > > > > > VAAPIEncodeS > > > > > lice > > > > > *slice) > > > > > { > > > > > + VAAPIEncodeContext *ctx = avctx- > > > > > >priv_data; > > > > > VAAPIEncodeH265Context *priv = avctx- > > > > > >priv_data; > > > > > VAAPIEncodeH265Picture *hpic = pic- > > > > > >priv_data; > > > > > const H265RawSPS *sps = &priv- > > > > > >raw_sps; > > > > > @@ -908,6 +909,9 @@ static int > > > > > vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, > > > > > > > > > > sh->slice_type = hpic->slice_type; > > > > > > > > > > + if (sh->slice_type == HEVC_SLICE_P && ctx->p_to_gpb) > > > > > + sh->slice_type = HEVC_SLICE_B; > > > > > + > > > > > sh->slice_pic_order_cnt_lsb = hpic->pic_order_cnt & > > > > > (1 << (sps->log2_max_pic_order_cnt_lsb_minus4 + 4)) > > > > > - 1; > > > > > > > > > > @@ -1066,6 +1070,9 @@ static int > > > > > vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, > > > > > av_assert0(pic->type == PICTURE_TYPE_P || > > > > > pic->type == PICTURE_TYPE_B); > > > > > vslice->ref_pic_list0[0] = vpic- > > > > > >reference_frames[0]; > > > > > + if (ctx->p_to_gpb && pic->type == PICTURE_TYPE_P) > > > > > + // Reference for GPB B-frame, L0 == L1 > > > > > + vslice->ref_pic_list1[0] = vpic- > > > > > > reference_frames[0]; > > > > > } > > > > > if (pic->nb_refs >= 2) { > > > > > // Forward reference for B-frame. > > > > > @@ -1073,6 +1080,14 @@ static int > > > > > vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, > > > > > vslice->ref_pic_list1[0] = vpic- > > > > > >reference_frames[1]; > > > > > } > > > > > > > > > > + if (pic->type == PICTURE_TYPE_P && ctx->p_to_gpb) { > > > > > + vslice->slice_type = HEVC_SLICE_B; > > > > > + for (i = 0; i < FF_ARRAY_ELEMS(vslice- > > > > > >ref_pic_list0); > > > > > i++) { > > > > > + vslice->ref_pic_list1[i].picture_id = vslice- > > > > > > ref_pic_list0[i].picture_id; > > > > > + vslice->ref_pic_list1[i].flags = vslice- > > > > > > ref_pic_list0[i].flags; > > > > > + } > > > > > + } > > > > > > > > Is it sensible to implement this properly in the generic code > > > > rather > > > > than having special ad-hoc code here? > > > > > > > > (Is there any chance this will also be a thing for e.g. H.264 > > > > or > > > > H.266 in > > > > future?) > > > > > > Considering that VAConfigAttribPredictionDirection is not a > > > specific > > > attribute for hevc in VA-API, I think it is acceptable to > > > implement > > > this in the generic code. > > I tried to add the same reference twice into VAAPIEncodePicture.refs, > and h265_vaapi > can get the correct L0/L1 and picture type without any change, test > code: > https://github.com/intel-media-ci/ffmpeg/pull/485/commits/f98fa04fe26333f09cdc9a1a11b0bc65783f9ae4 > > But this change breaks slice header's information get by > VAAPIEncodePicture.refs/nb_refs: > https://github.com/intel-media-ci/ffmpeg/blob/b14321e307fcd662f8d9aaa17c7f297cba2cbe4a/libavcodec/vaapi_encode_h265.c#L927 > A tricky way is to reconstruct pic->refs/nb_refs here and remove the > duplicated reference by using > pic->refs[i]->priv_data. pic_order_cnt. Seems this way looks even > worse compare to the current implementation > in this patch. Not sure if you have any better idea? If implement this in generic code, need to add same frame into reference list twice, and also need to change a lot in hevc_vaapi. This looks much more complicated than current way. So I will keep my original change unless you have a better idea. Fei Thanks > > Thanks > Fei > > > > Thanks > > > Haihao > > > > > > > > + > > > > > return 0; > > > > > } > > > > > > > > > > > > > - Mark > > > > _______________________________________________ > > > > 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". > > > _______________________________________________ > > > 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". > > _______________________________________________ > > 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". > _______________________________________________ > 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". _______________________________________________ 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".