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 247BE410CF for ; Fri, 15 Jul 2022 05:08:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BD1DE68B6F0; Fri, 15 Jul 2022 08:08:04 +0300 (EEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A595368B632 for ; Fri, 15 Jul 2022 08:07:57 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1657861682; x=1689397682; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wYAMlgvVuDyHoX/UUpFAnwW/gqwTs35UX/vQfOxNH80=; b=TFkwNlQtONDJMrJl+T4KVhC5UYc7ZGeLucTTQquTwJvXneVURTWH+VNV Od4HEvklkDsdnEtCVmfurb/uGXsTaIZwaN7UDxMVzJo488TfxlPydEqUr mKErIg7LieKNXklqBxdpL5K5CE8kBFXkzNRYqzyLlg5VEi5CxNINXwUQT jiWYWWDjOU4hWaldCfJm2bxDF4Omn6h8wA+Rupj03g5+YrHrHj9ayQh5L e6dpbtCduO7Nj9utT9sCcSoGpQXNRE+PDM5YvjaVETTEBGcqtPs2B4IAa CJSeFpkw+BRNDQ98YTqYeio3A2ZZIO7PzsZ0RSkNNzmG977oaqMAvH4MV g==; X-IronPort-AV: E=McAfee;i="6400,9594,10408"; a="265490995" X-IronPort-AV: E=Sophos;i="5.92,272,1650956400"; d="scan'208";a="265490995" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2022 22:07:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,272,1650956400"; d="scan'208";a="654183802" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga008.fm.intel.com with ESMTP; 14 Jul 2022 22:07:53 -0700 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Fri, 15 Jul 2022 13:06:41 +0800 Message-Id: <20220715050644.879488-1-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 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 --- update: 1. clean and replace 0xff with HEVC_SEQUENCE_COUNTER_MASK 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 6a70c817b0..2b0468d6c4 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -175,21 +175,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".