avcode/profiles: add AV1 profiles
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
99cc3cf7a2
commit
c0f0c9f531
@ -1602,6 +1602,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
|
|||||||
.name = "av1",
|
.name = "av1",
|
||||||
.long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"),
|
.long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"),
|
||||||
.props = AV_CODEC_PROP_LOSSY,
|
.props = AV_CODEC_PROP_LOSSY,
|
||||||
|
.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.id = AV_CODEC_ID_BITPACKED,
|
.id = AV_CODEC_ID_BITPACKED,
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "profiles.h"
|
||||||
|
|
||||||
typedef struct AV1DecodeContext {
|
typedef struct AV1DecodeContext {
|
||||||
struct aom_codec_ctx decoder;
|
struct aom_codec_ctx decoder;
|
||||||
@ -98,23 +99,29 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
|
|||||||
switch (img->fmt) {
|
switch (img->fmt) {
|
||||||
case AOM_IMG_FMT_I420:
|
case AOM_IMG_FMT_I420:
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_MAIN;
|
||||||
return 0;
|
return 0;
|
||||||
case AOM_IMG_FMT_I422:
|
case AOM_IMG_FMT_I422:
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
|
||||||
return 0;
|
return 0;
|
||||||
case AOM_IMG_FMT_I444:
|
case AOM_IMG_FMT_I444:
|
||||||
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
|
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
|
||||||
AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
|
AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_HIGH;
|
||||||
return 0;
|
return 0;
|
||||||
case AOM_IMG_FMT_I42016:
|
case AOM_IMG_FMT_I42016:
|
||||||
if (img->bit_depth == 8) {
|
if (img->bit_depth == 8) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_MAIN;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (img->bit_depth == 10) {
|
} else if (img->bit_depth == 10) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
|
avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_MAIN;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (img->bit_depth == 12) {
|
} else if (img->bit_depth == 12) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P12;
|
avctx->pix_fmt = AV_PIX_FMT_YUV420P12;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -122,12 +129,15 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
|
|||||||
case AOM_IMG_FMT_I42216:
|
case AOM_IMG_FMT_I42216:
|
||||||
if (img->bit_depth == 8) {
|
if (img->bit_depth == 8) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (img->bit_depth == 10) {
|
} else if (img->bit_depth == 10) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
|
avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (img->bit_depth == 12) {
|
} else if (img->bit_depth == 12) {
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
|
avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -136,14 +146,17 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
|
|||||||
if (img->bit_depth == 8) {
|
if (img->bit_depth == 8) {
|
||||||
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
|
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
|
||||||
AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
|
AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_HIGH;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (img->bit_depth == 10) {
|
} else if (img->bit_depth == 10) {
|
||||||
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
|
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
|
||||||
AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;
|
AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_HIGH;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (img->bit_depth == 12) {
|
} else if (img->bit_depth == 12) {
|
||||||
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
|
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
|
||||||
AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
|
AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
|
||||||
|
avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
@ -229,5 +242,6 @@ AVCodec ff_libaom_av1_decoder = {
|
|||||||
.close = aom_free,
|
.close = aom_free,
|
||||||
.decode = aom_decode,
|
.decode = aom_decode,
|
||||||
.capabilities = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1,
|
.capabilities = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1,
|
||||||
|
.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
|
||||||
.wrapper_name = "libaom",
|
.wrapper_name = "libaom",
|
||||||
};
|
};
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include "avcodec.h"
|
#include "avcodec.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "profiles.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Portion of struct aom_codec_cx_pkt from aom_encoder.h.
|
* Portion of struct aom_codec_cx_pkt from aom_encoder.h.
|
||||||
@ -735,6 +736,7 @@ AVCodec ff_libaom_av1_encoder = {
|
|||||||
.encode2 = aom_encode,
|
.encode2 = aom_encode,
|
||||||
.close = aom_free,
|
.close = aom_free,
|
||||||
.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_EXPERIMENTAL,
|
.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_EXPERIMENTAL,
|
||||||
|
.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
|
||||||
.priv_class = &class_aom,
|
.priv_class = &class_aom,
|
||||||
.defaults = defaults,
|
.defaults = defaults,
|
||||||
.init_static_data = av1_init_static,
|
.init_static_data = av1_init_static,
|
||||||
|
@ -140,6 +140,13 @@ const AVProfile ff_vp9_profiles[] = {
|
|||||||
{ FF_PROFILE_UNKNOWN },
|
{ FF_PROFILE_UNKNOWN },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const AVProfile ff_av1_profiles[] = {
|
||||||
|
{ FF_PROFILE_AV1_MAIN, "Main" },
|
||||||
|
{ FF_PROFILE_AV1_HIGH, "High" },
|
||||||
|
{ FF_PROFILE_AV1_PROFESSIONAL, "Professional" },
|
||||||
|
{ FF_PROFILE_UNKNOWN },
|
||||||
|
};
|
||||||
|
|
||||||
const AVProfile ff_sbc_profiles[] = {
|
const AVProfile ff_sbc_profiles[] = {
|
||||||
{ FF_PROFILE_SBC_MSBC, "mSBC" },
|
{ FF_PROFILE_SBC_MSBC, "mSBC" },
|
||||||
{ FF_PROFILE_UNKNOWN },
|
{ FF_PROFILE_UNKNOWN },
|
||||||
|
@ -31,6 +31,7 @@ extern const AVProfile ff_mpeg2_video_profiles[];
|
|||||||
extern const AVProfile ff_mpeg4_video_profiles[];
|
extern const AVProfile ff_mpeg4_video_profiles[];
|
||||||
extern const AVProfile ff_vc1_profiles[];
|
extern const AVProfile ff_vc1_profiles[];
|
||||||
extern const AVProfile ff_vp9_profiles[];
|
extern const AVProfile ff_vp9_profiles[];
|
||||||
|
extern const AVProfile ff_av1_profiles[];
|
||||||
extern const AVProfile ff_sbc_profiles[];
|
extern const AVProfile ff_sbc_profiles[];
|
||||||
|
|
||||||
#endif /* AVCODEC_PROFILES_H */
|
#endif /* AVCODEC_PROFILES_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user