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 6D1EB45280 for ; Thu, 16 Feb 2023 01:36:09 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DE8CD68BED9; Thu, 16 Feb 2023 03:35:32 +0200 (EET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C442A68BECA for ; Thu, 16 Feb 2023 03:35:26 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676511332; x=1708047332; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=x8ATO9dBZOURiBlDbQJVRcH+T+KLbK0xC6R15sV4wZM=; b=UciHhpMnDqW5R2Za0J7OJxOae6MUrGSZF7dVxSM5a9RDbhIZevPdbGNO KPy60NlzYQRD3e+uDz8r5jRnG+p81adDiZcREwOqSFtcMy7ANAShiUsCQ G6GxoM5pVmnqk3ZM4UlQBnKtZDmIhvdQMxXEOA/Aw9f6QXeqUSOrzLvqa KK+AezKHaxtUHK47an7g8px4p72y5z70nSdQbrSZ5tIju9L1oyHUJhXaj LUjP1+bOXGTNBSyINMwKLxokVDn5VBMFwlQr6jJdR04ATOH/ZgRCupzE7 s3PujDGNsrnF6/lmwLe1LA6uhCQfSEWqZpOfmfTxKU+WEbznhxiEqTgt1 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223805" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223805" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 17:35:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168808" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168808" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2023 17:35:17 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Feb 2023 09:32:44 +0800 Message-Id: <20230216013248.23044-6-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230216013248.23044-1-fei.w.wang@intel.com> References: <20230216013248.23044-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 06/10] lavc/hevc: Update reference list for SCC 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: From: Linjie Fu Screen Content Coding allows non-intra slice in an IRAP frame which can reference the frame itself, and would mark the current decoded picture as "used for long-term reference", no matter TwoVersionsOfCurrDecPicFlag(8.1.3), hence some previous restricts are not suitable any more. Constructe RefPicListTemp and RefPicList according to 8-8/9/10. Disable slice decoding for SCC profile to avoid unexpected error in hevc native decoder and patch welcome. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevc_refs.c | 21 ++++++++++++++++++++- libavcodec/hevcdec.c | 10 +++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 811e8feff8..96153a2459 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -322,7 +322,7 @@ int ff_hevc_slice_rpl(HEVCContext *s) return ret; if (!(s->rps[ST_CURR_BEF].nb_refs + s->rps[ST_CURR_AFT].nb_refs + - s->rps[LT_CURR].nb_refs)) { + s->rps[LT_CURR].nb_refs) && !s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Zero refs in the frame RPS.\n"); return AVERROR_INVALIDDATA; } @@ -349,6 +349,13 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl_tmp.nb_refs++; } } + // Construct RefPicList0, RefPicList1 (8-8, 8-10) + if (s->ps.pps->pps_curr_pic_ref_enabled_flag) { + rpl_tmp.list[rpl_tmp.nb_refs] = s->ref->poc; + rpl_tmp.ref[rpl_tmp.nb_refs] = s->ref; + rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = 1; + rpl_tmp.nb_refs++; + } } /* reorder the references if necessary */ @@ -371,6 +378,14 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl->nb_refs = FFMIN(rpl->nb_refs, sh->nb_refs[list_idx]); } + // 8-9 + if (s->ps.pps->pps_curr_pic_ref_enabled_flag && + !sh->rpl_modification_flag[list_idx] && + rpl_tmp.nb_refs > sh->nb_refs[L0]) { + rpl->list[sh->nb_refs[L0] - 1] = s->ref->poc; + rpl->ref[sh->nb_refs[L0] - 1] = s->ref; + } + if (sh->collocated_list == list_idx && sh->collocated_ref_idx < rpl->nb_refs) s->ref->collocated_ref = rpl->ref[sh->collocated_ref_idx]; @@ -541,5 +556,9 @@ int ff_hevc_frame_nb_refs(const HEVCContext *s) for (i = 0; i < long_rps->nb_refs; i++) ret += !!long_rps->used[i]; } + + if (s->ps.pps->pps_curr_pic_ref_enabled_flag) + ret++; + return ret; } diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 52fa627133..121ceb4e75 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -668,7 +668,8 @@ static int hls_slice_header(HEVCContext *s) sh->slice_type); return AVERROR_INVALIDDATA; } - if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) { + if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I && + !s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); return AVERROR_INVALIDDATA; } @@ -3123,6 +3124,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) if (ret < 0) goto fail; } else { + if (s->avctx->profile == FF_PROFILE_HEVC_SCC) { + av_log(s->avctx, AV_LOG_ERROR, + "SCC profile is not yet implemented in hevc native decoder.\n"); + ret = AVERROR_PATCHWELCOME; + goto fail; + } + if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0) ctb_addr_ts = hls_slice_data_wpp(s, nal); else -- 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".