summaryrefslogtreecommitdiff
path: root/libavcodec/nvdec.c
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2017-11-11 15:07:41 +0100
committerTimo Rothenpieler <timo@rothenpieler.org>2017-11-12 15:46:39 +0100
commit3f6294a53d58ececeacb42ce2ba8349a8b0a4abb (patch)
tree596d60332b9b4ef38efedd8667dcd3eb4569208b /libavcodec/nvdec.c
parentc60bc02bf4bc4f6f57fd0fd4c5b2e63253623185 (diff)
downloadffmpeg-3f6294a53d58ececeacb42ce2ba8349a8b0a4abb.tar.gz
avcodec/nvdec: add support for 12 bit formats
Diffstat (limited to 'libavcodec/nvdec.c')
-rw-r--r--libavcodec/nvdec.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c
index 6287897343..274f69f997 100644
--- a/libavcodec/nvdec.c
+++ b/libavcodec/nvdec.c
@@ -489,9 +489,21 @@ int ff_nvdec_frame_params(AVCodecContext *avctx,
frames_ctx->format = AV_PIX_FMT_CUDA;
frames_ctx->width = avctx->coded_width;
frames_ctx->height = avctx->coded_height;
- frames_ctx->sw_format = sw_desc->comp[0].depth > 8 ?
- AV_PIX_FMT_P010 : AV_PIX_FMT_NV12;
frames_ctx->initial_pool_size = dpb_size;
+ switch (sw_desc->comp[0].depth) {
+ case 8:
+ frames_ctx->sw_format = AV_PIX_FMT_NV12;
+ break;
+ case 10:
+ frames_ctx->sw_format = AV_PIX_FMT_P010;
+ break;
+ case 12:
+ frames_ctx->sw_format = AV_PIX_FMT_P016;
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+
return 0;
}