Missing header file in building hardware-accelerated gstjpeg from source

Hi, everyone,

The current hardware-accelerated gstjpeg library on Jetson TX2 board with L4T R27 does not allow setting image quality in the jpeg encoding process, even though in the source code gstjpegenc.c there is a line:


I am trying to modify gstjpeg library slightly so that I can set the image compression quality during the encoding process. My first step is trying to compile the original gstjpeg library without any modification. I followed the instructions from this link: https://devtalk.nvidia.com/default/topic/1009988/jetson-tk1/building-hardware-accelerated-gstjpeg-from-source-/post/5153576/

During compilation, I received the following error:

fatal error: gstnvexifmeta.h: No such file or directory

I have two questions:

  1. Where can I find gstnvexifmeta.h?
  2. Once I have modified and built my own gstjpeg library, how do I install it?

Many thanks!

You should be abe to set quality:
gst-launch-1.0 videotestsrc num-buffers=1 ! ‘video/x-raw, width=(int)1920, height=(int)1080’ ! nvvidconv ! ‘video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=I420’ ! nvjpegenc quality=90 ! filesink location=test.jpg

The build error of gst-jpeg is an issue in r27.1, and will be fixed in next release.

Hi, DaneLLL,

Thank you very much for your reply!

I am not using Gstreamer in my application. Instead I am writing my own C/C++ code following examples given in the Multimedia API samples. Here is my code snippet:

// create JPEG encoder
    g_JpegEncoder = NvJPEGEncoder::createJPEGEncoder("jpenenc");
    // JPEG image encode
    g_JpegEncoder->encodeFromFd(buffer->planes[0].fd, JCS_YCbCr, &g_Buffer, size);
    // save JPEG image to a file
    outputFile->write((char *)g_Buffer, size);

In this situation, how do I pass in the image quality in these functions calls? The Multimedia API documentation on NvJPEGEncoder Class does not expose image quality as a parameter.

I look forward to your answer to this question. Thanks for your help!

Please implement it in NvJPEGEncoder by calling jpeg_set_quality() in tegra_multimedia_api\include/libjpeg-8b/jpeglib.h

Hi, DaneLLL,

Thank you for the quick response!

Your answer is exactly what I was trying to do in the first place: to modify NvJPEGEncoder class source code so that image quality is exposed as a function call parameter. However, I cannot even compile the original library, let alone modifying the source code!

Also, I have found NvJpegEncoder.h file, but I cannot find NvJpegEncoder.cpp source file. Where can I find this and other related source files?

It should be at ~/tegra_multimedia_api/samples/common/classes/NvJpegEncoder.cpp. No?

Yes! I found it! Thank you very much!!!