我正在尝试为单帧运行D3D9 CUDA的解码器样本。现在我的解码器定义如下
CUvideodecoder *decoder_info;
CUVIDDECODECREATEINFO oVideoDecodeCreateInfo;
memset(&oVideoDecodeCreateInfo, 0, sizeof(CUVIDDECODECREATEINFO));
oVideoDecodeCreateInfo.CodecType = cudaVideoCodec_MPEG2;
oVideoDecodeCreateInfo.ulWidth = width;
oVideoDecodeCreateInfo.ulHeight = height;
oVideoDecodeCreateInfo.ulNumDecodeSurfaces = 20U;
while (oVideoDecodeCreateInfo.ulNumDecodeSurfaces * width * height > 16*1024*1024)
{
oVideoDecodeCreateInfo.ulNumDecodeSurfaces--;
}
oVideoDecodeCreateInfo.ChromaFormat = cudaVideoChromaFormat_420;
oVideoDecodeCreateInfo.OutputFormat = cudaVideoSurfaceFormat_NV12;
oVideoDecodeCreateInfo.DeinterlaceMode = cudaVideoDeinterlaceMode_Adaptive;
// No scaling
oVideoDecodeCreateInfo.ulTargetWidth = oVideoDecodeCreateInfo.ulWidth;
oVideoDecodeCreateInfo.ulTargetHeight = oVideoDecodeCreateInfo.ulHeight;
oVideoDecodeCreateInfo.ulNumOutputSurfaces = 2; // We won't simultaneously map more than 8 surfaces
oVideoDecodeCreateInfo.ulCreationFlags = cudaVideoCreate_PreferCUDA;
//oVideoDecodeCreateInfo.vidLock = vidCtxLock;
CUresult oResult = cuvidCreateDecoder(decoder_info,&oVideoDecodeCreateInfo);
assert(CUDA_SUCCESS == oResult);
CUresult oResult1 = cuvidDestroyDecoder(decoder_info);
assert(CUDA_SUCCESS == oResult1);
现在我想用来解码一个帧,所以我必须使用函数
CUresult cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS
*pPicParams);
但是在样本或其他地方没有给出解释如何使用该函数我的输入图像用于解码在数据与标题分离后位于BYTE
数组中,所以我有一个{{1}使用此功能从H.264编解码器解码。任何人都可以帮助我。谢谢。