分析AEC问题时需要打开如下Log Group:
- Sensor
- Stats
- AEC
打开Verbose和Info Log中的以上Group:
adb root
adb remount
adb shell "echo logVerboseMask=0x2000202 >> /vendor/etc/camera/
camxoverridesettings.txt"
adb shell "echo logInfoMask=0x2000202 >> /vendor/etc/camera/
camxoverridesettings.txt"
adb reboot
AEC算法每帧输出的信息, AEC_DEBUG_OUTPUT
搜索: AEC_DEBUG_OUTPUT
AEC_DEBUG_OUTPUT
对应打印Log的代码:
CAMX_LOG_VERBOSE(CamxLogGroupAEC,
"AEC_DEBUG_OUTPUT: %s FrameControl: G ET (0:%f %ld)(1:%f %ld)(2:%f %ld) LuxInd=%f EngAEState=%d "
"PreFlashState=%d FlashType=%d LED 1:2=%d:%d",
pTriggerName,
pAlgoOutput->engineFrameControl.exposureData[ExposureIndexShort].linearGain,
pAlgoOutput->engineFrameControl.exposureData[ExposureIndexShort].exposureTime,
pAlgoOutput->engineFrameControl.exposureData[ExposureIndexLong].linearGain,
pAlgoOutput->engineFrameControl.exposureData[ExposureIndexLong].exposureTime,
pAlgoOutput->engineFrameControl.exposureData[ExposureIndexSafe].linearGain,
pAlgoOutput->engineFrameControl.exposureData[ExposureIndexSafe].exposureTime,
pAlgoOutput->engineFrameControl.frameControl.luxIndex,
m_AECState, m_AECPreFlashState,
pAlgoOutput->engineFrameControl.frameControl.flashState,
pAlgoOutput->engineFrameControl.LEDCurrents[LEDSetting1],
pAlgoOutput->engineFrameControl.LEDCurrents[LEDSetting2]);
CAMX_LOG_VERBOSE(CamxLogGroupAEC,
"AEC_DEBUG_OUTPUT: %s FrameInfo: Settled=%d snapshotInd=%d LEDAFReq=%d FL:%f",
pTriggerName, pAlgoOutput->frameInfo.aecSettled,
pAlgoOutput->frameInfo.snapshotIndicator, pAlgoOutput->frameInfo.LEDAFRequired,
pAlgoOutput->frameInfo.frameLuma);
对应的Log输出:
11-13 17:16:22.823 881 1446 V CamX : [ VERB][STATS_AEC] camxaecengine.cpp:3189 DumpAEEngineOutputResults() AEC_DEBUG_OUTPUT: AEFC:Preview FrameControl: G ET (0:4.348665 66277668)(1:4.348665 66277668)(2:4.348665 66277668) LuxInd=329.837830 EngAEState=3 PreFlashState=0 FlashType=0 LED 1:2=0:0
11-13 17:16:22.823 881 1446 V CamX : [ VERB][STATS_AEC] camxaecengine.cpp:3195 DumpAEEngineOutputResults() AEC_DEBUG_OUTPUT: AEFC:Preview FrameInfo: Settled=1 snapshotInd=1 LEDAFReq=1 FL:78.712822
其中:
- G ET表示Gain ExposureTime,有三组:
- 短曝:(0:4.348665 66277668),Gain为4.348665,曝光时间为66277668(66ms)
- 长曝:(1:4.348665 66277668),Gain为4.348665,曝光时间为66277668(66ms)
- 正常曝:(2:4.348665 66277668),Gain为4.348665,曝光时间为66277668(66ms)
- LuxInd表示Lux Index
- EngAEState表示AEC的状态,状态定义如下:
- PreFlashState表示Flash预闪状态,状态定义如下:
- FlashType表示闪光灯状态,状态定义如下:
- LED 1:2表示两个LED Setting状态
Sensor每帧计算和生效的曝光时间和Gain, CalculateExposure
搜索 CalculateExposure
CalculateExposure
对应打印log的代码:
CAMX_LOG_VERBOSE(CamxLogGroupSensor,
"Long (TG:%f AG:%f DG:%f ISPG:%f LC:%u) Middle (TG:%f AG:%f DG:%f ISPG:%f LC:%u) "
"Short (TG:%f AG:%f DG:%f ISPG:%f LC:%u)",
realGain,
pExposureInfo->analogRealGain,
pExposureInfo->digitalRealGain,
pExposureInfo->ISPDigitalGain,
pExposureInfo->lineCount,
middleRealGain,
pExposureInfo->middleAnalogRealGain,
pExposureInfo->middleDigitalRealGain,
pExposureInfo->middleISPDigitalGain,
pExposureInfo->middleLinecount,
shortRealGain,
pExposureInfo->shortAnalogRealGain,
pExposureInfo->shortDigitalRealGain,
pExposureInfo->shortISPDigitalGain,
pExposureInfo->shortLinecount);
会得到下面的Log:
11-13 17:22:35.064 873 1372 V CamX : [ VERB][SENSOR ] camximagesensordata.cpp:1032 CalculateExposure() Long (TG:3.863595 AG:3.849624 DG:1.000000 ISPG:1.003629 LC:1220) Middle (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:0) Short (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:1)
11-13 17:22:35.605 873 1373 V CamX : [ VERB][SENSOR ] camximagesensordata.cpp:1032 CalculateExposure() Long (TG:3.863595 AG:3.849624 DG:1.000000 ISPG:1.003629 LC:1220) Middle (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:0) Short (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:1)
11-13 17:22:35.658 873 1375 V CamX : [ VERB][SENSOR ] camximagesensordata.cpp:1032 CalculateExposure() Long (TG:3.863595 AG:3.849624 DG:1.000000 ISPG:1.003629 LC:1220) Middle (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:0) Short (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:1)
11-13 17:22:35.783 873 1376 V CamX : [ VERB][SENSOR ] camximagesensordata.cpp:1032 CalculateExposure() Long (TG:3.863595 AG:3.849624 DG:1.000000 ISPG:1.003629 LC:1220) Middle (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:0) Short (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:1)
11-13 17:22:35.914 873 1371 V CamX : [ VERB][SENSOR ] camximagesensordata.cpp:1032 CalculateExposure() Long (TG:3.863595 AG:3.849624 DG:1.000000 ISPG:1.003629 LC:1220) Middle (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:0) Short (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:1)
11-13 17:22:35.959 873 1372 V CamX : [ VERB][SENSOR ] camximagesensordata.cpp:1032 CalculateExposure() Long (TG:3.863595 AG:3.849624 DG:1.000000 ISPG:1.003629 LC:1220) Middle (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:0) Short (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:1)
11-13 17:23:27.080 873 1374 V CamX : [ VERB][SENSOR ] camximagesensordata.cpp:1032 CalculateExposure() Long (TG:5.590778 AG:5.562500 DG:1.000000 ISPG:1.005084 LC:3538) Middle (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:0) Short (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:3)
11-13 17:23:27.133 873 1376 V CamX : [ VERB][SENSOR ] camximagesensordata.cpp:1032 CalculateExposure() Long (TG:5.590778 AG:5.562500 DG:1.000000 ISPG:1.005084 LC:3538) Middle (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:0) Short (TG:0.000000 AG:0.000000 DG:0.000000 ISPG:0.000000 LC:3)
其中一些缩写的全称如下:
- TG: Total Gain
- AG: Analog Gain
- DG: Digital Gain
- ISPG: ISP Gain
- LC: linecount
Sensor每帧输出的Metadata信息, PublishPerFrameSensorMetaData
搜索 PublishPerFrameSensorMetaData
PublishPerFrameSensorMetaData
对应打印Log的代码:
CAMX_LOG_INFO(CamxLogGroupSensor,
"Sensor[%d]:ReqId[%llu]: contextTypeID: %d, frameDuration: %llu,"
"exposureTime:[long: %llu, middle: %llu, short: %llu], "
"sensorGain: [long: %f, middle: %f, short: %f], "
"sensorSensitivity: [long: %d, middle: %d, short: %d], "
"Again:[long: %f, middle: %f, short: %f], "
"Dgain:[long: %f, middle: %f, short: %f], "
"ISPDGain:[long: %f, middle:%f, short: %f], "
"ISO100Gain:%f, rollingShutterSkew: %llu, FilterArrangement: %d resID %d",
m_cameraId,
requestId,
contextTypeID,
metaData.frameDuration,
metaData.exposureTime,
metaData.middleExposureTime,
metaData.shortExposureTime,
metaData.sensorGain,
metaData.middleSensorGain,
metaData.shortSensorGain,
metaData.sensitivity,
metaData.middleSensitivity,
metaData.shortSensitivity,
sensorAnalogRealGain,
sensorMiddleAnalogRealGain,
sensorShortAnalogRealGain,
sensorDigitalRealGain,
sensorMiddleDigitalRealGain,
sensorShortDigitalRealGain,
ISPDigitalGain,
middleISPDigitalGain,
shortISPDigitalGain,
ISO100Gain,
metaData.rollingShutterSkew,
metaData.filterArrangement,
m_currentResolutionIndex);
对应输出的Log:
11-13 17:39:32.968 880 1501 I CamX : [ INFO][SENSOR ] camxsensornode.cpp:1622 PublishPerFrameSensorMetaData() Sensor[1]:ReqId[5]: contextTypeID: 0, frameDuration: 66307296,exposureTime:[long: 66277668, middle: 0, short: 56190], sensorGain: [long: 4.406250, middle: 0.000000, short: 0.000000], sensorSensitivity: [long: 441, middle: 0, short: 0], Again:[long: 4.406250, middle: 0.000000, short: 0.000000], Dgain:[long: 1.000000, middle: 0.000000, short: 0.000000], ISPDGain:[long: 1.001626, middle:0.000000, short: 0.000000], ISO100Gain:1.000000, rollingShutterSkew: 28321082, FilterArrangement: 2 resID 1