IMX8MP sensor ISP VVCAM porting

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

IMX8MP sensor ISP VVCAM porting

1,546件の閲覧回数
jjiimmyy
Contributor II

Hi,

I am using OS08a20 as the example for porting a new sensor.

For exposure gain, sensor usually has min/max analog and digital gain. This is set in the vvcam_mode_info_s.ae_info.

My question is when ISP is calling set_gain(sensor, total_gain), how do I convert total_gain to sensor's analog and digital gain? 

I also check OV2755 and IMX219 VVCAM as examples, but they all have different calculation on converting total gain to analog and digital gain.

 

4 返答(返信)

1,542件の閲覧回数
jjiimmyy
Contributor II

Screenshot from 2024-08-19 17-32-42.png

attached a snippet of the vvcam 

0 件の賞賛
返信

1,522件の閲覧回数
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

The digital gain is realized by ISP (image signal processing), not directly adjusting the built-in register of the chip. Under normal circumstances, the default digital gain is close to 1.0, unless there are the following three situations.

  1. Overall gain parameter requirements, that is, when the analog gain cannot meet the set gain parameter requirements, the digital gain will be needed for compensation.
  2. One of the color gains is less than 1 (the color gain is achieved by digital gain), in this case, the final gain is stabilized at 1/min(red_gain, blue_gain), that is, a uniform digital gain is applied, and is the gain value for one of the color channels (not the green channel).
  3. AEC/AGC was modified. If there is a change in AEC/AGC, the digital gain will also change to a certain extent to eliminate any fluctuations, this change will be quickly restored to the "normal" value.

 

Regards

0 件の賞賛
返信

1,503件の閲覧回数
jjiimmyy
Contributor II

@Bio_TICFSL 

Thanks for the clarification. I am still a little confused about the gain value. 

When I look at the set_gain(...) which is called by ISP. It seems this function needs to convert "gain" to sensor's analog and digital gain.

But what is the equation or guideline for this conversion?

I already trace the function call, it seems the "gain" pass-in parameter is rather large and it is not floating point. 

 

0 件の賞賛
返信

1,476件の閲覧回数
malik_cisse
Senior Contributor I

Hi Jimmy,

I must admit, that in my case, I do not allow the ISP to set the gain because I am not using AEC functionality.
Nevertheless I will tell you what I know.
The *_set_gain() function you are showing is controlled by either the AEC (auto exposure control) or the manual exposure control of the ISP. This is done via ISP's VVSENSORIOC_S_GAIN  IOCTL. According to the "ISP tuning Tool User Guide" (ISPTTUG.pdf) which I highly recommend to read the max value is 32.0:

malik_cisse_0-1724142532761.png


This means the gain range is between 0 and 32. This gain is to be mapped to your sensor gain. Your sensor might have analog and digital gain or both depending on the sensor. Each sensor is different.
I would recommend to e.g only use analog gain. You are not obliged to set both analog and digital gain.
Also your sensor gain range is sensor dependant. It may be from 0 to 1000 for example.
This means the formula to map ISP gain will map (0 to 32) range to (0 to 1000).
This is why the formulas are different from sensor to sensor.
If the gain is too high, the AEC algorithm will go ahead and set lower gain, etc.
Also the sensors register are mostly 16bit and spread over two registers. Therefore you see code like this:

ret |= os08a20_write_reg(sensor, 0x3508, (again >>  & 0xff); 

ret |= os08a20_write_reg(sensor, 0x3509, again & 0xff); 


I hope this is useful.

0 件の賞賛
返信