首页 > 其他分享 >metada知识

metada知识

时间:2022-11-07 22:23:05浏览次数:48  
标签:metada CONFIG 知识 MTK static 加载 config metadata

metada知识   MTK Metadata Configuration (1) Camera_metadata Introduction (2) Loading Static metadata (1) 加载 sensor & 3A相关的static metadata impBuildStaticInfo_v1加载类型 impBuildStaticInof加载类型 impBuildStaticInfo_v1_overwrite加载类型 加载类型与metadata的对应关系 (2) 加载其他类型的static metadata impConstructStaticMetadata_v1()加载类型 impConstructStaticMetadata_v1_ext()加载类型 (3) request相关的static metadata (3) How to config metadata (1) COMMON_COMMON (2) COMMON_SENSOR (3) PLATFORM_COMMON (4) PLATFORM_SENSOR STREAM 流的配置 Slow Motion功能的配置 (4) How to add a vendor tag (1) 添加客制化的vendor tag (2) 添加requset阶段的vendor tag (3) 添加characteristic的vendor tag (4) 添加config阶段的vendor tag(即session key) (5) How to acquire vendor tag in flow (1) Camera_metadata Introduction Camera API2/HAL3的核心为per-frame control,为了达成这个目标产生了metadata的机制.metadata一共分为三类; Control(request): 当APK query出static metadata后,可以从中作总结想要的控制 Dynamic(result): 当Hal层收到control metadata后,设定进ISP最终产生对应的结果 Static(charateristics): 描述此logcial device的规格与提供的功能   (2) Loading Static metadata Camera static metadata再camerahalserver进程驱动就会进行加载,再onEnumerateDevicesLocked中会去分别加载相关的static_metadata;主要就是分为两类   auto CameraDeviceManagerImpl:: onEnumerateDevicesLocked() -> android::status_t{ ...     sizet const deviceNum = pHalDeviceList->searchDevices();//加载sensor&3A相关的 static metadata          pMetadataProvider = IMetadataProvider::create(instance);//加载其他的static metadata } 1 2 3 4 5 6 7 (1) 加载 sensor & 3A相关的static metadata vendor/mediatek/proprietary/hardware/mtkcam/utils/LogicalCam/HalLogicalDeviceList.cpp searchDevices vendor/mediatek/proprietary/hardware/mtkcam/utils/LogicalCam/HalLogicalDeviceList.cpp createDeviceMap vendor/mediatek/proprietary/hardware/mtkcam/drv/src/sensor/common/v1_1/HalSensorList.cpp searchSensors     HalSensorList::EnumInfo const* HalSensorList:: addAndInitSensorEnumInof_Locked(     IMGSENSOR_SENSOR_IDX eSensorDev,     MUINT                eSensorType,     char                 *szSensorDrvName){ ...        buildStaticInfo(rEnumInfo,rEnumInfo.mMetadata); ... } 1 2 3 4 5 6 7 8 9 10 最终会通过addSensorMetadata()->buildStaticInfo()从camera metadata配置文件加载sensor与3A相关的static metadata或者自动生成特定的static metadata。在Android Q中首先会通过impBuildStaticInfo_v1这一路进行加载,然后回调用impBuildStaticInfo兼容Android P,加载自动生成的metadata,最后调用impBuildStaticInfo_v1_overwrite,加载需要强制复写的metadata,如下   MBOOL HalSensorList:: buildStaticInfo(Info const& rInfo, IMetadata& rMetadata) const {       if( !impBuildStaticInfo_v1(rInfo, rMetadata) ) //加载Android Q架构的metadata       if( !impBuildStaticInfo(rInfo, rMetadata)) //兼容加载Android P架构的metadata          //Sensor manual add tag_list  //加载自动产生的metadata     IMetadata::IEntry entryA(MTK_MULTI_CAM_FEAUTRE_SENSOR_MANULA_UPDATED);     entryA.push_back((MINT64)MTK_SENSOR_INFO_ACTIVE_ARRAT_REGION, Type2Type<MUINT64>());       impBuildStaticInfo_v1_overwrite(rInfo, rMetadata);//提供强制修改metadata的接口 } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 impBuildStaticInfo_v1加载类型 Android Q的加载类型主要有   static char const*const kCommonStaticMetadataNames[] = {     // MODULE     "CAMERA",     "CONTROL_AE",     "CONTROL_AF",     "CONTROL_AWB",     "TUNNING",     "FLASHLIGHT",     "SENSOR",     "LENS",     // // PROJECT     // "AVAILABLE_KEYS",     // "FEATURE",     // "MULTICAM",     // "REQUEST",     // "SCALER",     // "VENDOR",     NULL }; static char const* const kPlatformStaticMetadataNames[] = {     "MODULE",     "LENS",     // "MOD_OVERWRITE"     // "PROJECT",     // // "PRO_OVERWRITE"     NULL }; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 impBuildStaticInof加载类型 impBuildStaticInfo()兼容Android P架构,加载的是Android P类型的metadata,主要类型是   static char const* const kStaticMetadataTypeNames[] = {     "LENS",     "SENSOR",     "TUNNING_3A",     "FLASHLIGHT",     "SCALER",     "FEATURE",     "CAMERA",     "REQUEST",     NULL }; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 impBuildStaticInfo_v1_overwrite加载类型 impBuildStaticInfo_v1_overwrite提供强制修改metadata的接口,加载的类型是[MOD_OVERWRITE]   static char const* const kPlatformOverwriteStaticMetadataNames[] = {     // "MODULE"     // "LENS",     "MOD_OVERWRITE",     // "PROJECT",     // // "PRO_OVERWRITE"     NULL }; 1 2 3 4 5 6 7 8 9 10 11 加载类型与metadata的对应关系 以impBuildStaticInfo为例,介绍加载类型是如何对应上配置中的metadata   static MBOOL impBuildStaticInfo(     Info const&    rInfo,     IMetadata&     rMetadata ){ ...     String8 const s8Symbol_Sensor = String8::format("%s_DEVICE_%s_%s", PREFIX_FUNCTION_STATIC_METADATA,     pTypeName, rInfo.getSensorDrvName().string());     status = impConstructStaticMetadata_by_SymbolName(s8Symbol_sensor, rInfo, rMetadata);       String8 const s8Symbol_Common = String8::format("%s_DEVICE_%s_%s", PREFIX_FUNCTION_STATIC_METADATA,     pTypeName, "COMMON");     status = impConstructStaticMetadata_by_SymbolName(s8Symbol_Common , rInfo, rMetadata); } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 上面部分使用类型等参数从camera metadata配置文件中找到对应文件中的函数指针进行加载, String8::format("%s_DEVICE_%s_%s", PREFIX_FUNCTION_STATIC_METADATA, pTypeName, rInfo.getSensorDrvName().string()); 以LENS类型为例,pTypeName = “LENS”, rInfo.getSensorDevName表示sensorName, 对应的函数指针即 STATIC_METADATA2_BEGIN(DEVICE,LENS,SENSOR_DRVNAME_IMX135_MIPI_RAW), 对应加载的配置文件即 config_static_metadata.lens.imx135mipiraw.h HalSensorList.cpp加载sensor与3A的metadata,主要就是通过impConstructStaticMetadata_by_SymbolName函数去open对应的so库,这里是"libcam.halsensor.so"   MBOOL impConstructStaticMetadata_by_SymbolName(     String8 const& s8Symbol,     Info const&    rInfo,     IMetadata&     rMetadata){ ...     Sting8 const s8LibPath = String8::format("libcam.halsensor.so");     void *handle = ::dlopen(s8LibPath.string(), RTLD_GLOBAL);      } 1 2 3 4 5 6 7 8 9 10 metadata文件的命令主要有三种, “config_request_metadata_*.h”、" config_static_metadata_ *. h"、“config_static_metadata. * .h”;   libcam.halsensor.so默认会加载libcam.halsensor.custom.a这个static lib,而这个static lib加载的则是"config_static_metadata.*.h"类型的文件;类似 config_static_metadata.lens.imx135mipiraw.h config_static_metadata.project.camera.imx135mipiraw.h config_static_metadata.project.flashlight.imx135mipiraw.h config_static_metadata.sensor.imx135mipiraw.h等 vendor/mediatek/proprietary/hardware/mtkcam/drv/src/sensor/mtxxx/custom/Android.mk     #define my-all-config.sensor-metadata-under $(patsubst ./%,%, \     $(shell find $(1) -maxdepth 4 \( -name "config_static_metadata.*.h") \) -and -not -name ".*") \     ) #endef   1 2 3 4 5 6 7 (2) 加载其他类型的static metadata 上述说到除了生成libcam.halsensor.custom.a类型的metadata,还剩下"config_request_metadata_* .h"、" config_static_metadata_ * . h"两类;其他类型的主要是指" config_static_ metadata_ * . h"   status_t MetadataProvider:: onCreate() { ...     status = (mVersion==0)?         constructStaticMetadata(pMetadataConverter, mpStaticCharacteristics, mpHALMetadata):         constructStaticMetadata_v1(pMetadataConverter, mpStaticCharacteristics, mpHALMetadata); } 1 2 3 4 5 6 7 8 9 constructStaticMetadata是Android P的加载流程,Android Q开始默认走的是constructStaticMetadata_v1这一路函数,同加载Sensor与3A metadata一样,这类同样会调用到impConstructStaticMetadata_v1进行配置文件中的static metadata记载,再updata(mtkMetadata)中会自动生成特定的metadata; vendor/mediatek/proprietary/hardware/mtkcam/utils/metastore/metadataprovider/constructStaticMetadata.cpp             impConstrucStaticMetadata_by_SymbolName会去加载so库,constructStaticMetadata.cpp加载的默认路径的so,这里加载的时libmtkcam_metastore.so;   status_t MetadataProvider:: impConstructStaticMetadata_by_SymbolName(     String8 const&  s8Symbol,     IMetadata  &metadata){     typedef status_t (*PFN_T)(         IMetadata &   metadata,         Info const&   info);     PFN_T pfn = (PFN_T)::dlsym(RTKD_DEFAULT, s8Symbol.string());      }   1 2 3 4 5 6 7 8 9 10 11 12 libmtkcam_metastore.so加载了libmtkcam_metastore.static.custom.a,默认会加载"config_static_metadata_*.h"类型,类似 config_static_metadata_feature.h config_static_metadata_request_commonType.h config_static_metadata_scaler.h vendor/mediatek/proprietary/hardware/mtkcam/utils/metastore/metadataprovider/custom/Android.mk   #define my-all-config.metadata-under $(patsubst ./%,%, \   $(shell if [ 0d $(1) ]; then find $(1) -maxdepth 4 \( name  'config_static_metadata_*.h' \) -and -not -name '.*'; fi) \ )   1 2 3 4 5 impConstructStaticMetadata_v1()加载类型 impConstructStaticMetadata_v1()也保留了向前兼容Android P版本的metadata配置,在metadata配置中可以直接按Android P的结构进行配置,这部分加载的类型主要是   static char const*const kCommonStaticMetadataNames[] = {     // // MODULE     // "CAMERA",     // "CONTROL_AE",     // "CONTROL_AF",     // "CONTROL_AWB",     // "TUNNING",     // "FLASHLIGHT",     // "SENSOR",     // "LENS",     // PROJECT     "AVAILABLE_KEYS",     "AVAILABLE_KEYS_VENDOR",     "AVAILABLE_KEYS_CUSTOM",     "FEAUTRE",     "MULTICAM",     "REQUEST",     "SCALER",     "VENDOR",     "CUSTOM",     NULL }; 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 static char const*const kPlatformStaticMetadataNames[] = {     // "MODULE",     // "LENS",     // // "MOD_OVERWRITE"     "PROJECT",     // "PRO_OVERWRITE"     NULL }; 1 2 3 4 5 6 7 8 9 10 11 impConstructStaticMetadata_v1_ext()加载类型 加载的是可选的平台相关的配置,对应的加载类型是   static char const* const kPlatformOptionalStaticMetadataNames[] = {     "AVAILABLE_KEYS",     "VENDOR",     "CUSTOM",     NULL }; 1 2 3 4 5 6 7 8 9 (3) request相关的static metadata 如上,最后还剩下"config_request_metadata_* .h"类型的static metadata ; 当APK调用CameraDevice.createCaptureRequest(eg:CameraDevice.TEMPLATE_PREVIEW),会触发RequestTempalte的加载过程,通过HIDL接口调用到CameraDevice3SessionImpl.cpp中的constructDefaultRequestSettings()方法并创建TemplateRequest实例 vendor/mediatek/proprietary/hardware/mtkcam3/main/hal/device/3.x/device/CameraDevice3SessionImpl.cpp   Return<void> ThisNamespace:: constructDefaultRequestSettings(RequestTemplate type, constructDefaultRequestSettings_cb_hidl_cb) {     ITemplateRequest* obj = NSTemplateRequestManager::valueFor(getInstanceId());     if (obj == nullptr){         obj = ITemplateRequest::getInstance(getInstanceID());         NSTemplateRequestManager::add(getInstanceId(),obj);     }     CameraMetadata metadata;     {         camera_metadata const* p_camera_metadata = obj->getData(static_cast<int>(type));     } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 在ITemplateRequest的getIstance方法中会进行Template.onCreate()的创建动作,紧着调用constructRequsetMetadata加载TempalteRequest还是与之前一样,impConstructRequestMetadata()加载的时配置文件中的TemplateRequest信息,updata()是自动生成的TemplateRequest信息 vendor/mediatek/proprietary/hardware/mtkcam/utils/metastore/templateRequest/TemplateRequest.cpp   TemplateRequest:: constuctRequestMetadata(      int const           requestType,      camera_metadata*&   rpMetadata,      IMetadata&          rMtkMetadata){      MY_LOGD("constructRequestMetadata");          //-----(1)-----//      if( OK != (status = impConstructRequestMetadata(rMtkMetadata, rquestType)) ){          MY_LOGE("Unable evaluate the size for camera staic info -status[%s(%d)]\n",::strerror(-status), -status);          return status;      }      //-----(2)-----/      //overwrite      updateData(rMtkMetadata);      } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 RequestTemplate类型: CAMERA3_TEMPLATE_PREVIEW CAMERA3_TEMPLATE_STILL_CAPTURE CAMERA3_TEMPLATE_VIDEO_RECORD CAMERA3_TEMPLATE_VIDEO_SNAPSHOT CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG impConstructRequestMetadata加载的是默认的搜索路径的so们这里加载的是libmtkcam_metastore.so,这个动态库会加载libmtkcam_metastore.requset.custom.a,它会从metadata配置中加载名为"config_request_metadata_*.h"类型的文件,主要是 config_request_metadata_.h vendor/mediatek/proprietary/hardware/mtkcam/utils/metastore/templateRequest/custom/Android.mk   #define my-all-config.metadata-under $(patsubst ./%,%, \   $(shell if [ 0d $(1) ]; then find $(1) -maxdepth 4 \( name  'config_request_metadata_*.h' \) -and -not -name '.*'; fi) \ )   1 2 3 4 5 Android Q上通过COMMON_HIERARCHY这个宏开关控制走Android Q的Flow,在Andorid Q架构上PLATFORM目录与PROJECT目录一般不妨REQUEST TEMPLATE数据 vendor/mediatek/proprietary/hardware/mtkcam/utils/metastore/templateRequest/custom/TempalteRequest.cpp   #ifdef COMMON_HIERARCHY     //     int32_t result = 0;     {         String8 const s8Symbol_Common = String8::format("%s_COMMON_%s", PREFIX_FUNCTION_REQUEST_METADATA, "COMMON");         status = impConstructRequestMetadata_by_SymbolName(s8Symbol_Common, metadata, requestType);         if( !status ) result|=COMMON_COMMON;         String8 const s8Symbol_Sensor = String8::format("%s_COMMON_%s", PREFIX_FUNCTION_REQUEST_METADATA, nInfo.getSensorDrvName());         status = impConstructRequestMetadata_by_SymbolName(s8Symbol_Sensor , metadata, requestType);         if( !status ) result|=COMMON_SENSOR;     }     //     {         String8 const s8Symbol_Common = String8::format("%s_DEVICE_%s", PREFIX_FUNCTION_REQUEST_METADATA, "DEFAULT");         status = impConstructRequestMetadata_by_SymbolName(s8Symbol_Common, metadata, requestType);         if( !status ) result|=PLATFORM_COMMON;         String8 const s8Symbol_Sensor = String8::format("%s_DEVICE_%s", PREFIX_FUNCTION_REQUEST_METADATA, nInfo.getSensorDrvName());         status = impConstructRequestMetadata_by_SymbolName(s8Symbol_Sensor , metadata, requestType);         if( !status ) result|=PLATFORM_SENSOR;     }     //     {         String8 const s8Symbol_Sensor = String8::format("%s_PROJECT_%s", PREFIX_FUNCTION_REQUEST_METADATA, nInfo.getSensorDrvName());         status = impConstructRequestMetadata_by_SymbolName(s8Symbol_Sensor , metadata, requestType);         if( !status ) result|=PROJECT_SENSOR;     }     META_LOGD("%s: load status(0x%x)", "TemplateRequest", result); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 (3) How to config metadata (O - > Android 8 P - > Andorid 9 Q - > Android 10, R - > Android 11) Android Q版本加载的metadata配置文件路径如下图: Android 会先加载COMMON,再加载PLATFORM目录下的metadata,再加载PROJECT目录。Project目前很少用到;后面加载的会覆盖前面加载的metadata或者前面加载的metadata基础上追加   Path    Priority PROJECT    CUSTOM\$(PROJECT)\hal\imgsensor_metadata\common [PROJECT_COMMON] CUSTOM\$(PROJECT)\hal\imgsensor_metadata\imx_mipi_raw [PROJECT_SENSOR]    High PLATFORM    CUSTOM\$(PROJECT)\hal\imgsensor_metadata\common [PALTFORM_COMMON] CUSTOM\$(PROJECT)\hal\imgsensor_metadata\imx_mipi_raw [PALTFORM_SENSOR]    Mid PROJECT    CUSTOM\$(PROJECT)\hal\imgsensor_metadata\common [COMMON_COMMON] CUSTOM\$(PROJECT)\hal\imgsensor_metadata\imx_mipi_raw [COMMON_SENSOR]    Low 在同级目录下的加载顺序则为先COMMON目录,紧接着是PLATFORM目录,最后是PROJECT目录,对于某些tag,并不希望直接覆盖前面已经加载的tag对应的Metadata,那么则需要使用APPEND_METADATA_BEGIN/APPEND_METADATA_END接口。如在PLATFORM_SENSOR目录下希望增加MTK_REQUSET_AVAILABLE_REQUEST_KEYS中的key,如果直接使用CONFIG_METADATA_BEGIN/CONFIG_METADATA_END接口,就会直接覆盖COMMON_COMMOM中的config_static_metadata_availableKey.h加载的所有MTK_REQUEST_AVAILABLE_REQUEST_KEYS,最终可能只剩下PLATFORM_SENSOR中增加的这一个。   (1) COMMON_COMMON 该目录结构如下图,主要配置TemplateRequest,以及所有平添通用的3A或者metadta配置,该文件夹会最先被加载 vendor/mediatek/proprietary/custom/common/hal/imgsensor_metadata/common/   config_request_metadata_.h config_static_metadata.ae.h config_static_metadata.af.h config_static_metadata.awb.h config_static_metadata.camera.h config_static_metadata.flashlight.h config_static_metadata.tunning.h config_static_metadata_availableKeys.h config_static_metadata_custom.h config_static_metadata_feature.h config_static_metadata_multicam.h config_static_metadata_request.h config_static_metadata_scaler.h config_static_metadata_vendor.h //config_request_metadata_.h:配置 Template Request, android.*/com.mediatek.* 1   config_static_metadata.ae.h:配置CONTROL_AE类型的Metadata,第一个参数COMMON和最后一个参数COMMON表示 位于COMMON-COMMON目录下(后面都参考此规则),第二个参数表示类型; android.control.ae* STATIC_METADATA_BEGIN(COMMON, CONTROL_AE, COMMON) //-------------------------------------------- //android.control.ae* //-------------------------------------------- android.control.af* STATIC_METADATA_BEGIN(COMMON, CONTROL_AF, COMMON) //-------------------------------------------- //android.control.af* //-------------------------------------------- 1 2   (2) COMMON_SENSOR 该目录结构如下,主要配置的是特定sensor相关的信息,所有平台都通用的camera sensor属性 vendor/mediatek/proprietary/custom/common/hal/imgsensor_metadata/sensor/imx_mipi_raw   config_static_metadata.sensor.imxmipiraw.h 1 (3) PLATFORM_COMMON 该目录下的文件结构如下所示,以DEVICE开头的都是Android P的Metadata加载方式,只有按照Android Q的方式没有加载到数据时才会使用 vendor/mediatek/proprietary/custom/mt6761/hal/imgsensor_metadata/common/   config_static_metadata.lens.h config_static_metadata.project.flashlight.h config_static_metadata.sensor.h config_static_metadata.tunning_3a.h config_static_metadata_common.h config_static_metadata_feature.h config_static_metadata_project.h config_static_metadata_request_commonType.h config_static_metadata_scaler.h   config_static_metadata_project.h 配置PROJECT类型的Metadata,位于PLAFTOFMR目录下目前存放了 PLATFORM通用的stream configuration STATIC_METADATA2_BEGIN(PLATFORM, PROJECT, DEFAULT) //-------------------------------------------- //android.requset 1   (4) PLATFORM_SENSOR 文件结构如下,该目录配置的时Platform中Camera Sensor特有的camera metadata配置 size=4>vendor/mediatek/proprietary/custom/mt6761/hal/imgsensor_metadata/imx_mipi_raw/   config_static_metadata.lens.imxmipiraw.h config_static_metadata.module.imxmipiraw.h config_static_metadata_availableKeys.h config_static_metadata_custom.h config_static_metadata_project.h config_static_metadata_vendor.h   config_static_metadata_availableKeys.h 配置的是AVAILABLE_KEYS类型的Metadata,可以在这里添加自定义的Vendor Tag(sensor 特有的) STATIC_METADATA2_BEGIN(PLATFORM, AVAILABLE_KEYS, SENSOR_DRVNAME_IMX_MIPI_RAW) //-------------------------------------------- //android.requset   config_static_metadata_custom.h 配置的是CUSTOMER类型的Metadata,可以在这里添加自定义的Metadata(sensor特有的): com.xxx.* STATIC_METADATA2_BEGIN(PLATFORM, CUSTOM, SENSOR_DRVNAME_IMX_MIPI_RAW) //-------------------------------------------- //com.xxx.*   config_static_metadata_project.h 配置的是PROJECT类型的Metadata,可以在这里添加Stream Configuration STATIC_METADATA2_BEGIN(PLATFORM, PROJECT, SENSOR_DRVNAME_IMX_MIPI_RAW) //-------------------------------------------- //android.requset config_static_metadata_vendor.h 配置的是VENDOR类型的Metadata,目前用于MTK 的Vendor Tag     22 STREAM 流的配置 HAL_PIXEL_FORMAT_BLOB表示Picture-size,必须是16 align,最大必须填到跟sensor的szie小于3%的差距,宽高比位标准4:3或16:9 HAL_PIXEL_FORMAT_YCbCr_420_888用于preview、video size,只要配置了YCbCr_420_888 output,同时需要配置相同的BLOB size,HAL_PIXEL_FORMAT_YCbCr_420_888的input config用于支持yuv-reporcessing HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED则是用于private-reporcessing,仅用于input配置,不需要output,反而回引起问题 HAL_PIXEL_FORMAT_RAW16 只需要填一組output config, size同sensor size,支持拍raw图   若是有支援reprocessing, 则需要定义如下   CONFIG_METADATA_BEGIN(MTK_REPROCESS_MAX_CAPTURE_STALL)        CONFIG_ENTRY_VALUE(2 , MINT32) CONFIG_METADATA_END() 1 2 3 CONFIG_ENTRY_VALUE(HAL_PIXEL_FORMAT_YCbCr_420_888, MINT64) CONFIG_ENTRY_VALUE(4608, MINT64) CONFIG_ENTRY_VALUE(3456, MINT64) CONFIG_ENTRY_VALUE(MTK_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT, MINT64) CONFIG_ENTRY_VALUE(66666666, MINT64) CONFIG_ENTRY_VALUE(0, MINT64) //CTS testStreamConfigurationMap 1 2 3 4 5 6 min frame duration 表示size streaming出的情況下, frame 与 frame之间的最短duration stall duration 表示size因为后处理所要付出的额外时间 (例如jpeg的encode) min frame duration 影响rrzo的大小,影响p1的出图规则(正常rrzo要小于picture size)(p1→p2 p2a 将raw图转yuv) mtkcam3/pipeline/policy/config/mtkcam-P1HwSettingPolicy configP1HwSetting minDuration mtkcam3/pipeline/policy/FeatureSettingPolicy.cpp evaluateCaptureSetting needCaptureNode mtkcam3/pipeline/policy/requset/P2NodeDecisionPolicy.cpp decideStreamOut sensor imgo im2go输出的都是raw图;preview只出im2go;capture两个都出(imgo 纯raw图) P1Node负责输出raw图;P2CaptureNode主要负责拍照的frame的处理;P2StreamingNode主要负责录像预览的数据处理; JpegNode的输入时main YUV、Thumbnail YUV及metadata,输出是Jpeg及App metadata   Slow Motion功能的配置 首先得确保再ProjectConfig.mk中 MTK_SLOW_MOTION_VIDEO_SUPPORT = yes   config_static_metadata_availablekeys.h       APPEND_METADATA_BEGIN(MTK_REQUEST_AVAILABLE_RESULT_KEYS)//new hidden         //APPEND_ENTRY_VALUE(MTK_SMVR_FEATURE_SMVR_RESULT, MINT32)     APPEND_METADATA_END()     //==========================================================================     APPEND_METADATA_BEGIN(MTK_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS)//new hidden         APPEND_ENTRY_VALUE(MTK_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS, MINT32)     APPEND_METADATA_END() 1 2 3 4 5 6 7 config_static_metadata_project.h       CONFIG_METADATA_BEGIN(MTK_REQUEST_AVAILABLE_CAPABILITIES)//new         CONFIG_ENTRY_VALUE(MTK_REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO, MUINT8)     CONFIG_METADATA_END()     //==========================================================================     CONFIG_METADATA_BEGIN(MTK_CONTROL_AVAILABLE_HIGH_SPEED_VIDEO_CONFIGURATIONS)//new hidden        CONFIG_ENTRY_VALUE(1920, MINT32)    // width        CONFIG_ENTRY_VALUE(1080, MINT32)    // height        CONFIG_ENTRY_VALUE(  30, MINT32)    // fps_min        CONFIG_ENTRY_VALUE( 120, MINT32)    // fps_max        CONFIG_ENTRY_VALUE(   4, MINT32)    // batch_size_max        CONFIG_ENTRY_VALUE(1920, MINT32)    // width        CONFIG_ENTRY_VALUE(1080, MINT32)    // height        CONFIG_ENTRY_VALUE( 120, MINT32)    // fps_min        CONFIG_ENTRY_VALUE( 120, MINT32)    // fps_max        CONFIG_ENTRY_VALUE(   4, MINT32)    // batch_size_max        CONFIG_ENTRY_VALUE(1280, MINT32)    // width        CONFIG_ENTRY_VALUE( 720, MINT32)    // height        CONFIG_ENTRY_VALUE(  30, MINT32)    // fps_min        CONFIG_ENTRY_VALUE( 120, MINT32)    // fps_max        CONFIG_ENTRY_VALUE(   4, MINT32)    // batch_size_max        CONFIG_ENTRY_VALUE(1280, MINT32)    // width        CONFIG_ENTRY_VALUE( 720, MINT32)    // height        CONFIG_ENTRY_VALUE( 120, MINT32)    // fps_min        CONFIG_ENTRY_VALUE( 120, MINT32)    // fps_max        CONFIG_ENTRY_VALUE(   4, MINT32)    // batch_size_max     CONFIG_METADATA_END() 1 2 3   26 以上是google AOSP 120fps的配置,MTK提供SMVR功能,SMVR与google AOSP不能同时配置,会导致慢动作crash,项目中有遇到前摄VTS测不过,使用原生接口有问题,后来就改成了MTK SMVR Batch Mode   SMVR(Slow Motion Video Record),MTK支持三种模式 (1) constrained high speed recording 原生支持120fps,但仅能使用与Camera2 API,并且提供了 HD 和 FHD的分辨率 (2) continuos mode with batch-frames buffer 持续模式意味着,能一直录制知道用户停止,或达到内存上限,提供了240fps 和 HD resolution (3)burst mode with dram-buffering (3)是(2)的一个转变,提供更好帧率的录制同时减少了录制时间,提供480fps 和 HD resolution   config_static_metadata_availablekeys.h       APPEND_METADATA_BEGIN(MTK_REQUEST_AVAILABLE_RESULT_KEYS)//new hidden         APPEND_ENTRY_VALUE(MTK_SMVR_FEATURE_SMVR_RESULT, MINT32)     APPEND_METADATA_END() 1 2 3 config_static_metadata_vendor.h       CONFIG_METADATA_BEGIN(MTK_SMVR_FEATURE_AVAILABLE_SMVR_MODES)//  new hidden         CONFIG_ENTRY_VALUE(1280, MINT32)    // width         CONFIG_ENTRY_VALUE( 720, MINT32)    // height         CONFIG_ENTRY_VALUE( 120, MINT32)    // fps_max         CONFIG_ENTRY_VALUE(   4, MINT32)    // p2-custom-batch-num     CONFIG_METADATA_END() 1 2 3 4 5 6 没有慢动作选项或者效果需要注意media_profiles.xml中各sensor_id的支持能力,例如          <EncoderProfile quality="highspeed720p" fileFormat="mp4" duration="30">             <Video codec="h264"                    bitRate="17000000"                    width="1280"                    height="720"                    frameRate="240" />             <Audio codec="aac"                    bitRate="256000"                    sampleRate="48000"                    channels="2" />         </EncoderProfile> 1 2 3 4 5 6 7 8 9 10 11 (4) How to add a vendor tag (1) 添加客制化的vendor tag 无论是characteristic类型的,还是config阶段的session key 或者是 requset 阶段的control key都是需要进行如下定义的 vendor/mediatek/proprietary/hardware/mtkcam/include/mtkcam/utils/metadata/client/mtk_metadata_tag.h   typedef enum mtk_camera_metadata_section { ... ...     //vendor tag     MTK_VENDOR_TAG_SECTION          = 0x8000,     MTK_FACE_FEATURE                = 0,     MTK_NR_FEATURE                  = 1,     MTK_STEREO_FEATURE              = 2,     MTK_HDR_FEATURE                 = 3,     MTK_MFNR_FEATURE                = 4,     MTK_CSHOT_FEATURE               = 5,     MTK_3A_FEATURE                  = 6,     MTK_EIS_FEATURE                 = 7,     MTK_STREAMING_FEATURE           = 8,     MTK_VSDOF_FEATURE               = 9,     MTK_MULTI_CAM_FEATURE           = 10,     MTK_CONTROL_CAPTURE             = 11,     MTK_BGSERVICE_FEATURE           = 12,     MTK_CONFIGURE_SETTING           = 13,     MTK_FLASH_FEATURE               = 14,     MTK_SMVR_FEATURE                = 15,     MTK_SINGLEHW_SETTING            = 16,     MTK_ABF_FEATURE                 = 17,     MTK_CUSTOM_FEATURE             = 18, //客制化     MTK_VENDOR_SECTION_COUNT, } mtk_camera_metadata_section_t; //客制化feature段起始地址 typedef enum mtk_camera_metadata_section_start { ... ...     MTK_SINGLEHW_SETTING_START                  = (MTK_SINGLEHW_SETTING + MTK_VENDOR_TAG_SECTION) << 16,     MTK_ABF_FEATURE_START                       = (MTK_ABF_FEATURE + MTK_VENDOR_TAG_SECTION)   << 16,     MTK_CUSTOM_FEATURE_START                   = (MTK_CUSTOM_FEATURE + MTK_VENDOR_TAG_SECTION)   << 16, //客制化 } //客制化获取的metadata变量 typedef enum mtk_camera_metadata_tag{ ... ...     MTK_CUSTOM_FEATURE_SENSOR_INFO_NAME = MTK_CUSTOM_FEATURE_START, //客制化     MTK_CUSTOM_FEATURE_END,     ... }mtk_camera_metadata_tag_t;       vendor/mediatek/proprietary/hardware/mtkcam/include/mtkcam/utils/metadata/client/mtk_metadata_tag_info.inl   _IMP_SECTION_INFO_(MTK_CUSTOM_FEATURE,             "mtk.custom")   _IMP_TAG_INFO_( MTK_CUSTOM_FEATURE,                 MUINT8,     "mtk.custom")     6 vendor/mediatek/proprietary/hardware/mtkcam/include/mtkcam/utils/metadata/vendortag/VendorTagTable.h   static auto& _MTKCustomFeature_() {     static const std::map<uint32_t, VendorTag_t>     sInst = {         _TAG_(MTK_CUSTOM_FEATURE,             "mtk.custom",   TYPE_BYTE),       };     //     return sInst; } static auto& getGlobalSections() {     static std::vector<VendorTagSection_t>     sMTKSections = {         _SECTION_( "com.mediatek.facefeature",                     MTK_FACE_FEATURE_START,                     MTK_FACE_FEATURE_END,                     _FaceFeature_() ),         ...         ...         _SECTION_( "mtk.custom",                 MTK_CUSTOM_FEATURE_START,                 MTK_CUSTOM_FEATURE_END,                 _MTKCustomFeature_() ),       };     ... }   (2) 添加requset阶段的vendor tag vendor/mediatek/proprietary/cutom/mtxxx/hal/imgsensor_metadata/xxx_mipi_raw/config_static_metadata_availablekeys.h   APPEND_METADATA_BEGIN(MTK_REQUEST_AVAILABLE_REQUEST_KEYS)     APPEND_ENTRY_VALUE(MTK_CUSTOM_FEATURE, MINT32) APPEND_METADATA_END()   (3) 添加characteristic的vendor tag CONFIG_METADATA_BEGIN(MTK_CUSTOM_FEATURE)     CONFIG_ENTRY_VALUE(1, MINT32) CONFIG_METADATA_END()   (4) 添加config阶段的vendor tag(即session key) vendor/mediatek/proprietary/cutom/mtxxx/hal/imgsensor_metadata/xxx_mipi_raw/config_static_metadata_availablekeys.h   APPEND_METADATA_BEGIN(MTK_REQUEST_AVAILABLE_SESSION_KEYS)     APPEND_ENTRY_VALUE(MTK_CUSTOM_FEATURE, MIN32) APPEND_METADATA_END() 1 2 3 或者在constructStaticMetadata.cpp去动态更新 vendor/mediatek/proprietary/hardware/mtkcam/utils/metastore/metadataprovider/constructStaticMetadata.cpp   void MetadataProvider:: updataData(IMetadata &rMetadata) {     updataStreamConfiguration(rMetadata);     updataRecommendedStreamConfiguration(rMetadata);     updataAfRegions(rMetadata);     ...     {         IMetadata::IEntry availCharactsEntry = rMetadata.entryFor(MTK_REQUEST_AVAILABLE_CHARACTERISTICS_KEYS);         availCharactsEntry.push_back(MTK_HDR_FEATURE_AVAILABLE_HDR_MODES_PHOTO, Type2Type<MINT32 >());         availCharactsEntry.push_back(MTK_HDR_FEATURE_AVAILABLE_HDR_MODES_VIDEO, Type2Type<MINT32 >());         availCharactsEntry.push_back(MTK_HDR_FEATURE_AVAILABLE_MSTREAM_HDR_MODES, Type2Type<MINT32 >());         rMetadata.updata(availCharactsEntry.tag(), availCharactsEntry);     }     ...         IMetadata::IEntry customFeature = rMetadata.entryFor(MTK_REQUEST_AVAILABLE_SESSION_KEYS);         customFeature.push_back(MTK_CUSTOM_FEATURE, Type2Type< MINT32 >());         rMetadata.updata(customFeature.tag(), customFeature);   (5) How to acquire vendor tag in flow //session key pParsedAppConfiguration结构体 auto const& pParsedAppCfg       = pPipelineUserConfiguration->pParsedAppConfiguration; IMetadata::getEntry<MUINT8>(&pParsedAppCfg->sessionParams, MTK_CUSTOM_FEATURE, value);   //RequestPtr pRequest; IMetadata* pAppMeta = pRequest->mIMetadataApp->acquire(); IMetadata* pHalMeta  = pRequest->mIMetadataHal->acquire(); IMetadata* IMetaDynamic = pRequest->mIMetadataDynamic->acquire();   IMetadata::setEntry<MINT32>(pHalMeta, MTK_3A_ISP_BYPASS_LCE, 0);//Bypass isp  

标签:metada,CONFIG,知识,MTK,static,加载,config,metadata
From: https://www.cnblogs.com/breadmachine/p/16867695.html

相关文章

  • camera 硬件知识
    camera 硬件知识 MIPI接口的硬件原理图!4.常见基本概念我们这的BB端-原本是是baseband基带的意思,这里理解成CPU即可a)三路电压camera包含的三路电压为模拟电压(VCAM......
  • 闭包小知识:闭包实现数据缓存、变量隔离,以及柯里化的使用场景
    缓存什么是缓存函数?接收一个函数,用闭包将每次函数执行的结果缓存起来缓存例子1: /**闭包实现缓存*属性:有个键--值--->所以可以将缓存数据存放在一个对......
  • Java入门知识点;eclipse编辑器
    eclipse快捷键sysoalt+/mainalt+/运行:Ctrl+F11多行注释:Ctrl+Shift+/多行编辑:Alt+Shift+A大小写:Ctrl+Shift+X(小变大)Ctrl+Shift+Y(大变小)快速创建getter与setter:......
  • FHE学习笔记 #3 数论中的前置知识
    文章使用wolai编写并导出,在wolai中观看效果更好,有颜色高亮和实时更新不可约多项式IrreduciblePolynomialIrreduciblepolynomial-Wikipedia定义比较多,通俗......
  • C++入门知识点
        今天我为大家带来的是有关C++入门知识点,总共分为5个小知识点,分别是:命名空间,缺省参数,函数重载,引用和auto关键字(C++11)。在这其中,我们还会穿插将一些知识点,希望大......
  • 记录工作中可能需要用到的零散知识点
    1、命令行快速删除文件,例如删除node_modulesrimrafnode_modules//如需使用该命令,还需要安装rimraf  npminstall-g rimraf 2、命令行清除npm缓存npmcacheclea......
  • Vue3知识点之数据侦测
    Vue的核心之一就是响应式系统,通过侦测数据的变化,来驱动更新视图。实现可响应对象的方式通过可响应对象,实现对数据的侦测,从而告知外界数据变化。实现可响应对象的方式:g......
  • python二十九课--对象的封装与多态等知识
    上周内容回顾动静态方法类体代码中编写的函数有三种类型1.绑定给对象的方法:对象调用自动当做第一个参数传入 类中直接定义函数 classC1:def......
  • 初中知识,平方差公式和一元二次方程
    初中知识,平方差公式和一元二次方程   平面直角坐标系表示 ......
  • 知识蒸馏 -- 简单代码 实现
    知识蒸馏还是先来简单回顾下知识蒸馏的基本知识。知识蒸馏的核心思想就是:通过一个预训练的大的、复杂网络(教师网络)将其所学到的知识迁移到另一个小的、轻量的网络(学生......