Lifelong Learning with you, this is Android programmer

This article covers some of the basics of Android development. Here’s what you’ll learn:

Camx code structure 2. Camx compilation 3. Camx code flow analysis 4

Camx code structure

At present, mainstream models all use CAMX architecture. The main difference between this architecture and previous architecture is that the code of chip interface layer is migrated from Hardware /qcom to vendor/qcom/proprietary. We focus on the camera Hal layer source is also on the vendor/end/proprietary/camx/below.

Camx compilation

Camx core directory is the vendor/end/proprietary/camx/SRC/directory below:

Total 40 drwxrwxr-x 10 LXL LXL 4096 4月 4 10:52./ drwxrwxr-x 4 LXL LXL 4096 4月 4 10:52.. / drwxrwxr-x 3 LXL LXL 4096 4/4 10:52 chiiqutils/ drwxrwxr-x 7 LXL LXL 4096 4/4 10:56 core/ drwxrwxr-x 7 LXL LXL 4096 CSL/drWxrwxr-x 14 LXL LXL 4096 April 4 10:52 HWL/DRWxrwxr-x 3 LXL LX 4096 April 4 10:52 lib/ drWxrwxr-x 3 LXL LXL 4096 4/4 10:52 osutils/ drwxrwxr-x 11 LXL LXL 4096 4/4 10:52 SWL/drwxrwxr-x 3 LXL LXL 4096 4/4 10:52 utils/Copy the code

The core of the Android. Mk in. / lib/build/Android/Android. Mk. The static libraries included are as follows:

# Libraries to link
LOCAL_STATIC_LIBRARIES :=   \
    libcamxcore             \
    libcamxchi              \
    libcamxcsl              \
    libcamxofflinestats     \
    libnc                   \
    libcamxncs              \
    libifestriping          \
    libstriping

LOCAL_WHOLE_STATIC_LIBRARIES := \
    libcamxdspstreamer          \
    libcamxhwlbps               \
    libcamxgenerated            \
    libcamxhal                  \
    libcamxhalutils             \
    libcamxhwlfd                \
    libcamxhwlife               \
    libcamxhwlipe               \
    libcamxhwliqmodule          \
    libcamxswlfdmanager         \
    libcamxswljpeg              \
    libcamxhwljpeg              \
    libcamxhwllrme              \
    libcamxswlransac            \
    libcamxhwltitan17x          \
    libcamxiqsetting            \
    libcamxosutils              \
    libcamxstats                \
    libcamxsensor               \
    libcamxutils

Copy the code

These static library is camx or other directory compiled, compile the project, we need to compile these static libraries, and then compile the camx dynamic library (/ vendor/lib/hw/camera. The end. So).

# 3, CamX code flow analysis camera. Provider how to realize the jump to camera Hal layer, camera service calls the interface method in camera Provider, Now call to the camera hardware/interfaces of the provider/camera/device / 3.2 / default/CameraDeviceSession CPP The processCaptureRequest (…). Method, which will eventually call:

status_t ret = mDevice->ops->process_capture_request(mDevice, &halRequest);Copy the code

The mDevice – > ops is the hardware/libhardware/include/hardware/camera3 camera3_device_ops structure in the h: (reference: www.jianshu.com/p/099cc3b0a,…).

typedef struct camera3_device_ops {
    int (*initialize)(const struct camera3_device *,
            const camera3_callback_ops_t *callback_ops);
    int (*configure_streams)(const struct camera3_device *,
            camera3_stream_configuration_t *stream_list);
    int (*register_stream_buffers)(const struct camera3_device *,
            const camera3_stream_buffer_set_t *buffer_set);
    const camera_metadata_t* (*construct_default_request_settings)(
            const struct camera3_device *,
            int type);
    int (*process_capture_request)(const struct camera3_device *,
            camera3_capture_request_t *request);
    void (*get_metadata_vendor_tag_ops)(const struct camera3_device*,
            vendor_tag_query_ops_t* ops);
    void (*dump)(const struct camera3_device *, int fd);
    int (*flush)(const struct camera3_device *);
 
    /* reserved for future use */
    void *reserved[8];
} camera3_device_ops_t;
Copy the code

