From patchwork Mon Dec 19 11:35:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 39730 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp3976301pzb; Mon, 19 Dec 2022 03:36:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXuKVyLt9ozPfGvTyd7rTcuYt2tthgh6VzN9s5gqCVJIzGnFzOQRkD8PMzdaWpNdhi+Cq6gg X-Received: by 2002:a17:907:110c:b0:7c1:b64:e290 with SMTP id qu12-20020a170907110c00b007c10b64e290mr12185591ejb.45.1671449763790; Mon, 19 Dec 2022 03:36:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671449763; cv=none; d=google.com; s=arc-20160816; b=PJtGBFLAjnS5EHMjKLzz9hu2Q0YSylYSnDiDPotejKt91XH0HwDDLonEsN4P/Yc6xR JAy8GInGYyWnsRPAUJ7gS3HEAwBDVpFeERFGcXMqxev6fr5PsiX77wAbxvWIzELeGX6M f+K1kcHNy8H/UZdfiItYRIgh/3kHnHb8mCBusAmy+eEOHF7FfXZ5QOcrrSAWuRAaGK0A wdgyk7YiQeazZBualp/VAoE1jDX/TbCvROzsI69GSqhUk9aBdS/4gfQwhnppDC5TndFC TnoWrsDbbl0CumVZKu4sn70fws6xmTx8VvXv1aKwj22V/Jrq6Yu+BLX8z7STKMTq1Vjt RA4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:date:to:from:message-id :dkim-signature:delivered-to; bh=g+RcKM4NGFq/1LO8xbbFCHTkrTYXGQdBxYKOduEnIcA=; b=ntW9ujB3p62jFQfxG4xvRUsCPhHD9elzSNS7zU6mOmuMogsbkaHvfvOnnNILLq1TRu s2VqMdTALHUCRZoERdT1WDlGcAaOA4nQdeq/un85lP+hfHXE7hy+8YE1G9NfG3wJjrBX mGdWCiazaVh8c1VmyjVsKTlkrCAt5/ffIKNhP8rUmTYhBcSVKz5RT5us1nqM80m9WHVr nReYEmWtfF8ehM2AUwmPN93ILxR6x3PHltXrIhUcrYVA7nTPaXbLfSDgsVWUHSuYY3g/ Uw2WHZpSD9X3Zmiaf3lEKdLCdB5/VEC7wDCMIZqJJuGlw4BTIO3+jlQFpLnxHqx7JFRi p5zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b="E/dE1Xkc"; 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=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id lf17-20020a170907175100b007ae1e635ea3si7733722ejc.754.2022.12.19.03.36.03; Mon, 19 Dec 2022 03: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=@foxmail.com header.s=s201512 header.b="E/dE1Xkc"; 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=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C349468AEB3; Mon, 19 Dec 2022 13:35:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-57-252.mail.qq.com (out162-62-57-252.mail.qq.com [162.62.57.252]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA9B4680396 for ; Mon, 19 Dec 2022 13:35:50 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1671449746; bh=XCYZT+OL2oNKoZ15cmtZM2fXwMY4f57AZzpM3a+cA+E=; h=From:To:Cc:Subject:Date; b=E/dE1XkcK3kOEkBoGcWE6egdio5Y6j0HtnAevqsoQIhgeLGQ7HTLfjCGmS8xnSPl9 SLBFwzBPkqc87gQDUNgsoz9/qInQm/NQUjTrgaV8in/ikeJamMI3uOFn7XQ2DFOcW8 xF/3EQDp9DKAuW9CuD3CB1T6ovcRwbx1ClxIiH1w= Received: from localhost.localdomain ([113.118.115.165]) by newxmesmtplogicsvrszb1-0.qq.com (NewEsmtp) with SMTP id 8ED9E860; Mon, 19 Dec 2022 19:35:45 +0800 X-QQ-mid: xmsmtpt1671449745tx18q7w69 Message-ID: X-QQ-XMAILINFO: MNQ2FIpgVwZbX1J/V4rcuJM8qb/6RbiBPzk/ptMKS3NtyUCp9cvxOE/OZv5nPp 1r6bbQCXX82n4cCZOa8Q5h+G7uz5bdnqGzplWrTSfs3TnWG+L6/0Cok4bBqoAKYGLWh3oacXCZX8 PbgA9+HuRJ16JfNUvgxlGj7kRhQBCpvr0NaDaczTe2kO8k1K0d9mIxpKZp5FLWQFXsYHbVmynQQ+ LPhVcanAVRrJtxrGV8W4k7mosvq7xMMgIgfM2+AG5BWYayXHOw5LS8Lqif/AYKKm9a1zNZ1f7f99 ls3Mk7DircBQamJKp9QVXcEBpzdXI+pYwbo3oNPZEdKeO+gqGIQXsjMWo51rqxW6nQ53fBbQNQp4 SVj9MvIZ3st0wRPPdOeCFZXmrhU2YEe59uHkaXVTF/FjUfBvobqgGTmGfG1ut7AUzC8DF3ygaxDk 50fyFSO3CyCT/an3Cxgq8SXbKl16+TUZd0z3tNeLiDd0yRJQScBFI4hB39O0FDkDnrodjr0RFnKl FBguHqjVESOaQEnA864jc61tuaB6VN2o29WxoNa643SI8mTYqYCdPIGqhlXFVhyVrIU+jBV0xd64 1YGm8z8pzH/OCG8sn0W1nExOYMCB+SHEF8T+8rtrO5GYkfHa9PjWS7iicNmhpcZImYHPx+iD0fOp rh8DLOsiUo3qNsfbvaXJuKO1Ev/FsZD5GUMEV6ir4VQyn8WdNrBm3irrxGdjUk7cHMFtfZyf8t2O VoHKcKR6G7ArbOF2pSU2XtNxbuN3y9VUI8Qy2httbSXCE2nvtdi0q4aUEymTzUZFmlHNbh/VluEp bzoNr1u45YtMnXe6hMrfiWUPRxXnYQ9WQUr3CQ7DdAs/rLYIUPjz3eqV4DxhrbWjZlVTq/S3/wz0 xawMYLvkd0EIIiOGQIGHIyC4LbkDek5f/8+DJ/y7/tOQT7any5uvyHtizuYrJUDQKOzl+neYTbyH bGgwT54/z9el8hqxt1eA== From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Dec 2022 19:35:22 +0800 X-OQ-MSGID: <20221219113522.98378-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/mediacodecdec: add AV1 decoding support 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: Zhao Zhili Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: R2SmlwElX2GY From: Zhao Zhili Signed-off-by: Zhao Zhili --- libavcodec/allcodecs.c | 1 + libavcodec/mediacodecdec.c | 16 +++++++++++++++- libavcodec/version.h | 4 ++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d5a6c427e1..b009848a44 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -828,6 +828,7 @@ extern const FFCodec ff_libaom_av1_decoder; /* hwaccel hooks only, so prefer external decoders */ extern const FFCodec ff_av1_decoder; extern const FFCodec ff_av1_cuvid_decoder; +extern const FFCodec ff_av1_mediacodec_decoder; extern const FFCodec ff_av1_nvenc_encoder; extern const FFCodec ff_av1_qsv_decoder; extern const FFCodec ff_av1_qsv_encoder; diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c index 2c231d1a34..11f655a9aa 100644 --- a/libavcodec/mediacodecdec.c +++ b/libavcodec/mediacodecdec.c @@ -289,7 +289,8 @@ done: #if CONFIG_MPEG2_MEDIACODEC_DECODER || \ CONFIG_MPEG4_MEDIACODEC_DECODER || \ CONFIG_VP8_MEDIACODEC_DECODER || \ - CONFIG_VP9_MEDIACODEC_DECODER + CONFIG_VP9_MEDIACODEC_DECODER || \ + CONFIG_AV1_MEDIACODEC_DECODER static int common_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) { int ret = 0; @@ -323,6 +324,15 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) } switch (avctx->codec_id) { +#if CONFIG_AV1_MEDIACODEC_DECODER + case AV_CODEC_ID_AV1: + codec_mime = "video/av01"; + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif #if CONFIG_H264_MEDIACODEC_DECODER case AV_CODEC_ID_H264: codec_mime = "video/avc"; @@ -591,3 +601,7 @@ DECLARE_MEDIACODEC_VDEC(vp8, "VP8", AV_CODEC_ID_VP8, NULL) #if CONFIG_VP9_MEDIACODEC_DECODER DECLARE_MEDIACODEC_VDEC(vp9, "VP9", AV_CODEC_ID_VP9, NULL) #endif + +#if CONFIG_AV1_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_VDEC(av1, "AV1", AV_CODEC_ID_AV1, NULL) +#endif diff --git a/libavcodec/version.h b/libavcodec/version.h index eb95a0f827..6b8a1dbb79 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,8 +29,8 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 55 -#define LIBAVCODEC_VERSION_MICRO 103 +#define LIBAVCODEC_VERSION_MINOR 56 +#define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \