Camera Sensor Driver

Source: Internet
Author: User


Transferred from: http://blog.163.com/ac952_hmz/blog/static/947915132012101287284/


Drivers, three-point hardware, three-point format, four-point software.
In mobile phones, we often refer to the camera directly as sensor, the Spreadtrum platform sensor is like LCD, is already very mature. Follow the previous pattern, first introduce the basic knowledge of hardware.
I. Types of sensor
In fact, this for the driver is basically slightly known to be able to, in the kind of said to know is in the said sensor professional ranking this degree is OK. In general, sensor has two main categories, CMOS and CCD.
In general, the CCD high power consumption, high shooting quality, high cost, he is more suitable for use in digital cameras or DV, and our cell phone, in the pixel requirements are not harsh, but the space and cost have higher requirements, generally will choose CMOS camera. It works simply by receiving external light and converting it into electrical energy, and then converting the acquired image signal to a digital signal output via a die-to-analog converter (ADC) on the chip.
Second, the sensor output format
Similarly, the output format of sensor is not single, can be divided into YUV, JPEG, RGB, RAW, these several formats.
1. YUV
"Y" indicates luminance (luminance, Luma), "U" and "V" are chroma, concentration (chrominance, Chroma), in general the sensor supports the YUV422 format, i.e. the data format is output in y-u-y-v order.
2. JPEG
This does not need to be introduced, as a storage format it is very common, but as the output format of sensor, is generally low-resolution, its own JPEG engine, you can directly output the compressed JPG format data
3. RGB
The traditional red-green-blue format, such as RGB565. Popular Point said its color mixing way is like red, green, blue three lights, when their light overlapping, color mix, and brightness is equal to the sum of the brightness of the two, the more mixing brightness is higher, that is, the addition of mixed.
4. RAW
The image sensor converts the captured light source signal into the original data of the digital signal. Raw files are the raw information that records the sensor of a digital camera, while recording some of the original data (Metadata such as ISO settings, shutter speed, aperture value, white balance, etc.) produced by the camera. Raw is an unprocessed, uncompressed format that can conceptualize raw as "RAW image encoded data" or more visually called "Digital negatives".
Well, after describing their output format, we have a kind of question, which format should I choose as output?
For the Spreadtrum platform, sensor output format is generally YUV, his process is: The original camera data should be raw to record, the data may be raw RGB to represent, and then the sensor module inside the ISP will convert the data into YUV format output, Output to our AP inside the DSP will convert the YUV format to RGB, and then on the output to the screen, if it is filmed by the DSP will be converted to the format of JPEG storage.
This makes us very difficult to understand, since the ability to output RGB format data, why after several setbacks, conversion to convert, time-consuming and laborious. Here we are going to make a trade-off between photo quality and processing speed.
First of all, if the amount of data is the smallest, then the raw format, but the data transfer to pass through a large number of calculations to extract the information inside, if you want to use, generally more than 5M sensor output raw data to ensure a relatively fast output speed, The back end hangs a DSP to process the output data. The second is JPEG, the amount of data is also very small, but also requires a faster processing speed.
And the RGB and YUV a pixel is occupied 2B size, but RGB can read out the data directly to the screen, why should choose YUV it. The reason is that the YUV output brightness signal does not have any loss, and the color bias signal human eye is not particularly sensitive, RGB565 output format is R5G3 g3b5 will lose a lot of raw information, so YUV image quality and stability is much better than RGB565.
Then, although the default is YUV on the Spreadtrum platform, it is not that he is the best or immutable, we have to choose the world according to different circumstances of the output format.
Say the schema format, very fixed, first in the SENSOR_CFG.C declare and define a sensor_info_t structure pointer, and then you can implement your driver code in the specific sensor_***.c.
Debugging sensor common problems:
1. ID not read: Need to confirm the polarity of three power, power down and reset, MCLK,I2C is open normally. If this information is confirmed to be correct, it cannot be read that the ID basically confirms that the sensor is a hardware problem.
2. Can read the ID but not light: this is the most common situation, this is the time has been able to confirm that the above hardware signal is normal, first of all to see whether the HS/VS/PCLK polarity is configured correctly, whether the preview is lost before 1 frames, sensor output size is correct. These usually require the datasheet of the sensor to see if the register is configured correctly.
3. Photo crash: To confirm whether the Set_mode is set at the time of taking the photo (set to set the sensor output data size when the photo is taken), the memory is large enough.
Dc_mem = Frame_w*frame_h*2 *max ((1 + need_rotation), (1+is_jpg)) + 1M is calculated from this formula and configured in DC_PRODUCT_CFG.C.
4. Flower screen: If it is a lot of Green Line huaping, then usually the polarity of the HS/VS/PCLK configuration is reversed or the drive current is too small to be disturbed, if the color is red and blue, then the YUV output data is reversed, in the Yuv_info configuration.
5. Split screen: This is the brush screen when the brush is not the same frame of data, is the LCD Fmark pin did not come out, or no configuration. If the LCD does not have this foot, you need to estimate the time of the brush screen, and then adjust the sensor output frame rate to match it.
6. Rotation: The preview of the rotation in the Startpreview is set to the desired angle, the camera in the _dcamera_dosnapshot inside the rotation set to the desired angle, VT will be passed to the underlying parameters Screen2sensor_ The angle is set to dvt_mw_rotate_90 or other angles.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.