Camera3_device_ops_t mapping function pointer operations: the hardware/libhardware/modules/camera / 3 _0 / camera. CPP

const camera3_device_ops_t Camera::sOps = {
    .initialize = default_camera_hal::initialize,
    .configure_streams = default_camera_hal::configure_streams,
    .register_stream_buffers = default_camera_hal::register_stream_buffers,
    .construct_default_request_settings
        = default_camera_hal::construct_default_request_settings,
    .process_capture_request = default_camera_hal::process_capture_request,
    .get_metadata_vendor_tag_ops = NULL,
    .dump = default_camera_hal::dump,
    .flush = default_camera_hal::flush,
    .reserved = {0},
};
Copy the code

This finds the mapping of function Pointers in camera Hal layer. Mapped to: vendor/end/proprietary/camx/SRC/core/Hal/camxhal3entry CPP in static Dispatch g_dispatchHAL3 (& g_jumpTableHAL3); :

/// Array containing camera3_device_ops_t methods
static camera3_device_ops_t g_camera3DeviceOps =
{
    CamX::initialize,
    CamX::configure_streams,
    NULL,
    CamX::construct_default_request_settings,
    CamX::process_capture_request,
    NULL,
    CamX::dump,
    CamX::flush,
    {0},
};
Copy the code

The g_camera3DeviceOps variable is defined:

/// Array containing camera3_device_ops_t methods
static camera3_device_ops_t g_camera3DeviceOps =
{
    CamX::initialize,
    CamX::configure_streams,
    NULL,
    CamX::construct_default_request_settings,
    CamX::process_capture_request,
    NULL,
    CamX::dump,
    CamX::flush,
    {0},
};
Copy the code

In the Initialize method \vendor\qcom\proprietary\camx\ SRC \core\ Hal \camxhaldevice. CPP, get the connection from GetCamera3DeviceOps:

CamxResult HALDevice::Initialize(
    const HwModule* pHwModule,
    UINT32          cameraId)
{
    CamxResult result = CamxResultSuccess;

    m_cameraId = cameraId;

    if (CamxResultSuccess == result)
    {
        m_camera3Device.hwDevice.tag     = HARDWARE_DEVICE_TAG; /// @todo (CAMX-351) Get from local macro
        m_camera3Device.hwDevice.version = CAMERA_DEVICE_API_VERSION_3_3;
        m_camera3Device.hwDevice.close   = reinterpret_cast<CloseFunc>(GetHwDeviceCloseFunc());
        m_camera3Device.pDeviceOps       = reinterpret_cast<Camera3DeviceOps*>(GetCamera3DeviceOps());
        m_camera3Device.pPrivateData     = this;
        // NOWHINE CP036a: Need exception here
        m_camera3Device.hwDevice.pModule = const_cast<HwModule*>(pHwModule);

        m_HALCallbacks.ProcessCaptureResult = ProcessCaptureResult;
        m_HALCallbacks.NotifyResult         = Notify;
        CamX::ChiOverrideBypass(&m_HALCallbacks);
    }

    m_pHALSession = NULL;
    Utils::Memset(m_flushRequest, 0, sizeof(m_flushRequest));

    return result;
}
Copy the code

See g_jumpTableHAL3 variables: the vendor/end/proprietary/camx/SRC/core/Hal/camxhal3 CPP defined in:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////// // Jump table for HAL3 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////// JumpTableHAL3 g_jumpTableHAL3 = { open, get_number_of_cameras, get_camera_info, set_callbacks, get_vendor_tag_ops, open_legacy, set_torch_mode, init, parallelQuery, setCallBack, get_tag_count, get_all_tags, get_section_name, get_tag_name, get_tag_type, close, initialize, configure_streams, construct_default_request_settings, process_capture_request, dump, flush, camera_device_status_change, torch_mode_status_change, process_capture_result, notify };Copy the code

There is a direct mapping of pointer functions (corresponding to the function in camxhaldevice.cpp). Vendor/end/proprietary/camx/SRC/core/chi/camxchitypes CHIAppCallbacks structure is defined in the h, as follows:

