NVIDIA / cuda-samples

Samples for CUDA Developers which demonstrates features in CUDA Toolkit
Other
6.37k stars 1.81k forks source link

nvjpegEncodeYUV NVJPEG_STATUS_INVALID_PARAMETER #23

Open gangdelian opened 4 years ago

gangdelian commented 4 years ago

Hi, I use the sample named nvJPEG_encoder, and I use NVJPEG_CSS_GRAY as subsampling format to encode an image size(4x16), will get below error: CUDA error at d:\cppworkspace\cuda-samples\samples\nvjpeg_encoder\nvjpeg_encoder.cpp:200 code=2(NVJPEG_STATUS_INVALID_PARAMETER) "nvjpegEncodeYUV(nvjpeg_handle, encoder_state, encode_params, &imgdesc, subsampling, widths[0], heights[0], NULL)" I found if use the image width smaller than 8, use NVJPEG_CSS_GRAY encode an image will fail. Is there some limits when encode an image?

maheshkha commented 4 years ago

Hi, Can you attached the sample images where you seen this error.

For quick debugging, just add these line at nvJPEG_encoder.cpp:193

subsampling = NVJPEG_CSS_GRAY;
checkCudaErrors(nvjpegEncoderParamsSetSamplingFactors(encode_params, NVJPEG_CSS_GRAY, NULL));

Test it, let me now your finding.

gangdelian commented 4 years ago

This is my test project, hope it will help you.

At 2019-11-26 06:18:28, "Mahesh Khadatare" notifications@github.com wrote:

Hi, Can you attached the sample images where you seen this error.

For quick debugging, just add these line at nvJPEG_encoder.cpp:193

subsampling = NVJPEG_CSS_GRAY; checkCudaErrors(nvjpegEncoderParamsSetSamplingFactors(encode_params, NVJPEG_CSS_GRAY, NULL));

Test it, let me now your finding.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

从网易163邮箱发来的云附件 nvJPEG_encoder.zip (29.32M, 2019年12月11日 17:47 到期) 下载

gangdelian commented 4 years ago

Hi, Can you attached the sample images where you seen this error.

For quick debugging, just add these line at nvJPEG_encoder.cpp:193

subsampling = NVJPEG_CSS_GRAY;
checkCudaErrors(nvjpegEncoderParamsSetSamplingFactors(encode_params, NVJPEG_CSS_GRAY, NULL));

Test it, let me now your finding.

you can also download my test project from here

maheshkha commented 4 years ago

Hi, Can you attached the sample images where you seen this error. For quick debugging, just add these line at nvJPEG_encoder.cpp:193

subsampling = NVJPEG_CSS_GRAY;
checkCudaErrors(nvjpegEncoderParamsSetSamplingFactors(encode_params, NVJPEG_CSS_GRAY, NULL));

Test it, let me now your finding.

you can also download my test project from here

Hi,

I've checked the code nvJPEG_encoder.cpp:line 197 change to subsampling variable.

checkCudaErrors(nvjpegEncodeYUV(nvjpeg_handle,
                    encoder_state,
                    encode_params,
                    &imgdesc,
                    subsampling,
                    widths[0],
                    heights[0],
                    NULL));

Tested encoder with following input arguments on GV100: -i img1.jpg (4x4, Sampling 4:2:0) -o /tmp/ -s 400 // for GRAY conversion

Input image details: File Name : img1.jpg File Size : 695 bytes Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 4x4

Output image details: File Name : img1.jpg File Size : 357 bytes Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 1 Image Size : 4x4

gangdelian commented 4 years ago

Hi, Can you attached the sample images where you seen this error. For quick debugging, just add these line at nvJPEG_encoder.cpp:193

subsampling = NVJPEG_CSS_GRAY;
checkCudaErrors(nvjpegEncoderParamsSetSamplingFactors(encode_params, NVJPEG_CSS_GRAY, NULL));

Test it, let me now your finding.

you can also download my test project from here

