
NvJpg encoder test is used to test nvjpeg library based HW encoder.  
The color format of encoder input should be YUV420.

Steps to build
______________

Build NvJpg encoder from <sdk>\Tests\Multimedia\Sources\Tests\NvJpgEncoder folder using below nact command 

nact platforms=NXFP2 specs=NX BUILD=Release,Develop

Steps to run 
_____________
Run <sdk>\Tests\Outputs\<NX-NXFP2-a32/a64>\Tests\testMultimedia_NvJpgEncoder\<Develop/Release>\testMultimedia_NvJpgEncoder.nsp from Target manager.

Command line parameter : 

--in <yuv file> -width<width > -height<height> --out <Output path> --incrc <Input CRC>  --outcrc <output CRC>

--in <yuv file>       : Input yuv file to encode. 
-width <width>        : Width of input yuv file.
-height <height>      : height of input yuv file.
--out <Output path>   : decoded output yuv file. 
--incrc <Input CRC>   : Input CRC refrence number. (Optional)
--outcrc <output CRC> : Output CRC refrence number. (Optional)
--rgb  <0 or 1>       : 0:when input format is YUV default), 1:when input format is RGB (Optional)
--LoopCount <loop count> :  0: for encoding only one image (default), n: for encoding n number of times same image   (One time nvjpeg initialization check)
          

As mention earlier CRC parameters are optional in test.
without CRC :
    eg : 
    --in C:\temp\Input.yuv -width 640 -height 480 --out C:\temp\output.jpg
    --in sdcard:/Input.yuv  -width 640 -height 480 --out sdcard:/temp/output.jpg
    
     
With CRC :
    To make use of the --incrc/--outcrc or both generate a reference CRC first.
    1. Provide a dummy value as argument in the --incrc/--outcrc and run the test for multiple iterations
        eg --incrc 45 --outcrc 67
    2. Compare the encoded jpeg file and values of input/output CRC(in log)for various iterations and they should be same.
    3. Use the printed CRC as reference value for future test. 
     
    eg :  
    --in C:\temp\Input.yuv -width 640 -height 480 --out C:\temp\output.jpg --incrc 45 --outcrc 67
    --in sdcard:/Input.yuv  -width 640 -height 480 --out sdcard:/temp/output.jpg  --incrc 45 --outcrc 67
    
For rgb : For rgb input file, default its yuv input
    eg : --in C:\temp\Input.yuv -width 640 -height 480 --rgb 1
         --in sdcard:/Input.yuv  -width 640 -height 480 --out sdcard:/temp/output.jpg --rgb 1
    
The encoded output.jpg image will be saved at <Output path>.

Please note:
            1. Encoder HW path doesn't support odd image inputs.
            2. For odd size input test should take SW path.
            2. The tests are restricted for 16x16 to 4kx4K image output