pdaf的一些计算

 Pdaf数据获取流程

  1. 根据上层的isCommand命令,在otp中获取到pd info。
  2. 构建flow control pdaf相关信息的结构体pd_profile,通过sendCommand在snesor driver文件中获取信息pdaf capacity、pdaf info、vc info、crop win info。
  3. 将矫正数据送入PD core中,会将otp中的pd info和driver中进行对比,不一致则报错。
  4. 在convertPDBufFormat中将pd点统一转换成raw16的格式,重新排列buffer,L靠前R靠后,即转化成pd algo所需要的pd格式。
     Pd info和相关计算
  5. Pd info结构体
    PD Block是PD点分布的最小单位,每个Block内的PD点的位置都是一样的,所以驱动只需要配置一个P

D Block内的PD坐标,再根据起始点的坐标和横向纵向各有多少个PD Block,就能够计算出所有PD点在Bayer raw域上的坐标。
static struct SET_PD_BLOCK_INFO_T imgsensor_pd_info_1920_1080 =
{
.i4OffsetX = 16, // x offset of PD area
.i4OffsetY = 12, // y offset of PD area
.i4PitchX = 16, // x pitch/width of a PD block
.i4PitchY = 16, // y pitch/height of a PD block
.i4PairNum = 8, // num of pairs L/R PD pixel within a PD block
.i4SubBlkW = 8, //一个block内y方向pairs的密度
.i4SubBlkH = 4, // y interval of 1 pair L/R PD pixel within a PD block
.i4BlockNumX = 120, // PD block number in X direction
.i4BlockNumY = 67, // PD block number in Y direction
.iMirrorFlip = 0, //指出图方向与模组厂校准出图方向的相对方向
.i4PosR = {
{16,13}, {24,13}, {20,17}, {28,17},
{16,21}, {24,21}, {20,25}, {28,25},
},
.i4PosL = {
{17,13}, {25,13}, {21,17}, {29,17},
{17,21}, {25,21}, {21,25}, {29,25},
},
.i4Crop = { {0, 0}, {0, 0}, {1040, 960}, {0, 0}, {0, 0}, {1040,960},{0, 0}, {0, 0}, {0, 0}, {0, 0} },
};
i4BlockNumX = 1920/i4PitchX
i4BlockNumY = 1080/i4PitchY
i4Crop = ???

MBOOL PD_xxxMIPIRAW::IsSupport( SPDProfile_t &iPdProfile)
{

if (( iPdProfile.i4SensorMode == 5) && ((iPdProfile.uImgXsz == 1920) && (iPdProfile.uImgYsz == 1080)))
{
	m_PDBufXSz = 240;
	m_PDBufYSz = 536;
            if(m_PDBuf)
           {
                delete m_PDBuf;
                m_PDBuf = nullptr;
           }
           m_PDBufSz  = m_PDBufXSz*m_PDBufYSz;
           m_PDBuf    = new uint16_t [m_PDBufSz];
	ret = MTRUE;
	AAA_LOGD("[1080P 60fps] is Support : i4SensorMode:%d w[%d] s[%d]\n", iPdProfile.i4SensorMode,iPdProfile.uImgXsz, iPdProfile.uImgYsz);
}
...

}
其中m_PDXSz为每行pixel的个数,m_PDYSz代表行数,
pixel num = PitchX / DensityX * BlockNumX = 16 / 8 * 120 = 240
line num = pitchY/DensityY * 2 * BlockNumY = 16 / 8 * 2 * 67 = 536 //因为L和R是上下分布的所以乘以2
pd win size
static struct SENSOR_WINSIZE_INFO_STRUCT imgsensor_winsize_info[7] = {
{8032, 6032, 0, 12, 8032, 6008, 4016, 3004, 8, 2, 4000, 3000, 0, 0, 4000, 3000}, //preview(4000 x 3000)
{8032, 6032, 0, 12, 8032, 6008, 4016, 3004, 8, 2, 4000, 3000, 0, 0, 4000, 3000}, //capture(4000 x 3000)
{8032, 6032, 0, 12, 8032, 6008, 4016, 3004, 8, 2, 4000, 3000, 0, 0, 4000, 3000}, // VIDEO (4000 x 3000)
{8032, 6032, 0, 1568, 8032, 2896, 2008, 724, 364, 2, 1280, 720, 0, 0, 1280, 720}, // hight speed video (1280 x 720)
{8032, 6032, 0, 12, 8032, 6008, 4016, 3004, 8, 2, 4000, 3000, 0, 0, 4000, 3000}, // slim video (1280 x 720)
{8032, 6032, 2080, 1932, 3872, 2168, 1936, 1084, 8, 2, 1920, 1080,0, 0, 1920, 1080}, // custom1 (1920x 1080)
{8032, 6032, 0, 14, 8032, 6004, 8032, 6004, 16, 2, 8000, 6000, 0, 0, 8000, 6000}, //remosaic (8000 x 6000)
};
8032 6032 sensor内部有效像素 crop → binning → crop 如果有还要小的尺寸还需要crop
为了保持中心一致 0 12 上下都裁剪 crop
8032-(0 * 2) 6032 -(12 * 2)= 8032 6008 再binning
4016 3004 继续上下crop
4016 -(8 * 2)3004(2*2)= 4000 * 3000 最终输出 tgsize

你可能感兴趣的:(pdaf的一些计算)