NVIDIA Jetson Orin NX 16GB, Jetpack 5.1.2, L4T 35.4.1
When attempting to add JPEG COM markers via jpeg_write_marker() as per libjpeg documentation (called after jpeg_start_compress() but before any scanline writes), the output file gains null padding instead of valid marker data
I try to modify 05_jpeg_encode:
@@ -101,7 +101,10 @@ NvJPEGEncoder::encodeFromFd(int fd, J_COLOR_SPACE color_space,
return -1;
}
- jpeg_start_compress (&cinfo, 0);
+ jpeg_start_compress (&cinfo, 1);
+
+ std::string message = "Hello";
+ jpeg_write_marker(&cinfo, JPEG_COM, (const JOCTET *)(message.c_str()), message.size());
if (cinfo.err->msg_code)
{
File size changes (+11 bytes)
Hex diff shows zero-padding instead of valid marker:
6544c6544
< 000198f0: ffd9 ..
---
> 000198f0: ffd9 0000 0000 0000 0000 0000 00 .............
- Does NVJPEG’s hardware-accelerated encoding support COM/APPn markers?
- If supported: what is the correct implementation pattern?
- If unsupported: are there workarounds while keeping hardware acceleration?