From patchwork Fri Jun 7 13:01:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 49669 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp1012925vqo; Fri, 7 Jun 2024 06:10:23 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCULWKdy9+V5kQjWrEMK8ZoNAgmBtxbl8Phjj7vO8kc4GnREGI530uP9jevsIJXnZ+6ctBSWdADWWQ9SPnnr3KScIEt/cR/MAhVVGw== X-Google-Smtp-Source: AGHT+IEM2Gu2qkTQgZ+/q1bTN8NpksesjtxMlBzshk0EVyNNFPrtGaE9OnMtUNO9M2CX4qdpCraE X-Received: by 2002:a05:6512:15a0:b0:522:2a2c:759e with SMTP id 2adb3069b0e04-52bb9f5de1bmr2035648e87.6.1717765823750; Fri, 07 Jun 2024 06:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717765823; cv=none; d=google.com; s=arc-20160816; b=QhJTeQ3svT0WaGhT0G45ozYezgCCOJPvZzk05Rkj/csdeB7WaIIKdlwLGwmIwgeSG/ hdFz6CHRMX+xAq5b4VH0wzuRwT025d8MACb9Lhp98XieM9K7LLTN/CxixO909OvJ5fYv XAHQ+unrb4TNNSrG/BdHlwwpRTZ/gogrKM77J1yvcU2K/XuUin0ZXXF3S2MGKzbYyacl Z1wuIjBaEAv9g8IJ/Ei/CgWWUWUbIN2owdZuOvfQslff5DUbEnB+EdvwmPVVWrzepWSv k59mziX69+exS7H4clLMz5Bwpn+of7GEPkkJ05zLaW3aHk04qZFMinkJQE9nfKdCqkjU HHtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=nW/it4sttWBzGpxLc+lX+sYgbQMwlZpagQB4PUglzKE=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=sCoouXd/jWmC9lY0V1wFBGwPZSGHDm/WD8B1GKyZPCc0P4g2+LGxwUlsnUiQRS9Zgs V1IYZu1WZQqbXudzWdG4GxoEx71DsOA8CmYP8sVT4pO2FnZBAOHNlLMX1K79gNrg5+F0 fWIEYqwvzblRH/RAYzKg5se64+TEGHkJXAz4/kEvAi6S0Wtrl4z+U8ryG30hbCNEjrC6 JNq639XSHYwXDGqN61AttHbMsxzQ9ogzOjlFkjElk97fVtpO310rccE4ENQ0/ANDWTmt lCw80T2DASvsPBd8WsflXa9aVkQsMEYqmMliIu37///DxdrJciNU23IU4xBX/QyDVTXP uS5A==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=KyaSNuPm; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 2adb3069b0e04-52bb41dbff1si1024348e87.334.2024.06.07.06.10.20; Fri, 07 Jun 2024 06:10:23 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=KyaSNuPm; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8C36C68D874; Fri, 7 Jun 2024 16:04:38 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4252568D2A2 for ; Fri, 7 Jun 2024 16:03:52 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=KyaSNuPm; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 2DF5D4D76 for ; Fri, 7 Jun 2024 15:03:52 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id 2xle7cKVK7Zm for ; Fri, 7 Jun 2024 15:03:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1717765423; bh=kCYiNFk8I7jqt9yzhJAmkemhXb+6n5JsA40aYc5T6lQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KyaSNuPmbrZ1c6088AbA8Vs6C1U50GfUU83kp5Wk8sw1oyNjd59Qo4IX3vxRbDGGR /+skIik4TITnLevkyc1oTA82/ilqnE7kbmbrCBorK5rq2AL3AdST/iocLBshoxoAP1 7rpdH4d+lqL6nyRehomJar66uqBXQ6wfnKCK0VqsRa6PhdYAccYE2f7HC8pSxCiuQ4 Fbf/MApn8+GHCwLen4aY1a2NweN7TEMZDnFEXUeb9gWHndbU5Vg54+WEthArBN6GIQ hlt+XWsWJnz7p46hvLEbzE8oac/scr57ZhXvpT6TB7zjkHXzwAkGAofEtlogfMUJel woUodSE8O+FWA== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id F1BAD4DFC for ; Fri, 7 Jun 2024 15:03:42 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id CE9463A1ABC for ; Fri, 07 Jun 2024 15:03:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jun 2024 15:01:28 +0200 Message-ID: <20240607130135.9088-32-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240607130135.9088-1-anton@khirnov.net> References: <20240607130135.9088-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 32/39] lavc/hevcdec: move sequence increment/IDR handling to hevc_frame_start() 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: yHDyWEgUO09V From hls_slice_header(). It is only done once per frame, so that is a more appropriate place for this code. --- libavcodec/hevc/hevcdec.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 9abae3260d..b13e3e06a3 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -604,11 +604,6 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) return 1; // This slice will be skipped later, do not corrupt state } - if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) { - s->seq_decode = (s->seq_decode + 1) & HEVC_SEQUENCE_COUNTER_MASK; - if (IS_IDR(s)) - ff_hevc_clear_refs(s); - } sh->no_output_of_prior_pics_flag = 0; if (IS_IRAP(s)) sh->no_output_of_prior_pics_flag = get_bits1(gb); @@ -2949,6 +2944,12 @@ static int hevc_frame_start(HEVCContext *s) memset(s->is_pcm, 0, (sps->min_pu_width + 1) * (sps->min_pu_height + 1)); memset(s->tab_slice_address, -1, pic_size_in_ctb * sizeof(*s->tab_slice_address)); + if ((IS_IDR(s) || IS_BLA(s))) { + s->seq_decode = (s->seq_decode + 1) & HEVC_SEQUENCE_COUNTER_MASK; + if (IS_IDR(s)) + ff_hevc_clear_refs(s); + } + s->is_decoded = 0; s->slice_idx = 0; s->first_nal_type = s->nal_unit_type;