Encoding varying-size and -format images with the same JPEG encoder produces incorrect result in Jetpack 5.1.1

Hi,
Pease check the suggestion in
NvJPEGEncoder cannot be reused for varying size images in JetPack 5.0.2 - #9 by DaneLLL