Hi all,
I’m getting a NVJPEG_STATUS_INVALID_PARAMETER when calling nvjpegEncodeYUV under certain circumstances, particularly when the image width is 455:
nvjpegHandle_t nv_handle;
nvjpegEncoderState_t nv_enc_state;
nvjpegEncoderParams_t nv_enc_params;
nvjpegCreateSimple(&nv_handle);
nvjpegEncoderStateCreate(nv_handle, &nv_enc_state, 0);
nvjpegEncoderParamsCreate(nv_handle, &nv_enc_params, 0);
int width = 455;
int height = 333;
void* device_ptr;
cudaMalloc(&device_ptr, width*height*1);
nvjpegImage_t nv_image;
nv_image.channel[0] = (unsigned char*)device_ptr;
nv_image.pitch[0] = width;
nvjpegEncoderParamsSetQuality(nv_enc_params, 70, 0);
nvjpegEncoderParamsSetSamplingFactors(nv_enc_params, NVJPEG_CSS_GRAY, 0);
auto er = nvjpegEncodeYUV(nv_handle, nv_enc_state, nv_enc_params, &nv_image, NVJPEG_CSS_GRAY, width, height, 0);
if(er == NVJPEG_STATUS_INVALID_PARAMETER){
std::cout << "BOOM! unhelpful invalid parameter" << std::endl;
}
size_t length = 0;
nvjpegEncodeRetrieveBitstream(nv_handle, nv_enc_state, NULL, &length, 0);
cudaStreamSynchronize(0);
std::vector<unsigned char> data(length);
nvjpegEncodeRetrieveBitstream(nv_handle, nv_enc_state, data.data(), &length, 0);
It will pass ok when using width 456. Is there some size requirement that I’m unaware of? I can’t find anything in the docs.
(using cuda SDK 11.4.0, Windows, Visual Studio 2017 version 15.9.3, Driver Version 471.11, Quadro P5000)
Cheers