hi ,now i test the 06_jpeg_decode to decode jpeg ,i found when i decode the same jpeg file,the decode-fd decode result is not different with the decode-buffer,use the decode-buffer the yuv color is not normal ,i read the source code ,found maybe the decode-buffer have some bugs about the V4L2_PIX_FMT_YUV422M,because my test jpeg use the decoe-fd result is yuv422
so how can i fix the problem,thanks for your help!!!
Hi,
Please set pixel format to V4L2_PIX_FMT_YUV420M and try again:
/* Set conv output plane format */
ret =
ctx.conv->setOutputPlaneFormat(V4L2_PIX_FMT_YUV420M, width,
height, V4L2_NV_BUFFER_LAYOUT_PITCH);
TEST_ERROR(ret < 0, "Could not set output plane format for conv", cleanup);
/* Set conv capture plane format */
ret =
ctx.conv->setCapturePlaneFormat(V4L2_PIX_FMT_YUV420M, width,
height,
V4L2_NV_BUFFER_LAYOUT_PITCH);
TEST_ERROR(ret < 0, "Could not set capture plane format for conv", cleanup);
hi DaneLLL,thanks for your help,i use the option --decode-buffer,that way do not use the convert ,so i think you say that will be not usefully ,now i can tell you again is that my jpeg file use the decodeToBuffer to decode not normal,but use the decodeToFd way is normal ,but you tell me to test way is the decodeToFd
hi DaneLLL,when i modify the function NvJPEGDecoder::decodeToBuffer like following that can decode normally ,so i want to know that whether will have some effections for the V4L2_PIX_FMT_YUV422M
if (cinfo.comp_info[0].h_samp_factor == 2)
{
if (cinfo.comp_info[0].v_samp_factor == 2)
{
pixel_format = V4L2_PIX_FMT_YUV420M;
}
else
{
pixel_format = V4L2_PIX_FMT_YUV420M;
}
}
hi DaneLLL,thanks for your help ,another question is that when i want to save the decode yuv data for twice in the --decode-fd way,so i add the modify the source code
ret = ctx.conv->output_plane.setupPlane(V4L2_MEMORY_MMAP, 2, true, false);
TEST_ERROR(ret < 0, “Error while setting up output plane for conv”,
cleanup);
/**
* REQBUF and EXPORT conv capture plane buffers
* No need to MAP since buffer will be shared to next component
* and not read in application
*/
ret =
ctx.conv->capture_plane.setupPlane(V4L2_MEMORY_MMAP, 2,
!ctx.use_fd, false);
Then i qBuffer twice the jpeg decode to output_plane like the following code
just call the following twice,buf i found that write dec yuv file still only have decode once data ,so how can i do can get the twice yuv data?
{
struct v4l2_buffer v4l2_buf;
struct v4l2_plane planes[MAX_PLANES];
hi DaneLLL ,because i want to decode from the camara cap jpeg ,so if i want to use the decodeToFd way,so i want to sent the jpeg data to decode ,so i want to how to do like the h264 decode to send the data Continuously
hi DaneLLL,thanks for your help ,now i refer the 12_camera_v4l2_cuda,i decode the jpeg file ,and then use the NvBufferTransform to convert the decode data ,then i call the write_video_frame of the 07_video_convert to write the yuv to file ,but i found at the last yuv file have some mosaic ,but the file size is right ,so why?my jpeg file resolution is 1920*1080,and i test some other resolution jpeg file ,i found some is normal ,some is not normal ,so i do not know how to fix it