camera ap在特殊的应用场景下额外使用一套独立的camera tuning参数
解决方案:
1, nvram_drv.h corefeatureiodrvinc 中添加下面的interface
virtual void setCustomIndex(int idx=0) = 0;
virtual int getCustomIndex() = 0;
2, 在nvram_drv.cppcorefeatureiodrv
vram去实现上面的interface, custom index值default为0, 需要加载那组特殊tuning data时, 调用setCustomIndex(1)
NvramDrvBase* nvDrv;
nvDrv = NvramDrvBase::createInstance();
NvramDrvBase::createInstance() 是single instance, camera HAL检测到特殊的应用场景后(camera ap可以定义一个新的camera parameter传下来 ), 调用nvDrv-> setCustomIndex(1), 否则调用setCustomIndex(0)
3, 在nvram_drv.cpp (corefeatureiodrv
vram) 添加下面红 {MOD}部分:
NvramDrv::readDefaultData(
CAMERA_DUAL_CAMERA_SENSOR_ENUM a_eSensorType,
unsigned long a_u4SensorID,
CAMERA_DATA_TYPE_ENUM a_eNvramDataType,
void *a_pNvramData
)
case CAMERA_NVRAM_DATA_ISP:
GetCameraDefaultPara(a_u4SensorID + getCustomIndex(), (PNVRAM_CAMERA_ISP_PARAM_STRUCT)a_pNvramData,NULL,NULL,NULL);
break;
case CAMERA_NVRAM_DATA_3A:
GetCameraDefaultPara(a_u4SensorID + getCustomIndex(), NULL,(PNVRAM_CAMERA_3A_STRUCT)a_pNvramData,NULL,NULL);
break;
case CAMERA_NVRAM_DATA_SHADING:
GetCameraDefaultPara(a_u4SensorID + getCustomIndex(), NULL,NULL,(PNVRAM_CAMERA_SHADING_STRUCT)a_pNvramData,NULL);
case CAMERA_DATA_AE_PLINETABLE:
GetCameraDefaultPara(a_u4SensorID + getCustomIndex(), NULL,NULL,NULL,(PAE_PLINETABLE_STRUCT)a_pNvramData);
break;
case CAMERA_DATA_TSF_TABLE:
if (0 != GetCameraTsfDefaultTbl(a_u4SensorID + getCustomIndex(), (PCAMERA_TSF_TBL_STRUCT)a_pNvramData))
{
return NVRAM_DEFAULT_DATA_READ_ERROR;
}
break;
case CAMERA_NVRAM_DATA_FEATURE:
//NVRAM_DRV_LOG("[readDefaultData] feature line=%d",__LINE__);
GetCameraFeatureDefault(a_u4SensorID + getCustomIndex(), (NVRAM_CAMERA_FEATURE_STRUCT*)a_pNvramData);
break;
4, 在sensorlist.cpp中添加一颗新的sensor, 其sensor ID是原sensor ID + 1
e.g. 实际sensor IMX135, 配置一颗IMX136和对应的tuning data
#if 1//defined(IMX135_MIPI_RAW_5MP)
RAW_INFO(IMX136_SENSOR_ID, SENSOR_DRVNAME_IMX136_MIPI_RAW_5MP,NULL),
#endif
/* ADD sensor driver before this line */
{0,{0},NULL, NULL, NULL}//end of list
[注意新配置的sensor放到sensorlist最后面, 避免search sensor时出错]
5, Middleware中所有加载tuning data的code, isForce这个值写成1, 否则读到是上一次cache起来的数据:
e.g.
err = NvBufUtil::getInstance().getBufAndRead(CAMERA_NVRAM_DATA_ISP, eSensorDev, (void*&)pNvram_Isp, 1);
NvBufUtil::getInstance().getBufAndRead(CAMERA_DATA_AE_PLINETABLE, i4SensorDev, (void*&)m_pAEPlineTable, 1/*isForce*/);