I am trying to use the CUDA structure CUVIDPICPARAMS according to my needs. I want to decode only one byte at a time and has my own input data from the video. Here is how i am defining the struct to use as
CUVIDPICPARAMS pPictureParameters;
CUvideodecoder decoder_info;
CUVIDDECODECREATEINFO oVideoDecodeCreateInfo;
memset(&oVideoDecodeCreateInfo, 0, sizeof(CUVIDDECODECREATEINFO));
oVideoDecodeCreateInfo.CodecType = cudaVideoCodec_H264;// 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 result = cuvidDecodePicture();
int nDestPitch = width*4;
CUdeviceptr pDevPtr[2] = {0,0};
unsigned int pPitch = 0;
pPictureParameters.CurrPicIdx = 1;
pPictureParameters.field_pic_flag = 0;
pPictureParameters.PicWidthInMbs = (width+15)/16;
pPictureParameters.FrameHeightInMbs = (height+15)/16;
pPictureParameters.pBitstreamData = input_image;
pPictureParameters.nBitstreamDataLen = Datasize;
//pPictureParameters.pSliceDataOffsets = 0;
pPictureParameters.nNumSlices = pPictureParameters.FrameHeightInMbs;
pPictureParameters.pSliceDataOffsets = 0;
//pPictureParameters.CodecSpecific.
//pPictureParameters.bottom_field_flag = 0;
CUresult result = cuvidDecodePicture(decoder_info,&pPictureParameters);
assert(CUDA_SUCCESS == result);
I want to decode a single BYTE frame at a second so initializing the pic parameters. But i cannot initialize the H264 and other codec values. Can anybody help me out here in this situation. I am getting CUDA error of invalid value. Thank you.