aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libaomdec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2018-03-28 23:28:34 -0300
committerJames Almer <jamrial@gmail.com>2018-03-29 00:05:52 -0300
commitc0f0c9f5318786904bc87f9278868ff3c3a7802d (patch)
tree72bc18a8a082299d3d77b3bf41b6bede93c21689 /libavcodec/libaomdec.c
parent99cc3cf7a26cd4113e5047034577027d8c6f07a2 (diff)
downloadffmpeg-c0f0c9f5318786904bc87f9278868ff3c3a7802d.tar.gz
avcode/profiles: add AV1 profiles
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/libaomdec.c')
-rw-r--r--libavcodec/libaomdec.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 29f0afd2ac..05e476c342 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -31,6 +31,7 @@
#include "avcodec.h"
#include "internal.h"
+#include "profiles.h"
typedef struct AV1DecodeContext {
struct aom_codec_ctx decoder;
@@ -98,23 +99,29 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
switch (img->fmt) {
case AOM_IMG_FMT_I420:
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ avctx->profile = FF_PROFILE_AV1_MAIN;
return 0;
case AOM_IMG_FMT_I422:
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+ avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
return 0;
case AOM_IMG_FMT_I444:
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
+ avctx->profile = FF_PROFILE_AV1_HIGH;
return 0;
case AOM_IMG_FMT_I42016:
if (img->bit_depth == 8) {
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
+ avctx->profile = FF_PROFILE_AV1_MAIN;
return 0;
} else if (img->bit_depth == 10) {
avctx->pix_fmt = AV_PIX_FMT_YUV420P10;
+ avctx->profile = FF_PROFILE_AV1_MAIN;
return 0;
} else if (img->bit_depth == 12) {
avctx->pix_fmt = AV_PIX_FMT_YUV420P12;
+ avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
return 0;
} else {
return AVERROR_INVALIDDATA;
@@ -122,12 +129,15 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
case AOM_IMG_FMT_I42216:
if (img->bit_depth == 8) {
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
+ avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
return 0;
} else if (img->bit_depth == 10) {
avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
+ avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
return 0;
} else if (img->bit_depth == 12) {
avctx->pix_fmt = AV_PIX_FMT_YUV422P12;
+ avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
return 0;
} else {
return AVERROR_INVALIDDATA;
@@ -136,14 +146,17 @@ static int set_pix_fmt(AVCodecContext *avctx, struct aom_image *img)
if (img->bit_depth == 8) {
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P;
+ avctx->profile = FF_PROFILE_AV1_HIGH;
return 0;
} else if (img->bit_depth == 10) {
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10;
+ avctx->profile = FF_PROFILE_AV1_HIGH;
return 0;
} else if (img->bit_depth == 12) {
avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ?
AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12;
+ avctx->profile = FF_PROFILE_AV1_PROFESSIONAL;
return 0;
} else {
return AVERROR_INVALIDDATA;
@@ -229,5 +242,6 @@ AVCodec ff_libaom_av1_decoder = {
.close = aom_free,
.decode = aom_decode,
.capabilities = AV_CODEC_CAP_AUTO_THREADS | AV_CODEC_CAP_DR1,
+ .profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
.wrapper_name = "libaom",
};