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 8005443A25 for ; Mon, 5 Dec 2022 06:11:06 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4C2D468BCA6; Mon, 5 Dec 2022 08:10:10 +0200 (EET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 037FD68BC82 for ; Mon, 5 Dec 2022 08:10:00 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670220606; x=1701756606; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x8ATO9dBZOURiBlDbQJVRcH+T+KLbK0xC6R15sV4wZM=; b=e4Qn5hvXqBNGV+z/SlmFz/mgBrJaBlcP2rjvPC9VBJCZkdM7z1BLwbCo mfRHXAAjeQbdwsuhthHxGtF/Z8yTPIOTb+A01lEod3xkOwLWBx3Rf56Z6 arnk0dIT/R8A8fKHQmMJSl7QUOCG9ieg3GfLnJ1AY1k/N/Fu0GcLypHKt E05tB5IDf/aLnF1/Qwc2UdGyu+gJ5HpBVEzUcIEqR2Yt+m3rSvntLMV5K h/IKQKc2wAxnxrFpBJZ5P4pav5oZghNF5PM4OBv0+8oVLNNYGOHkEjC/3 rxMraTxZoWGRNFNyZVHJ1TO2hlOc4AjHId05c+b+C29ayA8IkY0zxooKy A==; X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="295971381" X-IronPort-AV: E=Sophos;i="5.96,218,1665471600"; d="scan'208";a="295971381" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2022 22:09:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="645700091" X-IronPort-AV: E=Sophos;i="5.96,218,1665471600"; d="scan'208";a="645700091" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga002.jf.intel.com with ESMTP; 04 Dec 2022 22:09:53 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 5 Dec 2022 14:09:23 +0800 Message-Id: <20221205060929.2511871-7-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221205060929.2511871-1-fei.w.wang@intel.com> References: <20221205060929.2511871-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 07/13] 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 Cc: Linjie Fu , Fei Wang , Linjie Fu 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".