Loading services/camera/libcameraservice/api1/client2/FrameProcessor.cpp +18 −12 Original line number Original line Diff line number Diff line Loading @@ -78,7 +78,7 @@ bool FrameProcessor::processSingleFrame(CaptureResult &frame, } } if (mSynthesize3ANotify) { if (mSynthesize3ANotify) { process3aState(frame.mMetadata, client); process3aState(frame, client); } } return FrameProcessorBase::processSingleFrame(frame, device); return FrameProcessorBase::processSingleFrame(frame, device); Loading Loading @@ -212,14 +212,15 @@ status_t FrameProcessor::processFaceDetect(const CameraMetadata &frame, return OK; return OK; } } status_t FrameProcessor::process3aState(const CameraMetadata &frame, status_t FrameProcessor::process3aState(const CaptureResult &frame, const sp<Camera2Client> &client) { const sp<Camera2Client> &client) { ATRACE_CALL(); ATRACE_CALL(); const CameraMetadata &metadata = frame.mMetadata; camera_metadata_ro_entry_t entry; camera_metadata_ro_entry_t entry; int cameraId = client->getCameraId(); int cameraId = client->getCameraId(); entry = frame.find(ANDROID_REQUEST_FRAME_COUNT); entry = metadata.find(ANDROID_REQUEST_FRAME_COUNT); int32_t frameNumber = entry.data.i32[0]; int32_t frameNumber = entry.data.i32[0]; // Don't send 3A notifications for the same frame number twice // Don't send 3A notifications for the same frame number twice Loading @@ -238,26 +239,31 @@ status_t FrameProcessor::process3aState(const CameraMetadata &frame, // TODO: Also use AE mode, AE trigger ID // TODO: Also use AE mode, AE trigger ID gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AF_MODE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AF_MODE, &new3aState.afMode, frameNumber, cameraId); &new3aState.afMode, frameNumber, cameraId); gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AWB_MODE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AWB_MODE, &new3aState.awbMode, frameNumber, cameraId); &new3aState.awbMode, frameNumber, cameraId); gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AE_STATE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AE_STATE, &new3aState.aeState, frameNumber, cameraId); &new3aState.aeState, frameNumber, cameraId); gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AF_STATE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AF_STATE, &new3aState.afState, frameNumber, cameraId); &new3aState.afState, frameNumber, cameraId); gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AWB_STATE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AWB_STATE, &new3aState.awbState, frameNumber, cameraId); &new3aState.awbState, frameNumber, cameraId); gotAllStates &= get3aResult<int32_t>(frame, ANDROID_CONTROL_AF_TRIGGER_ID, if (client->getCameraDeviceVersion() >= CAMERA_DEVICE_API_VERSION_3_2) { new3aState.afTriggerId = frame.mResultExtras.afTriggerId; new3aState.aeTriggerId = frame.mResultExtras.precaptureTriggerId; } else { gotAllStates &= get3aResult<int32_t>(metadata, ANDROID_CONTROL_AF_TRIGGER_ID, &new3aState.afTriggerId, frameNumber, cameraId); &new3aState.afTriggerId, frameNumber, cameraId); gotAllStates &= get3aResult<int32_t>(frame, ANDROID_CONTROL_AE_PRECAPTURE_ID, gotAllStates &= get3aResult<int32_t>(metadata, ANDROID_CONTROL_AE_PRECAPTURE_ID, &new3aState.aeTriggerId, frameNumber, cameraId); &new3aState.aeTriggerId, frameNumber, cameraId); } if (!gotAllStates) return BAD_VALUE; if (!gotAllStates) return BAD_VALUE; Loading services/camera/libcameraservice/api1/client2/FrameProcessor.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -58,7 +58,7 @@ class FrameProcessor : public FrameProcessorBase { const sp<Camera2Client> &client); const sp<Camera2Client> &client); // Send 3A state change notifications to client based on frame metadata // Send 3A state change notifications to client based on frame metadata status_t process3aState(const CameraMetadata &frame, status_t process3aState(const CaptureResult &frame, const sp<Camera2Client> &client); const sp<Camera2Client> &client); // Helper for process3aState // Helper for process3aState Loading services/camera/libcameraservice/device3/Camera3Device.cpp +23 −15 Original line number Original line Diff line number Diff line Loading @@ -1188,7 +1188,7 @@ status_t Camera3Device::triggerAutofocus(uint32_t id) { { { ANDROID_CONTROL_AF_TRIGGER_ID, ANDROID_CONTROL_AF_TRIGGER_ID, static_cast<int32_t>(id) static_cast<int32_t>(id) }, } }; }; return mRequestThread->queueTrigger(trigger, return mRequestThread->queueTrigger(trigger, Loading @@ -1209,7 +1209,7 @@ status_t Camera3Device::triggerCancelAutofocus(uint32_t id) { { { ANDROID_CONTROL_AF_TRIGGER_ID, ANDROID_CONTROL_AF_TRIGGER_ID, static_cast<int32_t>(id) static_cast<int32_t>(id) }, } }; }; return mRequestThread->queueTrigger(trigger, return mRequestThread->queueTrigger(trigger, Loading @@ -1230,7 +1230,7 @@ status_t Camera3Device::triggerPrecaptureMetering(uint32_t id) { { { ANDROID_CONTROL_AE_PRECAPTURE_ID, ANDROID_CONTROL_AE_PRECAPTURE_ID, static_cast<int32_t>(id) static_cast<int32_t>(id) }, } }; }; return mRequestThread->queueTrigger(trigger, return mRequestThread->queueTrigger(trigger, Loading Loading @@ -1571,8 +1571,6 @@ bool Camera3Device::processPartial3AQuirk( uint8_t aeState; uint8_t aeState; uint8_t afState; uint8_t afState; uint8_t awbState; uint8_t awbState; int32_t afTriggerId; int32_t aeTriggerId; gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AF_MODE, gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AF_MODE, &afMode, frameNumber); &afMode, frameNumber); Loading @@ -1589,12 +1587,6 @@ bool Camera3Device::processPartial3AQuirk( gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AWB_STATE, gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AWB_STATE, &awbState, frameNumber); &awbState, frameNumber); gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AF_TRIGGER_ID, &afTriggerId, frameNumber); gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AE_PRECAPTURE_ID, &aeTriggerId, frameNumber); if (!gotAllStates) return false; if (!gotAllStates) return false; ALOGVV("%s: Camera %d: Frame %d, Request ID %d: AF mode %d, AWB mode %d, " ALOGVV("%s: Camera %d: Frame %d, Request ID %d: AF mode %d, AWB mode %d, " Loading @@ -1603,7 +1595,7 @@ bool Camera3Device::processPartial3AQuirk( __FUNCTION__, mId, frameNumber, resultExtras.requestId, __FUNCTION__, mId, frameNumber, resultExtras.requestId, afMode, awbMode, afMode, awbMode, afState, aeState, awbState, afState, aeState, awbState, afTriggerId, aeTriggerId); resultExtras.afTriggerId, resultExtras.precaptureTriggerId); // Got all states, so construct a minimal result to send // Got all states, so construct a minimal result to send // In addition to the above fields, this means adding in // In addition to the above fields, this means adding in Loading Loading @@ -1667,12 +1659,12 @@ bool Camera3Device::processPartial3AQuirk( } } if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AF_TRIGGER_ID, if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AF_TRIGGER_ID, &afTriggerId, frameNumber)) { &resultExtras.afTriggerId, frameNumber)) { return false; return false; } } if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AE_PRECAPTURE_ID, if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AE_PRECAPTURE_ID, &aeTriggerId, frameNumber)) { &resultExtras.precaptureTriggerId, frameNumber)) { return false; return false; } } Loading Loading @@ -2609,13 +2601,29 @@ status_t Camera3Device::RequestThread::insertTriggers( Mutex::Autolock al(mTriggerMutex); Mutex::Autolock al(mTriggerMutex); sp<Camera3Device> parent = mParent.promote(); if (parent == NULL) { CLOGE("RequestThread: Parent is gone"); return DEAD_OBJECT; } CameraMetadata &metadata = request->mSettings; CameraMetadata &metadata = request->mSettings; size_t count = mTriggerMap.size(); size_t count = mTriggerMap.size(); for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) { RequestTrigger trigger = mTriggerMap.valueAt(i); RequestTrigger trigger = mTriggerMap.valueAt(i); uint32_t tag = trigger.metadataTag; uint32_t tag = trigger.metadataTag; if (tag == ANDROID_CONTROL_AF_TRIGGER_ID || tag == ANDROID_CONTROL_AE_PRECAPTURE_ID) { bool isAeTrigger = (trigger.metadataTag == ANDROID_CONTROL_AE_PRECAPTURE_ID); uint32_t triggerId = static_cast<uint32_t>(trigger.entryValue); isAeTrigger ? request->mResultExtras.precaptureTriggerId = triggerId : request->mResultExtras.afTriggerId = triggerId; if (parent->mDeviceVersion >= CAMERA_DEVICE_API_VERSION_3_2) { continue; // Trigger ID tag is deprecated since device HAL 3.2 } } camera_metadata_entry entry = metadata.find(tag); camera_metadata_entry entry = metadata.find(tag); if (entry.count > 0) { if (entry.count > 0) { Loading Loading
services/camera/libcameraservice/api1/client2/FrameProcessor.cpp +18 −12 Original line number Original line Diff line number Diff line Loading @@ -78,7 +78,7 @@ bool FrameProcessor::processSingleFrame(CaptureResult &frame, } } if (mSynthesize3ANotify) { if (mSynthesize3ANotify) { process3aState(frame.mMetadata, client); process3aState(frame, client); } } return FrameProcessorBase::processSingleFrame(frame, device); return FrameProcessorBase::processSingleFrame(frame, device); Loading Loading @@ -212,14 +212,15 @@ status_t FrameProcessor::processFaceDetect(const CameraMetadata &frame, return OK; return OK; } } status_t FrameProcessor::process3aState(const CameraMetadata &frame, status_t FrameProcessor::process3aState(const CaptureResult &frame, const sp<Camera2Client> &client) { const sp<Camera2Client> &client) { ATRACE_CALL(); ATRACE_CALL(); const CameraMetadata &metadata = frame.mMetadata; camera_metadata_ro_entry_t entry; camera_metadata_ro_entry_t entry; int cameraId = client->getCameraId(); int cameraId = client->getCameraId(); entry = frame.find(ANDROID_REQUEST_FRAME_COUNT); entry = metadata.find(ANDROID_REQUEST_FRAME_COUNT); int32_t frameNumber = entry.data.i32[0]; int32_t frameNumber = entry.data.i32[0]; // Don't send 3A notifications for the same frame number twice // Don't send 3A notifications for the same frame number twice Loading @@ -238,26 +239,31 @@ status_t FrameProcessor::process3aState(const CameraMetadata &frame, // TODO: Also use AE mode, AE trigger ID // TODO: Also use AE mode, AE trigger ID gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AF_MODE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AF_MODE, &new3aState.afMode, frameNumber, cameraId); &new3aState.afMode, frameNumber, cameraId); gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AWB_MODE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AWB_MODE, &new3aState.awbMode, frameNumber, cameraId); &new3aState.awbMode, frameNumber, cameraId); gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AE_STATE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AE_STATE, &new3aState.aeState, frameNumber, cameraId); &new3aState.aeState, frameNumber, cameraId); gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AF_STATE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AF_STATE, &new3aState.afState, frameNumber, cameraId); &new3aState.afState, frameNumber, cameraId); gotAllStates &= get3aResult<uint8_t>(frame, ANDROID_CONTROL_AWB_STATE, gotAllStates &= get3aResult<uint8_t>(metadata, ANDROID_CONTROL_AWB_STATE, &new3aState.awbState, frameNumber, cameraId); &new3aState.awbState, frameNumber, cameraId); gotAllStates &= get3aResult<int32_t>(frame, ANDROID_CONTROL_AF_TRIGGER_ID, if (client->getCameraDeviceVersion() >= CAMERA_DEVICE_API_VERSION_3_2) { new3aState.afTriggerId = frame.mResultExtras.afTriggerId; new3aState.aeTriggerId = frame.mResultExtras.precaptureTriggerId; } else { gotAllStates &= get3aResult<int32_t>(metadata, ANDROID_CONTROL_AF_TRIGGER_ID, &new3aState.afTriggerId, frameNumber, cameraId); &new3aState.afTriggerId, frameNumber, cameraId); gotAllStates &= get3aResult<int32_t>(frame, ANDROID_CONTROL_AE_PRECAPTURE_ID, gotAllStates &= get3aResult<int32_t>(metadata, ANDROID_CONTROL_AE_PRECAPTURE_ID, &new3aState.aeTriggerId, frameNumber, cameraId); &new3aState.aeTriggerId, frameNumber, cameraId); } if (!gotAllStates) return BAD_VALUE; if (!gotAllStates) return BAD_VALUE; Loading
services/camera/libcameraservice/api1/client2/FrameProcessor.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -58,7 +58,7 @@ class FrameProcessor : public FrameProcessorBase { const sp<Camera2Client> &client); const sp<Camera2Client> &client); // Send 3A state change notifications to client based on frame metadata // Send 3A state change notifications to client based on frame metadata status_t process3aState(const CameraMetadata &frame, status_t process3aState(const CaptureResult &frame, const sp<Camera2Client> &client); const sp<Camera2Client> &client); // Helper for process3aState // Helper for process3aState Loading
services/camera/libcameraservice/device3/Camera3Device.cpp +23 −15 Original line number Original line Diff line number Diff line Loading @@ -1188,7 +1188,7 @@ status_t Camera3Device::triggerAutofocus(uint32_t id) { { { ANDROID_CONTROL_AF_TRIGGER_ID, ANDROID_CONTROL_AF_TRIGGER_ID, static_cast<int32_t>(id) static_cast<int32_t>(id) }, } }; }; return mRequestThread->queueTrigger(trigger, return mRequestThread->queueTrigger(trigger, Loading @@ -1209,7 +1209,7 @@ status_t Camera3Device::triggerCancelAutofocus(uint32_t id) { { { ANDROID_CONTROL_AF_TRIGGER_ID, ANDROID_CONTROL_AF_TRIGGER_ID, static_cast<int32_t>(id) static_cast<int32_t>(id) }, } }; }; return mRequestThread->queueTrigger(trigger, return mRequestThread->queueTrigger(trigger, Loading @@ -1230,7 +1230,7 @@ status_t Camera3Device::triggerPrecaptureMetering(uint32_t id) { { { ANDROID_CONTROL_AE_PRECAPTURE_ID, ANDROID_CONTROL_AE_PRECAPTURE_ID, static_cast<int32_t>(id) static_cast<int32_t>(id) }, } }; }; return mRequestThread->queueTrigger(trigger, return mRequestThread->queueTrigger(trigger, Loading Loading @@ -1571,8 +1571,6 @@ bool Camera3Device::processPartial3AQuirk( uint8_t aeState; uint8_t aeState; uint8_t afState; uint8_t afState; uint8_t awbState; uint8_t awbState; int32_t afTriggerId; int32_t aeTriggerId; gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AF_MODE, gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AF_MODE, &afMode, frameNumber); &afMode, frameNumber); Loading @@ -1589,12 +1587,6 @@ bool Camera3Device::processPartial3AQuirk( gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AWB_STATE, gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AWB_STATE, &awbState, frameNumber); &awbState, frameNumber); gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AF_TRIGGER_ID, &afTriggerId, frameNumber); gotAllStates &= get3AResult(partial, ANDROID_CONTROL_AE_PRECAPTURE_ID, &aeTriggerId, frameNumber); if (!gotAllStates) return false; if (!gotAllStates) return false; ALOGVV("%s: Camera %d: Frame %d, Request ID %d: AF mode %d, AWB mode %d, " ALOGVV("%s: Camera %d: Frame %d, Request ID %d: AF mode %d, AWB mode %d, " Loading @@ -1603,7 +1595,7 @@ bool Camera3Device::processPartial3AQuirk( __FUNCTION__, mId, frameNumber, resultExtras.requestId, __FUNCTION__, mId, frameNumber, resultExtras.requestId, afMode, awbMode, afMode, awbMode, afState, aeState, awbState, afState, aeState, awbState, afTriggerId, aeTriggerId); resultExtras.afTriggerId, resultExtras.precaptureTriggerId); // Got all states, so construct a minimal result to send // Got all states, so construct a minimal result to send // In addition to the above fields, this means adding in // In addition to the above fields, this means adding in Loading Loading @@ -1667,12 +1659,12 @@ bool Camera3Device::processPartial3AQuirk( } } if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AF_TRIGGER_ID, if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AF_TRIGGER_ID, &afTriggerId, frameNumber)) { &resultExtras.afTriggerId, frameNumber)) { return false; return false; } } if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AE_PRECAPTURE_ID, if (!insert3AResult(min3AResult.mMetadata, ANDROID_CONTROL_AE_PRECAPTURE_ID, &aeTriggerId, frameNumber)) { &resultExtras.precaptureTriggerId, frameNumber)) { return false; return false; } } Loading Loading @@ -2609,13 +2601,29 @@ status_t Camera3Device::RequestThread::insertTriggers( Mutex::Autolock al(mTriggerMutex); Mutex::Autolock al(mTriggerMutex); sp<Camera3Device> parent = mParent.promote(); if (parent == NULL) { CLOGE("RequestThread: Parent is gone"); return DEAD_OBJECT; } CameraMetadata &metadata = request->mSettings; CameraMetadata &metadata = request->mSettings; size_t count = mTriggerMap.size(); size_t count = mTriggerMap.size(); for (size_t i = 0; i < count; ++i) { for (size_t i = 0; i < count; ++i) { RequestTrigger trigger = mTriggerMap.valueAt(i); RequestTrigger trigger = mTriggerMap.valueAt(i); uint32_t tag = trigger.metadataTag; uint32_t tag = trigger.metadataTag; if (tag == ANDROID_CONTROL_AF_TRIGGER_ID || tag == ANDROID_CONTROL_AE_PRECAPTURE_ID) { bool isAeTrigger = (trigger.metadataTag == ANDROID_CONTROL_AE_PRECAPTURE_ID); uint32_t triggerId = static_cast<uint32_t>(trigger.entryValue); isAeTrigger ? request->mResultExtras.precaptureTriggerId = triggerId : request->mResultExtras.afTriggerId = triggerId; if (parent->mDeviceVersion >= CAMERA_DEVICE_API_VERSION_3_2) { continue; // Trigger ID tag is deprecated since device HAL 3.2 } } camera_metadata_entry entry = metadata.find(tag); camera_metadata_entry entry = metadata.find(tag); if (entry.count > 0) { if (entry.count > 0) { Loading