I have a decoder class built on NVDEC that mostly used NvDecoder.cpp from the Video Codec SDK as a starting point:
It is provided, and only processes H.264 I-frames.
I started out using the class to decode (and resize) 1080p H.264 I-frames, and it works as expected. When I change the code to call cuvidReconfigureDecoder in the pfnSequenceCallback for frames of different resolutions, the frames are not decoded correctly. The
pfnDecodePicture and pfnDisplayPicture callbacks succeed, but the resulting decoded images look strange.
This is my first attempt at using NVDEC, so I’m not sure what could be wrong here. I’m hoping the appearance of the decoded frames will give someone a clue as to what’s going on. This is all being run on a Tesla K80 with driver 410.104, and targeting version 8.2.16 of the Video Codec SDK.
Can anyone provide some insight in to what the problem is here?
I confirm, we faced with the same issue, trying to reconfigure NVDEC on Tesla K80.
While the general decoding is working well, after reconfiguration decoder started to provide damaged pictures, just like in the post above. Driver version 418.56, Cuda version 10.1, video codec SDK version 8.2.16.
In fact we were able to get more details. Decoder provide broken images when the input frame size is changed. It works as expected if only output image size changes.
So obvious workaround here is to use multiple decoders with fixed input dimensions.
Dear Eugene.filin,
I successfully used reconfigure feature in NVDEC on Q 5000 GPU. I hope my method will help you resolve your issue.
How I did it.
I did not make any changes in NvDecoder.cpp file. My reconfigure function is very similar to below function.
int MyReconfigDecoder (NvDecoder *pNvDecoder, int newWidth, int newHeight)
{
Dim resizeDim = {};
// check arguments here.
// newWidth and newHeight "must" be less than or equal to the max_width and max_height set during NvDecoder create time.
// send CUVID_PKT_ENDOFSTREAM to NvDecoder
pNvDecoder->Decode (nullptr, 0, nullptr, nullptr);
resizeDim.w = newWidth;
resizeDim.h = newHeight;
// call NvDecoder's setReconfigParams
pNvDecoder->setReconfigParams(NULL, &resizeDim);
return 0;
}
During subsequent calls to NvDecoder::Decode () with input data, decoder will give callback to “HandleVideoSequence” which calls ReconfigureDecoder (pVideoFormat); by itself.