1 /* 2 * Copyright (c) 2019 Linaro Limited. 3 * Copyright (c) 2024 tinyVision.ai Inc. 4 * 5 * SPDX-License-Identifier: Apache-2.0 6 */ 7 #ifndef ZEPHYR_INCLUDE_VIDEO_CONTROLS_H_ 8 #define ZEPHYR_INCLUDE_VIDEO_CONTROLS_H_ 9 10 /** 11 * @file 12 * 13 * @brief Public APIs for Video. 14 */ 15 16 /** 17 * @brief Video controls 18 * @defgroup video_controls Video Controls 19 * @ingroup io_interfaces 20 * 21 * The Video control IDs (CIDs) are introduced with the same name as 22 * Linux V4L2 subsystem and under the same class. This facilitates 23 * inter-operability and debugging devices end-to-end across Linux and 24 * Zephyr. 25 * 26 * This list is maintained compatible to the Linux kernel definitions in 27 * @c linux/include/uapi/linux/v4l2-controls.h 28 * 29 * @{ 30 */ 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /** 37 * @name Base class control IDs 38 * @{ 39 */ 40 #define VIDEO_CID_BASE 0x00980900 41 42 /** Amount of perceived light of the image, the luma (Y') value. */ 43 #define VIDEO_CID_BRIGHTNESS (VIDEO_CID_BASE + 0) 44 45 /** Amount of difference between the bright colors and dark colors. */ 46 #define VIDEO_CID_CONTRAST (VIDEO_CID_BASE + 1) 47 48 /** Colorfulness of the image while preserving its brightness */ 49 #define VIDEO_CID_SATURATION (VIDEO_CID_BASE + 2) 50 51 /** Shift in the tint of every colors, clockwise in a RGB color wheel */ 52 #define VIDEO_CID_HUE (VIDEO_CID_BASE + 3) 53 54 /** Amount of time an image sensor is exposed to light, affecting the brightness */ 55 #define VIDEO_CID_EXPOSURE (VIDEO_CID_BASE + 17) 56 57 /** Amount of amplification performed to each pixel electrical signal, affecting the brightness */ 58 #define VIDEO_CID_GAIN (VIDEO_CID_BASE + 19) 59 60 /** Flip the image horizontally: the left side becomes the right side */ 61 #define VIDEO_CID_HFLIP (VIDEO_CID_BASE + 20) 62 63 /** Flip the image vertically: the top side becomes the bottom side */ 64 #define VIDEO_CID_VFLIP (VIDEO_CID_BASE + 21) 65 66 /** Frequency of the power line to compensate for, avoiding flicker due to artificial lighting */ 67 #define VIDEO_CID_POWER_LINE_FREQUENCY (VIDEO_CID_BASE + 24) 68 enum video_power_line_frequency { 69 VIDEO_CID_POWER_LINE_FREQUENCY_DISABLED = 0, 70 VIDEO_CID_POWER_LINE_FREQUENCY_50HZ = 1, 71 VIDEO_CID_POWER_LINE_FREQUENCY_60HZ = 2, 72 VIDEO_CID_POWER_LINE_FREQUENCY_AUTO = 3, 73 }; 74 75 /** Balance of colors in direction of blue (cold) or red (warm) */ 76 #define VIDEO_CID_WHITE_BALANCE_TEMPERATURE (VIDEO_CID_BASE + 26) 77 78 /** 79 * @} 80 */ 81 82 /** 83 * @name Stateful codec controls IDs 84 * @{ 85 */ 86 #define VIDEO_CID_CODEC_CLASS_BASE 0x00990900 87 88 /** 89 * @} 90 */ 91 92 /** 93 * @name Camera class controls IDs 94 * @{ 95 */ 96 #define VIDEO_CID_CAMERA_CLASS_BASE 0x009a0900 97 98 /** Amount of optical zoom applied through to the camera optics */ 99 #define VIDEO_CID_ZOOM_ABSOLUTE (VIDEO_CID_CAMERA_CLASS_BASE + 13) 100 101 /** 102 * @} 103 */ 104 105 /** 106 * @name Camera Flash class control IDs 107 * @{ 108 */ 109 #define VIDEO_CID_FLASH_CLASS_BASE 0x009c0900 110 111 /** 112 * @} 113 */ 114 115 /** 116 * @name JPEG class control IDs 117 * @{ 118 */ 119 #define VIDEO_CID_JPEG_CLASS_BASE 0x009d0900 120 121 /** Quality (Q) factor of the JPEG algorithm, also increasing the data size */ 122 #define VIDEO_CID_JPEG_COMPRESSION_QUALITY (VIDEO_CID_JPEG_CLASS_BASE + 3) 123 124 /** 125 * @} 126 */ 127 128 /** 129 * @name Image Source class control IDs 130 * @{ 131 */ 132 #define VIDEO_CID_IMAGE_SOURCE_CLASS_BASE 0x009e0900 133 134 /** 135 * @} 136 */ 137 138 /** 139 * @name Image Processing class control IDs 140 * @{ 141 */ 142 #define VIDEO_CID_IMAGE_PROC_CLASS_BASE 0x009f0900 143 144 /** Pixel rate (pixels/second) in the device's pixel array. This control is read-only. */ 145 #define VIDEO_CID_PIXEL_RATE (VIDEO_CID_IMAGE_PROC_CLASS_BASE + 2) 146 147 /** Selection of the type of test pattern to represent */ 148 #define VIDEO_CID_TEST_PATTERN (VIDEO_CID_IMAGE_PROC_CLASS_BASE + 3) 149 150 /** 151 * @} 152 */ 153 154 /** 155 * @name Vendor-specific class control IDs 156 * @{ 157 */ 158 #define VIDEO_CID_PRIVATE_BASE 0x08000000 159 160 /** 161 * @} 162 */ 163 164 #ifdef __cplusplus 165 } 166 #endif 167 168 /** 169 * @} 170 */ 171 172 #endif /* ZEPHYR_INCLUDE_VIDEO_H_ */ 173