@VickNV
Can you share us with the jpgenc supported input format list? Which document cover those kinds of info?
Anyway as your suggestion, I have updated cmdline.c to try to support YUV422. The patch part is showing below.
diff --git a/nvmedia/img_jpgenc/cmdline.c b/nvmedia/img_jpgenc/cmdline.c
index 3de3ddc..871ac3f 100644
--- a/nvmedia/img_jpgenc/cmdline.c
+++ b/nvmedia/img_jpgenc/cmdline.c
@@ -20,7 +20,7 @@ void PrintUsage()
LOG_MSG("Options:\n");
LOG_MSG("-h Prints usage\n");
LOG_MSG("-f [file] Input image file. \n");
- LOG_MSG(" Input file should be in YUV420 with UV order\n");
+ LOG_MSG(" Input file should be in YUV422 with UV order\n");
LOG_MSG("-fr [WxH] Input file resolution\n");
LOG_MSG("-q [value] JPEG Encoder quality (1..100)\n");
LOG_MSG("-of [file] Output JPEG file. \n");
@@ -40,7 +40,7 @@ int ParseArgs(int argc, char **argv, TestArgs *args)
// Defaults
args->maxOutputBuffering = 5;
args->quality = 50;
- NVM_SURF_FMT_SET_ATTR_YUV(surfFormatAttrs,YUV,420,SEMI_PLANAR,UINT,8,PL);
+ NVM_SURF_FMT_SET_ATTR_YUV(surfFormatAttrs,YUV,422,SEMI_PLANAR,UINT,8,PL);
args->inputSurfType = NvMediaSurfaceFormatGetType(surfFormatAttrs, NVM_SURF_FMT_ATTR_MAX);
//init crcoption
args->crcoption.crcGenMode = NVMEDIA_FALSE;
After build the new version nvmimg_jpgenc and feed it with sample_1920x1080_yuv422p.yuv, we got follow error message. Seems it doesn’t work well.
There are maybe three reasons:
- Our own code modification is not completely. Do we miss some parts?
- Currently YUV422 to JPEG isn’t supported for DRIVE OS 5.2.0? Will be supported latter DRIVE OS version?
- current JPEG hardware engine limitation?
~$ ./nvmimg_jpgenc -f sample_1920x1080_yuv422p.yuv -fr 1920x1080 -of sample_1920x1080_2.jpg -q 75 -v 3
nvmedia: main: NvMediaDeviceCreate
nvmedia: main: Encode start from frame 0, imageSize=3110400
nvmedia: main: NvMediaIJPECreate, 0x420070
nvmedia: main: Reading YUV frame 0 from file sample_1920x1080_yuv422p.yuv to image surface location: 0x41f8c0. (W:1920, H:1080)
nvmedia: main: ReadYUVFrame 0/0 done
nvmedia: main: Encoding frame #0
nvmedia: ERROR: main: NvMediaIJPEFeedFrameQuality failed: 7
nvmedia: main: Destroying device
sample_1920x1080_yuv420p.yuv (3.0 MB) : original YUV420P 1920x1080 input file.
sample_1920x1080_yuv422p.yuv (4.0 MB) : original YUV422P 1920x1080 input file.
: original JPEG 1920x1080 input file.
Just as like you did jpgenc on your side, per frame encoding time cost is somehow too high. We assuming it should be less than 1 ms or even more faster. It doesn’t make sense that per frame encoding cost more than 2ms . Right?
Is there possible to monitor JPEGenc processing hot point? Then we could locate where is the bottleneck.