summaryrefslogtreecommitdiffstats
path: root/camera/inc
diff options
context:
space:
mode:
authorAkwasi Boateng <akwasi.boateng@ti.com>2011-09-15 11:53:05 -0500
committerIliyan Malchev <malchev@google.com>2011-10-07 11:02:14 -0700
commit72b0d2814165e633385bd87a838fc9c3a8250113 (patch)
tree8bd89c63958d9ce430149729f53fa36b35dd0ef7 /camera/inc
parent9a412956d5327ec851ff8adc3e9804640fa30c7f (diff)
downloadhardware_ti_omap4xxx-72b0d2814165e633385bd87a838fc9c3a8250113.zip
hardware_ti_omap4xxx-72b0d2814165e633385bd87a838fc9c3a8250113.tar.gz
hardware_ti_omap4xxx-72b0d2814165e633385bd87a838fc9c3a8250113.tar.bz2
omap4xxx: camera: send different preview and video buffers for MMS mode
Fixes b/5265389 b/5156090 1. Add support to send different preview and video buffers to framework in MMS mode. 2. For resolutions less than or equal to QVGA, preview resolution will be changed to a bigger resolution matching the aspect ratio of the preview resolution. 3. During record the changed resolution will be resized to the original resolution and sent to the encoder. 4. Modified NV12 resizer routine to account for frame offset and stride to avoid double memcpy of the buffers Change-Id: If66aa1fd861078d0a63b4a77a1bdc20d4c6bccda Signed-off-by: Akwasi Boateng <akwasi.boateng@ti.com> Signed-off-by: Iliyan Malchev <malchev@google.com>
Diffstat (limited to 'camera/inc')
-rw-r--r--camera/inc/CameraHal.h27
-rw-r--r--camera/inc/CameraProperties.h4
-rw-r--r--camera/inc/NV12_resize.h147
-rw-r--r--camera/inc/OMXCameraAdapter/OMXCameraAdapter.h3
4 files changed, 178 insertions, 3 deletions
diff --git a/camera/inc/CameraHal.h b/camera/inc/CameraHal.h
index 4fb297c..07f084f 100644
--- a/camera/inc/CameraHal.h
+++ b/camera/inc/CameraHal.h
@@ -43,6 +43,9 @@
#include "DebugUtils.h"
#include "SensorListener.h"
+#include <ui/GraphicBufferAllocator.h>
+#include <ui/GraphicBuffer.h>
+
#define MIN_WIDTH 640
#define MIN_HEIGHT 480
#define PICTURE_WIDTH 3264 /* 5mp - 2560. 8mp - 3280 */ /* Make sure it is a multiple of 16. */
@@ -73,6 +76,7 @@
#define PPM_INSTRUMENTATION_ABS 1
#define LOCK_BUFFER_TRIES 5
+#define HAL_PIXEL_FORMAT_NV12 0x100
//Uncomment to enable more verbose/debug logs
//#define DEBUG_LOG
@@ -565,13 +569,18 @@ public:
//Notifications from CameraHal for video recording case
status_t startRecording();
status_t stopRecording();
- status_t initSharedVideoBuffers(void *buffers, uint32_t *offsets, int fd, size_t length, size_t count);
+ status_t initSharedVideoBuffers(void *buffers, uint32_t *offsets, int fd, size_t length, size_t count, void *vidBufs);
status_t releaseRecordingFrame(const void *opaque);
status_t useMetaDataBufferMode(bool enable);
void EncoderDoneCb(size_t jpeg_size, uint8_t* src, CameraFrame::FrameType type, void* cookie1, void* cookie2);
+ void useVideoBuffers(bool useVideoBuffers);
+
+ bool getUesVideoBuffers();
+ void setVideoRes(int width, int height);
+
//Internal class definitions
class NotificationThread : public Thread {
AppCallbackNotifier* mAppCallbackNotifier;
@@ -653,6 +662,11 @@ private:
CameraParameters mParameters;
+ bool mUseVideoBuffers;
+
+ int mVideoWidth;
+ int mVideoHeight;
+
};
@@ -1097,7 +1111,7 @@ private:
status_t allocPreviewBufs(int width, int height, const char* previewFormat, unsigned int bufferCount, unsigned int &max_queueable);
/** Allocate video buffers */
- status_t allocVideoBufs(int width, int height, const char* previewFormat);
+ 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, size_t length, const char* previewFormat, unsigned int bufferCount);
@@ -1106,7 +1120,7 @@ private:
status_t freePreviewBufs();
/** Free video bufs */
- status_t freeVideoBufs();
+ status_t freeVideoBufs(void *bufs);
//Check if a given resolution is supported by the current camera
//instance
@@ -1133,6 +1147,9 @@ private:
void selectFPSRange(int framerate, int *min_fps, int *max_fps);
+ void setPreferredPreviewRes(int width, int height);
+ void resetPreviewRes(CameraParameters *mParams, int width, int height);
+
//@}
@@ -1235,6 +1252,10 @@ private:
uint32_t mPreviewWidth;
uint32_t mPreviewHeight;
int32_t mMaxZoomSupported;
+
+ int mVideoWidth;
+ int mVideoHeight;
+
};
diff --git a/camera/inc/CameraProperties.h b/camera/inc/CameraProperties.h
index c8d0135..7b9dbd2 100644
--- a/camera/inc/CameraProperties.h
+++ b/camera/inc/CameraProperties.h
@@ -136,6 +136,10 @@ public:
static const char VIDEO_SNAPSHOT_SUPPORTED[];
+ static const char VIDEO_SIZE[];
+ static const char SUPPORTED_VIDEO_SIZES[];
+ static const char PREFERRED_PREVIEW_SIZE_FOR_VIDEO[];
+
CameraProperties();
~CameraProperties();
diff --git a/camera/inc/NV12_resize.h b/camera/inc/NV12_resize.h
new file mode 100644
index 0000000..64afcea
--- /dev/null
+++ b/camera/inc/NV12_resize.h
@@ -0,0 +1,147 @@
+#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;
+} 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}},
+
+ {{56, 8, 0, 0}, {49, 7, 1, 7}, {42, 6, 2,14}, {35, 5, 3,21},
+ {28, 4, 4,28}, {21, 3, 5,35}, {14, 2, 6,42}, { 7, 1, 7,49}},
+
+ {{48,16, 0, 0}, {42,14, 2, 6}, {36,12,4 ,12}, {30,10,6 ,18},
+ {24, 8, 8,24}, {18, 6,10,30}, {12,4 ,12,36}, { 6, 2,14,42}},
+
+ {{40,24,0 ,0 }, {35,21, 3, 5}, {30,18, 6,10}, {25,15, 9,15},
+ {20,12,12,20}, {15, 9,15,25}, {10, 6,18,30}, { 5, 3,21,35}},
+
+ {{32,32, 0,0 }, {28,28, 4, 4}, {24,24, 8, 8}, {20,20,12,12},
+ {16,16,16,16}, {12,12,20,20}, { 8, 8,24,24}, { 4, 4,28,28}},
+
+ {{24,40,0 ,0 }, {21,35, 5, 3}, {18,30,10, 6}, {15,25,15, 9},
+ {12,20,20,12}, { 9,15,25,15}, { 6,10,30,18}, { 3, 5,35,21}},
+
+ {{16,48, 0,0 }, {14,42, 6, 2}, {12,36,12, 4}, {10,30,18, 6},
+ {8 ,24,24,8 }, { 6,18,30,10}, { 4,12,36,12}, { 2, 6,42,14}},
+
+ {{ 8,56, 0,0 }, { 7,49, 7, 1}, { 6,42,14, 2}, { 5,35,21, 3},
+ { 4,28,28,4 }, { 3,21,35, 5}, { 2,14,42, 6}, { 1,7 ,49, 7}}
+};
+
+typedef enum
+{
+ IC_FORMAT_NONE,
+ IC_FORMAT_RGB565,
+ IC_FORMAT_RGB888,
+ IC_FORMAT_YCbCr420_lp,
+ IC_FORMAT_YCbCr,
+ IC_FORMAT_YCbCr420_FRAME_PK,
+ IC_FORMAT_MAX
+}enumImageFormat;
+
+/* This structure defines the format of an image */
+typedef struct
+{
+ mmInt32 uWidth;
+ mmInt32 uHeight;
+ 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 */
+} IC_rect_type;
+
+/*==========================================================================
+* Function Name : VT_resizeFrame_Video_opt2_lp
+*
+* Description : Resize a yuv frame.
+*
+* Input(s) : input_img_ptr -> Input Image Structure
+* : output_img_ptr -> Output Image Structure
+* : cropout -> crop structure
+*
+* Value Returned : mmBool -> FALSE on error TRUE on success
+* NOTE:
+* Not tested for crop funtionallity.
+* 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
+
+#endif //#define NV12_RESIZE_H_
diff --git a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
index ddb22cb..6701aa6 100644
--- a/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
+++ b/camera/inc/OMXCameraAdapter/OMXCameraAdapter.h
@@ -570,6 +570,7 @@ 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&);
+ static status_t insertVideoSizes(CameraProperties::Properties*, OMX_TI_CAPTYPE&);
status_t setParametersCapture(const CameraParameters &params,
BaseCameraAdapter::AdapterState state);
@@ -730,6 +731,8 @@ private:
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 size_t MAX_FOCUS_AREAS;
OMX_VERSIONTYPE mCompRevision;