From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 08EFE4B4BB for ; Fri, 7 Jun 2024 13:06:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB0C768D6A6; Fri, 7 Jun 2024 16:04:07 +0300 (EEST) Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 725CD68D782 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=grx3cuyu; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 3CA764DF2 for ; Fri, 7 Jun 2024 15:03:48 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id Mk4BdSRIGllS for ; Fri, 7 Jun 2024 15:03:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1717765422; bh=kXL7ou06MZalsHE5CvfLjYkQ4JYpQXT3hMUg3tJzhMI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=grx3cuyuE/NEesaX4645qkt9hOq0VbzkJrUGWnA/ueKVr06rJdI7xNKW621WCtuxF EQiypK3OTJ2KXvAe2li9wz+Xx5v/CY6B32oGMIMYohyHmiAHo6Lhw859hoMve5QSuH Z1GmCh8gL1qDIK2aGUxbzIiVNbXF/z3aGQvY1ynxTPvOKyZ9HPwYOYfvK7RuEjBWi+ 9lOJI9tyWp/xz0kv9ZvG3kRx1aAxszoHbl54sXkuwjsWpJGovijDgSZYfmxBfddY0k azQAhbDuD7Kfn0qBQtyCEXBBXFYjNYxhq9FM4vnBP9QMh4Zd+GFpN+w3HuG0L19kLH LMrgU06pDht8Q== 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 064364DF4 for ; Fri, 7 Jun 2024 15:03:41 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 374873A1513 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:15 +0200 Message-ID: <20240607130135.9088-19-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 19/39] lavc/hevcdec: do not pass HEVCContext to ff_hevc_frame_nb_refs() 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Pass the only things required from it - slice header and PPS - explicitly. Will be useful in the following commits to avoid mofiying HEVCContext in hls_slice_header(). --- libavcodec/hevc/hevcdec.c | 2 +- libavcodec/hevc/hevcdec.h | 2 +- libavcodec/hevc/refs.c | 8 ++++---- libavcodec/nvdec_hevc.c | 2 +- libavcodec/vdpau_hevc.c | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index bf6e93ba1b..585a066426 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -795,7 +795,7 @@ static int hls_slice_header(HEVCContext *s, GetBitContext *gb) sh->rpl_modification_flag[0] = 0; sh->rpl_modification_flag[1] = 0; - nb_refs = ff_hevc_frame_nb_refs(s); + nb_refs = ff_hevc_frame_nb_refs(sh, pps); if (!nb_refs) { av_log(s->avctx, AV_LOG_ERROR, "Zero refs for a frame with P or B slices.\n"); return AVERROR_INVALIDDATA; diff --git a/libavcodec/hevc/hevcdec.h b/libavcodec/hevc/hevcdec.h index 4b28494366..5eaebd3584 100644 --- a/libavcodec/hevc/hevcdec.h +++ b/libavcodec/hevc/hevcdec.h @@ -614,7 +614,7 @@ int ff_hevc_res_scale_sign_flag(HEVCLocalContext *lc, int idx); /** * Get the number of candidate references for the current frame. */ -int ff_hevc_frame_nb_refs(const HEVCContext *s); +int ff_hevc_frame_nb_refs(const SliceHeader *sh, const HEVCPPS *pps); int ff_hevc_set_new_ref(HEVCContext *s, int poc); diff --git a/libavcodec/hevc/refs.c b/libavcodec/hevc/refs.c index 31fcd49d69..5bd5eab9f1 100644 --- a/libavcodec/hevc/refs.c +++ b/libavcodec/hevc/refs.c @@ -526,12 +526,12 @@ fail: return ret; } -int ff_hevc_frame_nb_refs(const HEVCContext *s) +int ff_hevc_frame_nb_refs(const SliceHeader *sh, const HEVCPPS *pps) { int ret = 0; int i; - const ShortTermRPS *rps = s->sh.short_term_rps; - const LongTermRPS *long_rps = &s->sh.long_term_rps; + const ShortTermRPS *rps = sh->short_term_rps; + const LongTermRPS *long_rps = &sh->long_term_rps; if (rps) { for (i = 0; i < rps->num_negative_pics; i++) @@ -545,7 +545,7 @@ int ff_hevc_frame_nb_refs(const HEVCContext *s) ret += !!long_rps->used[i]; } - if (s->pps->pps_curr_pic_ref_enabled_flag) + if (pps->pps_curr_pic_ref_enabled_flag) ret++; return ret; diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c index 0bebca7568..ce66ddcfb7 100644 --- a/libavcodec/nvdec_hevc.c +++ b/libavcodec/nvdec_hevc.c @@ -187,7 +187,7 @@ static int nvdec_hevc_start_frame(AVCodecContext *avctx, .NumBitsForShortTermRPSInSlice = s->sh.short_term_rps ? s->sh.short_term_ref_pic_set_size : 0, .NumDeltaPocsOfRefRpsIdx = s->sh.short_term_rps ? s->sh.short_term_rps->rps_idx_num_delta_pocs : 0, - .NumPocTotalCurr = ff_hevc_frame_nb_refs(s), + .NumPocTotalCurr = ff_hevc_frame_nb_refs(&s->sh, pps), .NumPocStCurrBefore = s->rps[ST_CURR_BEF].nb_refs, .NumPocStCurrAfter = s->rps[ST_CURR_AFT].nb_refs, .NumPocLtCurr = s->rps[LT_CURR].nb_refs, diff --git a/libavcodec/vdpau_hevc.c b/libavcodec/vdpau_hevc.c index 3db7ec156a..b9e922ecfc 100644 --- a/libavcodec/vdpau_hevc.c +++ b/libavcodec/vdpau_hevc.c @@ -205,7 +205,7 @@ static int vdpau_hevc_start_frame(AVCodecContext *avctx, } } /* See section 7.4.7.2 of the specification. */ - info->NumPocTotalCurr = ff_hevc_frame_nb_refs(h); + info->NumPocTotalCurr = ff_hevc_frame_nb_refs(&h->sh, pps); if (sh->short_term_ref_pic_set_sps_flag == 0 && sh->short_term_rps) { /* Corresponds to specification field, NumDeltaPocs[RefRpsIdx]. Only applicable when short_term_ref_pic_set_sps_flag == 0. -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".