K510 V4L2 Developer's Guide
Document version: V1.0.0
Published: 2022-03-09
Disclaimer The products, services or features you purchase shall be subject to the commercial contracts and terms of Beijing Canaan Jiesi Information Technology Co., Ltd. ("the Company", the same hereinafter), and all or part of the products, services or features described in this document may not be within the scope of your purchase or use. Except as otherwise agreed in the contract, the Company disclaims all representations or warranties, express or implied, as to the accuracy, reliability, completeness, marketing, specific purpose and non-aggression of any representations, information, or content of this document. Unless otherwise agreed, this document is provided as a guide for use only. Due to product version upgrades or other reasons, the contents of this document may be updated or modified from time to time without any notice.
Trademark Notices
"", "Canaan" icon, Canaan and other trademarks of Canaan and other trademarks of Canaan are trademarks of Beijing Canaan Jiesi Information Technology Co., Ltd. All other trademarks or registered trademarks that may be mentioned in this document are owned by their respective owners.
Copyright ©2022 Beijing Canaan Jiesi Information Technology Co., Ltd This document is only applicable to the development and design of the K510 platform, without the written permission of the company, no unit or individual may disseminate part or all of the content of this document in any form.
Beijing Canaan Jiesi Information Technology Co., Ltd URL: canaan-creative.com Business Enquiries: [email protected]
# preface **Document purpose** This document is an explanatory document for the K510 V4L2 application example.Reader Objects
The main people to whom this document (this guide) applies:
- Software developers
- Technical support personnel
Revision history The revision history accumulates a description of each document update. The latest version of the document contains updates for all previous versions.
The version number | Modified by | Date of revision | Revision Notes |
---|---|---|---|
V1.0.0 | System software groups | 2022-03-09 | SDK V1.5 released |
v1.0.1 | Zhu Dalei | 2022-03-11 | SDK V1.5 released |
[TOC]
#include “media_ctl.h”
struct video_info {
unsigned int video_used;
char *video_name[4];
unsigned int enable[4];
unsigned int video_width[4];
unsigned int video_height[4];
unsigned int video_out_format[4];
};
int mediactl_init(char *video_cfg_file,struct video_info *dev_info);
Initialize media.
参数:
[in] video_cfg_file: video的配置文件,这个文件的内容只需关心下面解释的内容,具体解释如下。
sensor0_name:只在V4L2驱动中设置的sensor驱动名字。
sensor0_cfg_file:sensor对应的isp参数配置文件名字,如imx219_0.conf。
sensor0_total_width:sensor输出的水平方向的总像素,用来产生VSYNC信号,如3476
sensor0_total_height:sensor输出的总行数,用来产生HSYNC信号,如1166
sensor0_active_width:sensor输出的水平方向的有效像素,如1920,
sensor0_active_height:sensor输出的有效行数,如1080
video2_used:1 -- 使能,0 -- 没有使用。
video2_width:video输出的宽度,如1920。
video2_height:video输出的高度,如1080。
video2_out_format:1--指YUV420,NV21。
video3_used:1 -- 使能,0 -- 没有使用。
video3_width:video输出的宽度,如1080。
video3_height:video输出的高度,如720。
video3_out_format:1--指YUV420,NV21。
video4_used:1 -- 使能,0 -- 没有使用。
video4_width:video输出的宽度,如640。
video4_height:video输出的高度,如480。
video4_out_format:1--指YUV420,NV21。
video5_used:1 -- 使能,0 -- 没有使用。
video5_width:video输出的宽度,如320。
video5_height":video存储的高度,如320。
video5_height_r:video输出的高度,如240。
video5_out_format:0--指分离RGB,1--指ARGB。
sensor1_name:只在V4L2驱动中设置的sensor驱动名字。
sensor1_cfg_file:sensor对应的isp参数配置文件名字,如imx219_0.conf。
sensor1_total_width:sensor输出的水平方向的总像素,用来产生VSYNC信号,如3476
sensor1_total_height:sensor输出的总行数,用来产生HSYNC信号,如1166
sensor1_active_width:sensor输出的水平方向的有效像素,如1920,
sensor1_active_height:sensor输出的有效行数,如1080
video6_used:1 -- 使能,0 -- 没有使用。
video6_width:video输出的宽度,如1920。
video6_height:video输出的高度,如1080。
video6_out_format:1--指YUV420,NV21。
video7_used:1 -- 使能,0 -- 没有使用。
video7_width:video输出的宽度,如1080。
video7_height:video输出的高度,如720.
video7_out_format:1--指YUV420,NV21。
video8_used:1 -- 使能,0 -- 没有使用。
video8_width:video输出的宽度,如640。
video8_height:video输出的高度,如480。
video8_out_format:1--指YUV420,NV21。
video9_used:1 -- 使能,0 -- 没有使用。
video9_width:video输出的宽度,如320。
video9_height:video存储的宽度,如320。
video9_height_r:video输出的高度,如240。
video9_out_format:0--指分离RGB,1--指ARGB。
[out] dev_info: mediactl_lib返回从video的配置文件得到的video信息,具体的解释如下。
video_used:这里是指ISP的pipeline,如果使用就会返回1,否则0。K510支持ISP_F2K/ISP_R2K这两个pipeline,每个pipeline最多支持4个video输出。
video_name[4]:返回的video的名字。f2k的四个video是video2/video3/video4/video5;r2k的四个video是 video6/video7/video8/video9
enable[4]:返回的每个video是否使能,1 -- 使能,0 -- 没有使用。
video_width[4]:返回的每个video的宽度。
video_height[4]:返回的每个video的高度。
video_out_format[4]:返回的每个video的输出图像格式,具体见《video的配置文件》的解释。
具体使用方法如下:
char *video_cfg_file = "video_cfg";
struct video_info dev_info[2]
mediactl_init(video_cfg_file,&dev_info)
0 成功, -1 失败.
Shut down the media device and free up the requested share memory memory.
参数:
无
enum isp_pipeline_e {
ISP_F2K_PIPELINE,
ISP_R2K_PIPELINE,
ISP_TOF_PIPELINE
};
int mediactl_set_ae(enum isp_pipeline_e pipeline);
Configure the AE value of the sensor
参数:
ISP_F2K_PIPELINE:配置f2k pipeline的AE。
ISP_R2K_PIPELINE:配置r2k pipeline的AE。
ISP_TOF_PIPELINE:没有使用。
enum isp_modules {
ISP_TPG,
ISP_BLC,
ISP_LSC,
ISP_AE,
ISP_AWB,
ISP_AWB_D65,
ISP_AWB_CCM,
ISP_WDR,
ISP_RGB_GAMMA,
ISP_YUV_GAMMA,
ISP_ADA,
ISP_ADA_SBZ,
ISP_ADA_CCR,
ISP_RGBIR,
ISP_RAW_2DNR,
ISP_YUV_Y_2DNR,
ISP_YUV_UV_2DNR,
ISP_3DNR,
ISP_LTM,
ISP_SHARP,
ISP_CC,
ISP_CTRST,
ISP_LUMA,
ISP_SATURATION,
ISP_LDC,
ISP_AF,
};
unsigned int mediactl_get_isp_modules(enum isp_pipeline_e pipeline,enum isp_modules module);
Gets the enable status of each module of the ISP.
参数:
isp_pipeline_e:具体见mediactl_set_ae中的解释。
isp_modules:
ISP_TPG -- Test Pattern Control模块
ISP_BLC -- Black Level Correction模块
ISP_LSC -- Lens Shading Correction模块
ISP_AE -- AUTO Exposure Gain模块
ISP_AWB -- AUTO white balance模块
ISP_AWB_D65 -- AUTO white balance d65模块
ISP_AWB_CCM -- AUTO white balance ccm模块
ISP_WDR -- wide dynamic range模块
ISP_RGB_GAMMA -- rgb gamma模块
ISP_YUV_GAMMA -- yuv gamma模块
ISP_ADA -- Adaptive dynamic range adjust模块
ISP_ADA_SBZ -- Image stabilization模块
ISP_ADA_CCR -- Color correction模块
ISP_RGBIR -- rgbir rectify模块
ISP_RAW_2DNR -- raw域2D降噪模块
ISP_YUV_Y_2DNR -- yuv域2D Y方向降噪模块
ISP_YUV_UV_2DNR -- yuv域2D uv方向降噪模块
ISP_3DNR -- yuv域3D降噪模块
ISP_LTM -- local tone mapping模块
ISP_SHARP -- sharpness模块
ISP_CC -- color correction模块
ISP_CTRST -- contrast adjust模块
ISP_LUMA -- luma adjust模块
ISP_SATURATION -- saturation adjust 模块
ISP_LDC -- lens Distortion Correction模块
ISP_AF -- ATUO FOCUS模块
0 -- 模块没有使能 1 -- 模块使能
The program is placed/app/mediactl_lib
in the directory:
v4l2_drm.out
:v4l2 and drm linkage case, added -f to modify the name of the input configuration file, -e to open the isp ae function. You can use -h to view help.
Run v4l2_drm.out
- -e:0 turns off all aes, 1 turns on f-2k ae, 2 turns on r-2k ae, and 3 turns on all aes. By default, you can leave -e to turn off all aes.
- The demo requires the video configuration file and the corresponding sensor configuration file to be in the current directory.
- The demo can demonstrate single and double cameras by changing the configuration file.
- The demo demo single-camera full screen: ./v4l2_drm.out -e 1 -f video_drm_1080x1920.conf
- The demo demo dual camera: ./v4l2_drm.out -f video_drm_1920x1080.conf
- The demo must ensure that three profiles video_drm_1920x1080.conf, imx219_0.conf, and imx219_1.conf exist
Translation Disclaimer
For the convenience of customers, Canaan uses an AI translator to translate text into multiple languages, which may contain errors. We do not guarantee the accuracy, reliability or timeliness of the translations provided. Canaan shall not be liable for any loss or damage caused by reliance on the accuracy or reliability of the translated information. If there is a content difference between the translations in different languages, the Chinese Simplified version shall prevail.
If you would like to report a translation error or inaccuracy, please feel free to contact us by mail.