Exposure compensation support.
authorMarko Ollonen <marko.ollonen@ixonos.com>
Thu, 28 Mar 2013 15:14:27 +0000 (17:14 +0200)
committerMarko Ollonen <marko.ollonen@ixonos.com>
Tue, 2 Apr 2013 10:22:40 +0000 (13:22 +0300)
Change-Id: I767f97d344032384406fa4c357e51bdfea711a7d

gst-libs/atomisphal/gstv4l2mfldadvci.c
gst-libs/atomisphal/gstv4l2mfldadvci.h
gst-libs/atomisphal/mfld_cam.c
gst-libs/gst/camera/gstmfldcameracolorbalance.c
gst-libs/gst/camera/gstmfldcameracolorbalance.h
gst/mfldv4l2cam/v4l2camsrc_calls.c
packaging/gst-plugins-atomisp.changes

index e8cc2c3..992f684 100644 (file)
@@ -334,6 +334,9 @@ lib_3a_link_functions_init (GstV4l2MFLDAdvCI *mfldadvci,  GModule *mod)
 
   g_module_symbol (mod, "ci_adv_ae_set_mode", (gpointer) &mfldadvci->AeSetMode);
   g_module_symbol (mod, "ci_adv_ae_get_mode", (gpointer) &mfldadvci->AeGetMode);
+  g_module_symbol (mod, "ci_adv_ae_set_bias", (gpointer) &mfldadvci->AeSetBias);
+  g_module_symbol (mod, "ci_adv_ae_get_bias", (gpointer) &mfldadvci->AeGetBias);
+
 
   mfldadvci->initialized = 0;
   // TODO
@@ -342,8 +345,6 @@ lib_3a_link_functions_init (GstV4l2MFLDAdvCI *mfldadvci,  GModule *mod)
   mfldadvci->update_dis_results = wrapper_default_void;
   mfldadvci->do_redeye_removal = wrapper_default_do_redeye_removal;
   mfldadvci->load_gdc_table = wrapper_default_void;
-  mfldadvci->AeSetBias = wrapper_default_int_int;
-  mfldadvci->AeGetBias = wrapper_default_intp;
   mfldadvci->AeGetIso = wrapper_default_AeGetManualIso;
   mfldadvci->RerVersion = wrapper_default_RerVersion;
 
index b5848f8..03a13eb 100644 (file)
@@ -217,8 +217,8 @@ struct _GstV4l2MFLDAdvCI
   void (*load_gdc_table)(void);
 
   /* 3A property API */
-  ci_adv_Err (*AeSetBias)(int bias); /* bias: -2.0(EV) to +2.0(EV) */
-  ci_adv_Err (*AeGetBias)(int *bias); /* bias: -2.0(EV) to +2.0(EV) */
+  ci_adv_Err (*AeSetBias)(float bias); /* bias: -2.0(EV) to +2.0(EV) */
+  ci_adv_Err (*AeGetBias)(float *bias); /* bias: -2.0(EV) to +2.0(EV) */
   void (*AeSetFlickerMode)(advci_ae_flicker_mode mode);
   advci_ae_flicker_mode  (*AeGetFlickerMode)(void);
   void (*AeSetExposureProgram)(advci_ae_exposure_program program);
