Jetson_multimedia_api jpeg encode encoding Issue on Jetson AGX orin JP 5.1.3

Hi,
I added the continuous yuv data jpeg encoding function in the 05_jpeg_encode sample of Jetson_Multimedia_API_R35.5.0_aarch64.tbz2. The code is in the attachment 05_jpeg_encode.zip
05_jpeg_encode.zip (6.5 MB). I found that only the first frame can be encoded correctly, and all subsequent encodings are wrong. Execute the command ./jpeg_encode yuv420_1920_1536.yuv 1920 1536 test.jpg --encode-buffer --perf
It prints as follows:

pegasus@pegasus-ubuntu-3:~/workspace/jetson_multimedia/jetson_multimedia_api_v513/samples/05_jpeg_encode$ ./jpeg_encode yuv420_1920_1536.yuv 1920 1536 test.jpg --encode-buffer --perf

NvMMLiteBlockCreate : Block : BlockType = 1
out_file_name: output_1920_1536_0.jpg out_size: 187012
out_file_name: output_1920_1536_1.jpg out_size: 18446744069414771811
out_file_name: output_1920_1536_2.jpg out_size: 18446744069414771729
out_file_name: output_1920_1536_3.jpg out_size: 18446744065119804708
Could not read a complete frame from file
----------- Element = jpenenc -----------
Total units processed = 4
Average latency(usec) = 7221
Minimum latency(usec) = 3512
Maximum latency(usec) = 18244

App run failed

The data length from the second frame is wrong,
Can out suggest a workaround for this issue ?

Thanks
Liuyue

Hi,
For information, do yo observe the issue when calling encodeFromFd()? If it is specific to calling encodeFromBuffer(), we would suggest call encodeFromFd() as a quick solution.

Hi,
DaneLLL,Thank you very much for your reply,I have used the encodeFromFd function to replace the encodeFromBuffer function,Modify the code as
05_jpeg_encode.zip (5.9 MB)
,Execute the command ./jpeg_encode yuv420_1920_1536.yuv 1920 1536 test.jpg --perf. The problem still exists. The performance is the same. The first frame is good, but all subsequent frames have errors.

Hi,
Please reset the buffer size before calling encodeFromFd() or encodeFromBuffer():

out_buf_size = ctx.in_width * ctx.in_height * 3 / 2;

Hi,
DaneLLL,Thank you very much for your reply,This modification has solved the problem.

Thanks
Liuyue

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.