]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/nvdec.c
avcodec/utvideodec : use gradient_pred dsp in interlace decoding
[ffmpeg] / libavcodec / nvdec.c
index d5cf1058cb7b41609d6a088e5482492d4443188d..e9e6ea0f8b9d03c8bdde9aa376a329ae491e6003 100644 (file)
@@ -56,7 +56,9 @@ static int map_avcodec_id(enum AVCodecID id)
     case AV_CODEC_ID_HEVC:       return cudaVideoCodec_HEVC;
     case AV_CODEC_ID_MPEG1VIDEO: return cudaVideoCodec_MPEG1;
     case AV_CODEC_ID_MPEG2VIDEO: return cudaVideoCodec_MPEG2;
+    case AV_CODEC_ID_MPEG4:      return cudaVideoCodec_MPEG4;
     case AV_CODEC_ID_VC1:        return cudaVideoCodec_VC1;
+    case AV_CODEC_ID_VP8:        return cudaVideoCodec_VP8;
     case AV_CODEC_ID_VP9:        return cudaVideoCodec_VP9;
     case AV_CODEC_ID_WMV3:       return cudaVideoCodec_VC1;
     }
@@ -89,6 +91,18 @@ static int nvdec_test_capabilities(NVDECDecoder *decoder,
     caps.eChromaFormat   = params->ChromaFormat;
     caps.nBitDepthMinus8 = params->bitDepthMinus8;
 
+    if (!decoder->cvdl->cuvidGetDecoderCaps) {
+        av_log(logctx, AV_LOG_WARNING, "Used Nvidia driver is too old to perform a capability check.\n");
+        av_log(logctx, AV_LOG_WARNING, "The minimum required version is "
+#if defined(_WIN32) || defined(__CYGWIN__)
+            "378.66"
+#else
+            "378.13"
+#endif
+            ". Continuing blind.\n");
+        return 0;
+    }
+
     err = decoder->cvdl->cuvidGetDecoderCaps(&caps);
     if (err != CUDA_SUCCESS) {
         av_log(logctx, AV_LOG_ERROR, "Failed querying decoder capabilities\n");
@@ -175,7 +189,7 @@ static int nvdec_decoder_create(AVBufferRef **out, AVBufferRef *hw_device_ref,
     decoder->cuda_ctx = device_hwctx->cuda_ctx;
     decoder->cudl = device_hwctx->internal->cuda_dl;
 
-    ret = cuvid_load_functions(&decoder->cvdl);
+    ret = cuvid_load_functions(&decoder->cvdl, logctx);
     if (ret < 0) {
         av_log(logctx, AV_LOG_ERROR, "Failed loading nvcuvid.\n");
         goto fail;
@@ -531,8 +545,8 @@ 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->width             = (avctx->coded_width + 1) & ~1;
+    frames_ctx->height            = (avctx->coded_height + 1) & ~1;
     frames_ctx->initial_pool_size = dpb_size;
 
     switch (sw_desc->comp[0].depth) {