avcodec: add av1 VAAPI decoder

Example cmdline:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -v verbose \
-c:v av1 -i input.ivf -pix_fmt yuv420p -vsync passthrough -f md5     \
-y out.md5

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
This commit is contained in:
Fei Wang
2020-10-29 14:54:25 +08:00
committed by Mark Thompson
parent dbd4254a61
commit 3308bbf776
8 changed files with 304 additions and 2 deletions

View File

@@ -215,7 +215,7 @@ static int get_pixel_format(AVCodecContext *avctx)
uint8_t bit_depth;
int ret;
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
#define HWACCEL_MAX (0)
#define HWACCEL_MAX (CONFIG_AV1_VAAPI_HWACCEL)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
if (seq->seq_profile == 2 && seq->color_config.high_bitdepth)
@@ -276,6 +276,19 @@ static int get_pixel_format(AVCodecContext *avctx)
return -1;
s->pix_fmt = pix_fmt;
switch (s->pix_fmt) {
case AV_PIX_FMT_YUV420P:
#if CONFIG_AV1_VAAPI_HWACCEL
*fmtp++ = AV_PIX_FMT_VAAPI;
#endif
break;
case AV_PIX_FMT_YUV420P10:
#if CONFIG_AV1_VAAPI_HWACCEL
*fmtp++ = AV_PIX_FMT_VAAPI;
#endif
break;
}
*fmtp++ = s->pix_fmt;
*fmtp = AV_PIX_FMT_NONE;
@@ -840,6 +853,9 @@ AVCodec ff_av1_decoder = {
.flush = av1_decode_flush,
.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
.hw_configs = (const AVCodecHWConfigInternal * []) {
#if CONFIG_AV1_VAAPI_HWACCEL
HWACCEL_VAAPI(av1),
#endif
NULL
},
};