3

I am implementing a video decoder using NVidia's NvDec CUVID feature. According to chapter 2 of the (woefully inadequate) manual, decoding limits are specified by GPU architecture. ie, the maximum h265 horizontal resolution is 8192 on a GP10x, 4096 on a GP100 or less, and unsupported on any architecture less than GM206.

How do I use CUDA to detect such architectures? Am I supposed to infer it from compute capabilities or what? And if I'm supposed to infer it, is there a table of architectures vs compute capabilities?

swestrup
  • 4,079
  • 3
  • 22
  • 33
  • 2
    Chapter 4 introduces a `cuvidGetDecoderCaps()` function, which detects decoder capability. – halfelf May 17 '17 at 03:48
  • It does?? How the heck did I miss that? Since I only want to know the architecture to know the capabilities, post your comment as an answer and I'll mark it as correct! – swestrup May 18 '17 at 18:26
  • It turns out that in v7 of the SDK there was no such function, but since I don't need to be backward compatible with 7, I could (and did) upgrade to 8.0 and used its features. – swestrup May 23 '17 at 03:46

1 Answers1

4

Though there isn't a function that returns code name of GPU, NVIDIA provides cuvidGetDecoderCaps() API to let users query the capabilities of underlying hardware video decoder.

A detailed example of cuvidGetDecoderCaps() can be found in Video_Codec_SDK_x.x.x downloaded from nvenc official site. One example in Samples/NvDecodeD3D11/NvDecodeD3D11.cpp:

CUVIDEOFORMAT videoFormat = g_pVideoSource->format();
CUVIDDECODECAPS videoDecodeCaps = {};
videoDecodeCaps.eCodecType = videoFormat.codec;
videoDecodeCaps.eChromaFormat = videoFormat.chroma_format;
videoDecodeCaps.nBitDepthMinus8 = videoFormat.bit_depth_luma_minus8;
if (cuvidGetDecoderCaps(&videoDecodeCaps) != CUDA_SUCCESS)
{
    printf("cuvidGetDecoderCaps failed: %d\n", result);
    return;
}
if (!videoDecodeCaps.bIsSupported) {
    printf("Error: This video format isn't supported on the selected GPU.");
    exit(1);;
}
halfelf
  • 9,737
  • 13
  • 54
  • 63