From patchwork Mon Mar 28 19:59:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Dufresne X-Patchwork-Id: 12794175 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 BEABEC433EF for ; Mon, 28 Mar 2022 19:59:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235927AbiC1UBh (ORCPT ); Mon, 28 Mar 2022 16:01:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344003AbiC1UBf (ORCPT ); Mon, 28 Mar 2022 16:01:35 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F24163969A; Mon, 28 Mar 2022 12:59:54 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: nicolas) with ESMTPSA id D7E931F43853 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1648497593; bh=koeYZVYa1e9V9VAWFVOsniYBHyi6nWtDcIkC0przTEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n4LqLgpBupA7Vw6AD5z/wVRO3g7+he2wEA288iD6Ho4mfTQVWnM+FTZpAmFZPZDaH oj4IlQXm7SvqKU/H10sqMz9poEwuzZUeiG8gEE5WzvHIvwCs7WZRCcgSfye+qzqCfR EoHcip48VZ/+lhfc0OdQ+tsFwhTfX/RxMezGwkbxBdD6s2MPplK0ASSQ54/PjzgfCw avIr1tSLDsp4s9vUcNp4o92zyvncm2ExFJAxNiqgzqwdLtEvnEJO9t1et5oL61egqu r9mDlWWDSqwT3dXjH0VK0+X7DkXmvrAh6x4UzBbdnW5aC27R57F6deeFO515CWc3xf Kh5Hc7D/2cwPQ== From: Nicolas Dufresne To: Mauro Carvalho Chehab Cc: kernel@collabora.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 03/24] media: h264: Avoid wrapping long_term_frame_idx Date: Mon, 28 Mar 2022 15:59:15 -0400 Message-Id: <20220328195936.82552-4-nicolas.dufresne@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220328195936.82552-1-nicolas.dufresne@collabora.com> References: <20220328195936.82552-1-nicolas.dufresne@collabora.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org For long term reference, frame_num is set to long_term_frame_idx which does not require wrapping. This if fixed by observation, no directly related issue have been found yet. Signed-off-by: Nicolas Dufresne Reviewed-by: Sebastian Fricke --- 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 8d750ee69e74..aebed1cbe05a 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 reference, 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