index 75f2fe8..fc8daa1 100644 (file)
@@ -1025,7 +1025,7 @@ cam_err_t
 cam_feature_set (int fd, cam_photo_feature_t feature, int value)
 {
   cam_err_t ret = CAM_ERR_NONE;
-  int bias;
+  float bias;
 
   cam_driver_dbg ("%s: feature %s, value %d\n", __func__,
                  photo_features[feature], value);
@@ -1049,12 +1049,16 @@ cam_feature_set (int fd, cam_photo_feature_t feature, int value)
       ret = cam_driver_set_aperture (fd, value);
       break;
     case CAM_EXPOSURE_COMPENSATION:
-      if (value > 20)
-       value = 20;
-      if (value < -20)
-       value = -20;
-      bias = (int) ((double) value / 10 * 65536.0);
-      ret = mfldadvci->AeSetBias (bias);
+      if (value > 20) value = 20;
+      if (value < -20) value = -20;
+      bias = value;
+      bias = bias / 10;
+      if (mfld_cam_settings.ev_compensation != bias &&
+              mfld_driver.sensor_type == SENSOR_TYPE_RAW){
+        cam_driver_dbg ("set AEBias %f\n",bias);
+        ret = mfldadvci->AeSetBias (bias);
+        mfld_cam_settings.ev_compensation = bias;
+        }
       break;
     case CAM_EXPOSURE_ISO_VALUE:
          ret = set_iso_speed (value);
@@ -1088,7 +1092,7 @@ cam_feature_set (int fd, cam_photo_feature_t feature, int value)
 cam_err_t
 cam_feature_get (int fd, cam_photo_feature_t feature, int *value)
 {
-  int bias;
+  float bias;
   cam_err_t ret;
 
   cam_driver_dbg ("%s: feature %s, \n", __func__,
@@ -1118,8 +1122,7 @@ cam_feature_get (int fd, cam_photo_feature_t feature, int *value)
       ret = cam_driver_get_aperture (fd, value);
       break;
     case CAM_EXPOSURE_COMPENSATION:
-      ret = mfldadvci->AeGetBias (&bias);
-      *value = (int) (((double) bias / 65536.0) * 10);
+      *value  = mfld_cam_settings.ev_compensation * 10;
       break;
     case CAM_EXPOSURE_ISO_VALUE:
          ret = get_iso_speed (value);
index a245408..bd87a2b 100644 (file)
@@ -96,6 +96,9 @@ gst_camerasrc_color_balance_set_value (GstCameraSrc * camerasrc,
     case MM_CAM_FILTER_WB_SOURCE_PRIV:
       camerasrc->photoconf.wb_mode = value;
       break;
+    case MM_CAM_FILTER_BRIGHTNESS_SOURCE_PRIV:
+      camerasrc->photoconf.ev_compensation = (gfloat)value;
+      break;
     default:
       break;
    }
index 2c9f9f5..3773a0d 100644 (file)
@@ -53,10 +53,13 @@ G_BEGIN_DECLS
  * #define V4L2_CID_PRIVATE_BASE  0x08000000
  */
 #define SOURCE_PRIV_BASE  V4L2_CID_PRIVATE_BASE
-#define MM_CAM_FILTER_WB_SOURCE_PRIV  (SOURCE_PRIV_BASE + 1)
-#define MM_CAM_FILTER_COLOR_TONE_SOURCE_PRIV  (SOURCE_PRIV_BASE + 2)
 
-#define MM_CAM_SOURCE_PRIV_LAST MM_CAM_FILTER_COLOR_TONE_SOURCE_PRIV
+typedef enum {
+  MM_CAM_FILTER_WB_SOURCE_PRIV = (SOURCE_PRIV_BASE + 1),
+  MM_CAM_FILTER_COLOR_TONE_SOURCE_PRIV,
+  MM_CAM_FILTER_BRIGHTNESS_SOURCE_PRIV,
+  MM_CAM_SOURCE_PRIV_LAST
+} MMCamFilter;
 
 static struct v4l2_queryctrl mmfw_wb_controls[] = {
        {
@@ -78,6 +81,18 @@ static struct v4l2_queryctrl mmfw_wb_controls[] = {
                        .step = 0x01,
                        .default_value = 0x00,
                        .flags = 0,
+       },
+       {
+                       .id = MM_CAM_FILTER_BRIGHTNESS_SOURCE_PRIV,
+                       .type = V4L2_CTRL_TYPE_INTEGER,
+                       .name = "brightness",
+                       /* current scale is from 1...20, app is setting values from sleeve */
+                       /* TODO change when abobe problems are fixed */
+                       .minimum = -20,
+                       .maximum = 20,
+                       .step = 0x01,
+                       .default_value = 0,
+                       .flags = 0,
        }
 };
 
index 3f45bd7..4307356 100644 (file)
@@ -794,7 +794,7 @@ gst_v4l2camsrc_fill_lists (GstMFLDV4l2CamSrc * v4l2camsrc)
     control.id = n;
 
     if( n  > SOURCE_PRIV_BASE)  {
-       if(  n > MM_CAM_SOURCE_PRIV_LAST)
+       if(  n >= MM_CAM_SOURCE_PRIV_LAST)
           break;
        else
          get_supported_mmfw_control(v4l2camsrc, &control);
@@ -835,6 +835,7 @@ gst_v4l2camsrc_fill_lists (GstMFLDV4l2CamSrc * v4l2camsrc)
       case V4L2_CID_COLORFX:
       case MM_CAM_FILTER_WB_SOURCE_PRIV:
       case MM_CAM_FILTER_COLOR_TONE_SOURCE_PRIV:
+      case MM_CAM_FILTER_BRIGHTNESS_SOURCE_PRIV:
         /* we only handle these for now (why?) */
         break;
       case V4L2_CID_HFLIP:
@@ -1072,6 +1073,11 @@ gst_v4l2camsrc_get_attribute (GstCameraSrc * camsrc,
           err = cam_feature_get (v4l2camsrc->video_fd, CAM_GENERAL_EFFECT_TYPE, &tmp_value);
           *value = find_item (gst_v4l2camsrc_effect_map, tmp_value);
         break;
+     case MM_CAM_FILTER_BRIGHTNESS_SOURCE_PRIV:
+          err = cam_feature_get (v4l2camsrc->video_fd, CAM_EXPOSURE_COMPENSATION, &tmp_value);
+          *value = tmp_value;
+        break;
+
       default:
         break;
     }
@@ -1142,7 +1148,9 @@ gst_v4l2camsrc_set_attribute (GstCameraSrc * camsrc,
       case MM_CAM_FILTER_COLOR_TONE_SOURCE_PRIV:
           cam_feature_set (v4l2camsrc->video_fd, CAM_GENERAL_EFFECT_TYPE, gst_v4l2camsrc_effect_map[value]);
         break;
-
+      case MM_CAM_FILTER_BRIGHTNESS_SOURCE_PRIV:
+          cam_feature_set (v4l2camsrc->video_fd, CAM_EXPOSURE_COMPENSATION, value);
+        break;
       default:
         break;
     }
@@ -3204,7 +3212,6 @@ gst_v4l2camsrc_read_settings (GstCameraSrc * camsrc,
         cameralib_error_map[err]);
     goto error;
   }
-
   err = cam_feature_get (v4l2camsrc->video_fd, CAM_EXPOSURE_ISO_VALUE, &iso);
   if (err != CAM_ERR_NONE) {
     GST_DEBUG ("CAM_EXPOSURE_ISO_VALUE query failed: %s",
@@ -3260,7 +3267,7 @@ gst_v4l2camsrc_read_settings (GstCameraSrc * camsrc,
   photoconf->focus_mode = find_item (gst_v4l2camsrc_focus_map, focus);
   photoconf->flicker_mode = find_item (gst_v4l2camsrc_flicker_map, flicker);
 
-  photoconf->ev_compensation = (gfloat) ev / 10;
+  photoconf->ev_compensation = (gfloat) ev;
   photoconf->iso_speed = gst_v4l2camsrc_libmfld_map_iso (iso);
   photoconf->aperture = aperture;
   photoconf->exposure = exposure;
@@ -3440,7 +3447,7 @@ gst_v4l2camsrc_write_settings (GstCameraSrc * camsrc,
         photoconf->aperture);
 
     cam_feature_set (v4l2camsrc->video_fd, CAM_EXPOSURE_COMPENSATION,
-        (gint) (photoconf->ev_compensation * 10));
+        (gint) (photoconf->ev_compensation));
 
     cam_feature_set (v4l2camsrc->video_fd, CAM_EXPOSURE_ISO_VALUE,
                gst_v4l2camsrc_libmfld_reverse_map_iso (photoconf->iso_speed));
index 1a6a49d..ea3618c 100644 (file)
@@ -1,3 +1,6 @@
+* Tue Apr 02 2013 Marko Ollonen <marko.ollonen@ixonos.com> accepted/tizen_2.0/20130307.195130@2a057ef
+- Exposure compensation support.
+
 * Fri Mar 22 2013 Marko Ollonen <marko.ollonen@ixonos.com> accepted/tizen_2.0/20130307.195130@ef9992c
 - Set 50Hz flicker detection as default for secondary camera.
 - Stop af right after single shot focus has found. TZSP-5164