From patchwork Mon Feb 6 05:44:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40289 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3089569pzk; Sun, 5 Feb 2023 21:46:16 -0800 (PST) X-Google-Smtp-Source: AK7set8asos7PNqmhL+hkwUGgFiBdUNruE7qhFyZiPtq/p5J5ZKLqzOy2rkrlccL9LMS7iL5OH+Z X-Received: by 2002:a05:6402:5511:b0:4a2:2e8a:14c5 with SMTP id fi17-20020a056402551100b004a22e8a14c5mr18082237edb.2.1675662376414; Sun, 05 Feb 2023 21:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662376; cv=none; d=google.com; s=arc-20160816; b=uX8oSg/libWpwm9FdQg7SLNKdNhVktRQ4oDk3UlvG+92IdOSS/GxM1t+1ZcwbBNjx0 aCk4FyFJ9542OJ0YVnonD5JRhybbDaBrNmaWSRhbsOgas1Q/IDxEUrpi+Cqzx/YrL97W PU4JB2vqs98j5YNKGmO3nW6wUxfsQbNMU9iFN+BNPp/OzXXiec6oIeIUCkObVJThWwSU c9znhzFUHRX5plehov6npRKODaBhmVvTQ9BDgLsgiHFYLIDcZ2MC96OUWU5kMy644QRw jSi/E77jHJUmizaa2P4WmoBvq1jRyXE92ZxWkwmRdiCzFF0qF0A4SRvA7reKmmrSVmg1 m41A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=6vMxHKiMBiJ10vHDjtcNTaFFN++4YOJohyao6BOTP4o=; b=kuwkv+tLXrfxEGmOAxGB1g6QdcneRzfElN3e4ivwORHR6G9O/UUbG2X0vOMEUGcBlm 2TUYIVIqOehcrO/QDx9halmF/3Tu5dTXvg3hb+x5zwy5unuTs61Y2Nwme+LoXeLpvWRC 4Hpk0wMfczLkc3Y2LpLSUElt9XFWxl7LgFfh1LxJonJC3feiLQii2RGH/YYYky5jJSwD IrErCa8VChgwtD6PceN3CrsJAdlpBVhmuAu4CvzSPbcyNJMCZMDlb/UPbNJ1lsjxAtcL moG/zXo7cWqDntrGi3fvmZy8o+tSb7yKGcL0iS0xqY0RAFanzf6D4HA2VV6/aLe25FSs tWXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=Q+vbQ1GV; 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 ev25-20020a056402541900b004a2112830fcsi10659163edb.139.2023.02.05.21.46.14; Sun, 05 Feb 2023 21:46:16 -0800 (PST) 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=Q+vbQ1GV; 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 391CE68BC2E; Mon, 6 Feb 2023 07:46:10 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C1D4668BC2E for ; Mon, 6 Feb 2023 07:46:03 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662369; x=1707198369; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=I63A8nNHTQoj+MjMnjq68vfMbUo1f8fXCb7XEq+Uji0=; b=Q+vbQ1GVGIIUkfjSPIGD1lCOX+9hqfVoIeW9kbDAQpcRwG+A2YghDsPI ymhzYYD77ajuAqMaDyGzXDapDrSvo+zO4+u52UTqgxTZkzOUUfa8leuji immaSsnnf8zNqB+AfgHJirLS+4zyFQXDLSQ62vpZ/WIJmzS/8WRX/j02c GTZR0ednJbc9n8zFIerXiFHF9S4+waqJBqE2n+H5AMNswGb8pXach38/G ao2Kjj86pYEyxSz534IWPFoRwdPMyxI0hSWOXXdW+Yg8QL8JB/1o5C0xL WlRRKucifabUV5FprNEBXBTFgjKFKMmxOEK0yclPlnUOxw/4GudHBn5e1 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144195" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144195" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737399" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737399" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:00 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:49 +0800 Message-Id: <20230206054458.907060-1-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 01/10] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: PPQ0PhyHXGLQ From: Linjie Fu Described in HEVC spec A.3.7. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- 1. fix compile warning with VAAPI version less than 1.2.0 libavcodec/avcodec.h | 1 + libavcodec/hevc_ps.c | 2 ++ libavcodec/profiles.c | 1 + 3 files changed, 4 insertions(+) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 90b437ccbe..9e36d2402a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1672,6 +1672,7 @@ typedef struct AVCodecContext { #define FF_PROFILE_HEVC_MAIN_10 2 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT 4 +#define FF_PROFILE_HEVC_SCC 9 #define FF_PROFILE_VVC_MAIN_10 1 #define FF_PROFILE_VVC_MAIN_10_444 33 diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 5fe62ec35b..4aa5b76d5f 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -259,6 +259,8 @@ static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n"); else if (ptl->profile_idc == FF_PROFILE_HEVC_REXT) av_log(avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n"); + else if (ptl->profile_idc == FF_PROFILE_HEVC_SCC) + av_log(avctx, AV_LOG_DEBUG, "Screen Content Coding Extension profile bitstream\n"); else av_log(avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc); diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c index 7af7fbeb13..2230fc5415 100644 --- a/libavcodec/profiles.c +++ b/libavcodec/profiles.c @@ -85,6 +85,7 @@ const AVProfile ff_hevc_profiles[] = { { FF_PROFILE_HEVC_MAIN_10, "Main 10" }, { FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" }, { FF_PROFILE_HEVC_REXT, "Rext" }, + { FF_PROFILE_HEVC_SCC, "Scc" }, { FF_PROFILE_UNKNOWN }, }; From patchwork Mon Feb 6 05:44:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40290 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3089662pzk; Sun, 5 Feb 2023 21:46:25 -0800 (PST) X-Google-Smtp-Source: AK7set87KX3LPp017TwwWi4Ue5rE10ieLmPv9ECcUW8jCoal/Cg4I+spe/l445D0Gnax2CkwxvPk X-Received: by 2002:a17:906:5a4c:b0:87b:7c1e:7d58 with SMTP id my12-20020a1709065a4c00b0087b7c1e7d58mr18306845ejc.53.1675662385639; Sun, 05 Feb 2023 21:46:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662385; cv=none; d=google.com; s=arc-20160816; b=OGT11uE5GaP4lWk0fHHU2K/Gr0w7bY+NnmlZQ5k6dPcPVwoI5N6o7qUoxtus58bqgF VCOyGQKTCvlYG81dGJIyEqrcm5rSMaY5I+GNreiGoeoTGFDTrr6UilA5s7KQ4HPf7B23 Ss59xy+vHeGdOEfnbMIv4n3k/xq6i3qp/SodJ+oxtFFs5CVAo0zH5L4Z8X6XtPQz/ww/ meG1uM9dvNQ50QxM+ZeTEXmI+4dvWNznZDzGiawI4qZ5BRja2vTdwDsz1nSdgJTIH+2I hCTMK4mX4jOpOJ4uZ9QIjQyGLJoc+tq6GQKKxibliH2Ni/+eZQpWID+JLbIteWF7wIW6 NppA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=DtB0ERsM0jG3EtE73eOYNhBNjivxN8PcR7Hegk6lklU=; b=EEew1zUIFqzZv/BNKvzlqB9ZCtRbHEMP8mNU12tCKOKMnycPasqA6NwAO1zhX6rxvK VOxJLbCOTFWo3MyS/OnP62oOaOPc/3l8jC1YUPbBR6VNkX+7cFEIXgDwZWEYbEmPW1WZ GInyhVBB7WrmQo568N5UJQZ6dFpOwBjtranLOWMA+5cM0KT+7HFRIgNCKVwJxZwdLluV mgGvqeCni4buUFfY1mOwYOVrspx1hYlBEWrxLCnYeZ9IIK6WfZ5w1FQzX2Ke1z2hszjM QS6iKbERmpCDnRv1ZJJCQjTQsdsh+rVMag2/FteZtW+yKGvbu1yhdCD2WXSBAr2VuiM1 Qibg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=A5Gd+2Ub; 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 wc23-20020a170907125700b0088378cebacdsi10507449ejb.884.2023.02.05.21.46.24; Sun, 05 Feb 2023 21:46:25 -0800 (PST) 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=A5Gd+2Ub; 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 60FBE68BD1D; Mon, 6 Feb 2023 07:46:12 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9471468BD38 for ; Mon, 6 Feb 2023 07:46:05 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662370; x=1707198370; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=a3XIqrmp9IzMhYCzHdagnhnX4jwc8qKcVJgWBAT31Ic=; b=A5Gd+2UbW2H2lMmvbEleSrwojWB9iMBOoJxOFhPxKfP87jrJmq5NRovR MfP12WIA8ZWOoLRRwtC4F5+DjjHcOG2GZWc0ycrlDIkimrBS+t/XdZe96 V5YagpoaLMBrh5D8sge0Y4IvEOnn3U7iOvEUVru1TMLb84Diy4/dYwjko MYVFpJrC2oG+djSWD6zcxxDpGjjqkOxxdaHscFzwcEmkwPlnNnRH2h8fP NQP8RB4VxIfrWJxuRFSAJNoH00iB19Pb0DwXaBXg5xlrkwwtuZfBbO25+ 66mVsd5lsRvls3gKKNJBPc7CK55BfMLCQuvy2WkNcbDScejKx76an9Qns g==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144196" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144196" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737403" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737403" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:01 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:50 +0800 Message-Id: <20230206054458.907060-2-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206054458.907060-1-fei.w.wang@intel.com> References: <20230206054458.907060-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 02/10] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Dz8UpGmoJUk+ From: Linjie Fu 1. Add extension syntax according to 7.3.2.2.3/7.3.2.3.3 in T-REC-H.265-201911. 2. Keep using parsed PPS when bitstream overread for compatibility. For example, the clip PS_A_VIDYO_3.bit in FATE test has incomplete extension syntax which will be overread and un-decodable if without this change. 3. Format brace in pps_range_extensions(). Signed-off-by: Linjie Fu Signed-off-by: Haihao Xiang Signed-off-by: Fei Wang --- libavcodec/hevc.h | 3 + libavcodec/hevc_ps.c | 289 +++++++++++++++++++++++++++++++++++++++++-- libavcodec/hevc_ps.h | 69 +++++++++++ 3 files changed, 349 insertions(+), 12 deletions(-) diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h index 1804755327..6b454a75c1 100644 --- a/libavcodec/hevc.h +++ b/libavcodec/hevc.h @@ -154,6 +154,9 @@ enum { // get near that, though, so set a lower limit here with the maximum // possible value for 4K video (at most 135 16x16 Ctb rows). HEVC_MAX_ENTRY_POINT_OFFSETS = HEVC_MAX_TILE_COLUMNS * 135, + + // A.3.7: Screen content coding extensions + HEVC_MAX_PALETTE_PREDICTOR_SIZE = 128, }; diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 4aa5b76d5f..348e4d8de2 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -853,7 +853,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, HEVCWindow *ow; int ret = 0; int log2_diff_max_min_transform_block_size; - int bit_depth_chroma, start, vui_present, sublayer_ordering_info; + int bit_depth_chroma, start, vui_present, sublayer_ordering_info, num_comps; int i; // Coded parameters @@ -1074,8 +1074,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, decode_vui(gb, avctx, apply_defdispwin, sps); if (get_bits1(gb)) { // sps_extension_flag - sps->sps_range_extension_flag = get_bits1(gb); - skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7); + sps->sps_range_extension_flag = get_bits1(gb); + sps->sps_multilayer_extension_flag = get_bits1(gb); + sps->sps_3d_extension_flag = get_bits1(gb); + sps->sps_scc_extension_flag = get_bits1(gb); + skip_bits(gb, 4); // sps_extension_4bits + if (sps->sps_range_extension_flag) { sps->transform_skip_rotation_enabled_flag = get_bits1(gb); sps->transform_skip_context_enabled_flag = get_bits1(gb); @@ -1101,6 +1105,57 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, av_log(avctx, AV_LOG_WARNING, "cabac_bypass_alignment_enabled_flag not yet implemented\n"); } + + if (sps->sps_multilayer_extension_flag) { + skip_bits1(gb); // inter_view_mv_vert_constraint_flag + av_log(avctx, AV_LOG_WARNING, + "sps_multilayer_extension_flag not yet implemented\n"); + } + + if (sps->sps_3d_extension_flag) { + for (i = 0; i <= 1; i++) { + skip_bits1(gb); // iv_di_mc_enabled_flag + skip_bits1(gb); // iv_mv_scal_enabled_flag + if (i == 0) { + get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 + skip_bits1(gb); // iv_res_pred_enabled_flag + skip_bits1(gb); // depth_ref_enabled_flag + skip_bits1(gb); // vsp_mc_enabled_flag + skip_bits1(gb); // dbbp_enabled_flag + } else { + skip_bits1(gb); // tex_mc_enabled_flag + get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 + skip_bits1(gb); // intra_contour_enabled_flag + skip_bits1(gb); // intra_dc_only_wedge_enabled_flag + skip_bits1(gb); // cqt_cu_part_pred_enabled_flag + skip_bits1(gb); // inter_dc_only_enabled_flag + skip_bits1(gb); // skip_intra_enabled_flag + } + } + av_log(avctx, AV_LOG_WARNING, + "sps_3d_extension_flag not yet implemented\n"); + } + + if (sps->sps_scc_extension_flag) { + sps->sps_curr_pic_ref_enabled_flag = get_bits1(gb); + sps->palette_mode_enabled_flag = get_bits1(gb); + if (sps->palette_mode_enabled_flag) { + sps->palette_max_size = get_ue_golomb_long(gb); + sps->delta_palette_max_predictor_size = get_ue_golomb_long(gb); + sps->sps_palette_predictor_initializers_present_flag = get_bits1(gb); + + if (sps->sps_palette_predictor_initializers_present_flag) { + sps->sps_num_palette_predictor_initializers_minus1 = get_ue_golomb_long(gb); + num_comps = !sps->chroma_format_idc ? 1 : 3; + for (int comp = 0; comp < num_comps; comp++) + for (i = 0; i <= sps->sps_num_palette_predictor_initializers_minus1; i++) + sps->sps_palette_predictor_initializer[comp][i] = + get_bits(gb, !comp ? sps->bit_depth : sps->bit_depth_chroma); + } + } + sps->motion_vector_resolution_control_idc = get_bits(gb, 2); + sps->intra_boundary_filtering_disabled_flag = get_bits1(gb); + } } if (apply_defdispwin) { sps->output_window.left_offset += sps->vui.def_disp_win.left_offset; @@ -1265,10 +1320,161 @@ static void hevc_pps_free(void *opaque, uint8_t *data) av_freep(&pps); } -static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx, - HEVCPPS *pps, HEVCSPS *sps) { - int i; +static void colour_mapping_octants(GetBitContext *gb, HEVCPPS *pps, int inp_depth, + int idx_y, int idx_cb, int idx_cr, int inp_length) +{ + unsigned int split_octant_flag, part_num_y, coded_res_flag, res_coeff_q, res_coeff_r; + int bit_depth_cm_input_y, bit_depth_cm_output_y, cm_res_bits; + + part_num_y = 1 << pps->cm_y_part_num_log2; + + split_octant_flag = inp_depth < pps->cm_octant_depth ? get_bits1(gb) : 0; + + if (split_octant_flag) + for (int k = 0; k < 2; k++) + for (int m = 0; m < 2; m++) + for (int n = 0; n < 2; n++) + colour_mapping_octants(gb, pps, inp_depth + 1, + idx_y + part_num_y * k * inp_length / 2, + idx_cb + m * inp_length / 2, + idx_cr + n * inp_length / 2, + inp_length / 2); + else + for (int i = 0; i < part_num_y; i++) { + for (int j = 0; j < 4; j++) { + coded_res_flag = get_bits1(gb); + if (coded_res_flag) + for (int c = 0; c < 3; c++) { + res_coeff_q = get_ue_golomb_long(gb); + bit_depth_cm_input_y = 8 + pps->luma_bit_depth_cm_input_minus8; + bit_depth_cm_output_y = 8 + pps->luma_bit_depth_cm_output_minus8; + cm_res_bits = FFMAX(0, 10 + bit_depth_cm_input_y - bit_depth_cm_output_y - + pps->cm_res_quant_bits - (pps->cm_delta_flc_bits_minus1 + 1)); + res_coeff_r = cm_res_bits ? get_bits(gb, cm_res_bits) : 0; + if (res_coeff_q || res_coeff_r) + skip_bits1(gb); + } + } + } +} +static void colour_mapping_table(GetBitContext *gb, HEVCPPS *pps) +{ + pps->num_cm_ref_layers_minus1 = get_ue_golomb_long(gb); + for (int i = 0; i <= pps->num_cm_ref_layers_minus1; i++) + pps->cm_ref_layer_id[i] = get_bits(gb, 6); + + pps->cm_octant_depth = get_bits(gb, 2); + pps->cm_y_part_num_log2 = get_bits(gb, 2); + + pps->luma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb); + pps->chroma_bit_depth_cm_input_minus8 = get_ue_golomb_long(gb); + pps->luma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb); + pps->chroma_bit_depth_cm_output_minus8 = get_ue_golomb_long(gb); + + pps->cm_res_quant_bits = get_bits(gb, 2); + pps->cm_delta_flc_bits_minus1 = get_bits(gb, 2); + + if (pps->cm_octant_depth == 1) { + pps->cm_adapt_threshold_u_delta = get_se_golomb_long(gb); + pps->cm_adapt_threshold_v_delta = get_se_golomb_long(gb); + } + + colour_mapping_octants(gb, pps, 0, 0, 0, 0, 1 << pps->cm_octant_depth); +} + +static int pps_multilayer_extension(GetBitContext *gb, AVCodecContext *avctx, + HEVCPPS *pps, HEVCSPS *sps) +{ + pps->poc_reset_info_present_flag = get_bits1(gb); + pps->pps_infer_scaling_list_flag = get_bits1(gb); + if (pps->pps_infer_scaling_list_flag) + pps->pps_scaling_list_ref_layer_id = get_bits(gb, 6); + + pps->num_ref_loc_offsets = get_ue_golomb_long(gb); + for (int i = 0; i < pps->num_ref_loc_offsets; i++) { + pps->ref_loc_offset_layer_id[i] = get_bits(gb, 6); + pps->scaled_ref_layer_offset_present_flag[i] = get_bits1(gb); + if (pps->scaled_ref_layer_offset_present_flag[i]) { + pps->scaled_ref_layer_left_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb); + pps->scaled_ref_layer_top_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb); + pps->scaled_ref_layer_right_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb); + pps->scaled_ref_layer_bottom_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb); + } + + pps->ref_region_offset_present_flag[i] = get_bits1(gb); + if (pps->ref_region_offset_present_flag[i]) { + pps->ref_region_left_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb); + pps->ref_region_top_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb); + pps->ref_region_right_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb); + pps->ref_region_bottom_offset[pps->ref_loc_offset_layer_id[i]] = get_se_golomb_long(gb); + } + + pps->resample_phase_set_present_flag[i] = get_bits1(gb); + if (pps->resample_phase_set_present_flag[i]) { + pps->phase_hor_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb); + pps->phase_ver_luma[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb); + pps->phase_hor_chroma_plus8[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb); + pps->phase_ver_chroma_plus8[pps->ref_loc_offset_layer_id[i]] = get_ue_golomb_long(gb); + } + } + + pps->colour_mapping_enabled_flag = get_bits1(gb); + if (pps->colour_mapping_enabled_flag) + colour_mapping_table(gb, pps); + + return 0; +} + +static void delta_dlt(GetBitContext *gb, HEVCPPS *pps) +{ + unsigned int num_val_delta_dlt, max_diff = 0; + int min_diff_minus1 = -1; + unsigned int len; + + num_val_delta_dlt = get_bits(gb, pps->pps_bit_depth_for_depth_layers_minus8 + 8); + if (num_val_delta_dlt) { + if (num_val_delta_dlt > 1) + max_diff = get_bits(gb, pps->pps_bit_depth_for_depth_layers_minus8 + 8); + if (num_val_delta_dlt > 2 && max_diff) { + len = av_log2(max_diff) + 1; + min_diff_minus1 = get_bits(gb, len); + } + if (max_diff > (min_diff_minus1 + 1)) + for (int k = 1; k < num_val_delta_dlt; k++) { + len = av_log2(max_diff - (min_diff_minus1 + 1)) + 1; + skip_bits(gb, len); // delta_val_diff_minus_min + } + } +} + +static int pps_3d_extension(GetBitContext *gb, AVCodecContext *avctx, + HEVCPPS *pps, HEVCSPS *sps) +{ + unsigned int pps_depth_layers_minus1; + + if (get_bits1(gb)) { // dlts_present_flag + pps_depth_layers_minus1 = get_bits(gb, 6); + pps->pps_bit_depth_for_depth_layers_minus8 = get_bits(gb, 4); + for (int i = 0; i <= pps_depth_layers_minus1; i++) { + if (get_bits1(gb)) { // dlt_flag[i] + if (!get_bits1(gb)) { // dlt_pred_flag[i] + if (get_bits1(gb)) { // dlt_val_flags_present_flag[i] + for (int j = 0; j <= ((1 << (pps->pps_bit_depth_for_depth_layers_minus8 + 8)) - 1); j++) + skip_bits1(gb); // dlt_value_flag[i][j] + } else + delta_dlt(gb, pps); + } + } + } + } + + return 0; +} + +static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx, + HEVCPPS *pps, HEVCSPS *sps) +{ if (pps->transform_skip_enabled_flag) { pps->log2_max_transform_skip_block_size = get_ue_golomb_long(gb) + 2; } @@ -1282,7 +1488,7 @@ static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx, "chroma_qp_offset_list_len_minus1 shall be in the range [0, 5].\n"); return AVERROR_INVALIDDATA; } - for (i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) { + for (int i = 0; i <= pps->chroma_qp_offset_list_len_minus1; i++) { pps->cb_qp_offset_list[i] = get_se_golomb_long(gb); if (pps->cb_qp_offset_list[i]) { av_log(avctx, AV_LOG_WARNING, @@ -1306,6 +1512,47 @@ static int pps_range_extensions(GetBitContext *gb, AVCodecContext *avctx, return(0); } +static int pps_scc_extension(GetBitContext *gb, AVCodecContext *avctx, + HEVCPPS *pps, HEVCSPS *sps) +{ + int num_comps, ret; + + pps->pps_curr_pic_ref_enabled_flag = get_bits1(gb); + if (pps->residual_adaptive_colour_transform_enabled_flag = get_bits1(gb)) { + pps->pps_slice_act_qp_offsets_present_flag = get_bits1(gb); + pps->pps_act_y_qp_offset = get_se_golomb_long(gb) - 5; + pps->pps_act_cb_qp_offset = get_se_golomb_long(gb) - 5; + pps->pps_act_cr_qp_offset = get_se_golomb_long(gb) - 3; + +#define CHECK_QP_OFFSET(name) (pps->pps_act_ ## name ## _qp_offset <= -12 || \ + pps->pps_act_ ## name ## _qp_offset >= 12) + ret = CHECK_QP_OFFSET(y) || CHECK_QP_OFFSET(cb) || CHECK_QP_OFFSET(cr); +#undef CHECK_QP_OFFSET + if (ret) { + av_log(avctx, AV_LOG_ERROR, + "PpsActQpOffsetY/Cb/Cr shall be in the range of [-12, 12].\n"); + return AVERROR_INVALIDDATA; + } + } + + if (pps->pps_palette_predictor_initializers_present_flag = get_bits1(gb)) { + if ((pps->pps_num_palette_predictor_initializers = get_ue_golomb_long(gb)) > 0) { + pps->monochrome_palette_flag = get_bits1(gb); + pps->luma_bit_depth_entry_minus8 = get_ue_golomb_long(gb); + if (!pps->monochrome_palette_flag) + pps->chroma_bit_depth_entry_minus8 = get_ue_golomb_long(gb); + num_comps = pps->monochrome_palette_flag ? 1 : 3; + for (int comp = 0; comp < num_comps; comp++) + for (int i = 0; i < pps->pps_num_palette_predictor_initializers; i++) + pps->pps_palette_predictor_initializer[comp][i] = + get_bits(gb, 8 + (!comp ? pps->luma_bit_depth_entry_minus8 : + pps->chroma_bit_depth_entry_minus8)); + } + } + + return 0; +} + static inline int setup_pps(AVCodecContext *avctx, GetBitContext *gb, HEVCPPS *pps, HEVCSPS *sps) { @@ -1658,12 +1905,31 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, pps->slice_header_extension_present_flag = get_bits1(gb); if (get_bits1(gb)) { // pps_extension_present_flag - pps->pps_range_extensions_flag = get_bits1(gb); - skip_bits(gb, 7); // pps_extension_7bits - if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps->pps_range_extensions_flag) { + pps->pps_range_extensions_flag = get_bits1(gb); + pps->pps_multilayer_extension_flag = get_bits1(gb); + pps->pps_3d_extension_flag = get_bits1(gb); + pps->pps_scc_extension_flag = get_bits1(gb); + skip_bits(gb, 4); // pps_extension_4bits + + if (sps->ptl.general_ptl.profile_idc >= FF_PROFILE_HEVC_REXT && pps->pps_range_extensions_flag) { if ((ret = pps_range_extensions(gb, avctx, pps, sps)) < 0) goto err; } + + if (pps->pps_multilayer_extension_flag) { + if ((ret = pps_multilayer_extension(gb, avctx, pps, sps)) < 0) + goto err; + } + + if (pps->pps_3d_extension_flag) { + if ((ret = pps_3d_extension(gb, avctx, pps, sps)) < 0) + goto err; + } + + if (pps->pps_scc_extension_flag) { + if ((ret = pps_scc_extension(gb, avctx, pps, sps)) < 0) + goto err; + } } ret = setup_pps(avctx, gb, pps, sps); @@ -1671,9 +1937,8 @@ int ff_hevc_decode_nal_pps(GetBitContext *gb, AVCodecContext *avctx, goto err; if (get_bits_left(gb) < 0) { - av_log(avctx, AV_LOG_ERROR, + av_log(avctx, AV_LOG_WARNING, "Overread PPS by %d bits\n", -get_bits_left(gb)); - goto err; } remove_pps(ps, pps_id); diff --git a/libavcodec/hevc_ps.h b/libavcodec/hevc_ps.h index 18894cfed1..1f704108e3 100644 --- a/libavcodec/hevc_ps.h +++ b/libavcodec/hevc_ps.h @@ -210,6 +210,20 @@ typedef struct HEVCSPS { int persistent_rice_adaptation_enabled_flag; int cabac_bypass_alignment_enabled_flag; + int sps_multilayer_extension_flag; + int sps_3d_extension_flag; + + int sps_scc_extension_flag; + int sps_curr_pic_ref_enabled_flag; + int palette_mode_enabled_flag; + int palette_max_size; + int delta_palette_max_predictor_size; + int sps_palette_predictor_initializers_present_flag; + int sps_num_palette_predictor_initializers_minus1; + int sps_palette_predictor_initializer[3][HEVC_MAX_PALETTE_PREDICTOR_SIZE]; + int motion_vector_resolution_control_idc; + int intra_boundary_filtering_disabled_flag; + ///< coded frame dimension in various units int width; int height; @@ -284,6 +298,9 @@ typedef struct HEVCPPS { uint8_t slice_header_extension_present_flag; uint8_t log2_max_transform_skip_block_size; uint8_t pps_range_extensions_flag; + uint8_t pps_multilayer_extension_flag; + uint8_t pps_3d_extension_flag; + uint8_t pps_scc_extension_flag; uint8_t cross_component_prediction_enabled_flag; uint8_t chroma_qp_offset_list_enabled_flag; uint8_t diff_cu_chroma_qp_offset_depth; @@ -293,6 +310,58 @@ typedef struct HEVCPPS { uint8_t log2_sao_offset_scale_luma; uint8_t log2_sao_offset_scale_chroma; + // Multilayer extension parameters + uint8_t poc_reset_info_present_flag; + uint8_t pps_infer_scaling_list_flag; + uint8_t pps_scaling_list_ref_layer_id; + uint16_t num_ref_loc_offsets; + uint8_t ref_loc_offset_layer_id[64]; + uint8_t scaled_ref_layer_offset_present_flag[64]; + int8_t scaled_ref_layer_left_offset[64]; + int8_t scaled_ref_layer_top_offset[64]; + int8_t scaled_ref_layer_right_offset[64]; + int8_t scaled_ref_layer_bottom_offset[64]; + uint8_t ref_region_offset_present_flag[64]; + int8_t ref_region_left_offset[64]; + int8_t ref_region_top_offset[64]; + int8_t ref_region_right_offset[64]; + int8_t ref_region_bottom_offset[64]; + uint8_t resample_phase_set_present_flag[64]; + uint16_t phase_hor_luma[64]; + uint16_t phase_ver_luma[64]; + uint16_t phase_hor_chroma_plus8[64]; + uint16_t phase_ver_chroma_plus8[64]; + uint8_t colour_mapping_enabled_flag; + uint16_t num_cm_ref_layers_minus1; + uint8_t cm_ref_layer_id[63]; + uint8_t cm_octant_depth; + uint8_t cm_y_part_num_log2; + uint16_t luma_bit_depth_cm_input_minus8; + uint16_t chroma_bit_depth_cm_input_minus8; + uint16_t luma_bit_depth_cm_output_minus8; + uint16_t chroma_bit_depth_cm_output_minus8; + uint8_t cm_res_quant_bits; + uint8_t cm_delta_flc_bits_minus1; + int8_t cm_adapt_threshold_u_delta; + int8_t cm_adapt_threshold_v_delta; + + // 3D extension parameters + uint8_t pps_bit_depth_for_depth_layers_minus8; + + // SCC extension parameters + uint8_t pps_curr_pic_ref_enabled_flag; + uint8_t residual_adaptive_colour_transform_enabled_flag; + uint8_t pps_slice_act_qp_offsets_present_flag; + int8_t pps_act_y_qp_offset; // _plus5 + int8_t pps_act_cb_qp_offset; // _plus5 + int8_t pps_act_cr_qp_offset; // _plus3 + uint8_t pps_palette_predictor_initializers_present_flag; + uint8_t pps_num_palette_predictor_initializers; + uint8_t monochrome_palette_flag; + uint8_t luma_bit_depth_entry_minus8; + uint8_t chroma_bit_depth_entry_minus8; + uint8_t pps_palette_predictor_initializer[3][HEVC_MAX_PALETTE_PREDICTOR_SIZE]; + // Inferred parameters unsigned int *column_width; ///< ColumnWidth unsigned int *row_height; ///< RowHeight From patchwork Mon Feb 6 05:44:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40291 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3089753pzk; Sun, 5 Feb 2023 21:46:34 -0800 (PST) X-Google-Smtp-Source: AK7set+JR+CjBT7sQqfHx1XKh5tCZZSmRLgyJo61AVgM9fIINSCeJzu4px4kfqQx5bE3v8AppwVy X-Received: by 2002:a17:907:97cc:b0:887:aac3:9340 with SMTP id js12-20020a17090797cc00b00887aac39340mr11556880ejc.29.1675662393820; Sun, 05 Feb 2023 21:46:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662393; cv=none; d=google.com; s=arc-20160816; b=lRbvQxo789aN7HWJNf2/lEp621jtmLSNwScxzvdKH2Dz9xRr6QWSGDVal4dt82qc6a vppdjWiol/3u6I+A5iKnd8p7Ge0soRazERhAJbKIMnVdhUeBX/6JiStwzSPXFw2vOwRS NuIbmZhHVScY6meGuxfYPgenOodSdYsKF/eyxAYCEecagTI9jvAye3EryrqT3Y5CGGRt A490kAZB0bRPs8awTWWRRY4rVA7WSmYmNQAcvN9vBMuU/4AZyTJSmBMuzw+fdPTmLjRs q6X1iyjmgWff+3YkyNeCm19q1ninSy9Mcp5gX+sJycydvGwvXc0gCI2/L9aIAntVCeXu Wi0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=6l8A7ve5KWyU8+SvxMiKz4V3g9HtINN/ZuINpLAIBVI=; b=SxDM/lIuIWIxbOjq3pq9RnkEW2+m9ENW0knFiI0PrWNu+bqYK7oGArzccTCp01QFAq ZGPAtWENuIYHBiEfR11INFK4bE4en81x66YOIvJFGTLZGMKl3xv5d1ZgSAPwdfADPP0M yTrp0HpNaJYkX8fE8pHq4deTfDrAkQIF8ioE4LSUqmh3EJUgg2UdZV5ylujkxS50NxkZ uHbxVTcmKyXwQ03hqK0wQyUshEmfhBT9W7DXRVY8wpjAYTRAQVgwiyOFACrqhTKaWLuQ CWTkWjoOqnAEXZKiVvnBNe2ypmoIHQeZHakLgG0csxNI+XZiAm8ZRQvCg4N8Ev/W6vSu x7Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=dxa1inPf; 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 wj14-20020a170907050e00b008806435272bsi9660585ejb.43.2023.02.05.21.46.33; Sun, 05 Feb 2023 21:46:33 -0800 (PST) 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=dxa1inPf; 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 1729668BCD7; Mon, 6 Feb 2023 07:46:16 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4307E68BD42 for ; Mon, 6 Feb 2023 07:46:08 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662373; x=1707198373; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=1JoWN+YMZatoxBLjbA+BOa3Y8+4nDxD8bQqzdOPG82o=; b=dxa1inPf8EK73niuQBsi06ysQIftro+EojDYlDzLHNAWaFZljPSkl+ap KlPs/4Hc+Mwv64WH0U08gD1l0DTFCNFL6i6B2cbxSeip+SjLNqftf2ELL y0rDJlLshKNRRaU9zKF4SJ+eZZAodr7ZIUvVP8vrC+AQUzgA5fLM7yMMZ nFh3tRz+I6VHVdvHncYJ5u7fd5oo/4nbk2Y8sr6/counN85boIplLlAid 5lLqjVA2an4kdhlXp7FVSg45/wk53kmwPnIvqMmostA0ITDk+XVGXm7IW cXJbuI5J2I+/YknaGL2uQYHCH0SlJPX8bAxOGpoNbW0gBL1zYwNHVXE+c g==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144199" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144199" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737408" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737408" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:02 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:51 +0800 Message-Id: <20230206054458.907060-3-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206054458.907060-1-fei.w.wang@intel.com> References: <20230206054458.907060-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 03/10] lavc/hevcdec: Add slice parse support for HEVC SCC extension 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: RYIGHpSALKAG From: Linjie Fu Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.c | 6 ++++++ libavcodec/hevcdec.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 567e8d81d4..f9a97ac7f5 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -856,6 +856,12 @@ static int hls_slice_header(HEVCContext *s) sh->slice_cr_qp_offset = 0; } + if (s->ps.pps->pps_slice_act_qp_offsets_present_flag) { + sh->slice_act_y_qp_offset = get_se_golomb(gb); + sh->slice_act_cb_qp_offset = get_se_golomb(gb); + sh->slice_act_cr_qp_offset = get_se_golomb(gb); + } + if (s->ps.pps->chroma_qp_offset_list_enabled_flag) sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb); else diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 9d3f4adbb3..7841ba8565 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -295,6 +295,10 @@ typedef struct SliceHeader { int slice_cb_qp_offset; int slice_cr_qp_offset; + int slice_act_y_qp_offset; + int slice_act_cb_qp_offset; + int slice_act_cr_qp_offset; + uint8_t cu_chroma_qp_offset_enabled_flag; int beta_offset; ///< beta_offset_div2 * 2 From patchwork Mon Feb 6 05:44:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40292 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3089838pzk; Sun, 5 Feb 2023 21:46:42 -0800 (PST) X-Google-Smtp-Source: AK7set8OgZerueuFeY9+14ICwVVUQHFo47joq3uv8RUhY4O6x+DLnOHRYRQ0qBjO7zZ4+eSD3TVp X-Received: by 2002:a17:907:3e82:b0:84d:47e3:fe49 with SMTP id hs2-20020a1709073e8200b0084d47e3fe49mr25801556ejc.39.1675662401973; Sun, 05 Feb 2023 21:46:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662401; cv=none; d=google.com; s=arc-20160816; b=MVQaKv9nUW9SneIHmhqBaLsnTXVgjXbF1KpSQyhK3eInUgFWMdZzhL3EJT04iUZ6KH e+iZ8X08FRTbRu8GHH+nrDgfJJra6hZWQYDI9M49SwdhFPOaAB0EodVRHjLskmw6Ijdg CKqNT0E1S0/kYF6p2lzwQSAANO+PyZvA0mSDiBmqT9G0ysn/nf7MeCRI+As65ASk9LUN 0Ivl/HyFLAhtUpPXtN1oqS2kdip7YvFEuIrC2/CdTtRNzmJU2MUgN4Vl5CG5w18Sy5kL j+fpnblL4MWfaDU2YnWiRysHAug28wPd+zsQLAYDJKJqBdhZEeMrkH431kVfTW7elaLV /5sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=0jUeFCJaBCEWh23PCD+yPno7w0i7CgZp/aJzbAhvMIA=; b=cIbRH/7kEXVZyTJGHb92SE/M210OZenDxahN2KKHRi4BMvCu53yJTnW+T4l7XkmZfX HdEPbbDAkOcguXiMEZE1xJvvPtNArzM4r0hdrgt8eV027ZCe/jD0oxhpCSGHekKTeEED 0O43vRZ866YE3e3SrnL8RnzV2Lm+lXPL7mwz0i1LxlUMXAb8mUj+7kpxLFYDu+Tgs6/7 Uni99KYi5u6b8VX9lIP3++xPDiHIa8uG+9l+vPTQFlcZ/8vJjm9UoIpRzmqF01bCBoKf y8MDMgSeyWx0n/X7ysOFCg8Cv/tJUBNWN+xzFUgpbJHS1/kiRe7nqGU0IiFJKAXPefeU fe1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=MvOvOVGa; 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 fd10-20020a1709072a0a00b00894817b761bsi6230760ejc.69.2023.02.05.21.46.41; Sun, 05 Feb 2023 21:46:41 -0800 (PST) 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=MvOvOVGa; 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 3967B68BE62; Mon, 6 Feb 2023 07:46:17 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BCC2968BC4A for ; Mon, 6 Feb 2023 07:46:09 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662375; x=1707198375; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=L0fAowE8Rj3D3/ekpvujoRAjdJaOCWU8raZDLJN3GcM=; b=MvOvOVGaNubM4E8HGFdzEyw98IoGc5RFJCWRBxft5+ukaryrHibr9RrU 9kRBDBKw5q1Qn2fqswbCgjuIHlUoKxFjcZGUCIrC5NSb83HfX1D9x9YVj veQkPnj7B2SBYqq26+3aCpmu+uQR8/VWQHkvfC4pTPlRNp7I8OLu0ODqe +5APoOq/MQF5lAu3kjE4jVlqUhWxUot2I2UW4gNEPq9tZs3WFp5dJ5Jd6 01dysQguTW9eo0VRFWyj40azSEBk92etxaGOZCoG4NvWplo8sNXO0B3bT oLJDPZdoqBb+Lyo7GupWB8UOlFz6QzQy42J18zpP+bQI84BIejzhdjySu Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144201" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144201" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737410" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737410" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:03 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:52 +0800 Message-Id: <20230206054458.907060-4-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206054458.907060-1-fei.w.wang@intel.com> References: <20230206054458.907060-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 04/10] lavc/hevcdec: Fix the parsing for use_integer_mv_flag 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: F7TUy/QQ1kkP From: Linjie Fu According to 7.3.6.1, use_integer_mv_flag should be parsed if motion_vector_resolution_control_idc equals to 2. If not present, it equals to motion_vector_resolution_control_idc. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.c | 8 ++++++++ libavcodec/hevcdec.h | 1 + 2 files changed, 9 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index f9a97ac7f5..52fa627133 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -839,6 +839,14 @@ static int hls_slice_header(HEVCContext *s) sh->max_num_merge_cand); return AVERROR_INVALIDDATA; } + + // Syntax in 7.3.6.1 + if (s->ps.sps->motion_vector_resolution_control_idc == 2) + sh->use_integer_mv_flag = get_bits1(gb); + else + // Inferred to be equal to motion_vector_resolution_control_idc if not present + sh->use_integer_mv_flag = s->ps.sps->motion_vector_resolution_control_idc; + } sh->slice_qp_delta = get_se_golomb(gb); diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 7841ba8565..a7fc669bcb 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -305,6 +305,7 @@ typedef struct SliceHeader { int tc_offset; ///< tc_offset_div2 * 2 unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand + uint8_t use_integer_mv_flag; unsigned *entry_point_offset; int * offset; From patchwork Mon Feb 6 05:44:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40293 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3089947pzk; Sun, 5 Feb 2023 21:46:50 -0800 (PST) X-Google-Smtp-Source: AK7set89WPckNYnRMWDUqJoLsP30JCRAvMvB87x7rJ5NQKoFKg7qrcwui3+WjmeMcybSpgvslZdZ X-Received: by 2002:a17:907:7887:b0:877:573d:e919 with SMTP id ku7-20020a170907788700b00877573de919mr19172665ejc.20.1675662410526; Sun, 05 Feb 2023 21:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662410; cv=none; d=google.com; s=arc-20160816; b=c2OlX328vY+6Pt5p6Qt5YHj0meCSv/1urAhfmJZ5gyPtmuUep1W7zYcXDNlq1zDrJZ kTb8UBPaGfmUzY09suw6FwbhGEDWD/DMQJlaOqQA2KrxzDnEqpSfTgPwueRPayp1TutS 6v1pMgINiFOKohxEzajWZh9qL3GdcqzPIzzdHgnKc3MMCrO+Wk+dWOh1DotyO2gnQM2t 77pM+xFmrTtyQ9U/P2atzRA1kzSvvCj3dmMpJa7FnsZ3eGc9ug6VxrE9usfVZ+3Mtn4x 9E/zOn5lUnarZ7WaBzrmXZEBBMV6oDA5Yolc4o9DWitp+xlThcFDBY3RsSFQs4xqpgib JjQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=EvA/KiwpYfQrT5s8+tk8tz/WVhAOq56XwT3lQwjXMKM=; b=dlQsE392kr2Z7CN54CyLevJnO1cuoX7MQPym3rhtzYRYkpB6UsdOsQxlzGT0lAeWHb NVtAGUlGZFfckHa7hkPmBCM/l0Ec8NRJ14OmZraPVKtRopmJkctQQgnsGDZkZW0M9f6Z wDM4RBRX6tA8j9/1G9J2uHYgoNTHe23a8dkG32zLW8GCGxJEnuL298bUBY9xkzG+Rf/l H0/zRZr1ikoAf8QuZtP0z5CACScpIFSr1u6axZaSK4PeFYgqngCgF6lQR0UywKjbVhVf vg2EIOTk94WRW3245ZttdMCErCFbLqp05O5KirrBVq7uVFZeRUJwjSJ2fGqihplhM6UZ o7aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=kW8BKeRS; 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 om40-20020a170907a1a800b00877a61c8d7dsi11127486ejc.690.2023.02.05.21.46.49; Sun, 05 Feb 2023 21:46:50 -0800 (PST) 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=kW8BKeRS; 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 F1B1368BE54; Mon, 6 Feb 2023 07:46:18 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AE90668BE3C for ; Mon, 6 Feb 2023 07:46:11 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662376; x=1707198376; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=RzgeT27PLmco4fUtOCQPH5gyzkPiewt4BvWtHoO78Fw=; b=kW8BKeRS8eULo2VNk2lz3Ya/Ho4ikwZLvxzt4zXCiIpfSzJaeoZ+taQA MbTO00oOvrQOQ19u/5qqNXioNqm3bzvHzD2+7IixgKW57UQMGotQbRPMX 2L+hb1ErvgSMXhzapve28zCItbt/UK8M54CaeUuBH8fAWZjlT8s5QweI3 oBSwSY/FymzV/2PLZZkKFvtAz4Cb6KS/u+oYuorLvI1Zpi8jSMp5sD7p1 DuOQnsd6Py6AhqpWFKULTMp8uhXTt08WP54bOda+NdEzij986HfGAC7Pr wP1+KK/NMrR5y/wBOFGXNL17R4arcCq+vkyPTT7LAvQk++xzPYgGp9qTE A==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144204" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144204" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737412" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737412" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:04 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:53 +0800 Message-Id: <20230206054458.907060-5-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206054458.907060-1-fei.w.wang@intel.com> References: <20230206054458.907060-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 05/10] lavc/hevcdec: Set max_num_merge_cand to uint8_t 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: P2BOfgzmgOik From: Linjie Fu uint8_t is big enough and keep consistent with the definition in cbs_h265.h. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index a7fc669bcb..aab816791e 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -304,7 +304,7 @@ typedef struct SliceHeader { int beta_offset; ///< beta_offset_div2 * 2 int tc_offset; ///< tc_offset_div2 * 2 - unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand + uint8_t max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand uint8_t use_integer_mv_flag; unsigned *entry_point_offset; From patchwork Mon Feb 6 05:44:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40294 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3090031pzk; Sun, 5 Feb 2023 21:46:58 -0800 (PST) X-Google-Smtp-Source: AK7set/0J1q46kowRoN7GRilqZuS3OHB/IEuWBDV9q08H5o0XZRundyraSjuva2ozioteBKI6Rpb X-Received: by 2002:a50:9f8f:0:b0:4aa:a9c7:4224 with SMTP id c15-20020a509f8f000000b004aaa9c74224mr4191915edf.30.1675662418511; Sun, 05 Feb 2023 21:46:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662418; cv=none; d=google.com; s=arc-20160816; b=p+Sx5Ow8foIXEkhvl9NJ1MhcEfL5QToTtaj+hfPh+nHm0LDQ5VSbMvefRbp5RUz8ZB uY9LRJbYRjRh4FtsaF+hsXYUAJvt/tBk7iaAen7SuuR9IP1auudkY+QeWX04sp0EiFTd QPHLUiRM01Lzh/oQYi/Ei9U6qe4gqGIqbvvOrWWFodjhIydX5cXYkXjIRzBoNuwsjXl9 ERSgTQLm9mokqRFAYsVAESU2PzjvGeJTYVAb0D0qD/KMHMFyT+9j0M+TNlxJgbj3jBS3 xMQNvmU4LbMJ/+ZmVhp0YHeXD+5xJ7PovZ+T2oL9wiXL31OCbefpGX+jrEt3uYPUFaYn 45bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=ykz2ND30EKoxTHIzzfnZx7q2CtBOA21zBz4wiOjLF1s=; b=ZX6pkw+6Hz02Fx9IzHjxeMvJg2X6WDYCrqVB+X3GAn9vbbNS1ULsDQb1asMd3K6pR7 uaEXui6lFiP00IOSfyETwxSJ5euOnya4k8h2neDIUQ2E3KIGwk3DbpRmY+t9YYDtQwxP uYL2JpKVTKwXtB4svW3JWOBkV7RzIukZ2agcujR3lRdc0t0nKYvHp4hC+pRkhO8SKulG rWcx4y1O7FJgMruLPsKjenxDPR/G55CK5B/v77hECUg/snCbErm7lMh0IDB2FrbCsVA4 ESR0Yvl0ysGUhoEceCfFkR3NAX5E/4OrWqIKms9jggwfdJyJxubqTNdirhs9HLEi+tzJ gGMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b="FgD/kJlL"; 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 q9-20020a056402248900b00483bcf2ab07si12534174eda.325.2023.02.05.21.46.58; Sun, 05 Feb 2023 21:46:58 -0800 (PST) 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="FgD/kJlL"; 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 2DF4568BE6F; Mon, 6 Feb 2023 07:46:22 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3784968BE6F for ; Mon, 6 Feb 2023 07:46:14 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662379; x=1707198379; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=x8ATO9dBZOURiBlDbQJVRcH+T+KLbK0xC6R15sV4wZM=; b=FgD/kJlLDh6AcRXTnQgv5Co7Oeapp6qX9Djol3YBsGfQLWRocyWIyX6p sQZU5TAPzYDCM7AnD0EeP/gEwxSf4x4i3jEYcsY3QbPjEwPdqm0MHbBZ3 4vBcc+JbgaJ/D0pCDvVKGTkb/A+lSbNuTR4sCBxG9d+EwahCFCo/FDTSE Y9Dj97Ia2Yx4OofJlQz+PI20Yk0HdngOI7PbNbPu/xlOTgDRtOAZhC2Df UlTnh+NzEnqiLYjRJpJCgjTarJmiZ6E2z9jpamSBeTgNbk5YNZGwo13iC Yp/c3RSGZwg9iEpyYVPMIWgAs/Kip4y886PpsdkHy+/QOKmBKr+JZWjKe w==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144206" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144206" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737416" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737416" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:04 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:54 +0800 Message-Id: <20230206054458.907060-6-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206054458.907060-1-fei.w.wang@intel.com> References: <20230206054458.907060-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: XE+ACGCcmB0A 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 From patchwork Mon Feb 6 05:44:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40296 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3090220pzk; Sun, 5 Feb 2023 21:47:16 -0800 (PST) X-Google-Smtp-Source: AK7set8MuSWBq+meivhmj7rKRKELIZ9tnSYc1HWhouetgDugF2yAJG9BqbD53IzweqyypK32/H93 X-Received: by 2002:a17:907:868b:b0:8a4:7f5d:c000 with SMTP id qa11-20020a170907868b00b008a47f5dc000mr2412823ejc.64.1675662436455; Sun, 05 Feb 2023 21:47:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662436; cv=none; d=google.com; s=arc-20160816; b=rHae5lzMpN6d//3CBR1tP79KvauAahEr65z3UXByzINcU6AXcGnQZmRNZzVxTIHu62 FlDD95v5/JiX3R+ObPzDlKak8MSXNgoHmi3bwBGLP26hiUCelVVAfzVWOtSMeS36LiGW r5OL3+s9c4wCxwYZaDn2FXS3jJvtRo1+ho28n8BoIDiNC9+d6iSmkvAHST78cSfuXaUY e3fiqN1gc5/UkpWBSA0GQaxzHr7BPoIhvu2zAbsfZ0ie37qe9d2Eq8gQ+K/wfw+vmANK D+T66MqvEKwbpn1AUc4mOfQu05oA4x8qs2D8U6Ksb9KuyUxXI2SGeH9380ib4nIDYSYa NsLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=OVmId7HIys4Iyun5DSLOLlL+YvO0ZrsftPzETVsSOIM=; b=PELM1Yyhkr6XV1bB4zrtSl7rmKP8leCYDWAlKQkrxgaUqBxiW/Js/Hu9hedMyeX9xD SLRPuTVNqAEVsdiUJT764mx8Mluzk4/4zC+8TNIxhCyteQCDacf+JVXqa4EszRqqTuX2 TKDZhuQUEjhFuVTtV6O2n9Y3TwNrY11cFH5k9+tP8NvZUJbB1Epr5ddnuhgcwhRx5VsU 5whKsLr/Ry76pIAuAffwniXmCL1G+wq/8196MoWl0J43IfCy3jNlNaQdA5iyDpXqpEFo Ra8WWrLqJm6w7RahXROdc+kMIfxO02nrxFZ5lhZ7lpeLXMyCZQSRRZYd2jdHj5CrGlJV VfVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=G9U0jBOi; 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 fl22-20020a1709072a9600b00891c6821abesi7007372ejc.396.2023.02.05.21.47.16; Sun, 05 Feb 2023 21:47:16 -0800 (PST) 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=G9U0jBOi; 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 745AC68BEC8; Mon, 6 Feb 2023 07:46:24 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 34DC168BE73 for ; Mon, 6 Feb 2023 07:46:16 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662381; x=1707198381; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=9BYbyAle4yEXFLV986pORDT7UlIMNReCADyV/gEJBRI=; b=G9U0jBOizViCBLQBI3NFhrm5JwU0/6DlWreDxeu+QiYa34S1TZasOgcE 1ryzL84jRrYXVxzIxsavebm7RbCPj1jjSSMtIP/Jmcaue0wuRrnhYyb3e JlLgxsYb90Z5J9oxo8P/jHRZ+os9s827qHF6+IxAkJLANQ0FqA+kLBM2I 5/iGTvPFiKzvvrShxe56WYbgAszcWEw3ynlYCNGo78sTpfbuFUp6wipgM 3d494gDtm3Mdn29pNB4tD5goQPK0DjKkY795bCVtSQYaeM+ET6o46qeOD E830iRDb/+Ch0GvQTrCyOtuCyzXy86H6+xLIkBTc13rzwozxSIAfiApkI A==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144207" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144207" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737421" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737421" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:05 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:55 +0800 Message-Id: <20230206054458.907060-7-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206054458.907060-1-fei.w.wang@intel.com> References: <20230206054458.907060-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 07/10] lavc/vaapi_hevc: Pass SCC parameters Through VA-API 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ae33PaR1BqS2 From: Linjie Fu Including sps/pps/slice parameters. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 57 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 20fb36adfa..a7b541750c 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -126,6 +126,10 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, const ScalingList *scaling_list = NULL; int pic_param_size, err, i; +#if VA_CHECK_VERSION(1, 2, 0) + int num_comps, pre_palette_size; +#endif + VAPictureParameterBufferHEVC *pic_param = (VAPictureParameterBufferHEVC *)&pic->pic_param; pic->pic.output_surface = ff_vaapi_get_surface_id(h->ref->frame); @@ -218,7 +222,8 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, } #if VA_CHECK_VERSION(1, 2, 0) - if (avctx->profile == FF_PROFILE_HEVC_REXT) { + if (avctx->profile == FF_PROFILE_HEVC_REXT || + avctx->profile == FF_PROFILE_HEVC_SCC) { pic->pic_param.rext = (VAPictureParameterBufferHEVCRext) { .range_extension_pic_fields.bits = { .transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled_flag, @@ -245,8 +250,46 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, for (i = 0; i < 6; i++) pic->pic_param.rext.cr_qp_offset_list[i] = pps->cr_qp_offset_list[i]; } + + pre_palette_size = pps->pps_palette_predictor_initializers_present_flag ? + pps->pps_num_palette_predictor_initializers : + (sps->sps_palette_predictor_initializers_present_flag ? + sps->sps_num_palette_predictor_initializers_minus1 + 1 : + 0); + + if (avctx->profile == FF_PROFILE_HEVC_SCC) { + pic->pic_param.scc = (VAPictureParameterBufferHEVCScc) { + .screen_content_pic_fields.bits = { + .pps_curr_pic_ref_enabled_flag = pps->pps_curr_pic_ref_enabled_flag, + .palette_mode_enabled_flag = sps->palette_mode_enabled_flag, + .motion_vector_resolution_control_idc = sps->motion_vector_resolution_control_idc, + .intra_boundary_filtering_disabled_flag = sps->intra_boundary_filtering_disabled_flag, + .residual_adaptive_colour_transform_enabled_flag + = pps->residual_adaptive_colour_transform_enabled_flag, + .pps_slice_act_qp_offsets_present_flag = pps->pps_slice_act_qp_offsets_present_flag, + }, + .palette_max_size = sps->palette_max_size, + .delta_palette_max_predictor_size = sps->delta_palette_max_predictor_size, + .predictor_palette_size = pre_palette_size, + .pps_act_y_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_y_qp_offset + 5 : 0, + .pps_act_cb_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cb_qp_offset + 5 : 0, + .pps_act_cr_qp_offset_plus3 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cr_qp_offset + 3 : 0, + }; + + num_comps = pps->monochrome_palette_flag ? 1 : 3; + for (int comp = 0; comp < num_comps; comp++) + for (int j = 0; j < pre_palette_size; j++) + pic->pic_param.scc.predictor_palette_entries[comp][j] = + pps->pps_palette_predictor_initializers_present_flag ? + pps->pps_palette_predictor_initializer[comp][j]: + sps->sps_palette_predictor_initializer[comp][j]; + } + #endif - pic_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? + pic_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->pic_param) : sizeof(VAPictureParameterBufferHEVC); err = ff_vaapi_decode_make_param_buffer(avctx, &pic->pic, @@ -299,7 +342,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx) VASliceParameterBufferHEVC *last_slice_param = (VASliceParameterBufferHEVC *)&pic->last_slice_param; int ret; - int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? + int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->last_slice_param) : sizeof(VASliceParameterBufferHEVC); if (pic->last_size) { @@ -413,7 +456,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx, VAAPIDecodePictureHEVC *pic = h->ref->hwaccel_picture_private; VASliceParameterBufferHEVC *last_slice_param = (VASliceParameterBufferHEVC *)&pic->last_slice_param; - int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? + int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->last_slice_param) : sizeof(VASliceParameterBufferHEVC); int nb_list = (sh->slice_type == HEVC_SLICE_B) ? @@ -478,11 +521,15 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx, fill_pred_weight_table(avctx, h, sh, last_slice_param); #if VA_CHECK_VERSION(1, 2, 0) - if (avctx->profile == FF_PROFILE_HEVC_REXT) { + if (avctx->profile >= FF_PROFILE_HEVC_REXT) { pic->last_slice_param.rext = (VASliceParameterBufferHEVCRext) { .slice_ext_flags.bits = { .cu_chroma_qp_offset_enabled_flag = sh->cu_chroma_qp_offset_enabled_flag, + .use_integer_mv_flag = sh->use_integer_mv_flag, }, + .slice_act_y_qp_offset = sh->slice_act_y_qp_offset, + .slice_act_cb_qp_offset = sh->slice_act_cb_qp_offset, + .slice_act_cr_qp_offset = sh->slice_act_cr_qp_offset, }; for (i = 0; i < 15 && i < sh->nb_refs[L0]; i++) { pic->last_slice_param.rext.luma_offset_l0[i] = sh->luma_offset_l0[i]; From patchwork Mon Feb 6 05:44:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40298 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3090365pzk; Sun, 5 Feb 2023 21:47:34 -0800 (PST) X-Google-Smtp-Source: AK7set+TN7PZ4f4+L57z8RfHl/0mv9UqVhHwdtEs2ajkaXrN+XgP0mD8PPYyQ2OUNMDLmLYUUtoK X-Received: by 2002:a17:907:948a:b0:893:7668:1f34 with SMTP id dm10-20020a170907948a00b0089376681f34mr9181706ejc.35.1675662454092; Sun, 05 Feb 2023 21:47:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662454; cv=none; d=google.com; s=arc-20160816; b=RP2euGHvCdm+9VGLGomN1T7Ep0+ksoriS+3f4qbC45I0Xjd1Bk0/XBObjx0LR3etJs bZWG4P4CQs9xOJLaWoMexQyHQ+nuV0p/JmiCScTKTCVgccCOkyWVjk/9WHXG4WQwZ1c/ isyPqar7VX4CMBEYTSxpy8sDHlawOn0dvZTmZ4Ys8Y+PVMxqwH6O42dMVy8mOWw/FL9X cDWYJR3itg9eCwuP18YhLzjyixFqU/o4IWZo3iL+3CV2dd1aMXC64Ieu/KYlvcKnxdhp lkV5MF4tm+KSm/66IuW+RuIS70GhBXVfNCWkNypcP2srJ9beKdoM603uU7RCVf2M/i3K P+CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=y6VDCV3HyRaDIO/VKOcANrlsNddy21JEgopJdML0CnU=; b=qFtT90NNidVacTotC9smH94OIOybyAIsgsPVYKJ0cIW3lOQq3xcDtFk+MxhVvviJJR ukMJ9ZxQAc5cRQete6XhKnUYqkNxSNixX9SAvrS0Y4zek4AaJJ9oIO+PqbTkfwdSRjOw GMSddstRnNP9OvuRCBd224bU3GWIkJjTuxK3BTDAE+zPGiZR+JSl1iGnAue92uTuOxis frnexxjH2TJzEip5UNxmOthUSShzcDFEfBD83yX/aK6zCYQk3Gm9vvdk9N5V5t74fHTj ONg7ewhL+PLfr1JY9R3iVJmxE4JPHFwamPWJqyQcl/CnDApVxTHcmsduPsI/U7TFKVg8 HBEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=dvwVjLTk; 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 y14-20020a17090668ce00b008432fa22567si12953505ejr.649.2023.02.05.21.47.33; Sun, 05 Feb 2023 21:47:34 -0800 (PST) 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=dvwVjLTk; 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 7E53A68BEDA; Mon, 6 Feb 2023 07:46:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9DC9B68BE95 for ; Mon, 6 Feb 2023 07:46:17 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662382; x=1707198382; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=pXuG7eU4H624rWvc2n1fx8dkJ3wQyvtUr03EAJbcv3A=; b=dvwVjLTk+TnMZT+YuaR2SMwNheGMmxeO0aftPz1uGkSucITszGVHt9kB TBxn+e8c56RyV/LcGcDj9j96pXRoPxM7hBwSgP+bdkWtJf15Vo+A1Xbpu RL6iQDm0cNPus8BOz1pvePLox/ycrHwnW2IZ6vniWgkzeFcxi2KjwORIC Od2K+HoI6K2hS/LdFzriOyQ/Pqqt+SAqehUp95KcVW286ip7rt9t+yOEw AkAG4h6kyiie9ZpA+j3amFOFKbYPMjWMCLA/MkQDlrPrdzkQgcbS6kvXw TsCgEhhTDx74wcGwBBsSzkRZwXAJI4mIZECRC55b1Ol0MA0qbVirXpNoZ A==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144210" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144210" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737423" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737423" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:06 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:56 +0800 Message-Id: <20230206054458.907060-8-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206054458.907060-1-fei.w.wang@intel.com> References: <20230206054458.907060-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 08/10] lavc/vaapi_hevc: Add vaapi profile parse support 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: M2+RmtdEae8j From: Linjie Fu Note that Screen-Extended Main 4:4:4 and 4:4:4 10 supports chroma_format_idc from 0, 1 or 3, hence both 420 and 444 are supported. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_decode.c | 4 +++- libavcodec/vaapi_hevc.c | 14 ++++++++++++-- libavcodec/vaapi_hevc.h | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 134f10eca5..ab8c12e364 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -410,7 +410,9 @@ static const struct { #endif #if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL MAP(HEVC, HEVC_REXT, None, - ff_vaapi_parse_hevc_rext_profile ), + ff_vaapi_parse_hevc_rext_scc_profile ), + MAP(HEVC, HEVC_SCC, None, + ff_vaapi_parse_hevc_rext_scc_profile ), #endif MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT, JPEGBaseline), diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index a7b541750c..1cf43bd4dc 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -591,9 +591,9 @@ static int ptl_convert(const PTLCommon *general_ptl, H265RawProfileTierLevel *h2 } /* - * Find exact va_profile for HEVC Range Extension + * Find exact va_profile for HEVC Range Extension and Screen Content Coding Extension */ -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx) { const HEVCContext *h = avctx->priv_data; const HEVCSPS *sps = h->ps.sps; @@ -632,6 +632,16 @@ VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) else if (!strcmp(profile->name, "Main 4:4:4 12") || !strcmp(profile->name, "Main 4:4:4 12 Intra")) return VAProfileHEVCMain444_12; + else if (!strcmp(profile->name, "Screen-Extended Main")) + return VAProfileHEVCSccMain; + else if (!strcmp(profile->name, "Screen-Extended Main 10")) + return VAProfileHEVCSccMain10; + else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4")) + return VAProfileHEVCSccMain444; +#if VA_CHECK_VERSION(1, 8, 0) + else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4 10")) + return VAProfileHEVCSccMain444_10; +#endif #else av_log(avctx, AV_LOG_WARNING, "HEVC profile %s is " "not supported with this VA version.\n", profile->name); diff --git a/libavcodec/vaapi_hevc.h b/libavcodec/vaapi_hevc.h index b3b0e6fc1e..449635d0d7 100644 --- a/libavcodec/vaapi_hevc.h +++ b/libavcodec/vaapi_hevc.h @@ -22,6 +22,6 @@ #include #include "avcodec.h" -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx); +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx); #endif /* AVCODEC_VAAPI_HEVC_H */ From patchwork Mon Feb 6 05:44:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40295 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3090151pzk; Sun, 5 Feb 2023 21:47:07 -0800 (PST) X-Google-Smtp-Source: AK7set98vHmyt9aB3AQiks0IJ+iiTaMEcqbobn4/Z3DDGHnxwqrs5PGJ0r8Qyjn2zUhszgMYlNtR X-Received: by 2002:a17:907:1607:b0:87b:6aa1:c87f with SMTP id hb7-20020a170907160700b0087b6aa1c87fmr23999316ejc.26.1675662427378; Sun, 05 Feb 2023 21:47:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662427; cv=none; d=google.com; s=arc-20160816; b=wf+qW0649kqSF3T9cq6wpGxtZKpiqOm5ZTqNzB9NG3XYZRd5RBRxQrt6uAsJOQ0ts2 wSEFVOkXA0od65xhBzLIumQSrokpwdjj7910gzDJD7lBwdTBcojnFmCA3J+kNlFE/YqY Zz+4rvF8UN1hRit0z9IK0w9ErgzvnYWuNvYSh5xIRSev0omcMWR4f7baBWkfmiNKzSZj 2Tkv5kPr5Q2fm7/dNTON+vdNSsDRjBKER0OIVIrsKp0196oe0QmgsLp7CbF7tpRKsUTK yMvXvUGTwHzR53YUDDqtnltiaN5MjVYKP4p4aOcPboPF24rh68+bgKKLhGfuks8BviAC wovw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=yL4HEKNOoOVwqXmnPbWG8bsK3pSLhN16Zf5LSKaYiCc=; b=BuoR7evO8q0DrfP3WqBVVVZtitlzfsYd1XeHrJ3nd3hmQGjRu4ZQOj3rOjU8lSyS4H lC9hvMFg/bTcV48cGft4q41lAJNuDXt4p5VZBUGgLKt8lbsk0T3T243mshjWaRpTy+fk iE91uSgsArz2ViZ0UsswzDuEwK9lQBNhAlTx1uMxZYWr5AV8JsVqmcTnHsKwTFemUSkT vkUZ6dRDlz3kqyi5Rl6mZqAqFck5AzGf3/VtWse92x4/hFfi7J1qywOXBIoKrOlfCwu1 x4RjWk6AP3XyiMYJ21Cz9TQWGu9iCsaJzclyktDLW/Jf96WEvM6Halw7QevY8xEmjT6G GG7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=c1lv5VM5; 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 c9-20020a1709063f0900b0088da09e62d6si14195287ejj.538.2023.02.05.21.47.06; Sun, 05 Feb 2023 21:47:07 -0800 (PST) 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=c1lv5VM5; 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 20A2B68BEBF; Mon, 6 Feb 2023 07:46:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 40CC568BE6F for ; Mon, 6 Feb 2023 07:46:20 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662380; x=1707198380; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=dCehz39XW/LltSLxS3as6ORj4GttedgPDB3WbxMjABk=; b=c1lv5VM57kHYEvD26xbucoQtjL1PpasmjIa/xMYjm1admvbct3/wzzp5 dsbQ4GFTpSPLrbHziBMVMA2QngrNOvk2p/Y05t+HXNbFaVUJQS5JipOR6 FE8ZbXf+JmOe0Bibs29+MNLCYV+KGDpR+HLbr8N+sZRjInNoAYl606xrV 3X8obBDjs9uBqo9OqR8+ILRSTBg1kbwk9XloXIAm+uzA7Wy7khX/bRbfS Sii++Qibtjtir5sF4iqcTxERp30U9lX0blClZqw6j3aZ3JTHrqFAXo/f9 x3AeLPFGFHf8p1bqtNHbjegmFThuQhrH4Km8+UKacciwc55JAqqtBQ9X7 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144213" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144213" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737428" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737428" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:08 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:57 +0800 Message-Id: <20230206054458.907060-9-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206054458.907060-1-fei.w.wang@intel.com> References: <20230206054458.907060-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 09/10] lavc/vaapi_hevc: Set correct rps type 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: u0uObiS5Kcm0 From: Linjie Fu According to 8.1.3 and 8.3.2. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 1cf43bd4dc..a06785f7a6 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -71,6 +71,7 @@ static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) { VASurfaceID pic_surf = ff_vaapi_get_surface_id(pic->frame); + const HEVCFrame *current_picture = h->ref; int i; for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; i++) { @@ -88,6 +89,9 @@ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) return VA_PICTURE_HEVC_RPS_LT_CURR; } + if (h->ps.pps->pps_curr_pic_ref_enabled_flag && current_picture->poc == pic->poc) + return VA_PICTURE_HEVC_LONG_TERM_REFERENCE; + return 0; } From patchwork Mon Feb 6 05:44:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Fei W" X-Patchwork-Id: 40297 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp3090304pzk; Sun, 5 Feb 2023 21:47:25 -0800 (PST) X-Google-Smtp-Source: AK7set/6RsDIihShhJ8Y2I3UNcUcIMNc439cfxllwePPRU8rjb74W/FS7ODuMKDG2av2dxauogN8 X-Received: by 2002:aa7:cd4e:0:b0:4a2:331e:85f2 with SMTP id v14-20020aa7cd4e000000b004a2331e85f2mr17809528edw.26.1675662445534; Sun, 05 Feb 2023 21:47:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675662445; cv=none; d=google.com; s=arc-20160816; b=F0K2fU5ViFfwFHSGFyfj+xucDznRIa4QSTmCFwAwCCX4qZgBfDWbQsSeLBYq+gw9S7 CyWQT3+OjV4DbhyxCT84Gyk45m1EaOg91+uer02QvIzUdACHEZmUKpP1RMXeJRxtHH9r HqrX6MOCthfJoHdCm5awjHa1VSk2JUiiLLcfMEn7tO9SFmN2+ruE6+EzeA7t2KlqDwR4 KwFRbW8FvoQoxTE5WGCXv4lgu1/Yys+QCNOF4zUWViKX1J6GfYVRDr7iJvJbMCdWc4J+ EH8ruh8BCIwAXjGxQvchv5xr5oYnrPSeqP27XIJu2Zbw/2TAtHZR1a9wPW9FN1gp/Vgz jf1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding: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=qrHys0go/VOVaHhcenT2s8JBKGf1thS7PNItt+9Ahdk=; b=bLQmsAF2KOJzFto2lZc5Zc9Gdnq4nOGuwAdWE/rgfIBst8ixzS5hUWoi6tG5Klbtu4 EZkHhbAdpF8Wgd8aZbWL0ux0qL1zX4lpOzow0SqGzEg+ATxHbuQWMrlNcgQz8bMwC3Om jve+G6ik6s4wedryU+58cjy1s8gRuBuK1g/BG/LDJ4SeB9ojzL9K0dxjmF0DQFbOm/tj 6Mrh9CqimiKjlD6YUPUjMTs+DzA9bgYTsn1S8IFrR+EAQJbAk5V7LWuU7DrstFXjpFGZ 6ABIsUlrBy3cg3WSh+hFXH4j+FwWDYRxiADiW12LEUjL2sr4KW3Vr7fO7si6XUJOtNOP rMVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b="f9Ec7a/S"; 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 d17-20020a056402401100b004a12b1e8297si11702424eda.525.2023.02.05.21.47.25; Sun, 05 Feb 2023 21:47:25 -0800 (PST) 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="f9Ec7a/S"; 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 7801668BED2; Mon, 6 Feb 2023 07:46:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 401CE68BE85 for ; Mon, 6 Feb 2023 07:46:21 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675662381; x=1707198381; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=+Hp2FerR/3cmkCrSr+EIqBF0Q7jK+14hzILZnF+fmJk=; b=f9Ec7a/S3IKY1IPtJj8Bijz2ojn6VngzZaytOQ2xS6fEgQr5+MTIF0mQ 6/d2VV6sI9F8MW3tJmIFmWJOH+ORvj4DdUMtvpJOFJD11xpGm8hzwngmO 4Bb98pkY80wQvYnFNYbCRb7jQX3cRXtyNBmKe5ye8eOkClZwmBVBN/gtw p+ZTcbjlGthSPIYoYCpVc66AQWQ2VEDjwOJu69QsyuTvFYmYNPHKhdgYx Hskw7G7P0W/5gRrGGuHfnz8cl7qUr0pdGOArpQAkdmH1q0Lndr4h47xiy cms7mZ4NnqJKPuQMotYgLYqYXp64ueMXjzM3AVDPHl5yS/lfJd/Hph1yf A==; X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="317144215" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="317144215" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2023 21:46:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10612"; a="698737431" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698737431" Received: from t.sh.intel.com ([10.239.159.159]) by orsmga001.jf.intel.com with ESMTP; 05 Feb 2023 21:46:08 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Mon, 6 Feb 2023 13:44:58 +0800 Message-Id: <20230206054458.907060-10-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230206054458.907060-1-fei.w.wang@intel.com> References: <20230206054458.907060-1-fei.w.wang@intel.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v5 10/10] lavc/vaapi_hevc: Loose the restricts for SCC decoding 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: bEhmJoi6qIOy From: Linjie Fu Allow current picture as the reference picture. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index a06785f7a6..0e5da15e53 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -104,7 +104,8 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, VAPictureParameter const HEVCFrame *frame = NULL; while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) { - if (&h->DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) + if ((&h->DPB[j] != current_picture || h->ps.pps->pps_curr_pic_ref_enabled_flag) && + (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) frame = &h->DPB[j]; j++; }