flash sequence modification
authorMarko Ollonen <marko.ollonen@ixonos.com>
Tue, 16 Apr 2013 14:35:03 +0000 (17:35 +0300)
committerTelle-Tiia Pitkänen <telle-tiia.pitkanen@ixonos.com>
Wed, 17 Apr 2013 10:01:35 +0000 (13:01 +0300)
Smaller resolution images needs to use two flashes in
flash sequence to get auto exposure and white balance tuned.

Change-Id: I1385f5331132341704d30d6afa29771f95b797f0

gst-libs/atomisphal/mfld_cam.c
packaging/gst-plugins-atomisp.changes

index a469bb1..2b47d70 100644 (file)
@@ -656,31 +656,6 @@ cam_driver_set_capture_fmt (GstCameraSrc * camerasrc,
   return TRUE;
 }
 
-/* Tell the driver what resolution we want to capture.
- */
-static gboolean
-cam_driver_set_capture_res (GstCameraSrc * camerasrc, guint width, guint height)
-{
-  gboolean ret;
-  // Just set the capture format
-  struct v4l2_format fmt;
-  mfld_driver.height = height;
-  mfld_driver.width = width;
-  cam_driver_dbg ("%s: set res to width %u, height %u\n", __func__, width,
-      height);
-#if 0
-  memset (&fmt, 0, sizeof (fmt));
-  fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-  fmt.fmt.pix.width = width;
-  fmt.fmt.pix.height = height;
-  fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;
-  ret = ioctl (mfld_driver.fd, VIDIOC_S_FMT, &fmt);
-  if (ret < 0)
-    return FALSE;
-  return TRUE;
-#endif
-  return TRUE;
-}
 
 #endif
 /*
@@ -732,6 +707,9 @@ cam_set_capture_fmt (int fd, unsigned int width, unsigned int height,
   mfld_driver.height = height;
   mfld_driver.fourcc = fourcc;
 
+  cam_driver_dbg ("%s: set res to width %u, height %u\n",
+       __func__, width, height);
+
   mfldadvci->mode_spec_init ();
 
   return CAM_ERR_NONE;
@@ -1575,6 +1553,30 @@ run_flash_sequence (int fd, struct v4l2_buffer *buffer)
       cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 2);
       return CAM_ERR_SYS;
     }
+    /* In case of small images we need to do extra flash to get
+     * auto exposure and auto white balance tuned for flash
+     */
+    if(mfld_driver.width  < 2048 || mfld_driver.height  < 1536)  {
+      cam_driver_request_flash(fd, 1);
+      if (-1 == ioctl (fd, VIDIOC_QBUF, buffer)) {
+        cam_driver_dbg ("%s: Error qbuf %d\n", __func__, 1);
+        return CAM_ERR_SYS;
+      }
+      if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
+      cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 1);
+      return CAM_ERR_SYS;
+      }
+
+      if (-1 == ioctl (fd, VIDIOC_QBUF, buffer)) {
+        cam_driver_dbg ("%s: Error qbuf %d\n", __func__, 2);
+        return CAM_ERR_SYS;
+      }
+      if (-1 == ioctl (fd, VIDIOC_DQBUF, buffer)) {
+        cam_driver_dbg ("%s: Error dqbuf %d\n", __func__, 2);
+        return CAM_ERR_SYS;
+      }
+    }
+
     mfld_driver.flash_used = TRUE;
     return CAM_ERR_NONE;
 }
@@ -1854,6 +1856,10 @@ void cam_set_af_ae_window(advci_window *window)
     mfldadvci->AfSetWindows (1, window);
     mfldadvci->AeSetWindow(window);
     mfld_driver.window = *window;
+    cam_driver_dbg ("x_left:%d x_right:%d y_top:%d y_bottom:%d weight:%d\n",
+      mfld_driver.window.x_left, mfld_driver.window.x_right,
+      mfld_driver.window.y_top,
+      mfld_driver.window.y_bottom , mfld_driver.window.weight );
   }
 
 }
index 48cfb82..fc75891 100644 (file)
@@ -1,3 +1,6 @@
+* Tue Apr 16 2013 Marko Ollonen <marko.ollonen@ixonos.com> accepted/tizen_2.0/20130307.195130@12344e0
+- flash sequence modification
+
 * Tue Apr 16 2013 Marko Ollonen <marko.ollonen@ixonos.com> accepted/tizen_2.0/20130307.195130@d214073
 - Initilise 3A ae&af windows always when preview size is set.