struct CHIAppCallbacks { /// @brief Called by the driver to get number of cameras INT(*CHIGetNumCameras)( UINT32* pNumFwCameras, UINT32* pNumLogicalCameras); /// @brief Called by the driver to get the camera info for the camera id CamxResult (*CHIGetCameraInfo)( UINT32 cameraId, CameraInfo* pCameraInfo); /// @brief Defines the prototype for the device status change callback method from to the framework. Please refer to ///  the camera_device_status_change documentation in hardware/camera_common.h. VOID (*CHIInitializeOverrideSession)( UINT32  cameraId, const Camera3Device* pCamera3Device, const HALCallbacks* pHALCallbacks, Camera3StreamConfig* pStreamConfig, BOOL* isOverrideEnabled, VOID** ppPrivate); /// @brief Defines the prototype for the torch mode status change callback method from to the framework. Please refer to  /// the torch_mode_status_change documentation in hardware/camera_common.h. VOID (*CHIFinalizeOverrideSession)( const Camera3Device* pCamera3Device, UINT64* pSession, VOID** ppPrivate); /// @brief Called by the driver to inform about session closing VOID (*CHITeardownOverrideSession)( const Camera3Device*  pCamera3Device, UINT64* pSession, VOID* pPrivate); /// @brief Called by the driver to pass on capture request call to CHI INT (*CHIOverrideProcessRequest)( const Camera3Device* pCamera3Device, Camera3CaptureRequest* pCaptureRequest, VOID* pPrivate); /// @brief Called by the driver to allow for additional override processing during open() INT(*CHIExtendOpen)( UINT32 cameraId, VOID* pPrivateData); /// @brief Called by the driver to allow for additional override processing during close() INT(*CHIExtendClose)( UINT32 cameraId, VOID* pPrivateData); /// @brief Called by the driver to allow override to remap special camera IDs into logical camera IDs UINT32(*CHIRemapCameraId)( UINT32 frameworkCameraId, CameraIdRemapMode mode); /// @brief Interface to allow various override-specific settings to be toggled. UINT32(*CHIModifySettings)( VOID* pPrivateData); /// @brief Get any vendor tag specific request settings the override wants to get added to the default settings VOID (*CHIGetDefaultRequestSettings)( UINT32 frameworkCameraId, INT requestTemplate, const Metadata** pAdditionalMetadata); /// @brief Called by the driver to allow for flush() INT(*CHIOverrideFlush)( const Camera3Device* pCamera3Device); INT(*CHIParallelQuery) (INT num, char* list[]); INT(*CHISetCallback) (void*); }; typedef VOID(*CHIHALOverrideEntry)(CHIAppCallbacks* pCHIAppCallbacks);Copy the code

This structure is a function pointer, the mapping relationships: vendor/end/proprietary/camx/SRC/core/Hal/camxhal3module h defines CHIAppCallbacks m_ChiAppCallbacks;

