From patchwork Fri Jun 7 13:01:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 49656 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp1010711vqo; Fri, 7 Jun 2024 06:07:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUqzRyp5P303zI5HxFuX/pyqLZpunXGULaxRzlmjqRwrxa2NkQvwf+uqXKZhO4YQ1K1YIA6dD4ttlC2oW0ElagMUgEZYEmQt8SzeQ== X-Google-Smtp-Source: AGHT+IEiBqNoTRanP8Nc61TImBgbHuXFQspY2ND4HPOiskfcLOFZvlIiyVegXEA9DSQQQj3kweRT X-Received: by 2002:a17:907:7f93:b0:a68:f7e8:fc1 with SMTP id a640c23a62f3a-a6cd665e5e2mr187719866b.30.1717765634978; Fri, 07 Jun 2024 06:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717765634; cv=none; d=google.com; s=arc-20160816; b=piIXonl9JrUUpbbh2EcZECxV/n6TwdRstjtcrM92f22ZauT76P0eE7ywKVOxB8ReFL w5p/S6goOSorYxqpWhm3JNH6mTRyxZRpLS0skEfEVFy4i4ZfWz+eVHL32Rl8t3NdCcrd TyXXc2xVY7vOB8maWSTP/WXn+USbTbjEO6zHr16A5YKIOyzO78c9xFlspocV1ysTWG8L pWqjNaAYcb8ioj8qpfRnww84AViyvDsMWpyPeCQm5x7xdXEJNDYJq6hPMCoBJF6J/ma9 r5YM0Ty4tYlXhhZtsSW6Gp8XYY07N64gKSiUwSvmtdxWNHY6DYKAZZNakfO2EZUsRDaT 9xOA== 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=BHpM5rbPdOf5lRcF/4zzfBoTKgpt6jA5ZRsz+kLZUEY=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=zeBBJBPR6HDCfjowke+bN1D30ndoDUvn6TJJNCv3bEVFV2l85OrpHaRCwlZlB7aJc5 59hNrU/hXVRnQZm3AVa6O6+2TGsVlVVVr+B6EU9CBLOiS+v4DkKA1vkFZNKEdbfWdLUV GTDiOaDY28jC/P91K19xdXCleviAEaFPr4m00SZwb55CTG5rKHM3nWbK17cY5dROfFPi x0bth2U33+muP6nx/SzOzckY7cGKJYxBblFJ1LRYzWp/rDZZNWG54/3OhDprilNE3S5K GmwaOw5ppZoCcmN8n4cvxZxSMqQd3qq7Jc2QUVfb9+y+gVMcbp9bcBmuKluf9CqX/jBt ynCw==; 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=Pk54RQhU; 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 a640c23a62f3a-a6c80591c56si177972266b.48.2024.06.07.06.07.14; Fri, 07 Jun 2024 06:07:14 -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=Pk54RQhU; 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 90C9968D810; Fri, 7 Jun 2024 16:04:14 +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 9979068D79D 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=Pk54RQhU; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id 8257C4DE6 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 55uI3hrXtW9g 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=K2UZV27ouY7a5+GEWssTrMVUzUFZlP3Qy2Cdz49IQ8Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Pk54RQhU8tTt/uIW4NNe0ybDrX7LVXcjA6z4pgBDE1EBCfoU+6stfoCf6KfPMzKi0 l0YRRqDQwcs3gqFo0rZh62AFVd4cNnwKLtKiZwRUP0nfWtk3Bgca1pz0brEykGRnnE CuiNrIG/uQwH4LUl56c6Pn4YCMkxfhM8RG3s6ocGUU1pR7rtaLSbfBh5KvYKpWKB1B ucaWoQJh3YD8uw5CdAcKEDNp2rt+lGmOScPU0Ul925UbwkXJZLlRmsrl04vDH/KBDe S40fxU5KaCQRU3DCxnHU4C1WvzW1P5lltpRP/pZQMOz/0JzHpyizc9sFPUb+GPPhpu B4faGwRWNLhfg== 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 0630E4DF1 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 140243A0E0A 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:12 +0200 Message-ID: <20240607130135.9088-16-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 16/39] lavc/hevcdec: do not pass HEVCContext to decode_lt_rps() 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: VIcDS2UusNy9 Pass the two numbers needed from it explicitly. Makes it clear that HEVCContext is not modified by this function. --- libavcodec/hevc/hevcdec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 6a9de79dcd..960a06c773 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -260,8 +260,8 @@ static int pred_weight_table(SliceHeader *sh, void *logctx, return 0; } -static int decode_lt_rps(HEVCContext *s, const HEVCSPS *sps, LongTermRPS *rps, - GetBitContext *gb) +static int decode_lt_rps(const HEVCSPS *sps, LongTermRPS *rps, + GetBitContext *gb, int cur_poc, int poc_lsb) { int max_poc_lsb = 1 << sps->log2_max_poc_lsb; int prev_delta_msb = 0; @@ -306,7 +306,7 @@ static int decode_lt_rps(HEVCContext *s, const HEVCSPS *sps, LongTermRPS *rps, if (i && i != nb_sps) delta += prev_delta_msb; - poc = rps->poc[i] + s->poc - delta * max_poc_lsb - s->sh.pic_order_cnt_lsb; + poc = rps->poc[i] + cur_poc - delta * max_poc_lsb - poc_lsb; if (poc != (int32_t)poc) return AVERROR_INVALIDDATA; rps->poc[i] = poc; @@ -744,7 +744,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(s, sps, &sh->long_term_rps, gb); + ret = decode_lt_rps(sps, &sh->long_term_rps, gb, s->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)