|
|
|
@ -125,6 +125,7 @@ NdkCamera::NdkCamera(int32_t width, int32_t height, const NdkCamera::CAMERA_PARA
|
|
|
|
|
sceneModeSupported = false;
|
|
|
|
|
|
|
|
|
|
numberOfPrecaptures = 0;
|
|
|
|
|
m_precaptureStartTime = 0;
|
|
|
|
|
|
|
|
|
|
activeArraySize[0] = 0;
|
|
|
|
|
activeArraySize[1] = 0;
|
|
|
|
@ -623,11 +624,11 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
// uint8_t afMode = ACAMERA_CONTROL_AF_MODE_AUTO;
|
|
|
|
|
status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AF_MODE, 1, &afMode);
|
|
|
|
|
|
|
|
|
|
uint8_t trig = ACAMERA_CONTROL_AF_TRIGGER_CANCEL;
|
|
|
|
|
// uint8_t trig = ACAMERA_CONTROL_AF_TRIGGER_CANCEL;
|
|
|
|
|
// status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AF_TRIGGER, 1, &trig);
|
|
|
|
|
|
|
|
|
|
trig = ACAMERA_CONTROL_AF_TRIGGER_START;
|
|
|
|
|
status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AF_TRIGGER, 1, &trig);
|
|
|
|
|
// trig = ACAMERA_CONTROL_AF_TRIGGER_START;
|
|
|
|
|
// status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AF_TRIGGER, 1, &trig);
|
|
|
|
|
}
|
|
|
|
|
if (status == ACAMERA_OK)
|
|
|
|
|
{
|
|
|
|
@ -704,6 +705,7 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
uint8_t aePrecatureTrigger = ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_START;
|
|
|
|
|
status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER, 1, &aePrecatureTrigger);
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG, "Trigger PRECAPTURE status=%d", (int)status);
|
|
|
|
|
m_precaptureStartTime = m_startTime;
|
|
|
|
|
if (status == ACAMERA_OK)
|
|
|
|
|
{
|
|
|
|
|
m_imagesCaptured = ~0;
|
|
|
|
@ -806,6 +808,8 @@ int NdkCamera::open(const std::string& cameraId) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_startTime = GetMicroTimeStamp();
|
|
|
|
|
|
|
|
|
|
m_precaptureStartTime = m_startTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return status == ACAMERA_OK ? 0 : 1;
|
|
|
|
@ -1242,6 +1246,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
status = ACameraMetadata_getConstEntry(result, ACAMERA_CONTROL_AWB_MODE, &val);
|
|
|
|
|
mResult.awbMode = (status == ACAMERA_OK) ? *(val.data.u8) : ACAMERA_CONTROL_AWB_MODE_OFF;
|
|
|
|
|
|
|
|
|
|
unsigned long long ts = GetMicroTimeStamp();
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG, "3ASTATE: AES=%u AWBS=%u AFS=%u", (uint32_t)mResult.aeState, (uint32_t)mResult.awbState, (uint32_t)mResult.afState);
|
|
|
|
|
|
|
|
|
|
if (m_params.autoExposure != 0)
|
|
|
|
@ -1249,7 +1254,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
if (mResult.aeState == ACAMERA_CONTROL_AE_STATE_SEARCHING)
|
|
|
|
|
{
|
|
|
|
|
numberOfPrecaptures ++;
|
|
|
|
|
if (numberOfPrecaptures > 50)
|
|
|
|
|
if (numberOfPrecaptures > 8 && ((ts - m_precaptureStartTime) > 2000))
|
|
|
|
|
{
|
|
|
|
|
uint8_t aePrecatureTrigger = ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL;
|
|
|
|
|
status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER, 1, &aePrecatureTrigger);
|
|
|
|
@ -1259,11 +1264,13 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_WARNING, "Retrigger PRECAPTURE status=%d AES=%u", (int)status, (unsigned int)mResult.aeState);
|
|
|
|
|
numberOfPrecaptures = 0;
|
|
|
|
|
m_precaptureStartTime = ts;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
numberOfPrecaptures = 0;
|
|
|
|
|
m_precaptureStartTime = ts;
|
|
|
|
|
}
|
|
|
|
|
if (mResult.aeState == ACAMERA_CONTROL_AE_STATE_PRECAPTURE)
|
|
|
|
|
{
|
|
|
|
@ -1273,6 +1280,9 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
aePrecatureTrigger = ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER_START;
|
|
|
|
|
status = ACaptureRequest_setEntry_u8(capture_request, ACAMERA_CONTROL_AE_PRECAPTURE_TRIGGER, 1, &aePrecatureTrigger);
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_DEBUG, "Trigger PRECAPTURE status=%d AES=%u", (int)status, (unsigned int)mResult.aeState);
|
|
|
|
|
|
|
|
|
|
numberOfPrecaptures = 0;
|
|
|
|
|
m_precaptureStartTime = ts;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1297,7 +1307,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
|
|
|
|
|
if (m_imagesCaptured == ~0)
|
|
|
|
|
{
|
|
|
|
|
unsigned long long ts = GetMicroTimeStamp();
|
|
|
|
|
|
|
|
|
|
if (ts - m_startTime >= m_params.focusTimeout * 2)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_WARNING, "Prepare Capture Timeout for 3A And will Capture AFS=%u AES=%u AWBS=%u Time=%u",
|
|
|
|
@ -1308,7 +1318,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
{
|
|
|
|
|
if (awbMode == ACAMERA_CONTROL_AWB_MODE_AUTO)
|
|
|
|
|
{
|
|
|
|
|
if (awbLockAvailable && m_params.wait3ALocked)
|
|
|
|
|
if (awbLockAvailable && (m_params.wait3ALocked & WAIT_AWB_LOCKED))
|
|
|
|
|
{
|
|
|
|
|
if (mResult.awbState != ACAMERA_CONTROL_AWB_STATE_LOCKED)
|
|
|
|
|
{
|
|
|
|
@ -1334,7 +1344,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
|
|
|
|
|
|
if (m_params.autoExposure != 0)
|
|
|
|
|
{
|
|
|
|
|
if (aeLockAvailable && m_params.wait3ALocked)
|
|
|
|
|
if (aeLockAvailable && (m_params.wait3ALocked & WAIT_AE_LOCKED))
|
|
|
|
|
{
|
|
|
|
|
if (mResult.aeState != ACAMERA_CONTROL_AE_STATE_LOCKED)
|
|
|
|
|
{
|
|
|
|
|