JPEG Encoder¶
Name¶
jpegenc - jpeg encoding
Description¶
KNEO Pi provides an application called jpegenc designed for JPEG encoding demostrations. This application reads a YUV file and encode it into a jpeg file.
Before starting the encoding process, ensure the appropriate drivers are loaded.
Configuration File (config.ini)¶
- inputpath: Path to the input YUV file.
- outputpath: Path where the encode jpeg file will be saved.
- img_width: input frame width.
- img_height: input frame height.
- img_qp: output frame quantization parameter. Valid range is 0 ~ 200. Smaller value means better picture quality.
inputpath = "sample_1920x1080.yuv"
outputpath = "sample_1920x1080.jpg"
img_width = 1920
img_height = 1080
img_qp = 100
Use the following command to start the encoding process:
Build Example¶
Use ${kneopi-example}/hardware_control/${example}/build.sh script to compile the binary.
Synopsis¶
The JPEG encode sample uses VMF_SNAP_ProcessOneFrame_YUV and VMF_SNAP_CROP_PARAMS_T. It reads a YUV frame, fills VMF_SNAP_CROP_PARAMS_T with the output buffer/size, crop rectangle (dwStartX, dwStartY, dwCropWidth, dwCropHeight), and quality (dwQp), then calls VMF_SNAP_ProcessOneFrame_YUV(ssm, &crop) to encode. On success, the function returns the JPEG size (bytes) and writes the encoded image into pOutBuffer.
The simple encoder app flow is shown below:

Options¶
-c Specify the encoding configuration file
Example¶
To decode the specified video file according to the parameters defined in the config.ini file and output a YUV file