From patchwork Thu Mar 31 19:37:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 12797623 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 047D3C433F5 for ; Thu, 31 Mar 2022 19:37:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240815AbiCaTjf (ORCPT ); Thu, 31 Mar 2022 15:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240781AbiCaTj2 (ORCPT ); Thu, 31 Mar 2022 15:39:28 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70D3222451D; Thu, 31 Mar 2022 12:37:40 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: nicolas) with ESMTPSA id A47591F47247 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1648755459; bh=XWSCMrc+NrLm1p3fYYJooFLeLhu8K+wqylIt0iyj7Vc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ci2A27WG3nn3hVwxc9jwIR3E4CPWTQcVTJX69lc7p4gFqCHtA6JBUl2Zc403FpXq5 LkQ1jV3EkM9Dn964TVruUiU4v9lkrRH9Fb7J0VIytyFFZtFeOIktrZzNfcxOPviNDp o0jMoLjQioZWZclguu1x7RvVwgXbWK1O6VGJRcseqdEWPy8sEYg/hqZUdFQ2x9J9oq g5RbA6c821YYmIh0tZ95dqRwo/xZCZW2B5tcxonaUAFoGB/d/vG4+jCtUYEX65iuB6 1l7ebu99zlOQkx1eBuyjPSfSIpK3Oy/QWqai+EVzKRIlJnavqmkwAlyP/y7mQs+0mr IYSHXnNduxHAw== From: Nicolas Dufresne To: Mauro Carvalho Chehab Cc: kernel@collabora.com, Sebastian Fricke , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 04/23] media: h264: Avoid wrapping long_term_frame_idx Date: Thu, 31 Mar 2022 15:37:06 -0400 Message-Id: <20220331193726.289559-5-nicolas.dufresne@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220331193726.289559-1-nicolas.dufresne@collabora.com> References: <20220331193726.289559-1-nicolas.dufresne@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org For long term references, frame_num is set to long_term_frame_idx which does not require wrapping. This is fixed by observation, no directly related issue have been found yet. Signed-off-by: Nicolas Dufresne Reviewed-by: Sebastian Fricke Reviewed-by: Ezequiel Garcia --- drivers/media/v4l2-core/v4l2-h264.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-h264.c b/drivers/media/v4l2-core/v4l2-h264.c index 5633a242520a..ac47519a9fbe 100644 --- a/drivers/media/v4l2-core/v4l2-h264.c +++ b/drivers/media/v4l2-core/v4l2-h264.c @@ -57,8 +57,10 @@ v4l2_h264_init_reflist_builder(struct v4l2_h264_reflist_builder *b, * '8.2.4.1 Decoding process for picture numbers' of the spec. * TODO: This logic will have to be adjusted when we start * supporting interlaced content. + * For long term references, frame_num is set to + * long_term_frame_idx which requires no wrapping. */ - if (dpb[i].frame_num > cur_frame_num) + if (!b->refs[i].longterm && dpb[i].frame_num > cur_frame_num) b->refs[i].frame_num = (int)dpb[i].frame_num - max_frame_num; else