I. Overview
Taking HDR Feature as an example, add a new Feature in CamX
- Obtain multi-frame data in format P010 from the upstream (upstream) feature as input
- pipeline(SWMFMergeYuv) running algorithm
- Generate single frame data in the same format as output and send it to the downstream stream (down stream) feature
2. Add
2.1 Derive Feature from the Feature base class
2.1.1 Important documents:
- /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 Important functions
- DoQueryCaps(){ }
- CreateFeature(){ }
- OnSelectFlowToExecuteRequest (){ }
- DoPrepareRequest(){ }
- DoStreamNegotiation(){ }
2.2 Add Feature Descriptor (Feature descriptor)
2.2.1 CHI Feature descriptor includes the following detailed components:
- 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, and port numbers start at 0 and increase by 1
If there are two pipelines in a session, the pipeline IDs are 0 and 1
2.2.2 Important definitions:
vendor\qcom\proprietary\chi-cdk\core\chifeature2\Chifeature2utils.h
Make sure all input/output targets are listed in TargetStreamMap of chicature2utils.h
vendor\qcom\proprietary\chi-cdk\core\chifeature2\Chifeature2utils.h
Add a new feature type to ChiFeature2Type
2.2.3 chifeature2HDRdescriptor.cpp is placed in the correct directory
Place the Feature Descriptor file chifeature2HDRdescriptor.cpp in the correct file directory
2.2.4 Add ChiFeature2TargetDescriptor
The ChiFeature2TargetDescriptor structure describes the Input/output Targets of Feature
The target buffer name of ChiFeature2TargetDescriptor must be consistent with the target buffer name of the pipeline (SWMFMergeYuv) used by the feature.
2.2.5 Add ChiFeature2PortDescriptor
The ChiFeature2PortDescriptor structure describes Feature ports, including session info, pipeline, port index, port direction, port type and mapping of Feature port to Target.
2.2.6 Add ChiFeature2PipelineDescriptor
The ChiFeature2PipelineDescriptor structure describes the information about the pipeline in the Feature.
2.2.7 Add ChiFeature2SessionDescriptor
The ChiFeature2SessionDescriptor structure describes the Session information in Feature
2.2.8 Add ChiFeature2StageDescriptor
ChiFeature2StageDescriptor structure description Stage Id, Stage Name, pointer to the input dependency descriptor tale
2.2.9 Add ChiFeature2Descriptor
The ChiFeature2Descriptor structure describes the Feature Id, Feature name, and the number of stages in the Feature, and points to the session descriptor table.
pFeatureName("HDRDemo") must be the same as ppCapabilities("HDRDemo ") in DoQueryCaps()
3. Use Feature descriptor (Descriptor) in Feature2
3.1 Include Feature descriptor and Feature class files in Android.mk
/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 PRODUCT_PACKAGES Include "HDR Feature class lib" in the project configuration mk file
com.qti.feature2.hdrdemo.so is compiled and generated by .cpp and .h of HDR feature
/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"
When using HDRDemo feature in graphselector, you need to add com.qti.feature2.hdrdemo to 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 \