How to disable log debug from NvJPEG decode?

Hello, I am using uridecodebin in pipeline deepstream. And perhaps decodebin use NvJPEG for decode the frame from Stream: Video: mjpeg, yuvj420p. And in runtime of pipeline many of log out NvJPEG plugin below show up. How can I disable that log?

...
YUV 4:2:0 chroma subsampling
YUV 4:2:0 chroma subsampling
NvJPEG decode complete
size set = 64
NvJPEG decode complete
YUV 4:2:0 chroma subsampling
size set = 64
NvJPEG decode complete
size set = 64
YUV 4:2:0 chroma subsampling
NvJPEG decode complete
size set = 64
YUV 4:2:0 chroma subsampling
NvJPEG decode complete
size set = 64
NvJPEG decode complete
size set = 64
...

Thank you very much!

Hi,
The log are built in and cannot be disabled from upper application. Looks like you use x86 PC with NVIDIA dGPU? Please share information about your device.

Hi DaneLLL,

Below is my device information:

OS: Ubuntu 18.04.3 LTS x86_64
GPU: Tesla P4 (8GB Memory)
CUDA Version: 10.1
Environment: Docker, deploy with jupyter-lab

Hi,
You may remove

size set = 64

by downloading gst-jpeg package and rebuild libgstnvjpeg.so. The source code is in
https://developer.nvidia.com/embedded/r32-2-3_Release_v1.0/Sources/T186/public_sources.tbz2

The rest two prints are in libnvjpeg.so. We will check to remove them in future releases. Thanks.

Hi,
Please try the attachment.
DS401_x86_TEST_libnvds_lljpegdec.zip (1.03 MB)

Hi DaneLL,

With libnvds_lljpegdec, It was disabled the two rest print log, thank you!.

About

size set = 64

I could not build the libgstnvjpeg.so in my environment using dGPU it build on TEGRA, while the README in source code dont help anymore to build on dGPU.

Would you mind post the library was built too?

Hi,
The source code is also valid for dGPU platforms. Please check
https://docs.nvidia.com/metropolis/deepstream/dev-guide/index.html
Plugin and Library Source Details

Hi DaneLLL,

To remove “set size = 64” log I need to comment line 1319 in file gstjpeg_src/gst-jpeg/gst-jpeg-1.0/ext/jpeg/gstjpegdec.c

...
#if defined (USE_TARGET_GPU)
  gst_buffer_set_size (frame->output_buffer, dec->cinfo.Vendorbuf_Size);
  //g_print ("size set = %ld\n", gst_buffer_get_size(frame->output_buffer));
#endif
...

To build source code, I following instruction in gstjpeg_src/README.txt,

...
2) export NOCONFIGURE=true
3) export CFLAGS="-I/workspace/gstjpeg_src/nv_headers -DUSE_TARGET_GPU"
4) ./autogen.sh
5) ./configure
6) make
...

I change flag -DUSE_TARGET_TEGRA to -DUSE_TARGET_GPU. And continue to run step (4) (5) (6). But received an error when run make

...
gstjpegenc.c:300:22: error: 'struct jpeg_compress_struct' has no member named 'IsVendorbuf'
   if(!jpegenc->cinfo.IsVendorbuf)
                      ^~~~~~~~~~~
gstjpegenc.c: In function 'void gst_video_enc_check_nvfeatures(GstVideoEncoder*, GstVideoCodecState*)':
gstjpegenc.c:356:20: error: 'struct jpeg_compress_struct' has no member named 'IsVendorbuf'
         enc->cinfo.IsVendorbuf = TRUE;
                    ^~~~~~~~~~~
gstjpegenc.c: In function 'void gst_jpegenc_resync(GstNvJpegEnc*)':
gstjpegenc.c:465:39: warning: invalid conversion from 'gpointer {aka void*}' to 'guchar* {aka unsigned char*}' [-fpermissive]
         jpegenc->row[i][j] = g_malloc (width);
                              ~~~~~~~~~^~~~~~~
gstjpegenc.c: In function 'GstFlowReturn gst_jpegenc_handle_frame(GstVideoEncoder*, GstVideoCodecFrame*)':
gstjpegenc.c:489:53: warning: invalid conversion from 'int' to 'GstMemoryFlags' [-fpermissive]
   static GstAllocationParams params = { 0, 0, 0, 3, };
                                                     ^
gstjpegenc.c:498:22: error: 'struct jpeg_compress_struct' has no member named 'IsVendorbuf'
   if(!jpegenc->cinfo.IsVendorbuf)
                      ^~~~~~~~~~~
gstjpegenc.c:509:21: error: 'struct jpeg_compress_struct' has no member named 'IsVendorbuf'
   if(jpegenc->cinfo.IsVendorbuf)
                     ^~~~~~~~~~~
gstjpegenc.c:514:22: error: 'struct jpeg_compress_struct' has no member named 'pVendor_buf'
       jpegenc->cinfo.pVendor_buf = map.data; /* TODO:Try to copy to base[i] and line instead of pNv_buf*/
                      ^~~~~~~~~~~
