mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
avcodec/mediacodec: Add AV1 encoder
Connected FFmpeg to Mediacodec AV1 encoder Signed-off-by: Samuel Mira <samuel.mira@qt.io> Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
parent
6b2ae90411
commit
acd37fd566
1
configure
vendored
1
configure
vendored
@ -3162,6 +3162,7 @@ aac_mf_encoder_deps="mediafoundation"
|
||||
ac3_mf_encoder_deps="mediafoundation"
|
||||
av1_cuvid_decoder_deps="cuvid CUVIDAV1PICPARAMS"
|
||||
av1_mediacodec_decoder_deps="mediacodec"
|
||||
av1_mediacodec_encoder_deps="mediacodec"
|
||||
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"
|
||||
|
@ -253,6 +253,7 @@ 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_MEDIACODEC_ENCODER) += mediacodecenc.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
|
||||
|
@ -836,6 +836,7 @@ extern const FFCodec ff_libaom_av1_decoder;
|
||||
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_mediacodec_encoder;
|
||||
extern const FFCodec ff_av1_nvenc_encoder;
|
||||
extern const FFCodec ff_av1_qsv_decoder;
|
||||
extern const FFCodec ff_av1_qsv_encoder;
|
||||
|
@ -345,6 +345,12 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
|
||||
static const int MPEG4ProfileAdvancedScalable = 0x4000;
|
||||
static const int MPEG4ProfileAdvancedSimple = 0x8000;
|
||||
|
||||
|
||||
static const int AV1ProfileMain8 = 0x1;
|
||||
static const int AV1ProfileMain10 = 0x2;
|
||||
static const int AV1ProfileMain10HDR10 = 0x1000;
|
||||
static const int AV1ProfileMain10HDR10Plus = 0x2000;
|
||||
|
||||
// Unused yet.
|
||||
(void)AVCProfileConstrainedHigh;
|
||||
(void)HEVCProfileMain10HDR10;
|
||||
@ -353,6 +359,9 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
|
||||
(void)VP9Profile3HDR;
|
||||
(void)VP9Profile2HDR10Plus;
|
||||
(void)VP9Profile3HDR10Plus;
|
||||
(void)AV1ProfileMain10;
|
||||
(void)AV1ProfileMain10HDR10;
|
||||
(void)AV1ProfileMain10HDR10Plus;
|
||||
|
||||
if (avctx->codec_id == AV_CODEC_ID_H264) {
|
||||
switch(avctx->profile) {
|
||||
@ -436,6 +445,16 @@ int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if(avctx->codec_id == AV_CODEC_ID_AV1) {
|
||||
switch (avctx->profile)
|
||||
{
|
||||
case FF_PROFILE_AV1_MAIN:
|
||||
return AV1ProfileMain8;
|
||||
case FF_PROFILE_AV1_HIGH:
|
||||
case FF_PROFILE_AV1_PROFESSIONAL:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
@ -170,6 +170,9 @@ static av_cold int mediacodec_init(AVCodecContext *avctx)
|
||||
case AV_CODEC_ID_MPEG4:
|
||||
codec_mime = "video/mp4v-es";
|
||||
break;
|
||||
case AV_CODEC_ID_AV1:
|
||||
codec_mime = "video/av01";
|
||||
break;
|
||||
default:
|
||||
av_assert0(0);
|
||||
}
|
||||
@ -878,3 +881,91 @@ static const AVOption mpeg4_options[] = {
|
||||
DECLARE_MEDIACODEC_ENCODER(mpeg4, "MPEG-4", AV_CODEC_ID_MPEG4)
|
||||
|
||||
#endif // CONFIG_MPEG4_MEDIACODEC_ENCODER
|
||||
|
||||
#if CONFIG_AV1_MEDIACODEC_ENCODER
|
||||
|
||||
enum MediaCodecAV1Level {
|
||||
AV1Level2 = 0x1,
|
||||
AV1Level21 = 0x2,
|
||||
AV1Level22 = 0x4,
|
||||
AV1Level23 = 0x8,
|
||||
AV1Level3 = 0x10,
|
||||
AV1Level31 = 0x20,
|
||||
AV1Level32 = 0x40,
|
||||
AV1Level33 = 0x80,
|
||||
AV1Level4 = 0x100,
|
||||
AV1Level41 = 0x200,
|
||||
AV1Level42 = 0x400,
|
||||
AV1Level43 = 0x800,
|
||||
AV1Level5 = 0x1000,
|
||||
AV1Level51 = 0x2000,
|
||||
AV1Level52 = 0x4000,
|
||||
AV1Level53 = 0x8000,
|
||||
AV1Level6 = 0x10000,
|
||||
AV1Level61 = 0x20000,
|
||||
AV1Level62 = 0x40000,
|
||||
AV1Level63 = 0x80000,
|
||||
AV1Level7 = 0x100000,
|
||||
AV1Level71 = 0x200000,
|
||||
AV1Level72 = 0x400000,
|
||||
AV1Level73 = 0x800000,
|
||||
};
|
||||
|
||||
static const AVOption av1_options[] = {
|
||||
COMMON_OPTION
|
||||
{ "level", "Specify tier and level",
|
||||
OFFSET(level), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, "level" },
|
||||
{ "2", "Level 2",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level2 }, 0, 0, VE, "level" },
|
||||
{ "2.1", "Level 2.1",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level21 }, 0, 0, VE, "level" },
|
||||
{ "2.2", "Level 2.2",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level22 }, 0, 0, VE, "level" },
|
||||
{ "2.3", "Level 2.3",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level23 }, 0, 0, VE, "level" },
|
||||
{ "3", "Level 3",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level3 }, 0, 0, VE, "level" },
|
||||
{ "3.1", "Level 3.1",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level31 }, 0, 0, VE, "level" },
|
||||
{ "3.2", "Level 3.2",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level32 }, 0, 0, VE, "level" },
|
||||
{ "3.3", "Level 3.3",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level33 }, 0, 0, VE, "level" },
|
||||
{ "4", "Level 4",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level4 }, 0, 0, VE, "level" },
|
||||
{ "4.1", "Level 4.1",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level41 }, 0, 0, VE, "level" },
|
||||
{ "4.2", "Level 4.2",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level42 }, 0, 0, VE, "level" },
|
||||
{ "4.3", "Level 4.3",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level43 }, 0, 0, VE, "level" },
|
||||
{ "5", "Level 5",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level5 }, 0, 0, VE, "level" },
|
||||
{ "5.1", "Level 5.1",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level51 }, 0, 0, VE, "level" },
|
||||
{ "5.2", "Level 5.2",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level52 }, 0, 0, VE, "level" },
|
||||
{ "5.3", "Level 5.3",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level53 }, 0, 0, VE, "level" },
|
||||
{ "6", "Level 6",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level6 }, 0, 0, VE, "level" },
|
||||
{ "6.1", "Level 6.1",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level61 }, 0, 0, VE, "level" },
|
||||
{ "6.2", "Level 6.2",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level62 }, 0, 0, VE, "level" },
|
||||
{ "6.3", "Level 6.3",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level63 }, 0, 0, VE, "level" },
|
||||
{ "7", "Level 7",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level7 }, 0, 0, VE, "level" },
|
||||
{ "7.1", "Level 7.1",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level71 }, 0, 0, VE, "level" },
|
||||
{ "7.2", "Level 7.2",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level72 }, 0, 0, VE, "level" },
|
||||
{ "7.3", "Level 7.3",
|
||||
0, AV_OPT_TYPE_CONST, { .i64 = AV1Level73 }, 0, 0, VE, "level" },
|
||||
{ NULL, }
|
||||
};
|
||||
|
||||
DECLARE_MEDIACODEC_ENCODER(av1, "AV1", AV_CODEC_ID_AV1)
|
||||
|
||||
#endif // CONFIG_AV1_MEDIACODEC_ENCODER
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "version_major.h"
|
||||
|
||||
#define LIBAVCODEC_VERSION_MINOR 12
|
||||
#define LIBAVCODEC_VERSION_MINOR 13
|
||||
#define LIBAVCODEC_VERSION_MICRO 100
|
||||
|
||||
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
|
||||
|
Loading…
Reference in New Issue
Block a user