From patchwork Fri Aug 27 11:54:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fei Wang X-Patchwork-Id: 29808 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2a4a:0:0:0:0 with SMTP id k10csp1380007iov; Fri, 27 Aug 2021 04:54:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTJgtOtuTt4e9DAbWd2UrPjgp+rsjl3erNfyNN7NpWk5eNMoX/cwS5rdJQU9HyqXt7Tqn+ X-Received: by 2002:a17:906:58c7:: with SMTP id e7mr9418040ejs.197.1630065276535; Fri, 27 Aug 2021 04:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630065276; cv=none; d=google.com; s=arc-20160816; b=IGA1xwSidyvaLzh4YUs9Pp1XyjwgrS55fzXSuCl7etB6aZxMgQBiA7jjbisiOekeTc Sd23ZGaUEyFA/gmXDWLDxRZsWWmu9vCqY2PjkpaYdcXH3Er3cxKNVzzsOXr5+kF71IW4 MI86z5v+a/o9tsTN1mhqmLrVKr3LNOBUiA8fjI1ZeYMqqjYISHc+Q0wzar5osi+MiO86 zgbu0fUYQFomiwXynz/Z7tdp1ZsMGhlIF04XwYqhR0b3qk9jgxjDmSA5I/POAUqfgodF gjWXyxuSYygk0ofqrcQlszQO+56FyFNYKaLiRtoLrAIgnDavlVZQqhL3Dhf61SPHz3wD a3Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to; bh=daT9EewjRzdR2vnceLN+zmgb7T/KVRCYJikbS9wZB1s=; b=dmwm4Lsk9N8tK4Fz1+ZSoTnvAVdkydikM41UfT6Wxeeo9CcWr5yJkvPOrgPZH/BoGB C/3wBF4pF0DOeoHvHpbf50UWXH8N3OmwXwgqdczrXUvdyOimr39cUvzdFETS2I0lOZz8 XMJ9dWiQh2dX6tZ1n5aHxt3K1NVcnzwO1NSWNOXJeG9QoVnA48EYstY7+x9mnFA+t0ka zBf6/64M/tmLJS8epa3i2hLJgpYINX7pTxVHIxT851/dd0GOj9OyrMqgOpT92M5Wow+7 6S9JgIQJfdH+wraHw/4P14pgTuXKEsvvcyPYG61Aw+fLemtUeoIYynO8t/Im35dmgANF xnoQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id k3si5902014edr.159.2021.08.27.04.54.35; Fri, 27 Aug 2021 04:54:36 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7861168A3E8; Fri, 27 Aug 2021 14:54:31 +0300 (EEST) 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 42ED1680C03 for ; Fri, 27 Aug 2021 14:54:24 +0300 (EEST) X-IronPort-AV: E=McAfee;i="6200,9189,10088"; a="217949904" X-IronPort-AV: E=Sophos;i="5.84,356,1620716400"; d="scan'208";a="217949904" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Aug 2021 04:54:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,356,1620716400"; d="scan'208";a="465438642" Received: from f.sh.intel.com ([10.239.159.147]) by orsmga007.jf.intel.com with ESMTP; 27 Aug 2021 04:54:20 -0700 From: Fei Wang To: ffmpeg-devel@ffmpeg.org Date: Fri, 27 Aug 2021 19:54:12 +0800 Message-Id: <20210827115412.9663-1-fei.w.wang@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH v1] avcodec/av1dec: check if hwaccel is specificed X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Fei Wang MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: o4f2Q16Nn5ac Since av1 decoder is only available for hw acceleration. This will gives out more accurate information if this decoder used but doesn't specificed a hwaccel. For example: ffmpeg -c:v av1 -i INPUT OUTPUT Signed-off-by: Fei Wang --- 1. This is improvement of patch for: https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=4660 libavcodec/av1dec.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index a69808f7b6..58a9deeb4e 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -452,15 +452,22 @@ static int get_pixel_format(AVCodecContext *avctx) *fmtp++ = s->pix_fmt; *fmtp = AV_PIX_FMT_NONE; - ret = ff_thread_get_format(avctx, pix_fmts); - if (ret < 0) - return ret; - /** - * check if the HW accel is inited correctly. If not, return un-implemented. + * check if the HW accel is specificed. If not, return un-implemented. * Since now the av1 decoder doesn't support native decode, if it will be * implemented in the future, need remove this check. */ + if (!avctx->hw_device_ctx) { + av_log(avctx, AV_LOG_ERROR, "The AV1 decoder requires a hw acceleration" + " to be specified.\n"); + return AVERROR(ENOSYS); + } + + ret = ff_thread_get_format(avctx, pix_fmts); + if (ret < 0) + return ret; + + /** check if the HW accel is inited correctly by the specificed setting */ if (!avctx->hwaccel) { av_log(avctx, AV_LOG_ERROR, "Your platform doesn't suppport" " hardware accelerated AV1 decoding.\n");