From patchwork Thu Feb 16 01:32:39 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: 40398 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp115499pzk; Wed, 15 Feb 2023 17:35:26 -0800 (PST) X-Google-Smtp-Source: AK7set9H/IYYqQQ1TcG+TNN4tLVNWNVOwvAe7o4ei9FSfALyyYSI51GWchfpEi1m/1GIOj/SNsw+ X-Received: by 2002:a17:906:1906:b0:8a9:f870:d25b with SMTP id a6-20020a170906190600b008a9f870d25bmr4212447eje.15.1676511326741; Wed, 15 Feb 2023 17:35:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511326; cv=none; d=google.com; s=arc-20160816; b=HTB2MU0wFyJddVwy1u+2mSfNodPZeh+5dJC1mvBLi3bpwwpwy1BnN5Dne/vRVo4y/K /h0smwHwYw4oQrUxdgwT7MnkOEimi7KB78FpcjNwq9/RclvrleYTFsP3KBRbEbwJp1Dp 3my5O7r4eGbPTmmzhCEGxc1OcVk/5V1B6Jns4s/sCTkoXVvBOuCSmHwmAJTXkkzFlgMe x+3nNFLboPgHAW4zvvfGVkWX/aORXsQZpKa2SOTxY+z0QlPFH5ba9n5ftJ9W4U8HFUkS DzTe0f0SdfZEOlEjpBeWLw1A88y9aaFxwk1sZtZ+LBahfrcJkF5Hl0nCu8Mmz8tMIccM 8XUA== 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=gVAsVcTFbnFlQUU1L7vR+kBNwo7LdzV24lTG8/2zCW4=; b=bpH0LWN4bLMyOKGLCuRqHGHUwlygudl2il4WnB91EZkNmhxviNGdhmgVWao08+n9id gV8I3BuHwlmF1pN4hN0n0LmdKQPdv5FE34W1gpxKZiw/5U3ENKLKxUBeSCplX8UU9/ro LYcwlHuOe+qMpcDDyRct3D1mTnBNjvvXmdLzjTbwQyZj59xqG9GAZLB6ID/C1U3a6wga Y9aEm1xrb+JJ7XnBP7tNf97vsJlWSGMZqLW8FtJ2ZcJ4exSXkXccz8n+sUa6vZ7V/StA 3TVqjfauNiCkQxPx6v3WCwELCIXCV3T0FwIcuflVcS6EsZ08ca+v3+aVnk3nCxuHsaDe jDvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=KimgD3jL; 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 ez7-20020a1709070bc700b007c08bfea548si300658ejc.382.2023.02.15.17.35.26; Wed, 15 Feb 2023 17:35:26 -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=KimgD3jL; 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 5FD6F68BEAA; Thu, 16 Feb 2023 03:35:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E21D5689965 for ; Thu, 16 Feb 2023 03:35:15 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676511321; x=1708047321; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=8f1u1V5+7thjH+g0dTInY8EG6+ObYrswvji7T1/5yYc=; b=KimgD3jLg/BuzK5i37g1Iipo7AFM4GI0BlQXiH3fY1L5qbEoWKy2aIs5 oVpJ4RyEo7Lz68U5s+Yxh8T3/F1toN/JrSjoIk/xX8ApjehG6AKLTS3Ow fK7Dyy1qelbPNFAX9UWRk6vm+jz6qDCtIcGgx6foYJxWBE8p1+gZGr6+h 5R7J8Ygr/bUi6Fs4FqEHqP5dQisT+ymJlcpbKuoUJiEXJEdXB40dtyOWm av5VFcC/NbmPDV+09aWYYjHcv7lmWVwSukIoJ1zb3ycwDu6RpS/7mXItA klu6+qENiaL99kRGzEJSFLi9FNAee53iWH8U8vBZru/BkNRNUieBMcXf9 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223797" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223797" 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:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168791" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168791" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2023 17:35:13 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Feb 2023 09:32:39 +0800 Message-Id: <20230216013248.23044-1-fei.w.wang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v6 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: 5NkQDmEte/gD From: Linjie Fu Described in HEVC spec A.3.7. Bump minor version and add APIchanges entry for new added profile. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- update: 1. bump minor version and add APIchanges entry for new profile. doc/APIchanges | 3 +++ libavcodec/avcodec.h | 1 + libavcodec/hevc_ps.c | 2 ++ libavcodec/profiles.c | 1 + libavcodec/version.h | 2 +- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 3ca724724b..5ab4a9c94f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-02-14 - xxxxxxxxxx - lavc 60.3.100 - avcodec.h + Add FF_PROFILE_HEVC_SCC. + 2023-02-13 - xxxxxxxxxx - lavu 58.1.100 - frame.h Deprecate AVFrame.coded_picture_number and display_picture_number. Their usefulness is questionable and very few decoders set them. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 39881a1d2b..9a0fe97cad 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1654,6 +1654,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 }, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index 0550d7b0d8..43794ea588 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 2 +#define LIBAVCODEC_VERSION_MINOR 3 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ From patchwork Thu Feb 16 01:32:40 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: 40399 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp115589pzk; Wed, 15 Feb 2023 17:35:37 -0800 (PST) X-Google-Smtp-Source: AK7set8S3OflbtznM2Epp4yg/bvVZa6tKBgtcfZVIxkzIZcQSChL4i/zb6K2NHUpCOAIzqwMwEGO X-Received: by 2002:a17:907:c286:b0:8b1:3faf:e5d with SMTP id tk6-20020a170907c28600b008b13faf0e5dmr540935ejc.14.1676511336813; Wed, 15 Feb 2023 17:35:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511336; cv=none; d=google.com; s=arc-20160816; b=vxNPzOFnNi5uqYQLZHJfsPm4ph71lmzliD2z4g9NBloD8JNPozMz5ag0bj+kYIO34z 5PT7jKDX0zf04c3aUjMal5A4dP6KJQg5TlCdDEByxPIMrl144i3DROsqiGaN0WrL0aS/ cwutC+kT+Zh6cLhxGWCUAqc/zz9nQcV+sBjNPVN6kxbTr7g1dMN8H2pn9+RgDEY5Esss q5xKSF+32cdT4hk8kn9i0VDtDzD3bHTxNco6NhUl3jCILtuD6OA5sZENxzqVoCzWac9F 0tQXiqJUdGTpJRfPJ9Pcv8uNMgWT8M0TTFLbokK6SQabvJcecdwa1nwPhA7PODqZu1W0 AuCg== 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=052v/nx6YCFaTVXhhCQoaM/0q1ediqmkzwhIgDjGbW981OydjtEonquK6mm0acqdBR CiT15zjHxv/c9gMDWTeTt8Dey0V3sTmnolGJcmPMrI5hLCnmDkspAGOrhJmBGKdIAZaS baFvJFz9ZLxMbyXvEXPtDaBG92vMBa2nb+Uw0f/YSQ0B4jxQ9g8mB2LWIzT0aAMb9pr8 iWetBRuWvlPppLUzs59ufeV3NIAtqdsruv9OTuq0/LgPwEkQYqbLnkUjx9s4aXahbQVg bTG2GKw56HCKQ5Z30tcxIkwk2F6E2EApG6aGYvOY3+Tjfr2vITsK42nvbh/telUrlg6O oUwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=E9WVdEFV; 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 fh4-20020a1709073a8400b008b129981324si257010ejc.683.2023.02.15.17.35.36; Wed, 15 Feb 2023 17:35:36 -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=E9WVdEFV; 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 636E168BE7E; Thu, 16 Feb 2023 03:35:24 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3C51B689965 for ; Thu, 16 Feb 2023 03:35: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=1676511322; x=1708047322; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=a3XIqrmp9IzMhYCzHdagnhnX4jwc8qKcVJgWBAT31Ic=; b=E9WVdEFVsoQv7kiN+xfIoVIxnlMu4+rmGPe6wqxPNXmDH+5c/tU/6NX8 T7tVLvn/pD4+HP+57WkQqGrUS1XFLHE8YhQqySvMu0UHJR3xAbL2Z2gfW bpNM+TW1Idx/3Bvfjl+VqYNNcLE2r8fttLR0NbWhJN+qQx7Q0y8W18tI0 Lw3qSlxvkT1+dw9wASWej9oWGoaWDyhim41ArQZYZuKYBtUpxVXnbuwLQ mmRfM7JAZbZu1WHGgH3huLJ5pvADslMseV1GMGs++2+JA4zHc0wfi29D5 xqDK4LSIVQPN1Sv0sFQRsnJ5S9OHYyK0tFCq99epc9CwKxQP5SlzrtT+2 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223799" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223799" 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:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168798" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168798" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2023 17:35:13 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Feb 2023 09:32:40 +0800 Message-Id: <20230216013248.23044-2-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 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: l+2DkSlOG90s 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 Thu Feb 16 01:32:41 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: 40400 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp115655pzk; Wed, 15 Feb 2023 17:35:46 -0800 (PST) X-Google-Smtp-Source: AK7set+mVXTQLDl6IRWV5cw8O50+aI39Uo0OK/WbDCEJPsM24F+Lq+Uq7nAcMTQ7vdw2LWtEV/9S X-Received: by 2002:a05:6402:399:b0:4ab:ec2:3cd1 with SMTP id o25-20020a056402039900b004ab0ec23cd1mr4099137edv.25.1676511346044; Wed, 15 Feb 2023 17:35:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511346; cv=none; d=google.com; s=arc-20160816; b=vWVebUODeuoaiiNU4N1aopmpEPG2F62XAVSC7iKPeS7/LKrtrrYh96y5ub3FL4LEvJ +F4sb6yTEla7c6dB6RCaHsKH3036ay4QSprT/zDqsnPOopmFc95u25lNnNwlZOodT2Iz VwS/vnMUbQ0ew2ZOarlDg5PKGk1yY0SOGWxZmiliwTA7AX8GEx8YBLb/pffJPgo/A/2W Y3MmyHXn3Q7kaHXyRNpGHCRKya7NrdzDywQj/Tmai5Z/RiHa78w1nvXgCi/G6kzgJKMr IYkXlI+frzI6RPM22nT9AlAWGxVWN5yIJnJgf2El3z2XrQp4xXMzLt+lYwVJx9LOrc0b 7awQ== 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=cZC+1iY1vye9cJJmrBBdEMohvQXuxD9kWf3kmBg5xkMcmRNGNA8fFYFASZZ08tBV/8 KuInVXB3JrKI1SQh0m4W/ndnD1moVlixtGWO5YqvPP0e/bN1nx/L7oXvaTsnBvjxPwvY RWHQQXPq6iX2Bt/+8YTWZDA2lP56vujIW22TL9R3Jvm7naL5ihQfl3/0Cglo4nIQ0zQl tDvm8QNtNfnkHh2c+ncc7METciQRdwN4ZqlFUXMZqvzwNbtKLs2ZE1k5TNQ208AJCxaB +buYhWs5sKT0wE2ToS4Y9gQhS6j5/A4tRygtxmxaOh1fL5GqZKbLvPIVwSBtVbQBi4En 9sYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=bWV34vQC; 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 i16-20020aa7c9d0000000b004acbbc70421si452590edt.366.2023.02.15.17.35.45; Wed, 15 Feb 2023 17:35:46 -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=bWV34vQC; 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 58DE968BEBE; Thu, 16 Feb 2023 03:35:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 22AB768BEAD for ; Thu, 16 Feb 2023 03:35:19 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676511325; x=1708047325; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=1JoWN+YMZatoxBLjbA+BOa3Y8+4nDxD8bQqzdOPG82o=; b=bWV34vQCUwLfATwi9Gj14LyCxUR7O+6TACjZvFCsB8XO4zZiS2SZdJ1+ d7n1sp3ZXCSfh/jL0zkceLV2YD3Db7LwI+hqqzr37/Yeb30RcYgkauuos sX9V9B4UXmgi+TTcauUgKef7xSpUbo1re4vuEPaxEP3AVugB35N3f5mw0 P/i4OtNcX3ZkRIEkMUGBT+aARhtlFbVTin2vqwJz2kxHHDODK8Rb342uj mSj9TrWkS49qBbfb8vNSHaNut9LXH9IS3oeYp/As78XQ+C6YROkEd6h0b 6eF+mYlA+GmWj+gqKPK8w9/vho58fSCsAmLLv1lpjryZl776Uhr3KuFOt w==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223801" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223801" 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:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168802" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168802" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2023 17:35:14 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Feb 2023 09:32:41 +0800 Message-Id: <20230216013248.23044-3-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 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: pu/HorBYjGrV 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 Thu Feb 16 01:32:42 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: 40401 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp115720pzk; Wed, 15 Feb 2023 17:35:54 -0800 (PST) X-Google-Smtp-Source: AK7set95sT94gkIYREKuJv5t+SVAJNlyLlnIRZfU95GREOT7iQIULZQUmI4GJZP30xtBnsahduxM X-Received: by 2002:a17:906:dd:b0:88b:a30:25f0 with SMTP id 29-20020a17090600dd00b0088b0a3025f0mr4871964eji.32.1676511354352; Wed, 15 Feb 2023 17:35:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511354; cv=none; d=google.com; s=arc-20160816; b=z5NcrdK9d0M2ZL0yPcKIyriWvcnbBZk3WKc7vCfAXSFk15h8tGES5k2GYV4kfMQMkJ Cu8Cp/AOcL87M3MyXtYDb6CkdsM/5Ik505xHl0gSxqZxDC+cGWATGrbgHV9hbhIk5loa mySN7im4/XZGGqvGOMnERK9hIvoLPZAAFJ62oPiBcygkq5lMNV04aunFXZ/CJoiTTUo3 VmIWeGqfOdSopo6wmR54AdJjqAqHc+ecqKvSWcEYP/xO7ZQGT8GfyZX5F6jwxEKA/4vj 98yjc8V0/TtpqbpxvYzFcRP7v0AfKgqavZTtTMYgtyJdMnS6lduJR0Gm/uNkFOnkx5zh sM4Q== 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=tq+9+ou8f6deUZrOeVUzHPozhkbo64GB0+q8ujQgQs+6m1h620qFGFcrRrEE1rZ5Wr yzXXdV3oB8U9kGy6ukFR4xUAykfJSRsa2gZtUdYtzEw9IWtn0DbicHxKtwNBkogNc9pN AZ8AzB2Ef8sZrqida1hI1+pSSSUHIAOvEZhy1AIu4xnC+ma8lawESpwyC8Kj5//Nlxaq 4VSmDkpEjvTLBLQede1vDf5MPAaVd1n5B8fjT60QtErYqiAGnIWODlZ1wSXv5jzAzGsv 1PghAX4ktCK+pBvq8/Suy/JpRds/n7PQBjyhJQyRzh/SHIT0rB+58fwQtlYeKaqg5NdY Va6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=Zruyz6rz; 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 gi20-20020a1709070c9400b008b128f5510dsi349630ejc.47.2023.02.15.17.35.54; Wed, 15 Feb 2023 17:35:54 -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=Zruyz6rz; 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 3B2E668BEB6; Thu, 16 Feb 2023 03:35:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D4E8868BEAE for ; Thu, 16 Feb 2023 03:35: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=1676511327; x=1708047327; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=L0fAowE8Rj3D3/ekpvujoRAjdJaOCWU8raZDLJN3GcM=; b=Zruyz6rzQ3JhVxJGPo4NrQRQ49xKlg9wFWaxeDQUcUQQD4yIqLlDOFyl NnVD3EghS9CGb6jZqdvfhk2HHN6GUXJPF1EIExSnVwuyX5ABIcZuHSPC2 8llBr2OmMmK7e1meMFiVuE+IRTrlPcLpMd99fNFZ5TIhiwI1lbBC375yj fbs7hUsIk3xjL/SnIGOROKif/HeHz+MVrcRIA/8scoXd93CJVLoRTrdjf Xev1rRfIs3VQdX23i9h6lPdIKqkkStGTpa07XbGXX/rrow3SchCOru0FO lxkoPdFO7zqIWV8DYNYqOlLzqNbEdmWhMxpT6FiD30XL5J1rNUHQ8cvlz w==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223802" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223802" 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:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168804" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168804" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2023 17:35:15 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Feb 2023 09:32:42 +0800 Message-Id: <20230216013248.23044-4-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 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: S73qj2OLrkTh 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 Thu Feb 16 01:32:43 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: 40402 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp115798pzk; Wed, 15 Feb 2023 17:36:03 -0800 (PST) X-Google-Smtp-Source: AK7set89TVQ+zQF1dtpXFWUQ2GBotGJmNTj53XWn9Xrb/f2gYbL46O3xI1HH4m4ZuIAA8IdP0518 X-Received: by 2002:a17:906:19d8:b0:878:7349:5ce6 with SMTP id h24-20020a17090619d800b0087873495ce6mr4148944ejd.71.1676511363167; Wed, 15 Feb 2023 17:36:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511363; cv=none; d=google.com; s=arc-20160816; b=URTFuSUW4badez5XCe+FUbD92vOoyBTuqFSR8/zdqFwU3G+6PIWehp9xK5Vco7r4fP /mlTjHUF83pRomjYnWVss7w7qsWI1LMIuNVXCPpN4m9ahm3gtSMtrPAJUYVlF6EXx7Ko wCR9Kli+yg2GBOAtmXk7RFATCkzSLiqCFTXh7C+CiQKUDh+0KvRG2NO+7Yut2RNssKz0 xCAf5gD7Rs3cPHJV9Q9KNBKX2IBdMqu5hXKEH19dE9SKpzPV0LsXhLXx6gq4Gi8xnDWc S93i0ua/Y79dPdLbUesoqTpli4PSdTDo2ohYsWPCOTZc3TKLeYpbTbKxKjHTGoJJ+sWp YoQg== 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=vosILvdzXFhJKKVx6ITXS6KB0gU8GN7ZIVdj2q8OXZm8RsNzpKCeIGTCl4FZj78oKh n9z845c5m7vrW+By38hp7Alqh8Xw2KuQZZExU3zNZVE/ksn7MI9zEF82PmnPSne82/oA +vNKcXjWCW0ZDnQdkUqMppWafsgUamdxk8R9D1uEYBXzmqBDp1Nvyl8IBKiDwpeFgRwK qVmj2r3TFg1BbCS9heamqt0pUznQHeWs4czc7E+ThrIPa3t7sGicxs5kLQbAuBjk3uUB 3/h2Q+I5O6fA2WxzEbt0qk0KgnPUM2GPi7nOj/RsXzuxTLvx8sTXRHj2y2lSLB2E/uhw 5YRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=UASJNILJ; 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 wg3-20020a1709078f0300b008875216c082si289263ejc.374.2023.02.15.17.36.02; Wed, 15 Feb 2023 17:36:03 -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=UASJNILJ; 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 1DEE268BED1; Thu, 16 Feb 2023 03:35:30 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 58F8E68BEA4 for ; Thu, 16 Feb 2023 03:35:23 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676511328; x=1708047328; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=RzgeT27PLmco4fUtOCQPH5gyzkPiewt4BvWtHoO78Fw=; b=UASJNILJ/CCdWOb6ghRcs4Cg7JhaDWZgrRLzjZatm5bGoRgcsYb/HkW0 AwrIESXJW97cOxb5T1fm1fCpVxtl7HzBr3A4W2SMadFNGaTvDO/nKKF14 5xWa4Djy98G2d2425yt+EL64Kra/wWSch6nGrza9n0QsxPCDYtkUsqXQa 8+CzdvwljJhPT5s+GzOSdfeyY6z7ttILsk7soFBFs1jOFNM5PaGrv2U4k 5wdr4Vb51wB3Fk7I7cmKQNvQ9ep/rrkaUGTOsgdl8ZV0AZ4M11uix/Vre 5zotzIi+PkNLlZqbPMf35Nd+mSY/kABqBVHUwOVhUgHo2GI3k+6L8ZvCV Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223804" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223804" 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:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168806" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168806" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2023 17:35:16 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Feb 2023 09:32:43 +0800 Message-Id: <20230216013248.23044-5-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 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: vdQRJ1ldS4Ty 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 Thu Feb 16 01:32:44 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: 40403 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp115866pzk; Wed, 15 Feb 2023 17:36:12 -0800 (PST) X-Google-Smtp-Source: AK7set+HuBFCKfusSIzixpwxo6KqOGbedc59dwgXQ49M3MNNEBPpY2qKPVTm6MxdML0M24Vjo4t+ X-Received: by 2002:a17:906:4a91:b0:8ae:27d1:511a with SMTP id x17-20020a1709064a9100b008ae27d1511amr4354555eju.61.1676511372036; Wed, 15 Feb 2023 17:36:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511372; cv=none; d=google.com; s=arc-20160816; b=mNOnRlgiA2cC1hTiD660PtHzHqYer1bbe4XEFTsq6C16KcUYJUrYRncbGbfHPdtOHH FnOY5vLt8RJeLj2Lv/yL48jPn5mysZQnu6anFqoyeUMIsZ0fCOviKFtWaAKo+y5qQ1/p ndBhBQvBsVCqiFtmgOG8ZBBc+QOTwaYYTLSUzQm3ugK/wdQCwbdQfePxzQFnrUb0u0VR nsqUN7Z5SpHtbuKlYxyycAH4if9ezTLDGOP7aCyvFScuzjmFg5Qu1M7RrYiLxU/0Lt5H hoFN2h/pysHjsU+H4knqfMCWoQvi/wah1SJJJ4Lti6Ih+vfkcr+ZIrL/qWsi8dYemk/c Iasw== 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=KLRGK/GSHc1AbM9cyUy/QTwmrpGfRgmAgLD4AYQ/Hva3bvvdVxRC+5FGdYO/cL1f+p H4NmR0RFmEPdIZ/PUY4BRvt+3tNU9Jd0oBUBhUJZOPap0horfYPsE13C8t80oz10G7Vo aWSym9TotK4afl38e4twNA5+sZzVSCmCp/ACTFES5YXDhqVQxTHx9NJsmEyxFA8uZi/e KKTyRfNsojl8dg48YsjNpyLsJLnWGWueDaW0RLq1/u4332XNGQJWEMuId7ZRet2AYMOm zINrQIllYKvBi1PbrtYF3eYYcKvY+7Rn5dFmhsE4W+sxmzdua5/v6ZcfLdcNtXE41dPX 2V+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=UciHhpMn; 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 11-20020a170906004b00b008b1264cd2e4si359010ejg.676.2023.02.15.17.36.11; Wed, 15 Feb 2023 17:36:12 -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=UciHhpMn; 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 1937468BEDB; Thu, 16 Feb 2023 03:35:33 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Ed1qE4WDZkrS 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 Thu Feb 16 01:32:45 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: 40404 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp115938pzk; Wed, 15 Feb 2023 17:36:21 -0800 (PST) X-Google-Smtp-Source: AK7set9OBEtywAzC3GV0BY2TW7lYlw1xONrLzJE8Rw8kDfNtG6t2TSfuejQEtJVPZI7Rn82Et0Y1 X-Received: by 2002:a17:906:1313:b0:8aa:bf4e:7b2c with SMTP id w19-20020a170906131300b008aabf4e7b2cmr4560838ejb.21.1676511381157; Wed, 15 Feb 2023 17:36:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511381; cv=none; d=google.com; s=arc-20160816; b=XX0EDsSsSGS6ktS9i/v5nWqm+q8KvQsdTL5H4CUWfVid1xpIEO7vPWx8/kSCJaE6tU 5Xz9GKv+3SRwwVjvAYvaFnMm3aEHEKUzqfbb580bjlBHUFjoSX2HfPxD7SnxFcPvRA1B 0PAr/p8HRosua/hAhHKC5ftkRGsxqcq4Nh37itCkvfE06IMmbyPCYqtShmCmiwWJ2yfC 2hr99BtM/ssWNr/zEcKKaCV0zfxFIy5SAhGrZThcO3f68hvsBkF688dRNGpkbETdAo7a iRvtecGuZYDYsdm50G5ZmCMyRE4PaJ98+5QGyTCaXBOFPAhDCxfgDuA/y0hDTjvz8rFY PipA== 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=QkQb6OQEEsOluQPvybL4sm5SdGcDKdgrVW+1+dNw/3NNvHdQnzaUZ+kChMlPTCy0Lf gOMxKFjC2fgA7urQlTD5erkMNqvbEYwr86lx7Fn/KA1YYWoWPs+sYLglIH1ymbb3WqTb EnZi1ZSi209cibmzcukYdBGfgKepsbZf9AovUvoe5tg2hy1Nn0ePAwrUsG3f8RbNvJZS Xus+/vzOYS8m4T0AWTe2Ci9mJ7yFpLqNUiUcEKF4jADl4wCgLLQugAdfYnKidZVmocVO zJUGjSg3Od6ZGBK5BoeaNDpZbwTCnl/f+4gdA6HDavRLAyvZ8S6emQPYi6v8j3ifSTa0 OJMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=hXsl0pjO; 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 ew24-20020a170907951800b008b1316345efsi329491ejc.183.2023.02.15.17.36.20; Wed, 15 Feb 2023 17:36:21 -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=hXsl0pjO; 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 237CA68BEF1; Thu, 16 Feb 2023 03:35:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C2F4468BEB9 for ; Thu, 16 Feb 2023 03:35:27 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676511333; x=1708047333; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=9BYbyAle4yEXFLV986pORDT7UlIMNReCADyV/gEJBRI=; b=hXsl0pjO5Cd/p/xtPitUquLVwk1uTso/Dmg7SfDCHG1PyjU8H2Lhb/dQ y3aKKw8paDx49uaVr3sqmPDp7cRJsA0JKRvPpqB5GxINpO9/RS33lDjEx OZ2AVQEg4KrFLQLBwKZVfFarSgj2IcYK0ciN2nKsm6O6SlrdKPu9smyPu c6KsCwDNu3ifOri4FSuXllEqUDBhkx71NZvJmJetQgZhM/2YK7xv/wK8+ C/7FAGYPZxkUtMxe51WOXM8BX+80meIKwuqo8tjteJoNcdV6d+vLDZPfJ YLbBFQ6ixpWBQOXc7ef01QR7WBmyTKj5Ek8QmRqtK3PcDXa1aVjp0dqh5 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223807" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223807" 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:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168809" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168809" 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:45 +0800 Message-Id: <20230216013248.23044-7-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 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: FPQAlkgWGFd0 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 Thu Feb 16 01:32:46 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: 40407 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp116192pzk; Wed, 15 Feb 2023 17:36:49 -0800 (PST) X-Google-Smtp-Source: AK7set9sqlfJsMRrca39Sz/3qLKKRTIdKRl99r9cC3iIFNTrMpBJ32m4/xqzNzfcDxmaulsSYYc4 X-Received: by 2002:a17:907:72cf:b0:88d:72c0:611 with SMTP id du15-20020a17090772cf00b0088d72c00611mr6051216ejc.3.1676511408759; Wed, 15 Feb 2023 17:36:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511408; cv=none; d=google.com; s=arc-20160816; b=h8OKKANsMu1RiAQ+DiAU1dkQ5Kb81HdvbkWzQnN1qCak1Y+Tat95M4GApUu3G5xUrL d7HIpTBo+x1ilIjZ3Ju/0htwifCOoY8y7Ay4nMjtmxUawTb15m7iGLIvHGOKCgQHbHjm geCgTia+7cUIppeaujogauVplGCDgBNXZ6mji/rYu1MV2795Ab04CtarxW0ofK+S7XfF ZAIt/HccBXmwi76P53VVD0B8Ot3VinTQp4DHWQRMSocByeEy3V+0GIH5drwFUz4ap06f IBL8URwXRMCn6UZnxLzbVF0DBX/OBQIi/e+PIXTnPi6k2QK9q7a+3+zOwOrSJoUdW3uV pCPw== 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=w0YrreLcW0X/h2qtzmz6NQ+svUA06j6U8srjbSZbKOCmRabCptUiNFuymlIKVK8+l7 axwcqUcFUmLc/wH8O0OPAs7hr/jwn0qP2ft6E7aCMAHcUdp0wKT2ZzQvursn6Vz+L6x8 Or7nkfgYhERabY9dIjJQCdxvD231R1To/epoVngbsQE8zFRuLw8zjjRbjS9wB/bmaE4+ DfKfdLOoQN06mooDdoGcyiQQ1wCcVOjo8T7dTbsuYkeOyS+TuQsXzbdHSgjPm+K6eArR vjad9crvA6hPLBlpjL//y9AVlyB6PQriVoKi3pTg1btxoF/BIi2SIz6x87YC9PI2aM2t vZYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=fHnurAJH; 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 fu35-20020a170907b02300b008b12dcfd307si260131ejc.762.2023.02.15.17.36.48; Wed, 15 Feb 2023 17:36:48 -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=fHnurAJH; 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 9F3AA68BEFB; Thu, 16 Feb 2023 03:35:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4B48768BEC3 for ; Thu, 16 Feb 2023 03:35:29 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676511334; x=1708047334; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=pXuG7eU4H624rWvc2n1fx8dkJ3wQyvtUr03EAJbcv3A=; b=fHnurAJHEsVYY2m/UnNHCdJT0crHTSwGdKUUCEYiHPmbydyHPfHvriIx 2BklxdGVK7tLqIFuASXAH+eyrWI1mzmAFApNF6to6s8S6qjoXjwOC4NKj d5jJwTUDzCHIzbi9TC8PWi1A1bqSa0y3navjJZSRxfZWgeGoCdiLFUtNb cNnHSsUexDG0Hs4wOByQxJN5CSmfla2OnAAqG32eXq1jgXrBzxHTjgE5v wtUUssB8RmPq9cOaxXU4v/PaJyOHYr4jKVsm67WldhWoBPL9KL8R1Nnx0 JwFn+SzKTgUNumQqM4VttxFm9weVFoVMB7ABIOl1QeqH/Aav1FrYB9uc4 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223809" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223809" 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:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168810" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168810" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2023 17:35:18 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Feb 2023 09:32:46 +0800 Message-Id: <20230216013248.23044-8-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 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: zCPpYZjeUtsA 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 Thu Feb 16 01:32:47 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: 40406 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp116103pzk; Wed, 15 Feb 2023 17:36:39 -0800 (PST) X-Google-Smtp-Source: AK7set+GXaDaj4TocGR61WgU83y+HL2vxm95UJO90cH5sYGmEh3g5dXMAhgykQMZvCvdLOVBey0V X-Received: by 2002:a17:906:4acb:b0:889:5ca0:146e with SMTP id u11-20020a1709064acb00b008895ca0146emr4465635ejt.16.1676511399261; Wed, 15 Feb 2023 17:36:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511399; cv=none; d=google.com; s=arc-20160816; b=Y5mLukpH8vqusNKe40ido/WMlcl6Uxxi9oK6qHuZ8Y9euCqLc4umPk43oeTMzjXsSx 1ZrhPYhCGFrSNljtrMgm6bgGnUOmz/eIGYUSuTrnjuy2f7FDM05benJlp0F3Bt3y7AN1 0LSoKY2xxV/oyn/9QHyz9aZaTMT3EFdumOSLh3g0PDP18+PmRl8j1lZvUB2rtr/bkm7I 1Y5mYOFr+7M2Rf6hSqkwNuCu1i8NO+fMuNHTf85xDj2CH6oa3LrNo6ST+Qfi9svgsKAx 3n/KGZu8gn+VPB+0OdTRPlNBImLORs87WANsTQn32iRPlf6ZIy4qDe7/WnN6hn0HvlcX WtIA== 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=MQB6ljRNddRhsjFgkfP1QtfuXiE7WojDCuhzwc7iRE/zoppZpfDqHTidp3Gy+hVys+ APwDPUCwTCs8JtTneyxB1iclx+r15ptDNmSVr1CwGqKIsNCeCYOJbtmS+3gdXD65eE5N MDFkWvF0Cs+9Y5TFKmm8A1rljdVIZJYmb70eRP7fun9bL8HZ45+8zF+jh1xoYly/55cO biNwZo5J6Jt4ppj+ihzCIodsr2ll4Ffg446n4px5PA0G09Whusuz00h+n0TviRo9aAci 5zqhwVZlzPKTF1OBm3JjkOD8GCtctTc9TbPsjK8qRVo76nzhoZBNPR1CdVBG9zGiimxD YzFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=avlBXA0k; 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 b10-20020aa7c90a000000b004acc6c2a27csi512737edt.53.2023.02.15.17.36.38; Wed, 15 Feb 2023 17:36:39 -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=avlBXA0k; 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 B5C9268BEF4; Thu, 16 Feb 2023 03:35:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A986268BEB9 for ; Thu, 16 Feb 2023 03:35:32 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676511334; x=1708047334; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=dCehz39XW/LltSLxS3as6ORj4GttedgPDB3WbxMjABk=; b=avlBXA0k68T0BUxNsYz748C3im+kYQmKWZephxJcXCNPCSHY01oAOJVw +XtJsLtYD1Zy60VoKMZsUYLxRl9zDcS6+AkxEJ08y8s4dRy6Yb88UlHR8 XunvulI7evA2svIduOzgHKy/3tBVBFcIOeO3gYeXNBnEIuJ7+Yk0NJ7Kq zkoRESnubIoKsyRHCOYX+jhTxWQT1LqVJ1k4hodylyRPhO27SjHt+DHQ0 07+y25MRGoEES7Ka14cUMdrSnAiNlJ1wq1BZk9eENOTspOP6jxJL27QDn KU+UULDkK9FklV2vDnbvx9DM6Nm1wdw6JiAhenudCYnzqWLuwiuwSNOM8 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223810" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223810" 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:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168812" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168812" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2023 17:35:19 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Feb 2023 09:32:47 +0800 Message-Id: <20230216013248.23044-9-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 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: 0bY2Vxgbe+4H 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 Thu Feb 16 01:32:48 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: 40405 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:5494:b0:bf:7b3a:fd32 with SMTP id i20csp116017pzk; Wed, 15 Feb 2023 17:36:30 -0800 (PST) X-Google-Smtp-Source: AK7set88QwBfpNe0DOjpSZPBbZlvllVycDdfMzu86OMalPLvKW0GmaCUuhzVdH4VqFq/+0atGfM6 X-Received: by 2002:aa7:c2c9:0:b0:4ac:bf55:7d61 with SMTP id m9-20020aa7c2c9000000b004acbf557d61mr3736976edp.9.1676511390362; Wed, 15 Feb 2023 17:36:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511390; cv=none; d=google.com; s=arc-20160816; b=JQulYiRcNkkDBmGnGUBooVcjqcQ/AkFzfir8YvjeGjAqbhD/dFu9Wm0tGF2Y4cApCN s73xzCQciRJvOsvLgcTVhlivF3I8b1FBiTw3yDzGuoh3uC/2nULhLegW6U83qtiq9AAL mTSF9d6OjYzbsBvaYGsASwEZvbiJtXH2j4pnsCq4OiX0H4YTB50LlogqB227+UXcFh+S o1rOPWb25LfIj8IQqLbb+56BoRws4RjDPoSHmPrzK5PoyLKy68P/3u6x886NwcuYWN5Z 1ErYiuJ9HMyWLT3lpEgK4/Yih/x0NL9NnPZFBd6Zs4PO/OZJq662PiXceMsztI6aSAkE x8xw== 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=C5VxltZkO5SeFng8VIWMS4QLTKyYAPl56Q7CKMbQTLWGks/GY7B5++W62CVIsHiSvQ 1g/LWxuKY7ZKsCLGcBCxYPLt6hW1YDWlys4kw0/y51LDmHY2cx1243HUJsK4KOMVDoqP C7C9uNcKjOFszdwfO7KA3Tml6tpKentMLoHGaht+7QF1T7S2C5BClqOyb7VzgfOdwdkY NT2jc0GJ+HPorGlZbhNGiLybp6YhHQtvzY33tHO0EcjUHhnSNOWDlrUMeOvsqTuYxY/1 nEnsuSBZv+HzSzy51cMnf2UndIyBB0o+60W3arU5MsulW/sIG2gdkeJznyohXn9e2ywN DORw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=DSDjzsve; 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 m13-20020a50ef0d000000b004acede4d6cesi525707eds.175.2023.02.15.17.36.30; Wed, 15 Feb 2023 17:36:30 -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=DSDjzsve; 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 E229368BECA; Thu, 16 Feb 2023 03:35:36 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B710F68BEE7 for ; Thu, 16 Feb 2023 03:35:33 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676511333; x=1708047333; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=+Hp2FerR/3cmkCrSr+EIqBF0Q7jK+14hzILZnF+fmJk=; b=DSDjzsvecGOoslDHA0YzFvw9/PsvTIVnkg8nZb0Kh7JauIaCICK7GO7i jVoS8yHkD7l5G4obNZmo/ZQqjZY/sA3VSCS67FUOrCBj/1FNvaPZjS/o8 90SBH8n/uxlxEg1GC0bQKQpUszbI3FnpRHDziFr7keDjxQEkyQUM/BCIB w+Iy7BtavcE41RqEWFD+W6Ff0H4xvdw9Z5jb7nz81fPmdMAFs2+/222go Fy340gsWgB05a3DNzcBv2pc4JZMjjjqD97N+J8csmJXXjExwV59rJhdgg GkupVrQeBqBs4DOnFGZPVUKB8d8bScXKIvgy8OOAmxbYFil+zTj8mZ8Lc Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="311223812" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="311223812" 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:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="779168814" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="779168814" Received: from t.sh.intel.com ([10.239.159.159]) by fmsmga002.fm.intel.com with ESMTP; 15 Feb 2023 17:35:20 -0800 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Thu, 16 Feb 2023 09:32:48 +0800 Message-Id: <20230216013248.23044-10-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 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: hqxb60PvrmGM 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++; }