From patchwork Tue Jun 7 07:08:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 36083 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6914:b0:82:6b11:2509 with SMTP id q20csp6703315pzj; Tue, 7 Jun 2022 00:15:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyh7e+rVrn66gmhvb3BITCfntHaRyaH+tCk+I1cC05zjKxocLpDb8RgWjTIkm2uhyoe9h29 X-Received: by 2002:a17:906:2316:b0:711:e7f2:a33 with SMTP id l22-20020a170906231600b00711e7f20a33mr72565eja.726.1654586155955; Tue, 07 Jun 2022 00:15:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654586155; cv=none; d=google.com; s=arc-20160816; b=iAYzKYgCQJXwFlBV+EnlGNKtMyACvotqYd2wH8MfbszjsFmbPu/xFQzLlFRhX9QaCM aukWh5oprYJr3+zMaZ/50TenEXOz0q2OJP/wIK0zWRan9Rcdo3gSRz8TUjgtwemmq7zn ga+C1rUw1qqZFchFCxaDXa/tDrzleKo/TPPY0MkaEheKKhQPWcvp4SoVax9qwLbXxo4y ExSorz2vNCev6koWuV11dODV5S8WXgzajyBLUWSAYX/MyqLzqIMckZR3jSUYLb96gYm8 8ymqk2wJiGlSBQnMih1qoK+8ikxWtI6s0oDvr3/Nu7qm3HXOyBo/51eQUFhAoMldsS7u lhoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc: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=EOZ8Uv3i/B09xoyYPjZazaQ3hyFWeyj+gbVvYXmPVEo=; b=m2LIRWdKItBHjWP6YfuKh71OR5iVGrXOB/H9D1dbNVKie+WY+4CL9ZZdzi5IKXKcSP 7t0MsbC9TRj11iGRDRvXOGkv7Zgbgmzk+SqymroVpVjJ4C+XtAKAJVJ2PxM6bFBWHo3i SngWQLXH/h067ss6DlmFYOkQce9j+qSZ51nrLgEuoHdIVQJnjb51g3kJwOwi88F9CwRQ 4X2go03wRabfzj3TGh6Fc2quz7PggjZm0Cj9vdGeMVY2TrtglJnfBFYNCzotA3NjTrgh WVSRxzIYzSQCzX0oKuV/cU7eOHxpBF1js25qCpVRwN7kJtXYi6eEj4B/lPlVoUkls4pj zpcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=eSo7KuHU; 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 z70-20020a509e4c000000b0042dd79e606fsi12585395ede.478.2022.06.07.00.15.55; Tue, 07 Jun 2022 00:15:55 -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=@intel.com header.s=Intel header.b=eSo7KuHU; 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 4B33068B5AE; Tue, 7 Jun 2022 10:15:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2354A68B5AE for ; Tue, 7 Jun 2022 10:15:29 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654586135; x=1686122135; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HngGoGa5MSvythMXPwrNqCaAFNc/UpEMGVnVsgVih20=; b=eSo7KuHUCh/7YBs2ttM/6866lWjmYFaKwAuHC3MQxw+Bzf3n8EDe+znR Nx4Nh1asN5A2u1STXxkCMG+7Gyz/GAQnEZfhlosDzet8GDvQmIcNYkbGD i+82fs2KxI9jJnAkojJprKLSvtF2t3/4QhP4zpLYEFHxfrIlDTWbFnbPm psYgCWvriNh593l00cyclChpDp8GWvFr9f+idSgxB5X99NdKUFc67aJoz JYi9ykW0UcMMuJAzzkowk0KRFZ2Hlc26QLSEncBxV6GiDjFwJJ8LvSJQT EFLBvk4krXTv+iWQenJp0JCCb259Y+2llj/eB7UemrrsYMbwFhz7oqcrz A==; X-IronPort-AV: E=McAfee;i="6400,9594,10370"; a="337975037" X-IronPort-AV: E=Sophos;i="5.91,283,1647327600"; d="scan'208";a="337975037" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2022 00:15:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,283,1647327600"; d="scan'208";a="635988933" Received: from t.sh.intel.com ([10.239.159.147]) by fmsmga008.fm.intel.com with ESMTP; 07 Jun 2022 00:15:20 -0700 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 Jun 2022 15:08:29 +0800 Message-Id: <20220607070830.2654218-3-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220607070830.2654218-1-fei.w.wang@intel.com> References: <20220607070830.2654218-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1 3/4] lavc/hevc_refs: exclude current frame from long term 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 Cc: Xu Guangxin , Fei Wang Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: UBqLWFdC4rcn From: Xu Guangxin suppose a. You have 3 frames, 0, 1, 4096. b. The ltMask is 0xfff and use_msb is 0. c. The 0, 1 are lt refs for 4096. d. you are decoding frame 4096, and get the 0 frame. Since 4096 & ltMask is 0 too, even you want get 0, find_ref_idx may give you 4096. add_candidate_ref will report an error for this Tested-by: Fei Wang Signed-off-by: Xu Guangxin --- libavcodec/hevc_refs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 3ea2fb6c0b..7b106e31d7 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -387,7 +387,7 @@ static HEVCFrame *find_ref_idx(HEVCContext *s, int poc, uint8_t use_msb) for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { HEVCFrame *ref = &s->DPB[i]; if (ref->frame->buf[0] && ref->sequence == s->seq_decode) { - if ((ref->poc & mask) == poc) + if ((ref->poc & mask) == poc && (use_msb || ref->poc != s->poc)) return ref; } }