1,mtkcam3/pipeline/pipeline/PipelineContextImpl.cpp launchOneNode()
2.mtkcam3/pipeline/pipeline/NodeActorImpl.cpp init() -->onInit()
3.mtkcam3/pipeline/hwnode/p2/P2_StreamingNode.cpp init()
4.mtkcam3/pipeline/hwnode/p2/P2_Processor.h init()
5.mtkcam3/pipeline/hwnode/p2/P2_DispatchProcessor.cpp onInit()
6.mtkcam3/pipeline/hwnode/p2/P2_Processor.h init()
7.mtkcam3/pipeline/hwnode/p2/P2_StreamingProcessor.cpp onInit()
8.mtkcam3/pipeline/hwnode/p2/P2_StreamingProcessor.cpp initFeaturePipe()
9.mtkcam3/feature/core/featurePipe/streaming/StreamingFeaturePipe.cpp init()
10.mtkcam3/feature/core/featurePipe/streaming/StreamingFeaturePipe.cpp initTPIGroup()
11.mtkcam3/feature/core/featurePipe/streaming/tpi/TPIMgr_PluginWrapper.cpp createSession
12.mtkcam3/feature/core/featurePipe/streaming/tpi/TPIMgr_PluginWrapper.cpp createPluginSession
2.调用NodeActorImpl::init(),继续调用onInit(),virtual auto onInit() -> int { return (mpNodeOps->getNode()!=nullptr) ? mpNodeOps->getNode()->init(mInitParam) : -1; },这里会获取所有需要的node进行Init(),mInitParam包含node id/name等信息。
eNODEID_P2CaptureNode = 0x14,
eNODEID_P2StreamNode = 0x15,
eNODEID_FDNode_BEGIN = 0x16,
eNODEID_FDNode = eNODEID_FDNode_BEGIN,
eNODEID_JpegNode = 0x23,
eNODEID_P2YuvIspTuningDataPackNode = 0x41, //IspTuningDataPackNode after P2CaptureNode for Yuv
3.这里继续分析p2s的init
ret = parseInitParam(sensorLog, initParam) && mDispatcher.init(P2InitParam(P2Info(mP2Info, sensorLog, mP2Info->mConfigInfo.mMainSensorID)));
parseInitParam()将initParam转化成p2的param信息
mDispatcher.init()调用到P2_Processor.h的init()
4.Processor<Init_T, Config_T, Enque_T>::init()继续调用this->onInit(param);
5.ret = ret&& mBasicProcessor.init(param)&& mStreamingProcessor.init(param);
BasicProcessor用于处理慢动作何一些debug信息
StreamingProcessor则处理正常的streaming
6.processor<Init_T, Config_T, Enque_T>::init()继续调用this->onInit(param);
同4一样,P2_Processor.h中Processor类似于一个父类,用于管理各Processor,4的this就是DispatchProcessor,而这里是StreamingProcessor。所以下一步调用的就是StreamingProcessor的onInit()
7.ret = initFeaturePipe(mP2Info.getConfigInfo()) && init3A();
调用initFeaturePipe()进行p2s中feature的配置。另外此函数中有几个setprop项用于在出图上画线
// draw line
mDrawType = ::property_get_int32("vendor.debug.camera.draw.type", 0); // can set 15(10) = 1111(2) : draw running vertical line on input buffer
mDrawDefaultPosition = ::property_get_int32("vendor.debug.camera.draw.position", 50); // 0 ~ 100 (%)
mDrawMoveSpeed = ::property_get_int32("vendor.debug.camera.draw.move.speed", 2);
mDrawLineWidth = ::property_get_int32("vendor.debug.camera.draw.line.width", 10); // 10 ~ 100 (%)
mDrawValue = ::property_get_int32("vendor.debug.camera.draw.value", 255);
8.mPipeUsageHint = getFeatureUsageHint(config);
根据config信息确定pipeUsage的信息
mFeaturePipe = IStreamingFeaturePipe::createInstance(mP2Info.getConfigInfo().mMainSensorID, mPipeUsageHint);
根据上面的pipeUsage获取FeaturePipe实例
ret = mFeaturePipe->init(getName());
进行StreamingFeaturePipe的初始化
9.initTPIGroup(); 三方算法init
initP2AGroup();
initNodes(); 添加sfp中各node
mNodes.push_back(&mRootNode);
mNodes.push_back(&mDepth);
mNodes.push_back(&mBokeh);
if( mPipeUsage.supportTPI(TPIOEntry::YUV) )
{
MUINT32 count = mPipeUsage.getTPINodeCount(TPIOEntry::YUV);
mTPIs.clear();
mTPIs.reserve(count);
char name[32];
TPIUsage tpiUsage = mPipeUsage.getTPIUsage();
for( MUINT32 i = 0; i < count; ++i )
{
TPI_NodeInfo nodeInfo = tpiUsage.getTPIO(TPIOEntry::YUV, i).mNodeInfo;
int res = snprintf(name, sizeof(name), "fpipe.tpi.%d.%s.%d", i, nodeInfo.mName.c_str(), nodeInfo.mNodeID);
MY_LOGE_IF((res < 0), "create TPI snprintf FAIL!");
TPINode *tpi = new TPINode(name, i);
tpi->setTPIMgr(mTPIMgr);
mTPIs.push_back(tpi);
mNodes.push_back(tpi);
}
}
mTPIMgr = TPIMgr::createInstance(); 获取TPIMgr实例,实际就是new了一个TPIMgr_PluginWrapper供下一步createSession
11.会传入masks等参数,masks就是FeatureSettingPolicy中updateStreamConfiguration时的feature combination
12.mPluginPool = T_PluginType::getInstance(mainSensorID); 获取PluginPool
auto &plugin : mPluginPool->getProviders(masks) 遍历所有masks包含的plugin
T_Property prop = plugin->property();
plugin->negotiate(*sel);
mPluginMap[id] = PluginInfo(plugin, prop, sel); 将需要run的算法加入mPluginMap
加入feature时如果没走通,需要注意这里
1.mtkcam3/pipeline/hwnode/p2/P2_StreamingProcessor.cpp onEnque()
2.mtkcam3/pipeline/hwnode/p2/P2_StreamingProcessor.cpp processP2()
3.mtkcam3/feature/core/featurePipe/streaming/StreamingFeaturePipe.cpp enque()
4.mtkcam3/feature/core/featurePipe/streaming/tpi/TPIMgr_PluginWrapper.cpp genFrame()
5.mtkcam3/3rdparty/customer/s_wuhao/wuhao.cpp negotiate()
4.genframe()中会遍历之前保存的mPluginMap,调用到算法的negotiate()决定每一帧是否run,将frame加入到对应的域中(eJoinEntry_S_YUV)
1.mtkcam3/feature/core/featurePipe/streaming/TPINode.cpp onThreadLoop()
2.mtkcam3/feature/core/featurePipe/streaming/TPINode.cpp process()
3.mtkcam3/feature/core/featurePipe/streaming/tpi/TPIMgr_PluginWrapper.cpp enqueNode()
4.mtkcam3/3rdparty/customer/s_wuhao/wuhao.cpp process()
1.request进入TPINode是通过onData(),会进行一个入队操作mData.enque(data);onThreadLoop()在一直轮询,当拿到数据时会进行deque操作mData.deque(data);然后将data和JoinPulgin内部的request进行绑定,送入process
每个算法的FeatureIndex都依次1左移
TP_FEATURE_EIS = 1ULL << 34 0000 0000 0000 0000 0000 0000 0000 0100 0000 0000 0000 0000 0000 0000 0000 0000
TP_FEATURE_FB = 1ULL << 35 0000 0000 0000 0000 0000 0000 0000 1000 0000 0000 0000 0000 0000 0000 0000 0000
而在feature combination中,所有算法的合集mask是|操作,所以实际上是将各位都置为1.
0000 0000 0000 0000 0000 0000 0000 1100 0000 0000 0000 0000 0000 0000 0000 0000
在进行算法的加载时,会将该算法的index与mask进行&操作,如果该算法已被加入到这个feature combination中,&肯定为1