Converting jpeg images to avif performance on TX2


We are trying to convert 1920x1080 jpeg images to avif on Jetson TX2 with Jetpack 4.6.2.
Libaom compiled with -DENABLE_TESTS=0 -DENABLE_CCACHE=1 flags.
And using libheif to do the encoding.

It takes about 2 seconds to do the encoding on TX2 with default clock settings and ~1.5 sec after using jetson_clocks script.

Unfortunately 2 seconds is too much and we would like to have sub 1 second encoding times. Ideally even sub 0.5 sec times. One more constraint we have that it will have to work on TX1 (JP 4.6.2) as well.

Any ideas on performance improvement would be much appreciated, in hope that there is some kind of hardware specific lib implementation is available.
Thank you.

Not sure, I don’t have experience with avif format, and not sure if av1 encoder is available with TX2, but using AGX Orin this works:

# Generate a 1920x1080 JPEG test image
gst-launch-1.0 -ev videotestsrc num-buffers=1 ! video/x-raw,width=1920,height=1080,framerate=0/1 ! jpegenc ! filesink location=test.jpg

# Decode JPEG and encode into AV1 with HW encoder:
gst-launch-1.0 -ev filesrc location=test.jpg ! image/jpeg,format=I420,width=1920,height=1080,framerate=0/1 ! jpegdec ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080,format=NV12' ! nvv4l2av1enc enable-headers=1 bitrate=1000000 ! filesink location=test.avif
#Or using nvjpegdec:
gst-launch-1.0 -ev filesrc location=test.jpg ! image/jpeg,format=I420,width=1920,height=1080,framerate=0/1 ! nvjpegdec ! 'video/x-raw(memory:NVMM),format=I420' ! nvvidconv ! 'video/x-raw(memory:NVMM),width=1920,height=1080' ! nvv4l2av1enc enable-headers=1 bitrate=1000000 ! filesink location=test.avif

# Test decoding and display:
gst-launch-1.0 filesrc location=test.avif ! video/x-av1,width=1920,height=1080,framerate=0/1 ! decodebin ! nvvidconv ! imagefreeze ! xvimagesink

Hi @Honey_Patouceul. Thank you for advice but unfortunately TX2 doesn’t have nvv4l2av1enc plugin at least with Jetpack 4.6.2.

So, all that I could advise may be:

  • boosting clocks with sudo jetson_clocks
  • try rebuilding Libaom with a llvm version supporting Denver cores architecture. Note that these 2 Denver cores may be isolated from CPU scheduling from linux boot command line, so you may use these using cpu affinity/taskset.

If you need AV1 hardware encoder, please consider use Orin series. For TX2, Jetson Nano, you would need to use software encoder and boost CPU clocks to get maximum throughput, as Honey Patouceul suggests.

This worked as a solution in my case.

heif-enc -p speed=9 -p threads=6 <input_file.jpeg> -o <output_file.avif>

Increasing speed of libaom to 9 dropped the timings to 0.6 ish sec but at a cost of quality.

@DaneLLL unfortunately we can’t switch to Orin but it is awesome hardware.
@Honey_Patouceul I’ll try to rebuild libaom with llvm and will post new answer if there will be any significant gains.

Thank you for your help!

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