From patchwork Sun Apr 28 17:52:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 12933 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id B95A344931E for ; Sun, 28 Apr 2019 12:53:26 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A514868A55B; Sun, 28 Apr 2019 12:53:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 656F46805D3 for ; Sun, 28 Apr 2019 12:53:25 +0300 (EEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Apr 2019 02:53:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,405,1549958400"; d="scan'208";a="341481524" Received: from media_lj_kbl.sh.intel.com ([10.239.13.118]) by fmsmga005.fm.intel.com with ESMTP; 28 Apr 2019 02:53:22 -0700 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Apr 2019 01:52:46 +0800 Message-Id: <20190428175246.27126-1-linjie.fu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH 3/3, v5] lavc/vaapi_decode: add profile_parser to find the exact va_profile X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Linjie Fu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Add function pointer field in vaapi_profile_map[], set profile_parser for HEVC_REXT to find the exact va_profile. Signed-off-by: Linjie Fu --- SPS range extension fields should be passed to decoder, will use VAPictureParameterBufferHEVCExtension consist of base and rext. libavcodec/vaapi_decode.c | 71 ++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 69512e1d45..7c9cfbc0ed 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -24,7 +24,7 @@ #include "decode.h" #include "internal.h" #include "vaapi_decode.h" - +#include "vaapi_hevc.h" int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, VAAPIDecodePicture *pic, @@ -364,39 +364,44 @@ static const struct { enum AVCodecID codec_id; int codec_profile; VAProfile va_profile; + VAProfile (*profile_parser)(AVCodecContext *avctx); } vaapi_profile_map[] = { -#define MAP(c, p, v) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, VAProfile ## v } - MAP(MPEG2VIDEO, MPEG2_SIMPLE, MPEG2Simple ), - MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2Main ), - MAP(H263, UNKNOWN, H263Baseline), - MAP(MPEG4, MPEG4_SIMPLE, MPEG4Simple ), +#define MAP(c, p, v, f) { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, VAProfile ## v, f} + MAP(MPEG2VIDEO, MPEG2_SIMPLE, MPEG2Simple , NULL ), + MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2Main , NULL ), + MAP(H263, UNKNOWN, H263Baseline, NULL ), + MAP(MPEG4, MPEG4_SIMPLE, MPEG4Simple , NULL ), MAP(MPEG4, MPEG4_ADVANCED_SIMPLE, - MPEG4AdvancedSimple), - MAP(MPEG4, MPEG4_MAIN, MPEG4Main ), + MPEG4AdvancedSimple, NULL ), + MAP(MPEG4, MPEG4_MAIN, MPEG4Main , NULL ), MAP(H264, H264_CONSTRAINED_BASELINE, - H264ConstrainedBaseline), - MAP(H264, H264_MAIN, H264Main ), - MAP(H264, H264_HIGH, H264High ), + H264ConstrainedBaseline, NULL ), + MAP(H264, H264_MAIN, H264Main , NULL ), + MAP(H264, H264_HIGH, H264High , NULL ), #if VA_CHECK_VERSION(0, 37, 0) - MAP(HEVC, HEVC_MAIN, HEVCMain ), - MAP(HEVC, HEVC_MAIN_10, HEVCMain10 ), + MAP(HEVC, HEVC_MAIN, HEVCMain , NULL ), + MAP(HEVC, HEVC_MAIN_10, HEVCMain10 , NULL ), +#endif +#if VA_CHECK_VERSION(1, 2, 0) + MAP(HEVC, HEVC_REXT, None, + ff_vaapi_parse_rext_profile), #endif MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT, - JPEGBaseline), - MAP(WMV3, VC1_SIMPLE, VC1Simple ), - MAP(WMV3, VC1_MAIN, VC1Main ), - MAP(WMV3, VC1_COMPLEX, VC1Advanced ), - MAP(WMV3, VC1_ADVANCED, VC1Advanced ), - MAP(VC1, VC1_SIMPLE, VC1Simple ), - MAP(VC1, VC1_MAIN, VC1Main ), - MAP(VC1, VC1_COMPLEX, VC1Advanced ), - MAP(VC1, VC1_ADVANCED, VC1Advanced ), - MAP(VP8, UNKNOWN, VP8Version0_3 ), + JPEGBaseline, NULL ), + MAP(WMV3, VC1_SIMPLE, VC1Simple , NULL ), + MAP(WMV3, VC1_MAIN, VC1Main , NULL ), + MAP(WMV3, VC1_COMPLEX, VC1Advanced , NULL ), + MAP(WMV3, VC1_ADVANCED, VC1Advanced , NULL ), + MAP(VC1, VC1_SIMPLE, VC1Simple , NULL ), + MAP(VC1, VC1_MAIN, VC1Main , NULL ), + MAP(VC1, VC1_COMPLEX, VC1Advanced , NULL ), + MAP(VC1, VC1_ADVANCED, VC1Advanced , NULL ), + MAP(VP8, UNKNOWN, VP8Version0_3 , NULL ), #if VA_CHECK_VERSION(0, 38, 0) - MAP(VP9, VP9_0, VP9Profile0 ), + MAP(VP9, VP9_0, VP9Profile0 , NULL ), #endif #if VA_CHECK_VERSION(0, 39, 0) - MAP(VP9, VP9_2, VP9Profile2 ), + MAP(VP9, VP9_2, VP9Profile2 , NULL ), #endif #undef MAP }; @@ -415,8 +420,8 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, VAStatus vas; int err, i, j; const AVCodecDescriptor *codec_desc; - VAProfile *profile_list = NULL, matched_va_profile; - int profile_count, exact_match, matched_ff_profile; + VAProfile *profile_list = NULL, matched_va_profile, tmp_va_profile; + int profile_count, exact_match, matched_ff_profile, tmp_codec_profile; AVHWDeviceContext *device = (AVHWDeviceContext*)device_ref->data; AVVAAPIDeviceContext *hwctx = device->hwctx; @@ -454,15 +459,21 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, if (avctx->profile == vaapi_profile_map[i].codec_profile || vaapi_profile_map[i].codec_profile == FF_PROFILE_UNKNOWN) profile_match = 1; + + tmp_va_profile = vaapi_profile_map[i].profile_parser ? + vaapi_profile_map[i].profile_parser(avctx) : + vaapi_profile_map[i].va_profile; + tmp_codec_profile = vaapi_profile_map[i].codec_profile; + for (j = 0; j < profile_count; j++) { - if (vaapi_profile_map[i].va_profile == profile_list[j]) { + if (tmp_va_profile == profile_list[j]) { exact_match = profile_match; break; } } if (j < profile_count) { - matched_va_profile = vaapi_profile_map[i].va_profile; - matched_ff_profile = vaapi_profile_map[i].codec_profile; + matched_va_profile = tmp_va_profile; + matched_ff_profile = tmp_codec_profile; if (exact_match) break; }