   CHIAppCallbacks       m_ChiAppCallbacks;                    ///< CHI HAL override entry
Copy the code

Vendor/end/proprietary/camx/SRC/core/Hal/camxhal3module CPP HAL3Module in the constructor, the execution of the statement below:

CHIHALOverrideEntry funcCHIHALOverrideEntry = reinterpret_cast<CHIHALOverrideEntry>( CamX::OsUtils::LibGetAddr(m_hChiOverrideModuleHandle, "chi_hal_override_entry")); if (NULL ! = funcCHIHALOverrideEntry) { funcCHIHALOverrideEntry(&m_ChiAppCallbacks); / / corresponding to chxextensioninterface CAMX_ASSERT chi_hal_override_entry function of CPP (NULL! = m_ChiAppCallbacks.CHIGetNumCameras); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIGetCameraInfo); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIFinalizeOverrideSession); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIInitializeOverrideSession); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIOverrideProcessRequest); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIOverrideFlush); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHITeardownOverrideSession); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIExtendOpen); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIExtendClose); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIRemapCameraId); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIModifySettings); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHIParallelQuery); CAMX_ASSERT(NULL ! = m_ChiAppCallbacks.CHISetCallback); if ((NULL ! = m_ChiAppCallbacks.CHIGetNumCameras) && (NULL ! = m_ChiAppCallbacks.CHIGetCameraInfo) && (NULL ! = m_ChiAppCallbacks.CHIFinalizeOverrideSession) && (NULL ! = m_ChiAppCallbacks.CHIInitializeOverrideSession) && (NULL ! = m_ChiAppCallbacks.CHIOverrideProcessRequest) && (NULL ! = m_ChiAppCallbacks.CHIOverrideFlush) && (NULL ! = m_ChiAppCallbacks.CHITeardownOverrideSession) && (NULL ! = m_ChiAppCallbacks.CHIExtendOpen) && (NULL ! = m_ChiAppCallbacks.CHIExtendClose) && (NULL ! = m_ChiAppCallbacks.CHIRemapCameraId) && (NULL ! = m_ChiAppCallbacks.CHIModifySettings) && (NULL ! = m_ChiAppCallbacks.CHIParallelQuery) && (NULL ! = m_ChiAppCallbacks.CHISetCallback)) { CAMX_LOG_WARN(CamxLogGroupHAL, "CHI Module library function pointers exchanged");  }}Copy the code

M_ChiAppCallbacks is mapped by funcCHIHALOverrideEntry to chi_hal_override_entry, the chi_hal_override_entry Refers to vendor/end/proprietary/chi – CDK/vendor/chioverride/default/chxextensioninterface chi_hal_override_entry function of CPP, as follows:

void chi_hal_override_entry( chi_hal_callback_ops_t* callbacks) { ExtensionModule* pExtensionModule = ExtensionModule::GetInstance(); CHX_ASSERT(NULL ! = callbacks); if (NULL ! = pExtensionModule) { callbacks->chi_get_num_cameras = chi_get_num_cameras; callbacks->chi_get_camera_info = chi_get_camera_info; callbacks->chi_initialize_override_session = chi_initialize_override_session; callbacks->chi_finalize_override_session = chi_finalize_override_session; callbacks->chi_override_process_request = chi_override_process_request; callbacks->chi_teardown_override_session = chi_teardown_override_session; callbacks->chi_extend_open = chi_extend_open; callbacks->chi_extend_close = chi_extend_close; callbacks->chi_remap_camera_id = chi_remap_camera_id; callbacks->chi_modify_settings = chi_modify_settings; callbacks->chi_get_default_request_settings = chi_get_default_request_settings; callbacks->chi_override_flush = chi_override_flush; callbacks->chi_parallelquery = chi_parallelquery; callbacks->chi_setcallback = chi_setcallback; }}Copy the code

This establishes a one-to-one mapping of function Pointers in CHIAppCallbacks.

Vendor/end/proprietary/chi – CDK/vendor/chioverride/default/chxextensionmodule of CPP ExtensionModule: : OverrideProcessRequest function that executes the m_pUsecaseFactory – > CreateUsecaseObject, as follows:

m_pSelectedUsecase[logicalCameraId] =
            m_pUsecaseFactory->CreateUsecaseObject(&m_logicalCameraInfo[logicalCameraId],
                static_cast<UsecaseId>(m_SelectedUsecaseId[logicalCameraId]),
                m_pStreamConfig[logicalCameraId]);
Copy the code

Call directly to: Vendor/end/proprietary/chi – CDK/vendor/chioverride/default/chxusecaseutils UsecaseFactory: in the CPP: CreateUsecaseObject function:

