|
|
@ -29,6 +29,60 @@
|
|
|
|
#include <LogThread.h>
|
|
|
|
#include <LogThread.h>
|
|
|
|
#include "DngCreator.h"
|
|
|
|
#include "DngCreator.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MTK_MFBMODE_TAG "com.mediatek.mfbmode"
|
|
|
|
|
|
|
|
#define MTK_MFNR_ENABLE_TAG "com.mediatek.3afeature.mfnrenable"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MTK_VENDOR_TAG_SECTION 0x8000
|
|
|
|
|
|
|
|
#define MTK_MFNR_FEATURE 4
|
|
|
|
|
|
|
|
#define MTK_MFNR_FEATURE_START ((MTK_MFNR_FEATURE + MTK_VENDOR_TAG_SECTION) << 16)
|
|
|
|
|
|
|
|
#define MTK_MFNR_FEATURE_MFB_MODE MTK_MFNR_FEATURE_START
|
|
|
|
|
|
|
|
#define MTK_MFNR_FEATURE_MFB_RESULT (MTK_MFNR_FEATURE_START + 1)
|
|
|
|
|
|
|
|
#define MTK_MFNR_FEATURE_AVAILABLE_MFB_MODES (MTK_MFNR_FEATURE_START + 2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MTK_MFNR_FEATURE_MFB_AUTO 0xFF
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #define MTK_3A_MFNR_ENABLE "com.mediatek.3afeature.mfnrenable"
|
|
|
|
|
|
|
|
#define MTK_3A_MFNR_INTENSITY_TAG "com.mediatek.3afeature.mfnrintensity"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SetupMFNR(ACameraMetadata* characteristics, ACaptureRequest* request) {
|
|
|
|
|
|
|
|
// 1. 设置基础的相机参数
|
|
|
|
|
|
|
|
// ACaptureRequest_setEntry_i32(request, ACAMERA_CONTROL_MODE, 1, ACAMERA_CONTROL_MODE_AUTO);
|
|
|
|
|
|
|
|
camera_status_t status;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
int32_t tagCount = 0;
|
|
|
|
|
|
|
|
const uint32_t* tags = nullptr;
|
|
|
|
|
|
|
|
ACameraMetadata_getAllTags(characteristics, &tagCount, &tags);
|
|
|
|
|
|
|
|
for (int32_t i = 0; i < tagCount; i++) {
|
|
|
|
|
|
|
|
if (MTK_MFNR_FEATURE_AVAILABLE_MFB_MODES == tags[i])
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ALOGI("MTK_MFNR_FEATURE_AVAILABLE_MFB_MODES Tag ID: 0x%x\n", tags[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ACameraMetadata_const_entry entry;
|
|
|
|
|
|
|
|
status = ACameraMetadata_getConstEntry(characteristics, MTK_MFNR_FEATURE_AVAILABLE_MFB_MODES, &entry);
|
|
|
|
|
|
|
|
if (status == ACAMERA_OK)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
for (int i = 0; i < entry.count; i++)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ALOGI("MTK_MFNR_FEATURE_AVAILABLE_MFB_MODES: 0x%x\n", entry.data.i32[i]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t nrMode = ACAMERA_NOISE_REDUCTION_MODE_HIGH_QUALITY;
|
|
|
|
|
|
|
|
status = ACaptureRequest_setEntry_u8(request, ACAMERA_NOISE_REDUCTION_MODE, 1, &nrMode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 设置 MediaTek 特定的 MFNR 参数
|
|
|
|
|
|
|
|
// 使用 vendor tag 描述符
|
|
|
|
|
|
|
|
int32_t mfbMode = MTK_MFNR_FEATURE_MFB_AUTO; // 1 Enable MFNR
|
|
|
|
|
|
|
|
status = ACaptureRequest_setEntry_i32(request, MTK_MFNR_FEATURE_MFB_MODE, 1, &mfbMode);
|
|
|
|
|
|
|
|
if (status == ACAMERA_OK)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void saveYuvToFile(AImage* image, const std::string& filePath) {
|
|
|
|
void saveYuvToFile(AImage* image, const std::string& filePath) {
|
|
|
|
|
|
|
|
|
|
|
@ -1805,11 +1859,16 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
for (int idx = 0; idx < burstCaptures; idx++)
|
|
|
|
for (int idx = 0; idx < burstCaptures; idx++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CaptureRequest* request = CreateRequest(false);
|
|
|
|
CaptureRequest* request = CreateRequest(false);
|
|
|
|
|
|
|
|
if (m_params.burstRawCapture == 0 && m_params.customHdr != 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetupMFNR(mCharacteristics.get(), request->request);
|
|
|
|
|
|
|
|
}
|
|
|
|
mCaptureRequests.push_back(request);
|
|
|
|
mCaptureRequests.push_back(request);
|
|
|
|
// CopyPreviewRequest(mCaptureRequests[idx]->request, result);
|
|
|
|
// CopyPreviewRequest(mCaptureRequests[idx]->request, result);
|
|
|
|
requests.push_back(request->request);
|
|
|
|
requests.push_back(request->request);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
if (m_params.customHdr && burstCaptures > 1)
|
|
|
|
if (m_params.customHdr && burstCaptures > 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int32_t hdrStep = m_params.hdrStep;
|
|
|
|
int32_t hdrStep = m_params.hdrStep;
|
|
|
@ -1850,6 +1909,7 @@ void NdkCamera::onCaptureCompleted(ACameraCaptureSession* session, ACaptureReque
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// ALOGW("Will Stop Repeating Request");
|
|
|
|
// ALOGW("Will Stop Repeating Request");
|
|
|
|
// status = ACameraCaptureSession_stopRepeating(capture_session);
|
|
|
|
// status = ACameraCaptureSession_stopRepeating(capture_session);
|
|
|
|