From c68cd007d7c9fa9d06e440e2a644a5b31a5c52f2 Mon Sep 17 00:00:00 2001 From: Sungjoong Kang Date: Mon, 1 Oct 2012 21:50:09 -0700 Subject: [PATCH] hardware: samsung_slsi: libcamera2: Supports scene mode override and quirks With this patch, HAL will send scene mode override parameters and quirk parameters for zsl and af mode. BUG: 7172543 BUG: 7159577 Change-Id: Ia40cf3b600c1ae89a579c3f57f45752cb99ccf3b Signed-off-by: Sungjoong Kang --- libcamera2/ExynosCamera2.cpp | 29 ++++ libcamera2/MetadataConverter.cpp | 287 ------------------------------- 2 files changed, 29 insertions(+), 287 deletions(-) diff --git a/libcamera2/ExynosCamera2.cpp b/libcamera2/ExynosCamera2.cpp index 335fd91..0ad989f 100644 --- a/libcamera2/ExynosCamera2.cpp +++ b/libcamera2/ExynosCamera2.cpp @@ -562,6 +562,35 @@ status_t ExynosCamera2::constructStaticInfo(camera_metadata_t **info, ADD_OR_SIZE(ANDROID_CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES, availableVstabModes, sizeof(availableVstabModes)); + static const uint8_t sceneModeOverrides[] = { + // ANDROID_CONTROL_SCENE_MODE_ACTION + ANDROID_CONTROL_AE_ON, + ANDROID_CONTROL_AWB_AUTO, + ANDROID_CONTROL_AF_CONTINUOUS_PICTURE, + // ANDROID_CONTROL_SCENE_MODE_NIGHT + ANDROID_CONTROL_AE_ON, + ANDROID_CONTROL_AWB_AUTO, + ANDROID_CONTROL_AF_CONTINUOUS_PICTURE, + // ANDROID_CONTROL_SCENE_MODE_SUNSET + ANDROID_CONTROL_AE_ON, + ANDROID_CONTROL_AWB_DAYLIGHT, + ANDROID_CONTROL_AF_CONTINUOUS_PICTURE, + // ANDROID_CONTROL_SCENE_MODE_PARTY + ANDROID_CONTROL_AE_ON_AUTO_FLASH, + ANDROID_CONTROL_AWB_AUTO, + ANDROID_CONTROL_AF_CONTINUOUS_PICTURE + }; + ADD_OR_SIZE(ANDROID_CONTROL_SCENE_MODE_OVERRIDES, + sceneModeOverrides, sizeof(sceneModeOverrides)); + + static const uint8_t quirkTriggerAuto = 1; + ADD_OR_SIZE(ANDROID_QUIRKS_TRIGGER_AF_WITH_AUTO, + &quirkTriggerAuto, 1); + + static const uint8_t quirkUseZslFormat = 1; + ADD_OR_SIZE(ANDROID_QUIRKS_USE_ZSL_FORMAT, + &quirkUseZslFormat, 1); + #undef ADD_OR_SIZE /** Allocate metadata if sizing */ if (sizeRequest) { diff --git a/libcamera2/MetadataConverter.cpp b/libcamera2/MetadataConverter.cpp index 29dc167..9fa0f50 100644 --- a/libcamera2/MetadataConverter.cpp +++ b/libcamera2/MetadataConverter.cpp @@ -401,8 +401,6 @@ status_t MetadataConverter::ApplySceneModeParameters(camera_metadata_t * request dst->ctl.edge.strength = 0; dst->ctl.color.saturation = 3; // means '0' - // FLASH - // METERING break; case AA_SCENE_MODE_PARTY: @@ -422,8 +420,6 @@ status_t MetadataConverter::ApplySceneModeParameters(camera_metadata_t * request dst->ctl.edge.strength = 0; dst->ctl.color.saturation = 4; // means '+1' - // FLASH - // METERING break; case AA_SCENE_MODE_SUNSET: @@ -443,8 +439,6 @@ status_t MetadataConverter::ApplySceneModeParameters(camera_metadata_t * request dst->ctl.edge.strength = 0; dst->ctl.color.saturation = 3; // means '0' - // FLASH - // METERING break; case AA_SCENE_MODE_NIGHT: @@ -463,8 +457,6 @@ status_t MetadataConverter::ApplySceneModeParameters(camera_metadata_t * request dst->ctl.edge.strength = 0; dst->ctl.color.saturation = 3; // means '0' - // FLASH - // METERING break; case AA_SCENE_MODE_FACE_PRIORITY: @@ -647,283 +639,4 @@ status_t MetadataConverter::ToDynamicMetadata(struct camera2_shot_ext * metadata } -#if 0 // blocked for alpha version - -status_t MetadataConverter::ToDynamicMetadata(camera2_ctl_metadata_t * metadata, camera_metadata_t * dst) -{ - status_t res; - - if (0 != add_camera_metadata_entry(dst, ANDROID_REQUEST_ID, - &(metadata->dm.request.id), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_REQUEST_METADATA_MODE, - &(metadata->dm.request.metadataMode), 1)) - return NO_MEMORY; - - // needs check! - if (0 != add_camera_metadata_entry(dst, ANDROID_REQUEST_FRAME_COUNT, - &(metadata->dm.request.frameCount), 1)) - return NO_MEMORY; - - - if (metadata->dm.request.metadataMode == METADATA_MODE_NONE) { - ALOGD("DEBUG(%s): METADATA_MODE_NONE", __func__); - return NO_ERROR; - } - - ALOGD("DEBUG(%s): METADATA_MODE_FULL", __func__); - - if (0 != add_camera_metadata_entry(dst, ANDROID_LENS_FOCUS_DISTANCE, - &(metadata->dm.lens.focusDistance), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_LENS_APERTURE, - &(metadata->dm.lens.aperture), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_LENS_FOCAL_LENGTH, - &(metadata->dm.lens.focalLength), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_LENS_FILTER_DENSITY, - &(metadata->dm.lens.filterDensity), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_LENS_OPTICAL_STABILIZATION_MODE, - &(metadata->dm.lens.opticalStabilizationMode), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_LENS_APERTURE, - &(metadata->dm.lens.aperture), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_LENS_FOCUS_RANGE, - &(metadata->dm.lens.focusRange[0]), 2)) - return NO_MEMORY; - - - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_SENSOR_FRAME_DURATION, - &(metadata->dm.sensor.frameDuration), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_SENSOR_SENSITIVITY, - &(metadata->dm.aa.isoValue), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_SENSOR_TIMESTAMP, - &(metadata->dm.sensor.timeStamp), 1)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_FLASH_MODE, - &(metadata->dm.flash.flashMode), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_FLASH_FIRING_POWER, - &(metadata->dm.flash.firingPower), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_FLASH_FIRING_TIME, - &(metadata->dm.flash.firingPower), 1)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_HOT_PIXEL_MODE, - &(metadata->dm.hotpixel.mode), 1)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_DEMOSAIC_MODE, - &(metadata->dm.demosaic.mode), 1)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_NOISE_MODE, - &(metadata->dm.noise.mode), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_NOISE_STRENGTH, - &(metadata->dm.noise.strength), 1)) - return NO_MEMORY; - - - if (0 != add_camera_metadata_entry(dst, ANDROID_SHADING_MODE, - &(metadata->dm.shading.mode), 1)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_GEOMETRIC_MODE, - &(metadata->dm.geometric.mode), 1)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_COLOR_MODE, - &(metadata->dm.color.mode), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_COLOR_TRANSFORM, - &(metadata->dm.color.transform), 9)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_TONEMAP_MODE, - &(metadata->dm.tonemap.mode), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_TONEMAP_CURVE_RED, - &(metadata->dm.tonemap.curveRed), 32)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_TONEMAP_CURVE_GREEN, - &(metadata->dm.tonemap.curveGreen), 32)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_TONEMAP_CURVE_BLUE, - &(metadata->dm.tonemap.curveBlue), 32)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_EDGE_MODE, - &(metadata->dm.edge.mode), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_EDGE_STRENGTH, - &(metadata->dm.edge.strength), 1)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_SCALER_CROP_REGION, - &(metadata->dm.scaler.cropRegion), 3)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_JPEG_QUALITY, - &(metadata->dm.jpeg.quality), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_JPEG_THUMBNAIL_SIZE, - &(metadata->dm.jpeg.thumbnailSize), 2)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_JPEG_THUMBNAIL_QUALITY, - &(metadata->dm.jpeg.thumbnailQuality), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_JPEG_GPS_COORDINATES, - &(metadata->dm.jpeg.gpsCoordinates), 2)) // needs check - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_JPEG_GPS_PROCESSING_METHOD, - &(metadata->dm.jpeg.gpsProcessingMethod), 32)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_JPEG_GPS_TIMESTAMP, - &(metadata->dm.jpeg.gpsTimestamp), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_JPEG_ORIENTATION, - &(metadata->dm.jpeg.orientation), 1)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_STATS_FACE_DETECT_MODE, - &(metadata->dm.stats.faceDetectMode), 1)) - return NO_MEMORY; - - // TODO : more stat entries - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_MODE, - &(metadata->dm.aa.mode), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_CAPTURE_INTENT, - &(metadata->dm.aa.captureIntent), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_EFFECT_MODE, - &(metadata->dm.aa.effect_mode), 1)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_AE_REGIONS, - &(metadata->dm.aa.aeRegions), 5)) - return NO_MEMORY; - - - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_AE_STATE, - &(metadata->dm.aa.aeState), 1)) - return NO_MEMORY; - - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_AWB_REGIONS, - &(metadata->dm.aa.awbRegions), 5)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_AWB_STATE, - &(metadata->dm.aa.awbState), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_AF_MODE, - &(metadata->dm.aa.afMode), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_AF_REGIONS, - &(metadata->dm.aa.afRegions), 5)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_AF_STATE, - &(metadata->dm.aa.afState), 1)) - return NO_MEMORY; - - if (0 != add_camera_metadata_entry(dst, ANDROID_CONTROL_VIDEO_STABILIZATION_MODE, - &(metadata->dm.aa.videoStabilizationMode), 1)) - return NO_MEMORY; - - - return NO_ERROR; - -/* -typedef struct camera2_dm { - camera2_request_dm_t request; - camera2_lens_dm_t lens; - camera2_sensor_dm_t sensor; - camera2_flash_dm_t flash; - camera2_hotpixel_dm_t hotpixel; - camera2_demosaic_dm_t demosaic; - camera2_noisereduction_dm_t noise; - camera2_shading_dm_t shading; - camera2_geometric_dm_t geometric; - camera2_colorcorrection_dm_t color; - camera2_tonemap_dm_t tonemap; - camera2_edge_dm_t edge; - camera2_scaler_dm_t scaler; - camera2_jpeg_dm_t jpeg; - camera2_stats_dm_t stats; - camera2_aa_dm_t aa; -} camera2_dm_t; -*/ - -} -#endif - - }; // namespace android -- 2.20.1