Usecase* UsecaseFactory::CreateUsecaseObject(
    LogicalCameraInfo*              pLogicalCameraInfo,     ///< camera info
    UsecaseId                       usecaseId,              ///< Usecase Id
    camera3_stream_configuration_t* pStreamConfig)          ///< Stream config
{
    Usecase* pUsecase  = NULL;
    UINT     camera0Id = pLogicalCameraInfo->ppDeviceInfo[0]->cameraId;
    CHX_LOG_ERROR("UsecaseFactory::CreateUsecaseObject id = %d", usecaseId);
    switch (usecaseId)
    {
        case UsecaseId::PreviewZSL:
            pUsecase = AdvancedCameraUsecase::Create(pLogicalCameraInfo, pStreamConfig, usecaseId);
            break;
        case UsecaseId::MultiCamera:
            pUsecase = UsecaseMultiCamera::Create(pLogicalCameraInfo, pStreamConfig);
            break;
        case UsecaseId::MultiCameraVR:
            pUsecase = UsecaseMultiVRCamera::Create(pLogicalCameraInfo, pStreamConfig);
            break;
        case UsecaseId::MFNR:
            pUsecase = UsecaseMFNR::Create(camera0Id, pStreamConfig);
            break;
        case UsecaseId::QuadCFA:
            pUsecase = UsecaseQuadCFA::Create(pLogicalCameraInfo, pStreamConfig);
            break;
        case UsecaseId::Torch:
            pUsecase = UsecaseTorch::Create(camera0Id, pStreamConfig);
            break;
        default:
            pUsecase = AdvancedCameraUsecase::Create(pLogicalCameraInfo, pStreamConfig, usecaseId);
            break;
    }
 
    return pUsecase;
}
Copy the code
enum class UsecaseId
{
    NoMatch         = 0,
    Default         = 1,
    Preview         = 2,
    PreviewZSL      = 3,
    MFNR            = 4,
    MFSR            = 5,
    MultiCamera     = 6,
    QuadCFA         = 7,
    RawJPEG         = 8,
    MultiCameraVR   = 9,
    Torch           = 10,
    YUVInBlobOut    = 11,
    MaxUsecases     = 12,
};
Copy the code

The UsecaseId for the front camera is PreviewZSL, which is single-camera, and the UsecaseId for the rear camera is MultiCamera, which is multi-camera.

camx-usecase

Vendor/end/proprietary/camx/SRC/core/chi/camxchi CPP in ChiEntry function is as follows:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////// /// ChiEntry //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////// CAMX_VISIBILITY_PUBLIC VOID ChiEntry( ChiContextOps* pChiContextOps) { if (NULL ! = pChiContextOps) { pChiContextOps->size = sizeof(ChiContextOps); pChiContextOps->majorVersion = CHI_API_MAJOR_VERSION; pChiContextOps->minorVersion = CHI_API_MINOR_VERSION; pChiContextOps->pOpenContext = CamX::ChiOpenContext; pChiContextOps->pCloseContext = CamX::ChiCloseContext; pChiContextOps->pGetNumCameras = CamX::ChiGetNumCameras; pChiContextOps->pGetCameraInfo = CamX::ChiGetCameraInfo; pChiContextOps->pEnumerateSensorModes = CamX::ChiEnumerateSensorModes; pChiContextOps->pCreatePipelineDescriptor = CamX::ChiCreatePipelineDescriptor; pChiContextOps->pDestroyPipelineDescriptor = CamX::ChiDestroyPipelineDescriptor; pChiContextOps->pCreateSession = CamX::ChiCreateSession; pChiContextOps->pDestroySession = CamX::ChiDestroySession; pChiContextOps->pFlushSession = CamX::ChiFlushSession; pChiContextOps->pActivatePipeline = CamX::ChiActivatePipeline; pChiContextOps->pDeactivatePipeline = CamX::ChiDeactivatePipeline; pChiContextOps->pSubmitPipelineRequest = CamX::ChiSubmitPipelineRequest; pChiContextOps->pTagOps = CamX::ChiGetTagOps; } // This is the workaround for presil HAL3test on Windows // On Device, set_camera_metadata_vendor_ops will be call the set the // static vendor tag operation in camera_metadata.c // // On Windows side, theoretically hal3test should mimic what Android framework // does and call the set_camera_metadata_vendor_ops function in libcamxext library // However, in Windows, if both hal3test.exe and hal.dll link to libcamxext library, // there are two different instance of static varibles sit in different memory location. // Even if set_camera_metadata_vendor_ops is called in hal3test, when hal try to // access to vendor tag ops, it is still not set. // // This is also a workaround to call vendor tag ops in Chi at GetNumCameras which happens to get  called before // GetVendorTagOps CamX::g_vendorTagOps.get_all_tags = CamX::ChiGetAllTags; CamX::g_vendorTagOps.get_section_name = CamX::ChiGetSectionName; CamX::g_vendorTagOps.get_tag_count = CamX::ChiGetTagCount; CamX::g_vendorTagOps.get_tag_name = CamX::ChiGetTagName; CamX::g_vendorTagOps.get_tag_type = CamX::ChiGetTagType; set_camera_metadata_vendor_ops(&(CamX::g_vendorTagOps)); }Copy the code