Hi,

I've checked the code nvJPEG_encoder.cpp:line 197 change to subsampling variable.

checkCudaErrors(nvjpegEncodeYUV(nvjpeg_handle,
                  encoder_state,
                  encode_params,
                  &imgdesc,
                  subsampling,
                  widths[0],
                  heights[0],
                  NULL));

Tested encoder with following input arguments on GV100: -i img1.jpg (4x4, Sampling 4:2:0) -o /tmp/ -s 400 // for GRAY conversion

Input image details: File Name : img1.jpg File Size : 695 bytes Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 4x4

Output image details: File Name : img1.jpg File Size : 357 bytes Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 1 Image Size : 4x4

Yes, I want to encode to a gray image. So I specify NVJPEG_CSS_GRAY as subsampling. You can also test my new demo from here,the img1.jpg which i convert to 4x4 gray image,and will get following errors: image

maheshkha commented 4 years ago

Hi, Can you attached the sample images where you seen this error. For quick debugging, just add these line at nvJPEG_encoder.cpp:193

subsampling = NVJPEG_CSS_GRAY;
checkCudaErrors(nvjpegEncoderParamsSetSamplingFactors(encode_params, NVJPEG_CSS_GRAY, NULL));

Test it, let me now your finding.

you can also download my test project from here

Hi, I've checked the code nvJPEG_encoder.cpp:line 197 change to subsampling variable.

checkCudaErrors(nvjpegEncodeYUV(nvjpeg_handle,
                    encoder_state,
                    encode_params,
                    &imgdesc,
                    subsampling,
                    widths[0],
                    heights[0],
                    NULL));

Tested encoder with following input arguments on GV100: -i img1.jpg (4x4, Sampling 4:2:0) -o /tmp/ -s 400 // for GRAY conversion Input image details: File Name : img1.jpg File Size : 695 bytes Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 4x4 Output image details: File Name : img1.jpg File Size : 357 bytes Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 1 Image Size : 4x4

Yes, I want to encode to a gray image. So I specify NVJPEG_CSS_GRAY as subsampling. You can also test my new demo from here,the img1.jpg which i convert to 4x4 gray image,and will get following errors: image

This error due to source image plane pitch is not divisible by 8. In current GPU implementation source image plane should be divisible by 8 to achieve GPU speedup.

gangdelian commented 4 years ago

Hi, Can you attached the sample images where you seen this error. For quick debugging, just add these line at nvJPEG_encoder.cpp:193

subsampling = NVJPEG_CSS_GRAY;
checkCudaErrors(nvjpegEncoderParamsSetSamplingFactors(encode_params, NVJPEG_CSS_GRAY, NULL));

Test it, let me now your finding.

you can also download my test project from here

Hi, I've checked the code nvJPEG_encoder.cpp:line 197 change to subsampling variable.

checkCudaErrors(nvjpegEncodeYUV(nvjpeg_handle,
                  encoder_state,
                  encode_params,
                  &imgdesc,
                  subsampling,
                  widths[0],
                  heights[0],
                  NULL));

Tested encoder with following input arguments on GV100: -i img1.jpg (4x4, Sampling 4:2:0) -o /tmp/ -s 400 // for GRAY conversion Input image details: File Name : img1.jpg File Size : 695 bytes Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 3 Y Cb Cr Sub Sampling : YCbCr4:2:0 (2 2) Image Size : 4x4 Output image details: File Name : img1.jpg File Size : 357 bytes Encoding Process : Baseline DCT, Huffman coding Bits Per Sample : 8 Color Components : 1 Image Size : 4x4

Yes, I want to encode to a gray image. So I specify NVJPEG_CSS_GRAY as subsampling. You can also test my new demo from here,the img1.jpg which i convert to 4x4 gray image,and will get following errors: image

This error due to source image plane pitch is not divisible by 8. In current GPU implementation source image plane should be divisible by 8 to achieve GPU speedup.

Thanks, hope this limits can be wrote in documents