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 B4D1440BA9 for ; Tue, 7 Jun 2022 07:15:33 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4EC5368B5C0; Tue, 7 Jun 2022 10:15:31 +0300 (EEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D372768B1CE for ; Tue, 7 Jun 2022 10:15:22 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654586129; x=1686122129; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=i1hTfsAv6M+/09PVYvg6p13r3YyGzyNyi8eCI1KNLmA=; b=Nh6cB3YmChv6AkZchgcalTVJPhe3RZ0/3SM6dibXfs3CkFAgtF8y9ghX FbL9kQWXHim3q+V8ElZI7iO49B0W1PKnIIJqRCZIG1OT3DWlAcjrLoh3b XdW/hBii0I+Ay4/qfDyiEX9zwgHedcmROSCZoTXZwYWsJmKX+iz7yI9Rf 8C+invDMGAoM+FRaNCbk9hsRAwB5WOnJ0azKfCE9h4QLsDYzHN8HQjrh3 8lMR7wjJ3TwD6hr/2uTRt6mkOoONOQNuAMCuNCKXrL5q944m7BtFJ4E21 C9z0lGnQE7HBwmInrnHRTicIIaYZ3I0OTjIaJw2y8FrTDLJoqrc7Q3LdX Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10370"; a="337975023" X-IronPort-AV: E=Sophos;i="5.91,283,1647327600"; d="scan'208";a="337975023" 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:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,283,1647327600"; d="scan'208";a="635988869" Received: from t.sh.intel.com ([10.239.159.147]) by fmsmga008.fm.intel.com with ESMTP; 07 Jun 2022 00:15:18 -0700 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Tue, 7 Jun 2022 15:08:27 +0800 Message-Id: <20220607070830.2654218-1-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1 1/4] lavc/hevc_refs: fix dpb logical for IRAP 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 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: From: Xu Guangxin According to C.5.2.2, item 2. When we got an IRAP, and the NoOutputOfPriorPicsFlag = 0, we need bump all outputable frames. Tested-by: Fei Wang Signed-off-by: Xu Guangxin --- 1. Tested the patchset with ~1000 different kinds of clips and get a positive result, without any regression. libavcodec/hevc_refs.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index fe18ca2b1d..3f8fe1ef18 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -174,21 +174,24 @@ int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc) int ff_hevc_output_frame(HEVCContext *s, AVFrame *out, int flush) { + if (IS_IRAP(s) && s->no_rasl_output_flag == 1) { + const static int mask = HEVC_FRAME_FLAG_BUMPING | HEVC_FRAME_FLAG_OUTPUT; + for (int i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { + HEVCFrame *frame = &s->DPB[i]; + if ((frame->flags & mask) == HEVC_FRAME_FLAG_OUTPUT && + frame->sequence != s->seq_decode) { + if (s->sh.no_output_of_prior_pics_flag == 1) + ff_hevc_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT); + else + frame->flags |= HEVC_FRAME_FLAG_BUMPING; + } + } + } do { int nb_output = 0; int min_poc = INT_MAX; int i, min_idx, ret; - if (s->sh.no_output_of_prior_pics_flag == 1 && s->no_rasl_output_flag == 1) { - for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { - HEVCFrame *frame = &s->DPB[i]; - if (!(frame->flags & HEVC_FRAME_FLAG_BUMPING) && frame->poc != s->poc && - frame->sequence == s->seq_output) { - ff_hevc_unref_frame(s, frame, HEVC_FRAME_FLAG_OUTPUT); - } - } - } - for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { HEVCFrame *frame = &s->DPB[i]; if ((frame->flags & HEVC_FRAME_FLAG_OUTPUT) && -- 2.25.1 _______________________________________________ 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".