This function mapping is important and common in CamxChi, and is directly mapped in the CamxChi class of this file. From vendor/end/proprietary/chi – CDK/vendor/chioverride/default/chxextensionmodule CPP in the call to come over.

The following is the capture Request processing flowchart for the preview:There are five important processing types that we should focus on when checking the flow:

  • 1.UseCase

Vendor/end/proprietary/chi – CDK/vendor/chioverride/default/chxusecase h it has introduced the class diagram. UseCase has many derivative classes in CamX, which is used by CAMX to create different UseCase objects for different streams, manage selected features, and create pipelines and sessions.

  • 2.ChiFeature

Vendor/end/proprietary/chi – CDK/vendor/chioverride/default/chxfeature. J h, usecase choose corresponding feature, associated with a set of pipeline, received a request to request, Select the corresponding feature according to the request.

  • 3.Node

Vendro/end/propriatary/camx/SRC/core/camxnode. J h, have a class diagram below. Node is a very important parent class in CAMX. It is an intermediate Node in CAMX for processing camera requests. It is used to process pipeline requests. – 4. Pipeline A collection of a series of nodes that are sent to each node for processing under pipeline. – 5.session A collection of associated pipelines used to manage pipelines and process requests using pipelines.

Note: Node nodes are very important in camX Chi architecture, and data processing is carried out through encapsulated Node nodes.Camxnode structure diagram:The node node is created in thevendor/qcom/proprietary/camx/src/hwl/titian17x/camxtitian17xfactory.cpp

Node* Titan17xFactory::HwCreateNode(
    const NodeCreateInputData* pCreateInputData,
    NodeCreateOutputData*      pCreateOutputData
    ) const
{
    Node* pNode = NULL;
 
    switch (pCreateInputData->pNodeInfo->nodeId)
    {
        case AutoFocus:
            pNode = AutoFocusNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case BPS:
            pNode = BPSNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case IFE:
            pNode = IFENode::Create(pCreateInputData, pCreateOutputData);
            break;
        case IPE:
            pNode = IPENode::Create(pCreateInputData, pCreateOutputData);
            break;
        case Sensor:
            pNode = SensorNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case StatsProcessing:
            pNode = StatsProcessingNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case JPEG:
            pNode = JPEGEncNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case JPEGAggregator:
            pNode = JPEGAggrNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case StatsParse:
            pNode = StatsParseNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case ChiExternalNode:
            pNode = ChiNodeWrapper::Create(pCreateInputData, pCreateOutputData);
            break;
        case FDHw:
            pNode = FDHwNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case FDManager:
            pNode = FDManagerNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case OfflineStats:
            pNode = OfflineStatsNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case Torch:
            pNode = TorchNode::Create(pCreateInputData, pCreateOutputData);
            break;
        case LRME:
            pNode = LRMENode::Create(pCreateInputData, pCreateOutputData);
            break;
        case RANSAC:
            pNode = RANSACNode::Create(pCreateInputData, pCreateOutputData);
            break;
        default:
            CAMX_ASSERT_ALWAYS_MESSAGE("Unexpected node type");
            break;
    }
 
    return pNode;
}
Copy the code

Camx_feature:

In vendor/end/proprietary/chi – CDK/vendor/chioverride/default/chxadvancedcamerausecase SelectFeatures of CPP (…). The feature creation code is in the function.

