一.概述
以HDR Feature为例,在CamX中添加一个新的Feature
从上游stream(upstream) feature获取格式P010的多帧数据作为input
pipeline(SWMFMergeYuv)运行算法
生成同样格式的单帧数据作为输出,发送给下游stream(down stream) feature
二.添加
2.1 从Feature基类派生Feature
2.1.1 重要的文件:
/chi-cdk/oem/qcom/feature2/chifeature2hdr/chifeature2hdr.cpp
/chi-cdk/oem/qcom/feature2/chifeature2hdr/chifeature2hdr.h
/chi-cdk /oem/qcom/feature2/chifeature2hdr/common/build/android/Android.mk
2.1.2 重要的函数
DoQueryCaps(){ }
CreateFeature(){ }
OnSelectFlowToExecuteRequest (){ }
DoPrepareRequest(){ }
DoStreamNegotiation(){ }
2.2 添加Feature Descriptor (Feature描述符)
2.2.1 CHI Feature descriptor包括如下细节组件:
ChiFeature input/output target buffer descriptor.
ChiFeature input/output port descriptor.
ChiFeature pipelines descriptor.
ChiFeature session info descriptor.
ChiFeature input dependency and config descriptor.
ChiFeature stage info descriptor
Session, Pipeline, 和 port numbers 从 0 开始递增 1
如果1个session里面有2个pipeline,pipeline Id就是 0 和 1
2.2.2 重要定义:
vendor\qcom\proprietary\chi-cdk\core\chifeature2\Chifeature2utils.h
确保所有的input/output target都在chifeature2utils.h的TargetStreamMap有列出
vendor\qcom\proprietary\chi-cdk\core\chifeature2\Chifeature2utils.h
ChiFeature2Type 中添加一个新的 feature type
2.2.3 chifeature2HDRdescriptor.cpp放在正确的目录
将Feature Descriptor文件chifeature2HDRdescriptor.cpp放在正确的文件目录下
2.2.4 添加ChiFeature2TargetDescriptor
ChiFeature2TargetDescriptor结构体描述 Feature 的 Input/output Targets
ChiFeature2TargetDescriptor的target buffer名字要和feature使用的pipeline(SWMFMergeYuv)的target buffer名字保持一致
2.2.5 添加ChiFeature2PortDescriptor
ChiFeature2PortDescriptor 结构体描述了Feature的ports, 包括session的info、pipeline、port index、port direction、port type 和 Feature port 到 Target 的映射
2.2.6 添加ChiFeature2PipelineDescriptor
ChiFeature2PipelineDescriptor结构体描述Feature里pipeline的信息
2.2.7 添加ChiFeature2SessionDescriptor
ChiFeature2SessionDescriptor结构体描述Feature中的Session信息
2.2.8 添加ChiFeature2StageDescriptor
ChiFeature2StageDescriptor 结构体描述Stage Id,Stage Name, pointer to the input dependency descriptor tale
2.2.9 添加ChiFeature2Descriptor
ChiFeature2Descriptor 结构体描述Feature Id、Feature name、Feature里stages的个数,并且指向session descriptor table。
pFeatureName("HDRDemo") 必须和DoQueryCaps()中的ppCapabilities("HDRDemo ")一样
三.Feature2中使用Feature描述符(Descriptor)
3.1 在Android.mk中包含Feature descriptor和Feature class files
/chi-cdk/oem/qcom/feature2/chifeature2hdr/common/build/android/Android.mk
# Block this if use generated
LOCAL_SRC_FILES := \
chifeature2hdrdemo/chifeature2hdr.cpp \
chifeature2graphselector/descriptors/nongenerated/chifeature2hdrdescriptor.cpp
LOCAL_INC_FILES := \
chifeature2hdr/chifeature2hdr.h
# Binary name
LOCAL_MODULE := com.qti.feature2.hdr
...
include $(BUILD_SHARED_LIBRARY)
3.2 oem/Android.mk中 Include HDR Feature mk
/chi-cdk/oem/Android.mk
include $(CAMX_CHICDK_OEM_PATH)/qcom/feature2/chifeature2hdrdemo/common/build/android/Android.mk
include $(CAMX_CHICDK_OEM_PATH)/qcom/feature2/chifeature2realtimeserializer/common/build/android/Android.mk
3.3 项目配置mk文件中的PRODUCT_PACKAGES Include "HDR Feature class lib"
com.qti.feature2.hdrdemo.so由HDR feature的.cpp和.h编译生成
/chi-cdk/configs/product.mk
PRODUCT_PACKAGES = com.qti.feature2.rawhdr
PRODUCT_PACKAGES = com.qti.feature2.hdrdemo
PRODUCT_PACKAGES = com.qti.feature2.rt
3.4 LOCAL_SHARED_LIBRARIES中 Include "HDR Feature class lib"
当在graphselector里使用HDRDemo feature时,需要添加com.qti.feature2.hdrdemo到LOCAL_SHARED_LIBRARIES
/chi-cdk/oem/qcom/feature2/chifeature2graphselector/sm8350/build/android/Android.mk
LOCAL_SHARED_LIBRARIES = \
com.qti.feature2.rawhdr \
com.qti.feature2.hdrdemo \
com.qti.feature2.swmf \
四.结束
原文链接:https://blog.csdn.net/geyichongchujianghu/article/details/131034146