Message ID | 20240229030249.3404-1-irui.wang@mediatek.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-86076-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp144683dyb; Wed, 28 Feb 2024 19:03:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXopiNt4viXZ4Gfi7ZomrmIbwdEoCuqM92b0DhC++Lb9tgapihnDjL3QZHZhJ90d1MSLQXkSO4S9fG8Jq5Q2m/y92XeZQ== X-Google-Smtp-Source: AGHT+IGkZR2z57pwLlJ3F3orSWbthvawozuITMd1/wxruz6vwmTKJl5re4ZEoWCJG56lI//SQr/F X-Received: by 2002:a17:906:1c4b:b0:a3e:a3c3:9658 with SMTP id l11-20020a1709061c4b00b00a3ea3c39658mr477615ejg.22.1709175803623; Wed, 28 Feb 2024 19:03:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709175803; cv=pass; d=google.com; s=arc-20160816; b=uKO7+MSEIqO3Wrsnjt/zEegZamN2v1p6G6W8B89QL/5H6p7DS3RzWM2CyYSsmCooF+ 6fb4gdKRhJYxT4ZYfoBQPhQAPqG0kKl1biwyL8OaCslApsK59xi7kJhFl2eQakBH+kLY yZgLmBbKv3TquTIbQVdbYQL5WnnUOMz3X788g/zgreZ0tOpGYEl8nTdSm9CoTNVkZWK2 HrReLDNIWBMjpKElUJ4CcRbSHkc7Ye20/VcVOdZK9BX72V/X4qXU2/8x4EreIeFiJcB+ tq6dTqKbPV2ubQHIYdj0b7GzmVJ9qXoCOJXpnGuNTf/TmrOWU1BMBRof5w7hQFdIQGPv EjLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=aYhv12Ei/4yfF7DsV5pcHLs6C/tsptVLgekgyTfK2o0=; fh=fW4/mtk9ECucZGquvWVRWgMEO14S+ZJjGf6VGqn/9fQ=; b=U06MvnyEmg8q5Q7U9BfKqopWO6B9fWOLqUIn8tJbN5IwyJkb0sBJASqAeBN7boz7Qg FVILVJtnIKZa9ZJcknuoYRnG3ImF+7TWF58nHsrcsDwZ0ltcp6XTnCPRgQbxJjSqV9LF FIFr37/5f5hGysZ+CL1KFSs2YCMN8b4Ee/d+KFiyGJuxZFdG9fywSiT7/8PVcLKvA9x0 96m/jx7Wm1vJ4NCpnMODKfz7L5nmyAb+sBklAAIMayfayF6+gfO4o8pFfA9TeQk0Eoie oulx1wSpA5CyW2lOeTEuQtPaV3V21+HfqAoByHFwhwBpQYX3zgH44vizHS0iPQHydNdp vRzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=iCAyrNOE; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-86076-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86076-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x10-20020a1709064a8a00b00a4444ff5c9dsi92476eju.244.2024.02.28.19.03.23 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 19:03:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86076-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=iCAyrNOE; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-86076-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86076-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3E07D1F2402D for <ouuuleilei@gmail.com>; Thu, 29 Feb 2024 03:03:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69289374D3; Thu, 29 Feb 2024 03:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="iCAyrNOE" Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B225364A4; Thu, 29 Feb 2024 03:02:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=60.244.123.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709175782; cv=none; b=p2X26LO2aPNvmJ0BYzn5Bf0Dr7SwPg0jIv6gTIW9NQhQt2RC+DFbgC76J/p2RGu2D2NGv/iynXlt9GhAqo4g8GoqBcLHrNgh1WeQxT0m/GsMSf/l5YmXWfWfarf1iuTCewIpRAb7KCKYBk6oPJ0rAf6yntD20DvWFWwRBhhzTfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709175782; c=relaxed/simple; bh=d5YeaavC8vb1W+Ug/VmFLsdkSOi7EID7OlQsAE8E4fQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=W09ByOyoG/PXjDwgja6ElxI98luE0NSDX+t2++YkIf8T2IZz8CAhrtm+JInIIhMv94zJcFWyDnw7yLcb/u4v/qZ6I81BMXZ7cvXSLbZJfg/EvgRFLR+SdweoNBog9Apcv2m+c478xqmUVFgA0hzmwyGVIiQrEAlUbghHc0IdUEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=iCAyrNOE; arc=none smtp.client-ip=60.244.123.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 083293a2d6af11eeb8927bc1f75efef4-20240229 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=aYhv12Ei/4yfF7DsV5pcHLs6C/tsptVLgekgyTfK2o0=; b=iCAyrNOEQs9Co0VSv0GRswhR6Bf56YLJoqqT1eBCOd5DVcyEtkqbN/+LvByPUNNoBkNPoayMBAdbw3W6Rhta8oufRgHXyYZ3HVHSIMMlzAYV7ts/oYRjOm5dJWRkWnQ4ZYFek59zSk1bKSIZzXHy4/YnaWSntZ6/gVbG7mSMmv4=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:0dd5f1ff-7977-4477-8f68-18c58b84eb8b,IP:0,U RL:0,TC:0,Content:0,EDM:-30,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:-30 X-CID-META: VersionHash:6f543d0,CLOUDID:5f2353ff-c16b-4159-a099-3b9d0558e447,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:2,IP:nil,UR L:11|1,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES: 1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR,TF_CID_SPAM_ULN X-UUID: 083293a2d6af11eeb8927bc1f75efef4-20240229 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from <irui.wang@mediatek.com>) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1682834460; Thu, 29 Feb 2024 11:02:54 +0800 Received: from mtkmbs13n1.mediatek.inc (172.21.101.193) by mtkmbs13n1.mediatek.inc (172.21.101.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 29 Feb 2024 11:02:52 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 29 Feb 2024 11:02:51 +0800 From: Irui Wang <irui.wang@mediatek.com> To: Hans Verkuil <hverkuil-cisco@xs4all.nl>, Mauro Carvalho Chehab <mchehab@kernel.org>, Tiffany Lin <tiffany.lin@mediatek.com>, Matthias Brugger <matthias.bgg@gmail.com>, <angelogioacchino.delregno@collabora.com>, <nicolas.dufresne@collabora.com>, Yunfei Dong <yunfei.dong@mediatek.com>, Longfei Wang <longfei.wang@mediatek.com>, Maoguang Meng <maoguang.meng@mediatek.com> CC: Irui Wang <irui.wang@mediatek.com>, <Project_Global_Chrome_Upstream_Group@mediatek.com>, <linux-media@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org> Subject: [PATCH v2] media: mediatek: vcodec: Handle VP9 superframe bitstream with 8 sub-frames Date: Thu, 29 Feb 2024 11:02:49 +0800 Message-ID: <20240229030249.3404-1-irui.wang@mediatek.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792200727737622099 X-GMAIL-MSGID: 1792200727737622099 |
Series |
[v2] media: mediatek: vcodec: Handle VP9 superframe bitstream with 8 sub-frames
|
|
Commit Message
Irui Wang (王瑞)
Feb. 29, 2024, 3:02 a.m. UTC
The VP9 bitstream has 8 sub-frames into one superframe, the superframe
index validate failed when reach 8, modify the index checking so that the
last sub-frame can be decoded normally with stateful vp9 decoder.
Signed-off-by: Irui Wang <irui.wang@mediatek.com>
---
changed with v1:
- add a new define 'VP9_MAX_SUPER_FRAMES_NUM' for superframes.
---
.../mediatek/vcodec/decoder/vdec/vdec_vp9_if.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Comments
Hey Irui, On 29.02.2024 11:02, Irui Wang wrote: >The VP9 bitstream has 8 sub-frames into one superframe, the superframe >index validate failed when reach 8, modify the index checking so that the >last sub-frame can be decoded normally with stateful vp9 decoder. I find this commit message a bit confusing, you say that you couldn't index the last superframe, but then you say that you modify the index checking so that you can access the last sub-frame. I would reword this section, here is my suggestion: The VP9 bitstream uses superframes, which each contain 8 sub-frames, enable accessing the last superframe by increasing the range of the index validation as the maximum number of superframes is 8 and not 7. The rest looks good as already mentioned by Nicolas. Greetings, Sebastian > >Signed-off-by: Irui Wang <irui.wang@mediatek.com> >--- >changed with v1: > - add a new define 'VP9_MAX_SUPER_FRAMES_NUM' for superframes. >--- > .../mediatek/vcodec/decoder/vdec/vdec_vp9_if.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > >diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c >index 55355fa70090..039082f600c8 100644 >--- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c >+++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c >@@ -16,6 +16,7 @@ > #include "../vdec_drv_base.h" > #include "../vdec_vpu_if.h" > >+#define VP9_MAX_SUPER_FRAMES_NUM 8 > #define VP9_SUPER_FRAME_BS_SZ 64 > #define MAX_VP9_DPB_SIZE 9 > >@@ -133,11 +134,11 @@ struct vp9_sf_ref_fb { > */ > struct vdec_vp9_vsi { > unsigned char sf_bs_buf[VP9_SUPER_FRAME_BS_SZ]; >- struct vp9_sf_ref_fb sf_ref_fb[VP9_MAX_FRM_BUF_NUM-1]; >+ struct vp9_sf_ref_fb sf_ref_fb[VP9_MAX_SUPER_FRAMES_NUM]; > int sf_next_ref_fb_idx; > unsigned int sf_frm_cnt; >- unsigned int sf_frm_offset[VP9_MAX_FRM_BUF_NUM-1]; >- unsigned int sf_frm_sz[VP9_MAX_FRM_BUF_NUM-1]; >+ unsigned int sf_frm_offset[VP9_MAX_SUPER_FRAMES_NUM]; >+ unsigned int sf_frm_sz[VP9_MAX_SUPER_FRAMES_NUM]; > unsigned int sf_frm_idx; > unsigned int sf_init; > struct vdec_fb fb; >@@ -526,7 +527,7 @@ static void vp9_swap_frm_bufs(struct vdec_vp9_inst *inst) > /* if this super frame and it is not last sub-frame, get next fb for > * sub-frame decode > */ >- if (vsi->sf_frm_cnt > 0 && vsi->sf_frm_idx != vsi->sf_frm_cnt - 1) >+ if (vsi->sf_frm_cnt > 0 && vsi->sf_frm_idx != vsi->sf_frm_cnt) > vsi->sf_next_ref_fb_idx = vp9_get_sf_ref_fb(inst); > } > >@@ -735,7 +736,7 @@ static void get_free_fb(struct vdec_vp9_inst *inst, struct vdec_fb **out_fb) > > static int validate_vsi_array_indexes(struct vdec_vp9_inst *inst, > struct vdec_vp9_vsi *vsi) { >- if (vsi->sf_frm_idx >= VP9_MAX_FRM_BUF_NUM - 1) { >+ if (vsi->sf_frm_idx > VP9_MAX_SUPER_FRAMES_NUM) { > mtk_vdec_err(inst->ctx, "Invalid vsi->sf_frm_idx=%u.", vsi->sf_frm_idx); > return -EIO; > } >-- >2.18.0 > >
Dear Sebastian Sir, Thanks for your reviewing. I will reword the commit message according to your suggestion, and send a new patch v3. Thank you very much. Thanks Best Regards On Fri, 2024-03-01 at 16:13 +0100, Sebastian Fricke wrote: > Hey Irui, > > On 29.02.2024 11:02, Irui Wang wrote: > > The VP9 bitstream has 8 sub-frames into one superframe, the > > superframe > > index validate failed when reach 8, modify the index checking so > > that the > > last sub-frame can be decoded normally with stateful vp9 decoder. > > I find this commit message a bit confusing, you say that you couldn't > index the last superframe, but then you say that you modify the index > checking so that you can access the last sub-frame. > > I would reword this section, here is my suggestion: > > The VP9 bitstream uses superframes, which each contain 8 sub-frames, > enable accessing the last superframe by increasing the range of the > index validation as the maximum number of superframes is 8 and not 7. > > The rest looks good as already mentioned by Nicolas. > > Greetings, > Sebastian > > > > > Signed-off-by: Irui Wang <irui.wang@mediatek.com> > > --- > > changed with v1: > > - add a new define 'VP9_MAX_SUPER_FRAMES_NUM' for superframes. > > --- > > .../mediatek/vcodec/decoder/vdec/vdec_vp9_if.c | 11 ++++++ > > ----- > > 1 file changed, 6 insertions(+), 5 deletions(-) > > > > diff --git > > a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c > > b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c > > index 55355fa70090..039082f600c8 100644 > > --- > > a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c > > +++ > > b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c > > @@ -16,6 +16,7 @@ > > #include "../vdec_drv_base.h" > > #include "../vdec_vpu_if.h" > > > > +#define VP9_MAX_SUPER_FRAMES_NUM 8 > > #define VP9_SUPER_FRAME_BS_SZ 64 > > #define MAX_VP9_DPB_SIZE 9 > > > > @@ -133,11 +134,11 @@ struct vp9_sf_ref_fb { > > */ > > struct vdec_vp9_vsi { > > unsigned char sf_bs_buf[VP9_SUPER_FRAME_BS_SZ]; > > - struct vp9_sf_ref_fb sf_ref_fb[VP9_MAX_FRM_BUF_NUM-1]; > > + struct vp9_sf_ref_fb sf_ref_fb[VP9_MAX_SUPER_FRAMES_NUM]; > > int sf_next_ref_fb_idx; > > unsigned int sf_frm_cnt; > > - unsigned int sf_frm_offset[VP9_MAX_FRM_BUF_NUM-1]; > > - unsigned int sf_frm_sz[VP9_MAX_FRM_BUF_NUM-1]; > > + unsigned int sf_frm_offset[VP9_MAX_SUPER_FRAMES_NUM]; > > + unsigned int sf_frm_sz[VP9_MAX_SUPER_FRAMES_NUM]; > > unsigned int sf_frm_idx; > > unsigned int sf_init; > > struct vdec_fb fb; > > @@ -526,7 +527,7 @@ static void vp9_swap_frm_bufs(struct > > vdec_vp9_inst *inst) > > /* if this super frame and it is not last sub-frame, get next > > fb for > > * sub-frame decode > > */ > > - if (vsi->sf_frm_cnt > 0 && vsi->sf_frm_idx != vsi->sf_frm_cnt - > > 1) > > + if (vsi->sf_frm_cnt > 0 && vsi->sf_frm_idx != vsi->sf_frm_cnt) > > vsi->sf_next_ref_fb_idx = vp9_get_sf_ref_fb(inst); > > } > > > > @@ -735,7 +736,7 @@ static void get_free_fb(struct vdec_vp9_inst > > *inst, struct vdec_fb **out_fb) > > > > static int validate_vsi_array_indexes(struct vdec_vp9_inst *inst, > > struct vdec_vp9_vsi *vsi) { > > - if (vsi->sf_frm_idx >= VP9_MAX_FRM_BUF_NUM - 1) { > > + if (vsi->sf_frm_idx > VP9_MAX_SUPER_FRAMES_NUM) { > > mtk_vdec_err(inst->ctx, "Invalid vsi->sf_frm_idx=%u.", > > vsi->sf_frm_idx); > > return -EIO; > > } > > -- > > 2.18.0 > > > >
diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c index 55355fa70090..039082f600c8 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_if.c @@ -16,6 +16,7 @@ #include "../vdec_drv_base.h" #include "../vdec_vpu_if.h" +#define VP9_MAX_SUPER_FRAMES_NUM 8 #define VP9_SUPER_FRAME_BS_SZ 64 #define MAX_VP9_DPB_SIZE 9 @@ -133,11 +134,11 @@ struct vp9_sf_ref_fb { */ struct vdec_vp9_vsi { unsigned char sf_bs_buf[VP9_SUPER_FRAME_BS_SZ]; - struct vp9_sf_ref_fb sf_ref_fb[VP9_MAX_FRM_BUF_NUM-1]; + struct vp9_sf_ref_fb sf_ref_fb[VP9_MAX_SUPER_FRAMES_NUM]; int sf_next_ref_fb_idx; unsigned int sf_frm_cnt; - unsigned int sf_frm_offset[VP9_MAX_FRM_BUF_NUM-1]; - unsigned int sf_frm_sz[VP9_MAX_FRM_BUF_NUM-1]; + unsigned int sf_frm_offset[VP9_MAX_SUPER_FRAMES_NUM]; + unsigned int sf_frm_sz[VP9_MAX_SUPER_FRAMES_NUM]; unsigned int sf_frm_idx; unsigned int sf_init; struct vdec_fb fb; @@ -526,7 +527,7 @@ static void vp9_swap_frm_bufs(struct vdec_vp9_inst *inst) /* if this super frame and it is not last sub-frame, get next fb for * sub-frame decode */ - if (vsi->sf_frm_cnt > 0 && vsi->sf_frm_idx != vsi->sf_frm_cnt - 1) + if (vsi->sf_frm_cnt > 0 && vsi->sf_frm_idx != vsi->sf_frm_cnt) vsi->sf_next_ref_fb_idx = vp9_get_sf_ref_fb(inst); } @@ -735,7 +736,7 @@ static void get_free_fb(struct vdec_vp9_inst *inst, struct vdec_fb **out_fb) static int validate_vsi_array_indexes(struct vdec_vp9_inst *inst, struct vdec_vp9_vsi *vsi) { - if (vsi->sf_frm_idx >= VP9_MAX_FRM_BUF_NUM - 1) { + if (vsi->sf_frm_idx > VP9_MAX_SUPER_FRAMES_NUM) { mtk_vdec_err(inst->ctx, "Invalid vsi->sf_frm_idx=%u.", vsi->sf_frm_idx); return -EIO; }