From patchwork Mon Dec 19 12:45:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 39731 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:bc95:b0:ad:ade2:bfd2 with SMTP id fx21csp4027825pzb; Mon, 19 Dec 2022 04:46:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf4FsCKrGu3rwKVXtmbd/tCUP8dyxmeAGdCHjOrgW9FzlfuPn72rWUmn3Y0RGNEg+T9QMCxH X-Received: by 2002:a17:906:7f92:b0:7c0:cd95:bbb7 with SMTP id f18-20020a1709067f9200b007c0cd95bbb7mr34720403ejr.77.1671453992685; Mon, 19 Dec 2022 04:46:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671453992; cv=none; d=google.com; s=arc-20160816; b=FCBTxmHVxDsoOyr3MUvwa8uSA8TgGnGZ/GNyq8tsDDoS0aJRCHjns7OzAW+NyU7+3v HOeaXBRXSCC0f07fxOYhwRgUCREUhflPSq4hk01zAa9XPMv1t/3n49rGHWiBFROEU8u/ RlPVQqM7b5emu3zEgEA2q1HQlaxCKM8Ue6x28X85mDwA9iFC/awRKKvrebL95DBE6W5r lcmc5sBTIKv2FPN3NOC3sPYXRE+x0NRecrZgPwCoCuGEMe6P5vWxzizehUKkpTOH//nS 26lfQa7472260VtfCob5Vzek8uksGydD5yJBfQQRUaR3saroL73RERBm+9j+nful3gbT imKQ== 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=Xq6V7FsQqk43OpvYTpxeXPFfYUJQ3QZFNeGtKuqFssQ=; b=ZX6htFfrWPVhookUMUWEiRTOtpTZ2+3KWyFK1Y5o9OaYTLY9JJjpDOhHjpkGpLJrlP YR2C1xWJfKDYb0SFEyq1bvLQ9Es9GpryGSSEQyxjxACEYowMCWSrFVEP7jpb+eZp4Ckw BB6YgyhWZCN96kfAIdv1qfJIFJkA2JIQlBlxUuHsrcgWKWeLJWWdeB/lXET0DzZGeIsf bIqgEHtKlBNnpA8YBQFYFO8NvyvnPwRRLXEf7YAK5MxzoOxzGLyyhKgIc28p5O1rk81W PwppKoYaiyEVj6qEHpC83jK52E39Er9HzCxOt4ACORD5vMMn25IiGqZEzM/j+uoPD+Rl RtdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=aFNQQBxK; 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 wz8-20020a170906fe4800b0078e1e216396si9216172ejb.66.2022.12.19.04.46.32; Mon, 19 Dec 2022 04:46:32 -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=aFNQQBxK; 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 05F0568B461; Mon, 19 Dec 2022 14:46:28 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-58-211.mail.qq.com (out162-62-58-211.mail.qq.com [162.62.58.211]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6285F68B2E4 for ; Mon, 19 Dec 2022 14:46:20 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1671453977; bh=iVzzGOzDZdHY9rNQduOarz4AKh15Jj0qONuoZSTgbKk=; h=From:To:Cc:Subject:Date; b=aFNQQBxKpA2cx/gr17IUgIWKxzfsT/wiMUHZW/pQT1CO7mm6OUGMeJ7AJCFFdHaV9 Y5U4ZDTby41WpyQHOh7aTPf2TeEZNmfUSa6vNuKQUidaxJLHBju2NtYpJxN7o9rAI2 qCLhoE3kh7rMnxaOQqfHuOFg+Nlf/be4nF9Cc+YE= Received: from localhost.localdomain ([113.118.115.165]) by newxmesmtplogicsvrszb6-0.qq.com (NewEsmtp) with SMTP id B902D670; Mon, 19 Dec 2022 20:46:16 +0800 X-QQ-mid: xmsmtpt1671453976tepq600xr Message-ID: X-QQ-XMAILINFO: MFWpArBVhhGTN5ORdLEbE4vJ8Bq+LHjhBgnCQusrKLA2F+MrP3V02d7E9xoBAE BKGD5T6iwDNasGiNk87+IawlNV8BBDjV+6ct1kk6DgynloMGdqaQLpLmZaLsLQwfeCkzQRP/2kZF kwtVcrXojDFaLf0sungtFZSO28/flhqb9jFe/uAdDE8RK6TCEWNt2Ic68NFHbmMoK6DEP4rq9SZr KAjYgDzUjaV4P3woESuTqbhpJw9FWlAV9a+CD1uoE/U8dnaMJZMJ7F86yfa+jj4FgjDBUIi3KgSk JgC0Nfldpi+aWWllLHcGMU6Mrz+OozvisX2w/I9kyn4H6nOxDnabM1+mm0R8M2J1r1Y+PayAjVXf ai/2IhlBbgvxCXSFyJJg+GhrfUpz6oLbdJ8c8IpTBTRSa+yhotpmhttDOwsKXQH2hb6hSaU0UZad GWLKdr3Wh7O2hBD6o7BUo3EjFsxkmfWk4HStnYlWkx1BTEJtSsOGjyPfMZjV95AXmTp7qpJPrAz0 S60gnhZN4Vzj5zgnTz15nGCgntgoiwx7nWI0Dr1lJKMkNiOjDLP2Wq6ldScEIixZOJz+iBead9ov gjbRQmcw63e8T0k///WP2hWv4Uzm2ZkPIc6czq8fqSdSazN484vSxpLx80qxRyWgwJeP4EH9nDo+ 6SPLXudj8zVSk+Gta8vy4WqDW3yvX0EC1BjafZlVx01yIdE2YsVvYDFkIGBqagTboK+VyAhxnzZe rG04VPr6WCDlZd1UTr4n1FtE3AuUlCJbnKo30pRsJVmgec5G1JXx0nhtL3YZb7Fj2B5vWe3gtwfU YOoRRFixpkKRKfOlnBmV4QN4fv7wFe0gsQBiYRC243My/UJyNXGwb1JXv+7O1nwoIRiSrehQOx9h BNvj0gS8lg7u/7q+Dr3nsOcmiwMjolT/Fd3c54QmjieXmdfxP0oFeLfeWOs91bMhLJ60vWo3FLrz JgHstGdfjeSn4KhrPivVcsVvvkPxw3 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Dec 2022 20:45:40 +0800 X-OQ-MSGID: <20221219124540.172125-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] 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: OiIbOFH+1eDh From: Zhao Zhili Signed-off-by: Zhao Zhili --- configure | 2 ++ libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/mediacodecdec.c | 16 +++++++++++++++- libavcodec/version.h | 4 ++-- 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 2180ebb4f1..3ae9eb768f 100755 --- a/configure +++ b/configure @@ -3156,6 +3156,8 @@ nvenc_deps_any="libdl LoadLibrary" aac_mf_encoder_deps="mediafoundation" ac3_mf_encoder_deps="mediafoundation" av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS" +av1_mediacodec_decoder_deps="mediacodec" +av1_mediacodec_decoder_extralibs="-landroid" av1_nvenc_encoder_deps="nvenc NV_ENC_PIC_PARAMS_AV1" av1_nvenc_encoder_select="atsc_a53" h263_v4l2m2m_decoder_deps="v4l2_m2m h263_v4l2_m2m" diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 98841ed07c..3ab448dd49 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -249,6 +249,7 @@ OBJS-$(CONFIG_AURA_DECODER) += cyuv.o OBJS-$(CONFIG_AURA2_DECODER) += aura.o OBJS-$(CONFIG_AV1_DECODER) += av1dec.o OBJS-$(CONFIG_AV1_CUVID_DECODER) += cuviddec.o +OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER) += mediacodecdec.o OBJS-$(CONFIG_AV1_NVENC_ENCODER) += nvenc_av1.o nvenc.o OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o OBJS-$(CONFIG_AVRN_DECODER) += avrndec.o 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, \