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 7E35E4733C for ; Thu, 5 Oct 2023 22:04:45 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A260268CB23; Fri, 6 Oct 2023 01:04:43 +0300 (EEST) Received: from w4.tutanota.de (w4.tutanota.de [81.3.6.165]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7126268C9B6 for ; Fri, 6 Oct 2023 01:04:37 +0300 (EEST) Received: from tutadb.w10.tutanota.de (unknown [192.168.1.10]) by w4.tutanota.de (Postfix) with ESMTP id 29C7810602D9 for ; Thu, 5 Oct 2023 22:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1696543477; s=s1; d=lynne.ee; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:References:Sender; bh=Y6xvBbVKnXyoK5VwuYD0d0D1LZ5SRmIpsB21P7AtLwU=; b=fHR3UxP+3vCVSY1q372oYVxZFwFqAw/qx5TiLMw37jMD0XOnRJf+xzmxREwPpY5j IDpATYGAQ/WvzuehPhp58kI7TVhDPWkUyMYyLOWFTk3I0yHDKDhuzZX0xOisXRFNymI APAXKLMuOQM1uBELD4gVIJIMXuoTIB6VFQQTWWSd8Amj6/y09E5/vpxf8Or4UVfyxbj 9cOmRLYWs0nehtadVV88C0WDkGsM3LV/BXgbArYYbeObNAIUThJna72alAAlIdf6tCg UTG7e6y5w6pMS6bXmIglqf7KOGMC7fpdaGeHmp1XTlTLorDZv6swPTtE1tVZl8Rfm0u HPn55sGHgw== Date: Fri, 6 Oct 2023 00:04:37 +0200 (CEST) From: Lynne To: Benjamin Cheng via ffmpeg-devel Message-ID: In-Reply-To: <20230930165729.50497-1-ben@bcheng.me> References: <20230930165729.50497-1-ben@bcheng.me> MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH v2] vulkan_hevc: handle non-contiguous SPS/PPS/VPS ids 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: Sep 30, 2023, 18:57 by ffmpeg-devel@ffmpeg.org: > Some clips (i.e. SLIST_B_Sony_9) will use PPS 0 and 8, before PPS 1-7. > vulkan_hevc expects {sps,pps,vps}_list to be filled in order, which > causes PPS 8 to not be added to the Vulkan session params when it is > being used by a picture. > > This removes the expectation that these lists are filled in order. The > indicies into vps_list are saved since there are multiple usages of it. > > This also fixes a bug with some clips (i.e. PPS_A_qualcomm_7) which use > all 64 available PPS slots, causing the old loop to think there are more > than 64 PPS-es. > --- > libavcodec/vulkan_hevc.c | 46 +++++++++++++++++++++++----------------- > 1 file changed, 27 insertions(+), 19 deletions(-) > > diff --git a/libavcodec/vulkan_hevc.c b/libavcodec/vulkan_hevc.c > index 52f223ceb2..9685ec14c8 100644 > --- a/libavcodec/vulkan_hevc.c > +++ b/libavcodec/vulkan_hevc.c > @@ -70,6 +70,7 @@ typedef struct HEVCHeaderSet { > > static int alloc_hevc_header_structs(FFVulkanDecodeContext *s, > int nb_vps, > + const int vps_list_idx[HEVC_MAX_VPS_COUNT], > AVBufferRef * const vps_list[HEVC_MAX_VPS_COUNT]) > { > uint8_t *data_ptr; > @@ -77,7 +78,7 @@ static int alloc_hevc_header_structs(FFVulkanDecodeContext *s, > > size_t buf_size = sizeof(HEVCHeaderSet) + nb_vps*sizeof(HEVCHeaderVPS); > for (int i = 0; i < nb_vps; i++) { > - const HEVCVPS *vps = (const HEVCVPS *)vps_list[i]->data; > + const HEVCVPS *vps = (const HEVCVPS *)vps_list[vps_list_idx[i]]->data; > buf_size += sizeof(HEVCHeaderVPSSet)*vps->vps_num_hrd_parameters; > } > > @@ -96,7 +97,7 @@ static int alloc_hevc_header_structs(FFVulkanDecodeContext *s, > hdr->hvps = (HEVCHeaderVPS *)(data_ptr + sizeof(HEVCHeaderSet)); > data_ptr += sizeof(HEVCHeaderSet) + nb_vps*sizeof(HEVCHeaderVPS); > for (int i = 0; i < nb_vps; i++) { > - const HEVCVPS *vps = (const HEVCVPS *)vps_list[i]->data; > + const HEVCVPS *vps = (const HEVCVPS *)vps_list[vps_list_idx[i]]->data; > hdr->hvps[i].sls = (HEVCHeaderVPSSet *)data_ptr; > data_ptr += sizeof(HEVCHeaderVPSSet)*vps->vps_num_hrd_parameters; > } > @@ -655,13 +656,15 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf) > .videoSessionParametersTemplate = NULL, > }; > > - int nb_vps = 0; > HEVCHeaderSet *hdr; > + int nb_vps = 0; > + int vps_list_idx[HEVC_MAX_VPS_COUNT]; > > - for (int i = 0; h->ps.vps_list[i]; i++) > - nb_vps++; > + for (int i = 0; i < HEVC_MAX_VPS_COUNT; i++) > + if (h->ps.vps_list[i]) > + vps_list_idx[nb_vps++] = i; > > - err = alloc_hevc_header_structs(dec, nb_vps, h->ps.vps_list); > + err = alloc_hevc_header_structs(dec, nb_vps, vps_list_idx, h->ps.vps_list); > if (err < 0) > return err; > > @@ -672,26 +675,31 @@ static int vk_hevc_create_params(AVCodecContext *avctx, AVBufferRef **buf) > h265_params_info.pStdVPSs = hdr->vps; > > /* SPS list */ > - for (int i = 0; h->ps.sps_list[i]; i++) { > - const HEVCSPS *sps_l = (const HEVCSPS *)h->ps.sps_list[i]->data; > - set_sps(sps_l, i, &hdr->hsps[i].scaling, &hdr->hsps[i].vui_header, > - &hdr->hsps[i].vui, &hdr->sps[i], hdr->hsps[i].nal_hdr, > - hdr->hsps[i].vcl_hdr, &hdr->hsps[i].ptl, &hdr->hsps[i].dpbm, > - &hdr->hsps[i].pal, hdr->hsps[i].str, &hdr->hsps[i].ltr); > - h265_params_info.stdSPSCount++; > + for (int i = 0; i < HEVC_MAX_SPS_COUNT; i++) { > + if (h->ps.sps_list[i]) { > + const HEVCSPS *sps_l = (const HEVCSPS *)h->ps.sps_list[i]->data; > + int idx = h265_params_info.stdSPSCount++; > + set_sps(sps_l, i, &hdr->hsps[idx].scaling, &hdr->hsps[idx].vui_header, > + &hdr->hsps[idx].vui, &hdr->sps[idx], hdr->hsps[idx].nal_hdr, > + hdr->hsps[idx].vcl_hdr, &hdr->hsps[idx].ptl, &hdr->hsps[idx].dpbm, > + &hdr->hsps[idx].pal, hdr->hsps[idx].str, &hdr->hsps[idx].ltr); > + } > } > > /* PPS list */ > - for (int i = 0; h->ps.pps_list[i]; i++) { > - const HEVCPPS *pps_l = (const HEVCPPS *)h->ps.pps_list[i]->data; > - const HEVCSPS *sps_l = (const HEVCSPS *)h->ps.sps_list[pps_l->sps_id]->data; > - set_pps(pps_l, sps_l, &hdr->hpps[i].scaling, &hdr->pps[i], &hdr->hpps[i].pal); > - h265_params_info.stdPPSCount++; > + for (int i = 0; i < HEVC_MAX_PPS_COUNT; i++) { > + if (h->ps.pps_list[i]) { > + const HEVCPPS *pps_l = (const HEVCPPS *)h->ps.pps_list[i]->data; > + const HEVCSPS *sps_l = (const HEVCSPS *)h->ps.sps_list[pps_l->sps_id]->data; > + int idx = h265_params_info.stdPPSCount++; > + set_pps(pps_l, sps_l, &hdr->hpps[idx].scaling, > + &hdr->pps[idx], &hdr->hpps[idx].pal); > + } > } > > /* VPS list */ > for (int i = 0; i < nb_vps; i++) { > - const HEVCVPS *vps_l = (const HEVCVPS *)h->ps.vps_list[i]->data; > + const HEVCVPS *vps_l = (const HEVCVPS *)h->ps.vps_list[vps_list_idx[i]]->data; > set_vps(vps_l, &hdr->vps[i], &hdr->hvps[i].ptl, &hdr->hvps[i].dpbm, > hdr->hvps[i].hdr, hdr->hvps[i].sls); > h265_params_info.stdVPSCount++; > -- > 2.42.0 > Makes sense. Thanks, pushed! _______________________________________________ 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".