The scenes for taking photos are divided into pre and post. Pre is single shot, and post is multiple shot. There is also an introduction in the front.

The pipeline created by the front photo is:


MiuiZSLSnapshotJpeg at index 0 for session 0, session's pipeline 0, camera id:1
MiuiZSLPreviewRaw at index 1 for session 1, session's pipeline 0, camera id:1
BinningZSLYuv2Jpeg at index 2 for session 2, session's pipeline 0, camera id:1
BinningMerge3YuvCustomTo1Yuv at index 3 for session 3, session's pipeline 0, camera id:1
ZSLSnapshotYUV at index 4 for session 4, session's pipeline 0, camera id:1
AdvancedAsdMeta at index 5 for session 5, session's pipeline 0, camera id:1
SWMFClearShotYuv at index 6 for session 6, session's pipeline 0, camera id:1
BinningZSLSnapshotYUV at index 7 for session 7, session's pipeline 0, camera id:1
Copy the code

Post-photo created pipelines are:

BackCameraJpegEncode at index 0 for session 0, session's pipeline 0, camera id:0
MfnrPrefilter at index 1 for session 0, session's pipeline 1, camera id:0
MfnrBlend at index 2 for session 0, session's pipeline 2, camera id:0
MfnrPostFilter at index 3 for session 0, session's pipeline 3, camera id:0
MfnrScale at index 4 for session 0, session's pipeline 4, camera id:0
Merge3YuvCustomTo1Yuv at index 5 for session 1, session's pipeline 0, camera id:0
ZSLSnapshotYUV at index 6 for session 2, session's pipeline 0, camera id:0
ZSLSnapshotYUVAux at index 7 for session 3, session's pipeline 0, camera id:3
SWMFSRYuv at index 8 for session 4, session's pipeline 0, camera id:0
AdvancedAsdMeta at index 9 for session 5, session's pipeline 0, camera id:0
Copy the code

The configuration file for pipeline in CAMX is: Vendor/end/proprietary/chi – CDK/vendor/topology/default/titan17x_usecases XML, Vendor \qcom\proprietary\ Chi-cdk \vendor\ Chioverride \default\ g_charge. H, vendor\qcom\proprietary\chi-cdk\vendor\chioverride\default\build\android\Android.mk:

. $(info $(shell perl $(CAMX_CDK_PATH)/topology/usecaseconverter.pl $(CAMX_VENDOR_PATH)/topology/default/titan17x_usecases.xml $(LOCAL_PATH)/g_pipelines.h)) ...Copy the code

In \vendor\qcom\proprietary\ Chi-cdk \vendor\ Chioverride \default\chxusecaseutils. CPP, the corresponding Us will be selected according to pStreamConfig->num_streams (g_pipelines. H) :

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////// // UsecaseSelector::DefaultMatchingUsecase //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// / / / / / / / / ChiUsecase * UsecaseSelector: : DefaultMatchingUsecase (camera3_stream_configuration_t * pStreamConfig) {... pSelectedUsecase = &pChiTargetUsecases->pChiUsecases[i]; . }Copy the code

DefaultMatchingUsecase method namely in/vendor/end/proprietary, chi – CDK, vendor, chioverride \ default \ chxadvancedcamerausecase CPP is called:

CDKResult AdvancedCameraUsecase::SelectUsecaseConfig( LogicalCameraInfo* pCameraInfo, ///< Camera info camera3_stream_configuration_t* pStreamConfig) ///< Stream configuration { ... m_pChiUsecase = UsecaseSelector::DefaultMatchingUsecase(pStreamConfig); . }Copy the code

4. Camx debugging

Modify \vendor\qcom\proprietary\camx\ SRC \core\camxsettings. XML to set the log printing level, as follows:

overrideLogLevels=0x1F
logInfoMask=0x40080
logVerboseMask=0x40000
Copy the code

Original link: www.cnblogs.com/blogs-of-lx…

Friendly recommendation: Android dry goods to share

At this point, this has ended, if there is wrong place, welcome your suggestion and correction. Meanwhile, I look forward to your attention. Thank you for reading. Thank you!