From patchwork Fri Jun 7 13:01:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 49650 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp1009985vqo; Fri, 7 Jun 2024 06:06:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCW0+2HTJ37JZBXJIRx+nyf8cJxWH0XhCXXOBPa8BGNwhwmWc0w93IRKIQLlAu67cQ+zGK64CJmvJ7s2nQVRjYDe0g3BXu4XDR0DeQ== X-Google-Smtp-Source: AGHT+IHDzZ+iKG2STzS6f0KQiR35Xw+6WNP8QGipF8kkE3m6rFaB+ELS3TBLD1L0ebmv0ccSpmMg X-Received: by 2002:a2e:2ac2:0:b0:2ea:cd8e:2119 with SMTP id 38308e7fff4ca-2eadce1e77cmr16097521fa.1.1717765572713; Fri, 07 Jun 2024 06:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717765572; cv=none; d=google.com; s=arc-20160816; b=rjXfNdLgE/Ra0DuNAoQopxe/ca1b/kFr7ZGesYNVfUvY60GZbjCtsovDPclF1+/BJb qnSF7UChhYMQNxa+sTUvacVZQZVt81dCAiX5deZ1+ldXyAjKFbRjYneMoh4q7QotMjKi Sbx+iLIFisjLYaJDKSpPgWcGOUjPYv5YxVCmKNSLoVsnFMdagWgvZBLaIHCRkErDY0lt kRBinD9UqAb8gz2Bhy+7XglW7UOjWNtF6Xd0RBV0Ebd2OHCcEEr1PuIxZHoZe6hD1Ajd G+lFzEGHDvnfk1Ub8tCtqnlyAgR067zELGbLtzYv2ALqdby1t8skksgsI726Q4MvTjJc RgEw== 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=BQjLGqxXA3h8kglX/ij0fLkDAvKDSKOYIFg6q+c/cxM=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=jz/aPWmiX6IuTGFMBPDY2mZZZVpRAqCjg8/qRkLo1vzLfnGpVVZzb7y12uJkmqbC1U +KuUn0VII+BQs06fAQbmzDUkxBUAK7iSKvAdorMNqZ1/oGHiidl9G5JDPs8PJHnvQYp2 Vx5GClXJ7aqJmWdBXArWYX9IiwnsZ97g7WGTGev+CUUdHhsFkP2noBA+q/RQ+1ss0UjB 3DegIPbNmzeQ7RmF91sgOWhkuA03TvQycZMNYmuQwhoTfyxXaXRjpZKEzLehFtxtjEdz yjpajqKkEHDW21FS0m0Gl7MSqannPU9GVLUXFoWaOPUCgMb8ObX2XYtlKfYpHegLn0vB s4Bg==; 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=mj9h5+cc; 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 38308e7fff4ca-2ead41682bdsi9637731fa.350.2024.06.07.06.06.12; Fri, 07 Jun 2024 06:06:12 -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=mj9h5+cc; 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 1868F68D6D2; Fri, 7 Jun 2024 16:04:07 +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 6CA8068D77E for ; Fri, 7 Jun 2024 16:03:50 +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=mj9h5+cc; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 859FD4DE9 for ; Fri, 7 Jun 2024 15:03:49 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id uqbJZp9Sj2lM for ; Fri, 7 Jun 2024 15:03:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1717765422; bh=eO2n0goeaxSBqHo29iV307YATpMzChq6hGwCLPD7420=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mj9h5+ccK563leXz1MSRUahEZrWgAo5C8dWBPUAm5gnzIRi6vAL0GAaoEMo8vinIZ e9STtnsujayjkVU3gSP4Cpv+HyVEIEMCNcKRtAHPk0bMjv052Gzdd7eEEjpZbvi+Wh dGp2f0a1fXhUwSJo7zXzOkv5HHumbbDqbvo1+xP/ZwjHoibTX0bvWu7DQqbbJYoq3o 2oWWQInDD9qSiNUpbvcoqCYscHTH6LBXBwmsKTWExbxFCPTlhA0P3HUEqee1f0kOB5 /SGJaRERhf/rSZQvaaiJGO9tGVWyi0lZUxfoABgMfFLw0tS9ho6Xj8AdJWPNyP+sVz K8RKkXoQLf0Xg== 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 064CD4DF8 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 1FBC93A0E8F 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:13 +0200 Message-ID: <20240607130135.9088-17-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 17/39] lavc/hevcdec: move pocTid0 computation 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: ZLbhh0z7D5kc It is only done once per frame. Also, rename the variable to poc_tid0 to be consistent with our naming conventions. --- libavcodec/hevc/hevcdec.c | 26 +++++++++++++------------- libavcodec/hevc/hevcdec.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 960a06c773..dd3c188418 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -711,7 +711,7 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) int poc, pos; sh->pic_order_cnt_lsb = get_bits(gb, sps->log2_max_poc_lsb); - poc = ff_hevc_compute_poc(sps, s->pocTid0, sh->pic_order_cnt_lsb, s->nal_unit_type); + poc = ff_hevc_compute_poc(sps, s->poc_tid0, sh->pic_order_cnt_lsb, s->nal_unit_type); if (!sh->first_slice_in_pic_flag && poc != s->poc) { av_log(s->avctx, AV_LOG_WARNING, "Ignoring POC change between slices: %d -> %d\n", s->poc, poc); @@ -766,17 +766,6 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) sh->slice_temporal_mvp_enabled_flag = 0; } - /* 8.3.1 */ - if (sh->first_slice_in_pic_flag && s->temporal_id == 0 && - s->nal_unit_type != HEVC_NAL_TRAIL_N && - s->nal_unit_type != HEVC_NAL_TSA_N && - s->nal_unit_type != HEVC_NAL_STSA_N && - s->nal_unit_type != HEVC_NAL_RADL_N && - s->nal_unit_type != HEVC_NAL_RADL_R && - s->nal_unit_type != HEVC_NAL_RASL_N && - s->nal_unit_type != HEVC_NAL_RASL_R) - s->pocTid0 = s->poc; - if (sps->sao_enabled) { sh->slice_sample_adaptive_offset_flag[0] = get_bits1(gb); if (sps->chroma_format_idc) { @@ -2942,6 +2931,17 @@ static int hevc_frame_start(HEVCContext *s) s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || (s->nal_unit_type == HEVC_NAL_CRA_NUT && s->last_eos); + /* 8.3.1 */ + if (s->temporal_id == 0 && + s->nal_unit_type != HEVC_NAL_TRAIL_N && + s->nal_unit_type != HEVC_NAL_TSA_N && + s->nal_unit_type != HEVC_NAL_STSA_N && + s->nal_unit_type != HEVC_NAL_RADL_N && + s->nal_unit_type != HEVC_NAL_RADL_R && + s->nal_unit_type != HEVC_NAL_RASL_N && + s->nal_unit_type != HEVC_NAL_RASL_R) + s->poc_tid0 = s->poc; + if (pps->tiles_enabled_flag) s->local_ctx[0].end_of_tiles_x = pps->column_width[0] << sps->log2_ctb_size; @@ -3623,7 +3623,7 @@ static int hevc_update_thread_context(AVCodecContext *dst, s->seq_decode = s0->seq_decode; s->seq_output = s0->seq_output; - s->pocTid0 = s0->pocTid0; + s->poc_tid0 = s0->poc_tid0; s->max_ra = s0->max_ra; s->eos = s0->eos; s->no_rasl_output_flag = s0->no_rasl_output_flag; diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h index c58ce05639..4b28494366 100644 --- a/libavcodec/hevc/hevcdec.h +++ b/libavcodec/hevc/hevcdec.h @@ -483,7 +483,7 @@ typedef struct HEVCContext { HEVCFrame *collocated_ref; HEVCFrame DPB[32]; int poc; - int pocTid0; + int poc_tid0; int slice_idx; ///< number of the slice being currently decoded int eos; ///< current packet contains an EOS/EOB NAL int last_eos; ///< last packet contains an EOS/EOB NAL