From patchwork Thu Mar 28 04:03:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 12506 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 095BC447593 for ; Thu, 28 Mar 2019 06:03:41 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D932768A768; Thu, 28 Mar 2019 06:03:40 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DC65468A723 for ; Thu, 28 Mar 2019 06:03:33 +0200 (EET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2019 21:03:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,278,1549958400"; d="scan'208";a="126517190" Received: from media_lj_kbl.sh.intel.com ([10.239.13.101]) by orsmga007.jf.intel.com with ESMTP; 27 Mar 2019 21:03:30 -0700 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Mar 2019 12:03:53 +0800 Message-Id: <20190328040353.8844-1-linjie.fu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] lavc/vaapi_decode: add va_profile format map support for HEVC_REXT 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" HEVC_REXT will be map to {VAProfileHEVCMain422_10, VAProfileHEVCMain444, VAProfileHEVCMain444_10} in vaapi_profile_map[], since need to be distinguished to select the exact va_profile. Add va_profile -> AV_PIX_FMT map for FF_PROFILE_HEVC_REXT to match the exact va_profile. Signed-off-by: Linjie Fu --- libavcodec/vaapi_decode.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 015154b879..1cb8683b7c 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -414,6 +414,18 @@ static const struct { #undef MAP }; +static const struct { + VAProfile va_profile; + enum AVPixelFormat pix_fmt; +} rext_format_map[] = { +#define MAP(vp, av) { VAProfileHEVCMain ## vp, AV_PIX_FMT_ ## av } + MAP(422_10, YUYV422), + MAP(422_10, YUV422P10LE), + MAP(444, YUV444P), + MAP(444_10, YUV444P10LE), +#undef MAP +}; + /* * Set *va_config and the frames_ref fields from the current codec parameters * in avctx. @@ -426,7 +438,7 @@ static int vaapi_decode_make_config(AVCodecContext *avctx, AVVAAPIHWConfig *hwconfig = NULL; AVHWFramesConstraints *constraints = NULL; VAStatus vas; - int err, i, j; + int err, i, j, k; const AVCodecDescriptor *codec_desc; VAProfile *profile_list = NULL, matched_va_profile; int profile_count, exact_match, matched_ff_profile; @@ -467,13 +479,22 @@ 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; - for (j = 0; j < profile_count; j++) { - if (vaapi_profile_map[i].va_profile == profile_list[j]) { + if (avctx->profile == FF_PROFILE_HEVC_REXT) { + /* find the exact va_profile for HEVC_REXT */ + for (j = 0; j < FF_ARRAY_ELEMS(rext_format_map); j++) { + if (avctx->pix_fmt == rext_format_map[j].pix_fmt) + break; + } + if (vaapi_profile_map[i].va_profile != rext_format_map[j].va_profile) + continue; + } + for (k = 0; k < profile_count; k++) { + if (vaapi_profile_map[i].va_profile == profile_list[k]) { exact_match = profile_match; break; } } - if (j < profile_count) { + if (k < profile_count) { matched_va_profile = vaapi_profile_map[i].va_profile; matched_ff_profile = vaapi_profile_map[i].codec_profile; if (exact_match)