gstjpegenc.c:544:18: error: 'struct jpeg_compress_struct' has no member named 'outputBuffSize'
   jpegenc->cinfo.outputBuffSize = jpegenc->bufsize + (512 << 10);
                  ^~~~~~~~~~~~~~
gstjpegenc.c:546:67: error: 'struct jpeg_compress_struct' has no member named 'outputBuffSize'
   jpegenc->output_mem = gst_allocator_alloc (NULL, jpegenc->cinfo.outputBuffSize, &params);
                                                                   ^~~~~~~~~~~~~~
gstjpegenc.c:557:40: warning: invalid conversion from 'gint {aka int}' to 'J_DCT_METHOD' [-fpermissive]
   jpegenc->cinfo.dct_method = jpegenc->idct_method;
                               ~~~~~~~~~^~~~~~~~~~~
gstjpegenc.c:559:18: error: 'struct jpeg_compress_struct' has no member named 'bMeasure_ImageProcessTime'
   jpegenc->cinfo.bMeasure_ImageProcessTime = jpegenc->bMeasure_ImageProcessTime;
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
gstjpegenc.c:587:21: error: 'struct jpeg_compress_struct' has no member named 'IsVendorbuf'
   if(jpegenc->cinfo.IsVendorbuf)
...

I realized that in ./autogen and ./configure command overridden the origin Makefile in gstjpeg_src/gst-jpeg/gst-jpeg-1.0/ext/jpeg/Makefile, It was generated by automake.

Here is the origin Makefile

################################################################################
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.
#
################################################################################

CC:= g++
TARGET_NAME:= libnvdsgst_jpegdec.so

OPEN_CV:=0
IS_GST_PLUGIN:=1

SRCS:= gstjpeg.c gstjpegdec.c

CFLAGS:= -fPIC -std=c++11 -ggdb -DUSE_TARGET_GPU -fpermissive -DGPU_ACCELERATE

INC_PATHS:= ../gst-nvbufferpool \
						../../../../../../external/jpeg/libjpeg-8b/ \
						../../../../../../nvutils/nvbufsurface/ \
						/usr/local/cuda/include \
						/usr/local/cuda-10.0/include \
		        ../../utils/nv_csvparser \
		        DS_SRC_ROOT_DIR/src/gst-utils/gstnvdshelper \
		        ../../../../gstnvmeta \
		        ../../../external/3rdparty \
						../../gst-libs/

ifndef BUILD_DVS
INC_PATHS+=	DS_SRC_ROOT_DIR/external/cuda/video_codec_sdk8.0_includes
endif

BUILD_DIR:=../../../../../../deepstream/sdk/build/src/gst-plugins/gst-jpeg

NEEDS_CUDA:=1
NEEDS_NPP:=1

LIBS:= 	-LDS_BUILD_ROOT_DIR/src/gst-utils/gstnvdshelper -lnvdsgst_helper \
	-L../../../external/cuda \
	-L/usr/local/cuda-10.0/lib64 \
	-lrt -ldl -lpthread -lcudart \
 	-L../../../../../../deepstream/sdk/build/libs/ -lnvds_lljpegdec

PACKAGE_BINARY_IN_DS:=1

include ../../../../../../deepstream/sdk/Rules.mk

I have no ideal to fix this, please help me with a clearly instruction to build gstjpeg_src? Thank you very much!

Hi DaneLLL,

I was build successful when comment all gstjpeg_src/gst-jpeg/gst-jpeg-1.0/ext/jpeg/gstjpegenc.c to make sure dont combine gstjpegenc.c source, cause it default always used some field of TEGRA mode.

and add some include dir to CFLAGS:

export CFLAGS="-fPIC -std=c++11 -I/workspace/gstjpeg_src/nv_headers -I/usr/local/cuda-10.1/targets/x86_64-linux/include -I/root/deepstream_sdk_v4.0.1_x86_64/sources/includes -ggdb -DUSE_TARGET_GPU -fpermissive -DGPU_ACCELERATE"

It build successful to some binary files in folder gstjpeg_src/gst-jpeg/ext/jpeg/.libs/

libgstjpeg.exp      libgstjpeg.lai      libgstjpeg.ver      libgstjpeg_la-gstjpegdec.o
libgstjpeg.la       libgstjpeg.so       libgstjpeg_la-gstjpeg.o     libgstjpeg_la-gstjpegenc.o

I used libgstjpeg.so to replace libnvdsgst_jpegdec.so in deepstream lib plugin. Then run with my deepstream app failed by Segmentation fault

Hi,
Please try attachment.
DS401_x86_TEST_libnvdsgst_jpegdec.zip (77.5 KB)

Hi, It worked. Thank you!

I’m currently processing a stream of jpeg images and the following 3 messages per image are a little irritating.

YUV 4:2:2 chroma subsampling
NvJPEG decode complete
size set = 64

I’m looking forward to the release without these messages.
Are there any concrete plans?

Thank