diff options
author | Philip Langdale <philipl@overt.org> | 2018-10-07 06:20:58 +0300 |
---|---|---|
committer | Philip Langdale <philipl@overt.org> | 2019-02-16 19:47:36 +0300 |
commit | 83c7ac2e47efd96927127c1c385cdbb5fb53cb02 (patch) | |
tree | 81acf95f1623d5d1d15e4d282a4d15f472499b77 /libavcodec/nvdec.c | |
parent | e06ccfbe1d33c00d6f1df202a514219c7fdb7c03 (diff) |
avcodec/nvdec: Explicitly mark codecs that support 444 output formats
With the introduction of HEVC 444 support, we technically have two
codecs that can handle 444 - HEVC and MJPEG. In the case of MJPEG,
it can decode, but can only output one of the semi-planar formats.
That means we need additional logic to decide whether to use a
444 output format or not.
Diffstat (limited to 'libavcodec/nvdec.c')
-rw-r--r-- | libavcodec/nvdec.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/nvdec.c b/libavcodec/nvdec.c index 72201a1123..b60da24301 100644 --- a/libavcodec/nvdec.c +++ b/libavcodec/nvdec.c @@ -298,7 +298,7 @@ int ff_nvdec_decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_ERROR, "Unsupported chroma format\n"); return AVERROR(ENOSYS); } - chroma_444 = cuvid_chroma_format == cudaVideoChromaFormat_444; + chroma_444 = ctx->supports_444 && cuvid_chroma_format == cudaVideoChromaFormat_444; if (!avctx->hw_frames_ctx) { ret = ff_decode_get_hw_frames_ctx(avctx, AV_HWDEVICE_TYPE_CUDA); @@ -587,7 +587,8 @@ static AVBufferRef *nvdec_alloc_dummy(int size) int ff_nvdec_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx, - int dpb_size) + int dpb_size, + int supports_444) { AVHWFramesContext *frames_ctx = (AVHWFramesContext*)hw_frames_ctx->data; const AVPixFmtDescriptor *sw_desc; @@ -608,7 +609,7 @@ int ff_nvdec_frame_params(AVCodecContext *avctx, av_log(avctx, AV_LOG_VERBOSE, "Unsupported chroma format\n"); return AVERROR(EINVAL); } - chroma_444 = cuvid_chroma_format == cudaVideoChromaFormat_444; + chroma_444 = supports_444 && cuvid_chroma_format == cudaVideoChromaFormat_444; frames_ctx->format = AV_PIX_FMT_CUDA; frames_ctx->width = (avctx->coded_width + 1) & ~1; |