summaryrefslogtreecommitdiff
path: root/libavcodec/nvdec.c
diff options
context:
space:
mode:
authorPhilip Langdale <philipl@overt.org>2020-12-05 20:25:29 -0800
committerPhilip Langdale <philipl@overt.org>2020-12-06 14:59:24 -0800
commit67bb11b5f6548c3b273b575f44077db19bb9a98e (patch)
tree5cf07b8f2c6e20ea2d34a82cf86ab9fd0a22d516 /libavcodec/nvdec.c
parent51dfd6f1bdb03bfc7574b12e921fb3b8639ba5cf (diff)
downloadffmpeg-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/nvdec.c')
-rw-r--r--libavcodec/nvdec.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 48281293ce..23c84d9acf 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -83,6 +83,9 @@ static int map_chroma_format(enum AVPixelFormat pix_fmt)
{
int shift_h = 0, shift_v = 0;
+ if (av_pix_fmt_count_planes(pix_fmt) == 1)
+ return cudaVideoChromaFormat_Monochrome;
+
av_pix_fmt_get_chroma_sub_sample(pix_fmt, &shift_h, &shift_v);
if (shift_h == 1 && shift_v == 1)