diff options
author | Philip Langdale <philipl@overt.org> | 2020-12-05 20:25:29 -0800 |
---|---|---|
committer | Philip Langdale <philipl@overt.org> | 2020-12-06 14:59:24 -0800 |
commit | 67bb11b5f6548c3b273b575f44077db19bb9a98e (patch) | |
tree | 5cf07b8f2c6e20ea2d34a82cf86ab9fd0a22d516 /libavcodec/av1dec.c | |
parent | 51dfd6f1bdb03bfc7574b12e921fb3b8639ba5cf (diff) | |
download | ffmpeg-67bb11b5f6548c3b273b575f44077db19bb9a98e.tar.gz |
avcodec/nvdec: Add support for decoding monochrome av1
The nvidia hardware explicitly supports decoding monochrome content,
presumably for the AVIF alpha channel. Supporting this requires an
adjustment in av1dec and explicit monochrome detection in nvdec.
I'm not sure why the monochrome path in av1dec did what it did - it
seems non-functional - YUV440P doesn't seem a logical pix_fmt for
monochrome and conditioning on chroma sub-sampling doesn't make sense.
So I changed it.
I've tested 8bit content, but I haven't found a way to create a 10bit
sample, so that path is untested for now.
Diffstat (limited to 'libavcodec/av1dec.c')
-rw-r--r-- | libavcodec/av1dec.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index d7b2ac9d46..bc897af9cf 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -387,9 +387,12 @@ static int get_pixel_format(AVCodecContext *avctx) av_log(avctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n"); } } else { - if (seq->color_config.subsampling_x == 1 && - seq->color_config.subsampling_y == 1) - pix_fmt = AV_PIX_FMT_YUV440P; + if (bit_depth == 8) + pix_fmt = AV_PIX_FMT_GRAY8; + else if (bit_depth == 10) + pix_fmt = AV_PIX_FMT_GRAY10; + else if (bit_depth == 12) + pix_fmt = AV_PIX_FMT_GRAY12; else av_log(avctx, AV_LOG_WARNING, "Unknown AV1 pixel format.\n"); } @@ -432,6 +435,16 @@ static int get_pixel_format(AVCodecContext *avctx) *fmtp++ = AV_PIX_FMT_VAAPI; #endif break; + case AV_PIX_FMT_GRAY8: +#if CONFIG_AV1_NVDEC_HWACCEL + *fmtp++ = AV_PIX_FMT_CUDA; +#endif + break; + case AV_PIX_FMT_GRAY10: +#if CONFIG_AV1_NVDEC_HWACCEL + *fmtp++ = AV_PIX_FMT_CUDA; +#endif + break; } *fmtp++ = s->pix_fmt; |