From patchwork Fri Jun 7 13:01:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 49658 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp1010929vqo; Fri, 7 Jun 2024 06:07:35 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUbDjFcknnBoV51TuyJUHyifQpMGo5lvPPO3tkCF4jt/q0psDsxoRyb3DAY0mTxzRwMjZLQMwY8IX7r6lq10Hz2uSvXM95wDaEqTA== X-Google-Smtp-Source: AGHT+IG3OuNlqXMS1uRicOyyrQC93BMpBqI7sO44LK2jwrx4nFt+TtVnkyAFgXZb6ZCy2ClyxPan X-Received: by 2002:a50:96c2:0:b0:57c:6042:2224 with SMTP id 4fb4d7f45d1cf-57c604225dbmr554740a12.24.1717765654934; Fri, 07 Jun 2024 06:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717765654; cv=none; d=google.com; s=arc-20160816; b=a0YB3l2Pfpezk3klRg9XeOaoeUKe8P/2gU5UFSerHgSTISY1kgIc6ErGe9UGhgE+bz bQjtDxlM8VIK3yNm48UGTs9xFp1n6XTDko/SBTARuLxRmiG9MTim04zYMHY61WDixnRb KI6iCA5i3F3TbwkdGMHc89WZoRUyV8zBOb9D+2J2Lsm37VV9K5n2mLCPMRDYzZOpm7+1 i3sIXkodULt4oqYS3Vndr40GhQUtreffzxX/0Xkovh7pKwnSsmQtb8TJJGlMYwruywLN VinOHjGNWY1gS+H51vCkT3ji95e9hdpMOoUFYtjxM49gbYcppacdOuxcF0ri9SbpWJZQ g4xg== 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=1jIZC3S8Jzodue/D+7nMmGDLuKLAA4R1MedIA5tKa7g=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=dVUpqIJR91thBriWlFUiXHZJQrt5vXqCkSFQmCAfEAk7lwjzNoYWJovNZ/56z6LlAz 0/Rz49EaX4NuzK88QvnDa1y5NoBtZWD1tkmtS2me9xepQ76sJsucuXuZUueYVXX/TUvy 4+Hek7rjPVrLBEJg2OpvkUu/iiabX0vIqZLpFEbLuj8/fI8pm6J8lalC4R1MIaFK5fHt d/vaj+kwMLSzA7nqZdh8b4Z9y0NrOKKvUGamF+SRlSAXWFgaB6rlIHPGgMib8uDetHh5 paISoWTJ8keto651AW+OQrfWnwZ3/h8w5NpHNe5LFy3zeAth7hwGHL7ftmRAV7p30rFS JQ6Q==; 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=F0a0tnxs; 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 4fb4d7f45d1cf-57c5f4ef258si426998a12.240.2024.06.07.06.07.34; Fri, 07 Jun 2024 06:07:34 -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=F0a0tnxs; 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 E713F68D826; Fri, 7 Jun 2024 16:04:16 +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 B1AC768D785 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=F0a0tnxs; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 9D2374DA7 for ; Fri, 7 Jun 2024 15:03:50 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id KhjAB-kBuI_j for ; Fri, 7 Jun 2024 15:03:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1717765422; bh=yTXOYU0el60SJpwvDc8RgHTTPACQcSsSySHbP2lTr6s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=F0a0tnxsiDv+J5Hujhwa2Kab3VLVocpBR9SgNUZ9XTDbb1KMXb4tEhoZoiW9sjkpG jAgxGD9chjd6PO42J5yF0Ls+u4fZRkla6HIqTbcVpWwKGZZuqE+JCLJDogAF1M5AEk zIdUZjB9yqxPBw6STttc9vNR6h5mL3zLNlxajNAdpCBsAt0cntrPDdIUvde+7TrbO6 mXvjiml5vAHXwBP/fKR/oDtsNgy8PMX8Gaa549oNE7eZLoB6Z/F1bpMriZl0uULG78 SHWDsRvl1P75GcpX/pKM8e/RSygXIJCulALeU8PXSw3tfx0AwR3pDBUMtsAKuSVYGv Sp+AOcGrL9uLQ== 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 6B8644E04 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 71F903A1877 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:20 +0200 Message-ID: <20240607130135.9088-24-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 24/39] lavc/hevcdec: store slice header POC in SliceHeader 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: dMuxSwD1Yw1C Rather than decoding directly into HEVCContext.poc. This is a step towards constifying HEVCContext in hls_slice_header(). --- libavcodec/hevc/hevcdec.c | 13 +++++++------ libavcodec/hevc/hevcdec.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index f867fdbea5..df6d1565bc 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -706,14 +706,14 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) sh->pic_order_cnt_lsb = get_bits(gb, sps->log2_max_poc_lsb); 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) { + if (!sh->first_slice_in_pic_flag && poc != sh->poc) { av_log(s->avctx, AV_LOG_WARNING, - "Ignoring POC change between slices: %d -> %d\n", s->poc, poc); + "Ignoring POC change between slices: %d -> %d\n", poc, sh->poc); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; - poc = s->poc; + poc = sh->poc; } - s->poc = poc; + sh->poc = poc; sh->short_term_ref_pic_set_sps_flag = get_bits1(gb); pos = get_bits_left(gb); @@ -738,7 +738,7 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) sh->short_term_ref_pic_set_size = pos - get_bits_left(gb); pos = get_bits_left(gb); - ret = decode_lt_rps(sps, &sh->long_term_rps, gb, s->poc, sh->pic_order_cnt_lsb); + ret = decode_lt_rps(sps, &sh->long_term_rps, gb, sh->poc, sh->pic_order_cnt_lsb); if (ret < 0) { av_log(s->avctx, AV_LOG_WARNING, "Invalid long term RPS.\n"); if (s->avctx->err_recognition & AV_EF_EXPLODE) @@ -751,7 +751,7 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) else sh->slice_temporal_mvp_enabled_flag = 0; } else { - s->poc = 0; + sh->poc = 0; sh->pic_order_cnt_lsb = 0; sh->short_term_ref_pic_set_sps_flag = 0; sh->short_term_ref_pic_set_size = 0; @@ -2920,6 +2920,7 @@ static int hevc_frame_start(HEVCContext *s) s->is_decoded = 0; s->first_nal_type = s->nal_unit_type; + s->poc = s->sh.poc; if (IS_IRAP(s)) s->no_rasl_output_flag = IS_IDR(s) || IS_BLA(s) || diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h index 75026a8deb..e47a7107c8 100644 --- a/libavcodec/hevc/hevcdec.h +++ b/libavcodec/hevc/hevcdec.h @@ -209,6 +209,7 @@ typedef struct SliceHeader { enum HEVCSliceType slice_type; int pic_order_cnt_lsb; + int poc; uint8_t first_slice_in_pic_flag; uint8_t dependent_slice_segment_flag;