summaryrefslogtreecommitdiffstats
path: root/camera/inc
diff options
context:
space:
mode:
authorKyle Repinski <repinski23@gmail.com>2015-01-07 08:39:28 -0600
committerZiyan <jaraidaniel@gmail.com>2015-04-11 20:24:52 +0200
commitc5f4358c48d6e50b2affb3ad6c2c0f59546f5b04 (patch)
tree74070cb6d50ec822d3ef7acdaa390cf2f94c4097 /camera/inc
parentc52c76fa1593f374173a818b4de5bd7c51903fbc (diff)
downloaddevice_samsung_tuna-c5f4358c48d6e50b2affb3ad6c2c0f59546f5b04.zip
device_samsung_tuna-c5f4358c48d6e50b2affb3ad6c2c0f59546f5b04.tar.gz
device_samsung_tuna-c5f4358c48d6e50b2affb3ad6c2c0f59546f5b04.tar.bz2
camera: Update camera HAL.
OmapZoom p-jb-release branch with 'CameraHal: Camera Capabilities query update' reverted, as well as a bunch of stuff ifdef'd out. Needs a lot of work still. At this point it's a regression, but it has to be done.
Diffstat (limited to 'camera/inc')
-rw-r--r--camera/inc/ANativeWindowDisplayAdapter.h47
-rw-r--r--camera/inc/BaseCameraAdapter.h122
-rw-r--r--camera/inc/BufferSourceAdapter.h190
-rw-r--r--camera/inc/CameraHal.h687
-rw-r--r--camera/inc/CameraProperties.h105
-rw-r--r--camera/inc/Common.h65
-rw-r--r--camera/inc/Encoder_libjpeg.h43
-rw-r--r--camera/inc/General3A_Settings.h138
-rw-r--r--camera/inc/NV12_resize.h161
-rw-r--r--camera/inc/OMXCameraAdapter/OMXCameraAdapter.h559
-rw-r--r--camera/inc/OMXCameraAdapter/OMXSceneModeTables.h306
-rw-r--r--camera/inc/SensorListener.h26
-rw-r--r--camera/inc/TICameraParameters.h133
-rw-r--r--camera/inc/V4LCameraAdapter/V4LCameraAdapter.h130
14 files changed, 1965 insertions, 747 deletions
diff --git a/camera/inc/ANativeWindowDisplayAdapter.h b/camera/inc/ANativeWindowDisplayAdapter.h
index 9cdf45a..560e98d 100644
--- a/camera/inc/ANativeWindowDisplayAdapter.h
+++ b/camera/inc/ANativeWindowDisplayAdapter.h
@@ -20,10 +20,8 @@
#include <ui/GraphicBufferMapper.h>
#include <hal_public.h>
-//temporarily define format here
-#define HAL_PIXEL_FORMAT_TI_NV12 0x100
-
-namespace android {
+namespace Ti {
+namespace Camera {
/**
* Display handler class - This class basically handles the buffer posting to display
@@ -35,7 +33,7 @@ public:
typedef struct
{
- void *mBuffer;
+ CameraBuffer *mBuffer;
void *mUser;
int mOffset;
int mWidth;
@@ -65,7 +63,7 @@ public:
virtual int setPreviewWindow(struct preview_stream_ops *window);
virtual int setFrameProvider(FrameNotifier *frameProvider);
virtual int setErrorHandler(ErrorNotifier *errorNotifier);
- virtual int enableDisplay(int width, int height, struct timeval *refTime = NULL, S3DParameters *s3dParams = NULL);
+ virtual int enableDisplay(int width, int height, struct timeval *refTime = NULL);
virtual int disableDisplay(bool cancel_buffer = true);
virtual status_t pauseDisplay(bool pause);
@@ -76,16 +74,17 @@ public:
#endif
- virtual int useBuffers(void* bufArr, int num);
virtual bool supportsExternalBuffering();
//Implementation of inherited interfaces
- virtual void* allocateBuffer(int width, int height, const char* format, int &bytes, int numBufs);
+ virtual CameraBuffer * allocateBufferList(int width, int height, const char* format, int &bytes, int numBufs);
+ virtual CameraBuffer *getBufferList(int *numBufs);
virtual uint32_t * getOffsets() ;
virtual int getFd() ;
- virtual int freeBuffer(void* buf);
+ virtual int freeBufferList(CameraBuffer * buflist);
- virtual int maxQueueableBuffers(unsigned int& queueable);
+ virtual status_t maxQueueableBuffers(unsigned int& queueable);
+ virtual status_t minUndequeueableBuffers(int& unqueueable);
///Class specific functions
static void frameCallbackRelay(CameraFrame* caFrame);
@@ -105,17 +104,17 @@ public:
static const int DISPLAY_TIMEOUT;
static const int FAILED_DQS_TO_SUSPEND;
- class DisplayThread : public Thread
+ class DisplayThread : public android::Thread
{
ANativeWindowDisplayAdapter* mDisplayAdapter;
- TIUTILS::MessageQueue mDisplayThreadQ;
+ Utils::MessageQueue mDisplayThreadQ;
public:
DisplayThread(ANativeWindowDisplayAdapter* da)
: Thread(false), mDisplayAdapter(da) { }
///Returns a reference to the display message Q for display adapter to post messages
- TIUTILS::MessageQueue& msgQ()
+ Utils::MessageQueue& msgQ()
{
return mDisplayThreadQ;
}
@@ -147,20 +146,22 @@ private:
int mFailedDQs;
bool mPaused; //Pause state
preview_stream_ops_t* mANativeWindow;
- sp<DisplayThread> mDisplayThread;
+ android::sp<DisplayThread> mDisplayThread;
FrameProvider *mFrameProvider; ///Pointer to the frame provider interface
- TIUTILS::MessageQueue mDisplayQ;
+ Utils::MessageQueue mDisplayQ;
unsigned int mDisplayState;
///@todo Have a common class for these members
- mutable Mutex mLock;
+ mutable android::Mutex mLock;
bool mDisplayEnabled;
int mBufferCount;
- buffer_handle_t** mBufferHandleMap;
- IMG_native_handle_t** mGrallocHandleMap;
- uint32_t* mOffsetsMap;
+ CameraBuffer *mBuffers;
+ //buffer_handle_t** mBufferHandleMap; // -> frames[i].BufferHandle
+ //IMG_native_handle_t** mGrallocHandleMap; // -> frames[i].GrallocHandle
+ uint32_t* mOffsetsMap; // -> frames[i].Offset
int mFD;
- KeyedVector<int, int> mFramesWithCameraAdapterMap;
- sp<ErrorNotifier> mErrorNotifier;
+ android::KeyedVector<buffer_handle_t *, int> mFramesWithCameraAdapterMap;
+ android::KeyedVector<int, int> mFramesType;
+ android::sp<ErrorNotifier> mErrorNotifier;
uint32_t mFrameWidth;
uint32_t mFrameHeight;
@@ -184,5 +185,5 @@ private:
};
-};
-
+} // namespace Camera
+} // namespace Ti
diff --git a/camera/inc/BaseCameraAdapter.h b/camera/inc/BaseCameraAdapter.h
index bc38e00..b7966b0 100644
--- a/camera/inc/BaseCameraAdapter.h
+++ b/camera/inc/BaseCameraAdapter.h
@@ -21,7 +21,18 @@
#include "CameraHal.h"
-namespace android {
+namespace Ti {
+namespace Camera {
+
+struct LUT {
+ const char * userDefinition;
+ int halDefinition;
+};
+
+struct LUTtypeHAL{
+ int size;
+ const LUT *Table;
+};
class BaseCameraAdapter : public CameraAdapter
{
@@ -39,16 +50,16 @@ public:
//Message/Frame notification APIs
virtual void enableMsgType(int32_t msgs, frame_callback callback=NULL, event_callback eventCb=NULL, void* cookie=NULL);
virtual void disableMsgType(int32_t msgs, void* cookie);
- virtual void returnFrame(void * frameBuf, CameraFrame::FrameType frameType);
- virtual void addFramePointers(void *frameBuf, void *y_uv);
+ virtual void returnFrame(CameraBuffer * frameBuf, CameraFrame::FrameType frameType);
+ virtual void addFramePointers(CameraBuffer *frameBuf, void *y_uv);
virtual void removeFramePointers();
//APIs to configure Camera adapter and get the current parameter set
- virtual status_t setParameters(const CameraParameters& params) = 0;
- virtual void getParameters(CameraParameters& params) = 0;
+ virtual status_t setParameters(const android::CameraParameters& params) = 0;
+ virtual void getParameters(android::CameraParameters& params) = 0;
//API to send a command to the camera
- virtual status_t sendCommand(CameraCommands operation, int value1 = 0, int value2 = 0, int value3 = 0 );
+ virtual status_t sendCommand(CameraCommands operation, int value1 = 0, int value2 = 0, int value3 = 0, int value4 = 0 );
virtual status_t registerImageReleaseCallback(release_image_buffers_callback callback, void *user_data);
@@ -59,6 +70,8 @@ public:
//Retrieves the next Adapter state
virtual AdapterState getNextState();
+ virtual status_t setSharedAllocator(camera_request_memory shmem_alloc) { mSharedAllocator = shmem_alloc; return NO_ERROR; };
+
// Rolls the state machine back to INTIALIZED_STATE from the current state
virtual status_t rollbackToInitializedState();
@@ -115,10 +128,10 @@ protected:
virtual status_t stopSmoothZoom();
//Should be implemented by deriving classes in order to stop smooth zoom
- virtual status_t useBuffers(CameraMode mode, void* bufArr, int num, size_t length, unsigned int queueable);
+ virtual status_t useBuffers(CameraMode mode, CameraBuffer* bufArr, int num, size_t length, unsigned int queueable);
//Should be implemented by deriving classes in order queue a released buffer in CameraAdapter
- virtual status_t fillThisBuffer(void* frameBuf, CameraFrame::FrameType frameType);
+ virtual status_t fillThisBuffer(CameraBuffer* frameBuf, CameraFrame::FrameType frameType);
//API to get the frame size required to be allocated. This size is used to override the size passed
//by camera service when VSTAB/VNF is turned ON for example
@@ -128,7 +141,7 @@ protected:
virtual status_t getFrameDataSize(size_t &dataFrameSize, size_t bufferCount);
//API to get required picture buffers size with the current configuration in CameraParameters
- virtual status_t getPictureBufferSize(size_t &length, size_t bufferCount);
+ virtual status_t getPictureBufferSize(CameraFrame &frame, size_t bufferCount);
// Should be implemented by deriving classes in order to start face detection
// ( if supported )
@@ -140,6 +153,12 @@ protected:
virtual status_t switchToExecuting();
+ virtual status_t setupTunnel(uint32_t SliceHeight, uint32_t EncoderHandle, uint32_t width, uint32_t height);
+
+ virtual status_t destroyTunnel();
+
+ virtual status_t cameraPreviewInitialization();
+
// Receive orientation events from CameraHal
virtual void onOrientationEvent(uint32_t orientation, uint32_t tilt);
@@ -148,7 +167,7 @@ protected:
status_t notifyFocusSubscribers(CameraHalEvent::FocusStatus status);
status_t notifyShutterSubscribers();
status_t notifyZoomSubscribers(int zoomIdx, bool targetReached);
- status_t notifyFaceSubscribers(sp<CameraFDResult> &faces);
+ status_t notifyMetadataSubscribers(android::sp<CameraMetadataResult> &meta);
//Send the frame to subscribers
status_t sendFrameToSubscribers(CameraFrame *frame);
@@ -157,14 +176,15 @@ protected:
status_t resetFrameRefCount(CameraFrame &frame);
//A couple of helper functions
- void setFrameRefCount(void* frameBuf, CameraFrame::FrameType frameType, int refCount);
- int getFrameRefCount(void* frameBuf, CameraFrame::FrameType frameType);
- int setInitFrameRefCount(void* buf, unsigned int mask);
+ void setFrameRefCount(CameraBuffer* frameBuf, CameraFrame::FrameType frameType, int refCount);
+ int getFrameRefCount(CameraBuffer* frameBuf, CameraFrame::FrameType frameType);
+ int setInitFrameRefCount(CameraBuffer* buf, unsigned int mask);
+ static const char* getLUTvalue_translateHAL(int Value, LUTtypeHAL LUT);
// private member functions
private:
status_t __sendFrameToSubscribers(CameraFrame* frame,
- KeyedVector<int, frame_callback> *subscribers,
+ android::KeyedVector<int, frame_callback> *subscribers,
CameraFrame::FrameType frameType);
status_t rollbackToPreviousState();
@@ -198,55 +218,66 @@ protected:
#endif
- mutable Mutex mReturnFrameLock;
+ mutable android::Mutex mReturnFrameLock;
//Lock protecting the Adapter state
- mutable Mutex mLock;
+ mutable android::Mutex mLock;
AdapterState mAdapterState;
AdapterState mNextState;
//Different frame subscribers get stored using these
- KeyedVector<int, frame_callback> mFrameSubscribers;
- KeyedVector<int, frame_callback> mFrameDataSubscribers;
- KeyedVector<int, frame_callback> mVideoSubscribers;
- KeyedVector<int, frame_callback> mImageSubscribers;
- KeyedVector<int, frame_callback> mRawSubscribers;
- KeyedVector<int, event_callback> mFocusSubscribers;
- KeyedVector<int, event_callback> mZoomSubscribers;
- KeyedVector<int, event_callback> mShutterSubscribers;
- KeyedVector<int, event_callback> mFaceSubscribers;
+ android::KeyedVector<int, frame_callback> mFrameSubscribers;
+ android::KeyedVector<int, frame_callback> mSnapshotSubscribers;
+ android::KeyedVector<int, frame_callback> mFrameDataSubscribers;
+ android::KeyedVector<int, frame_callback> mVideoSubscribers;
+ android::KeyedVector<int, frame_callback> mVideoInSubscribers;
+ android::KeyedVector<int, frame_callback> mImageSubscribers;
+ android::KeyedVector<int, frame_callback> mRawSubscribers;
+ android::KeyedVector<int, event_callback> mFocusSubscribers;
+ android::KeyedVector<int, event_callback> mZoomSubscribers;
+ android::KeyedVector<int, event_callback> mShutterSubscribers;
+ android::KeyedVector<int, event_callback> mMetadataSubscribers;
//Preview buffer management data
- int *mPreviewBuffers;
+ CameraBuffer *mPreviewBuffers;
int mPreviewBufferCount;
size_t mPreviewBuffersLength;
- KeyedVector<int, int> mPreviewBuffersAvailable;
- mutable Mutex mPreviewBufferLock;
+ android::KeyedVector<CameraBuffer *, int> mPreviewBuffersAvailable;
+ mutable android::Mutex mPreviewBufferLock;
+
+ //Snapshot buffer management data
+ android::KeyedVector<int, int> mSnapshotBuffersAvailable;
+ mutable android::Mutex mSnapshotBufferLock;
//Video buffer management data
- int *mVideoBuffers;
- KeyedVector<int, int> mVideoBuffersAvailable;
+ CameraBuffer *mVideoBuffers;
+ android::KeyedVector<CameraBuffer *, int> mVideoBuffersAvailable;
int mVideoBuffersCount;
size_t mVideoBuffersLength;
- mutable Mutex mVideoBufferLock;
+ mutable android::Mutex mVideoBufferLock;
//Image buffer management data
- int *mCaptureBuffers;
- KeyedVector<int, bool> mCaptureBuffersAvailable;
+ CameraBuffer *mCaptureBuffers;
+ android::KeyedVector<CameraBuffer *, int> mCaptureBuffersAvailable;
int mCaptureBuffersCount;
size_t mCaptureBuffersLength;
- mutable Mutex mCaptureBufferLock;
+ mutable android::Mutex mCaptureBufferLock;
//Metadata buffermanagement
- int *mPreviewDataBuffers;
- KeyedVector<int, bool> mPreviewDataBuffersAvailable;
+ CameraBuffer *mPreviewDataBuffers;
+ android::KeyedVector<CameraBuffer *, int> mPreviewDataBuffersAvailable;
int mPreviewDataBuffersCount;
size_t mPreviewDataBuffersLength;
- mutable Mutex mPreviewDataBufferLock;
+ mutable android::Mutex mPreviewDataBufferLock;
- TIUTILS::MessageQueue mFrameQ;
- TIUTILS::MessageQueue mAdapterQ;
- mutable Mutex mSubscriberLock;
+ //Video input buffer management data (used for reproc pipe)
+ CameraBuffer *mVideoInBuffers;
+ android::KeyedVector<CameraBuffer *, int> mVideoInBuffersAvailable;
+ mutable android::Mutex mVideoInBufferLock;
+
+ Utils::MessageQueue mFrameQ;
+ Utils::MessageQueue mAdapterQ;
+ mutable android::Mutex mSubscriberLock;
ErrorNotifier *mErrorNotifier;
release_image_buffers_callback mReleaseImageBuffersCallback;
end_image_capture_callback mEndImageCaptureCallback;
@@ -254,18 +285,21 @@ protected:
void *mEndCaptureData;
bool mRecording;
+ camera_request_memory mSharedAllocator;
+
uint32_t mFramesWithDucati;
uint32_t mFramesWithDisplay;
uint32_t mFramesWithEncoder;
-#ifdef DEBUG_LOG
- KeyedVector<int, bool> mBuffersWithDucati;
+#ifdef CAMERAHAL_DEBUG
+ android::KeyedVector<int, bool> mBuffersWithDucati;
#endif
- KeyedVector<void *, CameraFrame *> mFrameQueue;
+ android::KeyedVector<void *, CameraFrame *> mFrameQueue;
};
-};
+} // namespace Camera
+} // namespace Ti
#endif //BASE_CAMERA_ADAPTER_H
diff --git a/camera/inc/BufferSourceAdapter.h b/camera/inc/BufferSourceAdapter.h
new file mode 100644
index 0000000..436d2e5
--- /dev/null
+++ b/camera/inc/BufferSourceAdapter.h
@@ -0,0 +1,190 @@
+/*
+ * Copyright (C) Texas Instruments - http://www.ti.com/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef BUFFER_SOURCE_ADAPTER_H
+#define BUFFER_SOURCE_ADAPTER_H
+
+#ifdef OMAP_ENHANCEMENT_CPCAM
+
+#include "CameraHal.h"
+#include <ui/GraphicBufferMapper.h>
+#include <hal_public.h>
+
+namespace Ti {
+namespace Camera {
+
+/**
+ * Handles enqueueing/dequeing buffers to tap-in/tap-out points
+ * TODO(XXX): this class implements DisplayAdapter for now
+ * but this will most likely change once tap-in/tap-out points
+ * are better defined
+ */
+
+class BufferSourceAdapter : public DisplayAdapter
+{
+// private types
+private:
+ // helper class to return frame in different thread context
+ class ReturnFrame : public android::Thread {
+ public:
+ ReturnFrame(BufferSourceAdapter* __this) : mBufferSourceAdapter(__this) {
+ mWaitForSignal.Create(0);
+ mDestroying = false;
+ }
+
+ ~ReturnFrame() {
+ mDestroying = true;
+ mWaitForSignal.Release();
+ }
+
+ void signal() {
+ mWaitForSignal.Signal();
+ }
+
+ virtual bool threadLoop() {
+ mWaitForSignal.Wait();
+ if (!mDestroying) mBufferSourceAdapter->handleFrameReturn();
+ return true;
+ }
+
+ private:
+ BufferSourceAdapter* mBufferSourceAdapter;
+ Utils::Semaphore mWaitForSignal;
+ bool mDestroying;
+ };
+
+ // helper class to queue frame in different thread context
+ class QueueFrame : public android::Thread {
+ public:
+ QueueFrame(BufferSourceAdapter* __this) : mBufferSourceAdapter(__this) {
+ mDestroying = false;
+ }
+
+ ~QueueFrame() {
+ mDestroying = true;
+
+ android::AutoMutex lock(mFramesMutex);
+ while (!mFrames.empty()) {
+ CameraFrame *frame = mFrames.itemAt(0);
+ mFrames.removeAt(0);
+ frame->mMetaData.clear();
+ delete frame;
+ }
+ mFramesCondition.signal();
+ }
+
+ void addFrame(CameraFrame *frame) {
+ android::AutoMutex lock(mFramesMutex);
+ mFrames.add(new CameraFrame(*frame));
+ mFramesCondition.signal();
+ }
+
+ virtual bool threadLoop() {
+ CameraFrame *frame = NULL;
+ {
+ android::AutoMutex lock(mFramesMutex);
+ while (mFrames.empty() && !mDestroying) mFramesCondition.wait(mFramesMutex);
+ if (!mDestroying) {
+ frame = mFrames.itemAt(0);
+ mFrames.removeAt(0);
+ }
+ }
+
+ if (frame) {
+ mBufferSourceAdapter->handleFrameCallback(frame);
+ frame->mMetaData.clear();
+ delete frame;
+ }
+
+ return true;
+ }
+
+ private:
+ BufferSourceAdapter* mBufferSourceAdapter;
+ android::Vector<CameraFrame *> mFrames;
+ android::Condition mFramesCondition;
+ android::Mutex mFramesMutex;
+ bool mDestroying;
+ };
+
+ enum {
+ BUFFER_SOURCE_TAP_IN,
+ BUFFER_SOURCE_TAP_OUT
+ };
+
+// public member functions
+public:
+ BufferSourceAdapter();
+ virtual ~BufferSourceAdapter();
+
+ virtual status_t initialize();
+ virtual int setPreviewWindow(struct preview_stream_ops *source);
+ virtual int setFrameProvider(FrameNotifier *frameProvider);
+ virtual int setErrorHandler(ErrorNotifier *errorNotifier);
+ virtual int enableDisplay(int width, int height, struct timeval *refTime = NULL);
+ virtual int disableDisplay(bool cancel_buffer = true);
+ virtual status_t pauseDisplay(bool pause);
+#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS
+ // Not implemented in this class
+ virtual status_t setSnapshotTimeRef(struct timeval *refTime = NULL) { return NO_ERROR; }
+#endif
+ virtual bool supportsExternalBuffering();
+ virtual CameraBuffer * allocateBufferList(int width, int dummyHeight, const char* format, int &bytes, int numBufs);
+ virtual CameraBuffer *getBufferList(int *numBufs);
+ virtual uint32_t * getOffsets() ;
+ virtual int getFd() ;
+ virtual int freeBufferList(CameraBuffer * buflist);
+ virtual int maxQueueableBuffers(unsigned int& queueable);
+ virtual int minUndequeueableBuffers(int& unqueueable);
+
+ static void frameCallback(CameraFrame* caFrame);
+ void addFrame(CameraFrame* caFrame);
+ void handleFrameCallback(CameraFrame* caFrame);
+ bool handleFrameReturn();
+
+private:
+ void destroy();
+ status_t returnBuffersToWindow();
+
+private:
+ preview_stream_ops_t* mBufferSource;
+ FrameProvider *mFrameProvider; // Pointer to the frame provider interface
+
+ mutable android::Mutex mLock;
+ int mBufferCount;
+ CameraBuffer *mBuffers;
+
+ android::KeyedVector<buffer_handle_t *, int> mFramesWithCameraAdapterMap;
+ android::sp<ErrorNotifier> mErrorNotifier;
+ android::sp<ReturnFrame> mReturnFrame;
+ android::sp<QueueFrame> mQueueFrame;
+
+ uint32_t mFrameWidth;
+ uint32_t mFrameHeight;
+ uint32_t mPreviewWidth;
+ uint32_t mPreviewHeight;
+
+ int mBufferSourceDirection;
+
+ const char *mPixelFormat;
+};
+
+} // namespace Camera
+} // namespace Ti
+
+#endif
+
+#endif
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index 2506b7b..d20db1e 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -29,22 +29,37 @@
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
+
+#include <hardware/camera.h>
#include <utils/Log.h>
#include <utils/threads.h>
-#include <linux/videodev2.h>
-#include "binder/MemoryBase.h"
-#include "binder/MemoryHeapBase.h"
#include <utils/threads.h>
+#include <binder/MemoryBase.h>
+#include <binder/MemoryHeapBase.h>
#include <camera/CameraParameters.h>
-#include <hardware/camera.h>
+#ifdef OMAP_ENHANCEMENT_CPCAM
+#include <camera/CameraMetadata.h>
+#include <camera/ShotParameters.h>
+#endif
+#include <ui/GraphicBufferAllocator.h>
+#include <ui/GraphicBuffer.h>
+
+/* For IMG_native_handle_t */
+#include <ui/GraphicBufferMapper.h>
+#include <hal_public.h>
+
+#include <ion_ti/ion.h>
+
+#include "Common.h"
#include "MessageQueue.h"
#include "Semaphore.h"
#include "CameraProperties.h"
-#include "DebugUtils.h"
#include "SensorListener.h"
-#include <ui/GraphicBufferAllocator.h>
-#include <ui/GraphicBuffer.h>
+//temporarily define format here
+#define HAL_PIXEL_FORMAT_TI_NV12 0x100
+#define HAL_PIXEL_FORMAT_TI_Y8 0x103
+#define HAL_PIXEL_FORMAT_TI_Y16 0x104
#define MIN_WIDTH 640
#define MIN_HEIGHT 480
@@ -66,6 +81,8 @@
#define SHARPNESS_OFFSET 100
#define CONTRAST_OFFSET 100
+#define FRAME_RATE_HIGH_HD 60
+
#define CAMHAL_GRALLOC_USAGE GRALLOC_USAGE_HW_TEXTURE | \
GRALLOC_USAGE_HW_RENDER | \
GRALLOC_USAGE_SW_READ_RARELY | \
@@ -77,75 +94,111 @@
#define LOCK_BUFFER_TRIES 5
#define HAL_PIXEL_FORMAT_NV12 0x100
-#define CAMHAL_LOGI ALOGI
+#define NONNEG_ASSIGN(x,y) \
+ if(x > -1) \
+ y = x
-//Uncomment to enable more verbose/debug logs
-#define DEBUG_LOG
+#define CAMHAL_SIZE_OF_ARRAY(x) static_cast<int>(sizeof(x)/sizeof(x[0]))
-///Camera HAL Logging Functions
-#ifndef DEBUG_LOG
+namespace Ti {
+namespace Camera {
-#define CAMHAL_LOGDA(str)
-#define CAMHAL_LOGDB(str, ...)
-#define CAMHAL_LOGVA(str)
-#define CAMHAL_LOGVB(str, ...)
+#ifdef CAMERAHAL_USE_RAW_IMAGE_SAVING
+extern const char * const kRawImagesOutputDirPath;
+extern const char * const kYuvImagesOutputDirPath;
+#endif
+#define V4L_CAMERA_NAME_USB "USBCAMERA"
+#define OMX_CAMERA_NAME_OV "OV5640"
+#define OMX_CAMERA_NAME_SONY "IMX060"
-#define CAMHAL_LOGEA ALOGE
-#define CAMHAL_LOGEB ALOGE
-#undef LOG_FUNCTION_NAME
-#undef LOG_FUNCTION_NAME_EXIT
-#define LOG_FUNCTION_NAME
-#define LOG_FUNCTION_NAME_EXIT
+///Forward declarations
+class CameraHal;
+class CameraFrame;
+class CameraHalEvent;
+class DisplayFrame;
-#else
+class FpsRange {
+public:
+ static int compare(const FpsRange * left, const FpsRange * right);
-#define CAMHAL_LOGDA DBGUTILS_LOGDA
-#define CAMHAL_LOGDB DBGUTILS_LOGDB
-#define CAMHAL_LOGVA DBGUTILS_LOGVA
-#define CAMHAL_LOGVB DBGUTILS_LOGVB
+ FpsRange(int min, int max);
+ FpsRange();
-#define CAMHAL_LOGEA DBGUTILS_LOGEA
-#define CAMHAL_LOGEB DBGUTILS_LOGEB
+ bool operator==(const FpsRange & fpsRange) const;
-#endif
+ bool isNull() const;
+ bool isFixed() const;
+ int min() const;
+ int max() const;
+private:
+ int mMin;
+ int mMax;
+};
-#define NONNEG_ASSIGN(x,y) \
- if(x > -1) \
- y = x
-namespace android {
+inline int FpsRange::compare(const FpsRange * const left, const FpsRange * const right) {
+ if ( left->max() < right->max() ) {
+ return -1;
+ }
-#define PARAM_BUFFER 6000
+ if ( left->max() > right->max() ) {
+ return 1;
+ }
-///Forward declarations
-class CameraHal;
-class CameraFrame;
-class CameraHalEvent;
-class DisplayFrame;
+ if ( left->min() < right->min() ) {
+ return -1;
+ }
+
+ if ( left->min() > right->min() ) {
+ return 1;
+ }
+
+ return 0;
+}
+
+inline FpsRange::FpsRange(const int min, const int max) : mMin(min), mMax(max) {}
+
+inline FpsRange::FpsRange() : mMin(-1), mMax(-1) {}
+
+inline bool FpsRange::operator==(const FpsRange & fpsRange) const {
+ return mMin == fpsRange.mMin && mMax == fpsRange.mMax;
+}
+
+inline bool FpsRange::isNull() const {
+ return mMin == -1 || mMax == -1;
+}
+
+inline bool FpsRange::isFixed() const {
+ return mMin == mMax;
+}
+
+inline int FpsRange::min() const { return mMin; }
+
+inline int FpsRange::max() const { return mMax; }
-class CameraArea : public RefBase
+class CameraArea : public android::RefBase
{
public:
- CameraArea(int32_t top,
- int32_t left,
- int32_t bottom,
- int32_t right,
- uint32_t weight) : mTop(top),
+ CameraArea(ssize_t top,
+ ssize_t left,
+ ssize_t bottom,
+ ssize_t right,
+ size_t weight) : mTop(top),
mLeft(left),
mBottom(bottom),
mRight(right),
mWeight(weight) {}
- status_t transfrom(uint32_t width,
- uint32_t height,
- int32_t &top,
- int32_t &left,
- uint32_t &areaWidth,
- uint32_t &areaHeight);
+ status_t transfrom(size_t width,
+ size_t height,
+ size_t &top,
+ size_t &left,
+ size_t &areaWidth,
+ size_t &areaHeight);
bool isValid()
{
@@ -158,62 +211,84 @@ public:
&& ( 0 == mRight ) && ( 0 == mWeight ));
}
- uint32_t getWeight()
+ size_t getWeight()
{
return mWeight;
}
- bool compare(const sp<CameraArea> &area);
+ bool compare(const android::sp<CameraArea> &area);
static status_t parseAreas(const char *area,
- uint32_t areaLength,
- Vector< sp<CameraArea> > &areas);
+ size_t areaLength,
+ android::Vector< android::sp<CameraArea> > &areas);
- static status_t checkArea(int32_t top,
- int32_t left,
- int32_t bottom,
- int32_t right,
- int32_t weight);
+ static status_t checkArea(ssize_t top,
+ ssize_t left,
+ ssize_t bottom,
+ ssize_t right,
+ ssize_t weight);
- static bool areAreasDifferent(Vector< sp<CameraArea> > &, Vector< sp<CameraArea> > &);
+ static bool areAreasDifferent(android::Vector< android::sp<CameraArea> > &, android::Vector< android::sp<CameraArea> > &);
protected:
- static const int32_t TOP = -1000;
- static const int32_t LEFT = -1000;
- static const int32_t BOTTOM = 1000;
- static const int32_t RIGHT = 1000;
- static const int32_t WEIGHT_MIN = 1;
- static const int32_t WEIGHT_MAX = 1000;
-
- int32_t mTop;
- int32_t mLeft;
- int32_t mBottom;
- int32_t mRight;
- uint32_t mWeight;
+ static const ssize_t TOP = -1000;
+ static const ssize_t LEFT = -1000;
+ static const ssize_t BOTTOM = 1000;
+ static const ssize_t RIGHT = 1000;
+ static const ssize_t WEIGHT_MIN = 1;
+ static const ssize_t WEIGHT_MAX = 1000;
+
+ ssize_t mTop;
+ ssize_t mLeft;
+ ssize_t mBottom;
+ ssize_t mRight;
+ size_t mWeight;
};
-class CameraFDResult : public RefBase
+class CameraMetadataResult : public android::RefBase
{
public:
- CameraFDResult() : mFaceData(NULL) {};
- CameraFDResult(camera_frame_metadata_t *faces) : mFaceData(faces) {};
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ CameraMetadataResult(camera_memory_t * extMeta) : mExtendedMetadata(extMeta) {
+ mMetadata.faces = NULL;
+ mMetadata.number_of_faces = 0;
+#ifdef OMAP_ENHANCEMENT
+ mMetadata.analog_gain = 0;
+ mMetadata.exposure_time = 0;
+#endif
+ };
+#endif
- virtual ~CameraFDResult() {
- if ( ( NULL != mFaceData ) && ( NULL != mFaceData->faces ) ) {
- free(mFaceData->faces);
- free(mFaceData);
- mFaceData=NULL;
- }
+ CameraMetadataResult() {
+ mMetadata.faces = NULL;
+ mMetadata.number_of_faces = 0;
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ mMetadata.analog_gain = 0;
+ mMetadata.exposure_time = 0;
+#endif
+
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ mExtendedMetadata = NULL;
+#endif
+ }
- if(( NULL != mFaceData ))
- {
- free(mFaceData);
- mFaceData = NULL;
- }
+ virtual ~CameraMetadataResult() {
+ if ( NULL != mMetadata.faces ) {
+ free(mMetadata.faces);
+ }
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ if ( NULL != mExtendedMetadata ) {
+ mExtendedMetadata->release(mExtendedMetadata);
+ }
+#endif
}
- camera_frame_metadata_t *getFaceResult() { return mFaceData; };
+ camera_frame_metadata_t *getMetadataResult() { return &mMetadata; };
+
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ camera_memory_t *getExtendedMetadata() { return mExtendedMetadata; };
+#endif
static const ssize_t TOP = -1000;
static const ssize_t LEFT = -1000;
@@ -223,9 +298,58 @@ public:
private:
- camera_frame_metadata_t *mFaceData;
+ camera_frame_metadata_t mMetadata;
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ camera_memory_t *mExtendedMetadata;
+#endif
};
+typedef enum {
+ CAMERA_BUFFER_NONE = 0,
+ CAMERA_BUFFER_GRALLOC,
+ CAMERA_BUFFER_ANW,
+ CAMERA_BUFFER_MEMORY,
+ CAMERA_BUFFER_ION
+} CameraBufferType;
+
+typedef struct _CameraBuffer {
+ CameraBufferType type;
+ /* opaque is the generic drop-in replacement for the pointers
+ * that were used previously */
+ void *opaque;
+
+ /* opaque has different meanings depending on the buffer type:
+ * GRALLOC - gralloc_handle_t
+ * ANW - a pointer to the buffer_handle_t (which corresponds to
+ * the ANativeWindowBuffer *)
+ * MEMORY - address of allocated memory
+ * ION - address of mapped ion allocation
+ *
+ * FIXME opaque should be split into several fields:
+ * - handle/pointer we got from the allocator
+ * - handle/value we pass to OMX
+ * - pointer to mapped memory (if the buffer is mapped)
+ */
+
+ /* mapped holds ptr to mapped memory in userspace */
+ void *mapped;
+
+ /* These are specific to ION buffers */
+ struct ion_handle * ion_handle;
+ int ion_fd;
+ int fd;
+ size_t size;
+ int index;
+
+ /* These describe the camera buffer */
+ int width;
+ int stride;
+ int height;
+ const char *format;
+} CameraBuffer;
+
+void * camera_buffer_get_omx_ptr (CameraBuffer *buffer);
+
class CameraFrame
{
public:
@@ -242,6 +366,7 @@ class CameraFrame
FRAME_DATA= 0x80,
RAW_FRAME = 0x100,
SNAPSHOT_FRAME = 0x200,
+ REPROCESS_INPUT_FRAME = 0x400,
ALL_FRAMES = 0xFFFF ///Maximum of 16 frame types supported
};
@@ -249,6 +374,8 @@ class CameraFrame
{
ENCODE_RAW_YUV422I_TO_JPEG = 0x1 << 0,
HAS_EXIF_DATA = 0x1 << 1,
+ FORMAT_YUV422I_YUYV = 0x1 << 2,
+ FORMAT_YUV422I_UYVY = 0x1 << 3,
};
//default contrustor
@@ -265,45 +392,32 @@ class CameraFrame
mFd(0),
mLength(0),
mFrameMask(0),
- mQuirks(0) {
-
+ mQuirks(0)
+ {
mYuv[0] = 0; //NULL;
mYuv[1] = 0; //NULL;
- }
- //copy constructor
- CameraFrame(const CameraFrame &frame) :
- mCookie(frame.mCookie),
- mCookie2(frame.mCookie2),
- mBuffer(frame.mBuffer),
- mFrameType(frame.mFrameType),
- mTimestamp(frame.mTimestamp),
- mWidth(frame.mWidth),
- mHeight(frame.mHeight),
- mOffset(frame.mOffset),
- mAlignment(frame.mAlignment),
- mFd(frame.mFd),
- mLength(frame.mLength),
- mFrameMask(frame.mFrameMask),
- mQuirks(frame.mQuirks) {
-
- mYuv[0] = frame.mYuv[0];
- mYuv[1] = frame.mYuv[1];
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ mMetaData = 0;
+#endif
}
void *mCookie;
void *mCookie2;
- void *mBuffer;
+ CameraBuffer *mBuffer;
int mFrameType;
nsecs_t mTimestamp;
unsigned int mWidth, mHeight;
uint32_t mOffset;
unsigned int mAlignment;
int mFd;
- uint32_t mLength;
+ size_t mLength;
unsigned mFrameMask;
unsigned int mQuirks;
unsigned int mYuv[2];
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ android::sp<CameraMetadataResult> mMetaData;
+#endif
///@todo add other member vars like stride etc
};
@@ -326,7 +440,7 @@ public:
EVENT_FOCUS_ERROR = 0x2,
EVENT_ZOOM_INDEX_REACHED = 0x4,
EVENT_SHUTTER = 0x8,
- EVENT_FACE = 0x10,
+ EVENT_METADATA = 0x10,
///@remarks Future enum related to display, like frame displayed event, could be added here
ALL_EVENTS = 0xFFFF ///Maximum of 16 event types supported
};
@@ -359,23 +473,23 @@ public:
} ZoomEventData;
typedef struct FaceData_t {
- int32_t top;
- int32_t left;
- int32_t bottom;
- int32_t right;
- uint32_t score;
+ ssize_t top;
+ ssize_t left;
+ ssize_t bottom;
+ ssize_t right;
+ size_t score;
} FaceData;
- typedef sp<CameraFDResult> FaceEventData;
+ typedef android::sp<CameraMetadataResult> MetaEventData;
- class CameraHalEventData : public RefBase{
+ class CameraHalEventData : public android::RefBase{
public:
CameraHalEvent::FocusEventData focusEvent;
CameraHalEvent::ZoomEventData zoomEvent;
CameraHalEvent::ShutterEventData shutterEvent;
- CameraHalEvent::FaceEventData faceEvent;
+ CameraHalEvent::MetaEventData metadataEvent;
};
//default contrustor
@@ -391,7 +505,7 @@ public:
void* mCookie;
CameraHalEventType mEventType;
- sp<CameraHalEventData> mEventData;
+ android::sp<CameraHalEventData> mEventData;
};
@@ -423,7 +537,7 @@ public:
virtual ~MessageNotifier() {};
};
-class ErrorNotifier : public virtual RefBase
+class ErrorNotifier : public virtual android::RefBase
{
public:
virtual void errorNotify(int error) = 0;
@@ -439,8 +553,8 @@ public:
class FrameNotifier : public MessageNotifier
{
public:
- virtual void returnFrame(void* frameBuf, CameraFrame::FrameType frameType) = 0;
- virtual void addFramePointers(void *frameBuf, void *buf) = 0;
+ virtual void returnFrame(CameraBuffer* frameBuf, CameraFrame::FrameType frameType) = 0;
+ virtual void addFramePointers(CameraBuffer *frameBuf, void *buf) = 0;
virtual void removeFramePointers() = 0;
virtual ~FrameNotifier() {};
@@ -460,8 +574,8 @@ public:
int enableFrameNotification(int32_t frameTypes);
int disableFrameNotification(int32_t frameTypes);
- int returnFrame(void *frameBuf, CameraFrame::FrameType frameType);
- void addFramePointers(void *frameBuf, void *buf);
+ int returnFrame(CameraBuffer *frameBuf, CameraFrame::FrameType frameType);
+ void addFramePointers(CameraBuffer *frameBuf, void *buf);
void removeFramePointers();
};
@@ -489,13 +603,18 @@ public:
class BufferProvider
{
public:
- virtual void* allocateBuffer(int width, int height, const char* format, int &bytes, int numBufs) = 0;
+ virtual CameraBuffer * allocateBufferList(int width, int height, const char* format, int &bytes, int numBufs) = 0;
+
+ // gets a buffer list from BufferProvider when buffers are sent from external source and already pre-allocated
+ // only call this function for an input source into CameraHal. If buffers are not from a pre-allocated source
+ // this function will return NULL and numBufs of -1
+ virtual CameraBuffer *getBufferList(int *numBufs) = 0;
//additional methods used for memory mapping
virtual uint32_t * getOffsets() = 0;
virtual int getFd() = 0;
- virtual int freeBuffer(void* buf) = 0;
+ virtual int freeBufferList(CameraBuffer * buf) = 0;
virtual ~BufferProvider() {}
};
@@ -503,7 +622,7 @@ public:
/**
* Class for handling data and notify callbacks to application
*/
-class AppCallbackNotifier: public ErrorNotifier , public virtual RefBase
+class AppCallbackNotifier: public ErrorNotifier , public virtual android::RefBase
{
public:
@@ -545,7 +664,7 @@ public:
//All sub-components of Camera HAL call this whenever any error happens
virtual void errorNotify(int error);
- status_t startPreviewCallbacks(CameraParameters &params, void *buffers, uint32_t *offsets, int fd, uint32_t length, uint32_t count);
+ status_t startPreviewCallbacks(android::CameraParameters &params, CameraBuffer *buffers, uint32_t *offsets, int fd, size_t length, size_t count);
status_t stopPreviewCallbacks();
status_t enableMsgType(int32_t msgType);
@@ -577,12 +696,12 @@ public:
//Notifications from CameraHal for video recording case
status_t startRecording();
status_t stopRecording();
- status_t initSharedVideoBuffers(void *buffers, uint32_t *offsets, int fd, uint32_t length, uint32_t count, void *vidBufs);
+ status_t initSharedVideoBuffers(CameraBuffer *buffers, uint32_t *offsets, int fd, size_t length, size_t count, CameraBuffer *vidBufs);
status_t releaseRecordingFrame(const void *opaque);
- status_t useMetaDataBufferMode(bool enable);
+ status_t useMetaDataBufferMode(bool enable);
- void EncoderDoneCb(void*, void*, CameraFrame::FrameType type, void* cookie1, void* cookie2);
+ void EncoderDoneCb(void*, void*, CameraFrame::FrameType type, void* cookie1, void* cookie2, void *cookie3);
void useVideoBuffers(bool useVideoBuffers);
@@ -592,9 +711,9 @@ public:
void flushEventQueue();
//Internal class definitions
- class NotificationThread : public Thread {
+ class NotificationThread : public android::Thread {
AppCallbackNotifier* mAppCallbackNotifier;
- TIUTILS::MessageQueue mNotificationThreadQ;
+ Utils::MessageQueue mNotificationThreadQ;
public:
enum NotificationThreadCommands
{
@@ -609,7 +728,7 @@ public:
return mAppCallbackNotifier->notificationThread();
}
- TIUTILS::MessageQueue &msgQ() { return mNotificationThreadQ;}
+ Utils::MessageQueue &msgQ() { return mNotificationThreadQ;}
};
//Friend declarations
@@ -623,10 +742,12 @@ private:
status_t dummyRaw();
void copyAndSendPictureFrame(CameraFrame* frame, int32_t msgType);
void copyAndSendPreviewFrame(CameraFrame* frame, int32_t msgType);
+ size_t calculateBufferSize(size_t width, size_t height, const char *pixelFormat);
+ const char* getContstantForPixelFormat(const char *pixelFormat);
private:
- mutable Mutex mLock;
- mutable Mutex mBurstLock;
+ mutable android::Mutex mLock;
+ mutable android::Mutex mBurstLock;
CameraHal* mCameraHal;
camera_notify_callback mNotifyCb;
camera_data_callback mDataCb;
@@ -636,34 +757,37 @@ private:
//Keeps Video MemoryHeaps and Buffers within
//these objects
- KeyedVector<unsigned int, unsigned int> mVideoHeaps;
- KeyedVector<unsigned int, unsigned int> mVideoBuffers;
- KeyedVector<unsigned int, unsigned int> mVideoMap;
+ android::KeyedVector<unsigned int, unsigned int> mVideoHeaps;
+ android::KeyedVector<unsigned int, unsigned int> mVideoBuffers;
+ android::KeyedVector<void *, CameraBuffer *> mVideoMap;
//Keeps list of Gralloc handles and associated Video Metadata Buffers
- KeyedVector<uint32_t, uint32_t> mVideoMetadataBufferMemoryMap;
- KeyedVector<uint32_t, uint32_t> mVideoMetadataBufferReverseMap;
+ android::KeyedVector<void *, camera_memory_t *> mVideoMetadataBufferMemoryMap;
+ android::KeyedVector<void *, CameraBuffer *> mVideoMetadataBufferReverseMap;
bool mBufferReleased;
- sp< NotificationThread> mNotificationThread;
+ android::sp< NotificationThread> mNotificationThread;
EventProvider *mEventProvider;
FrameProvider *mFrameProvider;
- TIUTILS::MessageQueue mEventQ;
- TIUTILS::MessageQueue mFrameQ;
+ Utils::MessageQueue mEventQ;
+ Utils::MessageQueue mFrameQ;
NotifierState mNotifierState;
bool mPreviewing;
camera_memory_t* mPreviewMemory;
- unsigned char* mPreviewBufs[MAX_BUFFERS];
+ CameraBuffer mPreviewBuffers[MAX_BUFFERS];
int mPreviewBufCount;
+ int mPreviewWidth;
+ int mPreviewHeight;
+ int mPreviewStride;
const char *mPreviewPixelFormat;
- KeyedVector<unsigned int, sp<MemoryHeapBase> > mSharedPreviewHeaps;
- KeyedVector<unsigned int, sp<MemoryBase> > mSharedPreviewBuffers;
+ android::KeyedVector<unsigned int, android::sp<android::MemoryHeapBase> > mSharedPreviewHeaps;
+ android::KeyedVector<unsigned int, android::sp<android::MemoryBase> > mSharedPreviewBuffers;
//Burst mode active
bool mBurst;
- mutable Mutex mRecordingLock;
+ mutable android::Mutex mRecordingLock;
bool mRecording;
bool mMeasurementEnabled;
@@ -681,27 +805,24 @@ private:
/**
* Class used for allocating memory for JPEG bit stream buffers, output buffers of camera in no overlay case
*/
-class MemoryManager : public BufferProvider, public virtual RefBase
+class MemoryManager : public BufferProvider, public virtual android::RefBase
{
public:
- MemoryManager():mIonFd(-1){ }
+ MemoryManager();
+ ~MemoryManager();
- ///Initializes the memory manager creates any resources required
- status_t initialize() { return NO_ERROR; }
+ status_t initialize();
int setErrorHandler(ErrorNotifier *errorNotifier);
- virtual void* allocateBuffer(int width, int height, const char* format, int &bytes, int numBufs);
+ virtual CameraBuffer * allocateBufferList(int width, int height, const char* format, int &bytes, int numBufs);
+ virtual CameraBuffer *getBufferList(int *numBufs);
virtual uint32_t * getOffsets();
virtual int getFd() ;
- virtual int freeBuffer(void* buf);
+ virtual int freeBufferList(CameraBuffer * buflist);
private:
-
- sp<ErrorNotifier> mErrorNotifier;
+ android::sp<ErrorNotifier> mErrorNotifier;
int mIonFd;
- KeyedVector<unsigned int, unsigned int> mIonHandleMap;
- KeyedVector<unsigned int, unsigned int> mIonFdMap;
- KeyedVector<unsigned int, unsigned int> mIonBufLength;
};
@@ -712,29 +833,31 @@ private:
* Concrete classes derive from this class and provide implementations based on the specific camera h/w interface
*/
-class CameraAdapter: public FrameNotifier, public virtual RefBase
+class CameraAdapter: public FrameNotifier, public virtual android::RefBase
{
protected:
enum AdapterActiveStates {
- INTIALIZED_ACTIVE = 1 << 0,
- LOADED_PREVIEW_ACTIVE = 1 << 1,
- PREVIEW_ACTIVE = 1 << 2,
- LOADED_CAPTURE_ACTIVE = 1 << 3,
- CAPTURE_ACTIVE = 1 << 4,
- BRACKETING_ACTIVE = 1 << 5,
- AF_ACTIVE = 1 << 6,
- ZOOM_ACTIVE = 1 << 7,
- VIDEO_ACTIVE = 1 << 8,
+ INTIALIZED_ACTIVE = 1 << 0,
+ LOADED_PREVIEW_ACTIVE = 1 << 1,
+ PREVIEW_ACTIVE = 1 << 2,
+ LOADED_CAPTURE_ACTIVE = 1 << 3,
+ CAPTURE_ACTIVE = 1 << 4,
+ BRACKETING_ACTIVE = 1 << 5,
+ AF_ACTIVE = 1 << 6,
+ ZOOM_ACTIVE = 1 << 7,
+ VIDEO_ACTIVE = 1 << 8,
+ LOADED_REPROCESS_ACTIVE = 1 << 9,
+ REPROCESS_ACTIVE = 1 << 10,
};
public:
typedef struct
{
- void *mBuffers;
+ CameraBuffer *mBuffers;
uint32_t *mOffsets;
int mFd;
- uint32_t mLength;
- uint32_t mCount;
- uint32_t mMaxQueueable;
+ size_t mLength;
+ size_t mCount;
+ size_t mMaxQueueable;
} BuffersDescriptor;
enum CameraCommands
@@ -764,6 +887,16 @@ public:
CAMERA_START_FD = 22,
CAMERA_STOP_FD = 23,
CAMERA_SWITCH_TO_EXECUTING = 24,
+ CAMERA_USE_BUFFERS_VIDEO_CAPTURE = 25,
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ CAMERA_USE_BUFFERS_REPROCESS = 26,
+ CAMERA_START_REPROCESS = 27,
+#endif
+#ifdef OMAP_ENHANCEMENT_VTC
+ CAMERA_SETUP_TUNNEL = 28,
+ CAMERA_DESTROY_TUNNEL = 29,
+#endif
+ CAMERA_PREVIEW_INITIALIZATION = 30,
};
enum CameraMode
@@ -771,27 +904,32 @@ public:
CAMERA_PREVIEW,
CAMERA_IMAGE_CAPTURE,
CAMERA_VIDEO,
- CAMERA_MEASUREMENT
+ CAMERA_MEASUREMENT,
+ CAMERA_REPROCESS,
};
enum AdapterState {
- INTIALIZED_STATE = INTIALIZED_ACTIVE,
- LOADED_PREVIEW_STATE = LOADED_PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- PREVIEW_STATE = PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- LOADED_CAPTURE_STATE = LOADED_CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- CAPTURE_STATE = CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- BRACKETING_STATE = BRACKETING_ACTIVE | CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE ,
- AF_STATE = AF_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- ZOOM_STATE = ZOOM_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- VIDEO_STATE = VIDEO_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- VIDEO_AF_STATE = VIDEO_ACTIVE | AF_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- VIDEO_ZOOM_STATE = VIDEO_ACTIVE | ZOOM_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- VIDEO_LOADED_CAPTURE_STATE = VIDEO_ACTIVE | LOADED_CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- VIDEO_CAPTURE_STATE = VIDEO_ACTIVE | CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- AF_ZOOM_STATE = AF_ACTIVE | ZOOM_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
- BRACKETING_ZOOM_STATE = BRACKETING_ACTIVE | ZOOM_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ INTIALIZED_STATE = INTIALIZED_ACTIVE,
+ LOADED_PREVIEW_STATE = LOADED_PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ PREVIEW_STATE = PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ LOADED_CAPTURE_STATE = LOADED_CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ CAPTURE_STATE = CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ BRACKETING_STATE = BRACKETING_ACTIVE | CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE ,
+ AF_STATE = AF_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ ZOOM_STATE = ZOOM_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ VIDEO_STATE = VIDEO_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ VIDEO_AF_STATE = VIDEO_ACTIVE | AF_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ VIDEO_ZOOM_STATE = VIDEO_ACTIVE | ZOOM_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ VIDEO_LOADED_CAPTURE_STATE = VIDEO_ACTIVE | LOADED_CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ VIDEO_CAPTURE_STATE = VIDEO_ACTIVE | CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ AF_ZOOM_STATE = AF_ACTIVE | ZOOM_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ BRACKETING_ZOOM_STATE = BRACKETING_ACTIVE | ZOOM_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ LOADED_REPROCESS_STATE = LOADED_REPROCESS_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ LOADED_REPROCESS_CAPTURE_STATE = LOADED_REPROCESS_ACTIVE | LOADED_CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
+ REPROCESS_STATE = REPROCESS_ACTIVE | CAPTURE_ACTIVE | PREVIEW_ACTIVE | INTIALIZED_ACTIVE,
};
+
public:
///Initialzes the camera adapter creates any resources required
@@ -805,19 +943,13 @@ public:
event_callback eventCb = NULL,
void *cookie = NULL) = 0;
virtual void disableMsgType(int32_t msgs, void* cookie) = 0;
- virtual void returnFrame(void* frameBuf, CameraFrame::FrameType frameType) = 0;
- virtual void addFramePointers(void *frameBuf, void *buf) = 0;
+ virtual void returnFrame(CameraBuffer* frameBuf, CameraFrame::FrameType frameType) = 0;
+ virtual void addFramePointers(CameraBuffer *frameBuf, void *buf) = 0;
virtual void removeFramePointers() = 0;
//APIs to configure Camera adapter and get the current parameter set
- virtual int setParameters(const CameraParameters& params) = 0;
- virtual void getParameters(CameraParameters& params) = 0;
-
- //API to flush the buffers from Camera
- status_t flushBuffers()
- {
- return sendCommand(CameraAdapter::CAMERA_PREVIEW_FLUSH_BUFFERS);
- }
+ virtual int setParameters(const android::CameraParameters& params) = 0;
+ virtual void getParameters(android::CameraParameters& params) = 0;
//Registers callback for returning image buffers back to CameraHAL
virtual int registerImageReleaseCallback(release_image_buffers_callback callback, void *user_data) = 0;
@@ -826,7 +958,7 @@ public:
virtual int registerEndCaptureCallback(end_image_capture_callback callback, void *user_data) = 0;
//API to send a command to the camera
- virtual status_t sendCommand(CameraCommands operation, int value1=0, int value2=0, int value3=0) = 0;
+ virtual status_t sendCommand(CameraCommands operation, int value1=0, int value2=0, int value3=0, int value4=0) = 0;
virtual ~CameraAdapter() {};
@@ -847,6 +979,8 @@ public:
// Retrieves the next Adapter state - for internal use (not locked)
virtual status_t getNextState(AdapterState &state) = 0;
+ virtual status_t setSharedAllocator(camera_request_memory shmem_alloc) = 0;
+
protected:
//The first two methods will try to switch the adapter state.
//Every call to setState() should be followed by a corresponding
@@ -857,16 +991,18 @@ protected:
virtual status_t rollbackState() = 0;
};
-class DisplayAdapter : public BufferProvider, public virtual RefBase
+class DisplayAdapter : public BufferProvider, public virtual android::RefBase
{
public:
- typedef struct S3DParameters_t
- {
- int mode;
- int framePacking;
- int order;
- int subSampling;
- } S3DParameters;
+ DisplayAdapter();
+
+#ifdef OMAP_ENHANCEMENT
+ preview_stream_extended_ops_t * extendedOps() const {
+ return mExtendedOps;
+ }
+
+ void setExtendedOps(preview_stream_extended_ops_t * extendedOps);
+#endif
///Initializes the display adapter creates any resources required
virtual int initialize() = 0;
@@ -874,7 +1010,7 @@ public:
virtual int setPreviewWindow(struct preview_stream_ops *window) = 0;
virtual int setFrameProvider(FrameNotifier *frameProvider) = 0;
virtual int setErrorHandler(ErrorNotifier *errorNotifier) = 0;
- virtual int enableDisplay(int width, int height, struct timeval *refTime = NULL, S3DParameters *s3dParams = NULL) = 0;
+ virtual int enableDisplay(int width, int height, struct timeval *refTime = NULL) = 0;
virtual int disableDisplay(bool cancel_buffer = true) = 0;
//Used for Snapshot review temp. pause
virtual int pauseDisplay(bool pause) = 0;
@@ -884,13 +1020,23 @@ public:
virtual int setSnapshotTimeRef(struct timeval *refTime = NULL) = 0;
#endif
- virtual int useBuffers(void *bufArr, int num) = 0;
virtual bool supportsExternalBuffering() = 0;
// Get max queueable buffers display supports
// This function should only be called after
- // allocateBuffer
- virtual int maxQueueableBuffers(unsigned int& queueable) = 0;
+ // allocateBufferList
+ virtual status_t maxQueueableBuffers(unsigned int& queueable) = 0;
+
+ // Get min buffers display needs at any given time
+ virtual status_t minUndequeueableBuffers(int& unqueueable) = 0;
+protected:
+ virtual const char* getPixFormatConstant(const char* parameters_format) const;
+ virtual size_t getBufSize(const char* parameters_format, int width, int height) const;
+
+private:
+#ifdef OMAP_ENHANCEMENT
+ preview_stream_extended_ops_t * mExtendedOps;
+#endif
};
static void releaseImageBuffers(void *userData);
@@ -912,6 +1058,7 @@ public:
///Constants
static const int NO_BUFFERS_PREVIEW;
static const int NO_BUFFERS_IMAGE_CAPTURE;
+ static const int NO_BUFFERS_IMAGE_CAPTURE_SYSTEM_HEAP;
static const uint32_t VFR_SCALE = 1000;
@@ -959,10 +1106,25 @@ public:
int startPreview();
/**
+ * Set preview mode related initialization.
+ * Only used when slice based processing is enabled.
+ */
+ int cameraPreviewInitialization();
+
+ /**
* Only used if overlays are used for camera preview.
*/
int setPreviewWindow(struct preview_stream_ops *window);
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ void setExtendedPreviewStreamOps(preview_stream_extended_ops_t *ops);
+
+ /**
+ * Set a tap-in or tap-out point.
+ */
+ int setBufferSource(struct preview_stream_ops *tapin, struct preview_stream_ops *tapout);
+#endif
+
/**
* Stop a previously started preview.
*/
@@ -1013,7 +1175,7 @@ public:
/**
* Take a picture.
*/
- int takePicture();
+ int takePicture(const char* params);
/**
* Cancel a picture that was started with takePicture. Calling this
@@ -1023,7 +1185,7 @@ public:
/** Set the camera parameters. */
int setParameters(const char* params);
- int setParameters(const CameraParameters& params);
+ int setParameters(const android::CameraParameters& params);
/** Return the camera parameters. */
char* getParameters();
@@ -1045,8 +1207,19 @@ public:
*/
int dump(int fd) const;
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ /**
+ * start a reprocessing operation.
+ */
+ int reprocess(const char* params);
+
+ /**
+ * cancels current reprocessing operation
+ */
+ int cancel_reprocess();
+#endif
- status_t storeMetaDataInBuffers(bool enable);
+ status_t storeMetaDataInBuffers(bool enable);
//@}
@@ -1097,7 +1270,7 @@ private:
//@{
/** Set the camera parameters specific to Video Recording. */
- bool setVideoModeParameters(const CameraParameters&);
+ bool setVideoModeParameters(const android::CameraParameters&);
/** Reset the camera parameters specific to Video Recording. */
bool resetVideoModeParameters();
@@ -1110,7 +1283,7 @@ private:
void insertSupportedParams();
/** Allocate preview data buffers */
- status_t allocPreviewDataBufs(uint32_t size, uint32_t bufferCount);
+ status_t allocPreviewDataBufs(size_t size, size_t bufferCount);
/** Free preview data buffers */
status_t freePreviewDataBufs();
@@ -1122,18 +1295,30 @@ private:
status_t allocVideoBufs(uint32_t width, uint32_t height, uint32_t bufferCount);
/** Allocate image capture buffers */
- status_t allocImageBufs(unsigned int width, unsigned int height, uint32_t length, const char* previewFormat, unsigned int bufferCount);
+ status_t allocImageBufs(unsigned int width, unsigned int height, size_t length,
+ const char* previewFormat, unsigned int bufferCount,
+ unsigned int *max_queueable);
+
+ /** Allocate Raw buffers */
+ status_t allocRawBufs(int width, int height, const char* previewFormat, int bufferCount);
/** Free preview buffers */
status_t freePreviewBufs();
/** Free video bufs */
- status_t freeVideoBufs(void *bufs);
+ status_t freeVideoBufs(CameraBuffer *bufs);
+
+ /** Free RAW bufs */
+ status_t freeRawBufs();
//Check if a given resolution is supported by the current camera
//instance
bool isResolutionValid(unsigned int width, unsigned int height, const char *supportedResolutions);
+ //Check if a given variable frame rate range is supported by the current camera
+ //instance
+ bool isFpsRangeValid(int fpsMin, int fpsMax, const char *supportedFpsRanges);
+
//Check if a given parameter is supported by the current camera
// instance
bool isParameterValid(const char *param, const char *supportedParams);
@@ -1153,11 +1338,11 @@ private:
void forceStopPreview();
- void selectFPSRange(int framerate, int *min_fps, int *max_fps);
-
- void setPreferredPreviewRes(int width, int height);
- void resetPreviewRes(CameraParameters *mParams, int width, int height);
+ void getPreferredPreviewRes(int *width, int *height);
+ void resetPreviewRes(android::CameraParameters *params);
+ // Internal __takePicture function - used in public takePicture() and reprocess()
+ int __takePicture(const char* params);
//@}
@@ -1178,21 +1363,33 @@ public:
static const char PARAMS_DELIMITER[];
CameraAdapter *mCameraAdapter;
- sp<AppCallbackNotifier> mAppCallbackNotifier;
- sp<DisplayAdapter> mDisplayAdapter;
- sp<MemoryManager> mMemoryManager;
+ android::sp<AppCallbackNotifier> mAppCallbackNotifier;
+ android::sp<DisplayAdapter> mDisplayAdapter;
+ android::sp<MemoryManager> mMemoryManager;
+ // TODO(XXX): May need to keep this as a vector in the future
+ // when we can have multiple tap-in/tap-out points
+ android::sp<DisplayAdapter> mBufferSourceAdapter_In;
+ android::sp<DisplayAdapter> mBufferSourceAdapter_Out;
+
+#ifdef OMAP_ENHANCEMENT
+ preview_stream_extended_ops_t * mExtendedPreviewStreamOps;
+#endif
- sp<IMemoryHeap> mPictureHeap;
+ android::sp<android::IMemoryHeap> mPictureHeap;
int* mGrallocHandles;
bool mFpsRangeChangedByApp;
-
+ int mRawWidth;
+ int mRawHeight;
+ bool mRawCapture;
///static member vars
+ static const int SW_SCALING_FPS_LIMIT;
+
#if PPM_INSTRUMENTATION || PPM_INSTRUMENTATION_ABS
//Timestamp from the CameraHal constructor
@@ -1211,34 +1408,40 @@ private:
bool mDynamicPreviewSwitch;
//keeps paused state of display
bool mDisplayPaused;
+
+#ifdef OMAP_ENHANCEMENT_VTC
+ bool mTunnelSetup;
+ bool mVTCUseCase;
+#endif
+
//Index of current camera adapter
int mCameraIndex;
- mutable Mutex mLock;
+ mutable android::Mutex mLock;
- sp<SensorListener> mSensorListener;
+ android::sp<SensorListener> mSensorListener;
void* mCameraAdapterHandle;
- CameraParameters mParameters;
+ android::CameraParameters mParameters;
bool mPreviewRunning;
bool mPreviewStateOld;
bool mRecordingEnabled;
EventProvider *mEventProvider;
- int32_t *mPreviewDataBufs;
+ CameraBuffer *mPreviewDataBuffers;
uint32_t *mPreviewDataOffsets;
int mPreviewDataFd;
int mPreviewDataLength;
- int32_t *mImageBufs;
+ CameraBuffer *mImageBuffers;
uint32_t *mImageOffsets;
int mImageFd;
int mImageLength;
- int32_t *mPreviewBufs;
+ CameraBuffer *mPreviewBuffers;
uint32_t *mPreviewOffsets;
int mPreviewLength;
int mPreviewFd;
- int32_t *mVideoBufs;
+ CameraBuffer *mVideoBuffers;
uint32_t *mVideoOffsets;
int mVideoFd;
int mVideoLength;
@@ -1254,6 +1457,7 @@ private:
CameraProperties::Properties* mCameraProperties;
bool mPreviewStartInProgress;
+ bool mPreviewInitializationDone;
bool mSetPreviewWindowCalled;
@@ -1264,9 +1468,10 @@ private:
int mVideoWidth;
int mVideoHeight;
+ android::String8 mCapModeBackup;
};
-
-}; // namespace android
+} // namespace Camera
+} // namespace Ti
#endif
diff --git a/camera/inc/CameraProperties.h b/camera/inc/CameraProperties.h
index 6f05877..bfc6012 100644
--- a/camera/inc/CameraProperties.h
+++ b/camera/inc/CameraProperties.h
@@ -30,15 +30,27 @@
#include <ctype.h>
#include "cutils/properties.h"
-namespace android {
+#include "Common.h"
-#define MAX_CAMERAS_SUPPORTED 2
+namespace Ti {
+namespace Camera {
+
+#define MAX_CAMERAS_SUPPORTED 3
#define MAX_SIMUL_CAMERAS_SUPPORTED 1
#define MAX_PROP_NAME_LENGTH 50
#define MAX_PROP_VALUE_LENGTH 2048
-#define EXIF_MAKE_DEFAULT "default_make"
-#define EXIF_MODEL_DEFAULT "default_model"
+#define REMAINING_BYTES(buff) ((((int)sizeof(buff) - 1 - (int)strlen(buff)) < 0) ? 0 : (sizeof(buff) - 1 - strlen(buff)))
+
+enum OperatingMode {
+ MODE_HIGH_SPEED = 0,
+ MODE_HIGH_QUALITY,
+ MODE_ZEROSHUTTERLAG,
+ MODE_VIDEO,
+ MODE_STEREO,
+ MODE_CPCAM,
+ MODE_MAX
+};
// Class that handles the Camera Properties
class CameraProperties
@@ -47,19 +59,32 @@ public:
static const char INVALID[];
static const char CAMERA_NAME[];
static const char CAMERA_SENSOR_INDEX[];
+ static const char CAMERA_SENSOR_ID[];
static const char ORIENTATION_INDEX[];
static const char FACING_INDEX[];
- static const char S3D_SUPPORTED[];
static const char SUPPORTED_PREVIEW_SIZES[];
+ static const char SUPPORTED_PREVIEW_SUBSAMPLED_SIZES[];
+ static const char SUPPORTED_PREVIEW_TOPBOTTOM_SIZES[];
+ static const char SUPPORTED_PREVIEW_SIDEBYSIDE_SIZES[];
static const char SUPPORTED_PREVIEW_FORMATS[];
static const char SUPPORTED_PREVIEW_FRAME_RATES[];
+ static const char SUPPORTED_PREVIEW_FRAME_RATES_EXT[];
static const char SUPPORTED_PICTURE_SIZES[];
+ static const char SUPPORTED_PICTURE_SUBSAMPLED_SIZES[];
+ static const char SUPPORTED_PICTURE_TOPBOTTOM_SIZES[];
+ static const char SUPPORTED_PICTURE_SIDEBYSIDE_SIZES[];
static const char SUPPORTED_PICTURE_FORMATS[];
static const char SUPPORTED_THUMBNAIL_SIZES[];
static const char SUPPORTED_WHITE_BALANCE[];
static const char SUPPORTED_EFFECTS[];
static const char SUPPORTED_ANTIBANDING[];
static const char SUPPORTED_EXPOSURE_MODES[];
+ static const char SUPPORTED_MANUAL_EXPOSURE_MIN[];
+ static const char SUPPORTED_MANUAL_EXPOSURE_MAX[];
+ static const char SUPPORTED_MANUAL_EXPOSURE_STEP[];
+ static const char SUPPORTED_MANUAL_GAIN_ISO_MIN[];
+ static const char SUPPORTED_MANUAL_GAIN_ISO_MAX[];
+ static const char SUPPORTED_MANUAL_GAIN_ISO_STEP[];
static const char SUPPORTED_EV_MIN[];
static const char SUPPORTED_EV_MAX[];
static const char SUPPORTED_EV_STEP[];
@@ -97,9 +122,15 @@ public:
static const char CONTRAST[];
static const char IPP[];
static const char GBCE[];
- static const char AUTOCONVERGENCE[];
+ static const char SUPPORTED_GBCE[];
+ static const char GLBCE[];
+ static const char SUPPORTED_GLBCE[];
static const char AUTOCONVERGENCE_MODE[];
- static const char MANUALCONVERGENCE_VALUES[];
+ static const char AUTOCONVERGENCE_MODE_VALUES[];
+ static const char MANUAL_CONVERGENCE[];
+ static const char SUPPORTED_MANUAL_CONVERGENCE_MIN[];
+ static const char SUPPORTED_MANUAL_CONVERGENCE_MAX[];
+ static const char SUPPORTED_MANUAL_CONVERGENCE_STEP[];
static const char SENSOR_ORIENTATION[];
static const char SENSOR_ORIENTATION_VALUES[];
static const char REVISION[];
@@ -113,16 +144,22 @@ public:
static const char MAX_FD_HW_FACES[];
static const char MAX_FD_SW_FACES[];
+ static const char MAX_PICTURE_WIDTH[];
+ static const char MAX_PICTURE_HEIGHT[];
+
static const char PARAMS_DELIMITER [];
- static const char S3D2D_PREVIEW[];
- static const char S3D2D_PREVIEW_MODES[];
+ static const char S3D_PRV_FRAME_LAYOUT[];
+ static const char S3D_PRV_FRAME_LAYOUT_VALUES[];
+ static const char S3D_CAP_FRAME_LAYOUT[];
+ static const char S3D_CAP_FRAME_LAYOUT_VALUES[];
static const char VSTAB[];
static const char VSTAB_SUPPORTED[];
+ static const char VNF[];
+ static const char VNF_SUPPORTED[];
static const char FRAMERATE_RANGE[];
- static const char FRAMERATE_RANGE_IMAGE[];
- static const char FRAMERATE_RANGE_VIDEO[];
static const char FRAMERATE_RANGE_SUPPORTED[];
+ static const char FRAMERATE_RANGE_EXT_SUPPORTED[];
static const char DEFAULT_VALUE[];
@@ -138,7 +175,14 @@ public:
static const char VIDEO_SIZE[];
static const char SUPPORTED_VIDEO_SIZES[];
- static const char PREFERRED_PREVIEW_SIZE_FOR_VIDEO[];
+
+ static const char MECHANICAL_MISALIGNMENT_CORRECTION_SUPPORTED[];
+ static const char MECHANICAL_MISALIGNMENT_CORRECTION[];
+
+ static const char RAW_WIDTH[];
+ static const char RAW_HEIGHT[];
+
+ static const char CAP_MODE_VALUES[];
CameraProperties();
~CameraProperties();
@@ -147,32 +191,31 @@ public:
class Properties
{
public:
+
Properties()
{
- mProperties = new DefaultKeyedVector<String8, String8>(String8(DEFAULT_VALUE));
- char property[PROPERTY_VALUE_MAX];
- property_get("ro.product.manufacturer", property, EXIF_MAKE_DEFAULT);
- property[0] = toupper(property[0]);
- set(EXIF_MAKE, property);
- property_get("ro.product.model", property, EXIF_MODEL_DEFAULT);
- property[0] = toupper(property[0]);
- set(EXIF_MODEL, property);
}
+
~Properties()
{
- delete mProperties;
}
- ssize_t set(const char *prop, const char *value);
- ssize_t set(const char *prop, int value);
- const char* get(const char * prop);
+
+ void set(const char *prop, const char *value);
+ void set(const char *prop, int value);
+ const char* get(const char * prop) const;
+ int getInt(const char * prop) const;
+ void setSensorIndex(int idx);
+ void setMode(OperatingMode mode);
+ OperatingMode getMode() const;
void dump();
protected:
- const char* keyAt(unsigned int);
- const char* valueAt(unsigned int);
+ const char* keyAt(const unsigned int) const;
+ const char* valueAt(const unsigned int) const;
private:
- DefaultKeyedVector<String8, String8>* mProperties;
+ OperatingMode mCurrentMode;
+ android::DefaultKeyedVector<android::String8, android::String8> mProperties[MODE_MAX];
};
@@ -184,15 +227,15 @@ public:
private:
- uint32_t mCamerasSupported;
+ int mCamerasSupported;
int mInitialized;
- mutable Mutex mLock;
+ mutable android::Mutex mLock;
Properties mCameraProps[MAX_CAMERAS_SUPPORTED];
};
-};
+} // namespace Camera
+} // namespace Ti
#endif //CAMERA_PROPERTIES_H
-
diff --git a/camera/inc/Common.h b/camera/inc/Common.h
new file mode 100644
index 0000000..b369e65
--- /dev/null
+++ b/camera/inc/Common.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) Texas Instruments - http://www.ti.com/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef CAMERAHAL_COMMON_H
+#define CAMERAHAL_COMMON_H
+
+#include "UtilsCommon.h"
+#include "DebugUtils.h"
+#include "Status.h"
+
+
+
+
+// logging functions
+#ifdef CAMERAHAL_DEBUG
+# define CAMHAL_LOGD DBGUTILS_LOGD
+# define CAMHAL_LOGDA DBGUTILS_LOGDA
+# define CAMHAL_LOGDB DBGUTILS_LOGDB
+# ifdef CAMERAHAL_DEBUG_VERBOSE
+# define CAMHAL_LOGV DBGUTILS_LOGV
+# define CAMHAL_LOGVA DBGUTILS_LOGVA
+# define CAMHAL_LOGVB DBGUTILS_LOGVB
+# else
+# define CAMHAL_LOGV(...)
+# define CAMHAL_LOGVA(str)
+# define CAMHAL_LOGVB(str, ...)
+# endif
+#else
+# define CAMHAL_LOGD(...)
+# define CAMHAL_LOGDA(str)
+# define CAMHAL_LOGDB(str, ...)
+# define CAMHAL_LOGV(...)
+# define CAMHAL_LOGVA(str)
+# define CAMHAL_LOGVB(str, ...)
+#endif
+
+#define CAMHAL_LOGI DBGUTILS_LOGI
+#define CAMHAL_LOGW DBGUTILS_LOGW
+#define CAMHAL_LOGE DBGUTILS_LOGE
+#define CAMHAL_LOGEA DBGUTILS_LOGEA
+#define CAMHAL_LOGEB DBGUTILS_LOGEB
+#define CAMHAL_LOGF DBGUTILS_LOGF
+
+#define CAMHAL_ASSERT DBGUTILS_ASSERT
+#define CAMHAL_ASSERT_X DBGUTILS_ASSERT_X
+
+#define CAMHAL_UNUSED(x) (void)x
+
+
+
+
+#endif // CAMERAHAL_COMMON_H
diff --git a/camera/inc/Encoder_libjpeg.h b/camera/inc/Encoder_libjpeg.h
index fb9a894..72feb08 100644
--- a/camera/inc/Encoder_libjpeg.h
+++ b/camera/inc/Encoder_libjpeg.h
@@ -29,11 +29,19 @@
extern "C" {
#include "jhead.h"
+
+#undef TRUE
+#undef FALSE
+
}
-#define CANCEL_TIMEOUT 3000000 // 3 seconds
+#include "CameraHal.h"
+
+#define CANCEL_TIMEOUT 5000000 // 5 seconds
+
+namespace Ti {
+namespace Camera {
-namespace android {
/**
* libjpeg encoder class - uses libjpeg to encode yuv
*/
@@ -45,6 +53,7 @@ typedef void (*encoder_libjpeg_callback_t) (void* main_jpeg,
void* cookie1,
void* cookie2,
void* cookie3,
+ void* cookie4,
bool canceled);
// these have to match strings defined in external/jhead/exif.c
@@ -86,7 +95,12 @@ class ExifElementsTable {
public:
ExifElementsTable() :
gps_tag_count(0), exif_tag_count(0), position(0),
- jpeg_opened(false), has_datetime_tag(false) { }
+ jpeg_opened(false)
+ {
+#ifdef ANDROID_API_JB_OR_LATER
+ has_datetime_tag = false;
+#endif
+ }
~ExifElementsTable();
status_t insertElement(const char* tag, const char* value);
@@ -102,10 +116,12 @@ class ExifElementsTable {
unsigned int exif_tag_count;
unsigned int position;
bool jpeg_opened;
+#ifdef ANDROID_API_JB_OR_LATER
bool has_datetime_tag;
+#endif
};
-class Encoder_libjpeg : public Thread {
+class Encoder_libjpeg : public android::Thread {
/* public member types and variables */
public:
struct params {
@@ -131,9 +147,9 @@ class Encoder_libjpeg : public Thread {
CameraFrame::FrameType type,
void* cookie1,
void* cookie2,
- void* cookie3)
- : Thread(false), mMainInput(main_jpeg), mThumbnailInput(tn_jpeg), mCb(cb),
- mCancelEncoding(false), mCookie1(cookie1), mCookie2(cookie2), mCookie3(cookie3),
+ void* cookie3, void *cookie4)
+ : android::Thread(false), mMainInput(main_jpeg), mThumbnailInput(tn_jpeg), mCb(cb),
+ mCancelEncoding(false), mCookie1(cookie1), mCookie2(cookie2), mCookie3(cookie3), mCookie4(cookie4),
mType(type), mThumb(NULL) {
this->incStrong(this);
mCancelSem.Create(0);
@@ -145,10 +161,9 @@ class Encoder_libjpeg : public Thread {
virtual bool threadLoop() {
size_t size = 0;
- sp<Encoder_libjpeg> tn = NULL;
if (mThumbnailInput) {
// start thread to encode thumbnail
- mThumb = new Encoder_libjpeg(mThumbnailInput, NULL, NULL, mType, NULL, NULL, NULL);
+ mThumb = new Encoder_libjpeg(mThumbnailInput, NULL, NULL, mType, NULL, NULL, NULL, NULL);
mThumb->run();
}
@@ -167,7 +182,7 @@ class Encoder_libjpeg : public Thread {
}
if(mCb) {
- mCb(mMainInput, mThumbnailInput, mType, mCookie1, mCookie2, mCookie3, mCancelEncoding);
+ mCb(mMainInput, mThumbnailInput, mType, mCookie1, mCookie2, mCookie3, mCookie4, mCancelEncoding);
}
// encoder thread runs, self-destructs, and then exits
@@ -197,13 +212,15 @@ class Encoder_libjpeg : public Thread {
void* mCookie1;
void* mCookie2;
void* mCookie3;
+ void* mCookie4;
CameraFrame::FrameType mType;
- sp<Encoder_libjpeg> mThumb;
- Semaphore mCancelSem;
+ android::sp<Encoder_libjpeg> mThumb;
+ Utils::Semaphore mCancelSem;
size_t encode(params*);
};
-}
+} // namespace Camera
+} // namespace Ti
#endif
diff --git a/camera/inc/General3A_Settings.h b/camera/inc/General3A_Settings.h
index dab1f8e..777b255 100644
--- a/camera/inc/General3A_Settings.h
+++ b/camera/inc/General3A_Settings.h
@@ -29,12 +29,8 @@
#ifndef GENERAL_3A_SETTINGS_H
#define GENERAL_3A_SETTINGS_H
-#define FOCUS_FACE_PRIORITY OMX_IMAGE_FocusControlMax -1
-#define FOCUS_REGION_PRIORITY OMX_IMAGE_FocusControlMax -2
-#define WB_FACE_PRIORITY OMX_WhiteBalControlMax -1
-#define EXPOSURE_FACE_PRIORITY OMX_ExposureControlMax - 1
-
-namespace android {
+namespace Ti {
+namespace Camera {
struct userToOMX_LUT{
const char * userDefinition;
@@ -58,15 +54,15 @@ const userToOMX_LUT isoUserToOMX[] = {
};
const userToOMX_LUT effects_UserToOMX [] = {
- { CameraParameters::EFFECT_NONE, OMX_ImageFilterNone },
- { CameraParameters::EFFECT_NEGATIVE, OMX_ImageFilterNegative },
- { CameraParameters::EFFECT_SOLARIZE, OMX_ImageFilterSolarize },
- { CameraParameters::EFFECT_SEPIA, OMX_ImageFilterSepia },
- { CameraParameters::EFFECT_MONO, OMX_ImageFilterGrayScale },
- { CameraParameters::EFFECT_BLACKBOARD, OMX_TI_ImageFilterBlackBoard },
- { CameraParameters::EFFECT_WHITEBOARD, OMX_TI_ImageFilterWhiteBoard },
- { CameraParameters::EFFECT_AQUA, OMX_TI_ImageFilterAqua },
- { CameraParameters::EFFECT_POSTERIZE, OMX_TI_ImageFilterPosterize },
+ { android::CameraParameters::EFFECT_NONE, OMX_ImageFilterNone },
+ { android::CameraParameters::EFFECT_NEGATIVE, OMX_ImageFilterNegative },
+ { android::CameraParameters::EFFECT_SOLARIZE, OMX_ImageFilterSolarize },
+ { android::CameraParameters::EFFECT_SEPIA, OMX_ImageFilterSepia },
+ { android::CameraParameters::EFFECT_MONO, OMX_ImageFilterGrayScale },
+ { android::CameraParameters::EFFECT_BLACKBOARD, OMX_TI_ImageFilterBlackBoard },
+ { android::CameraParameters::EFFECT_WHITEBOARD, OMX_TI_ImageFilterWhiteBoard },
+ { android::CameraParameters::EFFECT_AQUA, OMX_TI_ImageFilterAqua },
+ { android::CameraParameters::EFFECT_POSTERIZE, OMX_TI_ImageFilterPosterize },
#ifdef OMAP_ENHANCEMENT
{ TICameraParameters::EFFECT_NATURAL, OMX_ImageFilterNatural },
{ TICameraParameters::EFFECT_VIVID, OMX_ImageFilterVivid },
@@ -76,27 +72,24 @@ const userToOMX_LUT effects_UserToOMX [] = {
};
const userToOMX_LUT scene_UserToOMX [] = {
- { CameraParameters::SCENE_MODE_AUTO, OMX_Manual },
- { CameraParameters::SCENE_MODE_ACTION, OMX_TI_Action },
- { CameraParameters::SCENE_MODE_NIGHT, OMX_TI_Night },
- { CameraParameters::SCENE_MODE_PARTY, OMX_TI_Party },
- { CameraParameters::SCENE_MODE_SUNSET, OMX_TI_Sunset },
-/*********** TODO: These scene modes are not verified. ************
- ***************** Have to verify and reeable later. **************
- { CameraParameters::SCENE_MODE_THEATRE, OMX_TI_Theatre },
- { CameraParameters::SCENE_MODE_LANDSCAPE, OMX_Landscape },
- { CameraParameters::SCENE_MODE_NIGHT_PORTRAIT, OMX_NightPortrait },
- { CameraParameters::SCENE_MODE_FIREWORKS, OMX_Fireworks },
- { CameraParameters::SCENE_MODE_BEACH, OMX_TI_Beach },
- { CameraParameters::SCENE_MODE_CANDLELIGHT, OMX_TI_Candlelight },
- { CameraParameters::SCENE_MODE_PORTRAIT, OMX_TI_Portrait },
- { CameraParameters::SCENE_MODE_SNOW, OMX_TI_Snow },
- { CameraParameters::SCENE_MODE_STEADYPHOTO, OMX_TI_Steadyphoto },
-*********************************************************************/
+ { android::CameraParameters::SCENE_MODE_AUTO, OMX_Manual },
+ { android::CameraParameters::SCENE_MODE_LANDSCAPE, OMX_Landscape },
+ { android::CameraParameters::SCENE_MODE_NIGHT_PORTRAIT, OMX_NightPortrait },
+ { android::CameraParameters::SCENE_MODE_FIREWORKS, OMX_Fireworks },
+ { android::CameraParameters::SCENE_MODE_ACTION, OMX_TI_Action },
+ { android::CameraParameters::SCENE_MODE_BEACH, OMX_TI_Beach },
+ { android::CameraParameters::SCENE_MODE_CANDLELIGHT, OMX_TI_Candlelight },
+ { android::CameraParameters::SCENE_MODE_NIGHT, OMX_TI_Night },
+ { android::CameraParameters::SCENE_MODE_PARTY, OMX_TI_Party },
+ { android::CameraParameters::SCENE_MODE_PORTRAIT, OMX_TI_Portrait },
+ { android::CameraParameters::SCENE_MODE_SNOW, OMX_TI_Snow },
+ { android::CameraParameters::SCENE_MODE_STEADYPHOTO, OMX_TI_Steadyphoto },
+ { android::CameraParameters::SCENE_MODE_SUNSET, OMX_TI_Sunset },
+ { android::CameraParameters::SCENE_MODE_THEATRE, OMX_TI_Theatre },
+ { android::CameraParameters::SCENE_MODE_SPORTS, OMX_Sport },
#ifdef OMAP_ENHANCEMENT
{ TICameraParameters::SCENE_MODE_CLOSEUP, OMX_Closeup },
{ TICameraParameters::SCENE_MODE_AQUA, OMX_Underwater },
- { TICameraParameters::SCENE_MODE_SPORT, OMX_Sport },
{ TICameraParameters::SCENE_MODE_MOOD, OMX_Mood },
{ TICameraParameters::SCENE_MODE_NIGHT_INDOOR, OMX_NightIndoor },
{ TICameraParameters::SCENE_MODE_DOCUMENT, OMX_Document },
@@ -108,47 +101,45 @@ const userToOMX_LUT scene_UserToOMX [] = {
};
const userToOMX_LUT whiteBal_UserToOMX [] = {
- { CameraParameters::WHITE_BALANCE_AUTO, OMX_WhiteBalControlAuto },
- { CameraParameters::WHITE_BALANCE_DAYLIGHT, OMX_WhiteBalControlSunLight },
- { CameraParameters::WHITE_BALANCE_CLOUDY_DAYLIGHT, OMX_WhiteBalControlCloudy },
- { CameraParameters::WHITE_BALANCE_FLUORESCENT, OMX_WhiteBalControlFluorescent },
- { CameraParameters::WHITE_BALANCE_INCANDESCENT, OMX_WhiteBalControlIncandescent },
-/********************** THESE ARE CURRENT NOT TUNED PROPERLY *************************
- { CameraParameters::WHITE_BALANCE_SHADE, OMX_TI_WhiteBalControlShade },
- { CameraParameters::WHITE_BALANCE_TWILIGHT, OMX_TI_WhiteBalControlTwilight },
- { CameraParameters::WHITE_BALANCE_WARM_FLUORESCENT, OMX_TI_WhiteBalControlWarmFluorescent },
-**************************************************************************************/
+ { android::CameraParameters::WHITE_BALANCE_AUTO, OMX_WhiteBalControlAuto },
+ { android::CameraParameters::WHITE_BALANCE_DAYLIGHT, OMX_WhiteBalControlSunLight },
+ { android::CameraParameters::WHITE_BALANCE_CLOUDY_DAYLIGHT, OMX_WhiteBalControlCloudy },
+ { android::CameraParameters::WHITE_BALANCE_FLUORESCENT, OMX_WhiteBalControlFluorescent },
+ { android::CameraParameters::WHITE_BALANCE_INCANDESCENT, OMX_WhiteBalControlIncandescent },
+ { android::CameraParameters::WHITE_BALANCE_SHADE, OMX_TI_WhiteBalControlShade },
+ { android::CameraParameters::WHITE_BALANCE_TWILIGHT, OMX_TI_WhiteBalControlTwilight },
+ { android::CameraParameters::WHITE_BALANCE_WARM_FLUORESCENT, OMX_TI_WhiteBalControlWarmFluorescent },
#ifdef OMAP_ENHANCEMENT
{ TICameraParameters::WHITE_BALANCE_TUNGSTEN, OMX_WhiteBalControlTungsten },
{ TICameraParameters::WHITE_BALANCE_HORIZON, OMX_WhiteBalControlHorizon },
- { TICameraParameters::WHITE_BALANCE_FACE, WB_FACE_PRIORITY },
{ TICameraParameters::WHITE_BALANCE_SUNSET, OMX_TI_WhiteBalControlSunset }
#endif
};
const userToOMX_LUT antibanding_UserToOMX [] = {
- { CameraParameters::ANTIBANDING_OFF, OMX_FlickerCancelOff },
- { CameraParameters::ANTIBANDING_AUTO, OMX_FlickerCancelAuto },
- { CameraParameters::ANTIBANDING_50HZ, OMX_FlickerCancel50 },
- { CameraParameters::ANTIBANDING_60HZ, OMX_FlickerCancel60 }
+ { android::CameraParameters::ANTIBANDING_OFF, OMX_FlickerCancelOff },
+ { android::CameraParameters::ANTIBANDING_AUTO, OMX_FlickerCancelAuto },
+ { android::CameraParameters::ANTIBANDING_50HZ, OMX_FlickerCancel50 },
+ { android::CameraParameters::ANTIBANDING_60HZ, OMX_FlickerCancel60 }
};
const userToOMX_LUT focus_UserToOMX [] = {
- { CameraParameters::FOCUS_MODE_AUTO, OMX_IMAGE_FocusControlAutoLock },
- { CameraParameters::FOCUS_MODE_INFINITY, OMX_IMAGE_FocusControlAutoInfinity },
- { CameraParameters::FOCUS_MODE_INFINITY, OMX_IMAGE_FocusControlHyperfocal },
- { CameraParameters::FOCUS_MODE_MACRO, OMX_IMAGE_FocusControlAutoMacro },
- { CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO, OMX_IMAGE_FocusControlAuto },
- { CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE, OMX_IMAGE_FocusControlAuto },
+ { android::CameraParameters::FOCUS_MODE_AUTO, OMX_IMAGE_FocusControlAutoLock },
+ { android::CameraParameters::FOCUS_MODE_INFINITY, OMX_IMAGE_FocusControlAutoInfinity },
+ { android::CameraParameters::FOCUS_MODE_INFINITY, OMX_IMAGE_FocusControlHyperfocal },
+ { android::CameraParameters::FOCUS_MODE_MACRO, OMX_IMAGE_FocusControlAutoMacro },
+ { android::CameraParameters::FOCUS_MODE_CONTINUOUS_VIDEO, OMX_IMAGE_FocusControlAuto },
+ { android::CameraParameters::FOCUS_MODE_CONTINUOUS_PICTURE, OMX_IMAGE_FocusControlAuto },
#ifdef OMAP_ENHANCEMENT
- { TICameraParameters::FOCUS_MODE_FACE , FOCUS_FACE_PRIORITY },
+ { TICameraParameters::FOCUS_MODE_FACE , OMX_IMAGE_FocusControlContinousFacePriority },
{ TICameraParameters::FOCUS_MODE_PORTRAIT, OMX_IMAGE_FocusControlPortrait },
{ TICameraParameters::FOCUS_MODE_EXTENDED, OMX_IMAGE_FocusControlExtended },
#endif
+ { TICameraParameters::FOCUS_MODE_OFF , OMX_IMAGE_FocusControlOff }
};
const userToOMX_LUT exposure_UserToOMX [] = {
- { TICameraParameters::EXPOSURE_MODE_OFF, OMX_ExposureControlOff },
+ { TICameraParameters::EXPOSURE_MODE_MANUAL, OMX_ExposureControlOff },
{ TICameraParameters::EXPOSURE_MODE_AUTO, OMX_ExposureControlAuto },
{ TICameraParameters::EXPOSURE_MODE_NIGHT, OMX_ExposureControlNight },
{ TICameraParameters::EXPOSURE_MODE_BACKLIGHT, OMX_ExposureControlBackLight },
@@ -158,15 +149,14 @@ const userToOMX_LUT exposure_UserToOMX [] = {
{ TICameraParameters::EXPOSURE_MODE_BEACH, OMX_ExposureControlBeach },
{ TICameraParameters::EXPOSURE_MODE_APERTURE, OMX_ExposureControlLargeAperture },
{ TICameraParameters::EXPOSURE_MODE_SMALL_APERTURE, OMX_ExposureControlSmallApperture },
- { TICameraParameters::EXPOSURE_MODE_FACE, EXPOSURE_FACE_PRIORITY },
};
const userToOMX_LUT flash_UserToOMX [] = {
- { CameraParameters::FLASH_MODE_OFF ,OMX_IMAGE_FlashControlOff },
- { CameraParameters::FLASH_MODE_ON ,OMX_IMAGE_FlashControlOn },
- { CameraParameters::FLASH_MODE_AUTO ,OMX_IMAGE_FlashControlAuto },
- { CameraParameters::FLASH_MODE_TORCH ,OMX_IMAGE_FlashControlTorch },
- { CameraParameters::FLASH_MODE_RED_EYE ,OMX_IMAGE_FlashControlRedEyeReduction },
+ { android::CameraParameters::FLASH_MODE_OFF ,OMX_IMAGE_FlashControlOff },
+ { android::CameraParameters::FLASH_MODE_ON ,OMX_IMAGE_FlashControlOn },
+ { android::CameraParameters::FLASH_MODE_AUTO ,OMX_IMAGE_FlashControlAuto },
+ { android::CameraParameters::FLASH_MODE_TORCH ,OMX_IMAGE_FlashControlTorch },
+ { android::CameraParameters::FLASH_MODE_RED_EYE ,OMX_IMAGE_FlashControlRedEyeReduction },
#ifdef OMAP_ENHANCEMENT
{ TICameraParameters::FLASH_MODE_FILL_IN ,OMX_IMAGE_FlashControlFillin }
#endif
@@ -241,11 +231,23 @@ class Gen3A_settings{
int Sharpness;
int ISO;
int FlashMode;
+ int ManualExposure;
+ int ManualExposureRight;
+ int ManualGain;
+ int ManualGainRight;
unsigned int Brightness;
OMX_BOOL ExposureLock;
OMX_BOOL FocusLock;
OMX_BOOL WhiteBalanceLock;
+
+ OMX_BOOL AlgoFixedGamma;
+ OMX_BOOL AlgoNSF1;
+ OMX_BOOL AlgoNSF2;
+ OMX_BOOL AlgoSharpening;
+ OMX_BOOL AlgoThreeLinColorMap;
+ OMX_BOOL AlgoGIC;
+
};
/*
@@ -270,11 +272,21 @@ enum E3ASettingsFlags
SetExpLock = 1 << 16,
SetWBLock = 1 << 17,
SetMeteringAreas = 1 << 18,
+ SetManualExposure = 1 << 19,
+
+ SetAlgoFixedGamma = 1 << 20,
+ SetAlgoNSF1 = 1 << 21,
+ SetAlgoNSF2 = 1 << 22,
+ SetAlgoSharpening = 1 << 23,
+ SetAlgoThreeLinColorMap = 1 << 24,
+ SetAlgoGIC = 1 << 25,
+
E3aSettingMax,
E3AsettingsAll = ( ((E3aSettingMax -1 ) << 1) -1 ) /// all possible flags raised
};
-};
+} // namespace Camera
+} // namespace Ti
#endif //GENERAL_3A_SETTINGS_H
diff --git a/camera/inc/NV12_resize.h b/camera/inc/NV12_resize.h
index 927faf8..4b05a4f 100644
--- a/camera/inc/NV12_resize.h
+++ b/camera/inc/NV12_resize.h
@@ -1,66 +1,61 @@
+/*
+ * Copyright (C) Texas Instruments - http://www.ti.com/
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#ifndef NV12_RESIZE_H_
#define NV12_RESIZE_H_
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef unsigned char mmBool;
-typedef unsigned char mmUchar;
-typedef unsigned char mmUint8;
-typedef unsigned char mmByte;
-typedef unsigned short mmUint16;
-typedef unsigned int mmUint32;
-typedef unsigned long mmUint64;
-typedef signed char mmInt8;
-typedef char mmChar;
-typedef signed short mmInt16;
-typedef signed int mmInt32;
-typedef signed long mmLong;
-typedef signed int mmHandle;
-typedef float mmFloat;
-typedef double mmDouble;
-typedef int HObj;
-typedef HObj HFile;
-typedef int HDir;
-typedef void* mmMutexHandle;
-typedef struct _fstat
-{
- mmInt32 fileSize;
-}VE_FileAttribute;
-
-typedef struct
-{
- mmInt32 second;
- mmInt32 millisecond;
-}tsVE_Time;
-
-typedef struct
-{
- mmInt32 year;
- mmInt32 month;
- mmInt32 day;
- mmInt32 hour;
- mmInt32 minute;
- mmInt32 second;
+#include "Common.h"
+
+typedef unsigned char mmBool;
+typedef unsigned char mmUchar;
+typedef unsigned char mmUint8;
+typedef unsigned char mmByte;
+typedef unsigned short mmUint16;
+typedef unsigned int mmUint32;
+typedef unsigned long mmUint64;
+typedef signed char mmInt8;
+typedef char mmChar;
+typedef signed short mmInt16;
+typedef signed int mmInt32;
+typedef signed long mmLong;
+typedef signed int mmHandle;
+typedef float mmFloat;
+typedef double mmDouble;
+typedef int HObj;
+typedef HObj HFile;
+typedef int HDir;
+typedef void* mmMutexHandle;
+typedef struct _fstat {
+ mmInt32 fileSize;
+} VE_FileAttribute;
+
+typedef struct {
+ mmInt32 second;
+ mmInt32 millisecond;
+} tsVE_Time;
+
+typedef struct {
+ mmInt32 year;
+ mmInt32 month;
+ mmInt32 day;
+ mmInt32 hour;
+ mmInt32 minute;
+ mmInt32 second;
} TmDateTime;
-/*----------------------------------------------------------------------------
- Define : TRUE/FALSE for boolean operations
-----------------------------------------------------------------------------*/
-
-#ifndef TRUE
- #define TRUE 1
-#endif
-
-#ifndef FALSE
- #define FALSE 0
-#endif
-
-#ifndef NULL
- #define NULL 0
-#endif
-
const mmUint8 bWeights[8][8][4] = {
{{64, 0, 0, 0}, {56, 0, 0, 8}, {48, 0, 0,16}, {40, 0, 0,24},
{32, 0, 0,32}, {24, 0, 0,40}, {16, 0, 0,48}, { 8, 0, 0,56}},
@@ -87,8 +82,7 @@ const mmUint8 bWeights[8][8][4] = {
{ 4,28,28,4 }, { 3,21,35, 5}, { 2,14,42, 6}, { 1,7 ,49, 7}}
};
-typedef enum
-{
+typedef enum {
IC_FORMAT_NONE,
IC_FORMAT_RGB565,
IC_FORMAT_RGB888,
@@ -96,26 +90,24 @@ typedef enum
IC_FORMAT_YCbCr,
IC_FORMAT_YCbCr420_FRAME_PK,
IC_FORMAT_MAX
-}enumImageFormat;
+} enumImageFormat;
/* This structure defines the format of an image */
-typedef struct
-{
- mmInt32 uWidth;
- mmInt32 uHeight;
- mmInt32 uStride;
- enumImageFormat eFormat;
- mmByte *imgPtr;
- mmByte *clrPtr;
- mmInt32 uOffset;
+typedef struct {
+ mmInt32 uWidth;
+ mmInt32 uHeight;
+ mmInt32 uStride;
+ enumImageFormat eFormat;
+ mmByte *imgPtr;
+ mmByte *clrPtr;
+ mmInt32 uOffset;
} structConvImage;
-typedef struct IC_crop_struct
-{
- mmUint32 x; /* x pos of rectangle */
- mmUint32 y; /* y pos of rectangle */
- mmUint32 uWidth; /* dx of rectangle */
- mmUint32 uHeight; /* dy of rectangle */
+typedef struct IC_crop_struct {
+ mmUint32 x; /* x pos of rectangle */
+ mmUint32 y; /* y pos of rectangle */
+ mmUint32 uWidth; /* dx of rectangle */
+ mmUint32 uHeight; /* dy of rectangle */
} IC_rect_type;
/*==========================================================================
@@ -133,16 +125,11 @@ typedef struct IC_crop_struct
* faster version.
============================================================================*/
mmBool
-VT_resizeFrame_Video_opt2_lp
-(
- structConvImage* i_img_ptr, /* Points to the input image */
- structConvImage* o_img_ptr, /* Points to the output image */
- IC_rect_type* cropout, /* how much to resize to in final image */
- mmUint16 dummy /* Transparent pixel value */
- );
-
-#ifdef __cplusplus
-}
-#endif
+VT_resizeFrame_Video_opt2_lp(
+ structConvImage* i_img_ptr, /* Points to the input image */
+ structConvImage* o_img_ptr, /* Points to the output image */
+ IC_rect_type* cropout, /* how much to resize to in final image */
+ mmUint16 dummy /* Transparent pixel value */
+ );
#endif //#define NV12_RESIZE_H_
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
index 5c88cf7..3d9d788 100644
--- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
+++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
@@ -48,7 +48,8 @@ extern "C"
}
-namespace android {
+namespace Ti {
+namespace Camera {
#define Q16_OFFSET 16
@@ -60,6 +61,7 @@ namespace android {
#define MIN_JPEG_QUALITY 1
#define MAX_JPEG_QUALITY 100
#define EXP_BRACKET_RANGE 10
+#define ZOOM_BRACKET_RANGE 10
#define FOCUS_DIST_SIZE 100
#define FOCUS_DIST_BUFFER_SIZE 500
@@ -68,6 +70,8 @@ namespace android {
#define DEFAULT_THUMB_WIDTH 160
#define DEFAULT_THUMB_HEIGHT 120
#define FRAME_RATE_FULL_HD 27
+#define FRAME_RATE_HIGH_HD 60
+
#define ZOOM_STAGES 61
#define FACE_DETECTION_BUFFER_SIZE 0x1000
@@ -116,27 +120,27 @@ namespace android {
#define OMX_CAMERA_PORT_IMAGE_OUT_IMAGE (OMX_CAMERA_PORT_IMAGE_START + 0)
-#define OMX_INIT_STRUCT(_s_, _name_) \
- memset(&(_s_), 0x0, sizeof(_name_)); \
- (_s_).nSize = sizeof(_name_); \
- (_s_).nVersion.s.nVersionMajor = 0x1; \
- (_s_).nVersion.s.nVersionMinor = 0x1; \
- (_s_).nVersion.s.nRevision = 0x0; \
+#define OMX_INIT_STRUCT(_s_, _name_) \
+ memset(&(_s_), 0x0, sizeof(_name_)); \
+ (_s_).nSize = sizeof(_name_); \
+ (_s_).nVersion.s.nVersionMajor = 0x1; \
+ (_s_).nVersion.s.nVersionMinor = 0x1; \
+ (_s_).nVersion.s.nRevision = 0x0; \
(_s_).nVersion.s.nStep = 0x0
#define OMX_INIT_STRUCT_PTR(_s_, _name_) \
- memset((_s_), 0x0, sizeof(_name_)); \
- (_s_)->nSize = sizeof(_name_); \
- (_s_)->nVersion.s.nVersionMajor = 0x1; \
- (_s_)->nVersion.s.nVersionMinor = 0x1; \
- (_s_)->nVersion.s.nRevision = 0x0; \
+ memset((_s_), 0x0, sizeof(_name_)); \
+ (_s_)->nSize = sizeof(_name_); \
+ (_s_)->nVersion.s.nVersionMajor = 0x1; \
+ (_s_)->nVersion.s.nVersionMinor = 0x1; \
+ (_s_)->nVersion.s.nRevision = 0x0; \
(_s_)->nVersion.s.nStep = 0x0
-#define GOTO_EXIT_IF(_CONDITION,_ERROR) { \
- if ((_CONDITION)) { \
- eError = (_ERROR); \
- goto EXIT; \
- } \
+#define GOTO_EXIT_IF(_CONDITION,_ERROR) { \
+ if ((_CONDITION)) { \
+ eError = (_ERROR); \
+ goto EXIT; \
+ } \
}
const int64_t kCameraBufferLatencyNs = 250000000LL; // 250 ms
@@ -167,15 +171,16 @@ struct CapPixelformat {
const char *param;
};
-struct CapU32 {
- OMX_U32 num;
+struct CapCodingFormat {
+ OMX_IMAGE_CODINGTYPE imageCodingFormat;
const char *param;
};
-struct CapU32Pair {
- OMX_U32 num1, num2;
+struct CapU32 {
+ OMX_U32 num;
const char *param;
};
+
struct CapS32 {
OMX_S32 num;
const char *param;
@@ -185,7 +190,6 @@ typedef CapU32 CapFramerate;
typedef CapU32 CapISO;
typedef CapU32 CapSensorName;
typedef CapS32 CapZoom;
-typedef CapS32 CapEVComp;
/**
* Class which completely abstracts the camera hardware interaction from camera hal
@@ -205,19 +209,14 @@ public:
///Five second timeout
static const int CAMERA_ADAPTER_TIMEOUT = 5000*1000;
- enum OMXCameraEvents
- {
- CAMERA_PORT_ENABLE = 0x1,
- CAMERA_PORT_FLUSH = 0x2,
- CAMERA_PORT_DISABLE = 0x4,
- };
-
enum CaptureMode
{
+ INITIAL_MODE = -1,
HIGH_SPEED = 1,
HIGH_QUALITY = 2,
VIDEO_MODE = 3,
HIGH_QUALITY_ZSL = 4,
+ CP_CAM = 5,
};
enum IPPMode
@@ -231,11 +230,9 @@ public:
enum CodingMode
{
- CodingNone = 0,
+ CodingJPEG = 0,
CodingJPS,
CodingMPO,
- CodingRAWJPEG,
- CodingRAWMPO,
};
enum Algorithm3A
@@ -264,10 +261,30 @@ public:
SetExpBracket = 1 << 2,
SetQuality = 1 << 3,
SetRotation = 1 << 4,
+ SetBurst = 1 << 5,
ECaptureSettingMax,
ECapturesettingsAll = ( ((ECaptureSettingMax -1 ) << 1) -1 ) /// all possible flags raised
};
+ enum PreviewSettingsFlags {
+ SetLDC = 1 << 0,
+ SetNSF = 1 << 1,
+ SetCapMode = 1 << 2,
+ SetVNF = 1 << 3,
+ SetVSTAB = 1 << 4,
+ EPreviewSettingMax,
+ EPreviewSettingsAll = ( ((EPreviewSettingMax -1 ) << 1) -1 ) /// all possible flags raised
+ };
+
+ enum BracketingValueMode {
+ BracketingValueAbsolute,
+ BracketingValueRelative,
+ BracketingValueAbsoluteForced,
+ BracketingValueRelativeForced,
+ BracketingValueCompensation,
+ BracketingValueCompensationForced
+ };
+
class GPSData
{
public:
@@ -309,8 +326,9 @@ public:
class OMXCameraPortParameters
{
public:
- OMX_U32 mHostBufaddr[MAX_NO_BUFFERS];
+ //CameraBuffer * mHostBufaddr[MAX_NO_BUFFERS];
OMX_BUFFERHEADERTYPE *mBufferHeader[MAX_NO_BUFFERS];
+ OMX_U8 mStatus[MAX_NO_BUFFERS];
OMX_U32 mWidth;
OMX_U32 mHeight;
OMX_U32 mStride;
@@ -328,9 +346,17 @@ public:
OMX_CONFIG_FRAMESTABTYPE mVidStabConfig;
OMX_U32 mCapFrame;
OMX_U32 mFrameRate;
- OMX_S32 mMinFrameRate;
- OMX_S32 mMaxFrameRate;
- CameraFrame::FrameType mImageType;
+ OMX_U32 mMinFrameRate;
+ OMX_U32 mMaxFrameRate;
+ CameraFrame::FrameType mImageType;
+ OMX_TI_STEREOFRAMELAYOUTTYPE mFrameLayoutType;
+
+ CameraBuffer * lookup_omx_buffer (OMX_BUFFERHEADERTYPE *pBufHeader);
+ enum {
+ IDLE = 0, // buffer is neither with HAL or Ducati
+ FILL, // buffer is with Ducati
+ DONE, // buffer is filled and sent to HAL
+ };
};
///Context of the OMX Camera component
@@ -344,9 +370,24 @@ public:
OMX_U32 mPrevPortIndex;
OMX_U32 mImagePortIndex;
OMX_U32 mMeasurementPortIndex;
+ OMX_U32 mVideoInPortIndex;
OMXCameraPortParameters mCameraPortParams[MAX_NO_PORTS];
};
+ class CachedCaptureParameters
+ {
+ public:
+ unsigned int mPendingCaptureSettings;
+ unsigned int mPictureRotation;
+ int mExposureBracketingValues[EXP_BRACKET_RANGE];
+ int mExposureGainBracketingValues[EXP_BRACKET_RANGE];
+ int mExposureGainBracketingModes[EXP_BRACKET_RANGE];
+ size_t mExposureBracketingValidEntries;
+ OMX_BRACKETMODETYPE mExposureBracketMode;
+ unsigned int mBurstFrames;
+ bool mFlushShotConfigQueue;
+ };
+
public:
OMXCameraAdapter(size_t sensor_index);
@@ -356,21 +397,22 @@ public:
virtual status_t initialize(CameraProperties::Properties*);
//APIs to configure Camera adapter and get the current parameter set
- virtual status_t setParameters(const CameraParameters& params);
- virtual void getParameters(CameraParameters& params);
+ virtual status_t setParameters(const android::CameraParameters& params);
+ virtual void getParameters(android::CameraParameters& params);
// API
- virtual status_t UseBuffersPreview(void* bufArr, int num);
+ status_t UseBuffersPreview(CameraBuffer *bufArr, int num);
- //API to flush the buffers for preview
- status_t flushBuffers();
+ //API to flush the buffers
+ status_t flushBuffers(OMX_U32 port = OMX_CAMERA_PORT_VIDEO_OUT_PREVIEW);
// API
virtual status_t setFormat(OMX_U32 port, OMXCameraPortParameters &cap);
// Function to get and populate caps from handle
- static status_t getCaps(CameraProperties::Properties* props, OMX_HANDLETYPE handle);
+ static status_t getCaps(int sensorId, CameraProperties::Properties* props, OMX_HANDLETYPE handle);
static const char* getLUTvalue_OMXtoHAL(int OMXValue, LUTtype LUT);
+ static int getMultipleLUTvalue_OMXtoHAL(int OMXValue, LUTtype LUT, char * supported);
static int getLUTvalue_HALtoOMX(const char * HalValue, LUTtype LUT);
OMX_ERRORTYPE OMXCameraAdapterEventHandler(OMX_IN OMX_HANDLETYPE hComponent,
@@ -385,7 +427,8 @@ public:
OMX_ERRORTYPE OMXCameraAdapterFillBufferDone(OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_BUFFERHEADERTYPE* pBuffHeader);
- static OMX_ERRORTYPE OMXCameraGetHandle(OMX_HANDLETYPE *handle, OMX_PTR pAppData=NULL);
+ static OMX_ERRORTYPE OMXCameraGetHandle(OMX_HANDLETYPE *handle, OMX_PTR pAppData,
+ const OMX_CALLBACKTYPE & callbacks);
protected:
@@ -402,10 +445,10 @@ protected:
virtual status_t stopVideoCapture();
virtual status_t startPreview();
virtual status_t stopPreview();
- virtual status_t useBuffers(CameraMode mode, void* bufArr, int num, size_t length, unsigned int queueable);
- virtual status_t fillThisBuffer(void* frameBuf, CameraFrame::FrameType frameType);
+ virtual status_t useBuffers(CameraMode mode, CameraBuffer * bufArr, int num, size_t length, unsigned int queueable);
+ virtual status_t fillThisBuffer(CameraBuffer * frameBuf, CameraFrame::FrameType frameType);
virtual status_t getFrameSize(size_t &width, size_t &height);
- virtual status_t getPictureBufferSize(size_t &length, size_t bufferCount);
+ virtual status_t getPictureBufferSize(CameraFrame &frame, size_t bufferCount);
virtual status_t getFrameDataSize(size_t &dataFrameSize, size_t bufferCount);
virtual status_t startFaceDetection();
virtual status_t stopFaceDetection();
@@ -414,11 +457,17 @@ protected:
private:
+ // Caches and returns current set of parameters
+ CachedCaptureParameters* cacheCaptureParameters();
+
status_t doSwitchToExecuting();
void performCleanupAfterError();
- status_t switchToLoaded();
+ status_t switchToIdle();
+
+ status_t switchToLoaded(bool bPortEnableRequired = false);
+ status_t prevPortEnable();
OMXCameraPortParameters *getPortParams(CameraFrame::FrameType frameType);
@@ -437,15 +486,21 @@ private:
OMX_IN OMX_EVENTTYPE eEvent,
OMX_IN OMX_U32 nData1,
OMX_IN OMX_U32 nData2,
- OMX_IN Semaphore &semaphore);
+ OMX_IN Utils::Semaphore &semaphore);
status_t setPictureRotation(unsigned int degree);
status_t setSensorOrientation(unsigned int degree);
status_t setImageQuality(unsigned int quality);
status_t setThumbnailParams(unsigned int width, unsigned int height, unsigned int quality);
+ status_t setSensorQuirks(int orientation,
+ OMXCameraPortParameters &portParams,
+ bool &portConfigured);
+
+ status_t setupTunnel(uint32_t SliceHeight, uint32_t EncoderHandle, uint32_t width, uint32_t height);
+ status_t destroyTunnel();
//EXIF
- status_t setParametersEXIF(const CameraParameters &params,
+ status_t setParametersEXIF(const android::CameraParameters &params,
BaseCameraAdapter::AdapterState state);
status_t convertGPSCoord(double coord, int &deg, int &min, int &sec, int &secDivisor);
status_t setupEXIF();
@@ -462,12 +517,12 @@ private:
//Focus distances
- status_t setParametersFocus(const CameraParameters &params,
+ status_t setParametersFocus(const android::CameraParameters &params,
BaseCameraAdapter::AdapterState state);
status_t addFocusDistances(OMX_U32 &near,
OMX_U32 &optimal,
OMX_U32 &far,
- CameraParameters& params);
+ android::CameraParameters& params);
status_t encodeFocusDistance(OMX_U32 dist, char *buffer, size_t length);
status_t getFocusDistances(OMX_U32 &near,OMX_U32 &optimal, OMX_U32 &far);
@@ -476,14 +531,17 @@ private:
status_t enableVideoStabilization(bool enable);
//Digital zoom
- status_t setParametersZoom(const CameraParameters &params,
+ status_t setParametersZoom(const android::CameraParameters &params,
BaseCameraAdapter::AdapterState state);
status_t doZoom(int index);
status_t advanceZoom();
//3A related parameters
- status_t setParameters3A(const CameraParameters &params,
+ status_t setParameters3A(const android::CameraParameters &params,
BaseCameraAdapter::AdapterState state);
+ void declareParameter3ABool(const android::CameraParameters &params, const char *key,
+ OMX_BOOL &current_setting, E3ASettingsFlags pending,
+ const char *msg);
// scene modes
status_t setScene(Gen3A_settings& Gen3A);
@@ -501,6 +559,7 @@ private:
//Exposure Modes
status_t setExposureMode(Gen3A_settings& Gen3A);
+ status_t setManualExposureVal(Gen3A_settings& Gen3A);
status_t setEVCompensation(Gen3A_settings& Gen3A);
status_t setWBMode(Gen3A_settings& Gen3A);
status_t setFlicker(Gen3A_settings& Gen3A);
@@ -512,6 +571,20 @@ private:
status_t setEffect(Gen3A_settings& Gen3A);
status_t setMeteringAreas(Gen3A_settings& Gen3A);
+ //TI extensions for enable/disable algos
+ status_t setParameter3ABool(const OMX_INDEXTYPE omx_idx,
+ const OMX_BOOL data, const char *msg);
+ status_t setParameter3ABoolInvert(const OMX_INDEXTYPE omx_idx,
+ const OMX_BOOL data, const char *msg);
+#ifndef OMAP_TUNA
+ status_t setAlgoFixedGamma(Gen3A_settings& Gen3A);
+ status_t setAlgoNSF1(Gen3A_settings& Gen3A);
+ status_t setAlgoNSF2(Gen3A_settings& Gen3A);
+ status_t setAlgoSharpening(Gen3A_settings& Gen3A);
+ status_t setAlgoThreeLinColorMap(Gen3A_settings& Gen3A);
+ status_t setAlgoGIC(Gen3A_settings& Gen3A);
+#endif
+
status_t getEVCompensation(Gen3A_settings& Gen3A);
status_t getWBMode(Gen3A_settings& Gen3A);
status_t getSharpness(Gen3A_settings& Gen3A);
@@ -524,10 +597,16 @@ private:
status_t setWhiteBalanceLock(Gen3A_settings& Gen3A);
status_t set3ALock(OMX_BOOL toggleExp, OMX_BOOL toggleWb, OMX_BOOL toggleFocus);
+ //Stereo 3D
+#ifndef OMAP_TUNA
+ void setParamS3D(OMX_U32 port, const char *valstr);
+ status_t setS3DFrameLayout(OMX_U32 port) const;
+#endif
+
//API to set FrameRate using VFR interface
status_t setVFramerate(OMX_U32 minFrameRate,OMX_U32 maxFrameRate);
- status_t setParametersAlgo(const CameraParameters &params,
+ status_t setParametersAlgo(const android::CameraParameters &params,
BaseCameraAdapter::AdapterState state);
//Noise filtering
@@ -548,18 +627,21 @@ private:
status_t setTouchFocus();
//Face detection
- status_t setParametersFD(const CameraParameters &params,
+ status_t setParametersFD(const android::CameraParameters &params,
BaseCameraAdapter::AdapterState state);
- status_t updateFocusDistances(CameraParameters &params);
+ status_t updateFocusDistances(android::CameraParameters &params);
+ status_t setFaceDetectionOrientation(OMX_U32 orientation);
status_t setFaceDetection(bool enable, OMX_U32 orientation);
- status_t detectFaces(OMX_BUFFERHEADERTYPE* pBuffHeader,
- sp<CameraFDResult> &result,
+ status_t createPreviewMetadata(OMX_BUFFERHEADERTYPE* pBuffHeader,
+ android::sp<CameraMetadataResult> &result,
size_t previewWidth,
size_t previewHeight);
status_t encodeFaceCoordinates(const OMX_FACEDETECTIONTYPE *faceData,
- camera_frame_metadata_t **pFaces,
+ camera_frame_metadata_t *metadataResult,
size_t previewWidth,
size_t previewHeight);
+ status_t encodePreviewMetadata(camera_frame_metadata_t *meta, const OMX_PTR plat_pvt);
+
void pauseFaceDetection(bool pause);
//3A Algorithms priority configuration
@@ -569,17 +651,29 @@ private:
status_t setSensorOverclock(bool enable);
// Utility methods for OMX Capabilities
+ static bool _checkOmxTiCap(const OMX_TI_CAPTYPE & caps);
+ static bool _dumpOmxTiCap(int sensorId, const OMX_TI_CAPTYPE & caps);
+
static status_t insertCapabilities(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t encodeSizeCap(OMX_TI_CAPRESTYPE&, const CapResolution *, size_t, char *, size_t);
static status_t encodeISOCap(OMX_U32, const CapISO*, size_t, char*, size_t);
static size_t encodeZoomCap(OMX_S32, const CapZoom*, size_t, char*, size_t);
- static status_t encodeFramerateCap(OMX_U32, OMX_U32, const CapFramerate*, size_t, char*, size_t);
- static status_t encodeVFramerateCap(OMX_TI_CAPTYPE&, const CapU32Pair*, size_t, char*, char*, size_t);
+ static void encodeFrameRates(int minFrameRate, int maxFrameRate, const OMX_TI_CAPTYPE & caps,
+ const CapFramerate * fixedFrameRates, int frameRateCount, android::Vector<FpsRange> & fpsRanges);
+ static status_t encodeImageCodingFormatCap(OMX_IMAGE_CODINGTYPE,
+ const CapCodingFormat *,
+ size_t,
+ char *);
static status_t encodePixelformatCap(OMX_COLOR_FORMATTYPE,
const CapPixelformat*,
size_t,
char*,
size_t);
+ static status_t encodeSizeCap3D(OMX_TI_CAPRESTYPE&,
+ const CapResolution*,
+ size_t ,
+ char * ,
+ size_t);
static status_t insertImageSizes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertPreviewSizes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertThumbSizes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
@@ -587,13 +681,13 @@ private:
static status_t insertImageFormats(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertPreviewFormats(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertFramerates(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
- static status_t insertVFramerates(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertEVs(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertISOModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertIPPModes(CameraProperties::Properties*, OMX_TI_CAPTYPE &);
static status_t insertWBModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertEffects(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertExpModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+ static status_t insertManualExpRanges(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertSceneModes(CameraProperties::Properties*, OMX_TI_CAPTYPE &);
static status_t insertFocusModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertFlickerModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
@@ -602,21 +696,55 @@ private:
static status_t insertDefaults(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertLocks(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertAreas(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+#ifndef OMAP_TUNA
+ static status_t insertMechanicalMisalignmentCorrection(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+#endif
+ static status_t insertCaptureModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
static status_t insertVideoSizes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
-
- status_t setParametersCapture(const CameraParameters &params,
+ static status_t insertFacing(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+ static status_t insertFocalLength(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+ static status_t insertAutoConvergenceModes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+ static status_t insertManualConvergenceRange(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+ static status_t insertLayout(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+ static status_t insertVideoSnapshotSupported(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+ static status_t insertVNFSupported(CameraProperties::Properties* params, OMX_TI_CAPTYPE &caps);
+ static status_t insertVSTABSupported(CameraProperties::Properties* params, OMX_TI_CAPTYPE &caps);
+ static status_t insertGBCESupported(CameraProperties::Properties* params,
+ const OMX_TI_CAPTYPE &caps);
+ static status_t insertGLBCESupported(CameraProperties::Properties* params,
+ const OMX_TI_CAPTYPE &caps);
+ static status_t insertRaw(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
+
+ status_t setParametersCapture(const android::CameraParameters &params,
BaseCameraAdapter::AdapterState state);
//Exposure Bracketing
- status_t setExposureBracketing(int *evValues, size_t evCount, size_t frameCount);
- status_t parseExpRange(const char *rangeStr, int * expRange, size_t count, size_t &validEntries);
+#ifndef OMAP_TUNA
+ status_t initVectorShot();
+ status_t setVectorShot(int *evValues, int *evValues2, int *evModes2,
+ size_t evCount, size_t frameCount,
+ bool flush, OMX_BRACKETMODETYPE bracketMode);
+#endif
+ status_t setVectorStop(bool toPreview = false);
+ status_t setExposureBracketing(int *evValues, int *evValues2,
+ size_t evCount, size_t frameCount,
+ OMX_BRACKETMODETYPE bracketMode);
+ status_t doExposureBracketing(int *evValues, int *evValues2,
+ int *evModes2,
+ size_t evCount, size_t frameCount,
+ bool flush,
+ OMX_BRACKETMODETYPE bracketMode);
+ int getBracketingValueMode(const char *a, const char *b) const;
+ status_t parseExpRange(const char *rangeStr, int *expRange, int *gainRange,
+ int *expGainModes,
+ size_t count, size_t &validEntries);
//Temporal Bracketing
status_t doBracketing(OMX_BUFFERHEADERTYPE *pBuffHeader, CameraFrame::FrameType typeOfFrame);
- status_t sendBracketFrames();
+ status_t sendBracketFrames(size_t &framesSent);
// Image Capture Service
- status_t startImageCapture();
+ status_t startImageCapture(bool bracketing, CachedCaptureParameters*);
status_t disableImagePort();
//Shutter callback notifications
@@ -624,34 +752,64 @@ private:
//Sets eithter HQ or HS mode and the frame count
status_t setCaptureMode(OMXCameraAdapter::CaptureMode mode);
- status_t UseBuffersCapture(void* bufArr, int num);
- status_t UseBuffersPreviewData(void* bufArr, int num);
+ status_t UseBuffersCapture(CameraBuffer *bufArr, int num);
+ status_t UseBuffersPreviewData(CameraBuffer *bufArr, int num);
+ status_t UseBuffersRawCapture(CameraBuffer *bufArr, int num);
//Used for calculation of the average frame rate during preview
status_t recalculateFPS();
- //Helper method for initializing a CameFrame object
- status_t initCameraFrame(CameraFrame &frame, OMX_IN OMX_BUFFERHEADERTYPE *pBuffHeader, int typeOfFrame, OMXCameraPortParameters *port);
-
//Sends the incoming OMX buffer header to subscribers
- status_t sendFrame(CameraFrame &frame);
-
status_t sendCallBacks(CameraFrame frame, OMX_IN OMX_BUFFERHEADERTYPE *pBuffHeader, unsigned int mask, OMXCameraPortParameters *port);
status_t apply3Asettings( Gen3A_settings& Gen3A );
- status_t init3AParams(Gen3A_settings &Gen3A);
// AutoConvergence
- status_t setAutoConvergence(OMX_TI_AUTOCONVERGENCEMODETYPE pACMode, OMX_S32 pManualConverence);
- status_t getAutoConvergence(OMX_TI_AUTOCONVERGENCEMODETYPE *pACMode, OMX_S32 *pManualConverence);
+ status_t setAutoConvergence(const char *valstr, const char *pValManualstr, const android::CameraParameters &params);
status_t setExtraData(bool enable, OMX_U32, OMX_EXT_EXTRADATATYPE);
- OMX_OTHER_EXTRADATATYPE *getExtradata(OMX_OTHER_EXTRADATATYPE *extraData, OMX_U32 extraDataSize, OMX_EXTRADATATYPE type);
+ OMX_OTHER_EXTRADATATYPE *getExtradata(const OMX_PTR ptrPrivate, OMX_EXTRADATATYPE type) const;
+
+ // Meta data
+#ifdef OMAP_ENHANCEMENT_CPCAM
+ camera_memory_t * getMetaData(const OMX_PTR plat_pvt,
+ camera_request_memory allocator) const;
+#endif
+
+#ifndef OMAP_TUNA
+ // Mechanical Misalignment Correction
+ status_t setMechanicalMisalignmentCorrection(bool enable);
+
+ // DCC file data save
+ status_t initDccFileDataSave(OMX_HANDLETYPE* omxHandle, int portIndex);
+ status_t sniffDccFileDataSave(OMX_BUFFERHEADERTYPE* pBuffHeader);
+ status_t saveDccFileDataSave();
+ status_t closeDccFileDataSave();
+ status_t fseekDCCuseCasePos(FILE *pFile);
+ FILE * fopenCameraDCC(const char *dccFolderPath);
+ FILE * parseDCCsubDir(DIR *pDir, char *path);
+#endif
+
+#ifdef CAMERAHAL_OMX_PROFILING
+ status_t storeProfilingData(OMX_BUFFERHEADERTYPE* pBuffHeader);
+#endif
+
+ // Internal buffers
+ status_t initInternalBuffers (OMX_U32);
+ status_t deinitInternalBuffers (OMX_U32);
+
+ // Reprocess Methods -- implementation in OMXReprocess.cpp
+ status_t setParametersReprocess(const android::CameraParameters &params, CameraBuffer* bufs,
+ BaseCameraAdapter::AdapterState state);
+ status_t startReprocess();
+ status_t disableReprocess();
+ status_t stopReprocess();
+ status_t UseBuffersReprocess(CameraBuffer *bufArr, int num);
- class CommandHandler : public Thread {
+ class CommandHandler : public android::Thread {
public:
CommandHandler(OMXCameraAdapter* ca)
- : Thread(false), mCameraAdapter(ca) { }
+ : android::Thread(false), mCameraAdapter(ca) { }
virtual bool threadLoop() {
bool ret;
@@ -659,38 +817,42 @@ private:
return ret;
}
- status_t put(TIUTILS::Message* msg){
- Mutex::Autolock lock(mLock);
+ status_t put(Utils::Message* msg){
+ android::AutoMutex lock(mLock);
return mCommandMsgQ.put(msg);
}
void clearCommandQ()
{
- Mutex::Autolock lock(mLock);
+ android::AutoMutex lock(mLock);
mCommandMsgQ.clear();
}
enum {
COMMAND_EXIT = -1,
CAMERA_START_IMAGE_CAPTURE = 0,
- CAMERA_PERFORM_AUTOFOCUS = 1,
+ CAMERA_PERFORM_AUTOFOCUS,
CAMERA_SWITCH_TO_EXECUTING,
+ CAMERA_START_REPROCESS
};
private:
bool Handler();
- TIUTILS::MessageQueue mCommandMsgQ;
+ Utils::MessageQueue mCommandMsgQ;
OMXCameraAdapter* mCameraAdapter;
- Mutex mLock;
+ android::Mutex mLock;
};
- sp<CommandHandler> mCommandHandler;
+ android::sp<CommandHandler> mCommandHandler;
public:
- class OMXCallbackHandler : public Thread {
+ class OMXCallbackHandler : public android::Thread {
public:
OMXCallbackHandler(OMXCameraAdapter* ca)
- : Thread(false), mCameraAdapter(ca) { }
+ : Thread(false), mCameraAdapter(ca)
+ {
+ mIsProcessed = true;
+ }
virtual bool threadLoop() {
bool ret;
@@ -698,31 +860,36 @@ public:
return ret;
}
- status_t put(TIUTILS::Message* msg){
- Mutex::Autolock lock(mLock);
+ status_t put(Utils::Message* msg){
+ android::AutoMutex lock(mLock);
+ mIsProcessed = false;
return mCommandMsgQ.put(msg);
}
void clearCommandQ()
{
- Mutex::Autolock lock(mLock);
+ android::AutoMutex lock(mLock);
mCommandMsgQ.clear();
}
+ void flush();
+
enum {
COMMAND_EXIT = -1,
CAMERA_FILL_BUFFER_DONE,
- CAMERA_FOCUS_STATUS,
+ CAMERA_FOCUS_STATUS
};
private:
bool Handler();
- TIUTILS::MessageQueue mCommandMsgQ;
+ Utils::MessageQueue mCommandMsgQ;
OMXCameraAdapter* mCameraAdapter;
- Mutex mLock;
+ android::Mutex mLock;
+ android::Condition mCondition;
+ bool mIsProcessed;
};
- sp<OMXCallbackHandler> mOMXCallbackHandler;
+ android::sp<OMXCallbackHandler> mOMXCallbackHandler;
private:
@@ -731,15 +898,36 @@ private:
//OMX Capabilities data
static const CapResolution mImageCapRes [];
+ static const CapResolution mImageCapResSS [];
+ static const CapResolution mImageCapResTB [];
static const CapResolution mPreviewRes [];
+ static const CapResolution mPreviewResSS [];
+ static const CapResolution mPreviewResTB [];
+ static const CapResolution mPreviewPortraitRes [];
static const CapResolution mThumbRes [];
static const CapPixelformat mPixelformats [];
+ static const userToOMX_LUT mFrameLayout [];
+ static const LUTtype mLayoutLUT;
+ static const CapCodingFormat mImageCodingFormat[];
static const CapFramerate mFramerates [];
static const CapU32 mSensorNames[] ;
static const CapZoom mZoomStages [];
- static const CapEVComp mEVCompRanges [];
static const CapISO mISOStages [];
- static const CapU32Pair mVarFramerates [];
+ static const int SENSORID_IMX060;
+ static const int SENSORID_OV5650;
+ static const int SENSORID_OV5640;
+ static const int SENSORID_OV14825;
+ static const int SENSORID_S5K4E1GA;
+ static const int SENSORID_S5K6A1GX03;
+ static const CapU32 mFacing [];
+ static const userToOMX_LUT mAutoConvergence [];
+ static const LUTtype mAutoConvergenceLUT;
+ static const userToOMX_LUT mBracketingModes[];
+ static const LUTtype mBracketingModesLUT;
+
+ static const int FPS_MIN;
+ static const int FPS_MAX;
+ static const int FPS_MAX_EXTENDED;
// OMX Camera defaults
static const char DEFAULT_ANTIBANDING[];
@@ -752,45 +940,54 @@ private:
static const char DEFAULT_FLASH_MODE[];
static const char DEFAULT_FOCUS_MODE_PREFERRED[];
static const char DEFAULT_FOCUS_MODE[];
- static const char DEFAULT_FRAMERATE_RANGE_IMAGE[];
- static const char DEFAULT_FRAMERATE_RANGE_VIDEO[];
static const char DEFAULT_IPP[];
- static const char DEFAULT_GBCE[];
static const char DEFAULT_ISO_MODE[];
static const char DEFAULT_JPEG_QUALITY[];
static const char DEFAULT_THUMBNAIL_QUALITY[];
static const char DEFAULT_THUMBNAIL_SIZE[];
static const char DEFAULT_PICTURE_FORMAT[];
+ static const char DEFAULT_S3D_PICTURE_LAYOUT[];
static const char DEFAULT_PICTURE_SIZE[];
+ static const char DEFAULT_PICTURE_SS_SIZE[];
+ static const char DEFAULT_PICTURE_TB_SIZE[];
static const char DEFAULT_PREVIEW_FORMAT[];
static const char DEFAULT_FRAMERATE[];
+ static const char DEFAULT_S3D_PREVIEW_LAYOUT[];
static const char DEFAULT_PREVIEW_SIZE[];
+ static const char DEFAULT_PREVIEW_SS_SIZE[];
+ static const char DEFAULT_PREVIEW_TB_SIZE[];
static const char DEFAULT_NUM_PREV_BUFS[];
static const char DEFAULT_NUM_PIC_BUFS[];
- static const char DEFAULT_MAX_FOCUS_AREAS[];
static const char DEFAULT_SATURATION[];
static const char DEFAULT_SCENE_MODE[];
static const char DEFAULT_SHARPNESS[];
- static const char DEFAULT_VSTAB[];
- static const char DEFAULT_VSTAB_SUPPORTED[];
+ static const char * DEFAULT_VSTAB;
+ static const char * DEFAULT_VNF;
static const char DEFAULT_WB[];
static const char DEFAULT_ZOOM[];
static const char DEFAULT_MAX_FD_HW_FACES[];
static const char DEFAULT_MAX_FD_SW_FACES[];
- static const char DEFAULT_AE_LOCK[];
- static const char DEFAULT_AWB_LOCK[];
- static const char DEFAULT_MAX_NUM_METERING_AREAS[];
- static const char DEFAULT_LOCK_SUPPORTED[];
- static const char DEFAULT_LOCK_UNSUPPORTED[];
- static const char DEFAULT_FOCAL_LENGTH_PRIMARY[];
- static const char DEFAULT_FOCAL_LENGTH_SECONDARY[];
+ static const char * DEFAULT_AE_LOCK;
+ static const char * DEFAULT_AWB_LOCK;
static const char DEFAULT_HOR_ANGLE[];
static const char DEFAULT_VER_ANGLE[];
- static const char DEFAULT_VIDEO_SNAPSHOT_SUPPORTED[];
static const char DEFAULT_VIDEO_SIZE[];
- static const char DEFAULT_PREFERRED_PREVIEW_SIZE_FOR_VIDEO[];
+ static const char DEFAULT_SENSOR_ORIENTATION[];
+ static const char DEFAULT_AUTOCONVERGENCE_MODE[];
+ static const char DEFAULT_MANUAL_CONVERGENCE[];
+ static const char * DEFAULT_MECHANICAL_MISALIGNMENT_CORRECTION_MODE;
+ static const char DEFAULT_EXIF_MODEL[];
+ static const char DEFAULT_EXIF_MAKE[];
+
static const size_t MAX_FOCUS_AREAS;
+#ifdef CAMERAHAL_OMX_PROFILING
+
+ static const char DEFAULT_PROFILE_PATH[];
+ int mDebugProfile;
+
+#endif
+
OMX_VERSIONTYPE mCompRevision;
//OMX Component UUID
@@ -803,31 +1000,53 @@ private:
char mFocusDistBuffer[FOCUS_DIST_BUFFER_SIZE];
// Current Focus areas
- Vector< sp<CameraArea> > mFocusAreas;
- mutable Mutex mFocusAreasLock;
+ android::Vector<android::sp<CameraArea> > mFocusAreas;
+ mutable android::Mutex mFocusAreasLock;
+
+ // Current Touch convergence areas
+ android::Vector<android::sp<CameraArea> > mTouchAreas;
+ mutable android::Mutex mTouchAreasLock;
// Current Metering areas
- Vector< sp<CameraArea> > mMeteringAreas;
- mutable Mutex mMeteringAreasLock;
+ android::Vector<android::sp<CameraArea> > mMeteringAreas;
+ mutable android::Mutex mMeteringAreasLock;
+ OperatingMode mCapabilitiesOpMode;
CaptureMode mCapMode;
+ // TODO(XXX): Do we really need this lock? Let's
+ // try to merge temporal bracketing and burst
+ // capture later
+ mutable android::Mutex mBurstLock;
size_t mBurstFrames;
+ size_t mBurstFramesAccum;
+ size_t mBurstFramesQueued;
size_t mCapturedFrames;
+ bool mFlushShotConfigQueue;
bool mMeasurementEnabled;
//Exposure Bracketing
int mExposureBracketingValues[EXP_BRACKET_RANGE];
+ int mExposureGainBracketingValues[EXP_BRACKET_RANGE];
+ int mExposureGainBracketingModes[EXP_BRACKET_RANGE];
size_t mExposureBracketingValidEntries;
+ OMX_BRACKETMODETYPE mExposureBracketMode;
+
+ //Zoom Bracketing
+ int mZoomBracketingValues[ZOOM_BRACKET_RANGE];
+ size_t mZoomBracketingValidEntries;
- mutable Mutex mFaceDetectionLock;
+ static const uint32_t FACE_DETECTION_THRESHOLD;
+ mutable android::Mutex mFaceDetectionLock;
//Face detection status
bool mFaceDetectionRunning;
bool mFaceDetectionPaused;
bool mFDSwitchAlgoPriority;
- camera_face_t faceDetectionLastOutput [MAX_NUM_FACES_SUPPORTED];
+ camera_face_t faceDetectionLastOutput[MAX_NUM_FACES_SUPPORTED];
int faceDetectionNumFacesLastOutput;
+ int metadataLastAnalogGain;
+ int metadataLastExposureTime;
//Geo-tagging
EXIFData mEXIFData;
@@ -857,7 +1076,7 @@ private:
unsigned int mZoomParameterIdx;
//current zoom
- Mutex mZoomLock;
+ android::Mutex mZoomLock;
unsigned int mCurrentZoomIdx, mTargetZoomIdx, mPreviousZoomIndx;
bool mZoomUpdating, mZoomUpdate;
int mZoomInc;
@@ -868,63 +1087,78 @@ private:
OMX_VERSIONTYPE mLocalVersionParam;
unsigned int mPending3Asettings;
- Mutex m3ASettingsUpdateLock;
+ android::Mutex m3ASettingsUpdateLock;
Gen3A_settings mParameters3A;
const char *mPictureFormatFromClient;
+ BrightnessMode mGBCE;
+ BrightnessMode mGLBCE;
+
OMX_TI_CONFIG_3A_FACE_PRIORITY mFacePriority;
OMX_TI_CONFIG_3A_REGION_PRIORITY mRegionPriority;
- CameraParameters mParams;
+ android::CameraParameters mParams;
CameraProperties::Properties* mCapabilities;
unsigned int mPictureRotation;
bool mWaitingForSnapshot;
- int mSnapshotCount;
bool mCaptureConfigured;
unsigned int mPendingCaptureSettings;
+ unsigned int mPendingPreviewSettings;
OMX_TI_ANCILLARYDATATYPE* mCaptureAncillaryData;
OMX_TI_WHITEBALANCERESULTTYPE* mWhiteBalanceData;
+ bool mReprocConfigured;
//Temporal bracketing management data
- mutable Mutex mBracketingLock;
+ bool mBracketingSet;
+ mutable android::Mutex mBracketingLock;
bool *mBracketingBuffersQueued;
int mBracketingBuffersQueuedCount;
int mLastBracetingBufferIdx;
bool mBracketingEnabled;
- int mBracketingRange;
+ bool mZoomBracketingEnabled;
+ size_t mBracketingRange;
+ int mCurrentZoomBracketing;
+ android::CameraParameters mParameters;
+#ifdef CAMERAHAL_TUNA
bool mIternalRecordingHint;
+#endif
- CameraParameters mParameters;
bool mOmxInitialized;
OMXCameraAdapterComponentContext mCameraAdapterParameters;
bool mFirstTimeInit;
///Semaphores used internally
- Semaphore mInitSem;
- Semaphore mFlushSem;
- Semaphore mUsePreviewDataSem;
- Semaphore mUsePreviewSem;
- Semaphore mUseCaptureSem;
- Semaphore mStartPreviewSem;
- Semaphore mStopPreviewSem;
- Semaphore mStartCaptureSem;
- Semaphore mStopCaptureSem;
- Semaphore mSwitchToLoadedSem;
- Semaphore mSwitchToExecSem;
-
- mutable Mutex mStateSwitchLock;
-
- Vector<struct TIUTILS::Message *> mEventSignalQ;
- Mutex mEventLock;
+ Utils::Semaphore mInitSem;
+ Utils::Semaphore mFlushSem;
+ Utils::Semaphore mUsePreviewDataSem;
+ Utils::Semaphore mUsePreviewSem;
+ Utils::Semaphore mUseCaptureSem;
+ Utils::Semaphore mStartPreviewSem;
+ Utils::Semaphore mStopPreviewSem;
+ Utils::Semaphore mStartCaptureSem;
+ Utils::Semaphore mStopCaptureSem;
+ Utils::Semaphore mSwitchToLoadedSem;
+ Utils::Semaphore mSwitchToExecSem;
+ Utils::Semaphore mStopReprocSem;
+ Utils::Semaphore mUseReprocessSem;
+
+ mutable android::Mutex mStateSwitchLock;
+ mutable android::Mutex mIdleStateSwitchLock;
+
+ android::Vector<Utils::Message *> mEventSignalQ;
+ android::Mutex mEventLock;
OMX_STATETYPE mComponentState;
+ OMX_TI_AUTOCONVERGENCEMODETYPE mAutoConv;
+ OMX_S32 mManualConv;
bool mVnfEnabled;
bool mVstabEnabled;
int mSensorOrientation;
int mDeviceOrientation;
+ int mFaceOrientation;
bool mSensorOverclock;
//Indicates if we should leave
@@ -936,11 +1170,15 @@ private:
int mLastFrameCount;
unsigned int mIter;
nsecs_t mLastFPSTime;
- Mutex mFrameCountMutex;
- Condition mFirstFrameCondition;
+ android::Mutex mFrameCountMutex;
+ android::Condition mFirstFrameCondition;
- Mutex mDoAFMutex;
- Condition mDoAFCond;
+ static const nsecs_t CANCEL_AF_TIMEOUT;
+ android::Mutex mCancelAFMutex;
+ android::Condition mCancelAFCond;
+
+ android::Mutex mDoAFMutex;
+ android::Condition mDoAFCond;
size_t mSensorIndex;
CodingMode mCodingMode;
@@ -949,14 +1187,33 @@ private:
OMX_TICKS mTimeSourceDelta;
bool onlyOnce;
- Semaphore mCaptureSem;
+ Utils::Semaphore mCaptureSem;
bool mCaptureSignalled;
OMX_BOOL mUserSetExpLock;
OMX_BOOL mUserSetWbLock;
- Mutex mImageCaptureLock;
+#ifdef CAMERAHAL_USE_RAW_IMAGE_SAVING
+ bool mRawCapture;
+ bool mYuvCapture;
+#endif
+
+ bool mSetFormatDone;
+
+#ifndef OMAP_TUNA
+ OMX_TI_DCCDATATYPE mDccData;
+ android::Mutex mDccDataLock;
+#endif
+
+ int mMaxZoomSupported;
+ android::Mutex mImageCaptureLock;
+
+ bool mTunnelDestroyed;
+ bool mPreviewPortInitialized;
+
};
-}; //// namespace
-#endif //OMX_CAMERA_ADAPTER_H
+} // namespace Camera
+} // namespace Ti
+
+#endif //OMX_CAMERA_ADAPTER_H
diff --git a/camera/inc/OMXCameraAdapter/OMXSceneModeTables.h b/camera/inc/OMXCameraAdapter/OMXSceneModeTables.h
index 205a87b..d57843e 100644
--- a/camera/inc/OMXCameraAdapter/OMXSceneModeTables.h
+++ b/camera/inc/OMXCameraAdapter/OMXSceneModeTables.h
@@ -32,6 +32,9 @@
#define ARRAY_SIZE(array) (sizeof((array)) / sizeof((array)[0]))
#endif
+namespace Ti {
+namespace Camera {
+
struct SceneModesEntry {
OMX_SCENEMODETYPE scene;
OMX_IMAGE_FLASHCONTROLTYPE flash;
@@ -239,9 +242,312 @@ static const SceneModesEntry S5K6A1GX03_SceneModesLUT [] = {
OMX_WhiteBalControlAuto },
};
+static const SceneModesEntry IMX060_SceneModesLUT [] = {
+ { OMX_Closeup,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlAutoMacro,
+ OMX_WhiteBalControlAuto },
+ { OMX_Landscape,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlSunLight },
+ { OMX_Underwater,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Sport,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_SnowBeach,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Mood,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_NightPortrait,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlPortrait,
+ OMX_WhiteBalControlAuto },
+ { OMX_NightIndoor,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Fireworks,
+ OMX_IMAGE_FlashControlOn,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Document,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlAutoMacro,
+ OMX_WhiteBalControlAuto },
+ { OMX_Barcode,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlAutoMacro,
+ OMX_WhiteBalControlAuto },
+ { OMX_SuperNight,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlAutoInfinity,
+ OMX_WhiteBalControlAuto },
+ { OMX_Cine,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_OldFilm,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Action,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Beach,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Candlelight,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlIncandescent },
+ { OMX_TI_Night,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Party,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlAutoLock,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Portrait,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Snow,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Steadyphoto,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Sunset,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ ( OMX_WHITEBALCONTROLTYPE ) OMX_TI_WhiteBalControlSunset },
+ { OMX_TI_Theatre,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+};
+
+static const SceneModesEntry OV5640_SceneModesLUT [] = {
+ { OMX_Closeup,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Landscape,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Underwater,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlSunLight },
+ { OMX_Sport,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlAutoInfinity,
+ OMX_WhiteBalControlAuto },
+ { OMX_SnowBeach,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Mood,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_NightPortrait,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_NightIndoor,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Fireworks,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Document,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Barcode,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_SuperNight,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Cine,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_OldFilm,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Action,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Beach,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Candlelight,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlIncandescent },
+ { OMX_TI_Night,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Party,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Portrait,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Snow,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Steadyphoto,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Sunset,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Theatre,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+};
+
+static const SceneModesEntry OV5650_SceneModesLUT [] = {
+ { OMX_Closeup,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Landscape,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlSunLight },
+ { OMX_Underwater,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Sport,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_SnowBeach,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Mood,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_NightPortrait,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlPortrait,
+ OMX_WhiteBalControlAuto },
+ { OMX_NightIndoor,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Fireworks,
+ OMX_IMAGE_FlashControlOn,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Document,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_Barcode,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_SuperNight,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlAutoInfinity,
+ OMX_WhiteBalControlAuto },
+ { OMX_Cine,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_OldFilm,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Action,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Beach,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Candlelight,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlIncandescent },
+ { OMX_TI_Night,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Party,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlAutoLock,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Portrait,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Snow,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Steadyphoto,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+ { OMX_TI_Sunset,
+ OMX_IMAGE_FlashControlAuto,
+ OMX_IMAGE_FocusControlHyperfocal,
+ ( OMX_WHITEBALCONTROLTYPE ) OMX_TI_WhiteBalControlSunset },
+ { OMX_TI_Theatre,
+ OMX_IMAGE_FlashControlOff,
+ OMX_IMAGE_FocusControlHyperfocal,
+ OMX_WhiteBalControlAuto },
+};
+
static const CameraToSensorModesLUTEntry CameraToSensorModesLUT [] = {
{ "S5K4E1GA", S5K4E1GA_SceneModesLUT, ARRAY_SIZE(S5K4E1GA_SceneModesLUT)},
{ "S5K6A1GX03", S5K6A1GX03_SceneModesLUT, ARRAY_SIZE(S5K6A1GX03_SceneModesLUT)},
+ { "IMX060", IMX060_SceneModesLUT, ARRAY_SIZE(IMX060_SceneModesLUT)},
+ { "OV5640", OV5640_SceneModesLUT, ARRAY_SIZE(OV5640_SceneModesLUT)},
+ { "OV5650", OV5650_SceneModesLUT, ARRAY_SIZE(OV5650_SceneModesLUT)},
};
+} // namespace Camera
+} // namespace Ti
+
#endif
diff --git a/camera/inc/SensorListener.h b/camera/inc/SensorListener.h
index 913eb95..44037b7 100644
--- a/camera/inc/SensorListener.h
+++ b/camera/inc/SensorListener.h
@@ -30,7 +30,10 @@
#include <gui/SensorEventQueue.h>
#include <utils/Looper.h>
-namespace android {
+#include "Common.h"
+
+namespace Ti {
+namespace Camera {
/**
* SensorListner class - Registers with sensor manager to get sensor events
@@ -38,11 +41,11 @@ namespace android {
typedef void (*orientation_callback_t) (uint32_t orientation, uint32_t tilt, void* cookie);
-class SensorLooperThread : public Thread {
+class SensorLooperThread : public android::Thread {
public:
- SensorLooperThread(Looper* looper)
+ SensorLooperThread(android::Looper* looper)
: Thread(false) {
- mLooper = sp<Looper>(looper);
+ mLooper = android::sp<android::Looper>(looper);
}
~SensorLooperThread() {
mLooper.clear();
@@ -58,11 +61,11 @@ class SensorLooperThread : public Thread {
mLooper->wake();
}
private:
- sp<Looper> mLooper;
+ android::sp<android::Looper> mLooper;
};
-class SensorListener : public RefBase
+class SensorListener : public android::RefBase
{
/* public - types */
public:
@@ -85,17 +88,18 @@ public:
void handleOrientation(uint32_t orientation, uint32_t tilt);
/* public - member variables */
public:
- sp<SensorEventQueue> mSensorEventQueue;
+ android::sp<android::SensorEventQueue> mSensorEventQueue;
/* private - member variables */
private:
int sensorsEnabled;
orientation_callback_t mOrientationCb;
void *mCbCookie;
- sp<Looper> mLooper;
- sp<SensorLooperThread> mSensorLooperThread;
- Mutex mLock;
+ android::sp<android::Looper> mLooper;
+ android::sp<SensorLooperThread> mSensorLooperThread;
+ android::Mutex mLock;
};
-}
+} // namespace Camera
+} // namespace Ti
#endif
diff --git a/camera/inc/TICameraParameters.h b/camera/inc/TICameraParameters.h
index 4701cae..84fa9fa 100644
--- a/camera/inc/TICameraParameters.h
+++ b/camera/inc/TICameraParameters.h
@@ -14,16 +14,14 @@
* limitations under the License.
*/
-
-
-
#ifndef TI_CAMERA_PARAMETERS_H
#define TI_CAMERA_PARAMETERS_H
#include <utils/KeyedVector.h>
#include <utils/String8.h>
-namespace android {
+namespace Ti {
+namespace Camera {
///TI Specific Camera Parameters
class TICameraParameters
@@ -36,35 +34,48 @@ static const char KEY_SUPPORTED_CAMERAS[];
// Select logical Camera index
static const char KEY_CAMERA[];
static const char KEY_CAMERA_NAME[];
-static const char KEY_S3D_SUPPORTED[];
static const char KEY_BURST[];
static const char KEY_CAP_MODE[];
+static const char KEY_CAP_MODE_VALUES[];
static const char KEY_VNF[];
+static const char KEY_VNF_SUPPORTED[];
static const char KEY_SATURATION[];
static const char KEY_BRIGHTNESS[];
-static const char KEY_EXPOSURE_MODE[];
static const char KEY_SUPPORTED_EXPOSURE[];
+static const char KEY_EXPOSURE_MODE[];
+static const char KEY_SUPPORTED_MANUAL_EXPOSURE_MIN[];
+static const char KEY_SUPPORTED_MANUAL_EXPOSURE_MAX[];
+static const char KEY_SUPPORTED_MANUAL_EXPOSURE_STEP[];
+static const char KEY_SUPPORTED_MANUAL_GAIN_ISO_MIN[];
+static const char KEY_SUPPORTED_MANUAL_GAIN_ISO_MAX[];
+static const char KEY_SUPPORTED_MANUAL_GAIN_ISO_STEP[];
+static const char KEY_MANUAL_EXPOSURE[];
+static const char KEY_MANUAL_EXPOSURE_RIGHT[];
+static const char KEY_MANUAL_GAIN_ISO[];
+static const char KEY_MANUAL_GAIN_ISO_RIGHT[];
static const char KEY_CONTRAST[];
static const char KEY_SHARPNESS[];
static const char KEY_ISO[];
static const char KEY_SUPPORTED_ISO_VALUES[];
static const char KEY_SUPPORTED_IPP[];
static const char KEY_IPP[];
-static const char KEY_MAN_EXPOSURE[];
static const char KEY_METERING_MODE[];
-static const char KEY_PADDED_WIDTH[];
-static const char KEY_PADDED_HEIGHT[];
static const char KEY_EXP_BRACKETING_RANGE[];
+static const char KEY_EXP_GAIN_BRACKETING_RANGE[];
+static const char KEY_ZOOM_BRACKETING_RANGE[];
static const char KEY_TEMP_BRACKETING[];
static const char KEY_TEMP_BRACKETING_RANGE_POS[];
static const char KEY_TEMP_BRACKETING_RANGE_NEG[];
+static const char KEY_FLUSH_SHOT_CONFIG_QUEUE[];
static const char KEY_SHUTTER_ENABLE[];
static const char KEY_MEASUREMENT_ENABLE[];
static const char KEY_INITIAL_VALUES[];
static const char KEY_GBCE[];
+static const char KEY_GBCE_SUPPORTED[];
static const char KEY_GLBCE[];
-static const char KEY_MINFRAMERATE[];
-static const char KEY_MAXFRAMERATE[];
+static const char KEY_GLBCE_SUPPORTED[];
+static const char KEY_FRAMERATE_RANGES_EXT_SUPPORTED[];
+static const char KEY_FRAMERATES_EXT_SUPPORTED[];
// TI recording hint to notify camera adapters of possible recording
static const char KEY_RECORDING_HINT[];
@@ -72,32 +83,18 @@ static const char KEY_AUTO_FOCUS_LOCK[];
static const char KEY_CURRENT_ISO[];
static const char KEY_SENSOR_ORIENTATION[];
-static const char KEY_SENSOR_ORIENTATION_VALUES[];
-
-//TI extensions for zoom
-static const char ZOOM_SUPPORTED[];
-static const char ZOOM_UNSUPPORTED[];
//TI extensions for camera capabilies
static const char INITIAL_VALUES_TRUE[];
static const char INITIAL_VALUES_FALSE[];
-//TI extensions for enabling/disabling measurements
-static const char MEASUREMENT_ENABLE[];
-static const char MEASUREMENT_DISABLE[];
-
// TI extensions to add values for ManualConvergence and AutoConvergence mode
-static const char KEY_AUTOCONVERGENCE[];
static const char KEY_AUTOCONVERGENCE_MODE[];
-static const char KEY_MANUALCONVERGENCE_VALUES[];
-
-//TI extensions for enabling/disabling GLBCE
-static const char GLBCE_ENABLE[];
-static const char GLBCE_DISABLE[];
-
-//TI extensions for enabling/disabling GBCE
-static const char GBCE_ENABLE[];
-static const char GBCE_DISABLE[];
+static const char KEY_AUTOCONVERGENCE_MODE_VALUES[];
+static const char KEY_MANUAL_CONVERGENCE[];
+static const char KEY_SUPPORTED_MANUAL_CONVERGENCE_MIN[];
+static const char KEY_SUPPORTED_MANUAL_CONVERGENCE_MAX[];
+static const char KEY_SUPPORTED_MANUAL_CONVERGENCE_STEP[];
// TI extensions to add Min frame rate Values
static const char VIDEO_MINFRAMERATE_5[];
@@ -109,16 +106,6 @@ static const char VIDEO_MINFRAMERATE_25[];
static const char VIDEO_MINFRAMERATE_30[];
static const char VIDEO_MINFRAMERATE_33[];
-// TI extensions for Manual Gain and Manual Exposure
-static const char KEY_MANUAL_EXPOSURE_LEFT[];
-static const char KEY_MANUAL_EXPOSURE_RIGHT[];
-static const char KEY_MANUAL_EXPOSURE_MODES[];
-static const char KEY_MANUAL_GAIN_EV_RIGHT[];
-static const char KEY_MANUAL_GAIN_EV_LEFT[];
-static const char KEY_MANUAL_GAIN_ISO_RIGHT[];
-static const char KEY_MANUAL_GAIN_ISO_LEFT[];
-static const char KEY_MANUAL_GAIN_MODES[];
-
//TI extensions for setting EXIF tags
static const char KEY_EXIF_MODEL[];
static const char KEY_EXIF_MAKE[];
@@ -128,13 +115,13 @@ static const char KEY_GPS_MAPDATUM[];
static const char KEY_GPS_VERSION[];
static const char KEY_GPS_DATESTAMP[];
-//TI extensions for enabling/disabling shutter sound
-static const char SHUTTER_ENABLE[];
-static const char SHUTTER_DISABLE[];
+// TI extensions for VTC
+static const char KEY_VTC_HINT[];
+static const char KEY_VIDEO_ENCODER_HANDLE[];
+static const char KEY_VIDEO_ENCODER_SLICE_HEIGHT[];
-//TI extensions for Temporal bracketing
-static const char BRACKET_ENABLE[];
-static const char BRACKET_DISABLE[];
+static const char RAW_WIDTH[];
+static const char RAW_HEIGHT[];
//TI extensions to Image post-processing
static const char IPP_LDCNSF[];
@@ -146,18 +133,19 @@ static const char IPP_NONE[];
static const char HIGH_PERFORMANCE_MODE[];
static const char HIGH_QUALITY_MODE[];
static const char HIGH_QUALITY_ZSL_MODE[];
+static const char CP_CAM_MODE[];
static const char VIDEO_MODE[];
-
+static const char EXPOSURE_BRACKETING[];
+static const char ZOOM_BRACKETING[];
+static const char TEMP_BRACKETING[];
// TI extensions to standard android pixel formats
-static const char PIXEL_FORMAT_RAW[];
+static const char PIXEL_FORMAT_UNUSED[];
static const char PIXEL_FORMAT_JPS[];
static const char PIXEL_FORMAT_MPO[];
-static const char PIXEL_FORMAT_RAW_JPEG[];
-static const char PIXEL_FORMAT_RAW_MPO[];
+static const char PIXEL_FORMAT_YUV422I_UYVY[];
// TI extensions to standard android scene mode settings
-static const char SCENE_MODE_SPORT[];
static const char SCENE_MODE_CLOSEUP[];
static const char SCENE_MODE_AQUA[];
static const char SCENE_MODE_SNOWBEACH[];
@@ -176,7 +164,7 @@ static const char WHITE_BALANCE_SUNSET[];
static const char WHITE_BALANCE_FACE[];
// TI extensions to add exposure preset modes to android api
-static const char EXPOSURE_MODE_OFF[];
+static const char EXPOSURE_MODE_MANUAL[];
static const char EXPOSURE_MODE_AUTO[];
static const char EXPOSURE_MODE_NIGHT[];
static const char EXPOSURE_MODE_BACKLIGHT[];
@@ -192,6 +180,7 @@ static const char EXPOSURE_MODE_FACE[];
static const char FOCUS_MODE_PORTRAIT[];
static const char FOCUS_MODE_EXTENDED[];
static const char FOCUS_MODE_FACE[];
+static const char FOCUS_MODE_OFF[];
// TI extensions to add iso values
static const char ISO_MODE_AUTO[];
@@ -209,17 +198,34 @@ static const char EFFECT_VIVID[];
static const char EFFECT_COLOR_SWAP[];
static const char EFFECT_BLACKWHITE[];
-static const char KEY_S3D2D_PREVIEW[];
-static const char KEY_S3D2D_PREVIEW_MODE[];
+//TI extensions for stereo frame layouts
+static const char KEY_S3D_PRV_FRAME_LAYOUT[];
+static const char KEY_S3D_PRV_FRAME_LAYOUT_VALUES[];
+static const char KEY_S3D_CAP_FRAME_LAYOUT[];
+static const char KEY_S3D_CAP_FRAME_LAYOUT_VALUES[];
+
+//TI extensions for stereo frame layouts
+static const char S3D_NONE[];
+static const char S3D_TB_FULL[];
+static const char S3D_SS_FULL[];
+static const char S3D_TB_SUBSAMPLED[];
+static const char S3D_SS_SUBSAMPLED[];
+
+//TI extentions fo 3D resolutions
+static const char KEY_SUPPORTED_PICTURE_SUBSAMPLED_SIZES[];
+static const char KEY_SUPPORTED_PICTURE_TOPBOTTOM_SIZES[];
+static const char KEY_SUPPORTED_PICTURE_SIDEBYSIDE_SIZES[];
+static const char KEY_SUPPORTED_PREVIEW_SUBSAMPLED_SIZES[];
+static const char KEY_SUPPORTED_PREVIEW_TOPBOTTOM_SIZES[];
+static const char KEY_SUPPORTED_PREVIEW_SIDEBYSIDE_SIZES[];
// TI extensions to add values for AutoConvergence settings.
static const char AUTOCONVERGENCE_MODE_DISABLE[];
static const char AUTOCONVERGENCE_MODE_FRAME[];
static const char AUTOCONVERGENCE_MODE_CENTER[];
-static const char AUTOCONVERGENCE_MODE_FFT[];
+static const char AUTOCONVERGENCE_MODE_TOUCH[];
static const char AUTOCONVERGENCE_MODE_MANUAL[];
-
//TI extensions for flash mode settings
static const char FLASH_MODE_FILL_IN[];
@@ -234,9 +240,20 @@ static const char ORIENTATION_SENSOR_270[];
static const char FACING_FRONT[];
static const char FACING_BACK[];
-};
+static const char KEY_MECHANICAL_MISALIGNMENT_CORRECTION_SUPPORTED[];
+static const char KEY_MECHANICAL_MISALIGNMENT_CORRECTION[];
+
+//TI extensions for enable/disable algos
+static const char KEY_ALGO_FIXED_GAMMA[];
+static const char KEY_ALGO_NSF1[];
+static const char KEY_ALGO_NSF2[];
+static const char KEY_ALGO_SHARPENING[];
+static const char KEY_ALGO_THREELINCOLORMAP[];
+static const char KEY_ALGO_GIC[];
};
-#endif
+} // namespace Camera
+} // namespace Ti
+#endif
diff --git a/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h b/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h
index b9d3952..cf277ac 100644
--- a/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h
+++ b/camera/inc/V4LCameraAdapter/V4LCameraAdapter.h
@@ -19,16 +19,40 @@
#ifndef V4L_CAMERA_ADAPTER_H
#define V4L_CAMERA_ADAPTER_H
+#include <linux/videodev2.h>
+
#include "CameraHal.h"
#include "BaseCameraAdapter.h"
#include "DebugUtils.h"
-namespace android {
+namespace Ti {
+namespace Camera {
#define DEFAULT_PIXEL_FORMAT V4L2_PIX_FMT_YUYV
+
#define NB_BUFFER 10
-#define DEVICE "/dev/video4"
+#define DEVICE "/dev/videoxx"
+#define DEVICE_PATH "/dev/"
+#define DEVICE_NAME "videoxx"
+
+typedef int V4L_HANDLETYPE;
+
+struct CapPixelformat {
+ uint32_t pixelformat;
+ const char *param;
+};
+
+struct CapResolution {
+ size_t width, height;
+ char param[10];
+};
+struct CapU32 {
+ uint32_t num;
+ const char *param;
+};
+
+typedef CapU32 CapFramerate;
struct VideoInfo {
struct v4l2_capability cap;
@@ -36,6 +60,7 @@ struct VideoInfo {
struct v4l2_buffer buf;
struct v4l2_requestbuffers rb;
void *mem[NB_BUFFER];
+ void *CaptureBuffers[NB_BUFFER];
bool isStreaming;
int width;
int height;
@@ -43,6 +68,16 @@ struct VideoInfo {
int framesizeIn;
};
+typedef struct V4L_TI_CAPTYPE {
+ uint16_t ulPreviewFormatCount; // supported preview pixelformat count
+ uint32_t ePreviewFormats[32];
+ uint16_t ulPreviewResCount; // supported preview resolution sizes
+ CapResolution tPreviewRes[32];
+ uint16_t ulCaptureResCount; // supported capture resolution sizes
+ CapResolution tCaptureRes[32];
+ uint16_t ulFrameRateCount; // supported frame rate
+ uint16_t ulFrameRates[32];
+}V4L_TI_CAPTYPE;
/**
* Class which completely abstracts the camera hardware interaction from camera hal
@@ -64,32 +99,35 @@ public:
public:
- V4LCameraAdapter();
+ V4LCameraAdapter(size_t sensor_index);
~V4LCameraAdapter();
///Initialzes the camera adapter creates any resources required
- virtual status_t initialize(CameraProperties::Properties*, int sensor_index=0);
+ virtual status_t initialize(CameraProperties::Properties*);
//APIs to configure Camera adapter and get the current parameter set
- virtual status_t setParameters(const CameraParameters& params);
- virtual void getParameters(CameraParameters& params);
+ virtual status_t setParameters(const android::CameraParameters& params);
+ virtual void getParameters(android::CameraParameters& params);
// API
- virtual status_t UseBuffersPreview(void* bufArr, int num);
+ virtual status_t UseBuffersPreview(CameraBuffer *bufArr, int num);
+ virtual status_t UseBuffersCapture(CameraBuffer *bufArr, int num);
- //API to flush the buffers for preview
- status_t flushBuffers();
+ static status_t getCaps(const int sensorId, CameraProperties::Properties* params, V4L_HANDLETYPE handle);
protected:
//----------Parent class method implementation------------------------------------
virtual status_t startPreview();
virtual status_t stopPreview();
- virtual status_t useBuffers(CameraMode mode, void* bufArr, int num, size_t length, unsigned int queueable);
- virtual status_t fillThisBuffer(void* frameBuf, CameraFrame::FrameType frameType);
+ virtual status_t takePicture();
+ virtual status_t stopImageCapture();
+ virtual status_t autoFocus();
+ virtual status_t useBuffers(CameraMode mode, CameraBuffer *bufArr, int num, size_t length, unsigned int queueable);
+ virtual status_t fillThisBuffer(CameraBuffer *frameBuf, CameraFrame::FrameType frameType);
virtual status_t getFrameSize(size_t &width, size_t &height);
- virtual status_t getPictureBufferSize(size_t &length, size_t bufferCount);
+ virtual status_t getPictureBufferSize(CameraFrame *frame, size_t bufferCount);
virtual status_t getFrameDataSize(size_t &dataFrameSize, size_t bufferCount);
virtual void onOrientationEvent(uint32_t orientation, uint32_t tilt);
//-----------------------------------------------------------------------------
@@ -97,13 +135,13 @@ protected:
private:
- class PreviewThread : public Thread {
+ class PreviewThread : public android::Thread {
V4LCameraAdapter* mAdapter;
public:
PreviewThread(V4LCameraAdapter* hw) :
Thread(false), mAdapter(hw) { }
virtual void onFirstRef() {
- run("CameraPreviewThread", PRIORITY_URGENT_DISPLAY);
+ run("CameraPreviewThread", android::PRIORITY_URGENT_DISPLAY);
}
virtual bool threadLoop() {
mAdapter->previewThread();
@@ -122,15 +160,56 @@ private:
public:
private:
+ //capabilities data
+ static const CapPixelformat mPixelformats [];
+ static const CapResolution mPreviewRes [];
+ static const CapFramerate mFramerates [];
+ static const CapResolution mImageCapRes [];
+
+ //camera defaults
+ static const char DEFAULT_PREVIEW_FORMAT[];
+ static const char DEFAULT_PREVIEW_SIZE[];
+ static const char DEFAULT_FRAMERATE[];
+ static const char DEFAULT_NUM_PREV_BUFS[];
+
+ static const char DEFAULT_PICTURE_FORMAT[];
+ static const char DEFAULT_PICTURE_SIZE[];
+ static const char DEFAULT_FOCUS_MODE[];
+ static const char * DEFAULT_VSTAB;
+ static const char * DEFAULT_VNF;
+
+ static status_t insertDefaults(CameraProperties::Properties*, V4L_TI_CAPTYPE&);
+ static status_t insertCapabilities(CameraProperties::Properties*, V4L_TI_CAPTYPE&);
+ static status_t insertPreviewFormats(CameraProperties::Properties* , V4L_TI_CAPTYPE&);
+ static status_t insertPreviewSizes(CameraProperties::Properties* , V4L_TI_CAPTYPE&);
+ static status_t insertImageSizes(CameraProperties::Properties* , V4L_TI_CAPTYPE&);
+ static status_t insertFrameRates(CameraProperties::Properties* , V4L_TI_CAPTYPE&);
+ static status_t sortAscend(V4L_TI_CAPTYPE&, uint16_t ) ;
+
+ status_t v4lIoctl(int, int, void*);
+ status_t v4lInitMmap(int&);
+ status_t v4lInitUsrPtr(int&);
+ status_t v4lStartStreaming();
+ status_t v4lStopStreaming(int nBufferCount);
+ status_t v4lSetFormat(int, int, uint32_t);
+ status_t restartPreview();
+
+
int mPreviewBufferCount;
- KeyedVector<int, int> mPreviewBufs;
- mutable Mutex mPreviewBufsLock;
+ int mPreviewBufferCountQueueable;
+ int mCaptureBufferCount;
+ int mCaptureBufferCountQueueable;
+ android::KeyedVector<CameraBuffer *, int> mPreviewBufs;
+ android::KeyedVector<CameraBuffer *, int> mCaptureBufs;
+ mutable android::Mutex mPreviewBufsLock;
+ mutable android::Mutex mCaptureBufsLock;
+ mutable android::Mutex mStopPreviewLock;
- CameraParameters mParams;
+ android::CameraParameters mParams;
bool mPreviewing;
bool mCapturing;
- Mutex mLock;
+ android::Mutex mLock;
int mFrameCount;
int mLastFrameCount;
@@ -142,17 +221,18 @@ private:
int mSensorIndex;
- // protected by mLock
- sp<PreviewThread> mPreviewThread;
-
- struct VideoInfo *mVideoInfo;
- int mCameraHandle;
+ // protected by mLock
+ android::sp<PreviewThread> mPreviewThread;
+ struct VideoInfo *mVideoInfo;
+ int mCameraHandle;
int nQueued;
int nDequeued;
};
-}; //// namespace
-#endif //V4L_CAMERA_ADAPTER_H
+} // namespace Camera
+} // namespace Ti
+
+#endif //V4L_CAMERA_ADAPTER_H